@kumix/ui 0.3.5 → 0.3.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;KAcY;EACV;EACA,OAAO;EACP,OAAO;EACP;;KAGU;KACA;KACA;UAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBA+Gc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBA2EN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,YACG,QACF,wCAAqB,IAAA"}
1
+ {"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;KAeY;EACV;EACA,OAAO;EACP,OAAO;EACP;;KAGU;KACA;KACA;UAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBA+Gc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBAyEN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,YACG,QACF,wCAAqB,IAAA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { EASE_OUT, EASE_OUT_CSS, SPRING_PRESS, SPRING_SWAP } from "../../lib/ease.js";
3
- import { useLayoutEffect, useRef, useState } from "react";
2
+ import { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from "../../lib/ease.js";
3
+ import { useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
@@ -137,27 +137,22 @@ const SIZE_CLASS = {
137
137
  };
138
138
  function ActionSwapText({ value, children, animation = "blur", className }) {
139
139
  const reduce = useReducedMotion();
140
- const measureRef = useRef(null);
141
- const [width, setWidth] = useState();
142
- useLayoutEffect(() => {
143
- const nextWidth = measureRef.current?.offsetWidth;
144
- if (!nextWidth) return;
145
- setWidth((currentWidth) => currentWidth === nextWidth ? currentWidth : nextWidth);
146
- });
147
140
  const label = typeof children === "string" ? children : null;
148
141
  const cascade = animation === "cascade" && label !== null && !reduce;
149
142
  const coreAnimation = animation === "cascade" ? "roll" : animation;
150
143
  return /* @__PURE__ */ jsxs("span", {
151
- className: cn("relative inline-block overflow-hidden whitespace-nowrap align-bottom", className),
144
+ className: cn("relative -my-[0.08em] inline-block whitespace-nowrap py-[0.08em] align-bottom", className),
152
145
  style: {
153
- width,
154
- transition: reduce ? void 0 : `width 220ms ${EASE_OUT_CSS}`
146
+ clipPath: "inset(0 -999px)",
147
+ WebkitClipPath: "inset(0 -999px)"
155
148
  },
156
149
  children: [/* @__PURE__ */ jsx("span", {
157
- ref: measureRef,
158
150
  "aria-hidden": true,
159
151
  className: "invisible inline-block whitespace-nowrap",
160
- children
152
+ children: cascade ? label.split("").map((char, index) => /* @__PURE__ */ jsx("span", {
153
+ className: "inline-block whitespace-pre",
154
+ children: char
155
+ }, index)) : children
161
156
  }), cascade ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
162
157
  className: "sr-only",
163
158
  children: label
@@ -168,7 +163,7 @@ function ActionSwapText({ value, children, animation = "blur", className }) {
168
163
  initial: "initial",
169
164
  animate: "animate",
170
165
  exit: "exit",
171
- className: "absolute top-0 left-0 inline-block whitespace-pre",
166
+ className: "absolute top-[0.08em] left-0 inline-block whitespace-pre",
172
167
  children: label.split("").map((char, i) => /* @__PURE__ */ jsx(motion.span, {
173
168
  custom: i * CASCADE_STAGGER,
174
169
  variants: CASCADE_LETTER_VARIANTS,
@@ -188,7 +183,7 @@ function ActionSwapText({ value, children, animation = "blur", className }) {
188
183
  y: 0
189
184
  } : "animate",
190
185
  exit: reduce ? void 0 : "exit",
191
- className: "absolute top-0 left-0 inline-block will-change-[opacity,filter,transform]",
186
+ className: "absolute top-[0.08em] left-0 inline-block will-change-[opacity,filter,transform]",
192
187
  children
193
188
  }, `${animation}-${value}`)
194
189
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, EASE_OUT_CSS, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nconst BLUR_TRANSITION = { duration: 0.2, ease: \"easeInOut\" } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst SWAP_BLUR = \"blur(8px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.94, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-primary/5\",\n ghost: \"text-muted-foreground hover:bg-primary/5 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n const measureRef = useRef<HTMLSpanElement>(null);\n const [width, setWidth] = useState<number>();\n\n useLayoutEffect(() => {\n const nextWidth = measureRef.current?.offsetWidth;\n if (!nextWidth) return;\n setWidth((currentWidth) => (currentWidth === nextWidth ? currentWidth : nextWidth));\n });\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative inline-block overflow-hidden whitespace-nowrap align-bottom\",\n className,\n )}\n style={{\n width,\n transition: reduce ? undefined : `width 220ms ${EASE_OUT_CSS}`,\n }}\n >\n <span ref={measureRef} aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-0 left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"absolute top-0 left-0 inline-block will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {hasIcon ? (\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n ) : null}\n {!iconOnly ? (\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AAuDA,MAAM,kBAAkB;CAAE,UAAU;CAAK,MAAM;AAAY;AAC3D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,GAAG;GAAa;EAAM;CACtC;CACA,OAAO,QAAgB,OAAO;EAC5B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;GAAU,OAAO,QAAQ;EAAI;CACnE;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAM,QAAQ;EAAU;EACtD,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;EACA,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;CACF;CACA,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,GAAG;GAAO,QAAQ;EAAU;EACnD,SAAS;GACP,SAAS;GACT,GAAG;GACH,QAAQ;GACR,YAAY;EACd;EACA,MAAM;GACJ,SAAS;GACT,GAAG;GACH,QAAQ;GACR,YAAY;EACd;CACF;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAM,QAAQ;EAAU;EACtD,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;EACA,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;CACF;CACA,MAAM;EACJ,SAAS;GAAE,SA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ACpD;CACA,MAAM,aAAa,MAAM,gBAAgB,MAAM;CAC/C,MAAM,UAAU,MAAM,MAAM,SAAS,KAAK,IAAI;CAC9C,MAAM,WAAW,SAAS,MAAM,SAAS,IAAI,OAAO,cAAc,KAAK,MAAM,UAAU,KAAA;CAEvF,IAAI,CAAC,YAAY,OAAO;CAExB,MAAM,kBACJ,WAAW,cACV,YAAY,OAAO,WAAW,UAAU,WAAW,WAAW,QAAQ,KAAA;CAEzE,OACE,qBAAC,OAAO,QAAR;EACE,MAAK;EACK;EACV,UAAU,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACzD,YAAY;EACZ,WAAW,GACT,yFACA,oDACA,cAAc,UACd,WAAW,OACX,SACF;EACA,cAAY;EACZ,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,MAAM,oBAAoB,YAAY,CAAC,SAAS,CAAC,UAAU;GAC/D,IAAI,UAAU,KAAA,GAAW,iBAAiB,SAAS,EAAE;GACrD,gBAAgB,SAAS,IAAI,QAAQ;EACvC;EACA,GAAI;EAnBN,UAAA,CAqBG,UACC,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAAW,WAAU;GACnE,UAAA,WAAW,QAAQ;EACN,CAAA,IACd,MACH,CAAC,WACA,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAC9C,UAAA,WAAW;EACE,CAAA,IACd,IACS;;AAEnB"}
1
+ {"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nconst BLUR_TRANSITION = { duration: 0.2, ease: \"easeInOut\" } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst SWAP_BLUR = \"blur(8px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.94, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-primary/5\",\n ghost: \"text-muted-foreground hover:bg-primary/5 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative -my-[0.08em] inline-block whitespace-nowrap py-[0.08em] align-bottom\",\n className,\n )}\n style={{\n clipPath: \"inset(0 -999px)\",\n WebkitClipPath: \"inset(0 -999px)\",\n }}\n >\n <span aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-[0.08em] left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"absolute top-[0.08em] left-0 inline-block will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {hasIcon ? (\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n ) : null}\n {!iconOnly ? (\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AAwDA,MAAM,kBAAkB;CAAE,UAAU;CAAK,MAAM;AAAY;AAC3D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,GAAG;GAAa;EAAM;CACtC;CACA,OAAO,QAAgB,OAAO;EAC5B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;GAAU,OAAO,QAAQ;EAAI;CACnE;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAM,QAAQ;EAAU;EACtD,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;EACA,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;CACF;CACA,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,GAAG;GAAO,QAAQ;EAAU;EACnD,SAAS;GACP,SAAS;GACT,GAAG;GACH,QAAQ;GACR,YAAY;EACd;E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A,SACA,GAAG,QACqB;CACxB,MAAM,SAAS,iBAAiB;CAChC,MAAM,CAAC,eAAe,oBAAoB,SAAS,gBAAgB,MAAM,EAAE,EAAE,EAAE;CAC/E,MAAM,eAAe,SAAS;CAC9B,MAAM,cAAc,KAAK,IACvB,GACA,MAAM,WAAW,SAAS,KAAK,OAAO,YAAY,CACpD;CACA,MAAM,aAAa,MAAM,gBAAgB,MAAM;CAC/C,MAAM,UAAU,MAAM,MAAM,SAAS,KAAK,IAAI;CAC9C,MAAM,WAAW,SAAS,MAAM,SAAS,IAAI,OAAO,cAAc,KAAK,MAAM,UAAU,KAAA;CAEvF,IAAI,CAAC,YAAY,OAAO;CAExB,MAAM,kBACJ,WAAW,cACV,YAAY,OAAO,WAAW,UAAU,WAAW,WAAW,QAAQ,KAAA;CAEzE,OACE,qBAAC,OAAO,QAAR;EACE,MAAK;EACK;EACV,UAAU,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACzD,YAAY;EACZ,WAAW,GACT,yFACA,oDACA,cAAc,UACd,WAAW,OACX,SACF;EACA,cAAY;EACZ,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,MAAM,oBAAoB,YAAY,CAAC,SAAS,CAAC,UAAU;GAC/D,IAAI,UAAU,KAAA,GAAW,iBAAiB,SAAS,EAAE;GACrD,gBAAgB,SAAS,IAAI,QAAQ;EACvC;EACA,GAAI;EAnBN,UAAA,CAqBG,UACC,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAAW,WAAU;GACnE,UAAA,WAAW,QAAQ;EACN,CAAA,IACd,MACH,CAAC,WACA,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAC9C,UAAA,WAAW;EACE,CAAA,IACd,IACS;;AAEnB"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { EASE_DRAWER } from "../../lib/ease.js";
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useEffect, useId, useRef, useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { AnimatePresence, motion, useDragControls, useReducedMotion } from "motion/react";
@@ -17,6 +17,9 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
17
17
  const sheetRef = useRef(null);
18
18
  const reduce = useReducedMotion();
19
19
  const heightRef = useRef(0);
20
+ const uid = useId();
21
+ const titleId = `${uid}-title`;
22
+ const descriptionId = `${uid}-description`;
20
23
  useEffect(() => {
21
24
  setMounted(true);
22
25
  }, []);
@@ -39,7 +42,15 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
39
42
  body.style.left = "0";
40
43
  body.style.right = "0";
41
44
  body.style.overflow = "hidden";
45
+ const onKey = (event) => {
46
+ if (event.key === "Escape") {
47
+ event.preventDefault();
48
+ onOpenChange(false);
49
+ }
50
+ };
51
+ window.addEventListener("keydown", onKey);
42
52
  return () => {
53
+ window.removeEventListener("keydown", onKey);
43
54
  body.style.position = prev.position;
44
55
  body.style.top = prev.top;
45
56
  body.style.left = prev.left;
@@ -47,7 +58,7 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
47
58
  body.style.overflow = prev.overflow;
48
59
  window.scrollTo(0, scrollY);
49
60
  };
50
- }, [open]);
61
+ }, [open, onOpenChange]);
51
62
  const onDragEnd = (_, info) => {
52
63
  const velocity = info.velocity.y;
53
64
  const offset = info.offset.y;
@@ -119,16 +130,23 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
119
130
  className: cn("pointer-events-auto absolute right-0 bottom-0 left-0 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform", "border border-border bg-background shadow-xl", className),
120
131
  role: "dialog",
121
132
  "aria-modal": "true",
122
- "aria-label": title,
133
+ "aria-labelledby": title ? titleId : void 0,
134
+ "aria-describedby": description ? descriptionId : void 0,
135
+ "aria-label": title ? void 0 : "Bottom sheet",
123
136
  children: [/* @__PURE__ */ jsxs("div", {
124
- onPointerDown: (e) => dragControls.start(e),
125
- className: "flex cursor-grab touch-none flex-col items-center px-4 pt-3 pb-2 active:cursor-grabbing",
126
- children: [/* @__PURE__ */ jsx("div", { className: "h-1.5 w-10 rounded-full bg-muted-foreground/40" }), title || description ? /* @__PURE__ */ jsxs("div", {
127
- className: "mt-3 w-full",
137
+ className: "flex flex-col items-center px-4 pt-3 pb-2",
138
+ children: [/* @__PURE__ */ jsx("div", {
139
+ onPointerDown: (event) => dragControls.start(event),
140
+ className: "flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing",
141
+ children: /* @__PURE__ */ jsx("div", { className: "h-1.5 w-10 rounded-full bg-muted-foreground/40" })
142
+ }), title || description ? /* @__PURE__ */ jsxs("div", {
143
+ className: "mt-2 w-full",
128
144
  children: [title ? /* @__PURE__ */ jsx("h2", {
145
+ id: titleId,
129
146
  className: "font-semibold text-base text-foreground",
130
147
  children: title
131
148
  }) : null, description ? /* @__PURE__ */ jsx("p", {
149
+ id: descriptionId,
132
150
  className: "mt-0.5 text-muted-foreground text-sm",
133
151
  children: description
134
152
  }) : null]
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet.js","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n return () => {\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n return createPortal(\n <AnimatePresence>\n {open ? (\n <div className=\"pointer-events-none fixed inset-0 z-50\">\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto absolute inset-0 bg-background/40 backdrop-blur-sm\"\n />\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n style={heightStyle}\n className={cn(\n \"pointer-events-auto absolute right-0 bottom-0 left-0 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n >\n <div\n onPointerDown={(e) => dragControls.start(e)}\n className=\"flex cursor-grab touch-none flex-col items-center px-4 pt-3 pb-2 active:cursor-grabbing\"\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n {title || description ? (\n <div className=\"mt-3 w-full\">\n {title ? (\n <h2 className=\"font-semibold text-base text-foreground\">{title}</h2>\n ) : null}\n {description ? (\n <p className=\"mt-0.5 text-muted-foreground text-sm\">{description}</p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n </div>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA,mBAAmB,OACA;CACnB,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,eAAe,gBAAgB;CACrC,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAO,CAAC;CAE1B,gBAAgB;EACd,WAAW,IAAI;CACjB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,MAAM,QAAQ,WAAW;CAC/B,GAAG,CAAC,MAAM,WAAW,CAAC;CAMtB,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,OAAO,SAAS;EACtB,MAAM,UAAU,OAAO;EACvB,MAAM,OAAO;GACX,UAAU,KAAK,MAAM;GACrB,KAAK,KAAK,MAAM;GAChB,MAAM,KAAK,MAAM;GACjB,OAAO,KAAK,MAAM;GAClB,UA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,GACjB,SAAS,IACX;AACF"}
1
+ {"version":3,"file":"bottom-sheet.js","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const descriptionId = `${uid}-description`;\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n const onKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n onOpenChange(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open, onOpenChange]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n return createPortal(\n <AnimatePresence>\n {open ? (\n <div className=\"pointer-events-none fixed inset-0 z-50\">\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto absolute inset-0 bg-background/40 backdrop-blur-sm\"\n />\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n style={heightStyle}\n className={cn(\n \"pointer-events-auto absolute right-0 bottom-0 left-0 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-label={title ? undefined : \"Bottom sheet\"}\n >\n <div className=\"flex flex-col items-center px-4 pt-3 pb-2\">\n {/* Drag only the pill so the title and description stay selectable. */}\n <div\n onPointerDown={(event) => dragControls.start(event)}\n className=\"flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing\"\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n </div>\n {title || description ? (\n <div className=\"mt-2 w-full\">\n {title ? (\n <h2 id={titleId} className=\"font-semibold text-base text-foreground\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"mt-0.5 text-muted-foreground text-sm\">\n {description}\n </p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n </div>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA,mBAAmB,OACA;CACnB,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,eAAe,gBAAgB;CACrC,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,MAAM,MAAM;CAClB,MAAM,UAAU,GAAG,IAAI;CACvB,MAAM,gBAAgB,GAAG,IAAI;CAE7B,gBAAgB;EACd,WAAW,IAAI;CACjB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,MAAM,QAAQ,WAAW;CAC/B,GAAG,CAAC,MAAM,WAAW,CAAC;CAMtB,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,OAAO,SAAS;EACtB,MAAM,UAAU,OAAO;EACvB,MAAM,OAAO;GACX,UAAU,KAAK,MAAM;GACrB,KAAK,KAAK,MAAM;GAChB,MAAM,KAAK,MAAM;GACjB,OAAO,KAAK,MAAM;GAClB,UAAU,KAAK,MAAM;EACvB;EACA,KAAK,MAAM,WAAW;EACtB,KAAK,MAAM,MAAM,IAAI,QAAQ;EAC7B,KAAK,MAAM,OAAO;EAClB,KAAK,MAAM,QAAQ;EACnB,KAAK,MAAM,WAAW;EAEtB,MAAM,SAAS,UAAyB;GACtC,IAAI,MAAM,QAAQ,UAAU;IAC1B,MAAM,eAAe;IACrB,aAAa,KAA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AD;IAAK,WAAU;IAAuD;GAAc,CAAA,CAC1E;EACT,CAAA,CAAA;CACH,CAAA,IAAA,KACW,CAAA,GACjB,SAAS,IACX;AACF"}
@@ -13,7 +13,7 @@ function ComboboxList({ children, ariaLabel = "Options", className }) {
13
13
  id: context.listId,
14
14
  role: "listbox",
15
15
  "aria-label": ariaLabel,
16
- className: cn("max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
16
+ className: cn("scrollbar-none relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", className),
17
17
  children
18
18
  });
19
19
  }
@@ -94,7 +94,7 @@ function ComboboxItem({ value, children, textValue, keywords = [], disabled = fa
94
94
  onSelect?.(value);
95
95
  context.select(value);
96
96
  },
97
- className: cn("relative isolate flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150", active ? "text-foreground" : "text-muted-foreground", "disabled:pointer-events-none disabled:opacity-45", className),
97
+ className: cn("relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150", active ? "text-foreground" : "text-muted-foreground", "disabled:pointer-events-none disabled:opacity-45", className),
98
98
  children: [
99
99
  active ? /* @__PURE__ */ jsx(motion.span, {
100
100
  "aria-hidden": true,
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","names":[],"sources":["../../../../src/components/motion/combobox/list.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useContext, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { ComboboxGroupContext, useComboboxContext } from \"./context\";\n\nexport interface ComboboxListProps {\n children: ReactNode;\n ariaLabel?: string;\n className?: string;\n}\n\nexport function ComboboxList({ children, ariaLabel = \"Options\", className }: ComboboxListProps) {\n const context = useComboboxContext(\"ComboboxList\");\n return (\n <div\n id={context.listId}\n role=\"listbox\"\n aria-label={ariaLabel}\n className={cn(\n \"max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxGroupProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxGroup({ children, className }: ComboboxGroupProps) {\n const context = useComboboxContext(\"ComboboxGroup\");\n const groupId = useId();\n return (\n <ComboboxGroupContext.Provider value={groupId}>\n <fieldset\n hidden={!context.hasVisibleItems(groupId)}\n className={cn(\"m-0 min-w-0 border-0 p-0 py-0.5\", className)}\n >\n {children}\n </fieldset>\n </ComboboxGroupContext.Provider>\n );\n}\n\nexport interface ComboboxLabelProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxLabel({ children, className }: ComboboxLabelProps) {\n const groupId = useContext(ComboboxGroupContext);\n const labelClassName = cn(\n \"w-full px-2 py-1.5 font-medium text-[0.68rem] text-muted-foreground uppercase tracking-[0.12em]\",\n className,\n );\n return groupId ? (\n <legend className={labelClassName}>{children}</legend>\n ) : (\n <div className={labelClassName}>{children}</div>\n );\n}\n\nexport interface ComboboxItemProps {\n value: string;\n children: ReactNode;\n textValue?: string;\n keywords?: string[];\n disabled?: boolean;\n onSelect?: (value: string) => void;\n className?: string;\n}\n\nexport function ComboboxItem({\n value,\n children,\n textValue,\n keywords = [],\n disabled = false,\n onSelect,\n className,\n}: ComboboxItemProps) {\n const context = useComboboxContext(\"ComboboxItem\");\n const groupId = useContext(ComboboxGroupContext);\n const id = useId();\n const itemRef = useRef<HTMLButtonElement>(null);\n const label = textValue ?? (typeof children === \"string\" ? children : value);\n const visible = context.isVisible(value);\n const active = context.activeValue === value;\n const selected = context.value === value;\n const keywordKey = keywords.join(\"\\u0000\");\n const normalizedKeywords = useMemo(\n () => (keywordKey ? keywordKey.split(\"\\u0000\") : []),\n [keywordKey],\n );\n const { registerItem, unregisterItem } = context;\n\n useLayoutEffect(() => {\n registerItem({\n value,\n label,\n keywords: normalizedKeywords,\n disabled,\n groupId,\n id,\n ref: itemRef,\n });\n return () => unregisterItem(value);\n }, [disabled, groupId, id, label, normalizedKeywords, registerItem, unregisterItem, value]);\n\n if (!visible) return null;\n\n return (\n <button\n ref={itemRef}\n id={id}\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n disabled={disabled}\n tabIndex={-1}\n data-combobox-item=\"\"\n data-active={active || undefined}\n data-selected={selected || undefined}\n onPointerMove={() => {\n if (!disabled) context.setActiveValue(value);\n }}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n if (disabled) return;\n onSelect?.(value);\n context.select(value);\n }}\n className={cn(\n \"relative isolate flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n \"disabled:pointer-events-none disabled:opacity-45\",\n className,\n )}\n >\n {active ? (\n <motion.span\n aria-hidden\n layoutId={context.activeLayoutId}\n className=\"absolute inset-0 -z-10 rounded-lg bg-muted\"\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n />\n ) : null}\n <span className=\"min-w-0 flex-1\">{children}</span>\n <motion.span\n aria-hidden\n initial={false}\n animate={{\n opacity: selected ? 1 : 0,\n transform: selected ? \"scale(1)\" : \"scale(0.82)\",\n }}\n transition={context.reduce ? { duration: 0 } : { duration: 0.14, ease: EASE_OUT }}\n className=\"grid size-5 shrink-0 place-items-center text-foreground\"\n >\n <Check className=\"size-4\" />\n </motion.span>\n </button>\n );\n}\n\nexport interface ComboboxEmptyProps {\n children?: ReactNode;\n className?: string;\n}\n\nexport function ComboboxEmpty({ children = \"No options found.\", className }: ComboboxEmptyProps) {\n const context = useComboboxContext(\"ComboboxEmpty\");\n if (context.visibleCount > 0) return null;\n return (\n <div\n role=\"status\"\n className={cn(\"px-3 py-8 text-center text-muted-foreground text-sm\", className)}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxSeparatorProps {\n className?: string;\n}\n\nexport function ComboboxSeparator({ className }: ComboboxSeparatorProps) {\n return <div aria-hidden className={cn(\"-mx-1 my-1 h-px bg-border\", className)} />;\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,UAAU,YAAY,WAAW,aAAgC;CAC9F,MAAM,UAAU,mBAAmB,cAAc;CACjD,OACE,oBAAC,OAAD;EACE,IAAI,QAAQ;EACZ,MAAK;EACL,cAAY;EACZ,WAAW,GACT,oIACA,SACF;EAEC;CACE,CAAA;AAET;AAOA,SAAgB,cAAc,EAAE,UAAU,aAAiC;CACzE,MAAM,UAAU,mBAAmB,eAAe;CAClD,MAAM,UAAU,MAAM;CACtB,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EACpC,UAAA,oBAAC,YAAD;GACE,QAAQ,CAAC,QAAQ,gBAAgB,OAAO;GACxC,WAAW,GAAG,mCAAmC,SAAS;GAEzD;EACO,CAAA;CACmB,CAAA;AAEnC;AAOA,SAAgB,cAAc,EAAE,UAAU,aAAiC;CACzE,MAAM,UAAU,WAAW,oBAAoB;CAC/C,MAAM,iBAAiB,GACrB,mGACA,SACF;CACA,OAAO,UACL,oBAAC,UAAD;EAAQ,WAAW;EAAiB;CAAiB,CAAA,IAErD,oBAAC,OAAD;EAAK,WAAW;EAAiB;CAAc,CAAA;AAEnD;AAYA,SAAgB,aAAa,EAC3B,OACA,UACA,WACA,WAAW,CAAC,GACZ,WAAW,OACX,UACA,aACoB;CACpB,MAAM,UAAU,mBAAmB,cAAc;CACjD,MAAM,UAAU,WAAW,oBAAoB;CAC/C,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,OAA0B,IAAI;CAC9C,MAAM,QAAQ,cAAc,OAAO,aAAa,WAAW,WAAW;CACtE,MAAM,UAAU,QAAQ,UAAU,KAAK;CACvC,MAAM,S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AAO,WAAU,SAAU,CAAA;GAChB,CAAA;EACP;;AAEZ;AAOA,SAAgB,cAAc,EAAE,WAAW,qBAAqB,aAAiC;CAE/F,IADgB,mBAAmB,eACzB,CAAC,CAAC,eAAe,GAAG,OAAO;CACrC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,WAAW,GAAG,uDAAuD,SAAS;EAE7E;CACE,CAAA;AAET;AAMA,SAAgB,kBAAkB,EAAE,aAAqC;CACvE,OAAO,oBAAC,OAAD;EAAK,eAAA;EAAY,WAAW,GAAG,6BAA6B,SAAS;CAAI,CAAA;AAClF"}
1
+ {"version":3,"file":"list.js","names":[],"sources":["../../../../src/components/motion/combobox/list.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useContext, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { ComboboxGroupContext, useComboboxContext } from \"./context\";\n\nexport interface ComboboxListProps {\n children: ReactNode;\n ariaLabel?: string;\n className?: string;\n}\n\nexport function ComboboxList({ children, ariaLabel = \"Options\", className }: ComboboxListProps) {\n const context = useComboboxContext(\"ComboboxList\");\n return (\n <div\n id={context.listId}\n role=\"listbox\"\n aria-label={ariaLabel}\n className={cn(\n \"scrollbar-none relative isolate max-h-64 overflow-y-auto overscroll-contain p-1.5 [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxGroupProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxGroup({ children, className }: ComboboxGroupProps) {\n const context = useComboboxContext(\"ComboboxGroup\");\n const groupId = useId();\n return (\n <ComboboxGroupContext.Provider value={groupId}>\n <fieldset\n hidden={!context.hasVisibleItems(groupId)}\n className={cn(\"m-0 min-w-0 border-0 p-0 py-0.5\", className)}\n >\n {children}\n </fieldset>\n </ComboboxGroupContext.Provider>\n );\n}\n\nexport interface ComboboxLabelProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function ComboboxLabel({ children, className }: ComboboxLabelProps) {\n const groupId = useContext(ComboboxGroupContext);\n const labelClassName = cn(\n \"w-full px-2 py-1.5 font-medium text-[0.68rem] text-muted-foreground uppercase tracking-[0.12em]\",\n className,\n );\n return groupId ? (\n <legend className={labelClassName}>{children}</legend>\n ) : (\n <div className={labelClassName}>{children}</div>\n );\n}\n\nexport interface ComboboxItemProps {\n value: string;\n children: ReactNode;\n textValue?: string;\n keywords?: string[];\n disabled?: boolean;\n onSelect?: (value: string) => void;\n className?: string;\n}\n\nexport function ComboboxItem({\n value,\n children,\n textValue,\n keywords = [],\n disabled = false,\n onSelect,\n className,\n}: ComboboxItemProps) {\n const context = useComboboxContext(\"ComboboxItem\");\n const groupId = useContext(ComboboxGroupContext);\n const id = useId();\n const itemRef = useRef<HTMLButtonElement>(null);\n const label = textValue ?? (typeof children === \"string\" ? children : value);\n const visible = context.isVisible(value);\n const active = context.activeValue === value;\n const selected = context.value === value;\n const keywordKey = keywords.join(\"\\u0000\");\n const normalizedKeywords = useMemo(\n () => (keywordKey ? keywordKey.split(\"\\u0000\") : []),\n [keywordKey],\n );\n const { registerItem, unregisterItem } = context;\n\n useLayoutEffect(() => {\n registerItem({\n value,\n label,\n keywords: normalizedKeywords,\n disabled,\n groupId,\n id,\n ref: itemRef,\n });\n return () => unregisterItem(value);\n }, [disabled, groupId, id, label, normalizedKeywords, registerItem, unregisterItem, value]);\n\n if (!visible) return null;\n\n return (\n <button\n ref={itemRef}\n id={id}\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n disabled={disabled}\n tabIndex={-1}\n data-combobox-item=\"\"\n data-active={active || undefined}\n data-selected={selected || undefined}\n onPointerMove={() => {\n if (!disabled) context.setActiveValue(value);\n }}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n if (disabled) return;\n onSelect?.(value);\n context.select(value);\n }}\n className={cn(\n \"relative flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm outline-none transition-colors duration-150\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n \"disabled:pointer-events-none disabled:opacity-45\",\n className,\n )}\n >\n {active ? (\n <motion.span\n aria-hidden\n layoutId={context.activeLayoutId}\n className=\"absolute inset-0 -z-10 rounded-lg bg-muted\"\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n />\n ) : null}\n <span className=\"min-w-0 flex-1\">{children}</span>\n <motion.span\n aria-hidden\n initial={false}\n animate={{\n opacity: selected ? 1 : 0,\n transform: selected ? \"scale(1)\" : \"scale(0.82)\",\n }}\n transition={context.reduce ? { duration: 0 } : { duration: 0.14, ease: EASE_OUT }}\n className=\"grid size-5 shrink-0 place-items-center text-foreground\"\n >\n <Check className=\"size-4\" />\n </motion.span>\n </button>\n );\n}\n\nexport interface ComboboxEmptyProps {\n children?: ReactNode;\n className?: string;\n}\n\nexport function ComboboxEmpty({ children = \"No options found.\", className }: ComboboxEmptyProps) {\n const context = useComboboxContext(\"ComboboxEmpty\");\n if (context.visibleCount > 0) return null;\n return (\n <div\n role=\"status\"\n className={cn(\"px-3 py-8 text-center text-muted-foreground text-sm\", className)}\n >\n {children}\n </div>\n );\n}\n\nexport interface ComboboxSeparatorProps {\n className?: string;\n}\n\nexport function ComboboxSeparator({ className }: ComboboxSeparatorProps) {\n return <div aria-hidden className={cn(\"-mx-1 my-1 h-px bg-border\", className)} />;\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgB,aAAa,EAAE,UAAU,YAAY,WAAW,aAAgC;CAC9F,MAAM,UAAU,mBAAmB,cAAc;CACjD,OACE,oBAAC,OAAD;EACE,IAAI,QAAQ;EACZ,MAAK;EACL,cAAY;EACZ,WAAW,GACT,6IACA,SACF;EAEC;CACE,CAAA;AAET;AAOA,SAAgB,cAAc,EAAE,UAAU,aAAiC;CACzE,MAAM,UAAU,mBAAmB,eAAe;CAClD,MAAM,U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AU;EACV,sBAAmB;EACnB,eAAa,UAAU,KAAA;EACvB,iBAAe,YAAY,KAAA;EAC3B,qBAAqB;GACnB,IAAI,CAAC,UAAU,QAAQ,eAAe,KAAK;EAC7C;EACA,gBAAgB,UAAU,MAAM,eAAe;EAC/C,eAAe;GACb,IAAI,UAAU;GACd,WAAW,KAAK;GAChB,QAAQ,OAAO,KAAK;EACtB;EACA,WAAW,GACT,8HACA,SAAS,oBAAoB,yBAC7B,oDACA,SACF;EAzBF,UAAA;GA2BG,SACC,oBAAC,OAAO,MAAR;IACE,eAAA;IACA,UAAU,QAAQ;IAClB,WAAU;IACV,YAAY,QAAQ,SAAS,EAAE,UAAU,EAAE,IAAI;GAChD,CAAA,IACC;GACJ,oBAAC,QAAD;IAAM,WAAU;IAAkB;GAAe,CAAA;GACjD,oBAAC,OAAO,MAAR;IACE,eAAA;IACA,SAAS;IACT,SAAS;KACP,SAAS,WAAW,IAAI;KACxB,WAAW,WAAW,aAAa;IACrC;IACA,YAAY,QAAQ,SAAS,EAAE,UAAU,EAAE,IAAI;KAAE,UAAU;KAAM,MAAM;IAAS;IAChF,WAAU;IAEV,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;GAChB,CAAA;EACP;;AAEZ;AAOA,SAAgB,cAAc,EAAE,WAAW,qBAAqB,aAAiC;CAE/F,IADgB,mBAAmB,eACzB,CAAC,CAAC,eAAe,GAAG,OAAO;CACrC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,WAAW,GAAG,uDAAuD,SAAS;EAE7E;CACE,CAAA;AAET;AAMA,SAAgB,kBAAkB,EAAE,aAAqC;CACvE,OAAO,oBAAC,OAAD;EAAK,eAAA;EAAY,WAAW,GAAG,6BAA6B,SAAS;CAAI,CAAA;AAClF"}
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/components/motion/project-folder.d.ts
3
+ type ProjectFolderPreview = {
4
+ id: string;
5
+ content: ReactNode;
6
+ };
7
+ interface ProjectFolderProps {
8
+ title: string;
9
+ description?: string;
10
+ previews?: ProjectFolderPreview[];
11
+ count?: number;
12
+ itemLabel?: string;
13
+ open?: boolean;
14
+ defaultOpen?: boolean;
15
+ onOpenChange?: (open: boolean) => void;
16
+ expanded?: boolean;
17
+ defaultExpanded?: boolean;
18
+ onExpandedChange?: (expanded: boolean) => void;
19
+ onClick?: () => void;
20
+ disabled?: boolean;
21
+ ariaLabel?: string;
22
+ className?: string;
23
+ }
24
+ declare function ProjectFolder({ title, description, previews, count, itemLabel, open, defaultOpen, onOpenChange, expanded, defaultExpanded, onExpandedChange, onClick, disabled, ariaLabel, className }: ProjectFolderProps): import("react").JSX.Element;
25
+ //#endregion
26
+ export { ProjectFolder, ProjectFolderPreview, ProjectFolderProps };
27
+ //# sourceMappingURL=project-folder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-folder.d.ts","names":[],"sources":["../../../src/components/motion/project-folder.tsx"],"mappings":";;KAiBY;EACV;EACA,SAAS;;UAGM;EACf;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA,oBAAoB;EACpB;EACA;EACA;EACA;;iBA4Bc,gBACd,OACA,aACA,UACA,OACA,WACA,MACA,aACA,cACA,UACA,iBACA,kBACA,SACA,UACA,WACA,aACC,qCAAkB,IAAA"}
@@ -0,0 +1,310 @@
1
+ "use client";
2
+ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
+ import { SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
4
+ import { useCallback, useEffect, useId, useRef, useState } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
8
+ import { X } from "lucide-react";
9
+ import { createPortal } from "react-dom";
10
+ //#region src/components/motion/project-folder.tsx
11
+ const MAX_PREVIEWS = 5;
12
+ const FOCUSABLE_SELECTOR = [
13
+ "a[href]",
14
+ "button:not([disabled])",
15
+ "input:not([disabled])",
16
+ "select:not([disabled])",
17
+ "textarea:not([disabled])",
18
+ "[tabindex]:not([tabindex=\"-1\"])"
19
+ ].join(",");
20
+ function getPreviewTransform(index, count) {
21
+ const offset = index - (count - 1) / 2;
22
+ const distance = Math.abs(offset);
23
+ const centerLift = Math.max(0, 2 - distance) * 8;
24
+ return {
25
+ x: offset * 44,
26
+ y: 8 - centerLift,
27
+ rotate: offset * 6,
28
+ scale: distance === 0 ? 1.04 : distance === 1 ? .95 : .88,
29
+ opacity: distance === 0 ? 1 : distance === 1 ? .78 : .58,
30
+ zIndex: 10 - distance
31
+ };
32
+ }
33
+ function ProjectFolder({ title, description = "Updated recently", previews = [], count = previews.length, itemLabel = "file", open, defaultOpen = false, onOpenChange, expanded, defaultExpanded = false, onExpandedChange, onClick, disabled = false, ariaLabel, className }) {
34
+ const reduce = useReducedMotion();
35
+ const canHover = useHoverCapable();
36
+ const layoutGroupId = useId();
37
+ const dialogTitleId = `${layoutGroupId}-title`;
38
+ const hoveredRef = useRef(false);
39
+ const focusedRef = useRef(false);
40
+ const restoringFocusRef = useRef(false);
41
+ const folderButtonRef = useRef(null);
42
+ const closeButtonRef = useRef(null);
43
+ const dialogRef = useRef(null);
44
+ const [mounted, setMounted] = useState(false);
45
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
46
+ const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
47
+ const [isClosing, setIsClosing] = useState(false);
48
+ const openControlled = open !== void 0;
49
+ const expandedControlled = expanded !== void 0;
50
+ const isExpanded = expanded ?? internalExpanded;
51
+ const isOpen = (open ?? internalOpen) || isExpanded;
52
+ const previewItems = previews.slice(0, MAX_PREVIEWS);
53
+ const transition = reduce ? { duration: 0 } : SPRING_LAYOUT;
54
+ const countText = `${count} ${itemLabel}${count === 1 ? "" : "s"}`;
55
+ const setOpen = useCallback((next) => {
56
+ if (disabled) return;
57
+ if (!openControlled) setInternalOpen(next);
58
+ onOpenChange?.(next);
59
+ }, [
60
+ disabled,
61
+ onOpenChange,
62
+ openControlled
63
+ ]);
64
+ const setExpanded = useCallback((next) => {
65
+ if (disabled || previewItems.length === 0) return;
66
+ if (!expandedControlled) setInternalExpanded(next);
67
+ onExpandedChange?.(next);
68
+ }, [
69
+ disabled,
70
+ expandedControlled,
71
+ onExpandedChange,
72
+ previewItems.length
73
+ ]);
74
+ const finishClose = useCallback(() => {
75
+ setIsClosing(false);
76
+ restoringFocusRef.current = true;
77
+ requestAnimationFrame(() => folderButtonRef.current?.focus());
78
+ }, []);
79
+ const closeOverlay = useCallback(() => {
80
+ setIsClosing(true);
81
+ setOpen(false);
82
+ setExpanded(false);
83
+ }, [setExpanded, setOpen]);
84
+ useEffect(() => setMounted(true), []);
85
+ useEffect(() => {
86
+ if (reduce && isClosing) finishClose();
87
+ }, [
88
+ finishClose,
89
+ isClosing,
90
+ reduce
91
+ ]);
92
+ useEffect(() => {
93
+ if (!isExpanded) return;
94
+ const previousOverflow = document.body.style.overflow;
95
+ const focusFrame = requestAnimationFrame(() => closeButtonRef.current?.focus());
96
+ document.body.style.overflow = "hidden";
97
+ const handleKeyDown = (event) => {
98
+ if (event.key === "Escape") {
99
+ event.preventDefault();
100
+ closeOverlay();
101
+ return;
102
+ }
103
+ if (event.key !== "Tab" || !dialogRef.current) return;
104
+ const focusable = Array.from(dialogRef.current.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => element.tabIndex >= 0);
105
+ const first = focusable[0];
106
+ const last = focusable.at(-1);
107
+ if (!first || !last) return;
108
+ if (event.shiftKey && document.activeElement === first) {
109
+ event.preventDefault();
110
+ last.focus();
111
+ } else if (!event.shiftKey && document.activeElement === last) {
112
+ event.preventDefault();
113
+ first.focus();
114
+ }
115
+ };
116
+ document.addEventListener("keydown", handleKeyDown);
117
+ return () => {
118
+ cancelAnimationFrame(focusFrame);
119
+ document.body.style.overflow = previousOverflow;
120
+ document.removeEventListener("keydown", handleKeyDown);
121
+ };
122
+ }, [closeOverlay, isExpanded]);
123
+ const handleFolderClick = () => {
124
+ setIsClosing(false);
125
+ setExpanded(true);
126
+ setOpen(true);
127
+ onClick?.();
128
+ };
129
+ const overlay = isExpanded || isClosing ? /* @__PURE__ */ jsxs("div", {
130
+ ref: dialogRef,
131
+ role: "dialog",
132
+ "aria-modal": "true",
133
+ "aria-labelledby": dialogTitleId,
134
+ "aria-hidden": isExpanded ? void 0 : "true",
135
+ className: cn("fixed inset-0 z-50 flex items-start justify-center overflow-y-auto sm:items-center", isClosing && "pointer-events-none"),
136
+ children: [/* @__PURE__ */ jsx(AnimatePresence, {
137
+ initial: false,
138
+ children: isExpanded ? /* @__PURE__ */ jsx(motion.button, {
139
+ type: "button",
140
+ tabIndex: -1,
141
+ "aria-label": "Close file overlay",
142
+ onClick: closeOverlay,
143
+ initial: { opacity: 0 },
144
+ animate: { opacity: 1 },
145
+ exit: { opacity: 0 },
146
+ transition: reduce ? { duration: 0 } : { duration: .18 },
147
+ className: "absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl"
148
+ }, "project-files-backdrop") : null
149
+ }), /* @__PURE__ */ jsxs("div", {
150
+ className: "relative z-10 w-full max-w-5xl px-6 py-8",
151
+ children: [/* @__PURE__ */ jsx(AnimatePresence, {
152
+ initial: false,
153
+ children: isExpanded ? /* @__PURE__ */ jsxs(motion.div, {
154
+ initial: {
155
+ opacity: 0,
156
+ y: reduce ? 0 : 8
157
+ },
158
+ animate: {
159
+ opacity: 1,
160
+ y: 0
161
+ },
162
+ exit: {
163
+ opacity: 0,
164
+ y: reduce ? 0 : -8
165
+ },
166
+ transition: reduce ? { duration: 0 } : { duration: .18 },
167
+ className: "mb-6 flex items-center justify-between gap-4",
168
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
169
+ id: dialogTitleId,
170
+ className: "font-medium text-foreground text-xl",
171
+ children: title
172
+ }), /* @__PURE__ */ jsx("p", {
173
+ className: "mt-1 text-muted-foreground text-sm",
174
+ children: countText
175
+ })] }), /* @__PURE__ */ jsx("button", {
176
+ ref: closeButtonRef,
177
+ type: "button",
178
+ onClick: closeOverlay,
179
+ "aria-label": `Close ${title}`,
180
+ className: "flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
181
+ children: /* @__PURE__ */ jsx(X, {
182
+ className: "size-4",
183
+ "aria-hidden": "true"
184
+ })
185
+ })]
186
+ }, "project-files-header") : null
187
+ }), /* @__PURE__ */ jsx("div", {
188
+ className: "grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5",
189
+ children: isExpanded ? previewItems.map((preview) => /* @__PURE__ */ jsx(motion.div, {
190
+ layoutId: `file-${preview.id}`,
191
+ transition,
192
+ className: "aspect-3/4 w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl",
193
+ children: preview.content
194
+ }, preview.id)) : null
195
+ })]
196
+ })]
197
+ }) : null;
198
+ return /* @__PURE__ */ jsxs(LayoutGroup, {
199
+ id: layoutGroupId,
200
+ children: [/* @__PURE__ */ jsxs(motion.button, {
201
+ ref: folderButtonRef,
202
+ type: "button",
203
+ disabled,
204
+ "aria-label": ariaLabel,
205
+ "aria-haspopup": "dialog",
206
+ "aria-expanded": isExpanded,
207
+ "data-open": isOpen ? "true" : "false",
208
+ "data-expanded": isExpanded ? "true" : "false",
209
+ tabIndex: isExpanded ? -1 : void 0,
210
+ onPointerEnter: () => {
211
+ if (!canHover) return;
212
+ hoveredRef.current = true;
213
+ setOpen(true);
214
+ },
215
+ onPointerLeave: () => {
216
+ if (!canHover) return;
217
+ hoveredRef.current = false;
218
+ if (!isExpanded && !isClosing) setOpen(focusedRef.current);
219
+ },
220
+ onFocus: () => {
221
+ if (restoringFocusRef.current) {
222
+ restoringFocusRef.current = false;
223
+ focusedRef.current = false;
224
+ return;
225
+ }
226
+ focusedRef.current = true;
227
+ setOpen(true);
228
+ },
229
+ onBlur: () => {
230
+ focusedRef.current = false;
231
+ if (!isExpanded && !isClosing) setOpen(hoveredRef.current);
232
+ },
233
+ onClick: handleFolderClick,
234
+ whileTap: reduce || disabled ? void 0 : { scale: .98 },
235
+ transition: reduce ? { duration: 0 } : SPRING_PRESS,
236
+ className: cn("perspective-[1200px] relative block h-56 w-72 select-none rounded-2xl text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", className),
237
+ children: [
238
+ /* @__PURE__ */ jsx(motion.span, {
239
+ "aria-hidden": "true",
240
+ animate: { rotateX: isOpen && !reduce ? 15 : 0 },
241
+ transition,
242
+ className: "absolute inset-0 origin-[center_bottom] rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl"
243
+ }),
244
+ /* @__PURE__ */ jsx("span", {
245
+ "aria-hidden": "true",
246
+ className: "pointer-events-none absolute inset-0",
247
+ children: /* @__PURE__ */ jsx("span", {
248
+ className: "absolute top-0 left-1/2 block h-0 w-0",
249
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
250
+ initial: false,
251
+ children: !isExpanded ? previewItems.map((preview, index) => {
252
+ const opened = getPreviewTransform(index, previewItems.length);
253
+ return /* @__PURE__ */ jsx(motion.span, {
254
+ layoutId: `file-${preview.id}`,
255
+ initial: false,
256
+ animate: isOpen && !reduce ? {
257
+ x: opened.x * 1.4,
258
+ y: opened.y - 8,
259
+ rotate: opened.rotate * 1.3,
260
+ scale: opened.scale * 1.02,
261
+ opacity: Math.min(1, opened.opacity + .18)
262
+ } : {
263
+ x: opened.x,
264
+ y: opened.y,
265
+ rotate: opened.rotate,
266
+ scale: opened.scale,
267
+ opacity: opened.opacity
268
+ },
269
+ transition,
270
+ onLayoutAnimationComplete: () => {
271
+ if (isClosing && index === 0) finishClose();
272
+ },
273
+ className: "absolute top-0 left-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg",
274
+ style: { zIndex: opened.zIndex },
275
+ children: preview.content
276
+ }, preview.id);
277
+ }) : null
278
+ })
279
+ })
280
+ }),
281
+ /* @__PURE__ */ jsxs(motion.span, {
282
+ initial: false,
283
+ animate: { rotateX: isOpen && !reduce ? -25 : 0 },
284
+ transition,
285
+ className: "backface-hidden absolute inset-x-0 bottom-0 z-20 origin-[center_bottom] overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl",
286
+ children: [/* @__PURE__ */ jsx("span", {
287
+ className: "flex h-16 items-center px-4",
288
+ children: /* @__PURE__ */ jsx("span", {
289
+ className: "line-clamp-2 font-medium text-foreground text-xl leading-tight",
290
+ children: title
291
+ })
292
+ }), /* @__PURE__ */ jsxs("span", {
293
+ className: "flex h-12 items-center justify-between gap-3 border-foreground/10 border-t px-4",
294
+ children: [/* @__PURE__ */ jsx("span", {
295
+ className: "shrink-0 font-medium text-foreground/70 text-sm",
296
+ children: countText
297
+ }), /* @__PURE__ */ jsx("span", {
298
+ className: "truncate text-muted-foreground text-sm",
299
+ children: description
300
+ })]
301
+ })]
302
+ })
303
+ ]
304
+ }), mounted ? createPortal(overlay, document.body) : null]
305
+ });
306
+ }
307
+ //#endregion
308
+ export { ProjectFolder };
309
+
310
+ //# sourceMappingURL=project-folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-folder.js","names":[],"sources":["../../../src/components/motion/project-folder.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport {\n AnimatePresence,\n LayoutGroup,\n motion,\n type Transition,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\nexport type ProjectFolderPreview = {\n id: string;\n content: ReactNode;\n};\n\nexport interface ProjectFolderProps {\n title: string;\n description?: string;\n previews?: ProjectFolderPreview[];\n count?: number;\n itemLabel?: string;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onClick?: () => void;\n disabled?: boolean;\n ariaLabel?: string;\n className?: string;\n}\n\nconst MAX_PREVIEWS = 5;\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\nfunction getPreviewTransform(index: number, count: number) {\n const offset = index - (count - 1) / 2;\n const distance = Math.abs(offset);\n const centerLift = Math.max(0, 2 - distance) * 8;\n\n return {\n x: offset * 44,\n y: 8 - centerLift,\n rotate: offset * 6,\n scale: distance === 0 ? 1.04 : distance === 1 ? 0.95 : 0.88,\n opacity: distance === 0 ? 1 : distance === 1 ? 0.78 : 0.58,\n zIndex: 10 - distance,\n };\n}\n\nexport function ProjectFolder({\n title,\n description = \"Updated recently\",\n previews = [],\n count = previews.length,\n itemLabel = \"file\",\n open,\n defaultOpen = false,\n onOpenChange,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onClick,\n disabled = false,\n ariaLabel,\n className,\n}: ProjectFolderProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const layoutGroupId = useId();\n const dialogTitleId = `${layoutGroupId}-title`;\n const hoveredRef = useRef(false);\n const focusedRef = useRef(false);\n const restoringFocusRef = useRef(false);\n const folderButtonRef = useRef<HTMLButtonElement>(null);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const [mounted, setMounted] = useState(false);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const [isClosing, setIsClosing] = useState(false);\n const openControlled = open !== undefined;\n const expandedControlled = expanded !== undefined;\n const isExpanded = expanded ?? internalExpanded;\n const isOpen = (open ?? internalOpen) || isExpanded;\n const previewItems = previews.slice(0, MAX_PREVIEWS);\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const countText = `${count} ${itemLabel}${count === 1 ? \"\" : \"s\"}`;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (disabled) return;\n if (!openControlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [disabled, onOpenChange, openControlled],\n );\n\n const setExpanded = useCallback(\n (next: boolean) => {\n if (disabled || previewItems.length === 0) return;\n if (!expandedControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [disabled, expandedControlled, onExpandedChange, previewItems.length],\n );\n\n const finishClose = useCallback(() => {\n setIsClosing(false);\n restoringFocusRef.current = true;\n requestAnimationFrame(() => folderButtonRef.current?.focus());\n }, []);\n\n const closeOverlay = useCallback(() => {\n setIsClosing(true);\n setOpen(false);\n setExpanded(false);\n }, [setExpanded, setOpen]);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n if (reduce && isClosing) finishClose();\n }, [finishClose, isClosing, reduce]);\n\n useEffect(() => {\n if (!isExpanded) return;\n\n const previousOverflow = document.body.style.overflow;\n const focusFrame = requestAnimationFrame(() => closeButtonRef.current?.focus());\n\n document.body.style.overflow = \"hidden\";\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeOverlay();\n return;\n }\n if (event.key !== \"Tab\" || !dialogRef.current) return;\n\n const focusable = Array.from(\n dialogRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter((element) => element.tabIndex >= 0);\n const first = focusable[0];\n const last = focusable.at(-1);\n if (!first || !last) return;\n\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n cancelAnimationFrame(focusFrame);\n document.body.style.overflow = previousOverflow;\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [closeOverlay, isExpanded]);\n\n const handleFolderClick = () => {\n setIsClosing(false);\n setExpanded(true);\n setOpen(true);\n onClick?.();\n };\n\n const overlay =\n isExpanded || isClosing ? (\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={dialogTitleId}\n aria-hidden={isExpanded ? undefined : \"true\"}\n className={cn(\n \"fixed inset-0 z-50 flex items-start justify-center overflow-y-auto sm:items-center\",\n isClosing && \"pointer-events-none\",\n )}\n >\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.button\n key=\"project-files-backdrop\"\n type=\"button\"\n tabIndex={-1}\n aria-label=\"Close file overlay\"\n onClick={closeOverlay}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className=\"absolute inset-0 cursor-default bg-background/80 backdrop-blur-xl\"\n />\n ) : null}\n </AnimatePresence>\n\n <div className=\"relative z-10 w-full max-w-5xl px-6 py-8\">\n <AnimatePresence initial={false}>\n {isExpanded ? (\n <motion.div\n key=\"project-files-header\"\n initial={{ opacity: 0, y: reduce ? 0 : 8 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: reduce ? 0 : -8 }}\n transition={reduce ? { duration: 0 } : { duration: 0.18 }}\n className=\"mb-6 flex items-center justify-between gap-4\"\n >\n <div>\n <h2 id={dialogTitleId} className=\"font-medium text-foreground text-xl\">\n {title}\n </h2>\n <p className=\"mt-1 text-muted-foreground text-sm\">{countText}</p>\n </div>\n <button\n ref={closeButtonRef}\n type=\"button\"\n onClick={closeOverlay}\n aria-label={`Close ${title}`}\n className=\"flex size-10 items-center justify-center rounded-full border border-foreground/10 bg-background/50 text-muted-foreground backdrop-blur-xl transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </motion.div>\n ) : null}\n </AnimatePresence>\n\n <div className=\"grid grid-cols-2 place-items-center gap-3 sm:grid-cols-3 lg:grid-cols-5\">\n {isExpanded\n ? previewItems.map((preview) => (\n <motion.div\n key={preview.id}\n layoutId={`file-${preview.id}`}\n transition={transition}\n className=\"aspect-3/4 w-full max-w-40 overflow-hidden rounded-xl border border-foreground/10 bg-background/50 backdrop-blur-xl\"\n >\n {preview.content}\n </motion.div>\n ))\n : null}\n </div>\n </div>\n </div>\n ) : null;\n\n return (\n <LayoutGroup id={layoutGroupId}>\n <motion.button\n ref={folderButtonRef}\n type=\"button\"\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={isExpanded}\n data-open={isOpen ? \"true\" : \"false\"}\n data-expanded={isExpanded ? \"true\" : \"false\"}\n tabIndex={isExpanded ? -1 : undefined}\n onPointerEnter={() => {\n if (!canHover) return;\n hoveredRef.current = true;\n setOpen(true);\n }}\n onPointerLeave={() => {\n if (!canHover) return;\n hoveredRef.current = false;\n if (!isExpanded && !isClosing) setOpen(focusedRef.current);\n }}\n onFocus={() => {\n if (restoringFocusRef.current) {\n restoringFocusRef.current = false;\n focusedRef.current = false;\n return;\n }\n focusedRef.current = true;\n setOpen(true);\n }}\n onBlur={() => {\n focusedRef.current = false;\n if (!isExpanded && !isClosing) setOpen(hoveredRef.current);\n }}\n onClick={handleFolderClick}\n whileTap={reduce || disabled ? undefined : { scale: 0.98 }}\n transition={reduce ? { duration: 0 } : SPRING_PRESS}\n className={cn(\n \"perspective-[1200px] relative block h-56 w-72 select-none rounded-2xl text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n >\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotateX: isOpen && !reduce ? 15 : 0 }}\n transition={transition}\n className=\"absolute inset-0 origin-[center_bottom] rounded-2xl border border-foreground/10 bg-background/25 backdrop-blur-xl\"\n />\n\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0\">\n <span className=\"absolute top-0 left-1/2 block h-0 w-0\">\n <AnimatePresence initial={false}>\n {!isExpanded\n ? previewItems.map((preview, index) => {\n const opened = getPreviewTransform(index, previewItems.length);\n return (\n <motion.span\n key={preview.id}\n layoutId={`file-${preview.id}`}\n initial={false}\n animate={\n isOpen && !reduce\n ? {\n x: opened.x * 1.4,\n y: opened.y - 8,\n rotate: opened.rotate * 1.3,\n scale: opened.scale * 1.02,\n opacity: Math.min(1, opened.opacity + 0.18),\n }\n : {\n x: opened.x,\n y: opened.y,\n rotate: opened.rotate,\n scale: opened.scale,\n opacity: opened.opacity,\n }\n }\n transition={transition}\n onLayoutAnimationComplete={() => {\n if (isClosing && index === 0) finishClose();\n }}\n className=\"absolute top-0 left-0 -ml-12 block h-40 w-24 overflow-hidden rounded-lg border border-foreground/10 bg-background/45 backdrop-blur-lg\"\n style={{ zIndex: opened.zIndex }}\n >\n {preview.content}\n </motion.span>\n );\n })\n : null}\n </AnimatePresence>\n </span>\n </span>\n\n <motion.span\n initial={false}\n animate={{ rotateX: isOpen && !reduce ? -25 : 0 }}\n transition={transition}\n className=\"backface-hidden absolute inset-x-0 bottom-0 z-20 origin-[center_bottom] overflow-hidden rounded-2xl border border-foreground/10 bg-background/60 backdrop-blur-2xl\"\n >\n <span className=\"flex h-16 items-center px-4\">\n <span className=\"line-clamp-2 font-medium text-foreground text-xl leading-tight\">\n {title}\n </span>\n </span>\n <span className=\"flex h-12 items-center justify-between gap-3 border-foreground/10 border-t px-4\">\n <span className=\"shrink-0 font-medium text-foreground/70 text-sm\">{countText}</span>\n <span className=\"truncate text-muted-foreground text-sm\">{description}</span>\n </span>\n </motion.span>\n </motion.button>\n\n {mounted ? createPortal(overlay, document.body) : null}\n </Lay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W,CAAA;KACb,CAAA;IACF,CAAA;IAEN,qBAAC,OAAO,MAAR;KACE,SAAS;KACT,SAAS,EAAE,SAAS,UAAU,CAAC,SAAS,MAAM,EAAE;KACpC;KACZ,WAAU;KAJZ,UAAA,CAME,oBAAC,QAAD;MAAM,WAAU;MACd,UAAA,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA;MACG,CAAA;KACF,CAAA,GACN,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACE,oBAAC,QAAD;OAAM,WAAU;OAAmD,UAAA;MAAgB,CAAA,GACnF,oBAAC,QAAD;OAAM,WAAU;OAA0C,UAAA;MAAkB,CAAA,CACxE;KACK,CAAA,CAAA;;GACA;EAEd,CAAA,GAAA,UAAU,aAAa,SAAS,SAAS,IAAI,IAAI,IACvC;;AAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/motion/tabs.tsx"],"mappings":";;KAgBK;iBA0BW,OACd,cACA,OACA,eACA,SACA,UACA;EAEA;EACA;EACA,iBAAiB;EACjB,UAAU;EACV,UAAU;EACV;oBACD,IAAA;iBAsCe,WAAW,UAAU;EAAe,UAAU;EAAW;oBAAoB,IAAA;iBAS7E,cACd,OACA,UACA,WACA;EAEA;EACA,UAAU;EACV;EACA;oBACD,IAAA;iBA0De,cACd,OACA,UACA;EAEA;EACA,UAAU;EACV;oBACD,IAAA"}
1
+ {"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/motion/tabs.tsx"],"mappings":";;KAgBK;iBA0BW,OACd,cACA,OACA,eACA,SACA,UACA;EAEA;EACA;EACA,iBAAiB;EACjB,UAAU;EACV,UAAU;EACV;oBACD,IAAA;iBAsCe,WAAW,UAAU;EAAe,UAAU;EAAW;oBAAoB,IAAA;iBAS7E,cACd,OACA,UACA,WACA;EAEA;EACA,UAAU;EACV;EACA;oBACD,IAAA;iBA4De,cACd,OACA,UACA;EAEA;EACA,UAAU;EACV;oBACD,IAAA"}
@@ -74,6 +74,7 @@ function TabsTrigger({ value, children, className, indicatorClassName }) {
74
74
  className: cn("relative isolate -mb-px inline-flex min-h-[44px] items-center px-3 pt-1 pb-2.5 font-medium text-sm transition-colors", active ? "text-foreground" : "text-muted-foreground hover:text-foreground", className),
75
75
  children: [children, active ? /* @__PURE__ */ jsx(motion.span, {
76
76
  layoutId,
77
+ layout: "position",
77
78
  className: cn("absolute right-0 -bottom-px left-0 h-px bg-primary", indicatorClassName)
78
79
  }) : null]
79
80
  });
@@ -82,6 +83,7 @@ function TabsTrigger({ value, children, className, indicatorClassName }) {
82
83
  className: "relative",
83
84
  children: [active ? /* @__PURE__ */ jsx(motion.span, {
84
85
  layoutId,
86
+ layout: "position",
85
87
  style: { borderRadius: variant === "pill" ? 9999 : 8 },
86
88
  className: cn("absolute inset-0 bg-primary", radius, indicatorClassName)
87
89
  }) : null, /* @__PURE__ */ jsx("button", {
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/motion/tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { MotionConfig, motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype Variant = \"pill\" | \"underline\" | \"segment\";\n\ntype Ctx = {\n value: string;\n setValue: (v: string) => void;\n layoutId: string;\n variant: Variant;\n};\n\nconst TabsCtx = createContext<Ctx | null>(null);\n\nfunction useTabs() {\n const ctx = useContext(TabsCtx);\n if (!ctx) throw new Error(\"Tabs.* must be used inside <Tabs>\");\n return ctx;\n}\n\n// Weighty spring for the active-tab indicator: a touch of overshoot so it\n// settles with life instead of snapping.\nconst transition: Transition = {\n type: \"spring\",\n stiffness: 170,\n damping: 24,\n mass: 1.2,\n};\n\nexport function Tabs({\n defaultValue,\n value,\n onValueChange,\n variant = \"pill\",\n children,\n className,\n}: {\n defaultValue?: string;\n value?: string;\n onValueChange?: (v: string) => void;\n variant?: Variant;\n children: ReactNode;\n className?: string;\n}) {\n const [internal, setInternal] = useState(defaultValue ?? \"\");\n const layoutId = useId();\n const reduce = useReducedMotion();\n const controlled = value !== undefined;\n const current = controlled ? value : internal;\n const setValue = useCallback(\n (v: string) => {\n if (!controlled) setInternal(v);\n onValueChange?.(v);\n },\n [controlled, onValueChange],\n );\n const contextValue = useMemo(\n () => ({ value: current, setValue, layoutId, variant }),\n [current, layoutId, setValue, variant],\n );\n return (\n <MotionConfig transition={reduce ? { duration: 0 } : transition}>\n <TabsCtx.Provider value={contextValue}>\n {/* layoutRoot: the indicator's layoutId measures in page coordinates, so\n inside fixed/scrolled containers it would replay scroll offsets as\n movement. The pill only ever travels within the list, so scoping\n projection to the Tabs wrapper is always correct. */}\n <motion.div layoutRoot className={className}>\n {children}\n </motion.div>\n </TabsCtx.Provider>\n </MotionConfig>\n );\n}\n\nconst listClasses: Record<Variant, string> = {\n pill: \"inline-flex items-center gap-1 rounded-full bg-card p-1\",\n underline: \"inline-flex items-center gap-1 border-b border-border\",\n segment: \"inline-flex items-center gap-0 rounded-lg bg-card p-0.5\",\n};\n\nexport function TabsList({ children, className }: { children: ReactNode; className?: string }) {\n const { variant } = useTabs();\n return (\n <div role=\"tablist\" className={cn(listClasses[variant], className)}>\n {children}\n </div>\n );\n}\n\nexport function TabsTrigger({\n value,\n children,\n className,\n indicatorClassName,\n}: {\n value: string;\n children: ReactNode;\n className?: string;\n indicatorClassName?: string;\n}) {\n const { value: current, setValue, layoutId, variant } = useTabs();\n const active = current === value;\n\n if (variant === \"underline\") {\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => setValue(value)}\n className={cn(\n \"relative isolate -mb-px inline-flex min-h-[44px] items-center px-3 pt-1 pb-2.5 font-medium text-sm transition-colors\",\n active ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n className,\n )}\n >\n {children}\n {active ? (\n <motion.span\n layoutId={layoutId}\n className={cn(\"absolute right-0 -bottom-px left-0 h-px bg-primary\", indicatorClassName)}\n />\n ) : null}\n </button>\n );\n }\n\n const radius = variant === \"pill\" ? \"rounded-full\" : \"rounded-md\";\n\n return (\n <div className=\"relative\">\n {active ? (\n <motion.span\n layoutId={layoutId}\n style={{ borderRadius: variant === \"pill\" ? 9999 : 8 }}\n className={cn(\"absolute inset-0 bg-primary\", radius, indicatorClassName)}\n />\n ) : null}\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => setValue(value)}\n className={cn(\n \"relative z-10 inline-flex items-center justify-center whitespace-nowrap bg-transparent px-3.5 py-1.5 font-medium text-sm outline-none\",\n \"transition-colors\",\n active ? \"text-primary-foreground\" : \"text-muted-foreground hover:text-foreground\",\n radius,\n className,\n )}\n >\n {children}\n </button>\n </div>\n );\n}\n\nexport function TabsContent({\n value,\n children,\n className,\n}: {\n value: string;\n children: ReactNode;\n className?: string;\n}) {\n const { value: current } = useTabs();\n const reduce = useReducedMotion();\n const active = current === value;\n // Inactive panels stay mounted but hidden, so their content (e.g. source\n // code) is present in the server-rendered HTML for crawlers and assistive\n // tech, instead of being dropped from the DOM.\n if (!active) {\n return (\n <div hidden className={className}>\n {children}\n </div>\n );\n }\n return (\n <motion.div\n key={value}\n initial={{ opacity: 0, y: reduce ? 0 : 4 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.18, ease: EASE_OUT }}\n className={cn(\"mt-4\", className)}\n >\n {children}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,UAAU,cAA0B,IAAI;AAE9C,SAAS,UAAU;CACjB,MAAM,MAAM,WAAW,OAAO;CAC9B,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,mCAAmC;CAC7D,OAAO;AACT;AAIA,MAAM,aAAyB;CAC7B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SAAgB,KAAK,EACnB,cACA,OACA,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CAIZ,MAAM,SAAS,YAAY,SAAS,iBAAiB;CAErD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,SACC,oBAAC,OAAO,MAAR;GACY;GACV,OAAO,EAAE,cAAc,YAAY,SAAS,OAAO,EAAE;GACrD,WAAW,GAAG,+BAA+B,QAAQ,kBAAkB;EACxE,CAAA,IACC,MACJ,oBAAC,UAAD;GACE,MAAK;GACL,MAAK;GACL,iBAAe;GACf,eAAe,SAAS,KAAK;GAC7B,WAAW,GACT,yIACA,qBACA,SAAS,4BAA4B,+CACrC,QACA,SACF;GAEC;EACK,CAAA,CACL;;AAET;AAEA,SAAgB,YAAY,EAC1B,OACA,UACA,aAKC;CACD,MAAM,EAAE,OAAO,YAAY,QAAQ;CACnC,MAAM,SAAS,iBAAiB;CAKhC,IAAI,EAJW,YAAY,QAKzB,OACE,oBAAC,OAAD;EAAK,QAAA;EAAkB;EACpB;CACE,CAAA;CAGT,OACE,oBAAC,OAAO,KAAR;EAEE,SAAS;GAAE,SAAS;GAAG,GAAG,SAAS,IAAI;EAAE;EACzC,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;EAC7C,WAAW,GAAG,QAAQ,SAAS;EAE9B;CACS,GAPL,KAOK;AAEhB"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/motion/tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { MotionConfig, motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype Variant = \"pill\" | \"underline\" | \"segment\";\n\ntype Ctx = {\n value: string;\n setValue: (v: string) => void;\n layoutId: string;\n variant: Variant;\n};\n\nconst TabsCtx = createContext<Ctx | null>(null);\n\nfunction useTabs() {\n const ctx = useContext(TabsCtx);\n if (!ctx) throw new Error(\"Tabs.* must be used inside <Tabs>\");\n return ctx;\n}\n\n// Weighty spring for the active-tab indicator: a touch of overshoot so it\n// settles with life instead of snapping.\nconst transition: Transition = {\n type: \"spring\",\n stiffness: 170,\n damping: 24,\n mass: 1.2,\n};\n\nexport function Tabs({\n defaultValue,\n value,\n onValueChange,\n variant = \"pill\",\n children,\n className,\n}: {\n defaultValue?: string;\n value?: string;\n onValueChange?: (v: string) => void;\n variant?: Variant;\n children: ReactNode;\n className?: string;\n}) {\n const [internal, setInternal] = useState(defaultValue ?? \"\");\n const layoutId = useId();\n const reduce = useReducedMotion();\n const controlled = value !== undefined;\n const current = controlled ? value : internal;\n const setValue = useCallback(\n (v: string) => {\n if (!controlled) setInternal(v);\n onValueChange?.(v);\n },\n [controlled, onValueChange],\n );\n const contextValue = useMemo(\n () => ({ value: current, setValue, layoutId, variant }),\n [current, layoutId, setValue, variant],\n );\n return (\n <MotionConfig transition={reduce ? { duration: 0 } : transition}>\n <TabsCtx.Provider value={contextValue}>\n {/* layoutRoot: the indicator's layoutId measures in page coordinates, so\n inside fixed/scrolled containers it would replay scroll offsets as\n movement. The pill only ever travels within the list, so scoping\n projection to the Tabs wrapper is always correct. */}\n <motion.div layoutRoot className={className}>\n {children}\n </motion.div>\n </TabsCtx.Provider>\n </MotionConfig>\n );\n}\n\nconst listClasses: Record<Variant, string> = {\n pill: \"inline-flex items-center gap-1 rounded-full bg-card p-1\",\n underline: \"inline-flex items-center gap-1 border-b border-border\",\n segment: \"inline-flex items-center gap-0 rounded-lg bg-card p-0.5\",\n};\n\nexport function TabsList({ children, className }: { children: ReactNode; className?: string }) {\n const { variant } = useTabs();\n return (\n <div role=\"tablist\" className={cn(listClasses[variant], className)}>\n {children}\n </div>\n );\n}\n\nexport function TabsTrigger({\n value,\n children,\n className,\n indicatorClassName,\n}: {\n value: string;\n children: ReactNode;\n className?: string;\n indicatorClassName?: string;\n}) {\n const { value: current, setValue, layoutId, variant } = useTabs();\n const active = current === value;\n\n if (variant === \"underline\") {\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => setValue(value)}\n className={cn(\n \"relative isolate -mb-px inline-flex min-h-[44px] items-center px-3 pt-1 pb-2.5 font-medium text-sm transition-colors\",\n active ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n className,\n )}\n >\n {children}\n {active ? (\n <motion.span\n layoutId={layoutId}\n layout=\"position\"\n className={cn(\"absolute right-0 -bottom-px left-0 h-px bg-primary\", indicatorClassName)}\n />\n ) : null}\n </button>\n );\n }\n\n const radius = variant === \"pill\" ? \"rounded-full\" : \"rounded-md\";\n\n return (\n <div className=\"relative\">\n {active ? (\n <motion.span\n layoutId={layoutId}\n layout=\"position\"\n style={{ borderRadius: variant === \"pill\" ? 9999 : 8 }}\n className={cn(\"absolute inset-0 bg-primary\", radius, indicatorClassName)}\n />\n ) : null}\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => setValue(value)}\n className={cn(\n \"relative z-10 inline-flex items-center justify-center whitespace-nowrap bg-transparent px-3.5 py-1.5 font-medium text-sm outline-none\",\n \"transition-colors\",\n active ? \"text-primary-foreground\" : \"text-muted-foreground hover:text-foreground\",\n radius,\n className,\n )}\n >\n {children}\n </button>\n </div>\n );\n}\n\nexport function TabsContent({\n value,\n children,\n className,\n}: {\n value: string;\n children: ReactNode;\n className?: string;\n}) {\n const { value: current } = useTabs();\n const reduce = useReducedMotion();\n const active = current === value;\n // Inactive panels stay mounted but hidden, so their content (e.g. source\n // code) is present in the server-rendered HTML for crawlers and assistive\n // tech, instead of being dropped from the DOM.\n if (!active) {\n return (\n <div hidden className={className}>\n {children}\n </div>\n );\n }\n return (\n <motion.div\n key={value}\n initial={{ opacity: 0, y: reduce ? 0 : 4 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.18, ease: EASE_OUT }}\n className={cn(\"mt-4\", className)}\n >\n {children}\n </motion.div>\n );\n}\n"],"m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AAS,YAAY;CAE3B,IAAI,YAAY,aACd,OACE,qBAAC,UAAD;EACE,MAAK;EACL,MAAK;EACL,iBAAe;EACf,eAAe,SAAS,KAAK;EAC7B,WAAW,GACT,wHACA,SAAS,oBAAoB,+CAC7B,SACF;EATF,UAAA,CAWG,UACA,SACC,oBAAC,OAAO,MAAR;GACY;GACV,QAAO;GACP,WAAW,GAAG,sDAAsD,kBAAkB;EACvF,CAAA,IACC,IACE;;CAIZ,MAAM,SAAS,YAAY,SAAS,iBAAiB;CAErD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,SACC,oBAAC,OAAO,MAAR;GACY;GACV,QAAO;GACP,OAAO,EAAE,cAAc,YAAY,SAAS,OAAO,EAAE;GACrD,WAAW,GAAG,+BAA+B,QAAQ,kBAAkB;EACxE,CAAA,IACC,MACJ,oBAAC,UAAD;GACE,MAAK;GACL,MAAK;GACL,iBAAe;GACf,eAAe,SAAS,KAAK;GAC7B,WAAW,GACT,yIACA,qBACA,SAAS,4BAA4B,+CACrC,QACA,SACF;GAEC;EACK,CAAA,CACL;;AAET;AAEA,SAAgB,YAAY,EAC1B,OACA,UACA,aAKC;CACD,MAAM,EAAE,OAAO,YAAY,QAAQ;CACnC,MAAM,SAAS,iBAAiB;CAKhC,IAAI,EAJW,YAAY,QAKzB,OACE,oBAAC,OAAD;EAAK,QAAA;EAAkB;EACpB;CACE,CAAA;CAGT,OACE,oBAAC,OAAO,KAAR;EAEE,SAAS;GAAE,SAAS;GAAG,GAAG,SAAS,IAAI;EAAE;EACzC,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;EAC7C,WAAW,GAAG,QAAQ,SAAS;EAE9B;CACS,GAPL,KAOK;AAEhB"}
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/reui/alert.d.ts
3
3
  declare const alertVariants: (props?: ({
4
- variant?: "default" | "destructive" | "success" | "info" | "warning" | "invert" | null | undefined;
4
+ variant?: "default" | "destructive" | "info" | "success" | "warning" | "invert" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react").JSX.Element;
7
7
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
@@ -2,8 +2,8 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/reui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "default" | "destructive" | "secondary" | "outline" | "success" | "info" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
- size?: "default" | "sm" | "xs" | "lg" | "xl" | null | undefined;
5
+ variant?: "outline" | "default" | "destructive" | "info" | "success" | "warning" | "invert" | "secondary" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
7
7
  radius?: "default" | "full" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  interface BadgeProps extends useRender.ComponentProps<"span"> {
@@ -13,8 +13,8 @@ import { VariantProps } from "class-variance-authority";
13
13
  * :not() or !important needed
14
14
  */
15
15
  declare const frameVariants: (props?: ({
16
- variant?: "default" | "ghost" | "inverse" | null | undefined;
17
- spacing?: "default" | "sm" | "xs" | "lg" | null | undefined;
16
+ variant?: "ghost" | "default" | "inverse" | null | undefined;
17
+ spacing?: "default" | "sm" | "lg" | "xs" | null | undefined;
18
18
  stacked?: boolean | null | undefined;
19
19
  dense?: boolean | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -22,8 +22,8 @@ import { useRender } from "@base-ui/react/use-render";
22
22
  * default to `text-primary`; override it to recolor without touching internals.
23
23
  */
24
24
  declare const iconTileVariants: (props?: ({
25
- variant?: "outline" | "elevated" | "soft" | "solid" | "frame" | null | undefined;
26
- size?: "default" | "sm" | "xs" | "lg" | "xl" | null | undefined;
25
+ variant?: "soft" | "solid" | "outline" | "elevated" | "frame" | null | undefined;
26
+ size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
27
27
  radius?: "default" | "full" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
29
  interface IconTileProps extends useRender.ComponentProps<"span"> {
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/ui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "default" | "destructive" | "link" | "secondary" | "outline" | "ghost" | null | undefined;
5
+ variant?: "link" | "outline" | "ghost" | "default" | "destructive" | "secondary" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
8
8
  //#endregion
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/ui/bubble.d.ts
5
5
  declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
6
6
  declare const bubbleVariants: (props?: ({
7
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
7
+ variant?: "outline" | "ghost" | "default" | "destructive" | "secondary" | "muted" | "tinted" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
10
10
  align?: "start" | "end";
@@ -2,8 +2,8 @@ import { Button as Button$1 } from "@base-ui/react/button";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/ui/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
- variant?: "default" | "destructive" | "link" | "secondary" | "outline" | "ghost" | null | undefined;
6
- size?: "default" | "sm" | "xs" | "icon" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
5
+ variant?: "link" | "outline" | "ghost" | "default" | "destructive" | "secondary" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | "icon" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
9
9
  //#endregion
@@ -6,12 +6,12 @@ import { useRender } from "@base-ui/react/use-render";
6
6
  declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
7
7
  declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): React$1.JSX.Element;
8
8
  declare const itemVariants: (props?: ({
9
- variant?: "default" | "outline" | "muted" | null | undefined;
9
+ variant?: "outline" | "default" | "muted" | null | undefined;
10
10
  size?: "default" | "sm" | "xs" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
13
13
  declare const itemMediaVariants: (props?: ({
14
- variant?: "default" | "image" | "icon" | null | undefined;
14
+ variant?: "image" | "default" | "icon" | null | undefined;
15
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
16
16
  declare function ItemMedia({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React$1.JSX.Element;
17
17
  declare function ItemContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/ui/marker.d.ts
5
5
  declare const markerVariants: (props?: ({
6
- variant?: "default" | "separator" | "border" | null | undefined;
6
+ variant?: "separator" | "default" | "border" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Marker({ className, variant, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof markerVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
9
9
  declare function MarkerIcon({ className, ...props }: React$1.ComponentProps<"span">): React$1.JSX.Element;
@@ -41,7 +41,7 @@ declare function SidebarGroupContent({ className, ...props }: React$1.ComponentP
41
41
  declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<"ul">): React$1.JSX.Element;
42
42
  declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
43
43
  declare const sidebarMenuButtonVariants: (props?: ({
44
- variant?: "default" | "outline" | null | undefined;
44
+ variant?: "outline" | "default" | null | undefined;
45
45
  size?: "default" | "sm" | "lg" | null | undefined;
46
46
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
47
47
  declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, ...props }: useRender.ComponentProps<"button"> & React$1.ComponentProps<"button"> & {
@@ -3,7 +3,7 @@ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
3
3
  //#region src/components/ui/tabs.d.ts
4
4
  declare function Tabs({ className, orientation, ...props }: Tabs$1.Root.Props): import("react").JSX.Element;
5
5
  declare const tabsListVariants: (props?: ({
6
- variant?: "default" | "line" | null | undefined;
6
+ variant?: "line" | "default" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): import("react").JSX.Element;
9
9
  declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): import("react").JSX.Element;
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
3
3
  //#region src/components/ui/toggle.d.ts
4
4
  declare const toggleVariants: (props?: ({
5
- variant?: "default" | "outline" | null | undefined;
5
+ variant?: "outline" | "default" | null | undefined;
6
6
  size?: "default" | "sm" | "lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Toggle({ className, variant, size, ...props }: Toggle$1.Props & VariantProps<typeof toggleVariants>): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumix/ui",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Kumix React UI kit: shadcn/ui (Base UI, base-nova) + ReUI components, Tailwind tokens, and hooks. Per-file ESM exports.",
5
5
  "author": "Kumix Labs <hai@kumix.io>",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "add:reui": "shadcn add @reui/alert @reui/autocomplete @reui/badge @reui/data-grid @reui/date-selector @reui/event-calendar @reui/use-file-upload @reui/filters @reui/frame @reui/gantt @reui/icon-stack @reui/icon-tile @reui/kanban @reui/number-field @reui/phone-input @reui/rating @reui/scrollspy @reui/sortable @reui/stepper @reui/timeline @reui/tree --overwrite",
42
42
  "add:beui:ai-agents": "shadcn add @beui/prompt-input @beui/todo-list @beui/code-block @beui/approval-card @beui/file-diff @beui/tool-result @beui/streaming-response @beui/image-generation @beui/tool-approval @beui/citations @beui/agent-activity @beui/reasoning-text @beui/thinking-shimmer @beui/agent-progress @beui/ai-sidebar @beui/chat-app @beui/message-bubble @beui/message @beui/message-scroller --overwrite",
43
43
  "add:beui:components": "shadcn add @beui/marquee @beui/tabs @beui/switch @beui/input @beui/select @beui/select-morph @beui/combobox @beui/checkbox @beui/radio @beui/bottom-sheet @beui/pull-to-refresh @beui/shared-layout-bg @beui/bounce-sidebar @beui/animated-sidebar @beui/preview-rail @beui/dock @beui/tooltip @beui/context-menu @beui/popover @beui/popover-morph @beui/morphing-modal @beui/center-morph-modal @beui/chromatic-text-reveal @beui/text-reveal @beui/text-shimmer @beui/text-cascade @beui/number-ticker @beui/animated-number @beui/animated-badge @beui/action-swap-cascade @beui/action-swap-blur @beui/action-swap-roll @beui/animated-toast-stack @beui/theme-toggle @beui/bouncy-accordion @beui/drawer @beui/smooth-scroll @beui/scroll-progress @beui/parallax @beui/scroll-to @beui/scroll-reveal @beui/range-slider @beui/range-slider-fluid @beui/range-slider-wave @beui/range-slider-bubble @beui/range-slider-ruler @beui/wheel-picker @beui/table @beui/table-editable @beui/table-async @beui/shader-background @beui/cylinder-carousel @beui/loader @beui/tilt-card @beui/button-base @beui/button-stateful @beui/button-magnetic @beui/hold-action-button @beui/slide-action-button --overwrite",
44
- "add:beui:blocks": "shadcn add @beui/availability-scheduler @beui/dynamic-island @beui/command-palette @beui/expandable-action-bar @beui/overflow-actions @beui/expandable-tabs @beui/morphing-tabs @beui/swipeable-list @beui/attachment-upload @beui/file-upload @beui/otp-input @beui/signup-form @beui/bloom-menu @beui/feedback-widget @beui/not-found-glitch @beui/not-found-magnetic @beui/not-found-spotlight @beui/not-found-stacked @beui/not-found-terminal @beui/infinite-masonry @beui/notification-stack --overwrite",
44
+ "add:beui:blocks": "shadcn add @beui/availability-scheduler @beui/dynamic-island @beui/command-palette @beui/expandable-action-bar @beui/overflow-actions @beui/expandable-tabs @beui/morphing-tabs @beui/swipeable-list @beui/attachment-upload @beui/file-upload @beui/otp-input @beui/signup-form @beui/bloom-menu @beui/feedback-widget @beui/not-found-glitch @beui/not-found-magnetic @beui/not-found-spotlight @beui/not-found-stacked @beui/not-found-terminal @beui/infinite-masonry @beui/notification-stack @beui/project-folder --overwrite",
45
45
  "add:beui": "bun run add:beui:ai-agents && bun run add:beui:components && bun run add:beui:blocks"
46
46
  },
47
47
  "homepage": "https://github.com/kumixlabs/ui",
@@ -99,7 +99,7 @@
99
99
  "react": "^19.2.8",
100
100
  "react-day-picker": "^10.0.1",
101
101
  "react-phone-number-input": "^3.4.17",
102
- "react-resizable-panels": "^4.12.2",
102
+ "react-resizable-panels": "^4.12.3",
103
103
  "recharts": "3.10.1",
104
104
  "shiki": "^4.4.3",
105
105
  "tailwind-merge": "^3.6.0",