{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sheet",
  "title": "Sheet",
  "description": "A panel that slides in from an edge and is dragged back to dismiss: the mobile form of a dialog.",
  "dependencies": [
    "@base-ui/react@^1.8.0"
  ],
  "registryDependencies": [
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-dev",
    "@ouro/lib-env",
    "@ouro/lib-open-mode",
    "@ouro/lib-page-scroll-hold",
    "@ouro/lib-portal-container",
    "@ouro/lib-refs",
    "@ouro/lib-touch-target",
    "@ouro/lib-use-backdrop-anchor",
    "@ouro/lib-use-dev-messages",
    "@ouro/lib-use-keyboard-scrollable"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/sheet/sheet-parts.tsx",
      "content": "\"use client\";\n\nimport { Drawer } from \"@base-ui/react/drawer\";\nimport { createContext, useCallback, useContext, type JSX, type Ref } from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { devThrow } from \"@/registry/ouro/lib/ouro/dev\";\nimport { useMergedRef } from \"@/registry/ouro/lib/ouro/refs\";\nimport { useBackdropAnchor } from \"@/registry/ouro/lib/ouro/use-backdrop-anchor\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport { useKeyboardScrollable } from \"@/registry/ouro/lib/ouro/use-keyboard-scrollable\";\nimport { holdPageAtPress } from \"@/registry/ouro/lib/ouro/page-scroll-hold\";\nimport { PortalScope } from \"@/registry/ouro/lib/ouro/portal-container\";\nimport {\n  iosBackdrop,\n  registerSheetProperties,\n  sheetHint,\n  sheetSides,\n  sideWarning,\n  type SheetSide,\n} from \"@/registry/ouro/components/ouro/sheet/sheet-styles\";\n\nexport type { SheetSide } from \"@/registry/ouro/components/ouro/sheet/sheet-styles\";\n\n/**\n * A snap point for a bottom or top sheet: a fraction of the viewport height\n * (`0.5`), or a height in `px` or `rem` (`\"320px\"`, `\"20rem\"`).\n */\nexport type SheetSnapPoint = number | `${number}px` | `${number}rem`;\n\ninterface SheetContextValue {\n  side: SheetSide;\n  snap: boolean;\n  /** Whether the sheet shuts off the page; a non-modal one lets presses through around it. */\n  modal: boolean;\n}\n\nconst SheetContext = createContext<SheetContextValue | null>(null);\n\nconst swipeDirections = { bottom: \"down\", top: \"up\", left: \"left\", right: \"right\" } as const;\n\n/*\n * Styles: Base UI Drawer, tuned through its CSS variables (spec section 7).\n *\n * - Base UI moves the popup with --drawer-swipe-movement-x/y and places snap points\n *   with --drawer-snap-point-offset. Past the open edge it damps the pull to the\n *   square root of the distance (s = √d for a pull of d). The sheet lifts\n *   k·(s − k/4) with k = --ouro-sheet-stretch, which is never more than the pull:\n *   d − k·(s − k/4) = (s − k/2)² ≥ 0. An 80px pull lifts it about 28px, like\n *   RedwoodUI. A bleed (::after) in the sheet's color extends past the edge, so the\n *   lift reads as stretching.\n * - Base UI measures a drag from where the sheet is when the finger takes it, which is\n *   off its rest position while it is opening or on its way back from an earlier drag.\n *   --ouro-sheet-grab holds that distance for as long as the drag lasts (useGrabOffset),\n *   so the sheet stays under the finger and does not jump to rest. It is added after the\n *   stretch, which applies to the finger's movement alone.\n * - The drag rewrites these variables on the popup every frame. They are registered as\n *   not inherited (registerSheetProperties, as Base UI does for its own), so the popup's\n *   content is not restyled for it.\n * - The backdrop fades with --drawer-swipe-progress, up to --ouro-backdrop-max.\n * - Release and entry take --ouro-duration-sheet on the drawer curve; a flick's release is\n *   scaled by --drawer-swipe-strength (0.1 to 1).\n * - Reduced motion drops transform transitions and keeps an opacity fade.\n *\n * Class strings are literal so the app's Tailwind finds them when it compiles.\n */\n\nregisterSheetProperties();\n\nconst backdropClass =\n  \"fixed inset-0 z-1000 min-h-dvh bg-(--ouro-backdrop-color) \" +\n  \"opacity-[calc(var(--ouro-backdrop-max)*(1-var(--drawer-swipe-progress,0)))] \" +\n  \"[transition:opacity_var(--ouro-duration-sheet)_var(--ouro-ease-drawer)] \" +\n  \"data-starting-style:opacity-0 data-ending-style:opacity-0 \" +\n  \"data-ending-style:duration-(--ouro-duration-slow) data-ending-style:ease-(--ouro-ease-out) data-swiping:duration-0 \" +\n  // A flick sends the sheet away in about 100ms. Base UI pins the backdrop's\n  // --drawer-swipe-strength at 1, but marks it data-swipe-dismiss, so fade it as fast.\n  \"data-swipe-dismiss:data-ending-style:duration-(--ouro-duration-fast) \" +\n  iosBackdrop;\n\nconst viewportClasses = {\n  bottom: \"items-end justify-center\",\n  top: \"items-start justify-center\",\n  left: \"[justify-content:left]\",\n  right: \"[justify-content:right]\",\n} as const;\n\nconst popupBase =\n  \"[--ouro-sheet-stretch:3.5] [--ouro-sheet-slack:calc(var(--ouro-sheet-stretch)*0.25px)] [--ouro-sheet-gap:2rem] \" +\n  \"relative box-border flex min-h-0 flex-col outline-none touch-none \" +\n  \"bg-popover text-popover-foreground [-webkit-tap-highlight-color:transparent] \" +\n  \"[transition:transform_calc(var(--ouro-duration-sheet)*var(--drawer-swipe-strength,1))_var(--ouro-ease-drawer)] \" +\n  \"will-change-transform [transform:var(--ouro-sheet-transform)] data-swiping:select-none \" +\n  // While a finger is down, Base UI also writes the raw damped offset as an inline\n  // transform. The stretched transform has to win over it, so it is important here.\n  \"data-swiping:[transform:var(--ouro-sheet-transform)]! \" +\n  // Where the finger took the sheet counts only while it holds it: a release settles from\n  // there to rest. Important, to win over the value useGrabOffset leaves on the element.\n  \"not-data-swiping:[--ouro-sheet-grab:0px]! \" +\n  // The bleed: the sheet's color past its edge, so pulling it inward looks like stretching.\n  \"after:pointer-events-none after:absolute after:bg-inherit \" +\n  // Reduced motion: fade in place.\n  \"motion-reduce:[transition:transform_0s,opacity_var(--ouro-duration-base)_var(--ouro-ease-out)] \" +\n  \"motion-reduce:data-starting-style:[transform:var(--ouro-sheet-transform)] motion-reduce:data-starting-style:opacity-0 \" +\n  \"motion-reduce:data-ending-style:[transform:var(--ouro-sheet-transform)] motion-reduce:data-ending-style:opacity-0\";\n\n// Bottom (the default) and top: full width up to 40rem, fitting content up to the viewport less a gap.\nconst popupSides = {\n  bottom:\n    \"w-full max-w-[40rem] max-h-[calc(100dvh-var(--ouro-sheet-gap))] ps-[env(safe-area-inset-left,0px)] pe-[env(safe-area-inset-right,0px)] \" +\n    \"[--ouro-sheet-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] \" +\n    \"[--ouro-sheet-transform:translateY(calc(max(var(--ouro-sheet-y),0px)+min(var(--ouro-sheet-y)+var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] \" +\n    \"rounded-t-ouro-xl [box-shadow:var(--ouro-shadow-sheet-bottom)] \" +\n    \"after:inset-x-0 after:top-[calc(100%-1px)] after:h-[50dvh] \" +\n    \"data-starting-style:[transform:translateY(calc(100%+2px))] data-ending-style:[transform:translateY(calc(100%+2px))]\",\n  top:\n    \"w-full max-w-[40rem] max-h-[calc(100dvh-var(--ouro-sheet-gap))] ps-[env(safe-area-inset-left,0px)] pe-[env(safe-area-inset-right,0px)] \" +\n    \"[--ouro-sheet-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] \" +\n    \"[--ouro-sheet-transform:translateY(calc(min(var(--ouro-sheet-y),0px)+max(var(--ouro-sheet-y)-var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] \" +\n    \"rounded-b-ouro-xl [box-shadow:var(--ouro-shadow-sheet-top)] \" +\n    \"pt-[env(safe-area-inset-top,0px)] \" +\n    \"after:inset-x-0 after:bottom-[calc(100%-1px)] after:h-[50dvh] \" +\n    \"data-starting-style:[transform:translateY(calc(-100%-2px))] data-ending-style:[transform:translateY(calc(-100%-2px))]\",\n  // Left and right: full height, up to 22rem wide, always leaving a strip of the page visible.\n  left:\n    \"h-full w-[min(22rem,calc(100vw-3rem))] pt-[env(safe-area-inset-top,0px)] \" +\n    \"pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))] \" +\n    \"[--ouro-sheet-x:var(--drawer-swipe-movement-x,0px)] \" +\n    \"[--ouro-sheet-transform:translateX(calc(min(var(--ouro-sheet-x),0px)+max(var(--ouro-sheet-x)-var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] \" +\n    \"rounded-r-ouro-xl [box-shadow:var(--ouro-shadow-sheet-left)] pl-[env(safe-area-inset-left,0px)] \" +\n    \"after:inset-y-0 after:right-[calc(100%-1px)] after:w-[50vw] \" +\n    \"data-starting-style:[transform:translateX(calc(-100%-2px))] data-ending-style:[transform:translateX(calc(-100%-2px))]\",\n  right:\n    \"h-full w-[min(22rem,calc(100vw-3rem))] pt-[env(safe-area-inset-top,0px)] \" +\n    \"pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))] \" +\n    \"[--ouro-sheet-x:var(--drawer-swipe-movement-x,0px)] \" +\n    \"[--ouro-sheet-transform:translateX(calc(max(var(--ouro-sheet-x),0px)+min(var(--ouro-sheet-x)+var(--ouro-sheet-slack),0px)*var(--ouro-sheet-stretch)+var(--ouro-sheet-grab,0px)))] \" +\n    \"rounded-l-ouro-xl [box-shadow:var(--ouro-shadow-sheet-right)] pr-[env(safe-area-inset-right,0px)] \" +\n    \"after:inset-y-0 after:left-[calc(100%-1px)] after:w-[50vw] \" +\n    \"data-starting-style:[transform:translateX(calc(100%+2px))] data-ending-style:[transform:translateX(calc(100%+2px))]\",\n} as const;\n\n/**\n * A bottom sheet's padding keeps its body above the home indicator and the software\n * keyboard. At a lower snap point part of the sheet sits below the screen, so it is\n * padded by that much more and the body ends on screen. The padding follows the snap\n * point, not the finger: it changes when the sheet lands on another point, never on the\n * frames of a drag.\n * @claim \"The padding follows the snap point\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > pads a sheet at a lower snap point by the part below the screen, and holds that padding through a drag)\n * @claim \"The padding follows the snap point\" registry/ouro/components/ouro/sheet/sheet.touch.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.touch.test.tsx::Sheet on a phone > stays under the finger when a sheet with snap points is caught on its way back to one)\n */\nconst bottomPadding = {\n  fit: \"pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px))]\",\n  snap: \"h-[calc(100dvh-var(--ouro-sheet-gap))] pb-[calc(env(safe-area-inset-bottom,0px)+var(--drawer-keyboard-inset,0px)+max(0px,var(--drawer-snap-point-offset,0px)))]\",\n} as const;\n\n/** The JSX that puts a part in its place, for the dev message when it is not. */\nfunction shape(inner: string): string {\n  return `<SheetRoot><SheetTrigger render={<Button>Open</Button>} /><SheetPortal><SheetBackdrop /><SheetViewport><SheetPopup>${inner}</SheetPopup></SheetViewport></SheetPortal></SheetRoot>`;\n}\n\n/** Reads the sheet context, or throws in development with the JSX the part belongs in. */\nfunction useSheetPart(part: string, inner: string): SheetContextValue {\n  const context = useContext(SheetContext);\n  if (!context) {\n    devThrow(\n      part,\n      \"must be rendered inside <SheetRoot>\",\n      process.env.NODE_ENV !== \"production\" ? shape(inner) : /* istanbul ignore next @preserve -- production only */ \"\",\n    );\n  }\n  return context;\n}\n\n/**\n * Props for {@link SheetRoot}: Base UI `Drawer.Root` props with `side` in place of `swipeDirection`.\n * `modal={false}` leaves the page in use beside the sheet: no focus trap and no scroll lock, presses\n * reach the page around the sheet, and a press or focus outside leaves it open (unless you pass\n * `disablePointerDismissal={false}`). Leave out `SheetBackdrop` with it.\n * @claim \"leaves the page in use\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > built from parts, stays open on a press on the page, unless the app passes disablePointerDismissal={false})\n */\nexport type SheetRootProps = Omit<Drawer.Root.Props, \"swipeDirection\" | \"snapPoints\"> & {\n  /** The edge the sheet slides in from. @default \"bottom\" */\n  side?: SheetSide | (string & { 'Use \"bottom\", \"top\", \"left\" or \"right\"': never }) | undefined;\n  /** Snap points for a bottom or top sheet. Without them the sheet fits its content. */\n  snapPoints?: SheetSnapPoint[] | undefined;\n};\n\n/**\n * Part: the state owner of a sheet built from parts. Use the `Sheet` component\n * instead unless its props cannot express your layout.\n *\n * @example\n * <SheetRoot side=\"bottom\">\n *   <SheetTrigger render={<Button>Open</Button>} />\n *   <SheetPortal>\n *     <SheetBackdrop />\n *     <SheetViewport>\n *       <SheetPopup>\n *         <SheetHandle />\n *         <SheetTitle>Filters</SheetTitle>\n *         <SheetContent>…</SheetContent>\n *       </SheetPopup>\n *     </SheetViewport>\n *   </SheetPortal>\n * </SheetRoot>\n */\nexport function SheetRoot({ side: sideProp = \"bottom\", snapPoints, ...props }: SheetRootProps): JSX.Element {\n  const modal = props.modal !== false;\n  // A side that is not one of Ouro UI's (a type error) warns and renders a bottom sheet.\n  const side = sheetSides.includes(sideProp as SheetSide) ? (sideProp as SheetSide) : \"bottom\";\n  useDevWarnings(\n    \"SheetRoot\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [side !== sideProp && sideWarning(String(sideProp), \"<SheetRoot side=\\\"bottom\\\">\")]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  const snap = Boolean(snapPoints && snapPoints.length > 0);\n  return (\n    <SheetContext.Provider value={{ side, snap, modal }}>\n      <Drawer.Root\n        {...props}\n        disablePointerDismissal={props.disablePointerDismissal ?? !modal}\n        {...(snapPoints ? { snapPoints } : {})}\n        swipeDirection={swipeDirections[side]}\n      />\n    </SheetContext.Provider>\n  );\n}\n\n/** Part: the button that opens the sheet. Pass your button as `render={<Button>Open</Button>}`. */\nexport function SheetTrigger({ onPointerDown, onKeyDown, ...props }: Drawer.Trigger.Props): JSX.Element {\n  useSheetPart(\"SheetTrigger\", \"…\");\n  return (\n    <Drawer.Trigger\n      {...(props.render === undefined ? { className: \"forced-colors:border forced-colors:border-solid\", \"data-ouro-control\": \"sheet\", \"data-ouro-part\": \"trigger\" } : {})}\n      {...props}\n      onPointerDown={(event) => {\n        onPointerDown?.(event);\n        holdPageAtPress.dialog.onPointerDown(event);\n      }}\n      onKeyDown={(event) => {\n        onKeyDown?.(event);\n        holdPageAtPress.dialog.onKeyDown(event);\n      }}\n    />\n  );\n}\n\n/**\n * Part: moves the sheet to the end of `<body>` and makes it aware of the\n * software keyboard (`Drawer.VirtualKeyboardProvider`), so focused inputs stay visible.\n * The portal is its own stacking context at the `--ouro-layer` z-index (50 by default,\n * from ouro-base.css). If your app has fixed bars above z-50, raise it in a `:root`\n * rule of your own after the Ouro tokens, outside any `@layer`: `:root { --ouro-layer: 60; }`.\n * Don't edit the line shadcn wrote; `shadcn add` resets it.\n * @claim \"The portal is its own stacking\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet stacking above the app's fixed bars > puts the portal on the --ouro-layer level, as its own stacking context)\n * @claim \"The portal is its own stacking\" registry/ouro/theme/ouro-base.css verify:fileLine(registry/ouro/theme/ouro-base.css, /^\\s+--ouro-layer:\\s50;/)\n */\nexport function SheetPortal(props: Omit<Drawer.Portal.Props, \"className\">): JSX.Element {\n  useSheetPart(\"SheetPortal\", \"…\");\n  return (\n    <Drawer.VirtualKeyboardProvider>\n      {/* The keyboard's inset, 0px until Base UI sets it on the viewport inside: set there as each sheet opens, it\n          changed what the whole sheet inherits and restyled all of it once more in the middle of the press. Under a\n          0px of the same name it changes nothing until a keyboard shows. */}\n      <Drawer.Portal {...props} data-ouro=\"sheet-portal\" className=\"relative isolate z-(--ouro-layer) [--drawer-keyboard-inset:0px]\">\n        <PortalScope>{props.children}</PortalScope>\n      </Drawer.Portal>\n    </Drawer.VirtualKeyboardProvider>\n  );\n}\n\n/**\n * Part: the dimming layer. It lightens as the sheet is dragged away. On iOS it\n * stays anchored to the top of the screen on a scrolled page. A `ref` reaches\n * the backdrop element.\n */\nexport function SheetBackdrop({\n  ref,\n  ...props\n}: Omit<Drawer.Backdrop.Props, \"className\"> & { ref?: Ref<HTMLDivElement> | undefined }): JSX.Element {\n  useSheetPart(\"SheetBackdrop\", \"…\");\n  const anchorRef = useBackdropAnchor(ref);\n  return <Drawer.Backdrop {...props} ref={anchorRef} data-ouro=\"sheet-backdrop\" className={backdropClass} />;\n}\n\n/**\n * Keeps a sheet under the finger that catches it while it is still moving. On each event\n * that can begin a drag, until Base UI has begun one, it writes how far the sheet is from\n * rest to `--ouro-sheet-grab` on the popup: that is where Base UI starts the drag from.\n * The listeners are on the window, on the way down, because Base UI begins a touch drag\n * from a listener on the document that stops the event there.\n * @claim \"On each event that can begin\" registry/ouro/components/ouro/sheet/sheet.touch.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.touch.test.tsx::Sheet on a phone > stays under a finger that catches it by its scrolling body, where the drag starts with the first move)\n * @claim \"On each event that can begin\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > keeps the variables a drag rewrites out of the sheet's content)\n */\nfunction useGrabOffset(side: SheetSide): (viewport: HTMLDivElement) => () => void {\n  return useCallback(\n    (viewport) => {\n      const horizontal = side === \"left\" || side === \"right\";\n      // Whether the press may still need measuring: it is inside the viewport, Base UI has not begun a drag, and the sheet is moving.\n      let watching = false;\n      /** Writes how far the sheet is from rest. Returns whether to measure again on the next move. */\n      const measure = () => {\n        const popup = viewport.querySelector<HTMLElement>('[data-ouro=\"sheet\"]');\n        // Base UI turns the popup's transition off for as long as it drags it: the drag has begun.\n        if (!popup || popup.style.transitionProperty === \"none\") return false;\n        const style = getComputedStyle(popup);\n        const live = new DOMMatrixReadOnly(style.transform);\n        const rest = horizontal ? 0 : parseFloat(style.getPropertyValue(\"--drawer-snap-point-offset\"));\n        popup.style.setProperty(\"--ouro-sheet-grab\", `${(horizontal ? live.m41 : live.m42) - rest}px`);\n        // A sheet that stands still is where this measured it for the rest of the press, so a\n        // mouse that drags a slider or selects text inside it reads no style on its moves.\n        return popup.getAnimations().length > 0;\n      };\n      const onDown = (event: PointerEvent) => {\n        watching = viewport.contains(event.target as Node) && measure();\n      };\n      const onMove = () => {\n        if (watching) watching = measure();\n      };\n      const onEnd = () => {\n        watching = false;\n      };\n      addEventListener(\"pointerdown\", onDown, true);\n      addEventListener(\"pointermove\", onMove, true);\n      addEventListener(\"pointerup\", onEnd, true);\n      addEventListener(\"pointercancel\", onEnd, true);\n      return () => {\n        removeEventListener(\"pointerdown\", onDown, true);\n        removeEventListener(\"pointermove\", onMove, true);\n        removeEventListener(\"pointerup\", onEnd, true);\n        removeEventListener(\"pointercancel\", onEnd, true);\n      };\n    },\n    [side],\n  );\n}\n\n/** Part: the full-screen layer that positions the popup against its edge. A `ref` reaches the viewport element. */\nexport function SheetViewport({\n  ref,\n  ...props\n}: Omit<Drawer.Viewport.Props, \"className\"> & { ref?: Ref<HTMLDivElement> | undefined }): JSX.Element {\n  const { side, modal } = useSheetPart(\"SheetViewport\", \"…\");\n  const viewportRef = useMergedRef(ref, useGrabOffset(side));\n  return (\n    <Drawer.Viewport\n      {...props}\n      ref={viewportRef}\n      data-ouro=\"sheet-viewport\"\n      data-side={side}\n      // `overflow-clip`, not `overflow-hidden`: a hidden box is still a scroll container, so\n      // scrolling a control into view while the sheet enters would scroll the viewport and\n      // leave the sheet floating above its edge.\n      // A non-modal sheet's viewport lets presses through to the page around the sheet.\n      className={cn(\"fixed inset-0 z-1000 flex overflow-clip touch-none\", !modal && \"pointer-events-none\", viewportClasses[side])}\n    />\n  );\n}\n\n/** Props for {@link SheetPopup}. `className` is for layout only (width, margins). */\nexport type SheetPopupProps = Omit<Drawer.Popup.Props, \"className\"> & { className?: string | undefined };\n\n/** Part: the sheet panel. It stretches past its edge when pulled and springs back on release. */\nexport function SheetPopup(props: SheetPopupProps): JSX.Element {\n  useAppearanceClassNameCheck(\n    \"SheetPopup\",\n    props.className,\n    process.env.NODE_ENV !== \"production\"\n      ? sheetHint(\"<SheetPopup>\", \"</SheetPopup>\")\n      : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  return <SheetPopupUnchecked {...props} />;\n}\n\n/**\n * The popup without its own className check, for `Sheet`, which checks its own `className`.\n *\n * @internal\n */\nexport function SheetPopupUnchecked({ className, ...props }: SheetPopupProps): JSX.Element {\n  const { side, snap, modal } = useSheetPart(\"SheetPopup\", \"…\");\n  return (\n    <Drawer.Popup\n      {...props}\n      className={cn(\n        popupBase,\n        popupSides[side],\n        side === \"bottom\" && bottomPadding[snap ? \"snap\" : \"fit\"],\n        side === \"top\" && snap && \"h-[calc(100dvh-var(--ouro-sheet-gap))]\",\n        !modal && \"pointer-events-auto\",\n        className,\n      )}\n      aria-modal={modal ? \"true\" : undefined}\n      data-ouro=\"sheet\"\n      data-side={side}\n      data-snap-points={snap ? \"\" : undefined}\n      data-modal={modal ? undefined : \"false\"}\n    />\n  );\n}\n\n/** Part: the grab handle at the free edge of a bottom or top sheet. Decorative; renders nothing on side sheets. */\nexport function SheetHandle(): JSX.Element | null {\n  const { side } = useSheetPart(\"SheetHandle\", \"<SheetHandle />…\");\n  if (side === \"left\" || side === \"right\") return null;\n  return (\n    <div\n      aria-hidden=\"true\"\n      data-ouro-sheet-handle=\"\"\n      className=\"flex shrink-0 justify-center py-2 touch-none\"\n    >\n      <div className=\"h-1.25 w-9 rounded-full bg-border\" />\n    </div>\n  );\n}\n\n/** Props for {@link SheetTitle}. */\nexport type SheetTitleProps = Omit<Drawer.Title.Props, \"className\"> & {\n  /** Hides the title visually; it still names the dialog for screen readers. */\n  visuallyHidden?: boolean | undefined;\n};\n\n/**\n * Part: the sheet's title, which names the dialog. Every sheet needs one.\n *\n * @claim \"Every sheet needs one\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:fileLine(registry/ouro/components/ouro/sheet/sheet.test.tsx, /warns\\swhen\\sthe\\stitle\\sis\\smissing/)\n */\nexport function SheetTitle({ visuallyHidden, ...props }: SheetTitleProps): JSX.Element {\n  useSheetPart(\"SheetTitle\", \"<SheetTitle>…</SheetTitle>…\");\n  return (\n    <Drawer.Title\n      {...props}\n      data-ouro-sheet-title=\"\"\n      className={\n        visuallyHidden\n          ? \"sr-only\"\n          : \"m-0 font-[family-name:var(--font-heading,inherit)] text-lg leading-6 font-semibold text-balance text-popover-foreground\"\n      }\n    />\n  );\n}\n\n/** Part: a line under the title that describes the dialog. */\nexport function SheetDescription(props: Omit<Drawer.Description.Props, \"className\">): JSX.Element {\n  useSheetPart(\"SheetDescription\", \"<SheetDescription>…</SheetDescription>…\");\n  return (\n    <Drawer.Description\n      {...props}\n      data-ouro-sheet-description=\"\"\n      className=\"m-0 text-sm leading-5 text-muted-foreground\"\n    />\n  );\n}\n\n/** Props for {@link SheetContent}. `className` is for layout only. */\nexport type SheetContentProps = Omit<Drawer.Content.Props, \"className\"> & { className?: string | undefined };\n\n/**\n * Part: the scrollable body. A mouse can select text in it without dragging the\n * sheet; touch still drags from anywhere once the body is scrolled to the top.\n * While it overflows it is a tab stop, so a keyboard can scroll it.\n * Its focus ring is drawn over the content, so a header that sticks to the top never hides an edge of it.\n * @claim \"Its focus ring is drawn over the content\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::SheetContent > draws its focus ring whole over content that sticks to an edge, and leaves the pointer to the content)\n */\nexport function SheetContent({ className, ref, ...props }: SheetContentProps): JSX.Element {\n  const scrollRef = useMergedRef(ref, useKeyboardScrollable<HTMLDivElement>(props.tabIndex === undefined));\n  useSheetPart(\"SheetContent\", \"<SheetContent>…</SheetContent>\");\n  useAppearanceClassNameCheck(\n    \"SheetContent\",\n    className,\n    process.env.NODE_ENV !== \"production\"\n      ? sheetHint(\"<SheetContent>\", \"</SheetContent>\")\n      : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  // The wrapper takes the body's place in the sheet's column; the scroller fills it. Its focus ring is a sibling drawn\n  // over the scroller, so content that sticks to an edge inside the body never covers it.\n  return (\n    <div className=\"relative box-border flex min-h-0 flex-1 flex-col\">\n      <Drawer.Content\n        data-ouro-control=\"sheet\"\n        data-ouro-part=\"content\"\n        {...props}\n        ref={scrollRef}\n        data-ouro-sheet-content=\"\"\n        className={cn(\n          \"peer box-border min-h-0 flex-1 overflow-y-auto overscroll-contain touch-auto px-5 pt-2 pb-5 outline-none focus-visible:isolate\",\n          // Under forced colours, where the body ends while it is one.\n          \"forced-colors:[&[tabindex='0']]:outline-1 forced-colors:[&[tabindex='0']]:outline-solid forced-colors:[&[tabindex='0']]:-outline-offset-1\",\n          className,\n        )}\n      />\n      <span\n        aria-hidden=\"true\"\n        data-sheet-focus-ring=\"\"\n        className=\"pointer-events-none absolute inset-0 hidden rounded-[inherit] outline-ring -outline-offset-2 peer-focus-visible:block peer-focus-visible:outline-2 peer-focus-visible:outline-solid\"\n      />\n    </div>\n  );\n}\n\n\n/** Part: closes the sheet. Pass your button as `render={<Button>Done</Button>}`. */\nexport function SheetClose(props: Drawer.Close.Props): JSX.Element {\n  useSheetPart(\"SheetClose\", \"<SheetContent><SheetClose>…</SheetClose></SheetContent>\");\n  return <Drawer.Close {...(props.render === undefined ? { className: \"forced-colors:border forced-colors:border-solid\", \"data-ouro-control\": \"sheet\", \"data-ouro-part\": \"close\" } : {})} {...props} />;\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/sheet/sheet-parts.tsx"
    },
    {
      "path": "registry/ouro/components/ouro/sheet/sheet-styles.ts",
      "content": "export { sheetSides, sideWarning, iosBackdrop, footerClass, sheetHint, registerSheetProperties };\nexport type { SheetSide };\n\n// Shared class strings, value lists and dev-message helpers for Sheet, its parts and\n// Dialog. They live apart from the components so each component file exports only\n// components, which React Fast Refresh needs (and an app's linter checks). The export\n// list comes first because the shadcn CLI drops comments before a file's first statement.\n\n/** The edge a sheet slides in from, and is dragged back to, to dismiss. */\ntype SheetSide = \"bottom\" | \"top\" | \"left\" | \"right\";\n\n/**\n * The four sides, for checking a `side` prop. Shared with `Sheet`.\n *\n * @internal\n * @claim \"The four sides, for checking a\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet dev messages > warns once about guessed props and drops them)\n */\nconst sheetSides: readonly SheetSide[] = [\"bottom\", \"top\", \"left\", \"right\"];\n\n/**\n * The dev message for a side that is not one of {@link sheetSides}. Development only.\n *\n * @internal\n */\nfunction sideWarning(side: string, fix: string): readonly [string, string] {\n  return [`side=\"${side}\" is not a side; use ${sheetSides.map((name) => `\"${name}\"`).join(\", \")}`, fix];\n}\n\n/**\n * iOS 26+ Safari draws the page under its translucent toolbars, and a fixed element\n * stops at the toolbars, leaving the page under them undimmed. Base UI's guidance is\n * position: absolute (with body { position: relative } in the app). A library cannot\n * set that on body, and Base UI's iOS scroll lock keeps the page's scroll offset, so an\n * absolute backdrop would sit at the top of the document, off screen on a scrolled\n * page. The backdrops therefore keep --ouro-backdrop-top at the offset that puts them at\n * the top of the screen (useBackdropAnchor), and the large viewport height reaches under\n * the toolbars. Shared with the dialog backdrop.\n *\n * @internal\n * @claim \"iOS 26+ Safari draws the page\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet iOS backdrop rule > covers the visible screen on a page scrolled 2000px)\n * @claim \"iOS 26+ Safari draws the page\" registry/ouro/components/ouro/sheet/sheet-styles.ts verify:fileLine(registry/ouro/components/ouro/sheet/sheet-styles.ts, /supports-\\[-webkit-touch-callout:none\\]:h-lvh/)\n */\nconst iosBackdrop =\n  \"supports-[-webkit-touch-callout:none]:absolute supports-[-webkit-touch-callout:none]:inset-x-0 \" +\n  \"supports-[-webkit-touch-callout:none]:top-[var(--ouro-backdrop-top,0px)] supports-[-webkit-touch-callout:none]:bottom-auto \" +\n  \"supports-[-webkit-touch-callout:none]:h-lvh\";\n\n/**\n * The actions row of a Dialog, in either presentation: a row at the end from 640px up.\n * Below it the actions stack full width in DOM order, so the primary action (last)\n * sits at the bottom, nearest the thumb. Shared with `DialogFooter`.\n *\n * @internal\n * @claim \"The actions row of a Dialog\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::footer > renders footer as the actions row after the body, and closes from an action wrapped in SheetClose)\n * @claim \"The actions row of a Dialog\" registry/ouro/components/ouro/sheet/sheet-styles.ts verify:fileLine(registry/ouro/components/ouro/sheet/sheet-styles.ts, /const\\sfooterClass\\s=\\s\"box-border\\sflex\\sshrink-0\\sjustify-end\\sgap-3\\spx-5\\spt-3\\spb-5\\smax-sm:flex-col\\smax-sm:\\*:w-full\"/)\n * @claim \"The actions row of a Dialog\" registry/ouro/components/ouro/dialog/dialog.test.tsx verify:testExists(registry/ouro/components/ouro/dialog/dialog.test.tsx::footer > lays out actions in a row at the end on wide screens)\n */\nconst footerClass = \"box-border flex shrink-0 justify-end gap-3 px-5 pt-3 pb-5 max-sm:flex-col max-sm:*:w-full\";\n\n/**\n * The Fix code for an appearance class on a sheet part: the theme's CSS variables\n * for colors and radius, or a wrapper inside `open`…`close` for text classes.\n * Development only.\n *\n * @internal\n */\nfunction sheetHint(open: string, close: string) {\n  return (token: string): string => {\n    if (token.startsWith(\"rounded\")) {\n      return `:root { --radius: ${token === \"rounded-none\" ? \"0px\" : \"0.75rem\"} }`;\n    }\n    if (/^(text|font)-/.test(token)) return `${open}<div className=\"${token}\">…</div>${close}`;\n    return \":root { --popover: …; } .dark { --popover: …; }\";\n  };\n}\n\n/**\n * Registers the variables a drag rewrites on the sheet every frame as not inherited, so\n * the sheet's content is not restyled on each of those frames. Nothing inside a sheet\n * reads them. It does nothing where they are registered already (a second copy of this\n * module) and where there is no `CSS.registerProperty`: on the server and in a browser\n * without it, where the variables inherit as before.\n *\n * It also registers Base UI's own drawer variables, as Base UI does (DrawerPopup's layout\n * effect, through removeCSSVariableInheritance), when the module loads. Left to Base UI, they are registered as\n * its first sheet opens, restyling the whole page in the middle of that press; registered\n * here, Base UI finds them registered and does nothing.\n *\n * @internal\n * @claim \"Registers the variables a drag rewrites\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > keeps the variables a drag rewrites out of the sheet's content)\n * @claim \"It does nothing where they are\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > registers its variables once: a second copy of the module finds them registered and does nothing)\n * @claim \"It also registers Base UI's own drawer variables\" site/e2e/site-menu.spec.ts verify:testExists(site/e2e/site-menu.spec.ts::on a phone the menu's first open registers no CSS property, on the home page or a docs page, so it restyles no more of the page than the sheet)\n */\nfunction registerSheetProperties(): void {\n  const properties: PropertyDefinition[] = [\n    ...[\"--ouro-sheet-x\", \"--ouro-sheet-y\", \"--ouro-sheet-grab\"].map((name) => ({ name, syntax: \"<length>\", inherits: false, initialValue: \"0px\" })),\n    // A transform function, which no syntax but the universal one can hold with `var()` in it.\n    { name: \"--ouro-sheet-transform\", syntax: \"*\", inherits: false },\n    // Base UI's, as it registers them.\n    ...[\"--drawer-swipe-movement-x\", \"--drawer-swipe-movement-y\", \"--drawer-snap-point-offset\"].map((name) => ({ name, syntax: \"<length>\", inherits: false, initialValue: \"0px\" })),\n    { name: \"--drawer-swipe-progress\", syntax: \"<number>\", inherits: false, initialValue: \"0\" },\n    { name: \"--drawer-swipe-strength\", syntax: \"<number>\", inherits: false, initialValue: \"1\" },\n    // Base UI's too, which it sets on the popup as each sheet opens and does not register: inherited, it restyled the\n    // whole sheet once more in the middle of the press. Base UI reads it on the popup only.\n    { name: \"--drawer-frontmost-height\", syntax: \"*\", inherits: false },\n  ];\n  for (const property of properties) {\n    try {\n      CSS.registerProperty(property);\n    } catch {\n      // Registered already, or nothing to register with.\n    }\n  }\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/sheet/sheet-styles.ts"
    },
    {
      "path": "registry/ouro/components/ouro/sheet/sheet.tsx",
      "content": "\"use client\";\n\nimport type { JSX, ReactElement, ReactNode } from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { checkOpenMode, type TriggerOrOpen } from \"@/registry/ouro/lib/ouro/open-mode\";\nimport { TouchTarget } from \"@/registry/ouro/lib/ouro/touch-target\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport {\n  SheetBackdrop,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetHandle,\n  SheetPopupUnchecked,\n  SheetPortal,\n  SheetRoot,\n  SheetTitle,\n  SheetTrigger,\n  SheetViewport,\n  type SheetPopupProps,\n  type SheetSnapPoint,\n} from \"@/registry/ouro/components/ouro/sheet/sheet-parts\";\nimport { footerClass, sheetHint, sheetSides, sideWarning, type SheetSide } from \"@/registry/ouro/components/ouro/sheet/sheet-styles\";\n\nexport type { SheetSide, SheetSnapPoint } from \"@/registry/ouro/components/ouro/sheet/sheet-parts\";\n\n/** Props shared by both ways of opening a Sheet. */\nexport interface SheetBaseProps {\n  /**\n   * Names the sheet for screen readers and shows at its top. Always required; hide it with `hideTitle`.\n   *\n   * @claim \"Always required; hide it with `hideTitle`\" registry/ouro/components/ouro/sheet/sheet.test-d.ts verify:fileLine(registry/ouro/components/ouro/sheet/sheet.test-d.ts, /\\{\\strigger:\\sReactElement;\\schildren:\\s\"Body\"\\s\\}>\\(\\)\\.not\\.toExtend<SheetProps>/)\n   */\n  title: string;\n  /** Hides the title visually. It still names the dialog for screen readers. */\n  hideTitle?: boolean | undefined;\n  /**\n   * The label of the sheet's close button: an icon button in the top corner, in view, with a\n   * 44px target on a touch screen, as Dialog's is, so a mouse user sees how to close the sheet\n   * and a phone's screen reader (which has no Escape key) can always close it. It is the last\n   * control in the sheet. Escape and a press on the backdrop close it too. With `hideTitle`\n   * the button sits over the body's top corner, so leave that corner clear. @default \"Close\"\n   * @claim \"an icon button in the top corner, in view\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::close control > shows a Close icon button in the top corner without focus, last in the sheet, that closes it)\n   */\n  closeLabel?: string | undefined;\n  /** A short line under the title, read out when the sheet opens. */\n  description?: ReactNode;\n  /** The edge the sheet slides in from and is dragged back to. @default \"bottom\" */\n  side?: SheetSide | (string & { 'Use \"bottom\", \"top\", \"left\" or \"right\"': never }) | undefined;\n  /**\n   * Heights a bottom or top sheet rests at, smallest first: fractions of the\n   * viewport (`0.5`), `px` or `rem`. `snapPoints={[0.5, 1]}` opens at half\n   * height and drags up to full. Without snap points the sheet fits its content.\n   * @claim \"Heights a bottom or top sheet\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > opens at the first snap point, as a fraction of the viewport)\n   * @claim \"Heights a bottom or top sheet\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::feel > gives a top sheet with snap points the full height less the gap, and fits a top sheet without them)\n   */\n  snapPoints?: SheetSnapPoint[] | undefined;\n  /**\n   * Whether the sheet shuts off the rest of the page while it is open. `false` makes it a\n   * panel beside a page the person keeps using, such as a live preview of a look: no backdrop,\n   * no focus trap and no scroll lock, the page stays at full strength and in reach, and a press\n   * or focus on the page leaves the sheet open. Escape, with focus in the sheet, and its close\n   * button, shown at its top corner, close it. @default true\n   * @claim \"Whether the sheet shuts off the\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > draws no backdrop and leaves the page at full strength, in reach and scrolling)\n   * @claim \"Whether the sheet shuts off the\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > is a dialog without aria-modal, lets focus leave it, and stays open when focus or a press goes to the page)\n   * @claim \"makes it a panel beside\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > draws no backdrop and leaves the page at full strength, in reach and scrolling)\n   * @claim \"makes it a panel beside\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > is a dialog without aria-modal, lets focus leave it, and stays open when focus or a press goes to the page)\n   * @claim \"Escape, with focus in the sheet\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > closes on Escape from inside it, and from its close button, which shows at its top corner)\n   * @claim \"Whether the sheet shuts off the\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::non-modal sheet > stays modal by default, with its backdrop)\n   */\n  modal?: boolean | undefined;\n  /** The body. It scrolls when it is taller than the sheet. */\n  children: ReactNode;\n  /** The actions row, stacked full width on phones; primary action last. */\n  footer?: ReactNode;\n  /**\n   * Layout only, applied to the sheet panel: width and margins (`max-w-lg`,\n   * `mx-auto`). Your classes win over Ouro UI's. Appearance classes warn in development.\n   */\n  className?: string | undefined;\n\n  /** Not a prop. Ouro UI uses `open` with `onOpenChange`: `<Sheet open={open} onOpenChange={setOpen}>`. */\n  isOpen?: { 'Use <Sheet open={open} onOpenChange={setOpen}>': never };\n  /** Not a prop. `onOpenChange(false)` fires on close: `<Sheet open={open} onOpenChange={setOpen}>`. */\n  onClose?: { 'Use <Sheet open={open} onOpenChange={setOpen}>': never };\n  /** Not a prop. Ouro UI uses `side`: `<Sheet side=\"bottom\">`. */\n  position?: { 'Use <Sheet side=\"bottom\">': never };\n  /** Not a prop. A sheet fits its content; to set heights use `snapPoints={[0.5, 1]}`. */\n  size?: { 'Use <Sheet snapPoints={[0.5, 1]}>': never };\n}\n\n/** An uncontrolled Sheet: `trigger` opens it. */\nexport type SheetWithTriggerProps = SheetBaseProps & {\n  /** The element that opens the sheet, usually a Button: `trigger={<Button>Save</Button>}`. */\n  trigger: ReactElement;\n  /** Not with `trigger`. Remove `trigger` to control the sheet with `open` and `onOpenChange`. */\n  open?: TriggerOrOpen;\n  /** Not with `trigger`. Remove `trigger` to control the sheet with `open` and `onOpenChange`. */\n  onOpenChange?: never;\n};\n\n/** A controlled Sheet: you own `open` and update it in `onOpenChange`. */\nexport type SheetControlledProps = SheetBaseProps & {\n  /** Whether the sheet is open. */\n  open: boolean;\n  /** Called with `false` when the user dismisses the sheet (swipe, Escape, outside press). */\n  onOpenChange: (open: boolean) => void;\n  /** Not with `open`. Remove `open` and `onOpenChange` to let a trigger open the sheet. */\n  trigger?: never;\n};\n\n/** Props for {@link Sheet}: either `trigger`, or `open` with `onOpenChange`. */\nexport type SheetProps = SheetWithTriggerProps | SheetControlledProps;\n\n/**\n * A panel that slides in from an edge and is dragged back to dismiss: the\n * mobile form of a dialog. It stretches when pulled past its edge, its backdrop\n * lightens as it is dragged away, and it springs back on release. It handles\n * focus, Escape, scroll locking, safe areas and the software keyboard.\n *\n * Use `trigger` for a sheet a button opens, or `open` with `onOpenChange` to\n * control it. Use `Dialog` instead when the content should be a centered\n * dialog on larger screens; it renders this sheet on phones.\n *\n * To close the sheet from an action, control it (`open`/`onOpenChange`) and set\n * `open` to `false` in the handler, or wrap each action in `SheetClose`\n * (`import { SheetClose } from \"@/components/ouro/sheet/sheet-parts\"`, with your components alias):\n * `<SheetClose render={<Button>Copy link</Button>} />`.\n *\n * It stacks above the page at `--ouro-layer`, a z-index of 50 by default (from\n * ouro-base.css). If your app has fixed bars above z-50, raise it in a `:root` rule\n * of your own after the Ouro tokens, outside any `@layer`: `:root { --ouro-layer: 60; }`.\n * Don't edit the `--ouro-layer: 50` line shadcn wrote; `shadcn add` resets it.\n *\n * Testing accessibility: in WebKit, Base UI's focus guards take `role=\"button\"`\n * without a name so VoiceOver's cursor stays trapped. Exclude them:\n * `new AxeBuilder({ page }).exclude(\"[data-base-ui-focus-guard]\")`.\n *\n * @group Overlays\n * @see https://ui.ouroboros.bot/docs/sheet\n *\n * @example\n * <Sheet title=\"Save to cookbook\" trigger={<Button>Save</Button>}>\n *   <CookbookList />\n * </Sheet>\n * <Sheet title=\"Filters\" open={open} onOpenChange={setOpen} snapPoints={[0.5, 1]}>\n *   <FilterForm />\n * </Sheet>\n * @claim \"It stacks above the page at\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet stacking above the app's fixed bars > stays above a fixed app bar at the same level: a tie, which the portal wins as the last child of body)\n * @claim \"It stacks above the page at\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet stacking above the app's fixed bars > puts the portal on the --ouro-layer level, as its own stacking context)\n * @claim \"It stacks above the page at\" registry/ouro/theme/ouro-base.css verify:fileLine(registry/ouro/theme/ouro-base.css, /^\\s+--ouro-layer:\\s50;/)\n * @claim \"Testing accessibility: in WebKit, Base UI's\" test/axe-exclude.test.tsx verify:testExists(test/axe-exclude.test.tsx::matches the open dialog's focus guards, and with them excluded the accessibility gate finds nothing)\n * @claim \"To close the sheet from an\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::footer > renders footer as the actions row after the body, and closes from an action wrapped in SheetClose)\n * @claim \"To close the sheet from an\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::close control > takes its label from closeLabel and closes a controlled sheet through onOpenChange)\n */\nexport function Sheet(props: SheetProps): JSX.Element {\n  const {\n    title,\n    hideTitle,\n    closeLabel = \"Close\",\n    description,\n    side: sideProp = \"bottom\",\n    snapPoints,\n    modal,\n    children,\n    footer,\n    className,\n    trigger,\n    open,\n    onOpenChange,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    isOpen,\n    onClose,\n    position,\n    size,\n  } = props as SheetBaseProps & {\n    trigger?: ReactElement;\n    open?: boolean;\n    onOpenChange?: (open: boolean) => void;\n  };\n\n  checkOpenMode(\"Sheet\", \"sheet\", trigger !== undefined, open, onOpenChange);\n\n  // A side that is not one of Ouro UI's (a type error) warns and renders a bottom sheet.\n  const side = sheetSides.includes(sideProp as SheetSide) ? (sideProp as SheetSide) : \"bottom\";\n\n  useAppearanceClassNameCheck(\n    \"Sheet\",\n    className,\n    process.env.NODE_ENV !== \"production\"\n      ? sheetHint('<Sheet title=\"…\">', \"</Sheet>\")\n      : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Sheet\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          !title && [\"title is required; it names the sheet for screen readers\", '<Sheet title=\"Share\">'],\n          side !== sideProp && sideWarning(String(sideProp), '<Sheet side=\"bottom\">'),\n          isOpen !== undefined && [\"isOpen is not a prop\", \"<Sheet open={open} onOpenChange={setOpen}>\"],\n          onClose !== undefined && [\"onClose is not a prop\", \"<Sheet open={open} onOpenChange={setOpen}>\"],\n          position !== undefined && [\"position is not a prop\", '<Sheet side=\"bottom\">'],\n          size !== undefined && [\"size is not a prop; a sheet fits its content\", \"<Sheet snapPoints={[0.5, 1]}>\"],\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n\n  return (\n    <SheetFrame\n      title={title}\n      hideTitle={hideTitle}\n      closeLabel={closeLabel}\n      description={description}\n      side={side}\n      snapPoints={snapPoints}\n      modal={modal}\n      className={className}\n      trigger={trigger}\n      open={open}\n      onOpenChange={onOpenChange}\n      footer={footer}\n    >\n      {children}\n    </SheetFrame>\n  );\n}\n\n/**\n * The close button: in view at the top corner, as Dialog's is, with `TouchTarget` for a coarse pointer.\n */\nconst closeClass =\n  \"press absolute end-3 z-1 m-0 box-border inline-flex size-8 cursor-default items-center justify-center rounded-ouro-lg border-0 bg-transparent p-0 \" +\n  \"text-muted-foreground outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid \" +\n  \"pointer-fine:hover:bg-muted pointer-fine:hover:text-foreground motion-safe:active:scale-(--ouro-press-scale) \" +\n  \"forced-colors:border forced-colors:border-solid disabled:cursor-not-allowed disabled:opacity-50\";\n\n/** Props for {@link SheetFrame}: a Sheet's props after its checks, plus what `Dialog` adds. */\nexport interface SheetFrameProps {\n  title: string;\n  hideTitle?: boolean | undefined;\n  closeLabel: string;\n  description?: ReactNode;\n  side: SheetSide;\n  snapPoints?: SheetSnapPoint[] | undefined;\n  /** `false` leaves the page in use beside the sheet (`Sheet`'s `modal`). @default true */\n  modal?: boolean | undefined;\n  children: ReactNode;\n  className?: string | undefined;\n  /** The opening element. May come with `open`, when `Dialog` owns the state. */\n  trigger?: ReactElement | undefined;\n  open?: boolean | undefined;\n  onOpenChange?: ((open: boolean) => void) | undefined;\n  /** An actions row below the body (`Dialog`'s `footer`). */\n  footer?: ReactNode;\n  /** Marks the popup with `data-ouro-presentation`, when `Dialog` renders as a sheet. */\n  presentation?: \"sheet\" | undefined;\n  /** Where focus goes on close: `Dialog` passes its own trigger, which it renders outside the sheet, and `Command` a choice of its own. */\n  finalFocus?: SheetPopupProps[\"finalFocus\"];\n  /** What takes focus as the sheet opens: `Command` puts it in its search after a key press or a click, and on the sheet itself after a touch or pen tap. */\n  initialFocus?: SheetPopupProps[\"initialFocus\"];\n  /** Disables the close button, as `EditSheet` does while a save is pending. */\n  closeDisabled?: boolean | undefined;\n  /** Keeps the closed sheet's content in the page, hidden, so an open only shows it (`Navbar` builds its sheet ahead of the press). */\n  keepMounted?: boolean | undefined;\n  /** Called once an open or a close has finished, its slide included (`Navbar` builds its kept sheet afresh after a close). */\n  onOpenChangeComplete?: ((open: boolean) => void) | undefined;\n}\n\n/**\n * The sheet's markup, without prop checks: `Sheet` renders it after its own\n * checks, and `Dialog` renders it on phones after Dialog's checks, so every dev\n * message names the component the app wrote.\n *\n * @internal Shared with `Dialog`; apps use `Sheet`.\n * @claim \"The sheet's markup, without prop checks\" registry/ouro/components/ouro/sheet/sheet.test.tsx verify:testExists(registry/ouro/components/ouro/sheet/sheet.test.tsx::Sheet dev messages > throws the exact fix when open comes without onOpenChange)\n * @claim \"The sheet's markup, without prop checks\" registry/ouro/components/ouro/dialog/dialog.test.tsx verify:testExists(registry/ouro/components/ouro/dialog/dialog.test.tsx::Dialog parts > renders the auto DialogPopup for a size that is not one of Ouro UI's, and warns once with the fix)\n */\nexport function SheetFrame({\n  title,\n  hideTitle,\n  closeLabel,\n  description,\n  side,\n  snapPoints,\n  modal = true,\n  children,\n  className,\n  trigger,\n  open,\n  onOpenChange,\n  footer,\n  presentation,\n  finalFocus,\n  initialFocus,\n  closeDisabled,\n  keepMounted,\n  onOpenChangeComplete,\n}: SheetFrameProps): JSX.Element {\n  // A non-modal sheet keeps its header row, which its close button sits in, even with the title hidden.\n  const showHeader = !hideTitle || description !== undefined || !modal;\n  const titleNode = <SheetTitle visuallyHidden={hideTitle}>{title}</SheetTitle>;\n\n  return (\n    <SheetRoot\n      side={side}\n      snapPoints={snapPoints}\n      modal={modal}\n      {...(open !== undefined ? { open, onOpenChange: (next: boolean) => onOpenChange!(next) } : {})}\n      {...(onOpenChangeComplete ? { onOpenChangeComplete } : {})}\n    >\n      {trigger !== undefined && <SheetTrigger render={trigger} />}\n      <SheetPortal keepMounted={keepMounted}>\n        {modal && <SheetBackdrop />}\n        <SheetViewport>\n          <SheetPopupUnchecked\n            className={className}\n            data-ouro-presentation={presentation}\n            {...(finalFocus ? { finalFocus } : {})}\n            initialFocus={initialFocus}\n          >\n            {side === \"bottom\" && <SheetHandle />}\n            {showHeader ? (\n              // The end padding keeps the title clear of the close button in the corner.\n              <div data-ouro-sheet-header=\"\" className=\"grid min-h-12 shrink-0 gap-1 ps-5 pe-14 pt-3 pb-2\">\n                {titleNode}\n                {description !== undefined && <SheetDescription>{description}</SheetDescription>}\n              </div>\n            ) : (\n              titleNode\n            )}\n            <SheetContent>{children}</SheetContent>\n            {footer !== undefined && (\n              <div data-ouro-footer=\"\" className={footerClass}>\n                {footer}\n              </div>\n            )}\n            {side === \"top\" && <SheetHandle />}\n            <SheetClose\n              data-ouro-sheet-close=\"\"\n              disabled={closeDisabled}\n              // Level with the title, which a bottom sheet's handle puts 21px lower; at the top corner when there is no title row.\n              className={`${closeClass} ${side === \"bottom\" && showHeader ? \"top-8.25\" : \"top-3\"}`}\n            >\n              <TouchTarget />\n              <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" className=\"size-4\">\n                <path d=\"M4 4l8 8M12 4l-8 8\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n              </svg>\n              <span className=\"sr-only\">{closeLabel}</span>\n            </SheetClose>\n          </SheetPopupUnchecked>\n        </SheetViewport>\n      </SheetPortal>\n    </SheetRoot>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/sheet/sheet.tsx"
    }
  ],
  "docs": "A panel that slides in from an edge and is dragged back to dismiss: the mobile form of a dialog. Import: import { Sheet } from \"@/components/ouro/sheet/sheet\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: the helpers it imports in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/sheet.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}