@fanvue/ui 3.41.0 → 3.42.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.
@@ -1 +1 @@
1
- {"version":3,"file":"TabsList.cjs","sources":["../../../../src/components/Tabs/TabsList.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Breakpoint values for responsive props. */\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst alignLeftClasses: Record<Breakpoint | \"always\", string> = {\n always: \"[&>[role=tab]]:flex-initial\",\n sm: \"[&>[role=tab]]:sm:flex-initial\",\n md: \"[&>[role=tab]]:md:flex-initial\",\n lg: \"[&>[role=tab]]:lg:flex-initial\",\n xl: \"[&>[role=tab]]:xl:flex-initial\",\n};\n\nfunction getLayoutClass(\n variant: \"fill\" | \"hug\" | undefined,\n fullWidth: boolean,\n alignLeft?: boolean | Breakpoint,\n): string {\n if (variant === \"hug\") return \"inline-flex\";\n if (variant === \"fill\") return \"flex w-full [&>[role=tab]]:flex-1\";\n\n if (!fullWidth) return \"inline-flex\";\n\n const base = \"flex w-full [&>[role=tab]]:flex-1\";\n if (alignLeft === true) return `${base} ${alignLeftClasses.always}`;\n if (typeof alignLeft === \"string\") return `${base} ${alignLeftClasses[alignLeft]}`;\n return base;\n}\n\n/** Props for the {@link TabsList} component. */\nexport type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n /** When `true` (the default), the tab list spans the full width of its container and each tab grows equally. Set to `false` for inline sizing. */\n fullWidth?: boolean;\n /**\n * Controls tab alignment within a full-width container.\n * - `false` (default): tabs spread evenly\n * - `true`: tabs left-aligned, sized to content\n * - `\"md\"` (breakpoint): spread on mobile, left-aligned at breakpoint and up\n */\n alignLeft?: boolean | Breakpoint;\n /** Explicit layout variant. `\"hug\"` sizes the list to its content; `\"fill\"` stretches it full-width with equal-width tabs. Takes precedence over `fullWidth`/`alignLeft`. */\n variant?: \"fill\" | \"hug\";\n /**\n * Drops the leading padding on the first tab so its label sits flush with the\n * list's left edge, lining it up with page content above or below the bar\n * (a heading, for instance) rather than being indented by the tab's own\n * padding. Spacing between tabs is unaffected. Pair with `alignLeft` or\n * `variant=\"hug\"`. @default false\n */\n flushLeft?: boolean;\n /**\n * Scrolls the row horizontally when the tabs don't fit, instead of letting\n * them compress. By default a tab may shrink until its label ellipsises,\n * which on a narrow viewport can truncate every label at once; here each tab\n * keeps its natural width and the overflow scrolls. The scrollbar itself is\n * hidden — the clipped tab at the edge is the affordance.\n *\n * Because the tabs are content-sized, they no longer spread to fill the row:\n * a set that does fit sits left-aligned, as with `alignLeft`.\n *\n * Horizontal orientation only: a vertical list already grows downwards.\n * @default false\n */\n scrollable?: boolean;\n};\n\n/** Container for {@link TabsTrigger} elements. Renders a sliding active-tab indicator that animates between tabs. */\nexport const TabsList = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.List>,\n TabsListProps\n>(\n (\n {\n className,\n children,\n fullWidth = true,\n alignLeft,\n variant,\n flushLeft = false,\n scrollable = false,\n ...props\n },\n ref,\n ) => {\n const innerRef = React.useRef<HTMLDivElement>(null);\n const indicatorRef = React.useRef<HTMLSpanElement>(null);\n\n React.useImperativeHandle(ref, () => innerRef.current as HTMLDivElement);\n\n const updateIndicator = React.useCallback(() => {\n const list = innerRef.current;\n const indicator = indicatorRef.current;\n if (!list || !indicator) return;\n\n const activeTab = list.querySelector<HTMLElement>('[data-state=\"active\"]');\n if (!activeTab) {\n indicator.style.opacity = \"0\";\n return;\n }\n\n const isVertical = list.dataset.orientation === \"vertical\";\n\n indicator.style.opacity = \"1\";\n\n if (isVertical) {\n indicator.style.background =\n \"linear-gradient(180deg, var(--color-buttons-tertiary-default) 0%, var(--color-tab-active) 50%, var(--color-buttons-tertiary-default) 100%)\";\n indicator.style.inset = `0 -1px auto auto`;\n indicator.style.width = \"1px\";\n indicator.style.height = `${activeTab.offsetHeight}px`;\n indicator.style.transform = `translateY(${activeTab.offsetTop}px)`;\n } else {\n indicator.style.background =\n \"linear-gradient(90deg, var(--color-buttons-tertiary-default) 0%, var(--color-tab-active) 50%, var(--color-buttons-tertiary-default) 100%)\";\n indicator.style.inset = \"auto auto 0 0\";\n indicator.style.height = \"1px\";\n indicator.style.width = `${activeTab.offsetWidth}px`;\n indicator.style.transform = `translateX(${activeTab.offsetLeft}px)`;\n }\n }, []);\n\n // Radix scrolls a tab into view when it takes focus, and mount is not focus, so\n // URL-driven state can land on a tab that is off to the right with nothing on\n // screen to say so: no indicator, and tab one showing as though it were active.\n // Assigns `scrollLeft` rather than calling `scrollIntoView`, which would also\n // scroll every ancestor and the page with it. Only ever scrolls further right, so\n // re-running it after the webfont settles corrects a short initial scroll without\n // yanking the row back from wherever the user has since dragged it.\n const revealActiveTab = React.useCallback(() => {\n const list = innerRef.current;\n if (!list || !scrollable || list.dataset.orientation === \"vertical\") return;\n const activeTab = list.querySelector<HTMLElement>('[data-state=\"active\"]');\n if (!activeTab) return;\n const overshoot = activeTab.offsetLeft + activeTab.offsetWidth - list.clientWidth;\n if (overshoot > list.scrollLeft) list.scrollLeft = overshoot;\n }, [scrollable]);\n\n React.useLayoutEffect(() => {\n const list = innerRef.current;\n const indicator = indicatorRef.current;\n if (!list || !indicator) return;\n\n indicator.style.transitionDuration = \"0s\";\n updateIndicator();\n indicator.getBoundingClientRect();\n indicator.style.transitionDuration = \"\";\n revealActiveTab();\n\n const mutationObserver = new MutationObserver(updateIndicator);\n mutationObserver.observe(list, {\n attributes: true,\n attributeFilter: [\"data-state\"],\n childList: true,\n subtree: true,\n });\n\n const resizeObserver = new ResizeObserver(updateIndicator);\n resizeObserver.observe(list);\n\n let cancelled = false;\n if (document.fonts?.status !== \"loaded\") {\n document.fonts?.ready.then(() => {\n if (cancelled) return;\n updateIndicator();\n // The tabs are wider once the real font is in, so the mount-time scroll can\n // fall short of the active tab. Recomputed here against the settled layout.\n revealActiveTab();\n });\n }\n\n return () => {\n cancelled = true;\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n };\n }, [updateIndicator, revealActiveTab]);\n\n return (\n <TabsPrimitive.List\n ref={innerRef}\n className={cn(\n // `isolate` scopes the active indicator's `z-10` to a local stacking\n // context. Without it, `relative` alone creates no stacking context, so\n // the indicator escapes and paints above page chrome (e.g. the header).\n \"relative isolate\",\n getLayoutClass(variant, fullWidth, alignLeft),\n // Horizontal only: in the vertical orientation the leading padding is\n // the row's left inset, not a label offset, so zeroing it would pull\n // the first label out of line with the others.\n flushLeft && \"data-[orientation=horizontal]:[&>[role=tab]:first-child]:pl-0\",\n // `flex-none` is what stops the tabs compressing — without it they\n // share the row and never overflow, so there is nothing to scroll.\n // The scrollbar is hidden in both engines: Firefox reads\n // `scrollbar-width`, WebKit and Blink the pseudo-element.\n scrollable &&\n \"data-[orientation=horizontal]:overflow-x-auto data-[orientation=horizontal]:[scrollbar-width:none] data-[orientation=horizontal]:[&::-webkit-scrollbar]:hidden data-[orientation=horizontal]:[&>[role=tab]]:flex-none\",\n \"data-[orientation=horizontal]:items-center data-[orientation=horizontal]:shadow-[inset_0_-1px_0_0_var(--color-border-primary)]\",\n \"data-[orientation=vertical]:flex-col data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--color-border-primary)]\",\n className,\n )}\n {...props}\n >\n {children}\n <span\n ref={indicatorRef}\n aria-hidden\n className=\"pointer-events-none absolute z-10 rounded-full motion-safe:transition-[transform,width,height] motion-safe:duration-200 motion-safe:ease-in-out\"\n style={{ opacity: 0 }}\n />\n </TabsPrimitive.List>\n );\n },\n);\n\nTabsList.displayName = \"TabsList\";\n"],"names":["React","jsxs","TabsPrimitive","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,mBAA0D;AAAA,EAC9D,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAAS,e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A;AAAAA;AAAAA;AAAAA,UAIT;AAAA,UACA,eAAe,SAAS,WAAW,SAAS;AAAA;AAAA;AAAA;AAAA,UAI5C,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,UAKb,cACE;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA;AAAA,UACDC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,eAAW;AAAA,cACX,WAAU;AAAA,cACV,OAAO,EAAE,SAAS,EAAA;AAAA,YAAE;AAAA,UAAA;AAAA,QACtB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;;"}
1
+ {"version":3,"file":"TabsList.cjs","sources":["../../../../src/components/Tabs/TabsList.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Breakpoint values for responsive props. */\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\n/** Visual style of a {@link TabsList}. */\nexport type TabsListAppearance = \"underline\" | \"pill\";\n\n/** Height in pixels of each tab in a pill {@link TabsList}. */\nexport type TabsListPillSize = \"32\" | \"36\";\n\nexport const TabsAppearanceContext = React.createContext<{\n appearance: TabsListAppearance;\n size: TabsListPillSize;\n}>({ appearance: \"underline\", size: \"32\" });\n\ntype TabBox = { left: number; top: number; width: number; height: number };\n\nconst PILL_EASE = \"cubic-bezier(0.22, 1, 0.36, 1)\";\nconst PILL_STEP_MS = 360;\nconst PILL_STEP_MS_TOUCH = 200;\nconst PILL_EXTRA_STEP_MS = 220;\nconst PILL_MAX_MS = 1000;\n/** Share of a slide by which the eased pill has covered 80% of the way, so the label recolours under it. */\nconst PILL_ARRIVAL_SHARE = 0.27;\n\nfunction pillStepMs(canHover: boolean) {\n return canHover ? PILL_STEP_MS : PILL_STEP_MS_TOUCH;\n}\n\nfunction pillSlideMs(distance: number, canHover: boolean) {\n if (!canHover) return PILL_STEP_MS_TOUCH;\n return Math.min(PILL_STEP_MS + Math.max(distance - 1, 0) * PILL_EXTRA_STEP_MS, PILL_MAX_MS);\n}\n\nconst prefersReducedMotion = () =>\n window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches ?? false;\n\nfunction pillTarget(list: HTMLElement, hovered: HTMLElement | null, activeTab: HTMLElement) {\n return (\n list.querySelector<HTMLElement>('[role=\"tab\"][aria-expanded=\"true\"]') ??\n (hovered?.isConnected ? hovered : activeTab)\n );\n}\n\nfunction measureTabs(list: HTMLElement, observer: ResizeObserver | null) {\n const boxes = new Map<Element, TabBox>();\n const order = new Map<Element, number>();\n for (const tab of list.querySelectorAll<HTMLElement>('[role=\"tab\"]')) {\n observer?.observe(tab);\n order.set(tab, order.size);\n boxes.set(tab, {\n left: tab.offsetLeft,\n top: tab.offsetTop,\n width: tab.offsetWidth,\n height: tab.offsetHeight,\n });\n }\n return { boxes, order };\n}\n\nfunction slideFromPrevious(\n list: HTMLElement,\n previous: Map<Element, TabBox>,\n next: Map<Element, TabBox>,\n durationMs: number,\n) {\n const moved: HTMLElement[] = [];\n for (const [tab, box] of next) {\n const before = previous.get(tab);\n if (!before || before.left === box.left || !(tab instanceof HTMLElement)) continue;\n tab.style.transition = \"none\";\n tab.style.transform = `translateX(${before.left - box.left}px)`;\n moved.push(tab);\n }\n if (moved.length === 0) return;\n list.getBoundingClientRect();\n for (const tab of moved) {\n tab.style.transition = `transform ${durationMs}ms var(--pill-ease)`;\n tab.style.transform = \"\";\n const settle = (event: TransitionEvent) => {\n if (event.propertyName !== \"transform\") return;\n tab.style.transition = \"\";\n tab.removeEventListener(\"transitionend\", settle);\n };\n tab.addEventListener(\"transitionend\", settle);\n }\n}\n\nconst alignLeftClasses: Record<Breakpoint | \"always\", string> = {\n always: \"[&>[role=tab]]:flex-initial\",\n sm: \"[&>[role=tab]]:sm:flex-initial\",\n md: \"[&>[role=tab]]:md:flex-initial\",\n lg: \"[&>[role=tab]]:lg:flex-initial\",\n xl: \"[&>[role=tab]]:xl:flex-initial\",\n};\n\nfunction getLayoutClass(\n variant: \"fill\" | \"hug\" | undefined,\n fullWidth: boolean,\n alignLeft?: boolean | Breakpoint,\n): string {\n if (variant === \"hug\") return \"inline-flex\";\n if (variant === \"fill\") return \"flex w-full [&>[role=tab]]:flex-1\";\n\n if (!fullWidth) return \"inline-flex\";\n\n const base = \"flex w-full [&>[role=tab]]:flex-1\";\n if (alignLeft === true) return `${base} ${alignLeftClasses.always}`;\n if (typeof alignLeft === \"string\") return `${base} ${alignLeftClasses[alignLeft]}`;\n return base;\n}\n\n/** Props for the {@link TabsList} component. */\nexport type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n /** When `true` (the default), the tab list spans the full width of its container and each tab grows equally. Set to `false` for inline sizing. */\n fullWidth?: boolean;\n /**\n * Controls tab alignment within a full-width container.\n * - `false` (default): tabs spread evenly\n * - `true`: tabs left-aligned, sized to content\n * - `\"md\"` (breakpoint): spread on mobile, left-aligned at breakpoint and up\n */\n alignLeft?: boolean | Breakpoint;\n /** Explicit layout variant. `\"hug\"` sizes the list to its content; `\"fill\"` stretches it full-width with equal-width tabs. Takes precedence over `fullWidth`/`alignLeft`. */\n variant?: \"fill\" | \"hug\";\n /**\n * Drops the leading padding on the first tab so its label sits flush with the\n * list's left edge, lining it up with page content above or below the bar\n * (a heading, for instance) rather than being indented by the tab's own\n * padding. Spacing between tabs is unaffected. Pair with `alignLeft` or\n * `variant=\"hug\"`. @default false\n */\n flushLeft?: boolean;\n /**\n * Scrolls the row horizontally when the tabs don't fit, instead of letting\n * them compress. By default a tab may shrink until its label ellipsises,\n * which on a narrow viewport can truncate every label at once; here each tab\n * keeps its natural width and the overflow scrolls. The scrollbar itself is\n * hidden — the clipped tab at the edge is the affordance.\n *\n * Because the tabs are content-sized, they no longer spread to fill the row:\n * a set that does fit sits left-aligned, as with `alignLeft`.\n *\n * Horizontal orientation only: a vertical list already grows downwards.\n * @default false\n */\n scrollable?: boolean;\n /**\n * `\"underline\"` marks the active tab with a line under the row. `\"pill\"` sits\n * the tabs in a rounded track, sized to its tabs, and slides a filled pill\n * behind the active one. A pill list is horizontal and ignores `fullWidth`,\n * `alignLeft`, `variant` and `flushLeft`; it scrolls when it doesn't fit.\n * @default \"underline\"\n */\n appearance?: TabsListAppearance;\n /** Height of each tab in a pill list. Ignored by the underline appearance. @default \"32\" */\n size?: TabsListPillSize;\n /**\n * Pill only: the pill follows the mouse across the tabs and settles back on the\n * selected one when the pointer leaves. Mouse only, and off when the user prefers\n * reduced motion. @default false\n */\n followHover?: boolean;\n};\n\n/** Container for {@link TabsTrigger} elements. Renders a sliding active-tab indicator that animates between tabs. */\nexport const TabsList = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.List>,\n TabsListProps\n>(\n (\n {\n className,\n children,\n fullWidth = true,\n alignLeft,\n variant,\n flushLeft = false,\n scrollable = false,\n appearance = \"underline\",\n size = \"32\",\n followHover = false,\n onPointerOver,\n onPointerLeave,\n style,\n ...props\n },\n ref,\n ) => {\n const innerRef = React.useRef<HTMLDivElement>(null);\n const indicatorRef = React.useRef<HTMLSpanElement>(null);\n\n React.useImperativeHandle(ref, () => innerRef.current as HTMLDivElement);\n\n const tabBoxes = React.useRef(new Map<Element, TabBox>());\n const resizeObserverRef = React.useRef<ResizeObserver | null>(null);\n const listWidth = React.useRef<number | null>(null);\n const hoveredTab = React.useRef<HTMLElement | null>(null);\n const pillTab = React.useRef<HTMLElement | null>(null);\n const tabOrder = React.useRef(new Map<Element, number>());\n const canHover = React.useRef(false);\n\n const placePill = React.useCallback((tab: HTMLElement) => {\n const list = innerRef.current;\n const indicator = indicatorRef.current;\n if (!list || !indicator) return;\n const box = tabBoxes.current.get(tab);\n if (!box) return;\n const from = pillTab.current;\n pillTab.current = tab;\n const distance =\n from && from !== tab\n ? Math.abs((tabOrder.current.get(tab) ?? 0) - (tabOrder.current.get(from) ?? 0))\n : 0;\n const slideMs = pillSlideMs(distance, canHover.current);\n list.style.setProperty(\"--pill-slide\", `${slideMs}ms`);\n list.style.setProperty(\"--pill-arrive\", `${Math.round(slideMs * PILL_ARRIVAL_SHARE)}ms`);\n indicator.style.width = `${box.width}px`;\n indicator.style.height = `${box.height}px`;\n indicator.style.transform = `translate(${box.left}px, ${box.top}px)`;\n for (const marked of list.querySelectorAll(\"[data-pill]\")) {\n if (marked !== tab) marked.removeAttribute(\"data-pill\");\n }\n tab.setAttribute(\"data-pill\", \"\");\n }, []);\n\n const layoutPill = React.useCallback(\n (list: HTMLElement, indicator: HTMLElement, activeTab: HTMLElement) => {\n indicator.style.background = \"var(--color-content-primary)\";\n indicator.style.inset = \"0 auto auto 0\";\n const previous = tabBoxes.current;\n const rowResized = listWidth.current !== null && listWidth.current !== list.offsetWidth;\n listWidth.current = list.offsetWidth;\n const { boxes, order } = measureTabs(list, resizeObserverRef.current);\n tabBoxes.current = boxes;\n tabOrder.current = order;\n if (!rowResized && previous.size > 0 && !prefersReducedMotion()) {\n slideFromPrevious(list, previous, boxes, pillStepMs(canHover.current));\n }\n placePill(pillTarget(list, hoveredTab.current, activeTab));\n },\n [placePill],\n );\n\n const updateIndicator = React.useCallback(() => {\n const list = innerRef.current;\n const indicator = indicatorRef.current;\n if (!list || !indicator) return;\n\n const activeTab = list.querySelector<HTMLElement>('[data-state=\"active\"]');\n if (!activeTab) {\n indicator.style.opacity = \"0\";\n list.querySelector(\"[data-pill]\")?.removeAttribute(\"data-pill\");\n return;\n }\n\n const isVertical = list.dataset.orientation === \"vertical\";\n\n indicator.style.opacity = \"1\";\n\n if (appearance === \"pill\") {\n layoutPill(list, indicator, activeTab);\n } else if (isVertical) {\n indicator.style.background =\n \"linear-gradient(180deg, var(--color-buttons-tertiary-default) 0%, var(--color-tab-active) 50%, var(--color-buttons-tertiary-default) 100%)\";\n indicator.style.inset = `0 -1px auto auto`;\n indicator.style.width = \"1px\";\n indicator.style.height = `${activeTab.offsetHeight}px`;\n indicator.style.transform = `translateY(${activeTab.offsetTop}px)`;\n } else {\n indicator.style.background =\n \"linear-gradient(90deg, var(--color-buttons-tertiary-default) 0%, var(--color-tab-active) 50%, var(--color-buttons-tertiary-default) 100%)\";\n indicator.style.inset = \"auto auto 0 0\";\n indicator.style.height = \"1px\";\n indicator.style.width = `${activeTab.offsetWidth}px`;\n indicator.style.transform = `translateX(${activeTab.offsetLeft}px)`;\n }\n }, [appearance, layoutPill]);\n\n const followsHover = appearance === \"pill\" && followHover;\n\n const handlePointerOver = (event: React.PointerEvent<HTMLDivElement>) => {\n onPointerOver?.(event);\n if (!followsHover || event.pointerType !== \"mouse\") return;\n if (prefersReducedMotion()) return;\n const tab = (event.target as Element).closest<HTMLElement>('[role=\"tab\"]');\n if (!tab || tab === hoveredTab.current || !event.currentTarget.contains(tab)) return;\n hoveredTab.current = tab;\n placePill(pillTarget(event.currentTarget, tab, tab));\n };\n\n const handlePointerLeave = (event: React.PointerEvent<HTMLDivElement>) => {\n onPointerLeave?.(event);\n if (!hoveredTab.current) return;\n hoveredTab.current = null;\n const list = innerRef.current;\n const activeTab = list?.querySelector<HTMLElement>('[data-state=\"active\"]');\n if (list && activeTab) placePill(pillTarget(list, null, activeTab));\n };\n\n // Radix scrolls a tab into view when it takes focus, and mount is not focus, so\n // URL-driven state can land on a tab that is off to the right with nothing on\n // screen to say so: no indicator, and tab one showing as though it were active.\n // Assigns `scrollLeft` rather than calling `scrollIntoView`, which would also\n // scroll every ancestor and the page with it. Only ever scrolls further right, so\n // re-running it after the webfont settles corrects a short initial scroll without\n // yanking the row back from wherever the user has since dragged it.\n const revealActiveTab = React.useCallback(() => {\n const list = innerRef.current;\n const scrolls = scrollable || appearance === \"pill\";\n if (!list || !scrolls || list.dataset.orientation === \"vertical\") return;\n const activeTab = list.querySelector<HTMLElement>('[data-state=\"active\"]');\n if (!activeTab) return;\n const overshoot = activeTab.offsetLeft + activeTab.offsetWidth - list.clientWidth;\n if (overshoot > list.scrollLeft) list.scrollLeft = overshoot;\n }, [scrollable, appearance]);\n\n React.useLayoutEffect(() => {\n const list = innerRef.current;\n const indicator = indicatorRef.current;\n if (!list || !indicator) return;\n\n canHover.current = window.matchMedia?.(\"(hover: hover)\").matches ?? false;\n\n const resizeObserver = new ResizeObserver(updateIndicator);\n resizeObserver.observe(list);\n resizeObserverRef.current = resizeObserver;\n\n indicator.style.transitionDuration = \"0s\";\n updateIndicator();\n indicator.getBoundingClientRect();\n indicator.style.transitionDuration = \"\";\n revealActiveTab();\n\n const mutationObserver = new MutationObserver(updateIndicator);\n mutationObserver.observe(list, {\n attributes: true,\n attributeFilter: [\"data-state\", \"aria-expanded\"],\n childList: true,\n subtree: true,\n });\n\n let cancelled = false;\n if (document.fonts?.status !== \"loaded\") {\n document.fonts?.ready.then(() => {\n if (cancelled) return;\n updateIndicator();\n // The tabs are wider once the real font is in, so the mount-time scroll can\n // fall short of the active tab. Recomputed here against the settled layout.\n revealActiveTab();\n });\n }\n\n return () => {\n cancelled = true;\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n resizeObserverRef.current = null;\n };\n }, [updateIndicator, revealActiveTab]);\n\n const isPill = appearance === \"pill\";\n const listStyle: React.CSSProperties & { \"--pill-ease\"?: string } = isPill\n ? { \"--pill-ease\": PILL_EASE, ...style }\n : { ...style };\n\n return (\n <TabsAppearanceContext.Provider value={{ appearance, size }}>\n <TabsPrimitive.List\n ref={innerRef}\n onPointerOver={handlePointerOver}\n onPointerLeave={handlePointerLeave}\n style={listStyle}\n className={cn(\n // `isolate` scopes the active indicator's `z-10` to a local stacking\n // context. Without it, `relative` alone creates no stacking context, so\n // the indicator escapes and paints above page chrome (e.g. the header).\n \"relative isolate\",\n isPill\n ? \"inline-flex w-fit max-w-full items-center gap-1 overflow-x-auto rounded-full bg-background-secondary p-1 shadow-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\"\n : [\n getLayoutClass(variant, fullWidth, alignLeft),\n // Horizontal only: in the vertical orientation the leading padding is\n // the row's left inset, not a label offset, so zeroing it would pull\n // the first label out of line with the others.\n flushLeft && \"data-[orientation=horizontal]:[&>[role=tab]:first-child]:pl-0\",\n // `flex-none` is what stops the tabs compressing — without it they\n // share the row and never overflow, so there is nothing to scroll.\n // The scrollbar is hidden in both engines: Firefox reads\n // `scrollbar-width`, WebKit and Blink the pseudo-element.\n scrollable &&\n \"data-[orientation=horizontal]:overflow-x-auto data-[orientation=horizontal]:[scrollbar-width:none] data-[orientation=horizontal]:[&::-webkit-scrollbar]:hidden data-[orientation=horizontal]:[&>[role=tab]]:flex-none\",\n \"data-[orientation=horizontal]:items-center data-[orientation=horizontal]:shadow-[inset_0_-1px_0_0_var(--color-border-primary)]\",\n \"data-[orientation=vertical]:flex-col data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--color-border-primary)]\",\n ],\n className,\n )}\n {...props}\n >\n {children}\n <span\n ref={indicatorRef}\n aria-hidden\n className={cn(\n \"pointer-events-none absolute rounded-full motion-safe:transition-[transform,width,height]\",\n isPill\n ? \"z-5 motion-safe:duration-(--pill-slide) motion-safe:ease-(--pill-ease)\"\n : \"z-10 motion-safe:duration-200 motion-safe:ease-in-out\",\n )}\n style={{ opacity: 0 }}\n />\n </TabsPrimitive.List>\n </TabsAppearanceContext.Provider>\n );\n },\n);\n\nTabsList.displayName = \"TabsList\";\n"],"names":["React","jsx","jsxs","TabsPrimitive","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,wBAAwBA,iBAAM,cAGxC,EAAE,YAAY,aAAa,MAAM,MAAM;AAI1C,MAAM,YAAY;AAClB,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,cAAc;AAEpB,MAAM,qBAAqB;AAE3B,SAAS,WAAW,UAAmB;AACrC,SAAO,WAAW,eAAe;AACnC;AAEA,SAAS,YAAY,UAAkB,UAAmB;AACxD,MAAI,CAAC,SAAU,QAAO;AACtB,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ntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const cn = require("../../utils/cn.cjs");
7
+ const DropdownMenuItem = require("../DropdownMenu/DropdownMenuItem.cjs");
8
+ const DropdownMenuRoot = require("../DropdownMenu/DropdownMenuRoot.cjs");
9
+ const ChevronDownIcon = require("../Icons/ChevronDownIcon.cjs");
10
+ const Tabs = require("./Tabs.cjs");
11
+ const TabsTrigger = require("./TabsTrigger.cjs");
12
+ function _interopNamespaceDefault(e) {
13
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
+ if (e) {
15
+ for (const k in e) {
16
+ if (k !== "default") {
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: () => e[k]
21
+ });
22
+ }
23
+ }
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
29
+ const OPEN_KEYS = /* @__PURE__ */ new Set(["Enter", " ", "ArrowDown"]);
30
+ const TabsOverflowItem = React__namespace.forwardRef(
31
+ ({ value, ...props }, ref) => {
32
+ const selection = React__namespace.useContext(Tabs.TabsValueContext);
33
+ const isActive = selection.value === value;
34
+ return /* @__PURE__ */ jsxRuntime.jsx(
35
+ DropdownMenuItem.DropdownMenuItem,
36
+ {
37
+ ref,
38
+ role: "menuitemradio",
39
+ "aria-checked": isActive,
40
+ selected: isActive,
41
+ onSelect: () => selection.select(value),
42
+ ...props
43
+ }
44
+ );
45
+ }
46
+ );
47
+ TabsOverflowItem.displayName = "TabsOverflowItem";
48
+ const TabsOverflow = React__namespace.forwardRef(
49
+ ({ children, ...props }, ref) => {
50
+ const items = React__namespace.Children.toArray(children).filter(
51
+ (child) => React__namespace.isValidElement(child)
52
+ );
53
+ if (items.length === 0) return null;
54
+ return /* @__PURE__ */ jsxRuntime.jsx(OverflowMenu, { ref, items, ...props, children });
55
+ }
56
+ );
57
+ TabsOverflow.displayName = "TabsOverflow";
58
+ const OverflowMenu = React__namespace.forwardRef(({ items, label, children, className, onKeyDown, onMouseDown, ...props }, ref) => {
59
+ const { value } = React__namespace.useContext(Tabs.TabsValueContext);
60
+ const [open, setOpen] = React__namespace.useState(false);
61
+ const lastInput = React__namespace.useRef("keyboard");
62
+ const activeItem = items.find((item) => item.props.value === value);
63
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuRoot.DropdownMenu, { open, onOpenChange: setOpen, children: [
64
+ /* @__PURE__ */ jsxRuntime.jsx(
65
+ TabsTrigger.TabsTrigger,
66
+ {
67
+ ref,
68
+ asChild: true,
69
+ value: activeItem ? activeItem.props.value : Tabs.OVERFLOW_TAB_VALUE,
70
+ ...!activeItem && { "aria-controls": void 0 },
71
+ className,
72
+ onMouseDown: (event) => {
73
+ onMouseDown?.(event);
74
+ event.preventDefault();
75
+ },
76
+ onKeyDown: (event) => {
77
+ onKeyDown?.(event);
78
+ if (event.defaultPrevented) return;
79
+ if (OPEN_KEYS.has(event.key)) {
80
+ lastInput.current = "keyboard";
81
+ event.preventDefault();
82
+ setOpen(true);
83
+ }
84
+ },
85
+ ...props,
86
+ children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuRoot.DropdownMenuTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
87
+ activeItem ? activeItem.props.children : label,
88
+ /* @__PURE__ */ jsxRuntime.jsx(
89
+ ChevronDownIcon.ChevronDownIcon,
90
+ {
91
+ size: 16,
92
+ className: cn.cn("motion-safe:transition-transform", open && "rotate-180")
93
+ }
94
+ )
95
+ ] }) })
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsxRuntime.jsx(
99
+ DropdownMenuRoot.DropdownMenuContent,
100
+ {
101
+ align: "end",
102
+ "aria-label": typeof label === "string" ? label : void 0,
103
+ onPointerDownCapture: () => {
104
+ lastInput.current = "pointer";
105
+ },
106
+ onKeyDownCapture: () => {
107
+ lastInput.current = "keyboard";
108
+ },
109
+ onPointerDownOutside: () => {
110
+ lastInput.current = "pointer";
111
+ },
112
+ onCloseAutoFocus: (event) => {
113
+ if (lastInput.current === "pointer") event.preventDefault();
114
+ },
115
+ children
116
+ }
117
+ )
118
+ ] });
119
+ });
120
+ OverflowMenu.displayName = "OverflowMenu";
121
+ exports.TabsOverflow = TabsOverflow;
122
+ exports.TabsOverflowItem = TabsOverflowItem;
123
+ //# sourceMappingURL=TabsOverflow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabsOverflow.cjs","sources":["../../../../src/components/Tabs/TabsOverflow.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuItem, type DropdownMenuItemProps } from \"../DropdownMenu/DropdownMenuItem\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"../DropdownMenu/DropdownMenuRoot\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\nimport { OVERFLOW_TAB_VALUE, TabsValueContext } from \"./Tabs\";\nimport { TabsTrigger, type TabsTriggerProps } from \"./TabsTrigger\";\n\nconst OPEN_KEYS = new Set([\"Enter\", \" \", \"ArrowDown\"]);\n\n/** Props for the {@link TabsOverflow} component. */\nexport interface TabsOverflowProps\n extends Omit<TabsTriggerProps, \"value\" | \"children\" | \"asChild\"> {\n /** Text shown on the tab while none of its items is active, e.g. \"More\". */\n label: React.ReactNode;\n /** {@link TabsOverflowItem} elements, one per tab that doesn't fit the row. */\n children?: React.ReactNode;\n}\n\n/** Props for the {@link TabsOverflowItem} component. */\nexport type TabsOverflowItemProps = Omit<DropdownMenuItemProps, \"selected\" | \"onSelect\"> & {\n /** The tab's value, as on a {@link TabsTrigger}. */\n value: string;\n};\n\n/**\n * A tab listed in a {@link TabsOverflow} menu. The active one takes the menu's\n * selected style and is announced as the checked option.\n */\nexport const TabsOverflowItem = React.forwardRef<HTMLDivElement, TabsOverflowItemProps>(\n ({ value, ...props }, ref) => {\n const selection = React.useContext(TabsValueContext);\n const isActive = selection.value === value;\n return (\n <DropdownMenuItem\n ref={ref}\n role=\"menuitemradio\"\n aria-checked={isActive}\n selected={isActive}\n onSelect={() => selection.select(value)}\n {...props}\n />\n );\n },\n);\n\nTabsOverflowItem.displayName = \"TabsOverflowItem\";\n\n/**\n * The last tab in a {@link TabsList}, opening a menu of the tabs that don't fit\n * the row. It sits in the row's arrow-key order, opens with click, Enter, Space\n * or ArrowDown, and never selects anything itself. While one of its items is\n * active it shows that item's label and is the selected tab.\n *\n * Reads and sets the value of the surrounding {@link Tabs}, controlled or not.\n * Renders nothing when it has no items.\n *\n * @example\n * ```tsx\n * <Tabs value={tab} onValueChange={setTab}>\n * <TabsList appearance=\"pill\">\n * <TabsTrigger value=\"all\">All</TabsTrigger>\n * <TabsOverflow label=\"More\">\n * <TabsOverflowItem value=\"tips\">Tips</TabsOverflowItem>\n * </TabsOverflow>\n * </TabsList>\n * </Tabs>\n * ```\n */\nexport const TabsOverflow = React.forwardRef<HTMLButtonElement, TabsOverflowProps>(\n ({ children, ...props }, ref) => {\n const items = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<TabsOverflowItemProps> => React.isValidElement(child),\n );\n if (items.length === 0) return null;\n return (\n <OverflowMenu ref={ref} items={items} {...props}>\n {children}\n </OverflowMenu>\n );\n },\n);\n\nTabsOverflow.displayName = \"TabsOverflow\";\n\nconst OverflowMenu = React.forwardRef<\n HTMLButtonElement,\n TabsOverflowProps & { items: React.ReactElement<TabsOverflowItemProps>[] }\n>(({ items, label, children, className, onKeyDown, onMouseDown, ...props }, ref) => {\n const { value } = React.useContext(TabsValueContext);\n const [open, setOpen] = React.useState(false);\n\n const lastInput = React.useRef<\"pointer\" | \"keyboard\">(\"keyboard\");\n\n const activeItem = items.find((item) => item.props.value === value);\n\n return (\n <DropdownMenu open={open} onOpenChange={setOpen}>\n <TabsTrigger\n ref={ref}\n asChild\n value={activeItem ? activeItem.props.value : OVERFLOW_TAB_VALUE}\n {...(!activeItem && { \"aria-controls\": undefined })}\n className={className}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n event.preventDefault();\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (OPEN_KEYS.has(event.key)) {\n lastInput.current = \"keyboard\";\n event.preventDefault();\n setOpen(true);\n }\n }}\n {...props}\n >\n <DropdownMenuTrigger>\n <span className=\"flex items-center gap-2\">\n {activeItem ? activeItem.props.children : label}\n <ChevronDownIcon\n size={16}\n className={cn(\"motion-safe:transition-transform\", open && \"rotate-180\")}\n />\n </span>\n </DropdownMenuTrigger>\n </TabsTrigger>\n <DropdownMenuContent\n align=\"end\"\n aria-label={typeof label === \"string\" ? label : undefined}\n onPointerDownCapture={() => {\n lastInput.current = \"pointer\";\n }}\n onKeyDownCapture={() => {\n lastInput.current = \"keyboard\";\n }}\n onPointerDownOutside={() => {\n lastInput.current = \"pointer\";\n }}\n onCloseAutoFocus={(event) => {\n if (lastInput.current === \"pointer\") event.preventDefault();\n }}\n >\n {children}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n});\n\nOverflowMenu.displayName = \"OverflowMenu\";\n"],"names":["React","TabsValueContext","jsx","DropdownMenuItem","jsxs","DropdownMenu","TabsTrigger","OVERFLOW_TAB_VALUE","DropdownMenuTrigger","ChevronDownIcon","cn","DropdownMenuContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,YAAY,oBAAI,IAAI,CAAC,SAAS,KAAK,WAAW,CAAC;AAqB9C,MAAM,mBAAmBA,iBAAM;AAAA,EACpC,CAAC,EAAE,OAAO,GAAG,MAAA,GAAS,QAAQ;AAC5B,UAAM,YAAYA,iBAAM,WAAWC,qBAAgB;AACnD,UAAM,WAAW,UAAU,UAAU;AACrC,WACEC,2BAAAA;AAAAA,MAACC,iBAAAA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,gBAAc;AAAA,QACd,UAAU;AAAA,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AAG;AAC5B,sBAAU,UAAU;AACpB,kBAAM,eAAA;AACN,oBAAQ,IAAI;AAAA,UACd;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEJ,UAAAL,2BAAAA,IAACM,iBAAAA,qBAAA,EACC,UAAAJ,gCAAC,QAAA,EAAK,WAAU,2BACb,UAAA;AAAA,UAAA,aAAa,WAAW,MAAM,WAAW;AAAA,UAC1CF,2BAAAA;AAAAA,YAACO,gBAAAA;AAAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,WAAWC,GAAAA,GAAG,oCAAoC,QAAQ,YAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QACxE,EAAA,CACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAEFR,2BAAAA;AAAAA,MAACS,iBAAAA;AAAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,cAAY,OAAO,UAAU,WAAW,QAAQ;AAAA,QAChD,sBAAsB,MAAM;AAC1B,oBAAU,UAAU;AAAA,QACtB;AAAA,QACA,kBAAkB,MAAM;AACtB,oBAAU,UAAU;AAAA,QACtB;AAAA,QACA,sBAAsB,MAAM;AAC1B,oBAAU,UAAU;AAAA,QACtB;AAAA,QACA,kBAAkB,CAAC,UAAU;AAC3B,cAAI,UAAU,YAAY,UAAW,OAAM,eAAA;AAAA,QAC7C;AAAA,QAEC;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,CAAC;AAED,aAAa,cAAc;;;"}
@@ -5,6 +5,7 @@ const jsxRuntime = require("react/jsx-runtime");
5
5
  const TabsPrimitive = require("@radix-ui/react-tabs");
6
6
  const React = require("react");
7
7
  const cn = require("../../utils/cn.cjs");
8
+ const TabsList = require("./TabsList.cjs");
8
9
  function _interopNamespaceDefault(e) {
9
10
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
11
  if (e) {
@@ -24,11 +25,13 @@ function _interopNamespaceDefault(e) {
24
25
  const TabsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TabsPrimitive);
25
26
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
27
  const TabsTrigger = React__namespace.forwardRef(({ className, children, asChild, ...props }, ref) => {
27
- const label = /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children });
28
+ const { appearance, size } = React__namespace.useContext(TabsList.TabsAppearanceContext);
29
+ const labelClassName = cn.cn("min-w-0 truncate", appearance === "pill" && "flex items-center gap-2");
30
+ const label = /* @__PURE__ */ jsxRuntime.jsx("span", { className: labelClassName, children });
28
31
  const content = asChild && React__namespace.isValidElement(children) ? React__namespace.cloneElement(
29
32
  children,
30
33
  void 0,
31
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: children.props.children })
34
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: labelClassName, children: children.props.children })
32
35
  ) : label;
33
36
  return /* @__PURE__ */ jsxRuntime.jsx(
34
37
  TabsPrimitive__namespace.Trigger,
@@ -36,21 +39,31 @@ const TabsTrigger = React__namespace.forwardRef(({ className, children, asChild,
36
39
  ref,
37
40
  asChild,
38
41
  className: cn.cn(
39
- "inline-flex min-w-0 items-center justify-center",
40
- "typography-body-default-16px-semibold cursor-pointer",
42
+ "inline-flex min-w-0 cursor-pointer items-center justify-center",
41
43
  "motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out",
42
- "data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3",
43
- "data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3",
44
- "data-[state=active]:text-content-primary",
45
- "data-[state=inactive]:text-content-tertiary",
46
- "data-[state=active]:hover:text-content-primary/70",
47
- "data-[state=inactive]:hover:text-content-primary",
48
- "data-[state=active]:active:text-content-primary/70",
49
- "data-[state=inactive]:active:text-content-primary",
50
44
  "data-disabled:pointer-events-none",
51
- "data-disabled:data-[state=active]:text-content-tertiary",
52
- "data-disabled:data-[state=inactive]:text-neutral-alphas-200",
53
45
  "focus-visible:shadow-focus-ring focus-visible:outline-none",
46
+ appearance === "pill" ? [
47
+ "relative z-0 shrink-0 gap-2 rounded-full px-4 data-pill:z-10",
48
+ size === "36" ? "h-9" : "h-8",
49
+ "typography-body-small-14px-semibold",
50
+ "motion-safe:duration-[160ms] data-pill:motion-safe:delay-(--pill-arrive)",
51
+ "text-content-secondary data-pill:text-content-primary-inverted",
52
+ "not-data-pill:hover:text-content-primary",
53
+ "data-disabled:data-[state=inactive]:text-neutral-alphas-200"
54
+ ] : [
55
+ "typography-body-default-16px-semibold",
56
+ "data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3",
57
+ "data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3",
58
+ "data-[state=active]:text-content-primary",
59
+ "data-[state=inactive]:text-content-tertiary",
60
+ "data-[state=active]:hover:text-content-primary/70",
61
+ "data-[state=inactive]:hover:text-content-primary",
62
+ "data-[state=active]:active:text-content-primary/70",
63
+ "data-[state=inactive]:active:text-content-primary",
64
+ "data-disabled:data-[state=active]:text-content-tertiary",
65
+ "data-disabled:data-[state=inactive]:text-neutral-alphas-200"
66
+ ],
54
67
  className
55
68
  ),
56
69
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"TabsTrigger.cjs","sources":["../../../../src/components/Tabs/TabsTrigger.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link TabsTrigger} button component. */\nexport type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;\n\n/**\n * An interactive tab that activates its associated {@link TabsContent} panel.\n *\n * Renders a `<button>` by default. Pass `asChild` to render the tab as another\n * element — e.g. a router link for navigation tabs (`<TabsTrigger asChild><Link\n * href=\"…\">…</Link></TabsTrigger>`). With `asChild` the child element becomes\n * the tab itself (receiving `role=\"tab\"` and focus management), so the tab\n * stays a single interactive control rather than nesting one inside the other.\n */\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n TabsTriggerProps\n>(({ className, children, asChild, ...props }, ref) => {\n const label = <span className=\"min-w-0 truncate\">{children}</span>;\n\n // The `min-w-0 truncate` span keeps long labels ellipsised. With `asChild`\n // the consumer's element becomes the tab, so wrap *its* children in that\n // span (rather than wrapping the element) — the tab stays a single\n // interactive control (no nested link/button) while behaviour matches the\n // default button tab.\n const content =\n asChild && React.isValidElement(children)\n ? React.cloneElement(\n children,\n undefined,\n <span className=\"min-w-0 truncate\">\n {(children.props as { children?: React.ReactNode }).children}\n </span>,\n )\n : label;\n\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n asChild={asChild}\n className={cn(\n \"inline-flex min-w-0 items-center justify-center\",\n \"typography-body-default-16px-semibold cursor-pointer\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3\",\n \"data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3\",\n \"data-[state=active]:text-content-primary\",\n \"data-[state=inactive]:text-content-tertiary\",\n \"data-[state=active]:hover:text-content-primary/70\",\n \"data-[state=inactive]:hover:text-content-primary\",\n \"data-[state=active]:active:text-content-primary/70\",\n \"data-[state=inactive]:active:text-content-primary\",\n \"data-disabled:pointer-events-none\",\n \"data-disabled:data-[state=active]:text-content-tertiary\",\n \"data-disabled:data-[state=inactive]:text-neutral-alphas-200\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n className,\n )}\n {...props}\n >\n {content}\n </TabsPrimitive.Trigger>\n );\n});\n\nTabsTrigger.displayName = \"TabsTrigger\";\n"],"names":["React","jsx","TabsPrimitive","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,cAAcA,iBAAM,WAG/B,CAAC,EAAE,WAAW,UAAU,SAAS,GAAG,MAAA,GAAS,QAAQ;AACrD,QAAM,QAAQC,2BAAAA,IAAC,QAAA,EAAK,WAAU,oBAAoB,UAAS;AAO3D,QAAM,UACJ,WAAWD,iBAAM,eAAe,QAAQ,IACpCA,iBAAM;AAAA,IACJ;AAAA,IACA;AAAA,mCACC,QAAA,EAAK,WAAU,oBACZ,UAAA,SAAS,MAAyC,SAAA,CACtD;AAAA,EAAA,IAEF;AAEN,SACEC,2BAAAA;AAAAA,IAACC,yBAAc;AAAA,IAAd;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAWC,GAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAED,YAAY,cAAc;;"}
1
+ {"version":3,"file":"TabsTrigger.cjs","sources":["../../../../src/components/Tabs/TabsTrigger.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { TabsAppearanceContext } from \"./TabsList\";\n\n/** Props for the {@link TabsTrigger} button component. */\nexport type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;\n\n/**\n * An interactive tab that activates its associated {@link TabsContent} panel.\n *\n * Renders a `<button>` by default. Pass `asChild` to render the tab as another\n * element — e.g. a router link for navigation tabs (`<TabsTrigger asChild><Link\n * href=\"…\">…</Link></TabsTrigger>`). With `asChild` the child element becomes\n * the tab itself (receiving `role=\"tab\"` and focus management), so the tab\n * stays a single interactive control rather than nesting one inside the other.\n *\n * Inside a `TabsList appearance=\"pill\"` the tab takes the pill styling.\n */\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n TabsTriggerProps\n>(({ className, children, asChild, ...props }, ref) => {\n const { appearance, size } = React.useContext(TabsAppearanceContext);\n const labelClassName = cn(\"min-w-0 truncate\", appearance === \"pill\" && \"flex items-center gap-2\");\n const label = <span className={labelClassName}>{children}</span>;\n\n // The `min-w-0 truncate` span keeps long labels ellipsised. With `asChild`\n // the consumer's element becomes the tab, so wrap *its* children in that\n // span (rather than wrapping the element) — the tab stays a single\n // interactive control (no nested link/button) while behaviour matches the\n // default button tab.\n const content =\n asChild && React.isValidElement(children)\n ? React.cloneElement(\n children,\n undefined,\n <span className={labelClassName}>\n {(children.props as { children?: React.ReactNode }).children}\n </span>,\n )\n : label;\n\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n asChild={asChild}\n className={cn(\n \"inline-flex min-w-0 cursor-pointer items-center justify-center\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"data-disabled:pointer-events-none\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"pill\"\n ? [\n \"relative z-0 shrink-0 gap-2 rounded-full px-4 data-pill:z-10\",\n size === \"36\" ? \"h-9\" : \"h-8\",\n \"typography-body-small-14px-semibold\",\n \"motion-safe:duration-[160ms] data-pill:motion-safe:delay-(--pill-arrive)\",\n \"text-content-secondary data-pill:text-content-primary-inverted\",\n \"not-data-pill:hover:text-content-primary\",\n \"data-disabled:data-[state=inactive]:text-neutral-alphas-200\",\n ]\n : [\n \"typography-body-default-16px-semibold\",\n \"data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3\",\n \"data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3\",\n \"data-[state=active]:text-content-primary\",\n \"data-[state=inactive]:text-content-tertiary\",\n \"data-[state=active]:hover:text-content-primary/70\",\n \"data-[state=inactive]:hover:text-content-primary\",\n \"data-[state=active]:active:text-content-primary/70\",\n \"data-[state=inactive]:active:text-content-primary\",\n \"data-disabled:data-[state=active]:text-content-tertiary\",\n \"data-disabled:data-[state=inactive]:text-neutral-alphas-200\",\n ],\n className,\n )}\n {...props}\n >\n {content}\n </TabsPrimitive.Trigger>\n );\n});\n\nTabsTrigger.displayName = \"TabsTrigger\";\n"],"names":["React","TabsAppearanceContext","cn","jsx","TabsPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,cAAcA,iBAAM,WAG/B,CAAC,EAAE,WAAW,UAAU,SAAS,GAAG,MAAA,GAAS,QAAQ;AACrD,QAAM,EAAE,YAAY,KAAA,IAASA,iBAAM,WAAWC,SAAAA,qBAAqB;AACnE,QAAM,iBAAiBC,GAAAA,GAAG,oBAAoB,eAAe,UAAU,yBAAyB;AAChG,QAAM,QAAQC,2BAAAA,IAAC,QAAA,EAAK,WAAW,gBAAiB,UAAS;AAOzD,QAAM,UACJ,WAAWH,iBAAM,eAAe,QAAQ,IACpCA,iBAAM;AAAA,IACJ;AAAA,IACA;AAAA,mCACC,QAAA,EAAK,WAAW,gBACb,UAAA,SAAS,MAAyC,SAAA,CACtD;AAAA,EAAA,IAEF;AAEN,SACEG,2BAAAA;AAAAA,IAACC,yBAAc;AAAA,IAAd;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAWF,GAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAe,SACX;AAAA,UACE;AAAA,UACA,SAAS,OAAO,QAAQ;AAAA,UACxB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,IAEF;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEN;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAED,YAAY,cAAc;;"}
@@ -261,6 +261,7 @@ const TablePagination = require("./components/Table/TablePagination.cjs");
261
261
  const Tabs = require("./components/Tabs/Tabs.cjs");
262
262
  const TabsContent = require("./components/Tabs/TabsContent.cjs");
263
263
  const TabsList = require("./components/Tabs/TabsList.cjs");
264
+ const TabsOverflow = require("./components/Tabs/TabsOverflow.cjs");
264
265
  const TabsTrigger = require("./components/Tabs/TabsTrigger.cjs");
265
266
  const TextArea = require("./components/TextArea/TextArea.cjs");
266
267
  const TextField = require("./components/TextField/TextField.cjs");
@@ -609,6 +610,8 @@ exports.TablePagination = TablePagination.TablePagination;
609
610
  exports.Tabs = Tabs.Tabs;
610
611
  exports.TabsContent = TabsContent.TabsContent;
611
612
  exports.TabsList = TabsList.TabsList;
613
+ exports.TabsOverflow = TabsOverflow.TabsOverflow;
614
+ exports.TabsOverflowItem = TabsOverflow.TabsOverflowItem;
612
615
  exports.TabsTrigger = TabsTrigger.TabsTrigger;
613
616
  exports.TextArea = TextArea.TextArea;
614
617
  exports.TextField = TextField.TextField;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -53,64 +53,72 @@ const DialogContent = React.forwardRef(
53
53
  },
54
54
  props
55
55
  );
56
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
57
- overlay && /* @__PURE__ */ jsx(DialogOverlay, { ...overlayProps }),
58
- /* @__PURE__ */ jsxs(
59
- DialogPrimitive.Content,
60
- {
61
- ref,
62
- style: { zIndex: "var(--fanvue-ui-portal-z-index, 50)", ...style },
63
- onOpenAutoFocus: (e) => {
64
- if (onOpenAutoFocus) {
65
- onOpenAutoFocus(e);
66
- return;
56
+ const content = /* @__PURE__ */ jsxs(
57
+ DialogPrimitive.Content,
58
+ {
59
+ ref,
60
+ style: { zIndex: "var(--fanvue-ui-portal-z-index, 50)", ...style },
61
+ onOpenAutoFocus: (e) => {
62
+ if (onOpenAutoFocus) {
63
+ onOpenAutoFocus(e);
64
+ return;
65
+ }
66
+ e.preventDefault();
67
+ e.currentTarget.focus();
68
+ },
69
+ className: cn(
70
+ "fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none",
71
+ "data-[state=open]:fade-in-0 data-[state=open]:animate-in",
72
+ "data-[state=closed]:fade-out-0 data-[state=closed]:animate-out",
73
+ "data-[state=closed]:pointer-events-none!",
74
+ mobilePresentation === "card" ? (
75
+ // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius
76
+ cn(
77
+ "dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6",
78
+ "data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95",
79
+ "sm:inset-x-auto"
80
+ )
81
+ ) : (
82
+ // Bottom sheet pinned to the viewport bottom edge
83
+ cn(
84
+ "dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3",
85
+ "pb-[calc(1rem+env(safe-area-inset-bottom,0px))]",
86
+ "data-[state=open]:slide-in-from-bottom-full",
87
+ "data-[state=closed]:slide-out-to-bottom-full",
88
+ "sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95",
89
+ "sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95"
90
+ )
91
+ ),
92
+ "sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6",
93
+ "duration-200",
94
+ SIZE_CLASSES[size],
95
+ className
96
+ ),
97
+ ...contentProps,
98
+ children: [
99
+ /* @__PURE__ */ jsx(DialogPrimitive.Close, { ref: closeRef, hidden: true, tabIndex: -1, "aria-hidden": "true" }),
100
+ showMobileHandle && mobilePresentation === "sheet" && /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ "aria-hidden": "true",
104
+ className: "mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden"
67
105
  }
68
- e.preventDefault();
69
- e.currentTarget.focus();
70
- },
71
- className: cn(
72
- "fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none",
73
- "data-[state=open]:fade-in-0 data-[state=open]:animate-in",
74
- "data-[state=closed]:fade-out-0 data-[state=closed]:animate-out",
75
- mobilePresentation === "card" ? (
76
- // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius
77
- cn(
78
- "dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6",
79
- "data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95",
80
- "sm:inset-x-auto"
81
- )
82
- ) : (
83
- // Bottom sheet pinned to the viewport bottom edge
84
- cn(
85
- "dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3",
86
- "pb-[calc(1rem+env(safe-area-inset-bottom,0px))]",
87
- "data-[state=open]:slide-in-from-bottom-full",
88
- "data-[state=closed]:slide-out-to-bottom-full",
89
- "sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95",
90
- "sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95"
91
- )
92
- ),
93
- "sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6",
94
- "duration-200",
95
- SIZE_CLASSES[size],
96
- className
97
106
  ),
98
- ...contentProps,
99
- children: [
100
- /* @__PURE__ */ jsx(DialogPrimitive.Close, { ref: closeRef, hidden: true, tabIndex: -1, "aria-hidden": "true" }),
101
- showMobileHandle && mobilePresentation === "sheet" && /* @__PURE__ */ jsx(
102
- "div",
103
- {
104
- "aria-hidden": "true",
105
- className: "mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden"
106
- }
107
- ),
108
- children
109
- ]
110
- }
111
- )
107
+ children
108
+ ]
109
+ }
110
+ );
111
+ const overlayElement = overlay ? /* @__PURE__ */ jsx(DialogOverlay, { ...overlayProps }) : null;
112
+ if (!portal) {
113
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
114
+ overlayElement,
115
+ content
116
+ ] });
117
+ }
118
+ return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
119
+ overlayElement,
120
+ content
112
121
  ] });
113
- return portal ? /* @__PURE__ */ jsx(DialogPrimitive.Portal, { children: content }) : content;
114
122
  }
115
123
  );
116
124
  DialogContent.displayName = "DialogContent";
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Width preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n *\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<DialogContentProps[\"size\"]>, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const contentProps = useDragToDismiss(\n {\n enabled: mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <>\n {overlay && <DialogOverlay {...overlayProps} />}\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n \"duration-200\",\n SIZE_CLASSES[size],\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n </>\n );\n\n return portal ? <DialogPrimitive.Portal>{content}</DialogPrimitive.Portal> : content;\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,QAAQ,uCAAuC,GAAG,MAAA;AAAA,IAC1D,GAAG;AAAA,EAAA;AACN,CACD;AACD,cAAc,cAAc;AAoC5B,MAAM,eAAwE;AAAA,EAC5E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAkCO,MAAM,gBAAgB,MAAM;AAAA,EAIjC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAA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AA,IAC3E,GAAG;AAAA,EAAA;AACN,CACD;AACD,YAAY,cAAc;AAQnB,MAAM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+DAA+D,SAAS;AAAA,IACrF,GAAG;AAAA,EAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
1
+ {"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Width preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n *\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<DialogContentProps[\"size\"]>, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n *\n * It animates in and out. While the closing animation plays the panel stays\n * mounted but ignores pointer input, so a second click can't act on it.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const contentProps = useDragToDismiss(\n {\n enabled: mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n \"data-[state=closed]:pointer-events-none!\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n \"duration-200\",\n SIZE_CLASSES[size],\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n );\n const overlayElement = overlay ? <DialogOverlay {...overlayProps} /> : null;\n\n if (!portal) {\n return (\n <>\n {overlayElement}\n {content}\n </>\n );\n }\n return (\n <DialogPrimitive.Portal>\n {overlayElement}\n {content}\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,QAAQ,uCAAuC,GAAG,MAAA;AAAA,IAC1D,GAAG;AAAA,EAAA;AACN,CACD;AACD,cAAc,cAAc;AAoC5B,MAAM,eAAwE;AAAA,EAC5E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAqCO,MAAM,gB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IR;AACF;AACA,aAAa,cAAc;AASpB,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,qDAAqD,SAAS;AAAA,IAC3E,GAAG;AAAA,EAAA;AACN,CACD;AACD,YAAY,cAAc;AAQnB,MAAM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+DAA+D,SAAS;AAAA,IACrF,GAAG;AAAA,EAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
@@ -1,7 +1,31 @@
1
1
  "use client";
2
+ import { jsx } from "react/jsx-runtime";
2
3
  import * as TabsPrimitive from "@radix-ui/react-tabs";
3
- const Tabs = TabsPrimitive.Root;
4
+ import * as React from "react";
5
+ const OVERFLOW_TAB_VALUE = "fanvue-ui-tabs-overflow";
6
+ const TabsValueContext = React.createContext({ value: void 0, select: () => {
7
+ } });
8
+ const Tabs = React.forwardRef(
9
+ ({ value: valueProp, defaultValue, onValueChange, ...props }, ref) => {
10
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
11
+ const isControlled = valueProp !== void 0;
12
+ const value = isControlled ? valueProp : uncontrolledValue;
13
+ const select = React.useCallback(
14
+ (next) => {
15
+ if (next === OVERFLOW_TAB_VALUE) return;
16
+ if (!isControlled) setUncontrolledValue(next);
17
+ onValueChange?.(next);
18
+ },
19
+ [isControlled, onValueChange]
20
+ );
21
+ const context = React.useMemo(() => ({ value, select }), [value, select]);
22
+ return /* @__PURE__ */ jsx(TabsValueContext.Provider, { value: context, children: /* @__PURE__ */ jsx(TabsPrimitive.Root, { ref, value: value ?? "", onValueChange: select, ...props }) });
23
+ }
24
+ );
25
+ Tabs.displayName = "Tabs";
4
26
  export {
5
- Tabs
27
+ OVERFLOW_TAB_VALUE,
28
+ Tabs,
29
+ TabsValueContext
6
30
  };
7
31
  //# sourceMappingURL=Tabs.mjs.map