@kjun-ui/react 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.
Files changed (30) hide show
  1. package/dist/index.cjs +391 -258
  2. package/dist/index.js +305 -172
  3. package/dist/styles.css +26 -3
  4. package/dist/types/packages/react/src/collapse.d.cts +3 -1
  5. package/dist/types/packages/react/src/collapse.d.ts +3 -1
  6. package/dist/types/packages/react/src/combobox.d.cts +6 -2
  7. package/dist/types/packages/react/src/combobox.d.ts +6 -2
  8. package/dist/types/packages/react/src/drawer.d.cts +3 -1
  9. package/dist/types/packages/react/src/drawer.d.ts +3 -1
  10. package/dist/types/packages/react/src/dropdown.d.cts +4 -2
  11. package/dist/types/packages/react/src/dropdown.d.ts +4 -2
  12. package/dist/types/packages/react/src/floating-panel.d.cts +8 -1
  13. package/dist/types/packages/react/src/floating-panel.d.ts +8 -1
  14. package/dist/types/packages/react/src/list.d.cts +9 -2
  15. package/dist/types/packages/react/src/list.d.ts +9 -2
  16. package/dist/types/packages/react/src/modal.d.cts +3 -1
  17. package/dist/types/packages/react/src/modal.d.ts +3 -1
  18. package/dist/types/packages/react/src/navigation.d.cts +7 -1
  19. package/dist/types/packages/react/src/navigation.d.ts +7 -1
  20. package/dist/types/packages/react/src/popover.d.cts +12 -3
  21. package/dist/types/packages/react/src/popover.d.ts +12 -3
  22. package/dist/types/packages/react/src/select-control.d.cts +4 -1
  23. package/dist/types/packages/react/src/select-control.d.ts +4 -1
  24. package/dist/types/shared/package-runtime/anchor-rect.d.cts +17 -0
  25. package/dist/types/shared/package-runtime/anchor-rect.d.ts +17 -0
  26. package/dist/types/shared/package-runtime/nested-controls.d.cts +2 -0
  27. package/dist/types/shared/package-runtime/nested-controls.d.ts +2 -0
  28. package/dist/types/shared/package-runtime/use-after-close.d.cts +6 -0
  29. package/dist/types/shared/package-runtime/use-after-close.d.ts +6 -0
  30. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1258,13 +1258,32 @@ var KjunInput = forwardRef2(
1258
1258
  }
1259
1259
  );
1260
1260
 
1261
+ // shared/package-runtime/use-after-close.ts
1262
+ import { useCallback, useEffect as useEffect3, useRef as useRef5 } from "react";
1263
+ function useAfterCloseRef(open, onAfterClose) {
1264
+ const state = useRef5({ open, mounted: false, callback: onAfterClose });
1265
+ state.current.open = open;
1266
+ state.current.callback = onAfterClose;
1267
+ return useCallback((node) => {
1268
+ const current = state.current;
1269
+ if (node) current.mounted = true;
1270
+ else if (current.mounted) {
1271
+ current.mounted = false;
1272
+ queueMicrotask(() => {
1273
+ var _a;
1274
+ if (!current.open && !current.mounted) (_a = current.callback) == null ? void 0 : _a.call(current);
1275
+ });
1276
+ }
1277
+ }, []);
1278
+ }
1279
+
1261
1280
  // shared/package-runtime/use-presence.ts
1262
1281
  import { tokens as tokens5 } from "@kjun-ui/tokens";
1263
- import { useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState5 } from "react";
1282
+ import { useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState5 } from "react";
1264
1283
  function usePresence(open, reduced, exitDuration = tokens5.motion.layerExit) {
1265
1284
  const [retained, setRetained] = useState5(open);
1266
1285
  const [active, setActive] = useState5(false);
1267
- const mounted = useRef5(false);
1286
+ const mounted = useRef6(false);
1268
1287
  useLayoutEffect4(() => {
1269
1288
  let first = 0, second = 0, timer;
1270
1289
  if (open) {
@@ -1306,7 +1325,7 @@ function useReducedMotion() {
1306
1325
 
1307
1326
  // packages/react/src/modal.tsx
1308
1327
  import { tokens as tokens6 } from "@kjun-ui/tokens";
1309
- import { useId as useId4, useLayoutEffect as useLayoutEffect6, useRef as useRef6 } from "react";
1328
+ import { useId as useId4, useLayoutEffect as useLayoutEffect6, useRef as useRef7 } from "react";
1310
1329
 
1311
1330
  // shared/package-runtime/form-actions.ts
1312
1331
  function formActionsNeedStack(width, widths, gap) {
@@ -1397,7 +1416,7 @@ function KjunFormActions({
1397
1416
  const m = useKjunMessages();
1398
1417
  cancelText != null ? cancelText : cancelText = m.cancel;
1399
1418
  confirmText != null ? confirmText : confirmText = m.save;
1400
- const ref = useRef6(null);
1419
+ const ref = useRef7(null);
1401
1420
  useLayoutEffect6(() => observeFormActions(ref.current), []);
1402
1421
  return /* @__PURE__ */ jsxs4("div", { className: "kjun-form-actions", ref, children: [
1403
1422
  showCancel && /* @__PURE__ */ jsx7(
@@ -1427,6 +1446,7 @@ function KjunModal({
1427
1446
  open,
1428
1447
  onOpenChange,
1429
1448
  onClose,
1449
+ onAfterClose,
1430
1450
  onCancel,
1431
1451
  onConfirm,
1432
1452
  title = "",
@@ -1455,6 +1475,7 @@ function KjunModal({
1455
1475
  confirmText != null ? confirmText : confirmText = m.confirm;
1456
1476
  cancelText != null ? cancelText : cancelText = m.cancel;
1457
1477
  const motion = usePresence(open, useReducedMotion());
1478
+ const afterCloseRef = useAfterCloseRef(open, onAfterClose);
1458
1479
  const portalContainer = useKjunPortalContainer();
1459
1480
  const id = "kjun-" + useId4();
1460
1481
  const explicitLabel = ariaLabel == null ? void 0 : ariaLabel.trim();
@@ -1472,6 +1493,7 @@ function KjunModal({
1472
1493
  return /* @__PURE__ */ jsx7(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx7(
1473
1494
  ModalOverlay,
1474
1495
  {
1496
+ ref: afterCloseRef,
1475
1497
  style: { zIndex: layer.zIndex },
1476
1498
  isOpen: motion.present && layer.active,
1477
1499
  isExiting: motion.present && !layer.active,
@@ -1601,9 +1623,7 @@ import {
1601
1623
  useState as useState6
1602
1624
  } from "react";
1603
1625
 
1604
- // packages/react/src/card.tsx
1605
- import { useEffect as useEffect3, useRef as useRef7 } from "react";
1606
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1626
+ // shared/package-runtime/nested-controls.ts
1607
1627
  var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
1608
1628
  function developmentMode3() {
1609
1629
  try {
@@ -1612,6 +1632,13 @@ function developmentMode3() {
1612
1632
  return false;
1613
1633
  }
1614
1634
  }
1635
+ function warnNestedControls(root, message) {
1636
+ if (developmentMode3() && (root == null ? void 0 : root.querySelector(interactive))) console.warn(message);
1637
+ }
1638
+
1639
+ // packages/react/src/card.tsx
1640
+ import { useEffect as useEffect4, useRef as useRef8 } from "react";
1641
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1615
1642
  function KjunCard({
1616
1643
  title,
1617
1644
  subtitle,
@@ -1636,11 +1663,9 @@ function KjunCard({
1636
1663
  onKeyDown,
1637
1664
  ...props
1638
1665
  }) {
1639
- const root = useRef7(null);
1640
- useEffect3(() => {
1641
- var _a;
1642
- if (pressable && developmentMode3() && ((_a = root.current) == null ? void 0 : _a.querySelector(interactive)))
1643
- console.warn("KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
1666
+ const root = useRef8(null);
1667
+ useEffect4(() => {
1668
+ if (pressable) warnNestedControls(root.current, "KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
1644
1669
  }, [pressable]);
1645
1670
  const press = pressable ? {
1646
1671
  role: "button",
@@ -2078,13 +2103,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
2078
2103
  }
2079
2104
 
2080
2105
  // shared/package-runtime/feedback-dialog.ts
2081
- import { useRef as useRef8, useState as useState7 } from "react";
2106
+ import { useRef as useRef9, useState as useState7 } from "react";
2082
2107
  function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
2083
2108
  const options = request.options;
2084
2109
  const [value, setValue] = useState7(options.initialValue || "");
2085
2110
  const [error, setError] = useState7("");
2086
2111
  const [busy, setBusy] = useState7(false);
2087
- const working = useRef8(false);
2112
+ const working = useRef9(false);
2088
2113
  const active = () => {
2089
2114
  var _a;
2090
2115
  return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
@@ -2127,10 +2152,10 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
2127
2152
 
2128
2153
  // shared/package-runtime/feedback-motion.ts
2129
2154
  import { tokens as tokens9 } from "@kjun-ui/tokens";
2130
- import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState8 } from "react";
2155
+ import { useLayoutEffect as useLayoutEffect7, useRef as useRef10, useState as useState8 } from "react";
2131
2156
  function usePresentedToasts(toasts, reduced) {
2132
2157
  const [items, setItems] = useState8([]);
2133
- const removals = useRef9(/* @__PURE__ */ new Map());
2158
+ const removals = useRef10(/* @__PURE__ */ new Map());
2134
2159
  useLayoutEffect7(() => {
2135
2160
  const ids = new Set(toasts.map((toast) => toast.id));
2136
2161
  setItems((previous) => {
@@ -2181,7 +2206,7 @@ function useOptionalKjunFeedback() {
2181
2206
 
2182
2207
  // packages/react/src/toast-stack.tsx
2183
2208
  import { tokens as tokens11 } from "@kjun-ui/tokens";
2184
- import { useLayoutEffect as useLayoutEffect8, useRef as useRef11 } from "react";
2209
+ import { useLayoutEffect as useLayoutEffect8, useRef as useRef12 } from "react";
2185
2210
 
2186
2211
  // shared/package-runtime/toast-layout.ts
2187
2212
  import { tokens as tokens10 } from "@kjun-ui/tokens";
@@ -2243,16 +2268,16 @@ function createToastLayout() {
2243
2268
  }
2244
2269
 
2245
2270
  // packages/react/src/toast.tsx
2246
- import { useEffect as useEffect4, useRef as useRef10 } from "react";
2271
+ import { useEffect as useEffect5, useRef as useRef11 } from "react";
2247
2272
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
2248
2273
  function ToastView({
2249
2274
  toast,
2250
2275
  controller
2251
2276
  }) {
2252
2277
  const m = useKjunMessages();
2253
- const previous = useRef10(null);
2254
- const reasons = useRef10({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
2255
- useEffect4(() => {
2278
+ const previous = useRef11(null);
2279
+ const reasons = useRef11({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
2280
+ useEffect5(() => {
2256
2281
  previous.current = document.activeElement;
2257
2282
  return () => {
2258
2283
  controller.resumeToast(toast.id, reasons.hover);
@@ -2347,9 +2372,9 @@ function ToastView({
2347
2372
  // packages/react/src/toast-stack.tsx
2348
2373
  import { jsx as jsx12 } from "react/jsx-runtime";
2349
2374
  function ToastSurface({ item, controller }) {
2350
- const ref = useRef11(null), reduced = useReducedMotion();
2351
- const current = useRef11(null);
2352
- const entryFinished = useRef11(false);
2375
+ const ref = useRef12(null), reduced = useReducedMotion();
2376
+ const current = useRef12(null);
2377
+ const entryFinished = useRef12(false);
2353
2378
  useLayoutEffect8(() => {
2354
2379
  var _a, _b;
2355
2380
  const el = ref.current;
@@ -2384,7 +2409,7 @@ function ToastSurface({ item, controller }) {
2384
2409
  function ToastStack({ items, controller }) {
2385
2410
  var _a;
2386
2411
  const layers = useLayerState();
2387
- const root = useRef11(null), layout = useRef11(createToastLayout());
2412
+ const root = useRef12(null), layout = useRef12(createToastLayout());
2388
2413
  const reduced = useReducedMotion();
2389
2414
  useLayoutEffect8(() => {
2390
2415
  if (root.current) layout.current.update(root.current, reduced);
@@ -2408,9 +2433,9 @@ import {
2408
2433
  feedbackControllerOf
2409
2434
  } from "@kjun-ui/tokens";
2410
2435
  import {
2411
- useCallback,
2412
- useEffect as useEffect5,
2413
- useRef as useRef12,
2436
+ useCallback as useCallback2,
2437
+ useEffect as useEffect6,
2438
+ useRef as useRef13,
2414
2439
  useState as useState9,
2415
2440
  useSyncExternalStore as useSyncExternalStore3
2416
2441
  } from "react";
@@ -2467,8 +2492,8 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
2467
2492
  var _a;
2468
2493
  const [owned] = useState9(() => controllerProp ? void 0 : createFeedbackController());
2469
2494
  const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
2470
- useEffect5(() => controller.attach(), [controller]);
2471
- const life = useRef12(0);
2495
+ useEffect6(() => controller.attach(), [controller]);
2496
+ const life = useRef13(0);
2472
2497
  const snapshot = useSyncExternalStore3(
2473
2498
  controller.subscribe,
2474
2499
  controller.getSnapshot,
@@ -2477,7 +2502,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
2477
2502
  const reduced = useReducedMotion();
2478
2503
  const toasts = usePresentedToasts(snapshot.toasts, reduced);
2479
2504
  const dialog = usePresentedRequest(snapshot.current, reduced);
2480
- useEffect5(() => {
2505
+ useEffect6(() => {
2481
2506
  const version = ++life.current;
2482
2507
  return () => {
2483
2508
  queueMicrotask(() => {
@@ -2486,7 +2511,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
2486
2511
  };
2487
2512
  }, [controller]);
2488
2513
  const [layers, setLayers] = useState9([]);
2489
- const register = useCallback((id, order) => {
2514
+ const register = useCallback2((id, order) => {
2490
2515
  setLayers((current) => [...current, { id, order }]);
2491
2516
  return () => setLayers((current) => current.filter((value) => value.id !== id));
2492
2517
  }, []);
@@ -2518,7 +2543,7 @@ import { tokens as tokens13 } from "@kjun-ui/tokens";
2518
2543
  import {
2519
2544
  createContext as createContext10,
2520
2545
  forwardRef as forwardRef3,
2521
- useCallback as useCallback2,
2546
+ useCallback as useCallback3,
2522
2547
  useContext as useContext10,
2523
2548
  useId as useId5
2524
2549
  } from "react";
@@ -2528,7 +2553,7 @@ import {
2528
2553
  } from "react-aria-components";
2529
2554
 
2530
2555
  // packages/react/src/use-selection-indicator.ts
2531
- import { useLayoutEffect as useLayoutEffect9, useRef as useRef13 } from "react";
2556
+ import { useLayoutEffect as useLayoutEffect9, useRef as useRef14 } from "react";
2532
2557
 
2533
2558
  // shared/package-runtime/selection-indicator.ts
2534
2559
  import { tokens as tokens12 } from "@kjun-ui/tokens";
@@ -2600,9 +2625,9 @@ function selectionIndicator(root, marker, tabs = false) {
2600
2625
 
2601
2626
  // packages/react/src/use-selection-indicator.ts
2602
2627
  function useSelectionIndicator(tabs = false) {
2603
- const group = useRef13(null);
2604
- const indicator = useRef13(null);
2605
- const sync = useRef13(() => {
2628
+ const group = useRef14(null);
2629
+ const indicator = useRef14(null);
2630
+ const sync = useRef14(() => {
2606
2631
  });
2607
2632
  useLayoutEffect9(() => {
2608
2633
  const root = group.current, marker = indicator.current;
@@ -2691,7 +2716,7 @@ function KjunSwitch({
2691
2716
  const field = useKjunField();
2692
2717
  const descriptionId = "kjun-" + useId5().replace(/:/g, "") + "-description";
2693
2718
  const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
2694
- const markInput = useCallback2((input) => {
2719
+ const markInput = useCallback3((input) => {
2695
2720
  if (!input) return;
2696
2721
  if (invalid) input.setAttribute("aria-invalid", "true");
2697
2722
  else input.removeAttribute("aria-invalid");
@@ -2990,7 +3015,7 @@ function KjunFilterGroup({
2990
3015
 
2991
3016
  // packages/react/src/floating-panel.tsx
2992
3017
  import { isComposingKey as isComposingKey3, tokens as tokens14 } from "@kjun-ui/tokens";
2993
- import { useEffect as useEffect6, useRef as useRef14 } from "react";
3018
+ import { useEffect as useEffect7, useRef as useRef15 } from "react";
2994
3019
  import { Popover as AriaPopover } from "react-aria-components";
2995
3020
  import { jsx as jsx15 } from "react/jsx-runtime";
2996
3021
  function FloatingPanel({
@@ -3006,13 +3031,15 @@ function FloatingPanel({
3006
3031
  flip = true,
3007
3032
  nonModal = false,
3008
3033
  ownsDismiss = false,
3009
- returnFocus
3034
+ returnFocus,
3035
+ repositionKey = 0,
3036
+ inside
3010
3037
  }) {
3011
3038
  const motion = usePresence(open, useReducedMotion(), tokens14.motion.popupExit);
3012
3039
  const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
3013
3040
  const container = useKjunPortalContainer();
3014
- const panel = useRef14(null);
3015
- useEffect6(() => {
3041
+ const panel = useRef15(null);
3042
+ useEffect7(() => {
3016
3043
  var _a;
3017
3044
  const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
3018
3045
  if (!open || nonModal || !document2 || layer.keyboardManaged) return;
@@ -3041,12 +3068,17 @@ function FloatingPanel({
3041
3068
  if (next) onOpenChange(next);
3042
3069
  } : onOpenChange,
3043
3070
  triggerRef,
3071
+ shouldCloseOnInteractOutside: inside ? (element) => {
3072
+ var _a;
3073
+ return !((_a = inside.current) == null ? void 0 : _a.contains(element));
3074
+ } : void 0,
3044
3075
  UNSTABLE_portalContainer: container,
3045
3076
  placement: placement.replace("-", " "),
3046
3077
  shouldFlip: flip,
3047
3078
  maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? tokens14.extensions.menu.listMaxHeight : tokens14.extensions.floating.maxHeight : void 0,
3048
3079
  offset: field ? tokens14.extensions.floating.fieldGap : tokens14.extensions.floating.anchorGap,
3049
3080
  containerPadding: tokens14.extensions.floating.viewportInset,
3081
+ crossOffset: repositionKey % 2 ? 1e-3 : 0,
3050
3082
  className: "kjun-scope kjun-floating " + className,
3051
3083
  "data-motion": "popup",
3052
3084
  "data-motion-open": String(motion.active),
@@ -3059,10 +3091,36 @@ function FloatingPanel({
3059
3091
  }
3060
3092
  ) });
3061
3093
  }
3094
+ var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
3095
+
3096
+ // shared/package-runtime/anchor-rect.ts
3097
+ function place(element, rect) {
3098
+ var _a, _b;
3099
+ const next = [rect.x, rect.y, (_a = rect.width) != null ? _a : 0, (_b = rect.height) != null ? _b : 0].map((value) => value + "px");
3100
+ const style = element.style;
3101
+ if (style.left === next[0] && style.top === next[1] && style.width === next[2] && style.height === next[3]) return false;
3102
+ [style.left, style.top, style.width, style.height] = next;
3103
+ return true;
3104
+ }
3105
+ function followAnchor(element, source, moved) {
3106
+ let frame = 0, stopped = false;
3107
+ const step = () => {
3108
+ const current = source();
3109
+ const rect = typeof current === "function" ? current() : current;
3110
+ if (rect && place(element, rect)) moved();
3111
+ if (!stopped && typeof current === "function") frame = requestAnimationFrame(step);
3112
+ };
3113
+ step();
3114
+ return () => {
3115
+ stopped = true;
3116
+ cancelAnimationFrame(frame);
3117
+ };
3118
+ }
3119
+ var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidden" };
3062
3120
 
3063
3121
  // packages/react/src/popover.tsx
3064
3122
  import { tokens as tokens15 } from "@kjun-ui/tokens";
3065
- import { useCallback as useCallback3, useEffect as useEffect7, useId as useId6, useRef as useRef15, useState as useState10 } from "react";
3123
+ import { useCallback as useCallback4, useEffect as useEffect8, useId as useId6, useLayoutEffect as useLayoutEffect10, useRef as useRef16, useState as useState10 } from "react";
3066
3124
  import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger } from "react-aria-components";
3067
3125
 
3068
3126
  // shared/package-runtime/popover-nonmodal.ts
@@ -3140,24 +3198,36 @@ function KjunPopover({
3140
3198
  returnFocus,
3141
3199
  header,
3142
3200
  modal = true,
3201
+ anchorRect,
3143
3202
  trigger,
3144
3203
  children
3145
3204
  }) {
3146
3205
  const m = useKjunMessages();
3147
- const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef15(null), id = "kjun-" + useId6();
3206
+ const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef16(null), id = "kjun-" + useId6();
3148
3207
  const expanded = usePopupExpanded(open, ref);
3149
- const focusOnMount = useRef15(focusOnOpen);
3208
+ const focusOnMount = useRef16(focusOnOpen);
3150
3209
  focusOnMount.current = focusOnOpen;
3151
- const focusContent = useCallback3((node) => {
3210
+ const focusContent = useCallback4((node) => {
3152
3211
  if (node && focusOnMount.current) node.focus();
3153
3212
  }, []);
3154
- const resolveReturn = returnFocus === void 0 ? void 0 : () => typeof returnFocus === "function" ? returnFocus() : returnFocus instanceof HTMLElement ? returnFocus : returnFocus.current;
3213
+ const resolveReturn = resolveFocusReturn(returnFocus);
3214
+ const anchor = useRef16(null), anchorSource = useRef16(anchorRect), opener = useRef16(null);
3215
+ anchorSource.current = anchorRect;
3216
+ const [reposition, setReposition] = useState10(0);
3217
+ const anchored = anchorRect !== void 0;
3218
+ const wasOpen = useRef16(false);
3219
+ if (open && !wasOpen.current && typeof document !== "undefined") opener.current = document.activeElement;
3220
+ wasOpen.current = open;
3221
+ useLayoutEffect10(() => {
3222
+ if (!open || !anchored || !anchor.current) return;
3223
+ return followAnchor(anchor.current, () => anchorSource.current, () => setReposition((n) => n + 1));
3224
+ }, [open, anchored, typeof anchorRect === "function" ? anchorRect : anchorRect && `${anchorRect.x},${anchorRect.y},${anchorRect.width},${anchorRect.height}`]);
3155
3225
  const change = (v) => {
3156
3226
  setInternal(v);
3157
3227
  onOpenChange == null ? void 0 : onOpenChange(v);
3158
3228
  };
3159
- const skipReturn = useRef15(false);
3160
- useEffect7(() => {
3229
+ const skipReturn = useRef16(false);
3230
+ useEffect8(() => {
3161
3231
  if (!open || modal) return;
3162
3232
  skipReturn.current = false;
3163
3233
  return installNonModalPopover({
@@ -3174,7 +3244,8 @@ function KjunPopover({
3174
3244
  });
3175
3245
  const content = /* @__PURE__ */ jsx16("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
3176
3246
  return /* @__PURE__ */ jsxs10(Fragment4, { children: [
3177
- /* @__PURE__ */ jsx16(
3247
+ anchored && /* @__PURE__ */ jsx16("div", { ref: anchor, "aria-hidden": "true", style: anchorStyle }),
3248
+ (!anchored || trigger != null) && /* @__PURE__ */ jsx16(
3178
3249
  "div",
3179
3250
  {
3180
3251
  ref,
@@ -3199,13 +3270,18 @@ function KjunPopover({
3199
3270
  {
3200
3271
  open,
3201
3272
  onOpenChange: change,
3202
- triggerRef: ref,
3273
+ triggerRef: anchored ? anchor : ref,
3274
+ inside: anchored ? ref : void 0,
3275
+ repositionKey: reposition,
3203
3276
  className: "kjun-content-popover" + (header != null ? " kjun-popover-has-header" : ""),
3204
3277
  placement,
3205
3278
  matchTriggerWidth,
3206
3279
  maxHeight,
3207
3280
  flip,
3208
- returnFocus: () => skipReturn.current ? false : resolveReturn == null ? void 0 : resolveReturn(),
3281
+ returnFocus: () => {
3282
+ var _a;
3283
+ return skipReturn.current ? false : (_a = resolveReturn == null ? void 0 : resolveReturn()) != null ? _a : anchored && trigger == null ? opener.current : void 0;
3284
+ },
3209
3285
  nonModal: !modal,
3210
3286
  ownsDismiss: !modal,
3211
3287
  children: (() => {
@@ -3229,6 +3305,9 @@ function KjunPopover({
3229
3305
  }
3230
3306
  function KjunTooltip({
3231
3307
  content = "",
3308
+ title,
3309
+ align,
3310
+ width,
3232
3311
  placement = "top",
3233
3312
  delay = 0,
3234
3313
  open: controlled,
@@ -3242,19 +3321,23 @@ function KjunTooltip({
3242
3321
  onOpenChange == null ? void 0 : onOpenChange(value);
3243
3322
  };
3244
3323
  const layer = useLayer(open, open, "tooltip", () => setOpen(false));
3245
- return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content || !layer.scopeActive, children: [
3324
+ return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked && !!(content || title), onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content && !title || !layer.scopeActive, children: [
3246
3325
  /* @__PURE__ */ jsx16(Focusable, { children }),
3247
3326
  container !== null && /* @__PURE__ */ jsxs10(
3248
3327
  Tooltip,
3249
3328
  {
3250
- style: { zIndex: layer.zIndex },
3329
+ style: { zIndex: layer.zIndex, ...width ? { maxWidth: `var(--_kjun-extension-tooltip-max-widths-${width})` } : {} },
3330
+ "data-align": align,
3251
3331
  UNSTABLE_portalContainer: container,
3252
3332
  placement,
3253
3333
  offset: tokens15.extensions.floating.anchorGap,
3254
3334
  className: "kjun-scope kjun-tooltip",
3255
3335
  children: [
3256
3336
  /* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width: tokens15.extensions.tooltip.arrowSize, height: tokens15.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx16("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
3257
- content
3337
+ title ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
3338
+ /* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-title", children: title }),
3339
+ content && /* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-body", children: content })
3340
+ ] }) : content
3258
3341
  ]
3259
3342
  }
3260
3343
  )
@@ -3263,7 +3346,7 @@ function KjunTooltip({
3263
3346
 
3264
3347
  // packages/react/src/dropdown.tsx
3265
3348
  import { tokens as tokens16 } from "@kjun-ui/tokens";
3266
- import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext11, useEffect as useEffect8, useId as useId7, useRef as useRef16, useState as useState11 } from "react";
3349
+ import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback5, useContext as useContext11, useEffect as useEffect9, useId as useId7, useRef as useRef17, useState as useState11 } from "react";
3267
3350
  import { Menu, MenuItem, Separator } from "react-aria-components";
3268
3351
  import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
3269
3352
  var DropdownContext = createContext11(null);
@@ -3276,12 +3359,13 @@ function KjunDropdown({
3276
3359
  trigger,
3277
3360
  children,
3278
3361
  onOpen,
3279
- onClose
3362
+ onClose,
3363
+ returnFocus
3280
3364
  }) {
3281
- const [open, setOpen] = useState11(false), currentOpen = useRef16(false), ref = useRef16(null), id = "kjun-" + useId7();
3282
- const menuFocusCleanup = useRef16(() => {
3365
+ const [open, setOpen] = useState11(false), currentOpen = useRef17(false), ref = useRef17(null), id = "kjun-" + useId7();
3366
+ const menuFocusCleanup = useRef17(() => {
3283
3367
  });
3284
- const bindMenu = useCallback4((menu) => {
3368
+ const bindMenu = useCallback5((menu) => {
3285
3369
  menuFocusCleanup.current();
3286
3370
  menuFocusCleanup.current = () => {
3287
3371
  };
@@ -3332,7 +3416,7 @@ function KjunDropdown({
3332
3416
  if (value) onOpen == null ? void 0 : onOpen();
3333
3417
  else onClose == null ? void 0 : onClose();
3334
3418
  };
3335
- useEffect8(() => {
3419
+ useEffect9(() => {
3336
3420
  if (unavailable) change(false);
3337
3421
  }, [unavailable]);
3338
3422
  return /* @__PURE__ */ jsxs11(DropdownContext.Provider, { value: () => change(false), children: [
@@ -3356,6 +3440,7 @@ function KjunDropdown({
3356
3440
  {
3357
3441
  open,
3358
3442
  onOpenChange: change,
3443
+ returnFocus: resolveFocusReturn(returnFocus),
3359
3444
  triggerRef: ref,
3360
3445
  placement,
3361
3446
  className: "kjun-dropdown",
@@ -3386,7 +3471,7 @@ function KjunDropdownItem({
3386
3471
  onClick
3387
3472
  }) {
3388
3473
  const close = useContext11(DropdownContext);
3389
- const node = useCallback4((element) => {
3474
+ const node = useCallback5((element) => {
3390
3475
  if (!element) return;
3391
3476
  if (selected === null) {
3392
3477
  element.setAttribute("role", "menuitem");
@@ -3513,6 +3598,7 @@ function KjunDrawer({
3513
3598
  footer,
3514
3599
  children,
3515
3600
  onClose,
3601
+ onAfterClose,
3516
3602
  ariaLabel,
3517
3603
  safeAreaTop = 0,
3518
3604
  safeAreaBottom = 0,
@@ -3520,6 +3606,7 @@ function KjunDrawer({
3520
3606
  }) {
3521
3607
  const m = useKjunMessages();
3522
3608
  const motion = usePresence(open, useReducedMotion(), tokens17.motion.layerExit);
3609
+ const afterCloseRef = useAfterCloseRef(open, onAfterClose);
3523
3610
  const container = useKjunPortalContainer();
3524
3611
  const close = () => {
3525
3612
  if (!open) return;
@@ -3533,6 +3620,7 @@ function KjunDrawer({
3533
3620
  return /* @__PURE__ */ jsx18(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx18(
3534
3621
  ModalOverlay2,
3535
3622
  {
3623
+ ref: afterCloseRef,
3536
3624
  style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
3537
3625
  isOpen: motion.present && layer.active,
3538
3626
  isExiting: motion.present && !layer.active,
@@ -3599,7 +3687,7 @@ function KjunDrawer({
3599
3687
  }
3600
3688
 
3601
3689
  // shared/package-runtime/combobox.ts
3602
- import { useEffect as useEffect9, useState as useState12 } from "react";
3690
+ import { useEffect as useEffect10, useState as useState12 } from "react";
3603
3691
 
3604
3692
  // shared/package-runtime/options.ts
3605
3693
  var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
@@ -3679,8 +3767,8 @@ function useComboboxModel({
3679
3767
  const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
3680
3768
  const [query2, setQuery] = useState12(selectedLabel);
3681
3769
  const [open, setOpen] = useState12(false);
3682
- useEffect9(() => setQuery(selectedLabel), [value, selectedLabel]);
3683
- useEffect9(() => {
3770
+ useEffect10(() => setQuery(selectedLabel), [value, selectedLabel]);
3771
+ useEffect10(() => {
3684
3772
  if (disabled) setOpen(false);
3685
3773
  }, [disabled]);
3686
3774
  const change = (next) => {
@@ -3714,9 +3802,9 @@ function useComboboxModel({
3714
3802
 
3715
3803
  // packages/react/src/combobox.tsx
3716
3804
  import {
3717
- useEffect as useEffect10,
3805
+ useEffect as useEffect11,
3718
3806
  useId as useId8,
3719
- useRef as useRef17,
3807
+ useRef as useRef18,
3720
3808
  useState as useState13
3721
3809
  } from "react";
3722
3810
  import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
@@ -3737,7 +3825,8 @@ function KjunCombobox({
3737
3825
  onValueChange,
3738
3826
  onChange,
3739
3827
  onSearch,
3740
- onClear
3828
+ onClear,
3829
+ returnFocus
3741
3830
  }) {
3742
3831
  const m = useKjunMessages();
3743
3832
  placeholder != null ? placeholder : placeholder = m.searchOrSelect;
@@ -3773,7 +3862,8 @@ function KjunCombobox({
3773
3862
  renderOption,
3774
3863
  onValueChange: (v) => model.search(v, true),
3775
3864
  onSelect: model.select,
3776
- onClear: model.clear
3865
+ onClear: model.clear,
3866
+ returnFocus: resolveFocusReturn(returnFocus)
3777
3867
  }
3778
3868
  );
3779
3869
  }
@@ -3798,16 +3888,17 @@ function SearchField({
3798
3888
  onValueChange,
3799
3889
  onSelect,
3800
3890
  onClear,
3801
- onEnter
3891
+ onEnter,
3892
+ returnFocus
3802
3893
  }) {
3803
3894
  const m = useKjunMessages();
3804
3895
  const composition = useCompositionGuard();
3805
- const clearing = useRef17(false);
3806
- const ref = useRef17(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
3896
+ const clearing = useRef18(false);
3897
+ const ref = useRef18(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
3807
3898
  const focusGuard = usePopupFocusGuard(ref);
3808
3899
  const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
3809
- useEffect10(() => setActive(-1), [value, options.length]);
3810
- useEffect10(() => {
3900
+ useEffect11(() => setActive(-1), [value, options.length]);
3901
+ useEffect11(() => {
3811
3902
  if (!open) return;
3812
3903
  const leaveField = (event) => {
3813
3904
  var _a, _b, _c;
@@ -3817,16 +3908,16 @@ function SearchField({
3817
3908
  document.addEventListener("focusin", leaveField);
3818
3909
  return () => document.removeEventListener("focusin", leaveField);
3819
3910
  }, [open, onOpenChange, id]);
3820
- useEffect10(() => {
3911
+ useEffect11(() => {
3821
3912
  if (highlighted !== active) setActive(-1);
3822
3913
  }, [highlighted, active]);
3823
3914
  const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
3824
3915
  const select = (o) => {
3825
- var _a;
3916
+ var _a, _b;
3826
3917
  if (o === void 0 || disabled || loading || optionDisabled(o)) return;
3827
3918
  onSelect(o);
3828
3919
  onOpenChange(false);
3829
- (_a = ref.current) == null ? void 0 : _a.focus();
3920
+ (_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
3830
3921
  };
3831
3922
  return /* @__PURE__ */ jsxs13(Fragment5, { children: [
3832
3923
  /* @__PURE__ */ jsx19(
@@ -3874,7 +3965,7 @@ function SearchField({
3874
3965
  onCompositionStart: composition.onCompositionStart,
3875
3966
  onCompositionEnd: composition.onCompositionEnd,
3876
3967
  onKeyDown: (e) => {
3877
- var _a, _b, _c, _d;
3968
+ var _a, _b, _c, _d, _e;
3878
3969
  if (composition.isComposing(e)) return;
3879
3970
  let next = active;
3880
3971
  if (e.key === "ArrowDown") {
@@ -3897,10 +3988,11 @@ function SearchField({
3897
3988
  e.preventDefault();
3898
3989
  e.stopPropagation();
3899
3990
  onOpenChange(false);
3991
+ (_d = returnFocus == null ? void 0 : returnFocus()) == null ? void 0 : _d.focus();
3900
3992
  }
3901
3993
  setActive(next);
3902
3994
  if (next >= 0)
3903
- (_d = document.getElementById(id + "-" + next)) == null ? void 0 : _d.scrollIntoView({ block: "nearest" });
3995
+ (_e = document.getElementById(id + "-" + next)) == null ? void 0 : _e.scrollIntoView({ block: "nearest" });
3904
3996
  }
3905
3997
  }
3906
3998
  ),
@@ -4041,7 +4133,7 @@ function KjunDatePicker({
4041
4133
  import { useState as useState16 } from "react";
4042
4134
 
4043
4135
  // shared/package-runtime/search-input.ts
4044
- import { useEffect as useEffect11, useLayoutEffect as useLayoutEffect10, useRef as useRef18, useState as useState15 } from "react";
4136
+ import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect11, useRef as useRef19, useState as useState15 } from "react";
4045
4137
  function useSearchInputModel({
4046
4138
  value,
4047
4139
  disabled = false,
@@ -4051,20 +4143,20 @@ function useSearchInputModel({
4051
4143
  onValueChange,
4052
4144
  onSearchError
4053
4145
  }, open) {
4054
- const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version = useRef18(0), notify = useRef18(onSearchError);
4146
+ const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version = useRef19(0), notify = useRef19(onSearchError);
4055
4147
  notify.current = onSearchError;
4056
- const timer = useRef18(void 0);
4057
- const notifyValue = useRef18(onValueChange);
4148
+ const timer = useRef19(void 0);
4149
+ const notifyValue = useRef19(onValueChange);
4058
4150
  notifyValue.current = onValueChange;
4059
- useLayoutEffect10(() => {
4151
+ useLayoutEffect11(() => {
4060
4152
  clearTimeout(timer.current);
4061
4153
  setQuery(value);
4062
4154
  }, [value]);
4063
- useLayoutEffect10(() => {
4155
+ useLayoutEffect11(() => {
4064
4156
  clearTimeout(timer.current);
4065
4157
  return () => clearTimeout(timer.current);
4066
4158
  }, [disabled, debounce, !!loadOptions]);
4067
- useEffect11(() => {
4159
+ useEffect12(() => {
4068
4160
  const current = ++version.current, abort = new AbortController();
4069
4161
  setFailed(false);
4070
4162
  if (!loadOptions || !open || disabled || query2.length < minChars) {
@@ -4221,13 +4313,13 @@ import { tokens as tokens19 } from "@kjun-ui/tokens";
4221
4313
  import {
4222
4314
  useId as useId9,
4223
4315
  useContext as useContext12,
4224
- useRef as useRef20,
4225
- useEffect as useEffect13
4316
+ useRef as useRef21,
4317
+ useEffect as useEffect14
4226
4318
  } from "react";
4227
4319
  import { ListBox, ListBoxItem } from "react-aria-components";
4228
4320
 
4229
4321
  // shared/package-runtime/select.ts
4230
- import { useEffect as useEffect12, useRef as useRef19, useState as useState17 } from "react";
4322
+ import { useEffect as useEffect13, useRef as useRef20, useState as useState17 } from "react";
4231
4323
  function useSelectState(controlled, disabled, pageSize, onOpenChange) {
4232
4324
  const [internal, setInternal] = useState17(false);
4233
4325
  const [query2, setQuery] = useState17("");
@@ -4235,8 +4327,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
4235
4327
  const [session, setSession] = useState17(0);
4236
4328
  const isControlled = typeof controlled === "boolean";
4237
4329
  const open = !disabled && (isControlled ? controlled : internal);
4238
- const previousOpen = useRef19(open);
4239
- useEffect12(() => {
4330
+ const previousOpen = useRef20(open);
4331
+ useEffect13(() => {
4240
4332
  if (disabled && !isControlled) setInternal(false);
4241
4333
  if (previousOpen.current && !open) {
4242
4334
  setQuery("");
@@ -4245,7 +4337,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
4245
4337
  }
4246
4338
  previousOpen.current = open;
4247
4339
  }, [open, disabled, isControlled, pageSize]);
4248
- useEffect12(() => {
4340
+ useEffect13(() => {
4249
4341
  setLimit(pageSize);
4250
4342
  }, [pageSize]);
4251
4343
  const changeOpen = (next) => {
@@ -4294,24 +4386,25 @@ function KjunSelect({
4294
4386
  onSearch,
4295
4387
  onClear,
4296
4388
  filterFn,
4297
- searchKeys
4389
+ searchKeys,
4390
+ returnFocus
4298
4391
  }) {
4299
4392
  const m = useKjunMessages();
4300
4393
  placeholder != null ? placeholder : placeholder = m.select;
4301
4394
  searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
4302
4395
  const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
4303
4396
  const composition = useCompositionGuard();
4304
- const ref = useRef20(null), menu = useRef20(null), field = useKjunField(), id = "kjun-" + useId9();
4397
+ const ref = useRef21(null), menu = useRef21(null), field = useKjunField(), id = "kjun-" + useId9();
4305
4398
  const segment = useContext12(CompoundControlContext) !== null;
4306
4399
  const spec = tokens19.input[size];
4307
4400
  const expanded = usePopupExpanded(open, ref);
4308
4401
  const registerControl = field == null ? void 0 : field.setControlId;
4309
- useEffect13(() => {
4402
+ useEffect14(() => {
4310
4403
  if (!registerControl || !triggerId) return;
4311
4404
  registerControl(triggerId);
4312
4405
  return () => registerControl(void 0);
4313
4406
  }, [registerControl, triggerId]);
4314
- useEffect13(() => {
4407
+ useEffect14(() => {
4315
4408
  var _a, _b;
4316
4409
  if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
4317
4410
  if (!open) composition.onCompositionEnd();
@@ -4403,6 +4496,7 @@ function KjunSelect({
4403
4496
  {
4404
4497
  field: true,
4405
4498
  open,
4499
+ returnFocus: resolveFocusReturn(returnFocus),
4406
4500
  onOpenChange: changeOpen,
4407
4501
  triggerRef: ref,
4408
4502
  placement: "bottom-start",
@@ -4502,17 +4596,19 @@ import { tokens as tokens21 } from "@kjun-ui/tokens";
4502
4596
 
4503
4597
  // packages/react/src/collapse.tsx
4504
4598
  import { tokens as tokens20 } from "@kjun-ui/tokens";
4505
- import { useLayoutEffect as useLayoutEffect11, useRef as useRef21, useState as useState18 } from "react";
4599
+ import { useLayoutEffect as useLayoutEffect12, useRef as useRef22, useState as useState18 } from "react";
4506
4600
  import { jsx as jsx23 } from "react/jsx-runtime";
4507
- function Collapse({ open, children }) {
4601
+ function Collapse({ open, keepMounted = false, children }) {
4508
4602
  const reduced = useReducedMotion();
4509
4603
  const [retained, setRetained] = useState18(open);
4510
- const root = useRef21(null), body = useRef21(null);
4511
- const animation = useRef21(null);
4512
- const previous = useRef21(open);
4513
- const interrupted = useRef21(null);
4514
- const present = open || retained;
4515
- useLayoutEffect11(() => {
4604
+ const root = useRef22(null), body = useRef22(null);
4605
+ const animation = useRef22(null);
4606
+ const previous = useRef22(open);
4607
+ const interrupted = useRef22(null);
4608
+ const opened = useRef22(open);
4609
+ if (open) opened.current = true;
4610
+ const present = open || retained || keepMounted && opened.current;
4611
+ useLayoutEffect12(() => {
4516
4612
  const el = root.current, inner = body.current;
4517
4613
  if (!el || !inner) return;
4518
4614
  let disposed = false;
@@ -4567,10 +4663,10 @@ function Collapse({ open, children }) {
4567
4663
  }
4568
4664
 
4569
4665
  // shared/package-runtime/navigation.ts
4570
- import { useEffect as useEffect14, useRef as useRef22, useState as useState19 } from "react";
4666
+ import { useEffect as useEffect15, useRef as useRef23, useState as useState19 } from "react";
4571
4667
  function useInitialTab(value, candidate, change) {
4572
- const requested = useRef22(/* @__PURE__ */ new Set());
4573
- useEffect14(() => {
4668
+ const requested = useRef23(/* @__PURE__ */ new Set());
4669
+ useEffect15(() => {
4574
4670
  if (value !== "") {
4575
4671
  requested.current.clear();
4576
4672
  return;
@@ -4582,7 +4678,7 @@ function useInitialTab(value, candidate, change) {
4582
4678
  }
4583
4679
  function useAccordionState(multiple) {
4584
4680
  const [opened, setOpened] = useState19(/* @__PURE__ */ new Set());
4585
- useEffect14(() => {
4681
+ useEffect15(() => {
4586
4682
  if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
4587
4683
  }, [multiple]);
4588
4684
  return {
@@ -4672,10 +4768,10 @@ import {
4672
4768
  Fragment as Fragment7,
4673
4769
  isValidElement as isValidElement3,
4674
4770
  useContext as useContext13,
4675
- useEffect as useEffect15,
4676
- useLayoutEffect as useLayoutEffect12,
4771
+ useEffect as useEffect16,
4772
+ useLayoutEffect as useLayoutEffect13,
4677
4773
  useId as useId10,
4678
- useRef as useRef23,
4774
+ useRef as useRef24,
4679
4775
  useState as useState20
4680
4776
  } from "react";
4681
4777
  import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
@@ -4700,29 +4796,29 @@ function KjunTabs({
4700
4796
  isValidElement3
4701
4797
  );
4702
4798
  const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
4703
- useLayoutEffect12(() => {
4799
+ useLayoutEffect13(() => {
4704
4800
  var _a2;
4705
4801
  const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
4706
4802
  if (list) return manageTabList(list, () => {
4707
4803
  }, false);
4708
4804
  }, [group]);
4709
- useLayoutEffect12(() => {
4805
+ useLayoutEffect13(() => {
4710
4806
  var _a2;
4711
4807
  const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
4712
4808
  for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
4713
4809
  if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
4714
4810
  }
4715
4811
  });
4716
- const timer = useRef23(void 0), press = useRef23(null);
4717
- const menuState = useRef23({ tabs, onTabMenu });
4812
+ const timer = useRef24(void 0), press = useRef24(null);
4813
+ const menuState = useRef24({ tabs, onTabMenu });
4718
4814
  menuState.current = { tabs, onTabMenu };
4719
4815
  const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
4720
4816
  const clear = () => {
4721
4817
  clearTimeout(timer.current);
4722
4818
  press.current = null;
4723
4819
  };
4724
- useEffect15(() => clear, []);
4725
- useLayoutEffect12(() => {
4820
+ useEffect16(() => clear, []);
4821
+ useLayoutEffect13(() => {
4726
4822
  if (press.current && !canOpenMenu(press.current.name)) clear();
4727
4823
  }, [tabs, onTabMenu]);
4728
4824
  const change = (name) => {
@@ -4839,12 +4935,30 @@ function KjunAccordionItem({
4839
4935
  defaultOpen = false,
4840
4936
  disabled = false,
4841
4937
  header,
4938
+ open: openProp,
4939
+ onOpenChange,
4940
+ keepMounted = false,
4842
4941
  children
4843
4942
  }) {
4844
- const group = useContext13(AccordionContext), id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = group ? group.opened.has(id) : own;
4845
- useEffect15(() => {
4943
+ const controlled = openProp !== void 0, context = useContext13(AccordionContext), group = controlled ? null : context, id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = controlled ? openProp : group ? group.opened.has(id) : own;
4944
+ useEffect16(() => {
4846
4945
  return group == null ? void 0 : group.register(id, defaultOpen);
4847
4946
  }, []);
4947
+ const reported = useRef24(open), notify = useRef24(onOpenChange), registering = useRef24(!!group && defaultOpen);
4948
+ notify.current = onOpenChange;
4949
+ useEffect16(() => {
4950
+ var _a;
4951
+ if (registering.current) {
4952
+ if (open) {
4953
+ registering.current = false;
4954
+ reported.current = open;
4955
+ }
4956
+ return;
4957
+ }
4958
+ if (controlled || reported.current === open) return;
4959
+ reported.current = open;
4960
+ (_a = notify.current) == null ? void 0 : _a.call(notify, open);
4961
+ }, [open, controlled]);
4848
4962
  return /* @__PURE__ */ jsxs16("div", { className: "kjun-accordion-item", children: [
4849
4963
  /* @__PURE__ */ jsxs16(
4850
4964
  "button",
@@ -4855,7 +4969,10 @@ function KjunAccordionItem({
4855
4969
  "aria-expanded": open,
4856
4970
  "aria-controls": id + "-panel",
4857
4971
  className: "kjun-accordion-trigger",
4858
- onClick: () => group ? group.toggle(id) : setOwn(!own),
4972
+ onClick: () => {
4973
+ registering.current = false;
4974
+ controlled ? onOpenChange == null ? void 0 : onOpenChange(!open) : group ? group.toggle(id) : setOwn(!own);
4975
+ },
4859
4976
  children: [
4860
4977
  /* @__PURE__ */ jsx24("span", { className: "kjun-accordion-heading", children: header || title }),
4861
4978
  /* @__PURE__ */ jsx24(
@@ -4870,7 +4987,7 @@ function KjunAccordionItem({
4870
4987
  ]
4871
4988
  }
4872
4989
  ),
4873
- /* @__PURE__ */ jsx24(Collapse, { open, children: /* @__PURE__ */ jsx24(
4990
+ /* @__PURE__ */ jsx24(Collapse, { open, keepMounted, children: /* @__PURE__ */ jsx24(
4874
4991
  "div",
4875
4992
  {
4876
4993
  role: "region",
@@ -4999,8 +5116,8 @@ function KjunPagination({
4999
5116
  import { tokens as tokens22 } from "@kjun-ui/tokens";
5000
5117
  import {
5001
5118
  useContext as useContext14,
5002
- useEffect as useEffect16,
5003
- useRef as useRef24,
5119
+ useEffect as useEffect17,
5120
+ useRef as useRef25,
5004
5121
  useState as useState21
5005
5122
  } from "react";
5006
5123
  import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
@@ -5084,8 +5201,8 @@ function KjunCopyButton({
5084
5201
  const m = useKjunMessages();
5085
5202
  successText != null ? successText : successText = m.copied;
5086
5203
  const feedback = useOptionalKjunFeedback();
5087
- const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef24(false), timer = useRef24(void 0), mounted = useRef24(true);
5088
- useEffect16(() => {
5204
+ const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef25(false), timer = useRef25(void 0), mounted = useRef25(true);
5205
+ useEffect17(() => {
5089
5206
  mounted.current = true;
5090
5207
  return () => {
5091
5208
  mounted.current = false;
@@ -5216,7 +5333,7 @@ function KjunExternalLink({
5216
5333
  ) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
5217
5334
  }
5218
5335
  function KjunScrollFade({ children }) {
5219
- const ref = useRef24(null), [edges, setEdges] = useState21({ left: false, right: false });
5336
+ const ref = useRef25(null), [edges, setEdges] = useState21({ left: false, right: false });
5220
5337
  const update = () => {
5221
5338
  const el = ref.current;
5222
5339
  if (el)
@@ -5228,7 +5345,7 @@ function KjunScrollFade({ children }) {
5228
5345
  return prev.left === next.left && prev.right === next.right ? prev : next;
5229
5346
  });
5230
5347
  };
5231
- useEffect16(() => {
5348
+ useEffect17(() => {
5232
5349
  update();
5233
5350
  const observer = new ResizeObserver(update);
5234
5351
  if (ref.current) {
@@ -5260,10 +5377,10 @@ import {
5260
5377
  import { Component, useState as useState23 } from "react";
5261
5378
 
5262
5379
  // shared/package-runtime/use-loading-reveal.ts
5263
- import { useEffect as useEffect17, useState as useState22 } from "react";
5380
+ import { useEffect as useEffect18, useState as useState22 } from "react";
5264
5381
  function useLoadingReveal(active, delay = 0) {
5265
5382
  const [revealed, setRevealed] = useState22(false);
5266
- useEffect17(() => {
5383
+ useEffect18(() => {
5267
5384
  setRevealed(false);
5268
5385
  if (!active || delay <= 0) return;
5269
5386
  const timer = setTimeout(() => setRevealed(true), delay);
@@ -5595,7 +5712,7 @@ import {
5595
5712
  import { tokens as tokens28 } from "@kjun-ui/tokens";
5596
5713
 
5597
5714
  // shared/package-runtime/use-number-motion.ts
5598
- import { useLayoutEffect as useLayoutEffect13, useRef as useRef25, useState as useState24 } from "react";
5715
+ import { useLayoutEffect as useLayoutEffect14, useRef as useRef26, useState as useState24 } from "react";
5599
5716
 
5600
5717
  // shared/package-runtime/number-motion.ts
5601
5718
  import { tokens as tokens27 } from "@kjun-ui/tokens";
@@ -5642,13 +5759,13 @@ function createNumberMotion(apply) {
5642
5759
  // shared/package-runtime/use-number-motion.ts
5643
5760
  function useNumberMotion(value, animated, fromPrevious, reduced) {
5644
5761
  const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
5645
- const motion = useRef25(null);
5762
+ const motion = useRef26(null);
5646
5763
  if (!motion.current) motion.current = createNumberMotion(setDisplay);
5647
- useLayoutEffect13(() => {
5764
+ useLayoutEffect14(() => {
5648
5765
  if (!motion.current) motion.current = createNumberMotion(setDisplay);
5649
5766
  motion.current.update(value, animated, fromPrevious, reduced);
5650
5767
  }, [value, animated, fromPrevious, reduced]);
5651
- useLayoutEffect13(() => () => {
5768
+ useLayoutEffect14(() => () => {
5652
5769
  var _a;
5653
5770
  (_a = motion.current) == null ? void 0 : _a.cancel();
5654
5771
  motion.current = null;
@@ -5974,7 +6091,7 @@ function KjunSparkline({
5974
6091
 
5975
6092
  // shared/package-runtime/table.ts
5976
6093
  import { nextTableSort } from "@kjun-ui/tokens";
5977
- import { useEffect as useEffect18, useRef as useRef26, useState as useState25 } from "react";
6094
+ import { useEffect as useEffect19, useRef as useRef27, useState as useState25 } from "react";
5978
6095
 
5979
6096
  // shared/package-runtime/table-model.ts
5980
6097
  function getValue(row, key) {
@@ -6021,8 +6138,8 @@ function useTableModel(props) {
6021
6138
  const [internalSort, setSort] = useState25({
6022
6139
  key: "",
6023
6140
  order: "asc"
6024
- }), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef26(void 0);
6025
- useEffect18(() => () => clearTimeout(timer.current), []);
6141
+ }), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef27(void 0);
6142
+ useEffect19(() => () => clearTimeout(timer.current), []);
6026
6143
  const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
6027
6144
  const rows = sortTableRows(data, sort, { sortable, sortMode });
6028
6145
  const key = (row, index = 0) => tableRowKey(row, rowKey, index);
@@ -6416,7 +6533,7 @@ function TableCards({
6416
6533
  }
6417
6534
 
6418
6535
  // packages/react/src/table-view.tsx
6419
- import { useEffect as useEffect19, useState as useState26 } from "react";
6536
+ import { useEffect as useEffect20, useState as useState26 } from "react";
6420
6537
  import { isComposingKey as isComposingKey4, tokens as tokens33 } from "@kjun-ui/tokens";
6421
6538
  import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
6422
6539
  function KjunTable(props) {
@@ -6448,7 +6565,7 @@ function KjunTable(props) {
6448
6565
  onRetry
6449
6566
  } = props;
6450
6567
  const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
6451
- useEffect19(() => {
6568
+ useEffect20(() => {
6452
6569
  const media = matchMedia(`(width < ${tokens33.table.mobileBreakpoint}px)`);
6453
6570
  const update = () => setMobile(media.matches);
6454
6571
  update();
@@ -6814,7 +6931,7 @@ function KjunKpiRow({
6814
6931
  import { tokens as tokens35 } from "@kjun-ui/tokens";
6815
6932
 
6816
6933
  // shared/package-runtime/market-cards.ts
6817
- import { useEffect as useEffect20, useRef as useRef27, useState as useState27 } from "react";
6934
+ import { useEffect as useEffect21, useRef as useRef28, useState as useState27 } from "react";
6818
6935
  function useMarketCardsModel(props, persistence) {
6819
6936
  const {
6820
6937
  columns,
@@ -6831,7 +6948,7 @@ function useMarketCardsModel(props, persistence) {
6831
6948
  isDefaultSort: c.defaultSort
6832
6949
  }));
6833
6950
  const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
6834
- const mounted = useRef27("");
6951
+ const mounted = useRef28("");
6835
6952
  const save = (key2) => {
6836
6953
  var _a;
6837
6954
  try {
@@ -6839,7 +6956,7 @@ function useMarketCardsModel(props, persistence) {
6839
6956
  } catch (e) {
6840
6957
  }
6841
6958
  };
6842
- useEffect20(() => {
6959
+ useEffect21(() => {
6843
6960
  var _a, _b;
6844
6961
  if (mounted.current === restoreSignature) return;
6845
6962
  mounted.current = restoreSignature;
@@ -7174,7 +7291,7 @@ function watchTrailingOverflow(element, onChange) {
7174
7291
  }
7175
7292
 
7176
7293
  // packages/react/src/market-table.tsx
7177
- import { useEffect as useEffect21, useRef as useRef28, useState as useState28 } from "react";
7294
+ import { useEffect as useEffect22, useRef as useRef29, useState as useState28 } from "react";
7178
7295
  import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
7179
7296
  function KjunMarketTable(props) {
7180
7297
  const m = useKjunMessages();
@@ -7196,8 +7313,8 @@ function KjunMarketTable(props) {
7196
7313
  formatMetric,
7197
7314
  renderCell
7198
7315
  } = props;
7199
- const scroller = useRef28(null), [fadeEnd, setFadeEnd] = useState28(false);
7200
- useEffect21(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
7316
+ const scroller = useRef29(null), [fadeEnd, setFadeEnd] = useState28(false);
7317
+ useEffect22(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
7201
7318
  const render = (row, col) => {
7202
7319
  const value = getValue(row, col.key), stale = !!getValue(row, "stale");
7203
7320
  if (cellLoading(row, col))
@@ -7387,36 +7504,52 @@ function KjunMarketTable(props) {
7387
7504
 
7388
7505
  // packages/react/src/list.tsx
7389
7506
  import { tokens as tokens39 } from "@kjun-ui/tokens";
7390
- import { useId as useId12 } from "react";
7507
+ import { useEffect as useEffect23, useId as useId12, useRef as useRef30 } from "react";
7391
7508
  import { Fragment as Fragment18, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
7392
- function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick }) {
7509
+ function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
7510
+ const content = useRef30(null), pressable = !!(href || onClick);
7511
+ useEffect23(() => {
7512
+ if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
7513
+ }, [pressable]);
7393
7514
  const contents = /* @__PURE__ */ jsxs35(Fragment18, { children: [
7394
7515
  leading && /* @__PURE__ */ jsx43("span", { className: "kjun-list-leading", children: leading }),
7395
7516
  /* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
7396
7517
  /* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
7397
- description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description })
7518
+ description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description }),
7519
+ hasContent(children) && /* @__PURE__ */ jsx43("span", { ref: content, className: "kjun-list-content", children })
7398
7520
  ] }),
7399
7521
  trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing }),
7400
7522
  chevron && /* @__PURE__ */ jsx43(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: tokens39.iconSizes.default })
7401
7523
  ] });
7402
- const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
7524
+ const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-label": ariaLabel, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
7403
7525
  return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
7404
7526
  main,
7405
7527
  actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
7406
7528
  ] });
7407
7529
  }
7408
- function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
7530
+ function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default", radius = "none" }) {
7409
7531
  const id = "kjun-" + useId12();
7410
- return /* @__PURE__ */ jsxs35("section", { className: "kjun-list-section", "data-surface": surface ? void 0 : "false", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
7411
- (title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
7412
- /* @__PURE__ */ jsxs35("div", { children: [
7413
- title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
7414
- description && /* @__PURE__ */ jsx43("p", { children: description })
7415
- ] }),
7416
- actions
7417
- ] }),
7418
- /* @__PURE__ */ jsx43("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
7419
- ] });
7532
+ return /* @__PURE__ */ jsxs35(
7533
+ "section",
7534
+ {
7535
+ className: "kjun-list-section",
7536
+ "data-surface": surface ? void 0 : "false",
7537
+ "data-radius": radius === "none" ? void 0 : radius,
7538
+ style: radius === "none" ? void 0 : { borderRadius: `var(--_kjun-geometry-card-radii-${radius})` },
7539
+ "aria-labelledby": title ? id : void 0,
7540
+ "aria-label": title ? void 0 : ariaLabel,
7541
+ children: [
7542
+ (title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
7543
+ /* @__PURE__ */ jsxs35("div", { children: [
7544
+ title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
7545
+ description && /* @__PURE__ */ jsx43("p", { children: description })
7546
+ ] }),
7547
+ actions
7548
+ ] }),
7549
+ /* @__PURE__ */ jsx43("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
7550
+ ]
7551
+ }
7552
+ );
7420
7553
  }
7421
7554
  function KjunListItem({ children }) {
7422
7555
  return /* @__PURE__ */ jsx43("li", { className: "kjun-list-item", children });
@@ -7466,11 +7599,11 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
7466
7599
  }
7467
7600
 
7468
7601
  // packages/react/src/media.tsx
7469
- import { useRef as useRef29, useState as useState29 } from "react";
7602
+ import { useRef as useRef31, useState as useState29 } from "react";
7470
7603
  import { tokens as tokens41 } from "@kjun-ui/tokens";
7471
7604
  import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
7472
7605
  function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
7473
- const current = useRef29({ src, version: 0 });
7606
+ const current = useRef31({ src, version: 0 });
7474
7607
  if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
7475
7608
  const version = current.current.version;
7476
7609
  const [result, setResult] = useState29({ version, state: "loading" });
@@ -7525,7 +7658,7 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
7525
7658
  }
7526
7659
 
7527
7660
  // packages/react/src/range-input.tsx
7528
- import { useEffect as useEffect22, useRef as useRef30 } from "react";
7661
+ import { useEffect as useEffect24, useRef as useRef32 } from "react";
7529
7662
  import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
7530
7663
  import { createSliderDomain } from "@kjun-ui/tokens";
7531
7664
  import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
@@ -7535,10 +7668,10 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
7535
7668
  const domain = createSliderDomain(min, max, step);
7536
7669
  const list = Array.isArray(value) ? value : [value];
7537
7670
  const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
7538
- const latest = useRef30(value);
7671
+ const latest = useRef32(value);
7539
7672
  latest.current = value;
7540
- const active = useRef30(false);
7541
- useEffect22(() => {
7673
+ const active = useRef32(false);
7674
+ useEffect24(() => {
7542
7675
  if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
7543
7676
  }, [valid]);
7544
7677
  const change = (next) => {
@@ -7575,7 +7708,7 @@ function KjunRangeSlider(props) {
7575
7708
  }
7576
7709
 
7577
7710
  // packages/react/src/quantity-stepper.tsx
7578
- import { useEffect as useEffect23, useRef as useRef31, useState as useState30 } from "react";
7711
+ import { useEffect as useEffect25, useRef as useRef33, useState as useState30 } from "react";
7579
7712
  import { createNumberDomain, quantityKeyAction, tokens as tokens44 } from "@kjun-ui/tokens";
7580
7713
  import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
7581
7714
  function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
@@ -7586,13 +7719,13 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
7586
7719
  const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
7587
7720
  const [draft, setDraft] = useState30(String(value));
7588
7721
  const field = useKjunField();
7589
- const composing = useRef31(false), dirty = useRef31(false), accepted = useRef31(value);
7590
- useEffect23(() => {
7722
+ const composing = useRef33(false), dirty = useRef33(false), accepted = useRef33(value);
7723
+ useEffect25(() => {
7591
7724
  setDraft(String(value));
7592
7725
  accepted.current = value;
7593
7726
  dirty.current = false;
7594
7727
  }, [value, precision, min, max, step]);
7595
- useEffect23(() => {
7728
+ useEffect25(() => {
7596
7729
  if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
7597
7730
  }, [valid]);
7598
7731
  const emit = (next) => {
@@ -7667,18 +7800,18 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
7667
7800
  }
7668
7801
 
7669
7802
  // packages/react/src/time-picker.tsx
7670
- import { Fragment as Fragment20, useEffect as useEffect24, useId as useId13, useMemo as useMemo3, useRef as useRef32 } from "react";
7803
+ import { Fragment as Fragment20, useEffect as useEffect26, useId as useId13, useMemo as useMemo3, useRef as useRef34 } from "react";
7671
7804
  import { createTimeDomain } from "@kjun-ui/tokens";
7672
7805
  import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
7673
7806
  function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
7674
7807
  const m = useKjunMessages();
7675
7808
  ariaLabel != null ? ariaLabel : ariaLabel = m.time;
7676
- const root = useRef32(null);
7809
+ const root = useRef34(null);
7677
7810
  const field = useKjunField(), uid = useId13();
7678
7811
  const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
7679
7812
  const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
7680
7813
  const valid = domain.valid && domain.accepts(value);
7681
- useEffect24(() => {
7814
+ useEffect26(() => {
7682
7815
  if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
7683
7816
  }, [valid]);
7684
7817
  const change = (next) => {