@kjun-ui/native 0.14.0 → 0.16.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 +364 -302
- package/dist/index.js +234 -170
- package/dist/index.web.cjs +375 -313
- package/dist/index.web.js +238 -174
- package/dist/styles.css +26 -3
- 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 +9 -2
- package/dist/types/packages/native/src/list.d.ts +9 -2
- 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/packages/native/src/popover.d.cts +6 -1
- package/dist/types/packages/native/src/popover.d.ts +6 -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) {
|
|
@@ -4174,7 +4196,7 @@ function KjunFilterGroup({
|
|
|
4174
4196
|
paddingHorizontal: { xs: tokens22.dimension.value8, sm: tokens22.dimension.value12, md: tokens22.dimension.value12, lg: tokens22.dimension.value14, xl: tokens22.dimension.value16 }[size],
|
|
4175
4197
|
// Corners follow the button scale with the height, so every size keeps the same shape.
|
|
4176
4198
|
borderRadius: tokens22.button.radii[size],
|
|
4177
|
-
backgroundColor: active ? colors.
|
|
4199
|
+
backgroundColor: active ? colors.filterSelectedBg : colors.secondary
|
|
4178
4200
|
},
|
|
4179
4201
|
children: [
|
|
4180
4202
|
option.dot && /* @__PURE__ */ jsx23(
|
|
@@ -4193,7 +4215,7 @@ function KjunFilterGroup({
|
|
|
4193
4215
|
{
|
|
4194
4216
|
name: option.icon,
|
|
4195
4217
|
size: tokens22.extensions.selection.iconSize,
|
|
4196
|
-
color: active ? colors.
|
|
4218
|
+
color: active ? colors.filterSelectedText : colors.textSecondary
|
|
4197
4219
|
}
|
|
4198
4220
|
),
|
|
4199
4221
|
/* @__PURE__ */ jsxs13(View18, { children: [
|
|
@@ -4216,7 +4238,7 @@ function KjunFilterGroup({
|
|
|
4216
4238
|
right: 0,
|
|
4217
4239
|
top: 0,
|
|
4218
4240
|
...selectionTypeStyle(size, active),
|
|
4219
|
-
color: active ? colors.
|
|
4241
|
+
color: active ? colors.filterSelectedText : colors.textSecondary
|
|
4220
4242
|
},
|
|
4221
4243
|
children: option.label
|
|
4222
4244
|
}
|
|
@@ -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);
|
|
@@ -4911,7 +4939,10 @@ function KjunPopover({
|
|
|
4911
4939
|
] });
|
|
4912
4940
|
}
|
|
4913
4941
|
function KjunTooltip({
|
|
4914
|
-
content:
|
|
4942
|
+
content: body = "",
|
|
4943
|
+
title,
|
|
4944
|
+
align,
|
|
4945
|
+
width,
|
|
4915
4946
|
placement = "top",
|
|
4916
4947
|
delay = 0,
|
|
4917
4948
|
children,
|
|
@@ -4920,13 +4951,14 @@ function KjunTooltip({
|
|
|
4920
4951
|
open: controlled,
|
|
4921
4952
|
onOpenChange
|
|
4922
4953
|
}) {
|
|
4923
|
-
const
|
|
4954
|
+
const message = [title, body].filter(Boolean).join(", ");
|
|
4955
|
+
const { colors } = useKjunStyles(), [internal, setInternal] = useState18(false), open = controlled != null ? controlled : internal, latest = useRef20({ open, onOpenChange }), setOpen = (value) => {
|
|
4924
4956
|
var _a, _b;
|
|
4925
4957
|
if (latest.current.open === value) return;
|
|
4926
4958
|
latest.current.open = value;
|
|
4927
4959
|
setInternal(value);
|
|
4928
4960
|
(_b = (_a = latest.current).onOpenChange) == null ? void 0 : _b.call(_a, value);
|
|
4929
|
-
}, ref =
|
|
4961
|
+
}, ref = useRef20(null), timer = useRef20(void 0);
|
|
4930
4962
|
latest.current = { open, onOpenChange };
|
|
4931
4963
|
const scopeActive = useActiveLayerScope();
|
|
4932
4964
|
const hide = () => {
|
|
@@ -4938,11 +4970,11 @@ function KjunTooltip({
|
|
|
4938
4970
|
clearTimeout(timer.current);
|
|
4939
4971
|
timer.current = setTimeout(() => setOpen(true), delay);
|
|
4940
4972
|
};
|
|
4941
|
-
|
|
4973
|
+
useEffect14(() => {
|
|
4942
4974
|
if (!scopeActive) hide();
|
|
4943
4975
|
}, [scopeActive]);
|
|
4944
|
-
|
|
4945
|
-
|
|
4976
|
+
useEffect14(() => () => clearTimeout(timer.current), []);
|
|
4977
|
+
useEffect14(() => {
|
|
4946
4978
|
if (Platform17.OS !== "web" || !open) return;
|
|
4947
4979
|
const escape = (event) => {
|
|
4948
4980
|
if (event.key === "Escape") hide();
|
|
@@ -5005,25 +5037,29 @@ function KjunTooltip({
|
|
|
5005
5037
|
triggerRef: ref,
|
|
5006
5038
|
placement,
|
|
5007
5039
|
ariaLabel: message,
|
|
5008
|
-
children: /* @__PURE__ */
|
|
5040
|
+
children: /* @__PURE__ */ jsxs16(
|
|
5009
5041
|
View21,
|
|
5010
5042
|
{
|
|
5011
5043
|
style: {
|
|
5012
5044
|
paddingVertical: tokens26.extensions.tooltip.paddingY,
|
|
5013
5045
|
paddingHorizontal: tokens26.extensions.tooltip.paddingX,
|
|
5014
|
-
maxWidth: tokens26.extensions.tooltip.maxWidth,
|
|
5046
|
+
maxWidth: width ? tokens26.extensions.tooltip.maxWidths[width] : tokens26.extensions.tooltip.maxWidth,
|
|
5015
5047
|
backgroundColor: colors.chartTooltipBg
|
|
5016
5048
|
},
|
|
5017
|
-
children:
|
|
5018
|
-
KText,
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5049
|
+
children: [
|
|
5050
|
+
!!title && /* @__PURE__ */ jsx27(KText, { style: { ...typeStyle("controlSmall"), color: colors.chartTooltipText, ...align ? { textAlign: align === "center" ? "center" : "left" } : {} }, children: title }),
|
|
5051
|
+
!!body && /* @__PURE__ */ jsx27(
|
|
5052
|
+
KText,
|
|
5053
|
+
{
|
|
5054
|
+
style: {
|
|
5055
|
+
...typeStyle("caption"),
|
|
5056
|
+
color: colors.chartTooltipText,
|
|
5057
|
+
...align ? { textAlign: align === "center" ? "center" : "left" } : {}
|
|
5058
|
+
},
|
|
5059
|
+
children: body
|
|
5060
|
+
}
|
|
5061
|
+
)
|
|
5062
|
+
]
|
|
5027
5063
|
}
|
|
5028
5064
|
)
|
|
5029
5065
|
}
|
|
@@ -5047,7 +5083,7 @@ function KjunDropdown({
|
|
|
5047
5083
|
onClose
|
|
5048
5084
|
}) {
|
|
5049
5085
|
const m = useKjunMessages();
|
|
5050
|
-
const [open, setOpen] = useState19(false), currentOpen =
|
|
5086
|
+
const [open, setOpen] = useState19(false), currentOpen = useRef21(false), ref = useRef21(null);
|
|
5051
5087
|
let control = trigger;
|
|
5052
5088
|
while (isValidElement6(control) && control.type === KjunTooltip)
|
|
5053
5089
|
control = control.props.children;
|
|
@@ -5059,7 +5095,7 @@ function KjunDropdown({
|
|
|
5059
5095
|
if (v) onOpen == null ? void 0 : onOpen();
|
|
5060
5096
|
else onClose == null ? void 0 : onClose();
|
|
5061
5097
|
};
|
|
5062
|
-
|
|
5098
|
+
useEffect15(() => {
|
|
5063
5099
|
if (unavailable) change(false);
|
|
5064
5100
|
}, [unavailable]);
|
|
5065
5101
|
return /* @__PURE__ */ jsxs17(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -5195,7 +5231,7 @@ function KjunMenuButton({
|
|
|
5195
5231
|
}
|
|
5196
5232
|
|
|
5197
5233
|
// shared/package-runtime/combobox.ts
|
|
5198
|
-
import { useEffect as
|
|
5234
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
5199
5235
|
|
|
5200
5236
|
// shared/package-runtime/options.ts
|
|
5201
5237
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -5275,8 +5311,8 @@ function useComboboxModel({
|
|
|
5275
5311
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
5276
5312
|
const [query, setQuery] = useState20(selectedLabel);
|
|
5277
5313
|
const [open, setOpen] = useState20(false);
|
|
5278
|
-
|
|
5279
|
-
|
|
5314
|
+
useEffect16(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
5315
|
+
useEffect16(() => {
|
|
5280
5316
|
if (disabled) setOpen(false);
|
|
5281
5317
|
}, [disabled]);
|
|
5282
5318
|
const change = (next) => {
|
|
@@ -5310,7 +5346,7 @@ function useComboboxModel({
|
|
|
5310
5346
|
|
|
5311
5347
|
// packages/native/src/combobox.tsx
|
|
5312
5348
|
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5313
|
-
import { useId as useId5, useRef as
|
|
5349
|
+
import { useId as useId5, useRef as useRef22 } from "react";
|
|
5314
5350
|
import { Platform as Platform18, View as View24 } from "react-native";
|
|
5315
5351
|
|
|
5316
5352
|
// packages/native/src/select-options.tsx
|
|
@@ -5440,8 +5476,8 @@ function SearchField({
|
|
|
5440
5476
|
}) {
|
|
5441
5477
|
const m = useKjunMessages();
|
|
5442
5478
|
const searchId = "kjun-popup-search-" + useId5().replace(/:/g, "");
|
|
5443
|
-
const clearing =
|
|
5444
|
-
const ref =
|
|
5479
|
+
const clearing = useRef22(false);
|
|
5480
|
+
const ref = useRef22(null), { colors } = useKjunStyles();
|
|
5445
5481
|
const focusGuard = usePopupFocusGuard(ref);
|
|
5446
5482
|
const openFromPress = () => {
|
|
5447
5483
|
if (!disabled) {
|
|
@@ -5541,7 +5577,7 @@ function SearchField({
|
|
|
5541
5577
|
|
|
5542
5578
|
// packages/native/src/date-picker.tsx
|
|
5543
5579
|
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5544
|
-
import { useRef as
|
|
5580
|
+
import { useRef as useRef23, useState as useState21 } from "react";
|
|
5545
5581
|
import { Platform as Platform19, View as View25 } from "react-native";
|
|
5546
5582
|
import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5547
5583
|
function displayMonth(value) {
|
|
@@ -5564,7 +5600,7 @@ function KjunDatePicker({
|
|
|
5564
5600
|
const scope = useKjunMessageScope();
|
|
5565
5601
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5566
5602
|
const clear = clearable && !!value && !disabled;
|
|
5567
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref =
|
|
5603
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref = useRef23(null), spec = tokens30.input[size];
|
|
5568
5604
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5569
5605
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5570
5606
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5742,7 +5778,7 @@ function KjunDatePicker({
|
|
|
5742
5778
|
import { useState as useState23 } from "react";
|
|
5743
5779
|
|
|
5744
5780
|
// shared/package-runtime/search-input.ts
|
|
5745
|
-
import { useEffect as
|
|
5781
|
+
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect12, useRef as useRef24, useState as useState22 } from "react";
|
|
5746
5782
|
function useSearchInputModel({
|
|
5747
5783
|
value,
|
|
5748
5784
|
disabled = false,
|
|
@@ -5752,10 +5788,10 @@ function useSearchInputModel({
|
|
|
5752
5788
|
onValueChange,
|
|
5753
5789
|
onSearchError
|
|
5754
5790
|
}, open) {
|
|
5755
|
-
const [query, setQuery] = useState22(value), [options, setOptions] = useState22([]), [loading, setLoading] = useState22(false), [failed, setFailed] = useState22(false), version =
|
|
5791
|
+
const [query, setQuery] = useState22(value), [options, setOptions] = useState22([]), [loading, setLoading] = useState22(false), [failed, setFailed] = useState22(false), version = useRef24(0), notify = useRef24(onSearchError);
|
|
5756
5792
|
notify.current = onSearchError;
|
|
5757
|
-
const timer =
|
|
5758
|
-
const notifyValue =
|
|
5793
|
+
const timer = useRef24(void 0);
|
|
5794
|
+
const notifyValue = useRef24(onValueChange);
|
|
5759
5795
|
notifyValue.current = onValueChange;
|
|
5760
5796
|
useLayoutEffect12(() => {
|
|
5761
5797
|
clearTimeout(timer.current);
|
|
@@ -5765,7 +5801,7 @@ function useSearchInputModel({
|
|
|
5765
5801
|
clearTimeout(timer.current);
|
|
5766
5802
|
return () => clearTimeout(timer.current);
|
|
5767
5803
|
}, [disabled, debounce, !!loadOptions]);
|
|
5768
|
-
|
|
5804
|
+
useEffect17(() => {
|
|
5769
5805
|
const current = ++version.current, abort = new AbortController();
|
|
5770
5806
|
setFailed(false);
|
|
5771
5807
|
if (!loadOptions || !open || disabled || query.length < minChars) {
|
|
@@ -5918,7 +5954,7 @@ function KjunSearchInput({
|
|
|
5918
5954
|
|
|
5919
5955
|
// packages/native/src/select-control.tsx
|
|
5920
5956
|
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5921
|
-
import { useContext as useContext14, useEffect as
|
|
5957
|
+
import { useContext as useContext14, useEffect as useEffect19, useRef as useRef26 } from "react";
|
|
5922
5958
|
|
|
5923
5959
|
// packages/native/src/compound-control.tsx
|
|
5924
5960
|
import { createContext as createContext18 } from "react";
|
|
@@ -5932,7 +5968,7 @@ function CompoundTarget({ children, square = false }) {
|
|
|
5932
5968
|
}
|
|
5933
5969
|
|
|
5934
5970
|
// shared/package-runtime/select.ts
|
|
5935
|
-
import { useEffect as
|
|
5971
|
+
import { useEffect as useEffect18, useRef as useRef25, useState as useState24 } from "react";
|
|
5936
5972
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
5937
5973
|
const [internal, setInternal] = useState24(false);
|
|
5938
5974
|
const [query, setQuery] = useState24("");
|
|
@@ -5940,8 +5976,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5940
5976
|
const [session, setSession] = useState24(0);
|
|
5941
5977
|
const isControlled = typeof controlled === "boolean";
|
|
5942
5978
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
5943
|
-
const previousOpen =
|
|
5944
|
-
|
|
5979
|
+
const previousOpen = useRef25(open);
|
|
5980
|
+
useEffect18(() => {
|
|
5945
5981
|
if (disabled && !isControlled) setInternal(false);
|
|
5946
5982
|
if (previousOpen.current && !open) {
|
|
5947
5983
|
setQuery("");
|
|
@@ -5950,7 +5986,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5950
5986
|
}
|
|
5951
5987
|
previousOpen.current = open;
|
|
5952
5988
|
}, [open, disabled, isControlled, pageSize]);
|
|
5953
|
-
|
|
5989
|
+
useEffect18(() => {
|
|
5954
5990
|
setLimit(pageSize);
|
|
5955
5991
|
}, [pageSize]);
|
|
5956
5992
|
const changeOpen = (next) => {
|
|
@@ -6000,14 +6036,14 @@ function KjunSelect({
|
|
|
6000
6036
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
6001
6037
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
6002
6038
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
6003
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref =
|
|
6004
|
-
const trigger =
|
|
6039
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef26(null), spec = tokens32.input[size];
|
|
6040
|
+
const trigger = useRef26(null);
|
|
6005
6041
|
const compound = useContext14(CompoundControlContext);
|
|
6006
|
-
|
|
6042
|
+
useEffect19(() => {
|
|
6007
6043
|
if (compound == null ? void 0 : compound.focusRef) compound.focusRef.current = trigger.current;
|
|
6008
6044
|
}, [compound == null ? void 0 : compound.focusRef]);
|
|
6009
6045
|
const expanded = usePopupExpanded(open, ref);
|
|
6010
|
-
const selectedRow =
|
|
6046
|
+
const selectedRow = useRef26(null);
|
|
6011
6047
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open: expanded });
|
|
6012
6048
|
const change = (v) => {
|
|
6013
6049
|
onValueChange == null ? void 0 : onValueChange(v);
|
|
@@ -6205,15 +6241,16 @@ import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
|
6205
6241
|
|
|
6206
6242
|
// packages/native/src/collapse.tsx
|
|
6207
6243
|
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6208
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
6244
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef27, useState as useState25 } from "react";
|
|
6209
6245
|
import { Animated as Animated14, View as View28 } from "react-native";
|
|
6210
6246
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
6211
|
-
function Collapse({ open, children }) {
|
|
6247
|
+
function Collapse({ open, keepMounted = false, children }) {
|
|
6212
6248
|
const reduced = useReducedMotion();
|
|
6213
6249
|
const [retained, setRetained] = useState25(open), [height, setHeight] = useState25(null);
|
|
6214
|
-
const value =
|
|
6250
|
+
const value = useRef27(new Animated14.Value(0)).current;
|
|
6215
6251
|
const [settled, setSettled] = useState25(open);
|
|
6216
|
-
const version =
|
|
6252
|
+
const version = useRef27(0), first = useRef27(open), opened = useRef27(open);
|
|
6253
|
+
if (open) opened.current = true;
|
|
6217
6254
|
useLayoutEffect13(() => {
|
|
6218
6255
|
const revision = ++version.current;
|
|
6219
6256
|
if (open) setRetained(true);
|
|
@@ -6241,13 +6278,13 @@ function Collapse({ open, children }) {
|
|
|
6241
6278
|
value.stopAnimation();
|
|
6242
6279
|
};
|
|
6243
6280
|
}, [open, height, reduced, value]);
|
|
6244
|
-
return open || retained ? /* @__PURE__ */ jsx35(
|
|
6281
|
+
return open || retained || keepMounted && opened.current ? /* @__PURE__ */ jsx35(
|
|
6245
6282
|
Animated14.View,
|
|
6246
6283
|
{
|
|
6247
6284
|
pointerEvents: open ? "auto" : "none",
|
|
6248
6285
|
accessibilityElementsHidden: !open,
|
|
6249
6286
|
importantForAccessibility: open ? "auto" : "no-hide-descendants",
|
|
6250
|
-
...!open ? { inert: true } : {},
|
|
6287
|
+
...!open ? { inert: true, "aria-hidden": true } : {},
|
|
6251
6288
|
style: { height: settled && open ? void 0 : value, overflow: "hidden" },
|
|
6252
6289
|
children: /* @__PURE__ */ jsx35(View28, { onLayout: (event) => setHeight(event.nativeEvent.layout.height), children })
|
|
6253
6290
|
}
|
|
@@ -6255,10 +6292,10 @@ function Collapse({ open, children }) {
|
|
|
6255
6292
|
}
|
|
6256
6293
|
|
|
6257
6294
|
// shared/package-runtime/navigation.ts
|
|
6258
|
-
import { useEffect as
|
|
6295
|
+
import { useEffect as useEffect20, useRef as useRef28, useState as useState26 } from "react";
|
|
6259
6296
|
function useInitialTab(value, candidate, change) {
|
|
6260
|
-
const requested =
|
|
6261
|
-
|
|
6297
|
+
const requested = useRef28(/* @__PURE__ */ new Set());
|
|
6298
|
+
useEffect20(() => {
|
|
6262
6299
|
if (value !== "") {
|
|
6263
6300
|
requested.current.clear();
|
|
6264
6301
|
return;
|
|
@@ -6270,7 +6307,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
6270
6307
|
}
|
|
6271
6308
|
function useAccordionState(multiple) {
|
|
6272
6309
|
const [opened, setOpened] = useState26(/* @__PURE__ */ new Set());
|
|
6273
|
-
|
|
6310
|
+
useEffect20(() => {
|
|
6274
6311
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
6275
6312
|
}, [multiple]);
|
|
6276
6313
|
return {
|
|
@@ -6298,19 +6335,20 @@ import {
|
|
|
6298
6335
|
Fragment as Fragment12,
|
|
6299
6336
|
createContext as createContext20,
|
|
6300
6337
|
useContext as useContext16,
|
|
6301
|
-
useEffect as
|
|
6338
|
+
useEffect as useEffect21,
|
|
6302
6339
|
useId as useId7,
|
|
6340
|
+
useRef as useRef31,
|
|
6303
6341
|
useState as useState28
|
|
6304
6342
|
} from "react";
|
|
6305
6343
|
import { Animated as Animated16, View as View30, useWindowDimensions as useWindowDimensions5, Platform as Platform22 } from "react-native";
|
|
6306
6344
|
|
|
6307
6345
|
// packages/native/src/tabs.tsx
|
|
6308
6346
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6309
|
-
import { Children as Children4, createContext as createContext19, isValidElement as isValidElement7, useContext as useContext15, useCallback as
|
|
6347
|
+
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
6348
|
import { Animated as Animated15, Platform as Platform21, ScrollView as ScrollView5, View as View29 } from "react-native";
|
|
6311
6349
|
|
|
6312
6350
|
// packages/native/src/tabs-accessibility.web.ts
|
|
6313
|
-
import { useLayoutEffect as useLayoutEffect14, useRef as
|
|
6351
|
+
import { useLayoutEffect as useLayoutEffect14, useRef as useRef29 } from "react";
|
|
6314
6352
|
|
|
6315
6353
|
// shared/package-runtime/tab-keyboard.ts
|
|
6316
6354
|
function manageTabList(list, select, keyboard = true) {
|
|
@@ -6393,7 +6431,7 @@ function panelNeedsFocus(panel) {
|
|
|
6393
6431
|
|
|
6394
6432
|
// packages/native/src/tabs-accessibility.web.ts
|
|
6395
6433
|
function useTabKeyboard(root, select) {
|
|
6396
|
-
const callback =
|
|
6434
|
+
const callback = useRef29(select);
|
|
6397
6435
|
callback.current = select;
|
|
6398
6436
|
useLayoutEffect14(() => {
|
|
6399
6437
|
var _a;
|
|
@@ -6430,10 +6468,10 @@ function KjunTabs({
|
|
|
6430
6468
|
isValidElement7
|
|
6431
6469
|
);
|
|
6432
6470
|
const tabs = items2.length ? items2 : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
6433
|
-
const id = "kjun-" + useId6(), root =
|
|
6434
|
-
const menuState =
|
|
6471
|
+
const id = "kjun-" + useId6(), root = useRef30(null);
|
|
6472
|
+
const menuState = useRef30({ tabs, onTabMenu });
|
|
6435
6473
|
menuState.current = { tabs, onTabMenu };
|
|
6436
|
-
const pressedMenu =
|
|
6474
|
+
const pressedMenu = useRef30(null);
|
|
6437
6475
|
useLayoutEffect15(() => {
|
|
6438
6476
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6439
6477
|
}, [tabs, onTabMenu]);
|
|
@@ -6449,10 +6487,10 @@ function KjunTabs({
|
|
|
6449
6487
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6450
6488
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6451
6489
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
6452
|
-
const tabRefs =
|
|
6490
|
+
const tabRefs = useRef30(/* @__PURE__ */ new Map());
|
|
6453
6491
|
const { updateLayout } = selection;
|
|
6454
6492
|
const firstName = (_a = tabs[0]) == null ? void 0 : _a.name;
|
|
6455
|
-
const measureIndicator =
|
|
6493
|
+
const measureIndicator = useCallback6((name, box) => {
|
|
6456
6494
|
const left = underline && name === firstName ? 0 : paddingX;
|
|
6457
6495
|
updateLayout(name, underline ? {
|
|
6458
6496
|
x: box.x + left,
|
|
@@ -6621,7 +6659,7 @@ function KjunTabs({
|
|
|
6621
6659
|
}
|
|
6622
6660
|
function KjunTabPane({ name, children }) {
|
|
6623
6661
|
const { value, id, names } = useContext15(TabContext);
|
|
6624
|
-
const root =
|
|
6662
|
+
const root = useRef30(null);
|
|
6625
6663
|
usePanelFocus(root);
|
|
6626
6664
|
const hidden = value !== name;
|
|
6627
6665
|
return /* @__PURE__ */ jsx36(
|
|
@@ -6674,14 +6712,32 @@ function KjunAccordionItem({
|
|
|
6674
6712
|
defaultOpen = false,
|
|
6675
6713
|
disabled = false,
|
|
6676
6714
|
header,
|
|
6715
|
+
open: openProp,
|
|
6716
|
+
onOpenChange,
|
|
6717
|
+
keepMounted = false,
|
|
6677
6718
|
children
|
|
6678
6719
|
}) {
|
|
6679
|
-
const { colors } = useKjunStyles(), group =
|
|
6720
|
+
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;
|
|
6721
|
+
const reported = useRef31(open), notify = useRef31(onOpenChange), registering = useRef31(!!group && defaultOpen);
|
|
6722
|
+
notify.current = onOpenChange;
|
|
6723
|
+
useEffect21(() => {
|
|
6724
|
+
var _a;
|
|
6725
|
+
if (registering.current) {
|
|
6726
|
+
if (open) {
|
|
6727
|
+
registering.current = false;
|
|
6728
|
+
reported.current = open;
|
|
6729
|
+
}
|
|
6730
|
+
return;
|
|
6731
|
+
}
|
|
6732
|
+
if (controlled || reported.current === open) return;
|
|
6733
|
+
reported.current = open;
|
|
6734
|
+
(_a = notify.current) == null ? void 0 : _a.call(notify, open);
|
|
6735
|
+
}, [open, controlled]);
|
|
6680
6736
|
const rotation = useMotionValue(open ? 1 : 0, tokens35.motion.collapse, void 0, void 0, true);
|
|
6681
6737
|
const geometry2 = tokens35.extensions.accordion;
|
|
6682
6738
|
const [hovered, setHovered] = useState28(false);
|
|
6683
6739
|
const wrapping = Platform22.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6684
|
-
|
|
6740
|
+
useEffect21(() => {
|
|
6685
6741
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
6686
6742
|
}, []);
|
|
6687
6743
|
return /* @__PURE__ */ jsxs23(View30, { children: [
|
|
@@ -6695,7 +6751,10 @@ function KjunAccordionItem({
|
|
|
6695
6751
|
accessibilityLabel: title,
|
|
6696
6752
|
accessibilityState: { expanded: open, disabled },
|
|
6697
6753
|
disabled,
|
|
6698
|
-
onPress: () =>
|
|
6754
|
+
onPress: () => {
|
|
6755
|
+
registering.current = false;
|
|
6756
|
+
controlled ? onOpenChange == null ? void 0 : onOpenChange(!open) : group ? group.toggle(id) : setOwn(!own);
|
|
6757
|
+
},
|
|
6699
6758
|
onHoverIn: () => setHovered(true),
|
|
6700
6759
|
onHoverOut: () => setHovered(false),
|
|
6701
6760
|
style: ({ pressed }) => ({
|
|
@@ -6715,7 +6774,7 @@ function KjunAccordionItem({
|
|
|
6715
6774
|
]
|
|
6716
6775
|
}
|
|
6717
6776
|
),
|
|
6718
|
-
/* @__PURE__ */ jsx37(Collapse, { open, children: /* @__PURE__ */ jsx37(
|
|
6777
|
+
/* @__PURE__ */ jsx37(Collapse, { open, keepMounted, children: /* @__PURE__ */ jsx37(
|
|
6719
6778
|
View30,
|
|
6720
6779
|
{
|
|
6721
6780
|
nativeID: id + "-panel",
|
|
@@ -6912,7 +6971,7 @@ function KjunPagination({
|
|
|
6912
6971
|
|
|
6913
6972
|
// packages/native/src/actions.tsx
|
|
6914
6973
|
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6915
|
-
import { useContext as useContext17, useEffect as
|
|
6974
|
+
import { useContext as useContext17, useEffect as useEffect22, useRef as useRef32, useState as useState29 } from "react";
|
|
6916
6975
|
import { Platform as Platform23, ScrollView as ScrollView7, View as View31 } from "react-native";
|
|
6917
6976
|
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6918
6977
|
function KjunIconToggle({
|
|
@@ -6997,8 +7056,8 @@ function KjunCopyButton({
|
|
|
6997
7056
|
}) {
|
|
6998
7057
|
const m = useKjunMessages();
|
|
6999
7058
|
successText != null ? successText : successText = m.copied;
|
|
7000
|
-
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy =
|
|
7001
|
-
|
|
7059
|
+
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy = useRef32(false), timer = useRef32(void 0), mounted = useRef32(true);
|
|
7060
|
+
useEffect22(() => {
|
|
7002
7061
|
mounted.current = true;
|
|
7003
7062
|
return () => {
|
|
7004
7063
|
mounted.current = false;
|
|
@@ -7162,10 +7221,10 @@ import { Component, useState as useState31 } from "react";
|
|
|
7162
7221
|
import { Platform as Platform24, View as View32 } from "react-native";
|
|
7163
7222
|
|
|
7164
7223
|
// shared/package-runtime/use-loading-reveal.ts
|
|
7165
|
-
import { useEffect as
|
|
7224
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
7166
7225
|
function useLoadingReveal(active, delay = 0) {
|
|
7167
7226
|
const [revealed, setRevealed] = useState30(false);
|
|
7168
|
-
|
|
7227
|
+
useEffect23(() => {
|
|
7169
7228
|
setRevealed(false);
|
|
7170
7229
|
if (!active || delay <= 0) return;
|
|
7171
7230
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -7335,7 +7394,7 @@ KjunErrorBoundary.contextType = KjunMessageContext;
|
|
|
7335
7394
|
|
|
7336
7395
|
// packages/native/src/skeletons.tsx
|
|
7337
7396
|
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7338
|
-
import { useEffect as
|
|
7397
|
+
import { useEffect as useEffect24, useRef as useRef33, useState as useState33 } from "react";
|
|
7339
7398
|
import { Animated as Animated17, Platform as Platform25, View as View34, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
7340
7399
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
7341
7400
|
|
|
@@ -7526,8 +7585,8 @@ function KjunChartSkeleton({
|
|
|
7526
7585
|
}) {
|
|
7527
7586
|
const m = useKjunMessages();
|
|
7528
7587
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7529
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity =
|
|
7530
|
-
|
|
7588
|
+
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" };
|
|
7589
|
+
useEffect24(() => {
|
|
7531
7590
|
if (reduced || !skeleton) return;
|
|
7532
7591
|
const loop = Animated17.loop(
|
|
7533
7592
|
Animated17.sequence([
|
|
@@ -7625,7 +7684,7 @@ import Svg6, {
|
|
|
7625
7684
|
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7626
7685
|
|
|
7627
7686
|
// shared/package-runtime/use-number-motion.ts
|
|
7628
|
-
import { useLayoutEffect as useLayoutEffect16, useRef as
|
|
7687
|
+
import { useLayoutEffect as useLayoutEffect16, useRef as useRef34, useState as useState34 } from "react";
|
|
7629
7688
|
|
|
7630
7689
|
// shared/package-runtime/number-motion.ts
|
|
7631
7690
|
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
@@ -7672,7 +7731,7 @@ function createNumberMotion(apply) {
|
|
|
7672
7731
|
// shared/package-runtime/use-number-motion.ts
|
|
7673
7732
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
7674
7733
|
const [display, setDisplay] = useState34(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
7675
|
-
const motion =
|
|
7734
|
+
const motion = useRef34(null);
|
|
7676
7735
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
7677
7736
|
useLayoutEffect16(() => {
|
|
7678
7737
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
@@ -8137,7 +8196,7 @@ function KjunSparkline({
|
|
|
8137
8196
|
|
|
8138
8197
|
// shared/package-runtime/table.ts
|
|
8139
8198
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
8140
|
-
import { useEffect as
|
|
8199
|
+
import { useEffect as useEffect26, useRef as useRef36, useState as useState36 } from "react";
|
|
8141
8200
|
|
|
8142
8201
|
// shared/package-runtime/table-model.ts
|
|
8143
8202
|
function getValue(row, key) {
|
|
@@ -8184,8 +8243,8 @@ function useTableModel(props) {
|
|
|
8184
8243
|
const [internalSort, setSort] = useState36({
|
|
8185
8244
|
key: "",
|
|
8186
8245
|
order: "asc"
|
|
8187
|
-
}), [internalExpanded, setExpanded] = useState36([]), [search, setSearch] = useState36(""), timer =
|
|
8188
|
-
|
|
8246
|
+
}), [internalExpanded, setExpanded] = useState36([]), [search, setSearch] = useState36(""), timer = useRef36(void 0);
|
|
8247
|
+
useEffect26(() => () => clearTimeout(timer.current), []);
|
|
8189
8248
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
8190
8249
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
8191
8250
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -9342,7 +9401,7 @@ import { tokens as tokens52 } from "@kjun-ui/tokens";
|
|
|
9342
9401
|
import { ScrollView as ScrollView10, View as View45 } from "react-native";
|
|
9343
9402
|
|
|
9344
9403
|
// shared/package-runtime/market-cards.ts
|
|
9345
|
-
import { useEffect as
|
|
9404
|
+
import { useEffect as useEffect27, useRef as useRef37, useState as useState39 } from "react";
|
|
9346
9405
|
function useMarketCardsModel(props, persistence) {
|
|
9347
9406
|
const {
|
|
9348
9407
|
columns,
|
|
@@ -9359,7 +9418,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
9359
9418
|
isDefaultSort: c.defaultSort
|
|
9360
9419
|
}));
|
|
9361
9420
|
const [key, setKey] = useState39(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
9362
|
-
const mounted =
|
|
9421
|
+
const mounted = useRef37("");
|
|
9363
9422
|
const save = (key2) => {
|
|
9364
9423
|
var _a;
|
|
9365
9424
|
try {
|
|
@@ -9367,7 +9426,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
9367
9426
|
} catch (e) {
|
|
9368
9427
|
}
|
|
9369
9428
|
};
|
|
9370
|
-
|
|
9429
|
+
useEffect27(() => {
|
|
9371
9430
|
var _a, _b;
|
|
9372
9431
|
if (mounted.current === restoreSignature) return;
|
|
9373
9432
|
mounted.current = restoreSignature;
|
|
@@ -10152,26 +10211,31 @@ import { Children as Children5, createContext as createContext22, useContext as
|
|
|
10152
10211
|
import { View as View49, Platform as Platform26 } from "react-native";
|
|
10153
10212
|
import { Fragment as Fragment20, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10154
10213
|
var ListRowContext = createContext22({ divider: true, compact: false });
|
|
10155
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
10214
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress, ariaLabel, children }) {
|
|
10156
10215
|
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
10157
10216
|
const parts = /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
10158
10217
|
hasContent(leading) && /* @__PURE__ */ jsx56(View49, { children: content(leading) }),
|
|
10159
10218
|
/* @__PURE__ */ jsxs42(View49, { style: { flex: 1, minWidth: 0 }, children: [
|
|
10160
10219
|
/* @__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 })
|
|
10220
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens56.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description }),
|
|
10221
|
+
hasContent(children) && /* @__PURE__ */ jsx56(View49, { style: { marginTop: tokens56.extensions.list.descriptionGap }, children: content(children) })
|
|
10162
10222
|
] }),
|
|
10163
10223
|
hasContent(trailing) && /* @__PURE__ */ jsx56(View49, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
10164
10224
|
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
10225
|
] });
|
|
10166
10226
|
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
10227
|
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 }),
|
|
10228
|
+
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
10229
|
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
10230
|
] });
|
|
10171
10231
|
}
|
|
10172
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
10232
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default", radius = "none" }) {
|
|
10173
10233
|
const { colors } = useKjunStyles();
|
|
10174
|
-
return /* @__PURE__ */ jsxs42(View49, { style: {
|
|
10234
|
+
return /* @__PURE__ */ jsxs42(View49, { style: {
|
|
10235
|
+
minWidth: 0,
|
|
10236
|
+
backgroundColor: surface ? colors.surface : "transparent",
|
|
10237
|
+
...radius === "none" ? {} : { borderRadius: tokens56.card.radii[radius], overflow: "hidden" }
|
|
10238
|
+
}, children: [
|
|
10175
10239
|
!!(title || description || actions) && /* @__PURE__ */ jsxs42(View49, { style: { flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, padding: tokens56.extensions.list.padding }, children: [
|
|
10176
10240
|
/* @__PURE__ */ jsxs42(View49, { style: { flex: 1 }, children: [
|
|
10177
10241
|
!!title && /* @__PURE__ */ jsx56(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
@@ -10308,14 +10372,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
10308
10372
|
}
|
|
10309
10373
|
|
|
10310
10374
|
// packages/native/src/media.tsx
|
|
10311
|
-
import { createContext as createContext23, useContext as useContext20, useRef as
|
|
10375
|
+
import { createContext as createContext23, useContext as useContext20, useRef as useRef38, useState as useState42 } from "react";
|
|
10312
10376
|
import { Image, View as View51 } from "react-native";
|
|
10313
10377
|
import { tokens as tokens58 } from "@kjun-ui/tokens";
|
|
10314
10378
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10315
10379
|
var ImageBackgroundContext = createContext23(void 0);
|
|
10316
10380
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
10317
10381
|
const { colors } = useKjunStyles(), background = useContext20(ImageBackgroundContext);
|
|
10318
|
-
const request = JSON.stringify(source != null ? source : src), current =
|
|
10382
|
+
const request = JSON.stringify(source != null ? source : src), current = useRef38({ request, version: 0 });
|
|
10319
10383
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
10320
10384
|
const version = current.current.version;
|
|
10321
10385
|
const [failed, setFailed] = useState42(null);
|
|
@@ -10383,7 +10447,7 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10383
10447
|
}
|
|
10384
10448
|
|
|
10385
10449
|
// packages/native/src/range-input.tsx
|
|
10386
|
-
import { useEffect as
|
|
10450
|
+
import { useEffect as useEffect28, useMemo as useMemo3, useRef as useRef39, useState as useState43 } from "react";
|
|
10387
10451
|
import { PanResponder, Platform as Platform28, Pressable as Pressable3, View as View53 } from "react-native";
|
|
10388
10452
|
import { tokens as tokens61, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
10389
10453
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -10411,15 +10475,15 @@ function RangeInput({
|
|
|
10411
10475
|
const [hovered, setHovered] = useState43(null);
|
|
10412
10476
|
const [dragging, setDragging] = useState43(null);
|
|
10413
10477
|
const [focused, setFocused] = useState43(null);
|
|
10414
|
-
const track =
|
|
10415
|
-
const latest =
|
|
10478
|
+
const track = useRef39(null), measured = useRef39({ x: 0, width: 1 }), selected = useRef39(0), dirty = useRef39(false);
|
|
10479
|
+
const latest = useRef39(values);
|
|
10416
10480
|
latest.current = values;
|
|
10417
|
-
const callbacks =
|
|
10481
|
+
const callbacks = useRef39({ onValueChange, onChangeCommit });
|
|
10418
10482
|
callbacks.current = { onValueChange, onChangeCommit };
|
|
10419
|
-
|
|
10483
|
+
useEffect28(() => {
|
|
10420
10484
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10421
10485
|
}, [valid]);
|
|
10422
|
-
|
|
10486
|
+
useEffect28(() => {
|
|
10423
10487
|
if (blocked) {
|
|
10424
10488
|
setDragging(null);
|
|
10425
10489
|
setHovered(null);
|
|
@@ -10684,7 +10748,7 @@ function KjunRangeSlider(props) {
|
|
|
10684
10748
|
}
|
|
10685
10749
|
|
|
10686
10750
|
// packages/native/src/quantity-stepper.tsx
|
|
10687
|
-
import { useEffect as
|
|
10751
|
+
import { useEffect as useEffect29, useRef as useRef40, useState as useState44 } from "react";
|
|
10688
10752
|
import { Platform as Platform29, View as View54 } from "react-native";
|
|
10689
10753
|
import { createNumberDomain, quantityKeyAction, tokens as tokens62 } from "@kjun-ui/tokens";
|
|
10690
10754
|
|
|
@@ -10708,15 +10772,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10708
10772
|
const domain = createNumberDomain({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
10709
10773
|
const surface = useFieldSurface(size, { disabled: blocked, invalid });
|
|
10710
10774
|
const [draft, setDraft] = useState44(String(value));
|
|
10711
|
-
const inputRef =
|
|
10712
|
-
const composing =
|
|
10713
|
-
const cancelledEscape =
|
|
10714
|
-
|
|
10775
|
+
const inputRef = useRef40(null);
|
|
10776
|
+
const composing = useRef40(false), dirty = useRef40(false), accepted = useRef40(value);
|
|
10777
|
+
const cancelledEscape = useRef40(false);
|
|
10778
|
+
useEffect29(() => {
|
|
10715
10779
|
setDraft(String(value));
|
|
10716
10780
|
accepted.current = value;
|
|
10717
10781
|
dirty.current = false;
|
|
10718
10782
|
}, [value, precision, min, max, step]);
|
|
10719
|
-
|
|
10783
|
+
useEffect29(() => {
|
|
10720
10784
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10721
10785
|
}, [valid]);
|
|
10722
10786
|
const emit = (next) => {
|
|
@@ -10753,7 +10817,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10753
10817
|
} else if (action === "commit") commit();
|
|
10754
10818
|
else move(action === "increment" ? 1 : -1);
|
|
10755
10819
|
};
|
|
10756
|
-
const handlers =
|
|
10820
|
+
const handlers = useRef40({ key, edit: (text) => {
|
|
10757
10821
|
dirty.current = true;
|
|
10758
10822
|
setDraft(text);
|
|
10759
10823
|
} });
|
|
@@ -10761,7 +10825,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10761
10825
|
dirty.current = true;
|
|
10762
10826
|
setDraft(text);
|
|
10763
10827
|
} };
|
|
10764
|
-
|
|
10828
|
+
useEffect29(() => {
|
|
10765
10829
|
if (Platform29.OS !== "web") return;
|
|
10766
10830
|
const input = inputRef.current;
|
|
10767
10831
|
const keydown = (event) => handlers.current.key(event);
|
|
@@ -10833,7 +10897,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10833
10897
|
}
|
|
10834
10898
|
|
|
10835
10899
|
// packages/native/src/time-picker.tsx
|
|
10836
|
-
import { Fragment as Fragment22, useEffect as
|
|
10900
|
+
import { Fragment as Fragment22, useEffect as useEffect30, useId as useId11, useMemo as useMemo4, useRef as useRef41, useState as useState45 } from "react";
|
|
10837
10901
|
import { View as View55 } from "react-native";
|
|
10838
10902
|
import { createTimeDomain, tokens as tokens63 } from "@kjun-ui/tokens";
|
|
10839
10903
|
import { jsx as jsx63, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -10842,12 +10906,12 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10842
10906
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10843
10907
|
const geometry2 = tokens63.extensions.timePicker, spec = tokens63.input[size];
|
|
10844
10908
|
const { colors } = useKjunStyles();
|
|
10845
|
-
const first =
|
|
10909
|
+
const first = useRef41(null);
|
|
10846
10910
|
const [focused, setFocused] = useState45(false), [opened, setOpened] = useState45(null);
|
|
10847
10911
|
const field = useKjunField(), uid = useId11();
|
|
10848
10912
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
10849
10913
|
const domain = useMemo4(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
10850
|
-
|
|
10914
|
+
useEffect30(() => {
|
|
10851
10915
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10852
10916
|
}, [valid]);
|
|
10853
10917
|
const change = (next) => {
|