@ansh-ui/react 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-C5JG6TMM.cjs → chunk-2U7BHYIQ.cjs} +143 -143
- package/dist/chunk-2U7BHYIQ.cjs.map +1 -0
- package/dist/{chunk-HO2YSF5O.js → chunk-742E5FQS.js} +3 -3
- package/dist/chunk-742E5FQS.js.map +1 -0
- package/dist/{chunk-QO3E7TJS.js → chunk-7QGB2X7R.js} +36 -28
- package/dist/chunk-7QGB2X7R.js.map +1 -0
- package/dist/{chunk-EGG4CP7C.js → chunk-BQJ6H3HC.js} +3 -2
- package/dist/chunk-BQJ6H3HC.js.map +1 -0
- package/dist/{chunk-OLTS6G5M.js → chunk-GNA33V2J.js} +11 -6
- package/dist/chunk-GNA33V2J.js.map +1 -0
- package/dist/{chunk-C32LKF23.cjs → chunk-KTLTYHAT.cjs} +3 -3
- package/dist/chunk-KTLTYHAT.cjs.map +1 -0
- package/dist/{chunk-AVPEA5PB.cjs → chunk-MPX7QT4R.cjs} +4 -4
- package/dist/chunk-MPX7QT4R.cjs.map +1 -0
- package/dist/{chunk-T4AK2KLM.js → chunk-NJUVVMJV.js} +3 -3
- package/dist/chunk-NJUVVMJV.js.map +1 -0
- package/dist/{chunk-IBXLC5IE.js → chunk-P5MRISBP.js} +19 -3
- package/dist/chunk-P5MRISBP.js.map +1 -0
- package/dist/{chunk-WGYNCSTP.cjs → chunk-PUW6BTPQ.cjs} +3 -2
- package/dist/chunk-PUW6BTPQ.cjs.map +1 -0
- package/dist/{chunk-LDCZQP3R.js → chunk-RGGNLAAA.js} +122 -122
- package/dist/chunk-RGGNLAAA.js.map +1 -0
- package/dist/{chunk-6VRF7X5C.cjs → chunk-TEPQGFR4.cjs} +19 -2
- package/dist/chunk-TEPQGFR4.cjs.map +1 -0
- package/dist/{chunk-OJN5JBNP.cjs → chunk-VJI6V27F.cjs} +99 -99
- package/dist/chunk-VJI6V27F.cjs.map +1 -0
- package/dist/{chunk-HPGCILO4.js → chunk-XRKZPLUT.js} +99 -99
- package/dist/chunk-XRKZPLUT.js.map +1 -0
- package/dist/{chunk-DATBU46V.cjs → chunk-XYT6OXKP.cjs} +10 -4
- package/dist/chunk-XYT6OXKP.cjs.map +1 -0
- package/dist/{chunk-RHTLNSVW.cjs → chunk-YVJB7AAZ.cjs} +39 -31
- package/dist/chunk-YVJB7AAZ.cjs.map +1 -0
- package/dist/data.cjs +16 -16
- package/dist/data.d.cts +25 -23
- package/dist/data.d.ts +25 -23
- package/dist/data.js +1 -1
- package/dist/form.cjs +37 -37
- package/dist/form.d.cts +4 -1
- package/dist/form.d.ts +4 -1
- package/dist/form.js +2 -2
- package/dist/index.cjs +666 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +220 -7
- package/dist/index.d.ts +220 -7
- package/dist/index.js +530 -14
- package/dist/index.js.map +1 -1
- package/dist/layout.cjs +13 -13
- package/dist/layout.d.cts +11 -2
- package/dist/layout.d.ts +11 -2
- package/dist/layout.js +1 -1
- package/dist/{motion-CQmCq6_k.d.ts → motion-C6WfBFES.d.cts} +23 -19
- package/dist/{motion-CSX4g2N8.d.cts → motion-ugXmf505.d.ts} +23 -19
- package/dist/motion.cjs +19 -19
- package/dist/motion.d.cts +2 -2
- package/dist/motion.d.ts +2 -2
- package/dist/motion.js +2 -2
- package/dist/navigation.cjs +8 -8
- package/dist/navigation.d.cts +3 -2
- package/dist/navigation.d.ts +3 -2
- package/dist/navigation.js +1 -1
- package/dist/overlay.cjs +16 -16
- package/dist/overlay.d.cts +17 -14
- package/dist/overlay.d.ts +17 -14
- package/dist/overlay.js +2 -2
- package/dist/{position-DVScKcaa.d.cts → position-CW6cGpSF.d.cts} +2 -1
- package/dist/{position-DVScKcaa.d.ts → position-CW6cGpSF.d.ts} +2 -1
- package/dist/primitives.cjs +25 -21
- package/dist/primitives.d.cts +5 -4
- package/dist/primitives.d.ts +5 -4
- package/dist/primitives.js +2 -2
- package/dist/{sidebar-D-PafAXw.d.cts → sidebar-Dyt67t2z.d.cts} +2 -1
- package/dist/{sidebar-D-PafAXw.d.ts → sidebar-Dyt67t2z.d.ts} +2 -1
- package/dist/styles.css +464 -0
- package/dist/{use-observers-B9qtimrk.d.cts → use-observers-DvA7hSz4.d.cts} +10 -1
- package/dist/{use-observers-B9qtimrk.d.ts → use-observers-DvA7hSz4.d.ts} +10 -1
- package/package.json +3 -3
- package/dist/chunk-6VRF7X5C.cjs.map +0 -1
- package/dist/chunk-AVPEA5PB.cjs.map +0 -1
- package/dist/chunk-C32LKF23.cjs.map +0 -1
- package/dist/chunk-C5JG6TMM.cjs.map +0 -1
- package/dist/chunk-DATBU46V.cjs.map +0 -1
- package/dist/chunk-EGG4CP7C.js.map +0 -1
- package/dist/chunk-HO2YSF5O.js.map +0 -1
- package/dist/chunk-HPGCILO4.js.map +0 -1
- package/dist/chunk-IBXLC5IE.js.map +0 -1
- package/dist/chunk-LDCZQP3R.js.map +0 -1
- package/dist/chunk-OJN5JBNP.cjs.map +0 -1
- package/dist/chunk-OLTS6G5M.js.map +0 -1
- package/dist/chunk-QO3E7TJS.js.map +0 -1
- package/dist/chunk-RHTLNSVW.cjs.map +0 -1
- package/dist/chunk-T4AK2KLM.js.map +0 -1
- package/dist/chunk-WGYNCSTP.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/factory/create-behaviour-component.tsx","../src/components/interaction.tsx","../src/components/text.tsx","../src/components/providers.tsx","../src/components/motion.tsx"],"names":["Component","useRef","useMergedRef","useEffect","mountBehaviour","jsx","forwardRef","magnetic","tilt","ripple","marquee","scrollReveal","parallax","useLayoutEffect","useMemo","resolvePalette","createGradient","prefersReducedMotion","jsxs","resolveEasing","stagger","getTicker","observeIntersection","createContext","setReducedMotionMode","attachLifecycle","useContext","useState","applyTheme","resolveTheme","useCallback","springs","animate","Children","isValidElement","currentKeys","Fragment","cloneElement","cx"],"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,OAAO,CAAA;AAAA,YAC/B;AAAA,UACF,CAAA;AAAA,UACA,EAAE,KAAA,EAAO,OAAA,EAAS,IAAA,EAAM,WAAA;AAAY,SACtC;AACA,QAAA;AAAA,MACF;AAEA,MAAA,SAAA,GAAY,UAAU,OAAO,CAAA;AAAA,IAC/B,CAAA;AAEA,IAAA,MAAA,CAAO,gBAAA,CAAiB,eAAe,MAAM,CAAA;AAC7C,IAAA,MAAA,CAAO,gBAAA,CAAiB,aAAa,IAAI,CAAA;AACzC,IAAA,MAAA,CAAO,gBAAA,CAAiB,iBAAiB,IAAI,CAAA;AAAA,EAC/C,CAAA;AAEA,EAAA,uBACEhB,cAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,OAAA;AAAA,MACL,SAAA,EAAWiC,oBAAA,CAAG,gBAAA,EAAkB,QAAA,IAAY,0BAA0B,SAAS,CAAA;AAAA,MAC/E,KAAA,EAAO,EAAE,WAAA,EAAa,IAAA,KAAS,GAAA,GAAM,OAAA,GAAU,IAAA,KAAS,GAAA,GAAM,OAAA,GAAU,MAAA,EAAQ,GAAG,KAAA,EAAM;AAAA,MACzF,aAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"chunk-AVPEA5PB.cjs","sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ElementType,\n type ForwardRefExoticComponent,\n type ForwardedRef,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from 'react'\nimport {\n type BaseBehaviourOptions,\n type BehaviourDefinition,\n type BehaviourHandle,\n mountBehaviour,\n} from '@ansh-ui/core'\nimport { useMergedRef } from '../hooks/use-observers'\n\n/**\n * Turn a {@link BehaviourDefinition} into a React component.\n *\n * The DOM counterpart of {@link import('./create-effect-component').createEffectComponent}. The\n * difference in the API is deliberate and small: a behaviour component renders its children\n * *directly* rather than wrapping them in a positioned layer, because a behaviour manipulates the\n * host element itself and inserting a wrapper would break the author's layout.\n *\n * ```tsx\n * export const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n * ```\n */\n\nexport interface BehaviourComponentBaseProps {\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n children?: ReactNode\n}\n\nexport type BehaviourComponentProps<Options extends BaseBehaviourOptions> = Options &\n BehaviourComponentBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof Options | 'style' | 'className' | 'children'> &\n /**\n * Attributes that only make sense on the elements `as` is actually used with.\n *\n * `as=\"a\"` without this is a type error on `href`, which makes the prop useless for the case it\n * exists for — turning a magnetic button into a link. Full polymorphic typing (`as` as a generic\n * that rewrites the whole prop set) is the textbook answer and it collapses inference for every\n * behaviour option in the intersection, producing error messages nobody can read. Naming the two\n * element types `as` is realistically pointed at is the trade that keeps both working.\n */\n Partial<Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'download'>> &\n Partial<Pick<ComponentPropsWithoutRef<'button'>, 'type' | 'disabled' | 'form' | 'name' | 'value'>>\n\n/** The type of a component produced by {@link createBehaviourComponent}. */\nexport type BehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n> = ForwardRefExoticComponent<BehaviourComponentProps<Options> & RefAttributes<El>>\n\n/** See the note on the equivalent type in `create-effect-component.tsx`. */\ntype LooseProps = Record<string, unknown> & {\n as?: ElementType\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nexport function createBehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n>(\n definition: BehaviourDefinition<Options, El>,\n displayName?: string,\n defaultElement: ElementType = 'div',\n): BehaviourComponent<Options, El> {\n const optionKeys = new Set(Object.keys(definition.defaults))\n\n function Render(props: LooseProps, forwardedRef: ForwardedRef<El>) {\n const { as: Component = defaultElement, className, style, children, ...rest } = props\n\n const hostRef = useRef<El | null>(null)\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const mergedRef = useMergedRef<El>(hostRef, forwardedRef)\n\n const options: Record<string, unknown> = {}\n const domProps: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(rest)) {\n if (optionKeys.has(key)) options[key] = value\n else domProps[key] = value\n }\n\n const optionsKey = stableKey(options)\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n useEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n const handle = mountBehaviour(definition, host, optionsRef.current as Partial<Options>)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n // Mount-only. Behaviours that restructure the DOM (marquee, split-text) must not be torn\n // down and rebuilt on an unrelated prop change — that would lose scroll position and\n // restart animations.\n }, [])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current as Partial<Options>)\n }, [optionsKey])\n\n return (\n <Component ref={mergedRef} className={className} style={style} {...domProps}>\n {children}\n </Component>\n )\n }\n\n const Component = forwardRef(Render)\n Component.displayName = displayName ?? `Ansh(${definition.name})`\n\n return Component as unknown as BehaviourComponent<Options, El>\n}\n\n/** See the note on the identical helper in `create-effect-component.tsx`. */\nfunction stableKey(options: Record<string, unknown>): string {\n const keys = Object.keys(options).sort()\n const parts: string[] = []\n for (const key of keys) {\n const value = options[key]\n if (typeof value === 'function') parts.push(`${key}:fn`)\n else if (value === undefined) continue\n else parts.push(`${key}:${JSON.stringify(value)}`)\n }\n return parts.join('|')\n}\n\n/**\n * Attach a behaviour to an element you already have a ref to.\n *\n * The hook form, for when a component's own element must carry the behaviour rather than being\n * wrapped — which is most of the time when integrating with an existing design system.\n *\n * ```tsx\n * const ref = useRef<HTMLButtonElement>(null)\n * useBehaviour(ref, magnetic, { strength: 16 })\n * ```\n */\nexport function useBehaviour<Options extends BaseBehaviourOptions, El extends HTMLElement>(\n ref: React.RefObject<El | null>,\n definition: BehaviourDefinition<Options, El>,\n options?: Partial<Options>,\n): void {\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const optionsRef = useRef(options ?? {})\n optionsRef.current = options ?? {}\n\n const optionsKey = stableKey(optionsRef.current as Record<string, unknown>)\n\n useEffect(() => {\n const element = ref.current\n if (!element) return\n\n const handle = mountBehaviour(definition, element, optionsRef.current)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n }, [definition, ref])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current)\n }, [optionsKey])\n}\n","import { magnetic, marquee, parallax, ripple, scrollReveal, tilt } from '@ansh-ui/core'\nimport { createBehaviourComponent } from '../factory/create-behaviour-component'\n\n/**\n * DOM behaviour components.\n *\n * Unlike the canvas backgrounds these render their children directly — no wrapper, no positioned\n * layer — because a behaviour manipulates the host element and inserting a wrapper would break the\n * author's layout.\n */\n\n/**\n * An element that leans toward the pointer, spring-driven.\n *\n * Renders a `<button>` by default so it is keyboard-focusable and announced correctly. Pass\n * `as=\"a\"` or `as=\"div\"` when it isn't a button — but if it *acts* like a button, leave it.\n *\n * ```tsx\n * <MagneticButton strength={16} scale={1.04} onClick={submit}>\n * Get started\n * </MagneticButton>\n * ```\n */\nexport const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n\n/**\n * A card that rotates in 3D toward the pointer, with a moving specular highlight.\n *\n * The `perspective()` is baked into the transform as its first function, so no parent wrapper is\n * needed — which is the usual reason tilt implementations come out looking sheared rather than 3D.\n */\nexport const TiltCard = createBehaviourComponent(tilt, 'TiltCard', 'div')\n\n/**\n * A wave that expands from the point of contact.\n *\n * Also fires on Enter and Space, so keyboard activation gets the same feedback as a click. The\n * ripple layer inherits the host's `border-radius`, so a pill button clips its ripple to a pill\n * with no extra configuration.\n */\nexport const Ripple = createBehaviourComponent(ripple, 'Ripple', 'div')\n\n/**\n * Seamless infinite scrolling content.\n *\n * Speed is in **pixels per second**, not a duration, so adding an item to a logo strip doesn't\n * change how fast it scrolls. Content is duplicated as many times as needed to cover the\n * container, and clones are `aria-hidden` so a screen reader reads the list once.\n *\n * ```tsx\n * <Marquee speed={40} fadeEdges={64} pauseOnHover>\n * {logos.map((logo) => <img key={logo.id} src={logo.src} alt={logo.name} />)}\n * </Marquee>\n * ```\n */\nexport const Marquee = createBehaviourComponent(marquee, 'Marquee', 'div')\n\n/**\n * Reveal content as it enters the viewport.\n *\n * The hidden starting state is applied **in JavaScript**, not CSS. If the script never runs, the\n * content is simply visible — degraded but readable. A CSS-hidden initial state means content that\n * is permanently invisible when JavaScript fails, which has shipped to production on a lot of\n * marketing sites.\n *\n * Pass `children=\".selector\"` to stagger descendants instead of revealing the host as one block.\n */\nexport const ScrollReveal = createBehaviourComponent(scrollReveal, 'ScrollReveal', 'div')\n\n/**\n * Move an element at a different rate from the scroll.\n *\n * All measurement happens in the ticker's `read` phase, so fifty parallax elements cost one layout\n * read per frame between them rather than one per scroll event each. Disabled outright under\n * `prefers-reduced-motion` — parallax is the canonical vestibular trigger, and a slow parallax is\n * still parallax.\n */\nexport const Parallax = createBehaviourComponent(parallax, 'Parallax', 'div')\n","import { type ElementType, useEffect, useLayoutEffect, useMemo, useRef } from 'react'\nimport {\n type EasingInput,\n type StaggerFrom,\n createGradient,\n getTicker,\n observeIntersection,\n prefersReducedMotion,\n resolveEasing,\n resolvePalette,\n stagger,\n} from '@ansh-ui/core'\n\n/**\n * Text components.\n *\n * These are written by hand rather than generated from a behaviour, because text animation has one\n * requirement no generic factory can satisfy: **the accessible text must never be the animated\n * text.** Splitting a heading into per-character spans and animating them is fine visually and an\n * accessibility failure if the split structure is what a screen reader reads.\n *\n * The pattern used throughout: the real string lives in a visually-hidden element that remains the\n * accessible name, and the entire animated structure is `aria-hidden`. Assistive technology reads\n * \"Motion, refined.\"; the eye sees fifteen characters arriving in sequence.\n */\n\n/**\n * `useLayoutEffect` on the client, `useEffect` on the server.\n *\n * The distinction matters here specifically. `AnimatedText` renders its units *visible* so the\n * server HTML and the first client render agree — anything else is a hydration mismatch. The hidden\n * starting state is then applied by an effect. With `useEffect` that happens **after** the browser\n * paints, so there is a visible one-frame flash of the final text before it hides and animates in.\n * `useLayoutEffect` runs before paint, so the flash cannot occur.\n *\n * The plain `useEffect` fallback on the server exists only to silence React's warning; layout\n * effects never run during SSR anyway.\n */\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nconst VISUALLY_HIDDEN: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n borderWidth: 0,\n}\n\n// ---------------------------------------------------------------------------\n// GradientText\n// ---------------------------------------------------------------------------\n\nexport interface GradientTextProps {\n children: string\n /** Any number of colours, or a built-in palette name. */\n colors?: readonly string[] | Parameters<typeof resolvePalette>[0]\n /** Gradient angle in degrees. Default `100`. */\n angle?: number\n /** Seconds for one full cycle. `0` holds a static gradient. Default `0` (static). */\n duration?: number\n /** Interpolated stops handed to CSS. More is smoother. Default `16`. */\n stops?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n}\n\n/**\n * Text filled with a perceptual gradient.\n *\n * Uses `background-clip: text`, and the stops are generated through the OKLab interpolator rather\n * than handed to CSS as two endpoints. That is the whole point: a CSS\n * `linear-gradient(#0275f4, #9f0550)` passes through a desaturated grey-brown at its midpoint,\n * which on text — where the gradient crosses a narrow band — is exactly where the eye lands.\n *\n * Animation is a CSS `background-position` shift rather than a JS loop, because for a single\n * property with no interaction the browser's own compositor is strictly better than anything we\n * could do on the main thread.\n */\nexport function GradientText({\n children,\n colors,\n angle = 100,\n duration = 0,\n stops = 16,\n as: Component = 'span',\n className,\n style,\n}: GradientTextProps) {\n const gradientCss = useMemo(() => {\n const palette = resolvePalette(colors as never)\n // Duplicated so an animated background-position shift wraps seamlessly instead of jumping.\n const looped = duration > 0 ? [...palette, ...palette] : palette\n return createGradient(looped, { space: 'oklab' }).toCss(`${angle}deg`, stops)\n }, [colors, angle, duration, stops])\n\n const animated = duration > 0 && !prefersReducedMotion()\n\n return (\n <Component\n className={className}\n style={{\n backgroundImage: gradientCss,\n backgroundSize: animated ? '200% 100%' : '100% 100%',\n backgroundClip: 'text',\n WebkitBackgroundClip: 'text',\n color: 'transparent',\n // A fallback for the rare engine without background-clip support: the first colour still\n // renders as solid text rather than the content vanishing entirely.\n WebkitTextFillColor: 'transparent',\n display: 'inline-block',\n ...(animated\n ? {\n animation: `ansh-gradient-shift ${duration}s linear infinite`,\n }\n : {}),\n ...style,\n }}\n >\n {children}\n {animated ? <GradientKeyframes /> : null}\n </Component>\n )\n}\n\n/**\n * The keyframes for {@link GradientText}.\n *\n * Injected as a `<style>` element rather than requiring a stylesheet import, so\n * `<GradientText duration={6} />` works with no setup. The rule is idempotent — several instances\n * emit identical CSS and the browser deduplicates it.\n */\nfunction GradientKeyframes() {\n return (\n <style\n dangerouslySetInnerHTML={{\n __html:\n '@keyframes ansh-gradient-shift{from{background-position:0% 50%}to{background-position:200% 50%}}',\n }}\n />\n )\n}\n\n// ---------------------------------------------------------------------------\n// AnimatedText\n// ---------------------------------------------------------------------------\n\nexport interface AnimatedTextProps {\n children: string\n /** Split granularity. Default `'chars'`. */\n by?: 'chars' | 'words'\n /** Seconds per unit's animation. Default `0.6`. */\n duration?: number\n /** Seconds between units. Default `0.03`. */\n each?: number\n /** Where the reveal wave begins. Default `'first'`. */\n from?: StaggerFrom\n easing?: EasingInput\n /** Distance each unit travels into place, in pixels. Default `18`. */\n distance?: number\n /** Starting blur in pixels — the \"focus in\" look. Default `0`. */\n blur?: number\n /** Starting rotation in degrees. Default `0`. */\n rotate?: number\n /** Clip each unit so it rises from behind a mask. Default `false`. */\n mask?: boolean\n /** Wait until scrolled into view. Default `true`. */\n whenInView?: boolean\n /** Replay every time it re-enters the viewport. Default `false`. */\n repeat?: boolean\n /** Seconds to wait before starting. Default `0`. */\n delay?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n onComplete?: () => void\n}\n\ninterface Unit {\n text: string\n /** `true` for whitespace, which is rendered as a plain gap rather than an animated unit. */\n space: boolean\n}\n\n/**\n * Text that reveals unit by unit.\n *\n * The split happens in React (so the markup is server-rendered and present in the HTML source for\n * SEO and for no-JS readers) while the animation runs on the shared ticker (so a page full of these\n * shares one clock and cannot drift).\n *\n * Under `prefers-reduced-motion` the text renders in its final state immediately — no hidden\n * frame, no fade.\n */\nexport function AnimatedText({\n children,\n by = 'chars',\n duration = 0.6,\n each = 0.03,\n from = 'first',\n easing = 'cinematic',\n distance = 18,\n blur = 0,\n rotate = 0,\n mask = false,\n whenInView = true,\n repeat = false,\n delay = 0,\n as: Component = 'span',\n className,\n style,\n onComplete,\n}: AnimatedTextProps) {\n const hostRef = useRef<HTMLElement | null>(null)\n const unitRefs = useRef<(HTMLSpanElement | null)[]>([])\n const onCompleteRef = useRef(onComplete)\n onCompleteRef.current = onComplete\n\n /**\n * Split into units.\n *\n * Grapheme-aware via `Intl.Segmenter`: `[...string]` splits by code point, which breaks emoji\n * with modifiers and combining accents into multiple \"characters\".\n */\n const units = useMemo<Unit[]>(() => {\n if (by === 'words') {\n return children\n .split(/(\\s+)/)\n .filter((token) => token.length > 0)\n .map((token) => ({ text: token, space: /^\\s+$/.test(token) }))\n }\n\n const graphemes =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? Array.from(\n new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(children),\n (s) => s.segment,\n )\n : Array.from(children)\n\n return graphemes.map((character) => ({ text: character, space: /^\\s$/.test(character) }))\n }, [children, by])\n\n const animatedCount = useMemo(() => units.filter((u) => !u.space).length, [units])\n\n useIsomorphicLayoutEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n // Reduced motion: leave everything at its final state. The units are rendered without inline\n // styles below when this is true, so there is nothing to undo.\n if (prefersReducedMotion()) {\n onCompleteRef.current?.()\n return\n }\n\n const ease = resolveEasing(easing)\n const delayFor = stagger(animatedCount, { each, from })\n const ticker = getTicker()\n\n // Map each rendered unit to its animation index, skipping whitespace so the stagger counts\n // visible characters rather than including gaps.\n const targets: { node: HTMLSpanElement; delay: number }[] = []\n let animationIndex = 0\n units.forEach((unit, i) => {\n if (unit.space) return\n const node = unitRefs.current[i]\n if (node) targets.push({ node, delay: delay + delayFor(animationIndex) })\n animationIndex++\n })\n\n const apply = (node: HTMLSpanElement, progress: number): void => {\n const eased = ease(progress)\n const inverse = 1 - eased\n node.style.opacity = String(eased)\n const parts = [`translate3d(0, ${(distance * inverse).toFixed(2)}px, 0)`]\n if (rotate !== 0) parts.push(`rotate(${(rotate * inverse).toFixed(2)}deg)`)\n node.style.transform = parts.join(' ')\n if (blur > 0) {\n const amount = blur * inverse\n node.style.filter = amount > 0.05 ? `blur(${amount.toFixed(2)}px)` : ''\n }\n }\n\n const reset = (): void => {\n for (const { node } of targets) apply(node, 0)\n }\n\n const settle = (node: HTMLSpanElement): void => {\n node.style.opacity = ''\n node.style.transform = ''\n node.style.filter = ''\n // Drop the compositor promotion once at rest.\n node.style.willChange = ''\n }\n\n let elapsed = 0\n let running = false\n let stopTicker: (() => void) | null = null\n\n const start = (): void => {\n if (running) return\n running = true\n elapsed = 0\n for (const { node } of targets) node.style.willChange = 'opacity, transform'\n reset()\n\n stopTicker = ticker.add(\n ({ delta }) => {\n elapsed += delta\n let allDone = true\n\n for (const target of targets) {\n const local = elapsed - target.delay\n if (local < 0) {\n allDone = false\n continue\n }\n const progress = duration <= 0 ? 1 : local / duration\n if (progress >= 1) {\n settle(target.node)\n continue\n }\n apply(target.node, progress)\n allDone = false\n }\n\n if (allDone) {\n stopTicker?.()\n stopTicker = null\n running = false\n onCompleteRef.current?.()\n }\n },\n { phase: 'write', name: 'AnimatedText' },\n )\n }\n\n if (!whenInView) {\n // Hide immediately so there is no flash of final state before the first frame.\n reset()\n start()\n return () => {\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }\n\n reset()\n\n const stopObserver = observeIntersection(\n host,\n (entry) => {\n if (entry.isIntersecting) {\n start()\n } else if (repeat) {\n stopTicker?.()\n stopTicker = null\n running = false\n reset()\n }\n },\n { threshold: 0.2, rootMargin: '0px 0px -8% 0px' },\n )\n\n return () => {\n stopObserver()\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }, [\n units,\n animatedCount,\n duration,\n each,\n from,\n easing,\n distance,\n blur,\n rotate,\n whenInView,\n repeat,\n delay,\n ])\n\n return (\n <Component ref={hostRef} className={className} style={{ display: 'inline-block', ...style }}>\n {/* The accessible representation: the real string, unfragmented. */}\n <span style={VISUALLY_HIDDEN}>{children}</span>\n\n <span aria-hidden=\"true\">\n {units.map((unit, i) =>\n unit.space ? (\n // Whitespace as a plain text node so it collapses and wraps like real text.\n <span key={i}>{unit.text}</span>\n ) : mask ? (\n <span\n key={i}\n style={{ display: 'inline-block', overflow: 'hidden', verticalAlign: 'top' }}\n >\n <span\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n </span>\n ) : (\n <span\n key={i}\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n ),\n )}\n </span>\n </Component>\n )\n}\n","import { type ReactNode, createContext, useContext, useEffect, useMemo, useState } from 'react'\nimport {\n type ReducedMotionMode,\n attachLifecycle,\n getTicker,\n setReducedMotionMode,\n} from '@ansh-ui/core'\nimport { applyTheme, resolveTheme } from '@ansh-ui/tokens'\n\n// ---------------------------------------------------------------------------\n// MotionConfig\n// ---------------------------------------------------------------------------\n\nexport interface MotionConfigValue {\n reducedMotion: ReducedMotionMode\n /** Global playback rate. `0.5` is slow motion across every animation on the page. */\n timeScale: number\n /** Pin adaptive quality, or `null` to let the frame budget decide. */\n quality: number | null\n}\n\nconst MotionConfigContext = createContext<MotionConfigValue>({\n reducedMotion: 'auto',\n timeScale: 1,\n quality: null,\n})\n\nexport interface MotionConfigProps extends Partial<MotionConfigValue> {\n /**\n * Pause every animation while the document is hidden. Default `true`.\n *\n * Leave this on. Animating a background tab burns battery and spins fans for output nobody can\n * see, and it is the most common performance complaint about animation-heavy sites.\n */\n pauseWhenHidden?: boolean\n /** Also pause when the window loses focus. Default `false` — a visible unfocused window still\n * expects to animate. */\n pauseWhenBlurred?: boolean\n /** Reduce quality on low battery where the platform exposes it. Default `true`. */\n respectBattery?: boolean\n children?: ReactNode\n}\n\n/**\n * Application-level motion configuration.\n *\n * Optional — every component works without it. Mount it once at the root when you need\n * app-wide control:\n *\n * ```tsx\n * <MotionConfig reducedMotion={userPrefersCalm ? 'always' : 'auto'}>\n * <App />\n * </MotionConfig>\n * ```\n *\n * `reducedMotion=\"always\"` is genuinely useful in production, as the backing for an in-app\n * \"reduce motion\" setting — many users who want calmer interfaces have never found the OS toggle.\n */\nexport function MotionConfig({\n reducedMotion = 'auto',\n timeScale = 1,\n quality = null,\n pauseWhenHidden = true,\n pauseWhenBlurred = false,\n respectBattery = true,\n children,\n}: MotionConfigProps) {\n useEffect(() => {\n setReducedMotionMode(reducedMotion)\n }, [reducedMotion])\n\n useEffect(() => {\n getTicker().timeScale = timeScale\n }, [timeScale])\n\n useEffect(() => {\n if (quality !== null) getTicker().lockQuality(quality)\n }, [quality])\n\n useEffect(\n () =>\n attachLifecycle(getTicker(), {\n pauseWhenHidden,\n pauseWhenBlurred,\n respectBattery,\n }),\n [pauseWhenHidden, pauseWhenBlurred, respectBattery],\n )\n\n const value = useMemo(\n () => ({ reducedMotion, timeScale, quality }),\n [reducedMotion, timeScale, quality],\n )\n\n return <MotionConfigContext.Provider value={value}>{children}</MotionConfigContext.Provider>\n}\n\n/** Read the nearest {@link MotionConfig}. Returns sensible defaults with no provider present. */\nexport function useMotionConfig(): MotionConfigValue {\n return useContext(MotionConfigContext)\n}\n\n// ---------------------------------------------------------------------------\n// ThemeProvider\n// ---------------------------------------------------------------------------\n\nexport type ThemeSetting = 'light' | 'dark' | 'system'\n\nexport interface ThemeContextValue {\n /** What was requested, including `'system'`. */\n theme: ThemeSetting\n /** What is actually rendering. `'system'` is resolved to one or the other. */\n resolved: 'light' | 'dark'\n setTheme: (theme: ThemeSetting) => void\n}\n\nconst ThemeContext = createContext<ThemeContextValue>({\n theme: 'system',\n resolved: 'light',\n setTheme: () => {},\n})\n\nexport interface ThemeProviderProps {\n /** Initial setting. Default `'system'`. */\n defaultTheme?: ThemeSetting\n /** Persist the choice under this `localStorage` key. Pass `null` to disable. Default `'ansh-theme'`. */\n storageKey?: string | null\n children?: ReactNode\n}\n\n/**\n * Theme control over the `@ansh-ui/tokens` stylesheet.\n *\n * Sets `data-theme` on `<html>`, which the token stylesheet already understands. Two details that\n * are easy to get wrong and are handled here:\n *\n * **`'system'` removes the attribute rather than writing a resolved value.** The token stylesheet\n * guards its `prefers-color-scheme` rule with `:root:not([data-theme])`, so removing the attribute\n * hands control back to the OS — and, importantly, means the theme keeps following the OS if the\n * user changes it while the page is open.\n *\n * **The initial render always reports `'light'`.** Reading `localStorage` during render would be a\n * hydration mismatch, since the server has no access to it. The stored value is applied in an\n * effect. To avoid a flash of the wrong theme, ship the small inline script from\n * {@link themeScript} in your document `<head>` — that is the only way to set the attribute before\n * first paint, and it is what every correct implementation does.\n */\nexport function ThemeProvider({\n defaultTheme = 'system',\n storageKey = 'ansh-theme',\n children,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<ThemeSetting>(defaultTheme)\n const [resolved, setResolved] = useState<'light' | 'dark'>('light')\n\n // Read the stored preference after mount, never during render.\n useEffect(() => {\n if (!storageKey) return\n try {\n const stored = localStorage.getItem(storageKey)\n if (stored === 'light' || stored === 'dark' || stored === 'system') {\n setThemeState(stored)\n }\n } catch {\n // Storage can throw in private browsing or with cookies disabled. A theme preference is\n // not worth breaking the page over.\n }\n }, [storageKey])\n\n useEffect(() => {\n applyTheme(theme)\n setResolved(resolveTheme())\n\n if (storageKey) {\n try {\n localStorage.setItem(storageKey, theme)\n } catch {\n // As above.\n }\n }\n }, [theme, storageKey])\n\n // Follow the OS while set to `'system'`.\n useEffect(() => {\n if (theme !== 'system' || typeof matchMedia !== 'function') return\n const query = matchMedia('(prefers-color-scheme: dark)')\n const onChange = () => setResolved(query.matches ? 'dark' : 'light')\n query.addEventListener('change', onChange)\n return () => query.removeEventListener('change', onChange)\n }, [theme])\n\n const value = useMemo(() => ({ theme, resolved, setTheme: setThemeState }), [theme, resolved])\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\nexport function useTheme(): ThemeContextValue {\n return useContext(ThemeContext)\n}\n\n/**\n * The blocking script that prevents a theme flash.\n *\n * Inject this in `<head>`, before any stylesheet. It reads the stored preference and sets\n * `data-theme` synchronously, before the browser paints — which is the only point at which it can\n * be done without a visible flash. It is deliberately tiny and dependency-free.\n *\n * ```tsx\n * // Next.js app/layout.tsx\n * <head>\n * <script dangerouslySetInnerHTML={{ __html: themeScript() }} />\n * </head>\n * ```\n */\nexport function themeScript(storageKey = 'ansh-theme'): string {\n return (\n `(function(){try{var t=localStorage.getItem(${JSON.stringify(storageKey)});` +\n `if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}` +\n `catch(e){}})()`\n )\n}\n","import {\n type CSSProperties,\n type ElementType,\n type ReactElement,\n type ReactNode,\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react'\nimport {\n type AnimationOptions,\n type EasingInput,\n type SpringOptions,\n animate,\n getTicker,\n prefersReducedMotion,\n springs,\n} from '@ansh-ui/core'\nimport { cx } from '../primitives/compose'\nimport { useMergedRef } from '../hooks/use-observers'\n\n/**\n * Declarative motion.\n *\n * A deliberately **small** subset of what a full motion library does: transform properties and\n * opacity, animated from `initial` to `animate`, plus hover and press states and an exit animation\n * when paired with `AnimatePresence`.\n *\n * That scope is a decision, not a gap. Layout animation (FLIP), shared-element transitions and\n * variant propagation each need machinery an order of magnitude larger than this file, and a\n * half-implementation of them is worse than none — it works in the demo and fails on the real page.\n * For those, use a dedicated library; for the 90% case of \"fade this in, slide that up, spring the\n * card on hover\", this costs a fraction of the bundle.\n *\n * Values are written straight to the element's `style` from the ticker's write phase. React never\n * re-renders during an animation.\n */\n\nexport interface MotionValues {\n opacity?: number\n x?: number\n y?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n rotate?: number\n /** Blur radius in px. */\n blur?: number\n}\n\nexport interface MotionTransition {\n /** Seconds. Ignored when `spring` is set. Default `0.4`. */\n duration?: number\n /** Seconds to wait. Default `0`. */\n delay?: number\n easing?: EasingInput\n /** Use a spring instead of a tween. `true` uses the `smooth` preset. */\n spring?: boolean | SpringOptions | keyof typeof springs\n}\n\ntype MotionElementProps = {\n as?: ElementType\n /** Starting values. Applied before the first paint. */\n initial?: MotionValues\n /** Target values. Changing these animates to the new target. */\n animate?: MotionValues\n /** Values to animate to when removed by `AnimatePresence`. */\n exit?: MotionValues\n transition?: MotionTransition\n whileHover?: MotionValues\n whileTap?: MotionValues\n /** Animate to `animate` only once scrolled into view. */\n whileInView?: boolean\n /** Fraction visible before `whileInView` triggers. Default `0.2`. */\n inViewAmount?: number\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nconst DEFAULTS: Required<Omit<MotionValues, never>> = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n blur: 0,\n}\n\n/** Compose the values into a transform string plus the properties that aren't transforms. */\nfunction applyValues(node: HTMLElement, values: Required<MotionValues>): void {\n const transform =\n `translate3d(${values.x}px, ${values.y}px, 0)` +\n ` scale(${values.scale * values.scaleX}, ${values.scale * values.scaleY})` +\n ` rotate(${values.rotate}deg)`\n\n node.style.transform = transform\n node.style.opacity = String(values.opacity)\n // Only written when non-zero: an always-present `filter` creates a containing block and a new\n // stacking context, which changes how `position: fixed` descendants resolve.\n node.style.filter = values.blur > 0 ? `blur(${values.blur}px)` : ''\n}\n\nfunction resolve(\n values: MotionValues | undefined,\n base: Required<MotionValues>,\n): Required<MotionValues> {\n return { ...base, ...values }\n}\n\n/**\n * An animated element.\n *\n * ```tsx\n * <Motion initial={{ opacity: 0, y: 24 }} animate={{ opacity: 1, y: 0 }} whileInView>\n * <Card />\n * </Motion>\n * ```\n */\nexport function Motion({\n as: Component = 'div',\n initial,\n animate: target,\n // Destructured but unused here: `AnimatePresence` reads `exit` off the element's props when the\n // child is removed and swaps it into `animate`. Pulling it out of `rest` stops it reaching the\n // DOM as an unknown attribute.\n exit: _exit,\n transition,\n whileHover,\n whileTap,\n whileInView = false,\n inViewAmount = 0.2,\n className,\n style,\n children,\n ...rest\n}: MotionElementProps & Record<string, unknown>) {\n const nodeRef = useRef<HTMLElement | null>(null)\n const currentRef = useRef<Required<MotionValues>>(resolve(initial, DEFAULTS))\n const controlsRef = useRef<ReturnType<typeof animate> | null>(null)\n const [inView, setInView] = useState(!whileInView)\n\n // Applied before paint, not in an effect. `useEffect` runs after the browser has already painted\n // the element at its natural position, so an element that should fade in flashes at full opacity\n // for one frame first.\n useLayoutEffect(() => {\n if (nodeRef.current) applyValues(nodeRef.current, currentRef.current)\n }, [])\n\n const runTo = useCallback(\n (next: Required<MotionValues>, options?: MotionTransition) => {\n const node = nodeRef.current\n if (!node) return\n\n controlsRef.current?.stop()\n\n const from = { ...currentRef.current }\n const springOption = options?.spring ?? transition?.spring\n\n const animationOptions: AnimationOptions<number> = {\n ...((options?.delay ?? transition?.delay !== undefined)\n ? { delay: options?.delay ?? transition?.delay ?? 0 }\n : null),\n ...(springOption\n ? {\n spring:\n springOption === true\n ? springs.default\n : typeof springOption === 'string'\n ? springs[springOption]\n : springOption,\n }\n : {\n duration: options?.duration ?? transition?.duration ?? 0.4,\n ...((options?.easing ?? transition?.easing)\n ? { easing: (options?.easing ?? transition?.easing)! }\n : null),\n }),\n onUpdate: (t) => {\n // One scalar drives every property, so all of them stay in lockstep. Animating each\n // independently would need one ticker subscription per property and they would drift\n // apart under a spring, which is not time-based.\n const frame = {} as Required<MotionValues>\n for (const key of Object.keys(DEFAULTS) as Array<keyof MotionValues>) {\n frame[key] = from[key] + (next[key] - from[key]) * t\n }\n currentRef.current = frame\n applyValues(node, frame)\n },\n onComplete: () => {\n currentRef.current = next\n applyValues(node, next)\n },\n }\n\n controlsRef.current = animate(0, 1, animationOptions)\n },\n [transition],\n )\n\n // Animate to the target whenever it changes (or when it scrolls into view).\n const targetKey = JSON.stringify(target ?? null)\n useEffect(() => {\n if (!inView) return\n runTo(resolve(target, DEFAULTS))\n // `targetKey` stands in for `target`, which is nearly always an inline object literal whose\n // identity changes on every render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [targetKey, inView, runTo])\n\n useEffect(() => {\n if (!whileInView) return\n const node = nodeRef.current\n if (!node || typeof IntersectionObserver === 'undefined') {\n setInView(true)\n return\n }\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting) {\n setInView(true)\n observer.disconnect()\n }\n },\n { threshold: inViewAmount },\n )\n observer.observe(node)\n return () => observer.disconnect()\n }, [whileInView, inViewAmount])\n\n useEffect(() => () => controlsRef.current?.stop(), [])\n\n const interaction: Record<string, unknown> = {}\n if (whileHover) {\n interaction.onMouseEnter = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n interaction.onMouseLeave = () => runTo(resolve(target, DEFAULTS))\n }\n if (whileTap) {\n interaction.onPointerDown = () =>\n runTo(resolve({ ...target, ...whileTap }, DEFAULTS), { duration: 0.12 })\n interaction.onPointerUp = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n }\n\n return (\n <Component\n ref={nodeRef}\n className={className}\n // `will-change` is set once, statically. Toggling it per animation causes the compositor to\n // create and destroy a layer on every interaction, which is more expensive than the hint saves.\n style={{ willChange: 'transform, opacity', ...style }}\n {...interaction}\n {...rest}\n >\n {children}\n </Component>\n )\n}\n\nexport interface AnimatePresenceProps {\n children: ReactNode\n /** Seconds to keep a removed child mounted. Default `0.35`. */\n exitDuration?: number\n}\n\n/**\n * Keep removed children mounted long enough to animate out.\n *\n * React unmounts immediately when a child disappears from the tree, so an exit animation never gets\n * a chance to run. This holds departing children in its own state, plays their `exit` values, then\n * drops them.\n *\n * Children **must** have stable `key`s — that is how removals are detected at all. Without keys,\n * React reuses element positions and this sees no removal to animate.\n */\nexport function AnimatePresence({ children, exitDuration = 0.35 }: AnimatePresenceProps) {\n const currentChildren = Children.toArray(children).filter(isValidElement) as ReactElement[]\n const [rendered, setRendered] = useState<ReactElement[]>(currentChildren)\n const timersRef = useRef(new Map<string, ReturnType<typeof setTimeout>>())\n\n const keys = currentChildren.map((child) => String(child.key))\n const keysSignature = keys.join('|')\n\n useEffect(() => {\n const currentKeys = new Set(keys)\n const departing = rendered.filter((child) => !currentKeys.has(String(child.key)))\n\n if (departing.length === 0) {\n // Straight replacement keeps updated props flowing to children that are still present.\n setRendered(currentChildren)\n return\n }\n\n // Keep the departing children in place, appended after the current set so they don't reorder\n // the survivors while they animate out.\n setRendered([...currentChildren, ...departing])\n\n const delay = prefersReducedMotion() ? 0 : exitDuration * 1000\n for (const child of departing) {\n const key = String(child.key)\n clearTimeout(timersRef.current.get(key))\n timersRef.current.set(\n key,\n setTimeout(() => {\n setRendered((previous) => previous.filter((entry) => String(entry.key) !== key))\n timersRef.current.delete(key)\n }, delay),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [keysSignature, exitDuration])\n\n useEffect(() => {\n const timers = timersRef.current\n return () => {\n for (const timer of timers.values()) clearTimeout(timer)\n timers.clear()\n }\n }, [])\n\n const currentKeys = new Set(keys)\n\n return (\n <>\n {rendered.map((child) => {\n const leaving = !currentKeys.has(String(child.key))\n if (!leaving) return child\n\n // A departing child animates to its `exit` values by having them swapped into `animate`.\n const props = child.props as MotionElementProps\n return cloneElement(child as ReactElement<MotionElementProps>, {\n animate: props.exit ?? { opacity: 0, scale: 0.96 },\n transition: { duration: exitDuration, ...props.transition },\n })\n })}\n </>\n )\n}\n\nexport interface DraggableProps {\n /** Constrain movement. */\n axis?: 'x' | 'y' | 'both'\n /** Bounds relative to the starting position, in px. */\n bounds?: { left?: number; right?: number; top?: number; bottom?: number }\n /** Spring back to the origin on release. */\n snapBack?: boolean\n /** Carry momentum after release. Default `true` when not snapping back. */\n momentum?: boolean\n onDragStart?: () => void\n onDragEnd?: (offset: { x: number; y: number }) => void\n className?: string\n style?: CSSProperties\n children: ReactNode\n}\n\n/**\n * A draggable surface with inertia.\n *\n * The momentum on release is what separates a drag that feels physical from one that stops dead.\n * Velocity is measured over the last few pointer samples rather than the last two — a single pair\n * of events is dominated by whatever jitter the final sample had, which produces a flick in the\n * wrong direction often enough to be noticeable.\n */\nexport function Draggable({\n axis = 'both',\n bounds,\n snapBack = false,\n momentum,\n onDragStart,\n onDragEnd,\n className,\n style,\n children,\n}: DraggableProps) {\n const nodeRef = useRef<HTMLDivElement | null>(null)\n const offsetRef = useRef({ x: 0, y: 0 })\n const [dragging, setDragging] = useState(false)\n\n const useMomentum = momentum ?? !snapBack\n\n const clamp = useCallback(\n (value: { x: number; y: number }) => ({\n x: Math.min(Math.max(value.x, bounds?.left ?? -Infinity), bounds?.right ?? Infinity),\n y: Math.min(Math.max(value.y, bounds?.top ?? -Infinity), bounds?.bottom ?? Infinity),\n }),\n [bounds],\n )\n\n const write = (value: { x: number; y: number }) => {\n if (nodeRef.current) {\n nodeRef.current.style.transform = `translate3d(${value.x}px, ${value.y}px, 0)`\n }\n }\n\n const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n event.currentTarget.setPointerCapture(event.pointerId)\n setDragging(true)\n onDragStart?.()\n\n const start = { x: event.clientX, y: event.clientY }\n const origin = { ...offsetRef.current }\n // A short ring of recent samples, for a velocity estimate that isn't hostage to the last event.\n const samples: Array<{ x: number; y: number; t: number }> = []\n\n const onMove = (moveEvent: PointerEvent) => {\n const next = clamp({\n x: axis === 'y' ? origin.x : origin.x + (moveEvent.clientX - start.x),\n y: axis === 'x' ? origin.y : origin.y + (moveEvent.clientY - start.y),\n })\n offsetRef.current = next\n write(next)\n\n samples.push({ x: next.x, y: next.y, t: performance.now() })\n if (samples.length > 5) samples.shift()\n }\n\n const onUp = () => {\n setDragging(false)\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onUp)\n\n if (snapBack) {\n animate(0, 1, {\n spring: springs.subtle,\n onUpdate: (t) => {\n const value = { x: offsetRef.current.x * (1 - t), y: offsetRef.current.y * (1 - t) }\n write(value)\n },\n onComplete: () => {\n offsetRef.current = { x: 0, y: 0 }\n write(offsetRef.current)\n onDragEnd?.(offsetRef.current)\n },\n })\n return\n }\n\n if (useMomentum && samples.length >= 2) {\n const first = samples[0]!\n const last = samples[samples.length - 1]!\n const elapsed = Math.max(1, last.t - first.t)\n let velocity = {\n x: ((last.x - first.x) / elapsed) * 1000,\n y: ((last.y - first.y) / elapsed) * 1000,\n }\n\n const decay = 0.95\n const stop = getTicker().add(\n ({ delta }) => {\n // Exponential decay, frame-rate independent: raising the per-second factor to the\n // power of the frame time keeps the glide identical at 60 and 120 Hz.\n const factor = Math.pow(decay, delta * 60)\n velocity = { x: velocity.x * factor, y: velocity.y * factor }\n\n const next = clamp({\n x: offsetRef.current.x + velocity.x * delta,\n y: offsetRef.current.y + velocity.y * delta,\n })\n offsetRef.current = next\n write(next)\n\n if (Math.hypot(velocity.x, velocity.y) < 8) {\n stop()\n onDragEnd?.(offsetRef.current)\n }\n },\n { phase: 'write', name: 'Draggable' },\n )\n return\n }\n\n onDragEnd?.(offsetRef.current)\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onUp)\n }\n\n return (\n <div\n ref={nodeRef}\n className={cx('ansh-draggable', dragging && 'ansh-draggable--active', className)}\n style={{ touchAction: axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none', ...style }}\n onPointerDown={onPointerDown}\n >\n {children}\n </div>\n )\n}\n\n/** Merge a forwarded ref with the internal one, re-exported for consumers wrapping `Motion`. */\nexport { useMergedRef }\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/slot.tsx","../src/primitives/focus.ts","../src/primitives/presence.tsx"],"names":["forwardRef","Slot","isValidElement","cloneElement","mergeProps","mergeRefs","Children","useEffect","useRef","useState","prefersReducedMotion"],"mappings":";;;;;;;AA+BO,IAAM,IAAA,GAAOA,iBAAmC,SAASC,KAAAA,CAC9D,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,EACzB,YAAA,EACA;AACA,EAAA,IAAI,CAACC,oBAAA,CAAe,QAAQ,CAAA,EAAG;AAG7B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,KAAA,GAAQ,QAAA;AAId,EAAA,MAAM,QAAA,GAAY,KAAA,CAAM,KAAA,CAA2C,GAAA,IAAO,KAAA,CAAM,GAAA;AAEhF,EAAA,OAAOC,mBAAa,KAAA,EAAO;AAAA,IACzB,GAAGC,4BAAA,CAAW,SAAA,EAAW,KAAA,CAAM,KAAK,CAAA;AAAA,IACpC,GAAA,EAAKC,2BAAA,CAAU,YAAA,EAAc,QAAQ;AAAA,GACX,CAAA;AAC9B,CAAC;AAQM,SAAS,OAAA,CACd,SACA,QAAA,EACmB;AACnB,EAAA,OAAO,UAAW,IAAA,GAAwC,QAAA;AAC5D;AAGO,SAAS,cAAc,QAAA,EAA6B;AACzD,EAAA,OAAOC,eAAS,OAAA,CAAQ,QAAQ,CAAA,CAAE,MAAA,CAAOJ,oBAAc,CAAA,CAAE,MAAA;AAC3D;ACtDA,IAAM,kBAAA,GAAqB;AAAA,EACzB,SAAA;AAAA,EACA,wBAAA;AAAA,EACA,4CAAA;AAAA,EACA,wBAAA;AAAA,EACA,0BAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,kDAAA;AAAA,EACA;AACF,CAAA,CAAE,KAAK,GAAG,CAAA;AAGV,SAAS,UAAU,OAAA,EAA+B;AAIhD,EAAA,IAAI,OAAA,CAAQ,YAAA,CAAa,OAAO,CAAA,EAAG,OAAO,KAAA;AAC1C,EAAA,IAAI,OAAA,CAAQ,YAAA,KAAiB,IAAA,EAAM,OAA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AA,EAAA,QAAA,CAAS,EAAE,GAAA,EAAK,KAAA,EAAO,CAAA,EAAE,CAAA;AACrC","file":"chunk-C32LKF23.cjs","sourcesContent":["import {\n Children,\n type ReactElement,\n type ReactNode,\n cloneElement,\n forwardRef,\n isValidElement,\n} from 'react'\nimport { mergeProps, mergeRefs } from './compose'\n\nexport interface SlotProps {\n children?: ReactNode\n [key: string]: unknown\n}\n\n/**\n * Render into the child element instead of rendering a wrapper.\n *\n * This is what powers `asChild`. Without it, a `<Tooltip.Trigger>` wrapping a `<Button>` emits a\n * `<span>` around the button — which breaks flex layouts, adds a node that inherits nothing, and\n * puts the trigger's ARIA attributes on the wrong element for assistive technology.\n *\n * ```tsx\n * <Tooltip.Trigger asChild>\n * <Button>Save</Button>\n * </Tooltip.Trigger>\n * ```\n *\n * The button *is* the trigger: it carries `aria-describedby` and the handlers, and no extra DOM\n * node exists.\n */\nexport const Slot = forwardRef<HTMLElement, SlotProps>(function Slot(\n { children, ...slotProps },\n forwardedRef,\n) {\n if (!isValidElement(children)) {\n // A `Slot` with no element child renders nothing rather than throwing. Throwing here would\n // turn a conditional child (`{loading ? null : <Button/>}`) into a crash.\n return null\n }\n\n const child = children as ReactElement<Record<string, unknown>> & { ref?: React.Ref<HTMLElement> }\n\n // React 19 exposes `ref` as a normal prop; React 18 keeps it on the element. Reading both keeps\n // this working across the supported peer range without a version check.\n const childRef = (child.props as { ref?: React.Ref<HTMLElement> }).ref ?? child.ref\n\n return cloneElement(child, {\n ...mergeProps(slotProps, child.props),\n ref: mergeRefs(forwardedRef, childRef),\n } as Record<string, unknown>)\n})\n\n/**\n * Pick between a host element and its child based on `asChild`.\n *\n * Every component in this library that accepts `asChild` uses this, so the behaviour is identical\n * across all of them rather than reimplemented with small differences.\n */\nexport function slotted(\n asChild: boolean | undefined,\n fallback: React.ElementType,\n): React.ElementType {\n return asChild ? (Slot as unknown as React.ElementType) : fallback\n}\n\n/** Count element children, ignoring `null`/`false` from conditional rendering. */\nexport function countElements(children: ReactNode): number {\n return Children.toArray(children).filter(isValidElement).length\n}\n","import { type RefObject, useEffect, useRef } from 'react'\n\n/**\n * Focus management for overlay surfaces.\n *\n * Three separate concerns that are usually conflated:\n *\n * 1. **Finding what can be focused.** Harder than it looks — `disabled`, `hidden`, `inert`,\n * zero-size elements and negative tabindex all disqualify a node, and CSS-hidden ancestors\n * disqualify their whole subtree.\n * 2. **Trapping.** Tab must cycle within the surface. Required by WCAG 2.4.3 for modals.\n * 3. **Restoring.** Focus must return to the trigger on close, or a keyboard user is dumped at the\n * top of the document and has to navigate all the way back.\n */\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',')\n\n/** Is this element rendered and interactive right now? */\nfunction isVisible(element: HTMLElement): boolean {\n // `offsetParent === null` catches `display: none` on the element or any ancestor, cheaply.\n // `position: fixed` elements legitimately have a null offsetParent, so they are checked against\n // their box instead.\n if (element.hasAttribute('inert')) return false\n if (element.offsetParent !== null) return true\n const rect = element.getBoundingClientRect()\n return rect.width > 0 || rect.height > 0\n}\n\n/** Every tabbable descendant, in tab order. */\nexport function getTabbable(container: HTMLElement | null): HTMLElement[] {\n if (!container) return []\n const nodes = Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))\n return nodes.filter((node) => {\n if (node.getAttribute('aria-hidden') === 'true') return false\n if (node.closest('[inert]')) return false\n return isVisible(node)\n })\n}\n\n/**\n * Trap Tab within a container while `active`.\n *\n * Implemented on `keydown` at the container rather than with sentinel elements at either end. The\n * sentinel approach adds two focusable nodes to the accessibility tree that screen readers can\n * land on and announce as blank; intercepting the key does not.\n */\nexport function useFocusTrap(ref: RefObject<HTMLElement | null>, active: boolean): void {\n useEffect(() => {\n if (!active) return\n const container = ref.current\n if (!container) return\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Tab') return\n\n const tabbable = getTabbable(container)\n if (tabbable.length === 0) {\n // Nothing to move to — keep focus on the surface rather than letting it escape.\n event.preventDefault()\n return\n }\n\n const first = tabbable[0]!\n const last = tabbable[tabbable.length - 1]!\n const activeElement = document.activeElement as HTMLElement | null\n\n // Focus may sit on the container itself (given `tabIndex={-1}` for the initial focus), in\n // which case neither branch below matches and the default Tab lands on `first` naturally.\n if (event.shiftKey && (activeElement === first || activeElement === container)) {\n event.preventDefault()\n last.focus()\n } else if (!event.shiftKey && activeElement === last) {\n event.preventDefault()\n first.focus()\n }\n }\n\n container.addEventListener('keydown', onKeyDown)\n return () => container.removeEventListener('keydown', onKeyDown)\n }, [ref, active])\n}\n\n/**\n * Restore focus to whatever was focused before `active` became true.\n *\n * The element is captured on activation, not on mount, because a component can be mounted long\n * before it opens.\n */\nexport function useFocusRestore(active: boolean): void {\n const previousRef = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n if (!active) return\n previousRef.current = document.activeElement as HTMLElement | null\n\n return () => {\n const previous = previousRef.current\n // Guard against restoring to a node that has since been removed from the document —\n // focusing a detached element silently moves focus to `<body>`, losing the user's place.\n if (previous && previous.isConnected) previous.focus?.({ preventScroll: true })\n }\n }, [active])\n}\n\n/**\n * Move focus into a surface when it opens.\n *\n * Prefers an explicitly marked element, then the first tabbable one, then the container itself.\n * The container fallback matters for a dialog whose only content is text: focus must land inside\n * it so a screen reader announces the dialog rather than continuing from the page behind.\n */\nexport function useAutoFocus(\n ref: RefObject<HTMLElement | null>,\n active: boolean,\n initialFocus?: RefObject<HTMLElement | null>,\n): void {\n useEffect(() => {\n if (!active) return\n const container = ref.current\n if (!container) return\n\n // After paint: the surface may still be animating in, and focusing a node with\n // `visibility: hidden` is a no-op that silently leaves focus on the body.\n const frame = requestAnimationFrame(() => {\n const explicit = initialFocus?.current\n if (explicit?.isConnected) {\n explicit.focus({ preventScroll: true })\n return\n }\n const target = getTabbable(container)[0] ?? container\n target.focus({ preventScroll: true })\n })\n\n return () => cancelAnimationFrame(frame)\n }, [ref, active, initialFocus])\n}\n\n/**\n * Roving tabindex for a composite widget (toolbar, tab list, menu).\n *\n * The ARIA authoring practice: a composite has exactly **one** tab stop, and arrow keys move\n * within it. Ten tabs that are each a tab stop means a keyboard user presses Tab ten times to get\n * past the tab bar — technically operable, practically hostile.\n */\nexport function useRovingFocus(options: {\n /** Items in DOM order. */\n itemsRef: RefObject<Array<HTMLElement | null>>\n /** Index that currently owns the tab stop. */\n active: number\n onActiveChange: (index: number) => void\n orientation?: 'horizontal' | 'vertical' | 'both'\n loop?: boolean\n}): (event: React.KeyboardEvent) => void {\n const { itemsRef, active, onActiveChange, orientation = 'horizontal', loop = true } = options\n\n return (event: React.KeyboardEvent) => {\n const items = (itemsRef.current ?? []).filter((item): item is HTMLElement => item !== null)\n if (items.length === 0) return\n\n const horizontal = orientation === 'horizontal' || orientation === 'both'\n const vertical = orientation === 'vertical' || orientation === 'both'\n\n let next = active\n switch (event.key) {\n case 'ArrowRight':\n if (!horizontal) return\n next = active + 1\n break\n case 'ArrowLeft':\n if (!horizontal) return\n next = active - 1\n break\n case 'ArrowDown':\n if (!vertical) return\n next = active + 1\n break\n case 'ArrowUp':\n if (!vertical) return\n next = active - 1\n break\n case 'Home':\n next = 0\n break\n case 'End':\n next = items.length - 1\n break\n default:\n return\n }\n\n event.preventDefault()\n\n if (next < 0) next = loop ? items.length - 1 : 0\n if (next >= items.length) next = loop ? 0 : items.length - 1\n\n onActiveChange(next)\n items[next]?.focus()\n }\n}\n","import { type ReactNode, type RefObject, useEffect, useRef, useState } from 'react'\nimport { prefersReducedMotion } from '@ansh-ui/core'\n\n/**\n * Keep an element mounted while it animates out.\n *\n * The problem: `{open && <Dialog />}` cannot animate on close, because React removes the node the\n * instant `open` flips. The fix is to keep rendering it and unmount when the exit animation\n * actually finishes.\n *\n * Finishing is detected from `animationend`/`transitionend` rather than a duration prop. A duration\n * prop has to be kept in sync with the CSS by hand, and it drifts the moment someone retimes the\n * animation in the stylesheet — leaving either a flash (unmount too early) or a surface that lingers\n * invisibly and swallows clicks (too late). The timeout below is only a safety net for the case\n * where no animation is declared at all and no event ever fires.\n */\nexport function usePresence(\n open: boolean,\n ref: RefObject<HTMLElement | null>,\n): { mounted: boolean; state: 'open' | 'closed' } {\n const [mounted, setMounted] = useState(open)\n const [state, setState] = useState<'open' | 'closed'>(open ? 'open' : 'closed')\n\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n\n useEffect(() => {\n if (open) {\n clearTimeout(timeoutRef.current)\n setMounted(true)\n // Next frame, so the element mounts in its closed state and *then* transitions. Setting\n // both in the same commit means the browser never sees the start state and no transition\n // runs — the classic \"enter animation doesn't play\" bug.\n const frame = requestAnimationFrame(() => setState('open'))\n return () => cancelAnimationFrame(frame)\n }\n\n if (!mounted) return\n\n setState('closed')\n\n const node = ref.current\n if (!node || prefersReducedMotion()) {\n setMounted(false)\n return\n }\n\n // Only the element's *own* animations count. A child's animation ending would unmount the\n // surface while it is still fading.\n const onEnd = (event: AnimationEvent | TransitionEvent) => {\n if (event.target !== node) return\n setMounted(false)\n }\n\n node.addEventListener('animationend', onEnd)\n node.addEventListener('transitionend', onEnd)\n\n // Safety net: if no animation is declared, neither event ever fires and the surface would\n // stay mounted forever, invisible and intercepting pointer events.\n timeoutRef.current = setTimeout(() => setMounted(false), 400)\n\n return () => {\n node.removeEventListener('animationend', onEnd)\n node.removeEventListener('transitionend', onEnd)\n clearTimeout(timeoutRef.current)\n }\n }, [open, mounted, ref])\n\n return { mounted, state }\n}\n\nexport interface PresenceProps {\n open: boolean\n children: (props: { ref: RefObject<HTMLElement | null>; state: 'open' | 'closed' }) => ReactNode\n}\n\n/**\n * Render-prop form of `usePresence`, for callers that would otherwise need to hoist a ref.\n *\n * ```tsx\n * <Presence open={open}>\n * {({ ref, state }) => <div ref={ref} data-state={state} className=\"fade\" />}\n * </Presence>\n * ```\n */\nexport function Presence({ open, children }: PresenceProps) {\n const ref = useRef<HTMLElement | null>(null)\n const { mounted, state } = usePresence(open, ref)\n if (!mounted) return null\n return <>{children({ ref, state })}</>\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/command-palette.tsx","../src/components/overlay/popover.tsx","../src/components/overlay/tooltip.tsx","../src/components/overlay/dialog.tsx","../src/components/overlay/drawer.tsx","../src/components/overlay/menu.tsx"],"names":["useState","useRef","useId","useMemo","useEffect","useCallback","jsx","jsxs","createContext","useContext","useControllableState","Slot","usePresence","useAnchoredPosition","useDismiss","useFocusTrap","useAutoFocus","useFocusRestore","Portal","cx","Fragment","useScrollLock","MenuSurface","state","index"],"mappings":";;;;;;;;;AA+CA,SAAS,KAAA,CAAM,OAAe,IAAA,EAAsB;AAClD,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,EAAG,OAAO,CAAA;AAE/B,EAAA,MAAM,CAAA,GAAI,MAAM,WAAA,EAAY;AAC5B,EAAA,MAAM,CAAA,GAAI,KAAK,WAAA,EAAY;AAE3B,EAAA,IAAI,UAAA,GAAa,CAAA;AACjB,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,IAAI,GAAA,GAAM,CAAA;AAEV,EAAA,KAAA,IAAS,CAAA,GAAI,GAAG,CAAA,GAAI,CAAA,CAAE,UAAU,UAAA,GAAa,CAAA,CAAE,QAAQ,CAAA,EAAA,EAAK;AAC1D,IAAA,IAAI,CAAA,CAAE,CAAC,CAAA,KAAM,CAAA,CAAE,UAAU,CAAA,EAAG;AAC1B,MAAA,GAAA,EAAA;AAEA,MAAA,KAAA,IAAS,GAAA,GAAM,CAAA,IAAK,CAAA,KAAM,CAAA,GAAI,CAAA,GAAI,CAAA,CAAA;AAClC,MAAA,UAAA,EAAA;AAAA,IACF,CAAA,MAAO;AACL,MAAA,GAAA,GAAM,CAAA;AAAA,IACR;AAAA,EACF;A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AAK,QAAA;AAAA,YACL,EAAA;AAAA,YACA,OAAO,KAAA,CAAM,KAAA;AAAA,YACb,OAAO,OAAO,KAAA,CAAM,KAAA,KAAU,QAAA,GAAW,MAAM,KAAA,GAAQ,SAAA;AAAA,YACvD,KAAA;AAAA,YACA,OAAO,QAAA,CAAS,KAAA;AAAA,YAChB,OAAA,EAAS;AAAA;AAAA;AACX;AAAA,OAEJ,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"chunk-C5JG6TMM.cjs","sourcesContent":["import { type ReactNode, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\n/**\n * A command palette.\n *\n * The interaction is easy; the accessibility is where these usually go wrong. This one implements\n * the combobox pattern properly:\n *\n * - Focus stays in the input the whole time. Arrow keys move a *virtual* selection, announced via\n * `aria-activedescendant`, rather than moving DOM focus — so the user can keep typing.\n * - The list is `role=\"listbox\"` with `role=\"option\"` children and correct `aria-selected`.\n * - Focus is restored to whatever was focused before opening, so keyboard users aren't dumped at\n * the top of the document on close.\n * - Focus is trapped while open, so Tab can't escape to the page behind the scrim.\n *\n * Filtering is a subsequence match rather than a substring one: typing `nds` should find\n * \"**N**ew **D**ata**s**ource\", which is what anyone who has used a palette expects.\n */\n\nexport interface CommandItem {\n id: string\n label: string\n /** Optional grouping heading. Items with the same group render together. */\n group?: string\n /** Leading icon. */\n icon?: ReactNode\n /** Shortcut hint shown on the right, e.g. `'⌘K'`. Display only. */\n shortcut?: string\n /** Extra text matched against the query but not displayed. */\n keywords?: string\n onSelect?: () => void\n}\n\nexport interface CommandPaletteProps {\n items: readonly CommandItem[]\n open: boolean\n onOpenChange: (open: boolean) => void\n placeholder?: string\n emptyMessage?: string\n}\n\n/**\n * Subsequence match with a crude relevance score.\n *\n * Returns `-1` for no match. Contiguous runs score higher, and a match at the start of the label\n * scores higher still, so \"set\" ranks \"**Set**tings\" above \"As**set** manager\".\n */\nfunction score(query: string, text: string): number {\n if (query.length === 0) return 0\n\n const q = query.toLowerCase()\n const t = text.toLowerCase()\n\n let queryIndex = 0\n let total = 0\n let run = 0\n\n for (let i = 0; i < t.length && queryIndex < q.length; i++) {\n if (t[i] === q[queryIndex]) {\n run++\n // Contiguity bonus, plus a bonus for matching near the start.\n total += run * 2 + (i === 0 ? 8 : 0)\n queryIndex++\n } else {\n run = 0\n }\n }\n\n return queryIndex === q.length ? total : -1\n}\n\nexport function CommandPalette({\n items,\n open,\n onOpenChange,\n placeholder = 'Type a command or search…',\n emptyMessage = 'No results found.',\n}: CommandPaletteProps) {\n const [query, setQuery] = useState('')\n const [active, setActive] = useState(0)\n\n const inputRef = useRef<HTMLInputElement | null>(null)\n const dialogRef = useRef<HTMLDivElement | null>(null)\n /** Whatever had focus before opening, so it can be restored on close. */\n const restoreFocusRef = useRef<HTMLElement | null>(null)\n\n const listId = useId()\n\n const results = useMemo(() => {\n if (query.trim() === '') return [...items]\n return items\n .map((item) => ({\n item,\n score: Math.max(score(query, item.label), score(query, item.keywords ?? '')),\n }))\n .filter((entry) => entry.score >= 0)\n .sort((a, b) => b.score - a.score)\n .map((entry) => entry.item)\n }, [items, query])\n\n // Reset the cursor whenever the result set changes, or the highlight can point past the end.\n useEffect(() => setActive(0), [query, items])\n\n const close = useCallback(() => {\n onOpenChange(false)\n setQuery('')\n }, [onOpenChange])\n\n const select = useCallback(\n (item: CommandItem | undefined) => {\n if (!item) return\n item.onSelect?.()\n close()\n },\n [close],\n )\n\n // --- Open/close lifecycle ------------------------------------------------\n useEffect(() => {\n if (!open) return\n\n restoreFocusRef.current = document.activeElement as HTMLElement | null\n // Focus after paint, or the input isn't in the document yet.\n const raf = requestAnimationFrame(() => inputRef.current?.focus())\n\n // A modal surface must not leave the page behind it scrollable.\n const previousOverflow = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n\n return () => {\n cancelAnimationFrame(raf)\n document.body.style.overflow = previousOverflow\n // Restoring focus is what stops a keyboard user being dumped at the top of the document.\n restoreFocusRef.current?.focus?.()\n }\n }, [open])\n\n // --- Keyboard ------------------------------------------------------------\n const onKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n // Wraps, because a palette with five items shouldn't dead-end at the bottom.\n setActive((i) => (results.length === 0 ? 0 : (i + 1) % results.length))\n break\n case 'ArrowUp':\n event.preventDefault()\n setActive((i) => (results.length === 0 ? 0 : (i - 1 + results.length) % results.length))\n break\n case 'Home':\n event.preventDefault()\n setActive(0)\n break\n case 'End':\n event.preventDefault()\n setActive(Math.max(0, results.length - 1))\n break\n case 'Enter':\n event.preventDefault()\n select(results[active])\n break\n case 'Escape':\n event.preventDefault()\n close()\n break\n case 'Tab': {\n // Trap focus. The palette has exactly one focusable element, so Tab simply stays put —\n // but it must be prevented, or focus escapes to the page behind the scrim.\n event.preventDefault()\n break\n }\n }\n }\n\n // Keep the highlighted row in view during keyboard navigation.\n useEffect(() => {\n if (!open) return\n const node = document.getElementById(`${listId}-option-${active}`)\n // Optional-called: `scrollIntoView` is absent in jsdom and in some embedded webviews. Keeping\n // the selection visible is a nicety; throwing because the host lacks the method would take the\n // whole palette down, which is not a trade worth making.\n node?.scrollIntoView?.({ block: 'nearest' })\n }, [active, listId, open])\n\n if (!open) return null\n\n // Group headings are emitted when the group changes, so ordering by relevance still produces\n // sensible headings rather than repeating them.\n let lastGroup: string | undefined\n\n return (\n <div\n className=\"ansh-cmdk__backdrop\"\n // Clicking the scrim dismisses, but only when the click started on the scrim itself —\n // otherwise a drag that ends outside the dialog closes it unexpectedly.\n onMouseDown={(event) => {\n if (event.target === event.currentTarget) close()\n }}\n >\n <div\n ref={dialogRef}\n className=\"ansh-cmdk\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command palette\"\n >\n <input\n ref={inputRef}\n className=\"ansh-cmdk__input\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n // The combobox contract: focus stays here while the selection moves virtually.\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={results.length > 0 ? `${listId}-option-${active}` : undefined}\n autoComplete=\"off\"\n spellCheck={false}\n />\n\n {results.length === 0 ? (\n <div className=\"ansh-cmdk__empty\">{emptyMessage}</div>\n ) : (\n <ul className=\"ansh-cmdk__list\" id={listId} role=\"listbox\" aria-label=\"Commands\">\n {results.map((item, index) => {\n const heading = item.group && item.group !== lastGroup ? item.group : null\n lastGroup = item.group\n\n return (\n <li key={item.id} role=\"presentation\">\n {heading ? (\n <div className=\"ansh-cmdk__group\" role=\"presentation\">\n {heading}\n </div>\n ) : null}\n <div\n id={`${listId}-option-${index}`}\n className=\"ansh-cmdk__item\"\n role=\"option\"\n aria-selected={index === active}\n // Pointer hover moves the selection so mouse and keyboard agree on what\n // Enter will do.\n onMouseEnter={() => setActive(index)}\n onClick={() => select(item)}\n >\n {item.icon}\n <span>{item.label}</span>\n {item.shortcut ? <kbd className=\"ansh-cmdk__kbd\">{item.shortcut}</kbd> : null}\n </div>\n </li>\n )\n })}\n </ul>\n )}\n </div>\n </div>\n )\n}\n\n/**\n * Bind a keyboard shortcut that toggles state — `⌘K` by default.\n *\n * ```tsx\n * const [open, setOpen] = useState(false)\n * useCommandShortcut(() => setOpen((v) => !v))\n * ```\n */\nexport function useCommandShortcut(toggle: () => void, key = 'k'): void {\n const toggleRef = useRef(toggle)\n toggleRef.current = toggle\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n // `metaKey` on macOS, `ctrlKey` elsewhere — checking both is simpler and correct on each.\n if (event.key.toLowerCase() === key && (event.metaKey || event.ctrlKey)) {\n event.preventDefault()\n toggleRef.current()\n }\n }\n window.addEventListener('keydown', onKeyDown)\n return () => window.removeEventListener('keydown', onKeyDown)\n }, [key])\n}\n","import {\n type ReactNode,\n createContext,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { type Placement } from '../../primitives/position'\nimport { cx } from '../../primitives/compose'\nimport { Portal } from '../../primitives/portal'\nimport { Slot } from '../../primitives/slot'\nimport { useAnchoredPosition } from '../../primitives/use-anchored-position'\nimport { useControllableState } from '../../primitives/use-controllable-state'\nimport { useDismiss } from '../../primitives/use-dismiss'\nimport { useFocusTrap, useAutoFocus, useFocusRestore } from '../../primitives/focus'\nimport { usePresence } from '../../primitives/presence'\n\n/**\n * A popover.\n *\n * The compound API (`Popover` / `PopoverTrigger` / `PopoverContent`) rather than a single component\n * with a `content` prop, because the trigger needs attributes that only the popover can supply —\n * `aria-expanded`, `aria-controls` — and a `content` prop can't put them anywhere.\n *\n * Focus moves into the content on open and returns to the trigger on close, and Tab is trapped\n * inside. A popover containing a form that lets Tab wander onto the page behind it is a popover\n * keyboard users cannot fill in.\n */\n\ninterface PopoverContextValue {\n open: boolean\n setOpen: (open: boolean) => void\n triggerRef: React.MutableRefObject<HTMLElement | null>\n contentId: string\n placement: Placement\n offset: number\n modal: boolean\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null)\n\nfunction usePopover(component: string): PopoverContextValue {\n const context = useContext(PopoverContext)\n if (!context) {\n throw new Error(`<${component}> must be rendered inside <Popover>.`)\n }\n return context\n}\n\nexport interface PopoverProps {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n placement?: Placement\n /** Gap from the trigger, in px. Default `8`. */\n offset?: number\n /** Trap focus and block interaction behind. Default `false` — most popovers are non-modal. */\n modal?: boolean\n children: ReactNode\n}\n\nexport function Popover({\n open,\n defaultOpen = false,\n onOpenChange,\n placement = 'bottom',\n offset = 8,\n modal = false,\n children,\n}: PopoverProps) {\n const [isOpen, setOpen] = useControllableState<boolean>({\n value: open,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n })\n const triggerRef = useRef<HTMLElement | null>(null)\n const contentId = useId()\n\n const context = useMemo(\n () => ({ open: isOpen, setOpen, triggerRef, contentId, placement, offset, modal }),\n [isOpen, setOpen, contentId, placement, offset, modal],\n )\n\n return <PopoverContext.Provider value={context}>{children}</PopoverContext.Provider>\n}\n\nexport interface PopoverTriggerProps extends React.HTMLAttributes<HTMLElement> {\n /** Render into the child element rather than emitting a `<button>`. */\n asChild?: boolean\n children: ReactNode\n}\n\nexport function PopoverTrigger({ asChild = false, children, ...rest }: PopoverTriggerProps) {\n const { open, setOpen, triggerRef, contentId } = usePopover('PopoverTrigger')\n // Widened to `ElementType`: the union of `Slot` and `'button'` makes TypeScript intersect their\n // two ref signatures, which nothing can satisfy. The runtime behaviour is identical.\n const Component = (asChild ? Slot : 'button') as React.ElementType\n\n return (\n <Component\n ref={triggerRef as React.Ref<HTMLElement>}\n {...(asChild ? null : { type: 'button' as const })}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? contentId : undefined}\n {...rest}\n onClick={(event: React.MouseEvent<HTMLElement>) => {\n rest.onClick?.(event)\n if (event.defaultPrevented) return\n setOpen(!open)\n }}\n >\n {children}\n </Component>\n )\n}\n\nexport interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Draw an arrow pointing at the trigger. Default `false`. */\n arrow?: boolean\n /** Match the trigger's width — for a popover acting as a dropdown panel. */\n matchWidth?: boolean\n /** Accessible name. Required unless the content contains its own heading. */\n label?: string\n children: ReactNode\n}\n\nexport function PopoverContent({\n arrow = false,\n matchWidth = false,\n label,\n className,\n style,\n children,\n ...rest\n}: PopoverContentProps) {\n const { open, setOpen, triggerRef, contentId, placement, offset, modal } =\n usePopover('PopoverContent')\n\n const contentRef = useRef<HTMLDivElement | null>(null)\n const { mounted, state } = usePresence(open, contentRef)\n\n const position = useAnchoredPosition(triggerRef, contentRef, mounted, {\n placement,\n offset,\n matchWidth,\n arrowSize: arrow ? 10 : 0,\n })\n\n useDismiss(contentRef, open, () => setOpen(false), { ignore: [triggerRef] })\n useFocusTrap(contentRef, open && modal)\n useAutoFocus(contentRef, open)\n useFocusRestore(open)\n\n if (!mounted) return null\n\n return (\n <Portal>\n <div\n ref={contentRef}\n id={contentId}\n role=\"dialog\"\n aria-modal={modal || undefined}\n {...(label ? { 'aria-label': label } : null)}\n tabIndex={-1}\n data-state={state}\n data-side={position.side}\n className={cx('ansh-popover', className)}\n style={{ ...position.style, ...style }}\n {...rest}\n >\n {children}\n {arrow && position.arrowStyle ? (\n <span className=\"ansh-popover__arrow\" style={position.arrowStyle} aria-hidden=\"true\" />\n ) : null}\n </div>\n </Portal>\n )\n}\n\n// --- HoverCard ------------------------------------------------------------\n\nexport interface HoverCardProps {\n /** The card's contents. */\n content: ReactNode\n /** Delay before opening, in ms. Default `500`. */\n openDelay?: number\n /** Delay before closing, in ms. Default `200`. */\n closeDelay?: number\n placement?: Placement\n className?: string\n children: ReactNode\n}\n\n/**\n * A rich preview shown on hover — a user card on an @mention, a link preview.\n *\n * Two delays, not one. The open delay stops cards firing as the pointer sweeps across a paragraph\n * of links. The close delay is what lets the pointer travel from the trigger to the card without it\n * vanishing en route, which is the failure that makes hover cards feel broken.\n *\n * Hover-only content is invisible to keyboard and touch users, so this also opens on focus. It is\n * strictly for *supplementary* information — anything essential belongs in a click-opened popover.\n */\nexport function HoverCard({\n content,\n openDelay = 500,\n closeDelay = 200,\n placement = 'bottom',\n className,\n children,\n}: HoverCardProps) {\n const [open, setOpen] = useState(false)\n const triggerRef = useRef<HTMLSpanElement | null>(null)\n const cardRef = useRef<HTMLDivElement | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const id = useId()\n\n const { mounted, state } = usePresence(open, cardRef)\n const position = useAnchoredPosition(triggerRef, cardRef, mounted, { placement, offset: 8 })\n\n const schedule = (next: boolean) => {\n clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setOpen(next), next ? openDelay : closeDelay)\n }\n\n useEffect(() => () => clearTimeout(timerRef.current), [])\n\n return (\n <>\n <span\n ref={triggerRef}\n className=\"ansh-hovercard__trigger\"\n // `aria-describedby` rather than `aria-details`: support for details is still patchy, and\n // a description is the honest relationship for supplementary content.\n aria-describedby={open ? id : undefined}\n onMouseEnter={() => schedule(true)}\n onMouseLeave={() => schedule(false)}\n onFocus={() => setOpen(true)}\n onBlur={() => setOpen(false)}\n >\n {children}\n </span>\n\n {mounted ? (\n <Portal>\n <div\n ref={cardRef}\n id={id}\n role=\"tooltip\"\n data-state={state}\n className={cx('ansh-hovercard', className)}\n style={position.style}\n // Keeping the card open while the pointer is over it is what makes its contents\n // clickable at all.\n onMouseEnter={() => schedule(true)}\n onMouseLeave={() => schedule(false)}\n >\n {content}\n </div>\n </Portal>\n ) : null}\n </>\n )\n}\n","import {\n type ReactNode,\n createContext,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { type Placement } from '../../primitives/position'\nimport { cx } from '../../primitives/compose'\nimport { Portal } from '../../primitives/portal'\nimport { Slot } from '../../primitives/slot'\nimport { useAnchoredPosition } from '../../primitives/use-anchored-position'\nimport { usePresence } from '../../primitives/presence'\n\n/**\n * Tooltips.\n *\n * The rules this follows, all from WCAG 1.4.13 (Content on Hover or Focus) and the ARIA practices:\n *\n * - **Focus shows it too.** A tooltip only on hover doesn't exist for keyboard users.\n * - **Escape dismisses it** without moving focus, for anyone whose magnifier it is covering.\n * - **It is a description, not a name.** Wired with `aria-describedby`, so the trigger keeps its\n * own label. Using it as the label means an icon button announces nothing until the tooltip\n * opens, which on touch is never.\n * - **It never contains interactive content.** There is no way to reach a button inside a tooltip\n * with a keyboard. That's what `HoverCard` and `Popover` are for.\n *\n * Never put essential information here: tooltips do not appear on touch devices at all.\n */\n\ninterface TooltipGroupValue {\n /** Whether some tooltip in the group is already open — the next skips its delay. */\n active: boolean\n setActive: (active: boolean) => void\n delay: number\n}\n\nconst TooltipGroupContext = createContext<TooltipGroupValue | null>(null)\n\nexport interface TooltipProviderProps {\n /** Delay before the first tooltip in a group opens, in ms. Default `600`. */\n delay?: number\n children: ReactNode\n}\n\n/**\n * Share a delay across a set of tooltips.\n *\n * Once one is open, moving to a neighbour shows its tooltip immediately. Without this, scanning a\n * toolbar means waiting out the delay on every single button — the behaviour every desktop OS gets\n * right and most web implementations miss.\n */\nexport function TooltipProvider({ delay = 600, children }: TooltipProviderProps) {\n const [active, setActive] = useState(false)\n const value = useMemo(() => ({ active, setActive, delay }), [active, delay])\n return <TooltipGroupContext.Provider value={value}>{children}</TooltipGroupContext.Provider>\n}\n\nexport interface TooltipProps {\n /** The tooltip text. Keep it short — it is read as one description. */\n content: ReactNode\n placement?: Placement\n /** Override the group delay, in ms. */\n delay?: number\n /** Draw an arrow. Default `true`. */\n arrow?: boolean\n disabled?: boolean\n className?: string\n children: ReactNode\n}\n\nexport function Tooltip({\n content,\n placement = 'top',\n delay,\n arrow = true,\n disabled = false,\n className,\n children,\n}: TooltipProps) {\n const group = useContext(TooltipGroupContext)\n const [open, setOpen] = useState(false)\n\n const triggerRef = useRef<HTMLElement | null>(null)\n const tipRef = useRef<HTMLDivElement | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const id = useId()\n\n const { mounted, state } = usePresence(open, tipRef)\n const position = useAnchoredPosition(triggerRef, tipRef, mounted, {\n placement,\n offset: 6,\n arrowSize: arrow ? 8 : 0,\n })\n\n const effectiveDelay = delay ?? group?.delay ?? 600\n\n const show = (immediate = false) => {\n if (disabled) return\n clearTimeout(timerRef.current)\n // Skip the delay when a sibling tooltip is already open, or on focus — a keyboard user has\n // already made a deliberate move and shouldn't be made to wait.\n if (immediate || group?.active) {\n setOpen(true)\n group?.setActive(true)\n return\n }\n timerRef.current = setTimeout(() => {\n setOpen(true)\n group?.setActive(true)\n }, effectiveDelay)\n }\n\n const hide = () => {\n clearTimeout(timerRef.current)\n setOpen(false)\n // Grace period before the group goes cold, so moving between adjacent triggers stays instant.\n timerRef.current = setTimeout(() => group?.setActive(false), 200)\n }\n\n useEffect(() => () => clearTimeout(timerRef.current), [])\n\n // WCAG 1.4.13: dismissable without moving the pointer or focus.\n useEffect(() => {\n if (!open) return\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false)\n group?.setActive(false)\n }\n }\n document.addEventListener('keydown', onKeyDown)\n return () => document.removeEventListener('keydown', onKeyDown)\n }, [open, group])\n\n return (\n <>\n <Slot\n ref={triggerRef as React.Ref<HTMLElement>}\n aria-describedby={open ? id : undefined}\n onMouseEnter={() => show()}\n onMouseLeave={hide}\n onFocus={() => show(true)}\n onBlur={hide}\n >\n {children}\n </Slot>\n\n {mounted && !disabled ? (\n <Portal>\n <div\n ref={tipRef}\n id={id}\n role=\"tooltip\"\n data-state={state}\n data-side={position.side}\n className={cx('ansh-tooltip', className)}\n style={position.style}\n >\n {content}\n {arrow && position.arrowStyle ? (\n <span\n className=\"ansh-tooltip__arrow\"\n style={position.arrowStyle}\n aria-hidden=\"true\"\n />\n ) : null}\n </div>\n </Portal>\n ) : null}\n </>\n )\n}\n","import { type ReactNode, useCallback, useId, useRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { Portal } from '../../primitives/portal'\nimport { useAutoFocus, useFocusRestore, useFocusTrap } from '../../primitives/focus'\nimport { usePresence } from '../../primitives/presence'\nimport { useDismiss, useScrollLock } from '../../primitives/use-dismiss'\n\nexport type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\nexport interface DialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n /** The dialog's accessible name. Required — a dialog announced as just \"dialog\" is useless. */\n title: ReactNode\n /** Supporting text, wired to `aria-describedby`. */\n description?: ReactNode\n size?: DialogSize\n /** Actions row, pinned below the scrollable body. */\n footer?: ReactNode\n /** Show the ✕ button. Default `true`. */\n showClose?: boolean\n /** Allow closing via scrim click and Escape. Default `true`. */\n dismissable?: boolean\n /** Element to focus on open. Defaults to the first tabbable one. */\n initialFocus?: React.RefObject<HTMLElement | null>\n className?: string\n children?: ReactNode\n}\n\n/**\n * A modal dialog.\n *\n * Not `<dialog showModal>`: the native element's top-layer behaviour is genuinely better, but its\n * backdrop cannot be animated consistently, `::backdrop` inherits nothing, and closing behaviour\n * differs enough across browsers to need working around anyway. The pieces the native element gives\n * for free — focus trap, scroll lock, inert background, focus restore — are all here explicitly.\n *\n * `title` is a required prop rather than an optional slot. Every accessibility audit of a component\n * library turns up unnamed dialogs, and the reliable fix is to make the name impossible to omit.\n */\nexport function Dialog({\n open,\n onOpenChange,\n title,\n description,\n size = 'md',\n footer,\n showClose = true,\n dismissable = true,\n initialFocus,\n className,\n children,\n}: DialogProps) {\n const panelRef = useRef<HTMLDivElement | null>(null)\n const id = useId()\n const titleId = `${id}-title`\n const descriptionId = `${id}-description`\n\n const { mounted, state } = usePresence(open, panelRef)\n\n const close = useCallback(() => {\n if (dismissable) onOpenChange(false)\n }, [dismissable, onOpenChange])\n\n useDismiss(panelRef, open, close, { outsidePress: dismissable, escapeKey: dismissable })\n useFocusTrap(panelRef, open)\n useAutoFocus(panelRef, open, initialFocus)\n useFocusRestore(open)\n useScrollLock(open)\n\n if (!mounted) return null\n\n return (\n <Portal>\n <div className=\"ansh-dialog__layer\" data-state={state}>\n {/* The scrim is not a button and takes no focus — it's decorative. Dismissal is handled\n by `useDismiss` on a pointerdown outside the panel, which also covers the gap around\n the panel that isn't the scrim element itself. */}\n <div className=\"ansh-dialog__scrim\" data-state={state} aria-hidden=\"true\" />\n\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n {...(description ? { 'aria-describedby': descriptionId } : null)}\n tabIndex={-1}\n data-state={state}\n className={cx('ansh-dialog', `ansh-dialog--${size}`, className)}\n >\n <header className=\"ansh-dialog__header\">\n <div className=\"ansh-dialog__heading\">\n <h2 className=\"ansh-dialog__title\" id={titleId}>\n {title}\n </h2>\n {description ? (\n <p className=\"ansh-dialog__description\" id={descriptionId}>\n {description}\n </p>\n ) : null}\n </div>\n\n {showClose ? (\n <button\n type=\"button\"\n className=\"ansh-dialog__close ansh-focusable\"\n aria-label=\"Close dialog\"\n onClick={() => onOpenChange(false)}\n >\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n </button>\n ) : null}\n </header>\n\n {children ? <div className=\"ansh-dialog__body\">{children}</div> : null}\n {footer ? <footer className=\"ansh-dialog__footer\">{footer}</footer> : null}\n </div>\n </div>\n </Portal>\n )\n}\n\nexport interface AlertDialogProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n title: ReactNode\n description: ReactNode\n /** Confirm button text. Default `'Confirm'`. */\n confirmLabel?: string\n cancelLabel?: string\n /** Style the confirm action as destructive. */\n destructive?: boolean\n onConfirm: () => void | Promise<void>\n onCancel?: () => void\n /** Disable the buttons while an async confirm runs. */\n busy?: boolean\n className?: string\n}\n\n/**\n * A confirmation dialog.\n *\n * `role=\"alertdialog\"` and `aria-describedby` on the message, which makes a screen reader read the\n * consequence immediately on open rather than waiting for the user to navigate to it. That is the\n * entire difference from a regular dialog, and it matters precisely because these appear before\n * irreversible actions.\n *\n * It is deliberately **not** dismissable by clicking the scrim: an accidental click outside should\n * not silently cancel a decision the user was asked to make. Escape still works, because trapping\n * someone in a dialog is worse.\n *\n * Focus starts on **Cancel**, not Confirm. A keyboard user who hits Enter reflexively should not\n * delete their account.\n */\nexport function AlertDialog({\n open,\n onOpenChange,\n title,\n description,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n destructive = false,\n onConfirm,\n onCancel,\n busy = false,\n className,\n}: AlertDialogProps) {\n const panelRef = useRef<HTMLDivElement | null>(null)\n const cancelRef = useRef<HTMLButtonElement | null>(null)\n const id = useId()\n\n const { mounted, state } = usePresence(open, panelRef)\n\n const cancel = useCallback(() => {\n onCancel?.()\n onOpenChange(false)\n }, [onCancel, onOpenChange])\n\n useDismiss(panelRef, open, cancel, { outsidePress: false, escapeKey: true })\n useFocusTrap(panelRef, open)\n useAutoFocus(panelRef, open, cancelRef)\n useFocusRestore(open)\n useScrollLock(open)\n\n if (!mounted) return null\n\n return (\n <Portal>\n <div className=\"ansh-dialog__layer\" data-state={state}>\n <div className=\"ansh-dialog__scrim\" data-state={state} aria-hidden=\"true\" />\n\n <div\n ref={panelRef}\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-labelledby={`${id}-title`}\n aria-describedby={`${id}-description`}\n tabIndex={-1}\n data-state={state}\n className={cx('ansh-dialog', 'ansh-dialog--sm', 'ansh-dialog--alert', className)}\n >\n <div className=\"ansh-dialog__body\">\n {destructive ? (\n <span\n className=\"ansh-dialog__alert-icon ansh-dialog__alert-icon--danger\"\n aria-hidden=\"true\"\n >\n <svg\n viewBox=\"0 0 24 24\"\n width=\"20\"\n height=\"20\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n >\n <path d=\"M12 8v5\" strokeLinecap=\"round\" />\n <circle cx=\"12\" cy=\"16.5\" r=\"1\" fill=\"currentColor\" stroke=\"none\" />\n <path\n d=\"M10.3 3.9L2.6 17.4A2 2 0 004.3 20.4h15.4a2 2 0 001.7-3L13.7 3.9a2 2 0 00-3.4 0z\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n ) : null}\n\n <h2 className=\"ansh-dialog__title\" id={`${id}-title`}>\n {title}\n </h2>\n <p className=\"ansh-dialog__description\" id={`${id}-description`}>\n {description}\n </p>\n </div>\n\n <footer className=\"ansh-dialog__footer\">\n <button\n ref={cancelRef}\n type=\"button\"\n className=\"ansh-btn ansh-btn--ghost ansh-btn--sm ansh-focusable\"\n disabled={busy}\n onClick={cancel}\n >\n {cancelLabel}\n </button>\n <button\n type=\"button\"\n className={cx(\n 'ansh-btn',\n 'ansh-btn--sm',\n destructive ? 'ansh-btn--danger' : 'ansh-btn--solid',\n 'ansh-focusable',\n )}\n disabled={busy}\n onClick={() => void onConfirm()}\n >\n {busy ? <span className=\"ansh-spinner ansh-spinner--sm\" aria-hidden=\"true\" /> : null}\n {confirmLabel}\n </button>\n </footer>\n </div>\n </div>\n </Portal>\n )\n}\n\n/** Layout helper for a dialog's action row. Right-aligned, reversed on narrow screens. */\nexport function DialogFooter({ children, className }: { children: ReactNode; className?: string }) {\n return <div className={cx('ansh-dialog__actions', className)}>{children}</div>\n}\n","import { type ReactNode, useCallback, useId, useRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { Portal } from '../../primitives/portal'\nimport { useAutoFocus, useFocusRestore, useFocusTrap } from '../../primitives/focus'\nimport { usePresence } from '../../primitives/presence'\nimport { useDismiss, useScrollLock } from '../../primitives/use-dismiss'\n\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom'\n\nexport interface DrawerProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n /** Which edge it slides from. Default `'right'`. */\n side?: DrawerSide\n title: ReactNode\n description?: ReactNode\n /** Width for left/right, height for top/bottom. Default `'22rem'`. */\n size?: string\n footer?: ReactNode\n showClose?: boolean\n /** Block interaction behind and lock scroll. Default `true`. */\n modal?: boolean\n dismissable?: boolean\n className?: string\n children?: ReactNode\n}\n\n/**\n * A panel that slides in from an edge.\n *\n * Same accessibility contract as `Dialog` — it is a dialog, just positioned differently. The reason\n * it exists separately is that the *content* pattern differs: drawers hold navigation, filters and\n * detail views that stay open while the user works, so they support a non-modal mode where the page\n * behind stays usable.\n *\n * On a phone a bottom drawer is the right shape for what would be a dialog on a desktop; that's a\n * layout decision for the consumer, which is why `side` is a plain prop rather than a breakpoint\n * rule baked in here.\n */\nexport function Drawer({\n open,\n onOpenChange,\n side = 'right',\n title,\n description,\n size = '22rem',\n footer,\n showClose = true,\n modal = true,\n dismissable = true,\n className,\n children,\n}: DrawerProps) {\n const panelRef = useRef<HTMLDivElement | null>(null)\n const id = useId()\n\n const { mounted, state } = usePresence(open, panelRef)\n\n const close = useCallback(() => {\n if (dismissable) onOpenChange(false)\n }, [dismissable, onOpenChange])\n\n useDismiss(panelRef, open, close, { outsidePress: dismissable && modal, escapeKey: dismissable })\n useFocusTrap(panelRef, open && modal)\n useAutoFocus(panelRef, open)\n useFocusRestore(open)\n useScrollLock(open && modal)\n\n if (!mounted) return null\n\n const horizontal = side === 'left' || side === 'right'\n\n return (\n <Portal>\n <div\n className={cx('ansh-drawer__layer', !modal && 'ansh-drawer__layer--inline')}\n data-state={state}\n >\n {modal ? (\n <div className=\"ansh-dialog__scrim\" data-state={state} aria-hidden=\"true\" />\n ) : null}\n\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal={modal || undefined}\n aria-labelledby={`${id}-title`}\n {...(description ? { 'aria-describedby': `${id}-description` } : null)}\n tabIndex={-1}\n data-state={state}\n data-side={side}\n className={cx('ansh-drawer', `ansh-drawer--${side}`, className)}\n // The size travels as a custom property so the closed-state transform can be written in\n // terms of it — `translateX(100%)` alone breaks when the panel has a max-width.\n style={{\n [horizontal ? 'width' : 'height']: size,\n ['--ansh-drawer-size' as string]: size,\n }}\n >\n <header className=\"ansh-drawer__header\">\n <div className=\"ansh-dialog__heading\">\n <h2 className=\"ansh-dialog__title\" id={`${id}-title`}>\n {title}\n </h2>\n {description ? (\n <p className=\"ansh-dialog__description\" id={`${id}-description`}>\n {description}\n </p>\n ) : null}\n </div>\n\n {showClose ? (\n <button\n type=\"button\"\n className=\"ansh-dialog__close ansh-focusable\"\n aria-label=\"Close panel\"\n onClick={() => onOpenChange(false)}\n >\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n </button>\n ) : null}\n </header>\n\n <div className=\"ansh-drawer__body\">{children}</div>\n {footer ? <footer className=\"ansh-drawer__footer\">{footer}</footer> : null}\n </div>\n </div>\n </Portal>\n )\n}\n","import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from 'react'\nimport { type Placement } from '../../primitives/position'\nimport { cx } from '../../primitives/compose'\nimport { Portal } from '../../primitives/portal'\nimport { Slot } from '../../primitives/slot'\nimport { useAnchoredPosition } from '../../primitives/use-anchored-position'\nimport { useDismiss } from '../../primitives/use-dismiss'\nimport { usePresence } from '../../primitives/presence'\n\n/**\n * Menus — dropdown and context.\n *\n * Data-driven (`items={[…]}`) rather than compound. Menus are almost always built from a\n * configuration array anyway — permissions filter entries, a selection decides what's enabled — and\n * expressing that as JSX children means `{canDelete && <MenuItem …/>}` scattered through the tree,\n * which breaks keyboard navigation indices in ways that are painful to debug.\n *\n * Follows the ARIA menu pattern, where **DOM focus moves to the item** (unlike a listbox, which\n * keeps focus on the container). That's what makes Right/Left arrow submenu traversal work the way\n * it does in every desktop application.\n */\n\ninterface MenuItemBase {\n id?: string\n disabled?: boolean\n}\n\nexport interface MenuAction extends MenuItemBase {\n type?: 'item'\n label: ReactNode\n icon?: ReactNode\n /** Display-only shortcut hint, e.g. `'⌘S'`. */\n shortcut?: string\n /** Style as destructive, and mark it in the accessible name. */\n danger?: boolean\n onSelect?: () => void\n}\n\nexport interface MenuCheckbox extends MenuItemBase {\n type: 'checkbox'\n label: ReactNode\n checked: boolean\n onChange: (checked: boolean) => void\n shortcut?: string\n}\n\nexport interface MenuRadioGroup {\n type: 'radio'\n value: string\n onChange: (value: string) => void\n options: ReadonlyArray<{ value: string; label: ReactNode; disabled?: boolean }>\n}\n\nexport interface MenuSubmenu extends MenuItemBase {\n type: 'submenu'\n label: ReactNode\n icon?: ReactNode\n items: readonly MenuEntry[]\n}\n\nexport type MenuEntry =\n | MenuAction\n | MenuCheckbox\n | MenuRadioGroup\n | MenuSubmenu\n | { type: 'separator' }\n | { type: 'label'; label: ReactNode }\n\n/** Flatten to the rows that can actually receive focus, for keyboard navigation. */\ninterface Focusable {\n entry: MenuEntry\n /** For radio groups, which option this row is. */\n optionIndex?: number\n disabled: boolean\n}\n\nfunction flatten(items: readonly MenuEntry[]): Focusable[] {\n const rows: Focusable[] = []\n for (const entry of items) {\n if ('type' in entry && (entry.type === 'separator' || entry.type === 'label')) continue\n if ('type' in entry && entry.type === 'radio') {\n entry.options.forEach((option, optionIndex) => {\n rows.push({ entry, optionIndex, disabled: option.disabled ?? false })\n })\n continue\n }\n rows.push({ entry, disabled: (entry as MenuItemBase).disabled ?? false })\n }\n return rows\n}\n\nexport interface MenuProps {\n items: readonly MenuEntry[]\n placement?: Placement\n /** Accessible name for the menu itself. */\n label?: string\n className?: string\n /** The control that opens the menu. */\n children: ReactNode\n open?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\n/**\n * A dropdown menu.\n *\n * ```tsx\n * <DropdownMenu items={[\n * { label: 'Edit', shortcut: '⌘E', onSelect: edit },\n * { type: 'separator' },\n * { label: 'Delete', danger: true, onSelect: remove },\n * ]}>\n * <IconButton label=\"Actions\" />\n * </DropdownMenu>\n * ```\n */\nexport function DropdownMenu({\n items,\n placement = 'bottom-start',\n label = 'Menu',\n className,\n children,\n open: controlledOpen,\n onOpenChange,\n}: MenuProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false)\n const open = controlledOpen ?? uncontrolledOpen\n const setOpen = useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next)\n onOpenChange?.(next)\n },\n [onOpenChange],\n )\n\n const triggerRef = useRef<HTMLElement | null>(null)\n const menuRef = useRef<HTMLDivElement | null>(null)\n const menuId = useId()\n\n const { mounted, state } = usePresence(open, menuRef)\n const position = useAnchoredPosition(triggerRef, menuRef, mounted, { placement, offset: 6 })\n useDismiss(menuRef, open, () => setOpen(false), { ignore: [triggerRef] })\n\n return (\n <>\n <Slot\n ref={triggerRef as React.Ref<HTMLElement>}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n onClick={() => setOpen(!open)}\n onKeyDown={(event: React.KeyboardEvent) => {\n // ArrowDown opens *and* lands on the first item, which is the single most-used path\n // into a menu for keyboard users.\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n }\n }}\n >\n {children}\n </Slot>\n\n {mounted ? (\n <Portal>\n <MenuSurface\n ref={menuRef}\n id={menuId}\n items={items}\n label={label}\n state={state}\n style={position.style}\n className={className}\n onClose={() => {\n setOpen(false)\n triggerRef.current?.focus?.()\n }}\n />\n </Portal>\n ) : null}\n </>\n )\n}\n\nexport interface ContextMenuProps {\n items: readonly MenuEntry[]\n label?: string\n className?: string\n children: ReactNode\n}\n\n/**\n * A right-click menu.\n *\n * Also opens on the **context-menu key** and on Shift+F10, which is how keyboard users reach one —\n * a right-click-only implementation is inaccessible, and it is the most commonly missed keyboard\n * binding in the whole component set.\n *\n * Anchored to the pointer via a zero-size virtual rect, so the existing positioning code flips and\n * shifts it near the viewport edges without needing a separate path.\n */\nexport function ContextMenu({\n items,\n label = 'Context menu',\n className,\n children,\n}: ContextMenuProps) {\n const [point, setPoint] = useState<{ x: number; y: number } | null>(null)\n const menuRef = useRef<HTMLDivElement | null>(null)\n const anchorRef = useRef<HTMLSpanElement | null>(null)\n const menuId = useId()\n\n const open = point !== null\n const { mounted, state } = usePresence(open, menuRef)\n const position = useAnchoredPosition(anchorRef, menuRef, mounted, {\n placement: 'bottom-start',\n offset: 2,\n })\n\n useDismiss(menuRef, open, () => setPoint(null))\n\n return (\n <>\n <span\n className=\"ansh-contextmenu__area\"\n onContextMenu={(event) => {\n event.preventDefault()\n setPoint({ x: event.clientX, y: event.clientY })\n }}\n onKeyDown={(event) => {\n if (event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10')) {\n event.preventDefault()\n const rect = event.currentTarget.getBoundingClientRect()\n setPoint({ x: rect.left + 8, y: rect.top + 8 })\n }\n }}\n >\n {children}\n </span>\n\n {/* A zero-size anchor placed at the pointer. Cheaper than teaching the positioner about\n virtual elements, and it inherits flip/shift behaviour for free. */}\n {point ? (\n <span\n ref={anchorRef}\n aria-hidden=\"true\"\n style={{ position: 'fixed', left: point.x, top: point.y, width: 0, height: 0 }}\n />\n ) : null}\n\n {mounted ? (\n <Portal>\n <MenuSurface\n ref={menuRef}\n id={menuId}\n items={items}\n label={label}\n state={state}\n style={position.style}\n className={className}\n onClose={() => setPoint(null)}\n />\n </Portal>\n ) : null}\n </>\n )\n}\n\n// --- The menu surface itself ---------------------------------------------\n\ninterface MenuSurfaceProps {\n id: string\n items: readonly MenuEntry[]\n label: string\n state: 'open' | 'closed'\n style: React.CSSProperties\n className?: string | undefined\n onClose: () => void\n}\n\nconst MenuSurface = function MenuSurface({\n ref,\n id,\n items,\n label,\n state,\n style,\n className,\n onClose,\n}: MenuSurfaceProps & { ref: React.Ref<HTMLDivElement> }) {\n const rows = flatten(items)\n const itemRefs = useRef<Array<HTMLElement | null>>([])\n const [active, setActive] = useState(() => rows.findIndex((row) => !row.disabled))\n const [openSubmenu, setOpenSubmenu] = useState<number | null>(null)\n const typeaheadRef = useRef({\n buffer: '',\n timer: undefined as ReturnType<typeof setTimeout> | undefined,\n })\n\n // Focus the first enabled item on open. The ARIA menu pattern puts DOM focus on the item, which\n // is what allows Right-arrow to hand focus to a submenu and Left-arrow to take it back.\n useEffect(() => {\n itemRefs.current[active]?.focus()\n // Only on mount: afterwards focus follows the keyboard handler below.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const move = (delta: number) => {\n if (rows.length === 0) return\n let next = active\n for (let attempts = 0; attempts < rows.length; attempts++) {\n next = (next + delta + rows.length) % rows.length\n if (!rows[next]?.disabled) break\n }\n setActive(next)\n itemRefs.current[next]?.focus()\n }\n\n const activate = (index: number) => {\n const row = rows[index]\n if (!row || row.disabled) return\n const { entry } = row\n\n if ('type' in entry && entry.type === 'submenu') {\n setOpenSubmenu(index)\n return\n }\n if ('type' in entry && entry.type === 'checkbox') {\n entry.onChange(!entry.checked)\n // Checkbox items keep the menu open: toggling three view options should not require\n // reopening the menu twice.\n return\n }\n if ('type' in entry && entry.type === 'radio') {\n entry.onChange(entry.options[row.optionIndex!]!.value)\n onClose()\n return\n }\n ;(entry as MenuAction).onSelect?.()\n onClose()\n }\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n move(-1)\n break\n case 'Home':\n event.preventDefault()\n setActive(0)\n itemRefs.current[0]?.focus()\n break\n case 'End':\n event.preventDefault()\n setActive(rows.length - 1)\n itemRefs.current[rows.length - 1]?.focus()\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n activate(active)\n break\n case 'ArrowRight': {\n const row = rows[active]\n if (row && 'type' in row.entry && row.entry.type === 'submenu') {\n event.preventDefault()\n setOpenSubmenu(active)\n }\n break\n }\n case 'Escape':\n event.preventDefault()\n onClose()\n break\n case 'Tab':\n // A menu is a single stop in the tab order; Tab closes it rather than walking the items.\n event.preventDefault()\n onClose()\n break\n default: {\n if (event.key.length !== 1) return\n const state = typeaheadRef.current\n clearTimeout(state.timer)\n state.buffer += event.key.toLowerCase()\n state.timer = setTimeout(() => {\n state.buffer = ''\n }, 600)\n\n const match = rows.findIndex((row, index) => {\n if (row.disabled || index === active) return false\n const text =\n typeof (row.entry as MenuAction).label === 'string'\n ? ((row.entry as MenuAction).label as string)\n : ''\n return text.toLowerCase().startsWith(state.buffer)\n })\n if (match >= 0) {\n setActive(match)\n itemRefs.current[match]?.focus()\n }\n }\n }\n }\n\n let rowIndex = -1\n\n return (\n <div\n ref={ref}\n id={id}\n role=\"menu\"\n aria-label={label}\n data-state={state}\n className={cx('ansh-menu', className)}\n style={style}\n onKeyDown={onKeyDown}\n >\n {items.map((entry, entryIndex) => {\n if ('type' in entry && entry.type === 'separator') {\n return <div key={`sep-${entryIndex}`} role=\"separator\" className=\"ansh-menu__separator\" />\n }\n\n if ('type' in entry && entry.type === 'label') {\n return (\n <div key={`label-${entryIndex}`} role=\"presentation\" className=\"ansh-menu__label\">\n {entry.label}\n </div>\n )\n }\n\n if ('type' in entry && entry.type === 'radio') {\n return (\n <div key={`radio-${entryIndex}`} role=\"group\" className=\"ansh-menu__group\">\n {entry.options.map((option) => {\n rowIndex++\n const index = rowIndex\n return (\n <div\n key={option.value}\n ref={(node) => {\n itemRefs.current[index] = node\n }}\n role=\"menuitemradio\"\n aria-checked={entry.value === option.value}\n aria-disabled={option.disabled || undefined}\n tabIndex={index === active ? 0 : -1}\n className={cx(\n 'ansh-menu__item',\n option.disabled && 'ansh-menu__item--disabled',\n )}\n onClick={() => activate(index)}\n onMouseEnter={() => !option.disabled && setActive(index)}\n >\n <span\n className={cx(\n 'ansh-menu__indicator',\n entry.value === option.value && 'ansh-menu__indicator--on',\n )}\n aria-hidden=\"true\"\n />\n <span className=\"ansh-menu__text\">{option.label}</span>\n </div>\n )\n })}\n </div>\n )\n }\n\n rowIndex++\n const index = rowIndex\n\n if ('type' in entry && entry.type === 'checkbox') {\n return (\n <div\n key={entry.id ?? `check-${entryIndex}`}\n ref={(node) => {\n itemRefs.current[index] = node\n }}\n role=\"menuitemcheckbox\"\n aria-checked={entry.checked}\n aria-disabled={entry.disabled || undefined}\n tabIndex={index === active ? 0 : -1}\n className={cx('ansh-menu__item', entry.disabled && 'ansh-menu__item--disabled')}\n onClick={() => activate(index)}\n onMouseEnter={() => !entry.disabled && setActive(index)}\n >\n <span\n className={cx(\n 'ansh-menu__indicator',\n 'ansh-menu__indicator--check',\n entry.checked && 'ansh-menu__indicator--on',\n )}\n aria-hidden=\"true\"\n >\n <svg viewBox=\"0 0 14 14\" width=\"10\" height=\"10\">\n <path\n d=\"M2.5 7.5l3 3 6-6.5\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n </svg>\n </span>\n <span className=\"ansh-menu__text\">{entry.label}</span>\n {entry.shortcut ? <kbd className=\"ansh-menu__shortcut\">{entry.shortcut}</kbd> : null}\n </div>\n )\n }\n\n if ('type' in entry && entry.type === 'submenu') {\n return (\n <Submenu\n key={entry.id ?? `sub-${entryIndex}`}\n ref={(node) => {\n itemRefs.current[index] = node\n }}\n entry={entry}\n active={index === active}\n open={openSubmenu === index}\n onOpenChange={(next) => setOpenSubmenu(next ? index : null)}\n onHover={() => setActive(index)}\n onCloseAll={onClose}\n />\n )\n }\n\n const action = entry as MenuAction\n return (\n <div\n key={action.id ?? `item-${entryIndex}`}\n ref={(node) => {\n itemRefs.current[index] = node\n }}\n role=\"menuitem\"\n aria-disabled={action.disabled || undefined}\n tabIndex={index === active ? 0 : -1}\n className={cx(\n 'ansh-menu__item',\n action.danger && 'ansh-menu__item--danger',\n action.disabled && 'ansh-menu__item--disabled',\n )}\n onClick={() => activate(index)}\n onMouseEnter={() => !action.disabled && setActive(index)}\n >\n {action.icon ? <span className=\"ansh-menu__icon\">{action.icon}</span> : null}\n <span className=\"ansh-menu__text\">{action.label}</span>\n {action.shortcut ? <kbd className=\"ansh-menu__shortcut\">{action.shortcut}</kbd> : null}\n </div>\n )\n })}\n </div>\n )\n}\n\ninterface SubmenuProps {\n ref: React.Ref<HTMLDivElement>\n entry: MenuSubmenu\n active: boolean\n open: boolean\n onOpenChange: (open: boolean) => void\n onHover: () => void\n onCloseAll: () => void\n}\n\nfunction Submenu({ ref, entry, active, open, onOpenChange, onHover, onCloseAll }: SubmenuProps) {\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const id = useId()\n\n const { mounted, state } = usePresence(open, panelRef)\n const position = useAnchoredPosition(triggerRef, panelRef, mounted, {\n placement: 'right-start',\n offset: 2,\n })\n\n useEffect(() => () => clearTimeout(timerRef.current), [])\n\n return (\n <>\n <div\n ref={(node) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node\n }}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? id : undefined}\n aria-disabled={entry.disabled || undefined}\n tabIndex={active ? 0 : -1}\n className={cx(\n 'ansh-menu__item',\n 'ansh-menu__item--submenu',\n entry.disabled && 'ansh-menu__item--disabled',\n )}\n onMouseEnter={() => {\n onHover()\n // A short delay before opening on hover, so dragging the pointer diagonally across a\n // submenu trigger toward another item doesn't flash a panel open.\n clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => onOpenChange(true), 120)\n }}\n onMouseLeave={() => {\n clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => onOpenChange(false), 200)\n }}\n onClick={() => onOpenChange(!open)}\n >\n {entry.icon ? <span className=\"ansh-menu__icon\">{entry.icon}</span> : null}\n <span className=\"ansh-menu__text\">{entry.label}</span>\n <span className=\"ansh-menu__chevron\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 12 12\" width=\"12\" height=\"12\">\n <path\n d=\"M4.5 2.5L8 6l-3.5 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </div>\n\n {mounted ? (\n <Portal>\n <div\n onMouseEnter={() => clearTimeout(timerRef.current)}\n onMouseLeave={() => {\n timerRef.current = setTimeout(() => onOpenChange(false), 200)\n }}\n onKeyDown={(event) => {\n // Left arrow closes the submenu and returns focus to its trigger — the inverse of\n // the Right arrow that opened it.\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n event.stopPropagation()\n onOpenChange(false)\n triggerRef.current?.focus()\n }\n }}\n >\n <MenuSurface\n ref={panelRef}\n id={id}\n items={entry.items}\n label={typeof entry.label === 'string' ? entry.label : 'Submenu'}\n state={state}\n style={position.style}\n onClose={onCloseAll}\n />\n </div>\n </Portal>\n ) : null}\n </>\n )\n}\n"]}
|