@nori-ui/core 1.7.0 → 1.8.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 (36) hide show
  1. package/dist/chunk-BOMPFNM4.js +165 -0
  2. package/dist/chunk-BOMPFNM4.js.map +1 -0
  3. package/dist/chunk-BVLOX4A3.js +256 -0
  4. package/dist/chunk-BVLOX4A3.js.map +1 -0
  5. package/dist/chunk-VFUV6XJR.js +257 -0
  6. package/dist/chunk-VFUV6XJR.js.map +1 -0
  7. package/dist/client.cjs +650 -0
  8. package/dist/client.cjs.map +1 -1
  9. package/dist/client.d.cts +3 -0
  10. package/dist/client.d.ts +3 -0
  11. package/dist/client.js +14 -11
  12. package/dist/client.js.map +1 -1
  13. package/dist/components/Carousel/index.cjs +297 -0
  14. package/dist/components/Carousel/index.cjs.map +1 -0
  15. package/dist/components/Carousel/index.d.cts +67 -0
  16. package/dist/components/Carousel/index.d.ts +67 -0
  17. package/dist/components/Carousel/index.js +5 -0
  18. package/dist/components/Carousel/index.js.map +1 -0
  19. package/dist/components/HoverCard/index.cjs +894 -0
  20. package/dist/components/HoverCard/index.cjs.map +1 -0
  21. package/dist/components/HoverCard/index.d.cts +66 -0
  22. package/dist/components/HoverCard/index.d.ts +66 -0
  23. package/dist/components/HoverCard/index.js +9 -0
  24. package/dist/components/HoverCard/index.js.map +1 -0
  25. package/dist/components/InputOTP/index.cjs +580 -0
  26. package/dist/components/InputOTP/index.cjs.map +1 -0
  27. package/dist/components/InputOTP/index.d.cts +49 -0
  28. package/dist/components/InputOTP/index.d.ts +49 -0
  29. package/dist/components/InputOTP/index.js +7 -0
  30. package/dist/components/InputOTP/index.js.map +1 -0
  31. package/dist/index.cjs +650 -0
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +3 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.js +14 -11
  36. package/package.json +1 -1
package/dist/client.cjs CHANGED
@@ -6519,6 +6519,254 @@ var Card = Object.assign(CardRoot, {
6519
6519
  Content: CardContent,
6520
6520
  Footer: CardFooter
6521
6521
  });
6522
+ var CarouselContext = React.createContext(null);
6523
+ function useCarouselContext(caller) {
6524
+ const ctx = React.useContext(CarouselContext);
6525
+ if (!ctx) {
6526
+ throw new Error(`<${caller}> must be rendered inside <Carousel>.`);
6527
+ }
6528
+ return ctx;
6529
+ }
6530
+ __name(useCarouselContext, "useCarouselContext");
6531
+ var CarouselRoot = /* @__PURE__ */ __name(({
6532
+ index: controlledIndex,
6533
+ defaultIndex = 0,
6534
+ onIndexChange,
6535
+ loop = false,
6536
+ orientation = "horizontal",
6537
+ children,
6538
+ className,
6539
+ testID
6540
+ }) => {
6541
+ const [inner, setInner] = React.useState(defaultIndex);
6542
+ const isControlled = controlledIndex !== void 0;
6543
+ const index = isControlled ? controlledIndex : inner;
6544
+ const [count, setCount] = React.useState(0);
6545
+ const listRef = React.useRef(null);
6546
+ const id = React.useId();
6547
+ const setIndex = React.useCallback(
6548
+ (next2) => {
6549
+ if (!isControlled) {
6550
+ setInner(next2);
6551
+ }
6552
+ onIndexChange?.(next2);
6553
+ },
6554
+ [isControlled, onIndexChange]
6555
+ );
6556
+ const scrollTo = React.useCallback(
6557
+ (idx) => {
6558
+ const list = listRef.current;
6559
+ if (!list) {
6560
+ return;
6561
+ }
6562
+ const item = list.children[idx];
6563
+ if (!item) {
6564
+ return;
6565
+ }
6566
+ item.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
6567
+ setIndex(idx);
6568
+ },
6569
+ [setIndex]
6570
+ );
6571
+ const next = React.useCallback(() => {
6572
+ if (count === 0) {
6573
+ return;
6574
+ }
6575
+ if (index < count - 1) {
6576
+ scrollTo(index + 1);
6577
+ } else if (loop) {
6578
+ scrollTo(0);
6579
+ }
6580
+ }, [index, count, loop, scrollTo]);
6581
+ const prev = React.useCallback(() => {
6582
+ if (count === 0) {
6583
+ return;
6584
+ }
6585
+ if (index > 0) {
6586
+ scrollTo(index - 1);
6587
+ } else if (loop) {
6588
+ scrollTo(count - 1);
6589
+ }
6590
+ }, [index, count, loop, scrollTo]);
6591
+ React.useEffect(() => {
6592
+ const list = listRef.current;
6593
+ if (!list) {
6594
+ return;
6595
+ }
6596
+ const handleScroll = /* @__PURE__ */ __name(() => {
6597
+ const { scrollLeft, scrollTop, offsetWidth, offsetHeight } = list;
6598
+ const pos = orientation === "horizontal" ? scrollLeft : scrollTop;
6599
+ const size = orientation === "horizontal" ? offsetWidth : offsetHeight;
6600
+ if (size === 0) {
6601
+ return;
6602
+ }
6603
+ const newIdx = Math.round(pos / size);
6604
+ if (newIdx !== index) {
6605
+ setIndex(newIdx);
6606
+ }
6607
+ }, "handleScroll");
6608
+ list.addEventListener("scroll", handleScroll, { passive: true });
6609
+ return () => list.removeEventListener("scroll", handleScroll);
6610
+ }, [orientation, index, setIndex]);
6611
+ return /* @__PURE__ */ jsxRuntime.jsx(
6612
+ CarouselContext.Provider,
6613
+ {
6614
+ value: { index, count, loop, orientation, scrollTo, next, prev, listRef, setCount, id },
6615
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6616
+ "section",
6617
+ {
6618
+ "aria-label": testID ?? "Carousel",
6619
+ className: cn("relative overflow-hidden", className),
6620
+ "data-testid": testID,
6621
+ children
6622
+ }
6623
+ )
6624
+ }
6625
+ );
6626
+ }, "CarouselRoot");
6627
+ var CarouselContent = /* @__PURE__ */ __name(({ children, className, testID }) => {
6628
+ const ctx = useCarouselContext("Carousel.Content");
6629
+ const childCount = React.Children.count(children);
6630
+ React.useEffect(() => {
6631
+ ctx.setCount(childCount);
6632
+ }, [childCount, ctx.setCount]);
6633
+ const isHorizontal = ctx.orientation === "horizontal";
6634
+ return /* @__PURE__ */ jsxRuntime.jsx(
6635
+ "div",
6636
+ {
6637
+ ref: ctx.listRef,
6638
+ "data-testid": testID,
6639
+ className: cn(
6640
+ "flex",
6641
+ isHorizontal ? "flex-row overflow-x-auto overflow-y-hidden" : "flex-col overflow-y-auto overflow-x-hidden",
6642
+ className
6643
+ ),
6644
+ style: {
6645
+ scrollSnapType: isHorizontal ? "x mandatory" : "y mandatory",
6646
+ scrollBehavior: "smooth",
6647
+ WebkitOverflowScrolling: "touch",
6648
+ // Hide scrollbar
6649
+ scrollbarWidth: "none",
6650
+ msOverflowStyle: "none"
6651
+ },
6652
+ children
6653
+ }
6654
+ );
6655
+ }, "CarouselContent");
6656
+ var CarouselItem = /* @__PURE__ */ __name(({ children, className, testID }) => {
6657
+ const ctx = useCarouselContext("Carousel.Item");
6658
+ const isHorizontal = ctx.orientation === "horizontal";
6659
+ return /* @__PURE__ */ jsxRuntime.jsx(
6660
+ "div",
6661
+ {
6662
+ "data-testid": testID,
6663
+ className: cn("shrink-0", isHorizontal ? "w-full" : "h-full", className),
6664
+ style: {
6665
+ scrollSnapAlign: "start",
6666
+ minWidth: isHorizontal ? "100%" : void 0,
6667
+ minHeight: !isHorizontal ? "100%" : void 0
6668
+ },
6669
+ children
6670
+ }
6671
+ );
6672
+ }, "CarouselItem");
6673
+ var CarouselPrevious = /* @__PURE__ */ __name(({ className, testID, children }) => {
6674
+ const ctx = useCarouselContext("Carousel.Previous");
6675
+ const disabled = !ctx.loop && ctx.index === 0;
6676
+ return /* @__PURE__ */ jsxRuntime.jsx(
6677
+ "button",
6678
+ {
6679
+ type: "button",
6680
+ "aria-label": "Previous slide",
6681
+ disabled,
6682
+ "data-testid": testID,
6683
+ onClick: ctx.prev,
6684
+ className: cn(
6685
+ "absolute left-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40",
6686
+ className
6687
+ ),
6688
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
6689
+ "svg",
6690
+ {
6691
+ viewBox: "0 0 24 24",
6692
+ fill: "none",
6693
+ stroke: "currentColor",
6694
+ strokeWidth: 2,
6695
+ className: "h-4 w-4",
6696
+ "aria-hidden": "true",
6697
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 18l-6-6 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
6698
+ }
6699
+ )
6700
+ }
6701
+ );
6702
+ }, "CarouselPrevious");
6703
+ var CarouselNext = /* @__PURE__ */ __name(({ className, testID, children }) => {
6704
+ const ctx = useCarouselContext("Carousel.Next");
6705
+ const disabled = !ctx.loop && ctx.index >= ctx.count - 1;
6706
+ return /* @__PURE__ */ jsxRuntime.jsx(
6707
+ "button",
6708
+ {
6709
+ type: "button",
6710
+ "aria-label": "Next slide",
6711
+ disabled,
6712
+ "data-testid": testID,
6713
+ onClick: ctx.next,
6714
+ className: cn(
6715
+ "absolute right-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full bg-white/80 shadow hover:bg-white disabled:opacity-40",
6716
+ className
6717
+ ),
6718
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
6719
+ "svg",
6720
+ {
6721
+ viewBox: "0 0 24 24",
6722
+ fill: "none",
6723
+ stroke: "currentColor",
6724
+ strokeWidth: 2,
6725
+ className: "h-4 w-4",
6726
+ "aria-hidden": "true",
6727
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 18l6-6-6-6", strokeLinecap: "round", strokeLinejoin: "round" })
6728
+ }
6729
+ )
6730
+ }
6731
+ );
6732
+ }, "CarouselNext");
6733
+ var CarouselDots = /* @__PURE__ */ __name(({ className, testID }) => {
6734
+ const ctx = useCarouselContext("Carousel.Dots");
6735
+ if (ctx.count === 0) {
6736
+ return null;
6737
+ }
6738
+ return /* @__PURE__ */ jsxRuntime.jsx(
6739
+ "div",
6740
+ {
6741
+ role: "tablist",
6742
+ "aria-label": "Slide navigation",
6743
+ "data-testid": testID,
6744
+ className: cn("absolute bottom-3 left-0 right-0 flex items-center justify-center gap-1.5", className),
6745
+ children: Array.from({ length: ctx.count }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
6746
+ "button",
6747
+ {
6748
+ type: "button",
6749
+ role: "tab",
6750
+ "aria-selected": i === ctx.index,
6751
+ "aria-label": `Go to slide ${i + 1}`,
6752
+ onClick: () => ctx.scrollTo(i),
6753
+ className: cn(
6754
+ "h-1.5 w-1.5 rounded-full transition-all",
6755
+ i === ctx.index ? "w-3 bg-white" : "bg-white/50 hover:bg-white/75"
6756
+ )
6757
+ },
6758
+ i
6759
+ ))
6760
+ }
6761
+ );
6762
+ }, "CarouselDots");
6763
+ var Carousel = Object.assign(CarouselRoot, {
6764
+ Content: CarouselContent,
6765
+ Item: CarouselItem,
6766
+ Previous: CarouselPrevious,
6767
+ Next: CarouselNext,
6768
+ Dots: CarouselDots
6769
+ });
6522
6770
  var ROW_LAYOUT_BASE = { flexDirection: "row", alignItems: "center" };
6523
6771
  var BOX_LAYOUT_BASE = {
6524
6772
  // 20×20 box — component-density literal — not from theme
@@ -9398,6 +9646,161 @@ function withAlpha(color, alpha) {
9398
9646
  return color;
9399
9647
  }
9400
9648
  __name(withAlpha, "withAlpha");
9649
+ var HoverCardContext = React.createContext(null);
9650
+ function useHoverCardContext(caller) {
9651
+ const ctx = React.useContext(HoverCardContext);
9652
+ if (!ctx) {
9653
+ throw new Error(`<${caller}> must be rendered inside <HoverCard>.`);
9654
+ }
9655
+ return ctx;
9656
+ }
9657
+ __name(useHoverCardContext, "useHoverCardContext");
9658
+ var DEFAULT_OPEN_DELAY = 300;
9659
+ var DEFAULT_CLOSE_DELAY = 200;
9660
+ var HoverCardRoot = /* @__PURE__ */ __name(({
9661
+ open: controlledOpen,
9662
+ defaultOpen = false,
9663
+ onOpenChange,
9664
+ openDelay = DEFAULT_OPEN_DELAY,
9665
+ closeDelay = DEFAULT_CLOSE_DELAY,
9666
+ children
9667
+ }) => {
9668
+ const [inner, setInner] = React.useState(defaultOpen);
9669
+ const isControlled = controlledOpen !== void 0;
9670
+ const open = isControlled ? controlledOpen : inner;
9671
+ const id = React.useId();
9672
+ const setOpen = React.useCallback(
9673
+ (next) => {
9674
+ if (!isControlled) {
9675
+ setInner(next);
9676
+ }
9677
+ onOpenChange?.(next);
9678
+ },
9679
+ [isControlled, onOpenChange]
9680
+ );
9681
+ const openTimer = React.useRef(null);
9682
+ const closeTimer = React.useRef(null);
9683
+ const cancelTimers = React.useCallback(() => {
9684
+ if (openTimer.current) {
9685
+ clearTimeout(openTimer.current);
9686
+ openTimer.current = null;
9687
+ }
9688
+ if (closeTimer.current) {
9689
+ clearTimeout(closeTimer.current);
9690
+ closeTimer.current = null;
9691
+ }
9692
+ }, []);
9693
+ const requestOpen = React.useCallback(() => {
9694
+ if (closeTimer.current) {
9695
+ clearTimeout(closeTimer.current);
9696
+ closeTimer.current = null;
9697
+ }
9698
+ if (openTimer.current) {
9699
+ return;
9700
+ }
9701
+ if (openDelay <= 0) {
9702
+ setOpen(true);
9703
+ return;
9704
+ }
9705
+ openTimer.current = setTimeout(() => {
9706
+ openTimer.current = null;
9707
+ setOpen(true);
9708
+ }, openDelay);
9709
+ }, [openDelay, setOpen]);
9710
+ const requestClose = React.useCallback(() => {
9711
+ if (openTimer.current) {
9712
+ clearTimeout(openTimer.current);
9713
+ openTimer.current = null;
9714
+ }
9715
+ if (closeTimer.current) {
9716
+ return;
9717
+ }
9718
+ if (closeDelay <= 0) {
9719
+ setOpen(false);
9720
+ return;
9721
+ }
9722
+ closeTimer.current = setTimeout(() => {
9723
+ closeTimer.current = null;
9724
+ setOpen(false);
9725
+ }, closeDelay);
9726
+ }, [closeDelay, setOpen]);
9727
+ React.useEffect(() => () => cancelTimers(), [cancelTimers]);
9728
+ return /* @__PURE__ */ jsxRuntime.jsx(
9729
+ HoverCardContext.Provider,
9730
+ {
9731
+ value: { open, requestOpen, requestClose, cancelTimers, contentId: `hc-content-${id}` },
9732
+ children: /* @__PURE__ */ jsxRuntime.jsx(Popover, { open, onOpenChange: setOpen, children })
9733
+ }
9734
+ );
9735
+ }, "HoverCardRoot");
9736
+ var HoverCardTrigger = /* @__PURE__ */ __name(({ asChild = true, children, className, testID }) => {
9737
+ const ctx = useHoverCardContext("HoverCard.Trigger");
9738
+ const handleMouseEnter = React.useCallback(() => {
9739
+ ctx.cancelTimers();
9740
+ ctx.requestOpen();
9741
+ }, [ctx]);
9742
+ const handleMouseLeave = React.useCallback(() => {
9743
+ ctx.requestClose();
9744
+ }, [ctx]);
9745
+ const handlers = {
9746
+ onMouseEnter: handleMouseEnter,
9747
+ onMouseLeave: handleMouseLeave,
9748
+ "aria-haspopup": "dialog",
9749
+ "aria-expanded": ctx.open
9750
+ };
9751
+ if (asChild && React.isValidElement(children)) {
9752
+ const child = children;
9753
+ const compose = /* @__PURE__ */ __name((existing, next) => (event) => {
9754
+ existing?.(event);
9755
+ next(event);
9756
+ }, "compose");
9757
+ return /* @__PURE__ */ jsxRuntime.jsx(
9758
+ Slot,
9759
+ {
9760
+ ...handlers,
9761
+ onMouseEnter: compose(child.props.onMouseEnter, handleMouseEnter),
9762
+ onMouseLeave: compose(child.props.onMouseLeave, handleMouseLeave),
9763
+ ...className !== void 0 ? { className } : {},
9764
+ ...testID !== void 0 ? { "data-testid": testID } : {},
9765
+ children: child
9766
+ }
9767
+ );
9768
+ }
9769
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...handlers, className, ...testID !== void 0 ? { "data-testid": testID } : {}, children });
9770
+ }, "HoverCardTrigger");
9771
+ var HoverCardContent = /* @__PURE__ */ __name(({ side = "bottom", align = "start", children, className, testID }) => {
9772
+ const ctx = useHoverCardContext("HoverCard.Content");
9773
+ const handleMouseEnter = React.useCallback(() => {
9774
+ ctx.cancelTimers();
9775
+ }, [ctx]);
9776
+ const handleMouseLeave = React.useCallback(() => {
9777
+ ctx.requestClose();
9778
+ }, [ctx]);
9779
+ return /* @__PURE__ */ jsxRuntime.jsx(
9780
+ Popover.Content,
9781
+ {
9782
+ side,
9783
+ align,
9784
+ ...className !== void 0 ? { className } : {},
9785
+ ...testID !== void 0 ? { testID } : {},
9786
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9787
+ "div",
9788
+ {
9789
+ id: ctx.contentId,
9790
+ role: "dialog",
9791
+ "aria-label": "Hover card",
9792
+ onMouseEnter: handleMouseEnter,
9793
+ onMouseLeave: handleMouseLeave,
9794
+ children
9795
+ }
9796
+ )
9797
+ }
9798
+ );
9799
+ }, "HoverCardContent");
9800
+ var HoverCard = Object.assign(HoverCardRoot, {
9801
+ Trigger: HoverCardTrigger,
9802
+ Content: HoverCardContent
9803
+ });
9401
9804
  var ALIGN_CLASS = {
9402
9805
  start: "items-start",
9403
9806
  center: "items-center",
@@ -9770,6 +10173,250 @@ var InputGroup = Object.assign(InputGroupRoot, {
9770
10173
  Addon: InputGroupAddon,
9771
10174
  Input: InputGroupInput
9772
10175
  });
10176
+ function isAllowed(char, pattern) {
10177
+ if (pattern === "numeric") {
10178
+ return /^\d$/.test(char);
10179
+ }
10180
+ return /^[a-zA-Z0-9]$/.test(char);
10181
+ }
10182
+ __name(isAllowed, "isAllowed");
10183
+ function filterValue(value, pattern, length) {
10184
+ return value.split("").filter((c) => isAllowed(c, pattern)).slice(0, length).join("");
10185
+ }
10186
+ __name(filterValue, "filterValue");
10187
+ var InputOTP = /* @__PURE__ */ __name(({
10188
+ value = "",
10189
+ onChange,
10190
+ onComplete,
10191
+ length = 6,
10192
+ placeholder = "\xB7",
10193
+ pattern = "numeric",
10194
+ disabled = false,
10195
+ autoFocus = false,
10196
+ id,
10197
+ name,
10198
+ "aria-label": ariaLabel = "One-time code",
10199
+ "aria-labelledby": ariaLabelledBy,
10200
+ "aria-describedby": ariaDescribedBy,
10201
+ "aria-invalid": ariaInvalid,
10202
+ className,
10203
+ testID
10204
+ }) => {
10205
+ const colors = useThemeColors();
10206
+ const [cells, setCells] = React.useState(() => {
10207
+ const filtered = filterValue(value, pattern, length);
10208
+ return Array.from({ length }, (_, i) => filtered[i] ?? "");
10209
+ });
10210
+ const prevValue = React.useRef(value);
10211
+ React.useEffect(() => {
10212
+ if (value !== prevValue.current) {
10213
+ prevValue.current = value;
10214
+ const filtered = filterValue(value, pattern, length);
10215
+ setCells(Array.from({ length }, (_, i) => filtered[i] ?? ""));
10216
+ }
10217
+ }, [value, pattern, length]);
10218
+ const inputRefs = React.useRef([]);
10219
+ const focusCell = React.useCallback(
10220
+ (idx) => {
10221
+ if (idx >= 0 && idx < length) {
10222
+ inputRefs.current[idx]?.focus();
10223
+ }
10224
+ },
10225
+ [length]
10226
+ );
10227
+ const updateCells = React.useCallback(
10228
+ (next) => {
10229
+ setCells(next);
10230
+ const joined = next.join("");
10231
+ onChange?.(joined);
10232
+ if (joined.length === length && !next.includes("")) {
10233
+ onComplete?.(joined);
10234
+ }
10235
+ },
10236
+ [onChange, onComplete, length]
10237
+ );
10238
+ const onContainerPaste = React.useCallback(
10239
+ (e) => {
10240
+ e.preventDefault();
10241
+ const text = e.clipboardData.getData("text/plain") ?? "";
10242
+ const filtered = filterValue(text, pattern, length);
10243
+ const next = Array.from({ length }, (_, i) => filtered[i] ?? "");
10244
+ updateCells(next);
10245
+ const nextEmpty = next.indexOf("");
10246
+ focusCell(nextEmpty === -1 ? length - 1 : nextEmpty);
10247
+ },
10248
+ [pattern, length, updateCells, focusCell]
10249
+ );
10250
+ const handleChangeText = React.useCallback(
10251
+ (text, idx) => {
10252
+ if (text.length > 1) {
10253
+ const filtered = filterValue(text, pattern, length);
10254
+ const next2 = Array.from({ length }, (_, i) => filtered[i] ?? "");
10255
+ updateCells(next2);
10256
+ const nextEmpty = next2.indexOf("");
10257
+ focusCell(nextEmpty === -1 ? length - 1 : nextEmpty);
10258
+ return;
10259
+ }
10260
+ const char = text.slice(-1);
10261
+ if (char && !isAllowed(char, pattern)) {
10262
+ return;
10263
+ }
10264
+ const next = [...cells];
10265
+ next[idx] = char;
10266
+ updateCells(next);
10267
+ if (char) {
10268
+ focusCell(idx + 1);
10269
+ }
10270
+ },
10271
+ [cells, pattern, length, updateCells, focusCell]
10272
+ );
10273
+ const handleWebKeyDown = React.useCallback(
10274
+ (e, idx) => {
10275
+ if (e.key === "Backspace") {
10276
+ if (cells[idx] !== "") {
10277
+ const next = [...cells];
10278
+ next[idx] = "";
10279
+ updateCells(next);
10280
+ } else {
10281
+ focusCell(idx - 1);
10282
+ }
10283
+ e.preventDefault();
10284
+ } else if (e.key === "ArrowLeft") {
10285
+ focusCell(idx - 1);
10286
+ e.preventDefault();
10287
+ } else if (e.key === "ArrowRight") {
10288
+ focusCell(idx + 1);
10289
+ e.preventDefault();
10290
+ } else if (e.key.length === 1 && isAllowed(e.key, pattern)) {
10291
+ const next = [...cells];
10292
+ next[idx] = e.key;
10293
+ updateCells(next);
10294
+ focusCell(idx + 1);
10295
+ e.preventDefault();
10296
+ }
10297
+ },
10298
+ [cells, pattern, focusCell, updateCells]
10299
+ );
10300
+ const handleNativeKeyPress = React.useCallback(
10301
+ (e, idx) => {
10302
+ if (e.nativeEvent.key === "Backspace") {
10303
+ if (cells[idx] !== "") {
10304
+ const next = [...cells];
10305
+ next[idx] = "";
10306
+ updateCells(next);
10307
+ } else {
10308
+ focusCell(idx - 1);
10309
+ }
10310
+ }
10311
+ },
10312
+ [cells, focusCell, updateCells]
10313
+ );
10314
+ const cellStyle = [
10315
+ styles2.cell,
10316
+ {
10317
+ width: px(48),
10318
+ height: px(56),
10319
+ borderRadius: px(colors.radius.md),
10320
+ borderColor: colors.semantic.border.default,
10321
+ backgroundColor: colors.semantic.background.elevated,
10322
+ color: colors.semantic.text.default,
10323
+ fontSize: px(colors.fontSize.xl),
10324
+ fontFamily: colors.fontFamily.body
10325
+ },
10326
+ disabled ? styles2.disabled : null,
10327
+ ariaInvalid === true || ariaInvalid === "true" ? { borderColor: colors.color.danger } : null
10328
+ ];
10329
+ const isWeb3 = reactNative.Platform.OS === "web";
10330
+ const containerProps = isWeb3 ? {
10331
+ onPaste: onContainerPaste,
10332
+ role: "group",
10333
+ "aria-label": ariaLabel,
10334
+ "aria-labelledby": ariaLabelledBy,
10335
+ "aria-describedby": ariaDescribedBy
10336
+ } : {};
10337
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10338
+ reactNative.View,
10339
+ {
10340
+ testID,
10341
+ ...isWeb3 ? {} : { accessible: true, accessibilityLabel: ariaLabel },
10342
+ ...containerProps,
10343
+ className: cn("flex-row items-center gap-2", className),
10344
+ style: styles2.container,
10345
+ children: [
10346
+ Array.from({ length }, (_, idx) => {
10347
+ const cellValue = cells[idx] ?? "";
10348
+ const cellRef = /* @__PURE__ */ __name((el) => {
10349
+ inputRefs.current[idx] = el;
10350
+ }, "cellRef");
10351
+ const webProps = isWeb3 ? {
10352
+ onKeyDown: /* @__PURE__ */ __name((e) => handleWebKeyDown(e, idx), "onKeyDown"),
10353
+ // id only on the first cell
10354
+ ...idx === 0 && id ? { id, nativeID: id } : {},
10355
+ ...idx === 0 && name ? { name } : {},
10356
+ ...idx === 0 && ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {},
10357
+ ...idx === 0 && ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {},
10358
+ ...idx === 0 && ariaInvalid !== void 0 ? { "aria-invalid": ariaInvalid } : {},
10359
+ inputMode: pattern === "numeric" ? "numeric" : "text"
10360
+ } : {};
10361
+ const nativeOnlyProps = isWeb3 ? {} : {
10362
+ keyboardType: pattern === "numeric" ? "number-pad" : "default",
10363
+ textAlign: "center",
10364
+ selectTextOnFocus: true,
10365
+ onKeyPress: /* @__PURE__ */ __name((e) => handleNativeKeyPress(e, idx), "onKeyPress")
10366
+ };
10367
+ return /* @__PURE__ */ jsxRuntime.jsx(
10368
+ reactNative.TextInput,
10369
+ {
10370
+ ref: cellRef,
10371
+ value: cellValue,
10372
+ placeholder: placeholder,
10373
+ maxLength: 1,
10374
+ editable: !disabled,
10375
+ autoFocus: autoFocus && idx === 0,
10376
+ testID: testID ? `${testID}-cell-${idx}` : void 0,
10377
+ onChangeText: (text) => handleChangeText(text, idx),
10378
+ accessibilityLabel: `Digit ${idx + 1} of ${length}`,
10379
+ ...nativeOnlyProps,
10380
+ ...webProps,
10381
+ style: cellStyle
10382
+ },
10383
+ idx
10384
+ );
10385
+ }),
10386
+ isWeb3 && name ? /* @__PURE__ */ jsxRuntime.jsx(
10387
+ reactNative.TextInput,
10388
+ {
10389
+ style: styles2.hidden,
10390
+ value: cells.join(""),
10391
+ "aria-hidden": true,
10392
+ tabIndex: -1,
10393
+ ...{ name }
10394
+ }
10395
+ ) : null
10396
+ ]
10397
+ }
10398
+ );
10399
+ }, "InputOTP");
10400
+ var styles2 = reactNative.StyleSheet.create({
10401
+ container: {
10402
+ flexDirection: "row",
10403
+ alignItems: "center",
10404
+ gap: 8
10405
+ },
10406
+ cell: {
10407
+ borderWidth: 1,
10408
+ textAlign: "center"
10409
+ },
10410
+ disabled: {
10411
+ opacity: 0.6
10412
+ },
10413
+ hidden: {
10414
+ position: "absolute",
10415
+ width: 0,
10416
+ height: 0,
10417
+ opacity: 0
10418
+ }
10419
+ });
9773
10420
  var Item = /* @__PURE__ */ __name(({
9774
10421
  leading,
9775
10422
  title,
@@ -14235,6 +14882,7 @@ exports.Button = Button;
14235
14882
  exports.ButtonGroup = ButtonGroup;
14236
14883
  exports.Calendar = Calendar;
14237
14884
  exports.Card = Card;
14885
+ exports.Carousel = Carousel;
14238
14886
  exports.Checkbox = Checkbox;
14239
14887
  exports.Collapsible = Collapsible;
14240
14888
  exports.Combobox = Combobox;
@@ -14248,9 +14896,11 @@ exports.Empty = Empty;
14248
14896
  exports.Field = Field;
14249
14897
  exports.FloatButton = FloatButton;
14250
14898
  exports.HStack = HStack;
14899
+ exports.HoverCard = HoverCard;
14251
14900
  exports.I18nProvider = I18nProvider;
14252
14901
  exports.Icon = Icon;
14253
14902
  exports.InputGroup = InputGroup;
14903
+ exports.InputOTP = InputOTP;
14254
14904
  exports.Item = Item;
14255
14905
  exports.Kbd = Kbd;
14256
14906
  exports.Label = Label;