@ansh-ui/react 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RHTLNSVW.cjs → chunk-3SWO2M33.cjs} +7 -7
- package/dist/chunk-3SWO2M33.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-EGG4CP7C.js → chunk-BQJ6H3HC.js} +3 -2
- package/dist/chunk-BQJ6H3HC.js.map +1 -0
- package/dist/{chunk-LDCZQP3R.js → chunk-CWYBOVCZ.js} +3 -3
- package/dist/{chunk-LDCZQP3R.js.map → chunk-CWYBOVCZ.js.map} +1 -1
- package/dist/{chunk-AVPEA5PB.cjs → chunk-IZ6T7LO3.cjs} +4 -4
- package/dist/{chunk-AVPEA5PB.cjs.map → chunk-IZ6T7LO3.cjs.map} +1 -1
- package/dist/{chunk-C32LKF23.cjs → chunk-KTLTYHAT.cjs} +3 -3
- package/dist/chunk-KTLTYHAT.cjs.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-T4AK2KLM.js → chunk-PVDQPVYF.js} +3 -3
- package/dist/{chunk-T4AK2KLM.js.map → chunk-PVDQPVYF.js.map} +1 -1
- package/dist/{chunk-6VRF7X5C.cjs → chunk-TEPQGFR4.cjs} +19 -2
- package/dist/chunk-TEPQGFR4.cjs.map +1 -0
- package/dist/{chunk-QO3E7TJS.js → chunk-WNWGYXJY.js} +4 -4
- package/dist/chunk-WNWGYXJY.js.map +1 -0
- package/dist/{chunk-C5JG6TMM.cjs → chunk-YACOHFYJ.cjs} +27 -27
- package/dist/{chunk-C5JG6TMM.cjs.map → chunk-YACOHFYJ.cjs.map} +1 -1
- package/dist/data.d.cts +2 -1
- package/dist/data.d.ts +2 -1
- package/dist/form.cjs +37 -37
- package/dist/form.d.cts +2 -1
- package/dist/form.d.ts +2 -1
- package/dist/form.js +2 -2
- package/dist/index.cjs +641 -110
- 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 +526 -11
- 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-DoT_sTl1.d.ts} +3 -2
- package/dist/{motion-CSX4g2N8.d.cts → motion-DsQPOsTT.d.cts} +3 -2
- 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.d.cts +3 -2
- package/dist/navigation.d.ts +3 -2
- package/dist/overlay.cjs +16 -16
- package/dist/overlay.d.cts +3 -2
- package/dist/overlay.d.ts +3 -2
- 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-C32LKF23.cjs.map +0 -1
- package/dist/chunk-EGG4CP7C.js.map +0 -1
- package/dist/chunk-HO2YSF5O.js.map +0 -1
- package/dist/chunk-IBXLC5IE.js.map +0 -1
- package/dist/chunk-QO3E7TJS.js.map +0 -1
- package/dist/chunk-RHTLNSVW.cjs.map +0 -1
- package/dist/chunk-WGYNCSTP.cjs.map +0 -1
|
@@ -108,7 +108,7 @@ function useRovingFocus(options) {
|
|
|
108
108
|
if (items.length === 0) return;
|
|
109
109
|
const horizontal = orientation === "horizontal" || orientation === "both";
|
|
110
110
|
const vertical = orientation === "vertical" || orientation === "both";
|
|
111
|
-
let next
|
|
111
|
+
let next;
|
|
112
112
|
switch (event.key) {
|
|
113
113
|
case "ArrowRight":
|
|
114
114
|
if (!horizontal) return;
|
|
@@ -183,5 +183,5 @@ function Presence({ open, children }) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
export { Presence, Slot, countElements, getTabbable, slotted, useAutoFocus, useFocusRestore, useFocusTrap, usePresence, useRovingFocus };
|
|
186
|
-
//# sourceMappingURL=chunk-
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
186
|
+
//# sourceMappingURL=chunk-742E5FQS.js.map
|
|
187
|
+
//# sourceMappingURL=chunk-742E5FQS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/primitives/slot.tsx","../src/primitives/focus.ts","../src/primitives/presence.tsx"],"names":["Slot","useRef","useEffect"],"mappings":";;;;;AA+BO,IAAM,IAAA,GAAO,WAAmC,SAASA,KAAAA,CAC9D,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,EACzB,YAAA,EACA;AACA,EAAA,IAAI,CAAC,cAAA,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,C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AAA,IAAA,CAAK,gBAAA,CAAiB,gBAAgB,KAAK,CAAA;AAC3C,IAAA,IAAA,CAAK,gBAAA,CAAiB,iBAAiB,KAAK,CAAA;AAI5C,IAAA,UAAA,CAAW,UAAU,UAAA,CAAW,MAAM,UAAA,CAAW,KAAK,GAAG,GAAG,CAAA;AAE5D,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,mBAAA,CAAoB,gBAAgB,KAAK,CAAA;AAC9C,MAAA,IAAA,CAAK,mBAAA,CAAoB,iBAAiB,KAAK,CAAA;AAC/C,MAAA,YAAA,CAAa,WAAW,OAAO,CAAA;AAAA,IACjC,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,IAAA,EAAM,OAAA,EAAS,GAAG,CAAC,CAAA;AAEvB,EAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAC1B;AAgBO,SAAS,QAAA,CAAS,EAAE,IAAA,EAAM,QAAA,EAAS,EAAkB;AAC1D,EAAA,MAAM,GAAA,GAAMD,OAA2B,IAAI,CAAA;AAC3C,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAM,GAAI,WAAA,CAAY,MAAM,GAAG,CAAA;AAChD,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,uCAAU,QAAA,EAAA,QAAA,CAAS,EAAE,GAAA,EAAK,KAAA,EAAO,CAAA,EAAE,CAAA;AACrC","file":"chunk-742E5FQS.js","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: number\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"]}
|
|
@@ -3,6 +3,7 @@ import { cx } from './chunk-H34OXXJU.js';
|
|
|
3
3
|
import { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
+
// src/components/layout/shared.ts
|
|
6
7
|
function space(value) {
|
|
7
8
|
if (value === void 0) return void 0;
|
|
8
9
|
if (typeof value === "string") return value;
|
|
@@ -316,5 +317,5 @@ function Resizable({
|
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
export { AspectRatio, Center, Container, Divider, Grid, GridItem, HStack, Resizable, ScrollArea, Spacer, Stack, VStack };
|
|
319
|
-
//# sourceMappingURL=chunk-
|
|
320
|
-
//# sourceMappingURL=chunk-
|
|
320
|
+
//# sourceMappingURL=chunk-BQJ6H3HC.js.map
|
|
321
|
+
//# sourceMappingURL=chunk-BQJ6H3HC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/shared.ts","../src/components/layout/stack.tsx","../src/components/layout/grid.tsx","../src/components/layout/container.tsx","../src/components/layout/divider.tsx","../src/components/layout/spacer.tsx","../src/components/layout/center.tsx","../src/components/layout/aspect-ratio.tsx","../src/components/layout/scroll-area.tsx","../src/components/layout/resizable.tsx"],"names":["Stack","HStack","VStack","forwardRef","Grid","jsx","GridItem","Container","Divider","Center","AspectRatio","ScrollArea","jsxs"],"mappings":";;;;;;AAkBO,SAAS,MAAM,KAAA,EAAmD;AACvE,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,MAAA;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,OAAO,oBAAoB,KAAK,CAAA,CAAA,CAAA;AAClC;ACQO,IAAM,KAAA,GAAQ,UAAA,CAAW,SAASA,MAAAA,CACvC;AAAA,EACE,IAAI,SAAA,GAAY,KAAA;AAAA,EAChB,SAAA,GAAY,UAAA;AAAA,EACZ,GAAA,GAAM,CAAA;AAAA,EACN,KAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA,GAAO,KAAA;AAAA,EACP,OAAA,GAAU,KAAA;AAAA,EACV,MAAA,GAAS,KAAA;AAAA,EACT,SAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EACA,GAAA,EACA;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAA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AAA,EAAkB,SAAA,KAAc,YAAA,GAAe,UAAA,GAAa,YAAA;AAAA,YAC5D,eAAA,EAAe,IAAA,CAAK,KAAA,CAAM,KAAK,CAAA;AAAA,YAC/B,eAAA,EAAe,OAAA;AAAA,YACf,eAAA,EAAe,OAAA;AAAA,YACf,SAAA,EAAU,mCAAA;AAAA,YACV,aAAA;AAAA,YACA,SAAA;AAAA,YAGA,aAAA,EAAe,MAAM,QAAA,CAAS,EAAE,CAAA;AAAA,YAEhC,0BAAAA,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EAAmB,eAAY,MAAA,EAAO;AAAA;AAAA,SACxD;AAAA,wBAEAA,GAAAA,CAAC,KAAA,EAAA,EAAI,WAAU,kBAAA,EAAoB,QAAA,EAAA,QAAA,CAAS,CAAC,CAAA,EAAE;AAAA;AAAA;AAAA,GACjD;AAEJ","file":"chunk-BQJ6H3HC.js","sourcesContent":["import type { ElementType, HTMLAttributes, ReactNode } from 'react'\n\n/**\n * Layout primitives.\n *\n * These exist because every application rebuilds them, badly. The rebuilt versions hardcode gaps in\n * pixels, so they don't respond to a density setting; they use margins, so they collapse\n * unpredictably; and they don't handle the RTL case.\n *\n * Everything here takes a **token key**, not a raw value: `gap={4}` means `--ansh-space-4`, so a\n * layout is guaranteed to sit on the spacing scale. Passing an arbitrary string is still possible\n * for the genuine one-off, but the type nudges toward the scale first.\n */\n\n/** A key into the spacing scale, or a raw CSS length for the rare exception. */\nexport type SpaceToken =\n 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | (string & {})\n\nexport function space(value: SpaceToken | undefined): string | undefined {\n if (value === undefined) return undefined\n if (typeof value === 'string') return value\n return `var(--ansh-space-${value})`\n}\n\nexport interface BaseProps extends HTMLAttributes<HTMLElement> {\n as?: ElementType\n children?: ReactNode\n}\n","import { type CSSProperties, type ForwardedRef, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { type BaseProps, type SpaceToken, space } from './shared'\n\nexport interface StackProps extends BaseProps {\n /** Default `'vertical'` — the direction that needs a helper more often. */\n direction?: 'horizontal' | 'vertical'\n gap?: SpaceToken\n align?: CSSProperties['alignItems']\n justify?: CSSProperties['justifyContent']\n wrap?: boolean\n /** Grow to fill the cross axis. */\n stretch?: boolean\n /** Insert a hairline divider between children. */\n divide?: boolean\n}\n\n/**\n * One-dimensional flex layout.\n *\n * ```tsx\n * <Stack direction=\"horizontal\" gap={3} align=\"center\">\n * <Avatar src={user.avatar} name={user.name} />\n * <Stack gap={0.5}>\n * <strong>{user.name}</strong>\n * <Text tone=\"secondary\">{user.email}</Text>\n * </Stack>\n * </Stack>\n * ```\n */\nexport const Stack = forwardRef(function Stack(\n {\n as: Component = 'div',\n direction = 'vertical',\n gap = 4,\n align,\n justify,\n wrap = false,\n stretch = false,\n divide = false,\n className,\n style,\n ...rest\n }: StackProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={cx('ansh-stack', divide && 'ansh-stack--divide', className)}\n data-direction={direction}\n style={{\n display: 'flex',\n flexDirection: direction === 'horizontal' ? 'row' : 'column',\n gap: space(gap),\n alignItems: align ?? (stretch ? 'stretch' : undefined),\n justifyContent: justify,\n flexWrap: wrap ? 'wrap' : undefined,\n ...style,\n }}\n {...rest}\n />\n )\n})\n\n/** Horizontal `Stack`, for readability at call sites. */\nexport const HStack = forwardRef(function HStack(\n props: Omit<StackProps, 'direction'>,\n ref: ForwardedRef<HTMLElement>,\n) {\n return <Stack ref={ref} direction=\"horizontal\" {...props} />\n})\n\n/** Vertical `Stack`, for symmetry with `HStack`. */\nexport const VStack = forwardRef(function VStack(\n props: Omit<StackProps, 'direction'>,\n ref: ForwardedRef<HTMLElement>,\n) {\n return <Stack ref={ref} direction=\"vertical\" {...props} />\n})\n","import { type CSSProperties, type ForwardedRef, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { type BaseProps, type SpaceToken, space } from './shared'\n\nexport interface GridProps extends BaseProps {\n /** Fixed column count, or `'auto'` for a responsive `auto-fill` track. */\n columns?: number | 'auto'\n /** Minimum column width when `columns=\"auto\"`. Default `'16rem'`. */\n minColumnWidth?: string\n gap?: SpaceToken\n /** Row gap, when it should differ from the column gap. */\n rowGap?: SpaceToken\n align?: CSSProperties['alignItems']\n}\n\n/**\n * Two-dimensional layout.\n *\n * `columns=\"auto\"` uses `repeat(auto-fill, minmax(min(N, 100%), 1fr))`. The inner `min()` is what\n * stops the grid overflowing on a phone: without it, a 16rem minimum on a 15rem-wide viewport\n * produces a track wider than the screen and a horizontal scrollbar.\n */\nexport const Grid = forwardRef(function Grid(\n {\n as: Component = 'div',\n columns = 'auto',\n minColumnWidth = '16rem',\n gap = 4,\n rowGap,\n align,\n className,\n style,\n ...rest\n }: GridProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={cx('ansh-grid', className)}\n style={{\n display: 'grid',\n gridTemplateColumns:\n columns === 'auto'\n ? `repeat(auto-fill, minmax(min(${minColumnWidth}, 100%), 1fr))`\n : `repeat(${columns}, minmax(0, 1fr))`,\n gap: space(gap),\n rowGap: space(rowGap),\n alignItems: align,\n ...style,\n }}\n {...rest}\n />\n )\n})\n\nexport interface GridItemProps extends BaseProps {\n /** Columns to span. `'full'` spans the whole row. */\n span?: number | 'full'\n rowSpan?: number\n}\n\nexport const GridItem = forwardRef(function GridItem(\n { as: Component = 'div', span, rowSpan, className, style, ...rest }: GridItemProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={className}\n style={{\n gridColumn: span === 'full' ? '1 / -1' : span ? `span ${span} / span ${span}` : undefined,\n gridRow: rowSpan ? `span ${rowSpan} / span ${rowSpan}` : undefined,\n // `minWidth: 0` on every grid child. Without it a child containing a long unbroken string\n // or a table refuses to shrink below its content width and blows out the track.\n minWidth: 0,\n ...style,\n }}\n {...rest}\n />\n )\n})\n","import { type ForwardedRef, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { type BaseProps, type SpaceToken, space } from './shared'\n\nexport interface ContainerProps extends BaseProps {\n /** Max content width. Default `'lg'` (72rem). */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'\n /** Horizontal padding. Default `6`. */\n padding?: SpaceToken\n}\n\nconst CONTAINER_WIDTH = {\n sm: '40rem',\n md: '56rem',\n lg: '72rem',\n xl: '90rem',\n full: '100%',\n} as const\n\n/** Centred, width-constrained page content. */\nexport const Container = forwardRef(function Container(\n { as: Component = 'div', size = 'lg', padding = 6, className, style, ...rest }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={cx('ansh-container', className)}\n style={{\n width: '100%',\n maxWidth: CONTAINER_WIDTH[size],\n marginInline: 'auto',\n paddingInline: space(padding),\n ...style,\n }}\n {...rest}\n />\n )\n})\n","import { type ForwardedRef, type HTMLAttributes, type ReactNode, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { type BaseProps } from './shared'\n\nexport interface DividerProps extends Omit<BaseProps, 'children'> {\n orientation?: 'horizontal' | 'vertical'\n /** Optional label rendered in the middle of the rule. */\n label?: ReactNode\n}\n\n/**\n * A rule.\n *\n * With a label it becomes a labelled separator — the \"or continue with\" divider on a sign-in form.\n * `role=\"separator\"` is set only when there's no label; with one, it's a heading-like element and\n * announcing it as a separator loses the text.\n */\nexport const Divider = forwardRef(function Divider(\n { orientation = 'horizontal', label, className, ...rest }: DividerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n if (label) {\n return (\n <div\n ref={ref}\n className={cx('ansh-divider', 'ansh-divider--labelled', className)}\n {...(rest as HTMLAttributes<HTMLDivElement>)}\n >\n <span className=\"ansh-divider__line\" />\n <span className=\"ansh-divider__label\">{label}</span>\n <span className=\"ansh-divider__line\" />\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-orientation={orientation}\n className={cx('ansh-divider', `ansh-divider--${orientation}`, className)}\n {...(rest as HTMLAttributes<HTMLDivElement>)}\n />\n )\n})\n","import { type SpaceToken, space } from './shared'\n\nexport interface SpacerProps {\n size?: SpaceToken\n /** Grow to absorb free space in a flex container. */\n grow?: boolean\n}\n\n/** Explicit empty space. `grow` pushes siblings apart in a flex row. */\nexport function Spacer({ size, grow = false }: SpacerProps) {\n return (\n <span\n aria-hidden=\"true\"\n style={{\n display: 'block',\n flexGrow: grow ? 1 : 0,\n flexShrink: 0,\n ...(size !== undefined ? { width: space(size), height: space(size) } : null),\n }}\n />\n )\n}\n","import { type ForwardedRef, forwardRef } from 'react'\nimport { type BaseProps } from './shared'\n\n/** Centre a child on both axes. */\nexport const Center = forwardRef(function Center(\n { as: Component = 'div', className, style, ...rest }: BaseProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={className}\n style={{ display: 'grid', placeItems: 'center', ...style }}\n {...rest}\n />\n )\n})\n","import { type ForwardedRef, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport type { BaseProps } from './shared'\n\nexport interface AspectRatioProps extends BaseProps {\n /** Width ÷ height. `16 / 9` reads better than `1.777`. Default `16 / 9`. */\n ratio?: number\n}\n\n/**\n * Reserve space at a fixed aspect ratio.\n *\n * Uses the `aspect-ratio` property rather than the padding-top hack. The reserved space is what\n * matters: an image that loads without it shifts everything below, which is a Cumulative Layout\n * Shift penalty and the most common cause of a failing Core Web Vitals score.\n */\nexport const AspectRatio = forwardRef(function AspectRatio(\n { as: Component = 'div', ratio = 16 / 9, className, style, ...rest }: AspectRatioProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={cx('ansh-aspect', className)}\n style={{ aspectRatio: String(ratio), ...style }}\n {...rest}\n />\n )\n})\n","import { type ForwardedRef, forwardRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { type BaseProps } from './shared'\n\nexport interface ScrollAreaProps extends BaseProps {\n /** Max height before scrolling starts. */\n maxHeight?: string\n axis?: 'y' | 'x' | 'both'\n /** Fade the content at the scrollable edges. Default `true`. */\n fade?: boolean\n}\n\n/**\n * A scroll container with styled scrollbars and edge fades.\n *\n * The native scrollbar is kept — a JavaScript-rendered one breaks keyboard scrolling, mobile\n * momentum, and the OS \"scroll bar is always visible\" accessibility setting. It is only *styled*,\n * via `scrollbar-width`/`scrollbar-color` with a `::-webkit-scrollbar` fallback.\n *\n * The edge fade is a mask that appears only when there is more content in that direction. It is\n * driven by `animation-timeline: scroll()` where supported, so it costs nothing on the main thread\n * and degrades to no fade where it isn't.\n */\nexport const ScrollArea = forwardRef(function ScrollArea(\n {\n as: Component = 'div',\n maxHeight,\n axis = 'y',\n fade = true,\n className,\n style,\n ...rest\n }: ScrollAreaProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <Component\n ref={ref}\n className={cx('ansh-scroll', fade && 'ansh-scroll--fade', className)}\n data-axis={axis}\n style={{\n maxHeight,\n overflowY: axis === 'x' ? 'hidden' : 'auto',\n overflowX: axis === 'y' ? 'hidden' : 'auto',\n ...style,\n }}\n {...rest}\n />\n )\n})\n","import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { useControllableState } from '../../primitives/use-controllable-state'\n\nexport interface ResizableProps {\n /** Exactly two children: the two panes. */\n children: [ReactNode, ReactNode]\n direction?: 'horizontal' | 'vertical'\n /** First pane's size as a percentage, `0`–`100`. Default `50`. */\n defaultSize?: number\n size?: number\n onSizeChange?: (size: number) => void\n /** Clamp, as percentages. Defaults `10` and `90`. */\n minSize?: number\n maxSize?: number\n /** Snap points in percent, e.g. `[25, 50, 75]`. Within 3% the handle snaps. */\n snapPoints?: readonly number[]\n className?: string\n /** Accessible name for the handle — \"Resize sidebar\", not \"Resize\". */\n label?: string\n}\n\n/**\n * A two-pane split with a draggable divider.\n *\n * The layout every IDE, mail client and admin console needs, and the one most often shipped as\n * mouse-only. The handle here is a real `role=\"separator\"` with `aria-valuenow`, and arrow keys\n * move it in 2% steps — WAI-ARIA calls this a window splitter and it is a documented pattern, not\n * an invention.\n *\n * Sizes are percentages rather than pixels so the split survives a window resize proportionally.\n * Dragging writes to a CSS custom property directly, bypassing React: a re-render per pointer move\n * makes the drag feel heavy on a complex page, and the value is only committed to state on release.\n */\nexport function Resizable({\n children,\n direction = 'horizontal',\n defaultSize = 50,\n size,\n onSizeChange,\n minSize = 10,\n maxSize = 90,\n snapPoints,\n className,\n label = 'Resize panes',\n}: ResizableProps) {\n const [value, setValue] = useControllableState<number>({\n value: size,\n defaultValue: defaultSize,\n onChange: onSizeChange,\n })\n\n const containerRef = useRef<HTMLDivElement | null>(null)\n const [dragging, setDragging] = useState(false)\n\n const clamp = useCallback(\n (next: number) => {\n let result = Math.min(Math.max(next, minSize), maxSize)\n if (snapPoints) {\n for (const point of snapPoints) {\n if (Math.abs(result - point) < 3) {\n result = point\n break\n }\n }\n }\n return result\n },\n [minSize, maxSize, snapPoints],\n )\n\n const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n const container = containerRef.current\n if (!container) return\n\n // Pointer capture keeps events coming to the handle even when the pointer outruns it, which\n // it will — a fast drag easily leaves the 8px handle behind and the drag would otherwise stop\n // dead mid-gesture.\n event.currentTarget.setPointerCapture(event.pointerId)\n setDragging(true)\n\n let latest = value\n\n const onMove = (moveEvent: PointerEvent) => {\n const rect = container.getBoundingClientRect()\n const fraction =\n direction === 'horizontal'\n ? (moveEvent.clientX - rect.left) / rect.width\n : (moveEvent.clientY - rect.top) / rect.height\n\n latest = clamp(fraction * 100)\n // Written straight to the DOM. React state is updated once, on release.\n container.style.setProperty('--ansh-split', `${latest}%`)\n }\n\n const onUp = () => {\n setDragging(false)\n setValue(latest)\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onUp)\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onUp)\n }\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const step = event.shiftKey ? 10 : 2\n const forward = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown'\n const backward = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp'\n\n let next: number | null = null\n if (event.key === forward) next = value + step\n else if (event.key === backward) next = value - step\n else if (event.key === 'Home') next = minSize\n else if (event.key === 'End') next = maxSize\n // Enter toggles between collapsed and the midpoint — the shortcut people expect from a\n // collapsible sidebar, and the only way to fully collapse without a mouse.\n else if (event.key === 'Enter') next = value <= minSize + 1 ? 50 : minSize\n\n if (next === null) return\n event.preventDefault()\n setValue(clamp(next))\n }\n\n // Keep the custom property in sync when the value changes from outside a drag (controlled\n // updates, keyboard steps). During a drag the pointer handler owns it.\n useEffect(() => {\n if (dragging) return\n containerRef.current?.style.setProperty('--ansh-split', `${value}%`)\n }, [value, dragging])\n\n return (\n <div\n ref={containerRef}\n className={cx(\n 'ansh-split',\n `ansh-split--${direction}`,\n dragging && 'ansh-split--dragging',\n className,\n )}\n style={{ ['--ansh-split' as string]: `${value}%` }}\n >\n <div className=\"ansh-split__pane\">{children[0]}</div>\n\n <div\n role=\"separator\"\n tabIndex={0}\n aria-label={label}\n aria-orientation={direction === 'horizontal' ? 'vertical' : 'horizontal'}\n aria-valuenow={Math.round(value)}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n className=\"ansh-split__handle ansh-focusable\"\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n // Double-click resets to centre. Undocumented in the UI but universally expected, and\n // harmless to discover by accident.\n onDoubleClick={() => setValue(50)}\n >\n <span className=\"ansh-split__grip\" aria-hidden=\"true\" />\n </div>\n\n <div className=\"ansh-split__pane\">{children[1]}</div>\n </div>\n )\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Slot, usePresence, useFocusTrap, useAutoFocus, useFocusRestore } from './chunk-
|
|
1
|
+
import { Slot, usePresence, useFocusTrap, useAutoFocus, useFocusRestore } from './chunk-742E5FQS.js';
|
|
2
2
|
import { useAnchoredPosition, useDismiss, Portal, useScrollLock } from './chunk-XEP6P7E6.js';
|
|
3
3
|
import { useControllableState } from './chunk-LXCIXR5T.js';
|
|
4
4
|
import { cx } from './chunk-H34OXXJU.js';
|
|
@@ -1181,5 +1181,5 @@ function Submenu({ ref, entry, active, open, onOpenChange, onHover, onCloseAll }
|
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
1183
|
export { AlertDialog, CommandPalette, ContextMenu, Dialog, DialogFooter, Drawer, DropdownMenu, HoverCard, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipProvider, useCommandShortcut };
|
|
1184
|
-
//# sourceMappingURL=chunk-
|
|
1185
|
-
//# sourceMappingURL=chunk-
|
|
1184
|
+
//# sourceMappingURL=chunk-CWYBOVCZ.js.map
|
|
1185
|
+
//# sourceMappingURL=chunk-CWYBOVCZ.js.map
|