@constructive-io/ui 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ai-B7XNnqYL.js → ai-4JrVVL3q.js} +311 -213
- package/dist/ai-4JrVVL3q.js.map +1 -0
- package/dist/{ai-DJ-YPj8c.cjs → ai-B08ufcbD.cjs} +309 -211
- package/dist/ai-B08ufcbD.cjs.map +1 -0
- package/dist/components/ai/index.cjs +1 -1
- package/dist/components/ai/index.d.cts +1 -1
- package/dist/components/ai/index.d.ts +1 -1
- package/dist/components/ai/index.js +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/button.cjs +3 -3
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/collapsible.cjs +1 -1
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.cjs +8 -3
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +4 -1
- package/dist/components/command.d.ts +4 -1
- package/dist/components/command.js +8 -3
- package/dist/components/command.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +2 -2
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/item.d.cts +1 -1
- package/dist/components/item.d.ts +1 -1
- package/dist/components/multi-select.cjs +1 -1
- package/dist/components/multi-select.js +1 -1
- package/dist/components/popover.cjs +7 -0
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.d.cts +7 -1
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.js +7 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/tabs.cjs +5 -2
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +5 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/toggle-group.cjs +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/workspace-kit/index.cjs +51 -21
- package/dist/components/workspace-kit/index.cjs.map +1 -1
- package/dist/components/workspace-kit/index.d.cts +18 -6
- package/dist/components/workspace-kit/index.d.ts +18 -6
- package/dist/components/workspace-kit/index.js +51 -21
- package/dist/components/workspace-kit/index.js.map +1 -1
- package/dist/{fluid-highlight-DxWeZ7iu.js → fluid-highlight-CNELHV8o.js} +26 -11
- package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
- package/dist/{fluid-highlight-AW-OITqJ.cjs → fluid-highlight-YWFRZXsw.cjs} +30 -9
- package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
- package/dist/{index-z3LqQ5L5.d.ts → index-Cluc_xc5.d.ts} +23 -14
- package/dist/{index-CiO-3M_X.d.cts → index-DXoG0ghv.d.cts} +23 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{theme-DTTTlylA.d.ts → theme-CKpIa4Fj.d.cts} +42 -26
- package/dist/{theme-DTTTlylA.d.cts → theme-CKpIa4Fj.d.ts} +42 -26
- package/dist/theme-dials-config.d.cts +1 -1
- package/dist/theme-dials-config.d.ts +1 -1
- package/dist/theme-presets.d.cts +1 -1
- package/dist/theme-presets.d.ts +1 -1
- package/dist/{theme-tuning-TJ76tnxZ.d.cts → theme-tuning-CTOHSrsh.d.cts} +2 -2
- package/dist/{theme-tuning-DjgDvV8V.d.ts → theme-tuning-DOko6Pmy.d.ts} +2 -2
- package/dist/theme-tuning.d.cts +1 -1
- package/dist/theme-tuning.d.ts +1 -1
- package/dist/theme.cjs +28 -22
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +28 -22
- package/dist/theme.js.map +1 -1
- package/package.json +5 -2
- package/src/styles/globals.css +43 -25
- package/dist/ai-B7XNnqYL.js.map +0 -1
- package/dist/ai-DJ-YPj8c.cjs.map +0 -1
- package/dist/fluid-highlight-AW-OITqJ.cjs.map +0 -1
- package/dist/fluid-highlight-DxWeZ7iu.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
6
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -75,7 +75,7 @@ function DropdownMenuItem({ className, inset, variant = "default", asChild, chil
|
|
|
75
75
|
data-[variant=destructive]:data-[highlighted]:text-destructive
|
|
76
76
|
data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11
|
|
77
77
|
rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none
|
|
78
|
-
data-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`, className);
|
|
78
|
+
data-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`, className);
|
|
79
79
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Item, {
|
|
80
80
|
"data-slot": "dropdown-menu-item",
|
|
81
81
|
"data-inset": inset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.cjs","names":["React","MenuPrimitive","cn","FluidHighlight","CheckIcon","CircleIcon","ChevronRightIcon"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":";;;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,sBAAsB,EAAE,WAAW,GAAG,SAA+D;CAC7G,OACC,2CAACA,yBAAc,WAAf;EACC,aAAU;EACV,WAAWC,iBAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAuC;CACpF,OACC,2CAAC,OAAD;EACC,aAAU;EAEV,KAAI;EACJ,WAAWA,iBACV;wEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,GAAG,SAAiE;CAC9F,OAAO,2CAACD,yBAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,4CAACA,yBAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAWC,iBACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,2CAACI,+BAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,8EAA8C;CAEjE,OACC,2CAACL,yBAAc,QAAf;EAAiC;YAChC,2CAACA,yBAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,4CAACA,yBAAc,OAAf;IACC,aAAU;IACV,WAAWC,iBACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,2CAACC,wCAAD,CAAiB,IAChB,QACmB;;EACI;CACL;AAExB"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.cjs","names":["React","MenuPrimitive","cn","FluidHighlight","CheckIcon","CircleIcon","ChevronRightIcon"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,2BAA2BA,MAAM,cAAc,KAAK;AAE1D,SAAS,aAAa,EAAE,GAAG,SAA0D;CACpF,OAAO,2CAACC,yBAAc,MAAf;EAAoB,aAAU;EAAgB,GAAI;CAAQ;AAClE;AAEA,SAAS,mBAAmB,EAAE,GAAG,SAA4D;CAC5F,MAAM,EAAE,4EAA4C;CACpD,OAAO,2CAACA,yBAAc,QAAf;EAAsB,aAAU;EAAkC;EAAW,GAAI;CAAQ;AACjG;AAOA,S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AAiE;CAC9F,OAAO,2CAACD,yBAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,4CAACA,yBAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAWC,iBACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,2CAACI,+BAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,8EAA8C;CAEjE,OACC,2CAACL,yBAAc,QAAf;EAAiC;YAChC,2CAACA,yBAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,4CAACA,yBAAc,OAAf;IACC,aAAU;IACV,WAAWC,iBACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,2CAACC,wCAAD,CAAiB,IAChB,QACmB;;EACI;CACL;AAExB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
4
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
@@ -72,7 +72,7 @@ function DropdownMenuItem({ className, inset, variant = "default", asChild, chil
|
|
|
72
72
|
data-[variant=destructive]:data-[highlighted]:text-destructive
|
|
73
73
|
data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11
|
|
74
74
|
rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none
|
|
75
|
-
data-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`, className);
|
|
75
|
+
data-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`, className);
|
|
76
76
|
return /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
77
77
|
"data-slot": "dropdown-menu-item",
|
|
78
78
|
"data-inset": inset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","names":["React","MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,2BAA2BA,QAAM,cAAc,KAAK;AAE1D,SAAS,aAAa,EAAE,GAAG,SAA0D;CACpF,OAAO,oBAACC,OAAc,MAAf;EAAoB,aAAU;EAAgB,GAAI;CAAQ;AAClE;AAEA,SAAS,mBAAmB,EAAE,GAAG,SAA4D;CAC5F,MAAM,EAAE,cAAc,8BAA8B;CACpD,OAAO,oBAACA,OAAc,QAAf;EAAsB,aAAU;EAAkC;EAAW,GAAI;CAAQ;AACjG;AAOA,SAAS,oBAAoB,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAAmC;CAC7G,MAAM,cAAc,WAAW,UAAa,WAAWD,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACC,OAAc,SAAf;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACL;AAEzB;AAgBA,SAAS,oBAAoB,EAC5B,WACA,aAAa,GACb,OAAO,UACP,QAAQ,SACR,eAAe,gBACf,sBAAsB,uBACtB,kBAAkB,mBAClB,YAAY,aACZ,UACA,GAAG,SACyB;CAC5B,MAAM,EAAE,gBAAgB,8BAA8B;CAEtD,OACC,oBAAC,oBAAD,YACC,oBAACA,OAAc,YAAf;EAAgC;EAAa;EAAmB;EAAY,WAAW;YACtF,qBAACA,OAAc,OAAf;GACC,aAAU;GACV,WAAW,GACV;;;;;;;wFAQA,SACD;GACA,GAAI;aAbL,CAeC,oBAAC,gBAAD,CAAiB,IAChB,QACmB;;CACI,GACP;AAEtB;AAEA,SAAS,kBAAkB,EAAE,GAAG,SAA2D;CAC1F,OACC,oBAAC,yBAAyB,UAA1B;EAA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AA2E,SAAS;EAClG,GAAG;CACJ;CAEA,IAAI,WACH,OAAO,oBAACC,OAAc,YAAf,EAA0B,GAAI,WAAa;CAGnD,OACC,oBAAC,OAAD,EAAK,GAAI,WAAa;AAExB;AAEA,SAAS,sBAAsB,EAAE,WAAW,GAAG,SAA+D;CAC7G,OACC,oBAACA,OAAc,WAAf;EACC,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAuC;CACpF,OACC,oBAAC,OAAD;EACC,aAAU;EAEV,KAAI;EACJ,WAAW,GACV;wEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,GAAG,SAAiE;CAC9F,OAAO,oBAACA,OAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,qBAACA,OAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAW,GACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,oBAAC,kBAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,OAAc,QAAf;EAAiC;YAChC,oBAACA,OAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,qBAACA,OAAc,OAAf;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,oBAAC,gBAAD,CAAiB,IAChB,QACmB;;EACI;CACL;AAExB"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":["React","MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { FluidHighlight } from '../lib/motion/fluid-highlight';\nimport { cn } from '../lib/utils';\n\nconst DropdownMenuGroupContext = React.createContext(false);\n\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>) {\n\treturn <MenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n\tconst { container } = useFloatingOverlayPortalProps();\n\treturn <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" container={container} {...props} />;\n}\n\ntype DropdownMenuTriggerProps = React.ComponentProps<typeof MenuPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuTrigger({ asChild, children, render, nativeButton, ...props }: DropdownMenuTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<MenuPrimitive.Trigger\n\t\t\tdata-slot=\"dropdown-menu-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Trigger>\n\t);\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Popup> & {\n\tsideOffset?: number;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\talign?: 'start' | 'center' | 'end';\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDown?: (e: React.PointerEvent) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonPointerDownOutside?: (e: Event) => void;\n\t/** @deprecated Not supported in Base UI */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI menus mount on open automatically */\n\tforceMount?: boolean;\n};\n\nfunction DropdownMenuContent({\n\tclassName,\n\tsideOffset = 4,\n\tside = 'bottom',\n\talign = 'start',\n\tonPointerDown: _onPointerDown,\n\tonPointerDownOutside: _onPointerDownOutside,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tforceMount: _forceMount,\n\tchildren,\n\t...props\n}: DropdownMenuContentProps) {\n\tconst { zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<DropdownMenuPortal>\n\t\t\t<MenuPrimitive.Positioner side={side} align={align} sideOffset={sideOffset} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</DropdownMenuPortal>\n\t);\n}\n\nfunction DropdownMenuGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.Group>) {\n\treturn (\n\t\t<DropdownMenuGroupContext.Provider value={true}>\n\t\t\t<MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n\t\t</DropdownMenuGroupContext.Provider>\n\t);\n}\n\ntype DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & {\n\tinset?: boolean;\n\tvariant?: 'default' | 'destructive';\n\t/** When true, merges props onto the child element instead of rendering a div */\n\tasChild?: boolean;\n};\n\nfunction DropdownMenuItem({\n\tclassName,\n\tinset,\n\tvariant = 'default',\n\tasChild,\n\tchildren,\n\trender,\n\t...props\n}: DropdownMenuItemProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\tconst itemClassName = cn(\n\t\t`data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive\n\t\tdata-[variant=destructive]:data-[highlighted]:bg-destructive/10 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/40\n\t\tdata-[variant=destructive]:data-[highlighted]:text-destructive\n\t\tdata-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default items-center gap-2 pointer-coarse:min-h-11\n\t\trounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none\n\t\tdata-[disabled]:opacity-64 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n\t\tclassName,\n\t);\n\n\treturn (\n\t\t<MenuPrimitive.Item\n\t\t\tdata-slot=\"dropdown-menu-item\"\n\t\t\tdata-inset={inset}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={itemClassName}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</MenuPrimitive.Item>\n\t);\n}\n\nfunction DropdownMenuCheckboxItem({\n\tclassName,\n\tchildren,\n\tchecked,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n\treturn (\n\t\t<MenuPrimitive.CheckboxItem\n\t\t\tdata-slot=\"dropdown-menu-checkbox-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tchecked={checked}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.CheckboxItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CheckIcon size={16} />\n\t\t\t\t</MenuPrimitive.CheckboxItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.CheckboxItem>\n\t);\n}\n\nfunction DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n\treturn <MenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem>) {\n\treturn (\n\t\t<MenuPrimitive.RadioItem\n\t\t\tdata-slot=\"dropdown-menu-radio-item\"\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5\n\t\t\t\tpe-2 ps-8 text-sm outline-hidden select-none pointer-coarse:min-h-11 data-[disabled]:pointer-events-none data-[disabled]:opacity-64\n\t\t\t\t[&_svg]:pointer-events-none [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className='pointer-events-none absolute start-2 flex size-3.5 items-center justify-center'>\n\t\t\t\t\t<MenuPrimitive.RadioItemIndicator\n\t\t\t\t\t\tkeepMounted\n\t\t\t\t\t\tclassName='transition-[opacity,scale,filter] duration-(--duration-slow) ease-out data-unchecked:scale-[0.25] data-unchecked:opacity-0 data-unchecked:blur-[4px] motion-reduce:transition-none'\n\t\t\t\t\t>\n\t\t\t\t\t<CircleIcon className='size-2 fill-current' />\n\t\t\t\t</MenuPrimitive.RadioItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</MenuPrimitive.RadioItem>\n\t);\n}\n\n/**\n * Uses Base UI's semantic GroupLabel inside DropdownMenuGroup. The standalone\n * div fallback preserves compatibility with earlier Constructive menu markup,\n * where labels were allowed directly inside DropdownMenuContent.\n */\nfunction DropdownMenuLabel({\n\tclassName,\n\tinset,\n\t...props\n}: React.ComponentProps<'div'> & {\n\tinset?: boolean;\n}) {\n\tconst isGrouped = React.useContext(DropdownMenuGroupContext);\n\tconst labelProps = {\n\t\t'data-slot': 'dropdown-menu-label',\n\t\t'data-inset': inset,\n\t\tclassName: cn('text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:ps-8', className),\n\t\t...props,\n\t};\n\n\tif (isGrouped) {\n\t\treturn <MenuPrimitive.GroupLabel {...labelProps} />;\n\t}\n\n\treturn (\n\t\t<div {...labelProps} />\n\t);\n}\n\nfunction DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n\treturn (\n\t\t<MenuPrimitive.Separator\n\t\t\tdata-slot=\"dropdown-menu-separator\"\n\t\t\tclassName={cn('bg-border -mx-1 my-1 h-px', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"dropdown-menu-shortcut\"\n\t\t\t// Key chords read left to right in every script (\"⌘T\", never \"T⌘\"), and a long chord must not shrink.\n\t\t\tdir=\"ltr\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background text-subtle-foreground ms-auto -me-1 inline-flex h-5 max-h-full shrink-0 items-center rounded border\n\t\t\t\tpx-1 font-[inherit] text-[0.625rem] font-medium whitespace-nowrap`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DropdownMenuSub({ ...props }: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n\treturn <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n\tclassName,\n\tinset,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n\tinset?: boolean;\n}) {\n\treturn (\n\t\t<MenuPrimitive.SubmenuTrigger\n\t\t\tdata-slot=\"dropdown-menu-sub-trigger\"\n\t\t\tdata-inset={inset}\n\t\t\tclassName={cn(\n\t\t\t\t`data-[highlighted]:text-accent-foreground data-[popup-open]:bg-accent\n\t\t\t\tdata-[popup-open]:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm pointer-coarse:min-h-11\n\t\t\t\toutline-hidden select-none data-[inset]:ps-8`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<ChevronRightIcon size={16} className='text-muted-foreground/80 ms-auto rtl:rotate-180' />\n\t\t</MenuPrimitive.SubmenuTrigger>\n\t);\n}\n\nfunction DropdownMenuSubContent({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.Popup>) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<MenuPrimitive.Portal container={container}>\n\t\t\t<MenuPrimitive.Positioner side='inline-end' sideOffset={-4} className={zIndexClass}>\n\t\t\t\t<MenuPrimitive.Popup\n\t\t\t\t\tdata-slot=\"dropdown-menu-sub-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground relative origin-(--transform-origin) max-h-(--available-height) min-w-40\n\t\t\t\t\t\tmax-w-(--available-width) overflow-y-auto overscroll-contain rounded-lg border p-1 [overflow-wrap:anywhere]\n\t\t\t\t\t\tshadow-lg transition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t<FluidHighlight />\n\t\t\t\t\t{children}\n\t\t\t\t</MenuPrimitive.Popup>\n\t\t\t</MenuPrimitive.Positioner>\n\t\t</MenuPrimitive.Portal>\n\t);\n}\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,2BAA2BA,QAAM,cAAc,KAAK;AAE1D,SAAS,aAAa,EAAE,GAAG,SAA0D;CACpF,OAAO,oBAACC,OAAc,MAAf;EAAoB,aAAU;EAAgB,GAAI;CAAQ;AAClE;AAEA,SAAS,mBAAmB,EAAE,GAAG,SAA4D;CAC5F,MAAM,EAAE,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GACV;wEAEA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,gBAAgB,EAAE,GAAG,SAAiE;CAC9F,OAAO,oBAACA,OAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ;AAC7E;AAEA,SAAS,uBAAuB,EAC/B,WACA,OACA,UACA,GAAG,SAGD;CACF,OACC,qBAACA,OAAc,gBAAf;EACC,aAAU;EACV,cAAY;EACZ,WAAW,GACV;;mDAGA,SACD;EACA,GAAI;YATL,CAWE,UACD,oBAAC,kBAAD;GAAkB,MAAM;GAAI,WAAU;EAAmD,EAC5D;;AAEhC;AAEA,SAAS,uBAAuB,EAAE,WAAW,UAAU,GAAG,SAA2D;CACpH,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,OAAc,QAAf;EAAiC;YAChC,oBAACA,OAAc,YAAf;GAA0B,MAAK;GAAa,YAAY;GAAI,WAAW;aACtE,qBAACA,OAAc,OAAf;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFAQA,SACD;IACA,GAAI;cAbL,CAeC,oBAAC,gBAAD,CAAiB,IAChB,QACmB;;EACI;CACL;AAExB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
5
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
5
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let motion_react = require("motion/react");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
4
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { motion, useAnimate, useReducedMotion } from "motion/react";
|
|
@@ -16,7 +16,7 @@ interface ItemProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
16
16
|
}
|
|
17
17
|
declare const Item: React$1.ForwardRefExoticComponent<ItemProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
18
18
|
declare const itemMediaVariants: (props?: ({
|
|
19
|
-
variant?: "
|
|
19
|
+
variant?: "image" | "default" | "icon" | null | undefined;
|
|
20
20
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
21
|
interface ItemMediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof itemMediaVariants> {}
|
|
22
22
|
declare function ItemMedia({ className, variant, ...props }: ItemMediaProps): React$1.JSX.Element;
|
|
@@ -16,7 +16,7 @@ interface ItemProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
16
16
|
}
|
|
17
17
|
declare const Item: React$1.ForwardRefExoticComponent<ItemProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
18
18
|
declare const itemMediaVariants: (props?: ({
|
|
19
|
-
variant?: "
|
|
19
|
+
variant?: "image" | "default" | "icon" | null | undefined;
|
|
20
20
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
21
|
interface ItemMediaProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof itemMediaVariants> {}
|
|
22
22
|
declare function ItemMedia({ className, variant, ...props }: ItemMediaProps): React$1.JSX.Element;
|
|
@@ -5,7 +5,7 @@ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
6
|
const require_components_separator = require('./separator.cjs');
|
|
7
7
|
const require_components_badge = require('./badge.cjs');
|
|
8
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
8
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
9
9
|
const require_components_popover = require('./popover.cjs');
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
4
|
import { Separator } from "./separator.js";
|
|
5
5
|
import { Badge } from "./badge.js";
|
|
6
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
6
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
8
8
|
import * as React$1 from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -36,6 +36,12 @@ function PopoverClose({ asChild, children, render, nativeButton, ...props }) {
|
|
|
36
36
|
children: childRender ? void 0 : children
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of
|
|
41
|
+
* the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on
|
|
42
|
+
* any panel that hangs beside one.
|
|
43
|
+
*/
|
|
44
|
+
const popoverSurfaceClass = "rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]";
|
|
39
45
|
function PopoverContent({ className, align = "center", sideOffset = 4, showArrow = false, side = "bottom", children, onOpenAutoFocus: _onOpenAutoFocus, onCloseAutoFocus: _onCloseAutoFocus, onFocusOutside: _onFocusOutside, onEscapeKeyDown: _onEscapeKeyDown, ...props }) {
|
|
40
46
|
const { container, zIndexClass } = (0, _constructive_io_ui_portal.useFloatingOverlayPortalProps)();
|
|
41
47
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_popover.Popover.Portal, {
|
|
@@ -95,4 +101,5 @@ exports.PopoverContent = PopoverContent;
|
|
|
95
101
|
exports.PopoverDescription = PopoverDescription;
|
|
96
102
|
exports.PopoverTitle = PopoverTitle;
|
|
97
103
|
exports.PopoverTrigger = PopoverTrigger;
|
|
104
|
+
exports.popoverSurfaceClass = popoverSurfaceClass;
|
|
98
105
|
//# sourceMappingURL=popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","names":["PopoverPrimitive","React","cn"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CAClF,OAAO,2CAACA,+BAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ;AAC/D;AAOA,SAAS,eAAe,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA8B;CACnG,MAAM,cAAc,WAAW,UAAa,WAAWC,MAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,2CAACD,+BAAiB,SAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACF;AAE5B;AAOA,SAAS,aAAa,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA4B;CAC/F,MAAM,cAAc,WAAW,UAAa,WAAWC,MAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,2CAACD,+BAAiB,OAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACJ;AAE1B;
|
|
1
|
+
{"version":3,"file":"popover.cjs","names":["PopoverPrimitive","React","cn"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\n/**\n * A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of\n * the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on\n * any panel that hangs beside one.\n */\nconst popoverSurfaceClass =\n\t'rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]';\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tpopoverSurfaceClass,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CACl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,SAAS,aAAa,EAAE,WAAW,GAAG,SAA8D;CACnG,OACC,2CAACA,+BAAiB,OAAlB;EACC,aAAU;EACV,WAAWE,iBAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAoE;CAC/G,OACC,2CAACF,+BAAiB,aAAlB;EACC,aAAU;EACV,WAAWE,iBAAG,iCAAiC,SAAS;EACxD,GAAI;CACJ;AAEH"}
|
|
@@ -12,6 +12,12 @@ type PopoverCloseProps = React$1.ComponentProps<typeof Popover$1.Close> & {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
};
|
|
14
14
|
declare function PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps): React$1.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of
|
|
17
|
+
* the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on
|
|
18
|
+
* any panel that hangs beside one.
|
|
19
|
+
*/
|
|
20
|
+
declare const popoverSurfaceClass = "rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]";
|
|
15
21
|
type PopoverContentProps = React$1.ComponentProps<typeof Popover$1.Popup> & {
|
|
16
22
|
align?: 'start' | 'center' | 'end';
|
|
17
23
|
sideOffset?: number;
|
|
@@ -36,5 +42,5 @@ declare function PopoverAnchor({ ...props }: React$1.HTMLAttributes<HTMLDivEleme
|
|
|
36
42
|
declare function PopoverTitle({ className, ...props }: React$1.ComponentProps<typeof Popover$1.Title>): React$1.JSX.Element;
|
|
37
43
|
declare function PopoverDescription({ className, ...props }: React$1.ComponentProps<typeof Popover$1.Description>): React$1.JSX.Element;
|
|
38
44
|
//#endregion
|
|
39
|
-
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
45
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, popoverSurfaceClass };
|
|
40
46
|
//# sourceMappingURL=popover.d.cts.map
|
|
@@ -12,6 +12,12 @@ type PopoverCloseProps = React$1.ComponentProps<typeof Popover$1.Close> & {
|
|
|
12
12
|
asChild?: boolean;
|
|
13
13
|
};
|
|
14
14
|
declare function PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps): React$1.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of
|
|
17
|
+
* the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on
|
|
18
|
+
* any panel that hangs beside one.
|
|
19
|
+
*/
|
|
20
|
+
declare const popoverSurfaceClass = "rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]";
|
|
15
21
|
type PopoverContentProps = React$1.ComponentProps<typeof Popover$1.Popup> & {
|
|
16
22
|
align?: 'start' | 'center' | 'end';
|
|
17
23
|
sideOffset?: number;
|
|
@@ -36,5 +42,5 @@ declare function PopoverAnchor({ ...props }: React$1.HTMLAttributes<HTMLDivEleme
|
|
|
36
42
|
declare function PopoverTitle({ className, ...props }: React$1.ComponentProps<typeof Popover$1.Title>): React$1.JSX.Element;
|
|
37
43
|
declare function PopoverDescription({ className, ...props }: React$1.ComponentProps<typeof Popover$1.Description>): React$1.JSX.Element;
|
|
38
44
|
//#endregion
|
|
39
|
-
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
45
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, popoverSurfaceClass };
|
|
40
46
|
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -33,6 +33,12 @@ function PopoverClose({ asChild, children, render, nativeButton, ...props }) {
|
|
|
33
33
|
children: childRender ? void 0 : children
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of
|
|
38
|
+
* the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on
|
|
39
|
+
* any panel that hangs beside one.
|
|
40
|
+
*/
|
|
41
|
+
const popoverSurfaceClass = "rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]";
|
|
36
42
|
function PopoverContent({ className, align = "center", sideOffset = 4, showArrow = false, side = "bottom", children, onOpenAutoFocus: _onOpenAutoFocus, onCloseAutoFocus: _onCloseAutoFocus, onFocusOutside: _onFocusOutside, onEscapeKeyDown: _onEscapeKeyDown, ...props }) {
|
|
37
43
|
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
38
44
|
return /* @__PURE__ */ jsx(Popover$1.Portal, {
|
|
@@ -85,5 +91,5 @@ function PopoverDescription({ className, ...props }) {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
//#endregion
|
|
88
|
-
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
|
|
94
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, popoverSurfaceClass };
|
|
89
95
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["PopoverPrimitive","React"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CAClF,OAAO,oBAACA,UAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ;AAC/D;AAOA,SAAS,eAAe,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA8B;CACnG,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,SAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACF;AAE5B;AAOA,SAAS,aAAa,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA4B;CAC/F,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,OAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACJ;AAE1B;
|
|
1
|
+
{"version":3,"file":"popover.js","names":["PopoverPrimitive","React"],"sources":["../../src/components/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { useFloatingOverlayPortalProps } from '@constructive-io/ui/portal';\nimport { cn } from '../lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n\treturn <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\ntype PopoverTriggerProps = React.ComponentProps<typeof PopoverPrimitive.Trigger> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverTrigger({ asChild, children, render, nativeButton, ...props }: PopoverTriggerProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tdata-slot=\"popover-trigger\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Trigger>\n\t);\n}\n\ntype PopoverCloseProps = React.ComponentProps<typeof PopoverPrimitive.Close> & {\n\t/** When true, merges props onto the child element instead of rendering a button */\n\tasChild?: boolean;\n};\n\nfunction PopoverClose({ asChild, children, render, nativeButton, ...props }: PopoverCloseProps) {\n\tconst childRender = render === undefined && asChild && React.isValidElement(children) ? children : undefined;\n\n\treturn (\n\t\t<PopoverPrimitive.Close\n\t\t\tdata-slot=\"popover-close\"\n\t\t\tnativeButton={nativeButton ?? (childRender ? true : undefined)}\n\t\t\trender={render ?? childRender}\n\t\t\t{...props}\n\t\t>\n\t\t\t{childRender ? undefined : children}\n\t\t</PopoverPrimitive.Close>\n\t);\n}\n\n/**\n * A lighter edge for compact menus that float over busy content: a hairline ring and a soft drop shadow in place of\n * the border, on a 10px corner whose 4px inset gives rows a concentric 6px corner. Works on `PopoverContent` and on\n * any panel that hangs beside one.\n */\nconst popoverSurfaceClass =\n\t'rounded-lg border-0 bg-popover text-popover-foreground shadow-[0_0_0_1px_oklch(0_0_0/0.08),0_4px_16px_-4px_oklch(0_0_0/0.14)] dark:shadow-[0_0_0_1px_oklch(1_0_0/0.12),0_4px_16px_-4px_oklch(0_0_0/0.45)]';\n\ntype PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n\talign?: 'start' | 'center' | 'end';\n\tsideOffset?: number;\n\tshowArrow?: boolean;\n\tside?: 'top' | 'bottom' | 'left' | 'right';\n\t/** @deprecated Base UI uses different focus management */\n\tonOpenAutoFocus?: (e: Event) => void;\n\t/** @deprecated Base UI uses different focus management */\n\tonCloseAutoFocus?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonFocusOutside?: (e: Event) => void;\n\t/** @deprecated Use onOpenChange on Root instead */\n\tonEscapeKeyDown?: () => void;\n};\n\nfunction PopoverContent({\n\tclassName,\n\talign = 'center',\n\tsideOffset = 4,\n\tshowArrow = false,\n\tside = 'bottom',\n\tchildren,\n\tonOpenAutoFocus: _onOpenAutoFocus,\n\tonCloseAutoFocus: _onCloseAutoFocus,\n\tonFocusOutside: _onFocusOutside,\n\tonEscapeKeyDown: _onEscapeKeyDown,\n\t...props\n}: PopoverContentProps) {\n\tconst { container, zIndexClass } = useFloatingOverlayPortalProps();\n\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\tside={side}\n\t\t\t\talign={align}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={zIndexClass}\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"popover-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t`bg-popover text-popover-foreground origin-(--transform-origin) max-h-(--available-height) w-72 max-w-(--available-width)\n\t\t\t\t\t\trounded-lg border p-4 shadow-lg outline-hidden [overflow-wrap:break-word]\n\t\t\t\t\t\ttransition-[scale,opacity,translate] duration-(--duration-moderate) ease-out data-starting-style:scale-95\n\t\t\t\t\t\tdata-ending-style:scale-95 data-starting-style:opacity-0 data-ending-style:opacity-0\n\t\t\t\t\t\tdata-[side=bottom]:data-starting-style:-translate-y-2\n\t\t\t\t\t\tdata-[side=left]:data-starting-style:translate-x-2\n\t\t\t\t\t\tdata-[side=right]:data-starting-style:-translate-x-2\n\t\t\t\t\t\tdata-[side=top]:data-starting-style:translate-y-2 motion-reduce:transition-none`,\n\t\t\t\t\t\t// Capped to the room Base UI measured and scrolled inside. The arrow sits outside the box, so an arrowed popover keeps `overflow: visible`.\n\t\t\t\t\t\t!showArrow && 'overflow-y-auto overscroll-contain',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className='fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]' />\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * PopoverAnchor - placeholder for positioning anchor.\n * @deprecated Base UI Popover positions relative to Trigger by default.\n * For custom anchoring, use Popover.Positioner with anchor prop.\n */\nfunction PopoverAnchor({ ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn <div data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Title>) {\n\treturn (\n\t\t<PopoverPrimitive.Title\n\t\t\tdata-slot=\"popover-title\"\n\t\t\tclassName={cn('font-medium leading-tight', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PopoverDescription({ className, ...props }: React.ComponentProps<typeof PopoverPrimitive.Description>) {\n\treturn (\n\t\t<PopoverPrimitive.Description\n\t\t\tdata-slot=\"popover-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tPopover,\n\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tpopoverSurfaceClass,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,EAAE,GAAG,SAA6D;CAClF,OAAO,oBAACA,UAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ;AAC/D;AAOA,SAAS,eAAe,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA8B;CACnG,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,SAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACF;AAE5B;AAOA,SAAS,aAAa,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAA4B;CAC/F,MAAM,cAAc,WAAW,UAAa,WAAWC,QAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,oBAACD,UAAiB,OAAlB;EACC,aAAU;EACV,cAAc,iBAAiB,cAAc,OAAO;EACpD,QAAQ,UAAU;EAClB,GAAI;YAEH,cAAc,SAAY;CACJ;AAE1B;;;;;;AAOA,MAAM,sBACL;AAiBD,SAAS,eAAe,EACvB,WACA,QAAQ,UACR,aAAa,GACb,YAAY,OACZ,OAAO,UACP,UACA,iBAAiB,kBACjB,kBAAkB,mBAClB,gBAAgB,iBAChB,iBAAiB,kBACjB,GAAG,SACoB;CACvB,MAAM,EAAE,WAAW,gBAAgB,8BAA8B;CAEjE,OACC,oBAACA,UAAiB,QAAlB;EAAoC;YACnC,oBAACA,UAAiB,YAAlB;GACO;GACC;GACK;GACZ,WAAW;aAEX,qBAACA,UAAiB,OAAlB;IACC,aAAU;IACV,WAAW,GACV;;;;;;;wFASA,CAAC,aAAa,sCACd,SACD;IACA,GAAI;cAfL,CAiBE,UACA,aACA,oBAACA,UAAiB,OAAlB,EAAwB,WAAU,0DAA2D,EAEvE;;EACI;CACL;AAE3B;;;;;;AAOA,SAAS,cAAc,EAAE,GAAG,SAA+C;CAC1E,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAiB,GAAI;CAAQ;AACpD;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAA8D;CACnG,OACC,oBAACA,UAAiB,OAAlB;EACC,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACJ;AAEH;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAoE;CAC/G,OACC,oBAACA,UAAiB,aAAlB;EACC,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACJ;AAEH"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
6
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
4
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronDownIcon, ChevronUpIcon, ChevronsUpDownIcon } from "lucide-react";
|
package/dist/components/tabs.cjs
CHANGED
|
@@ -22,7 +22,10 @@ function Tabs({ className, ...props }) {
|
|
|
22
22
|
function revealInline(scroller, target) {
|
|
23
23
|
const frame = scroller.getBoundingClientRect();
|
|
24
24
|
const box = target.getBoundingClientRect();
|
|
25
|
-
if (box.
|
|
25
|
+
if (box.width >= frame.width) {
|
|
26
|
+
const rtl = getComputedStyle(scroller).direction === "rtl";
|
|
27
|
+
scroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });
|
|
28
|
+
} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });
|
|
26
29
|
else if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
@@ -50,7 +53,7 @@ function TabsList({ className, children, style, ...props }) {
|
|
|
50
53
|
}, [list, overflowing]);
|
|
51
54
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_tabs.Tabs.List, {
|
|
52
55
|
"data-slot": "tabs-list",
|
|
53
|
-
className: require_utils.cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
56
|
+
className: require_utils.cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
54
57
|
style: fade.style ? {
|
|
55
58
|
...style,
|
|
56
59
|
...fade.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.cjs","names":["TabsPrimitive","cn","useScrollFade","useMergedRefs"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\tif (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,2CAACA,yBAAc,MAAf;EAAoB,aAAU;EAAO,WAAWC,iBAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"tabs.cjs","names":["TabsPrimitive","cn","useScrollFade","useMergedRefs"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\t// A tab wider than the list shows its start, where the label begins, rather than its end.\n\tif (box.width >= frame.width) {\n\t\tconst rtl = getComputedStyle(scroller).direction === 'rtl';\n\t\tscroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });\n\t} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\t// Sideways only: a strip never scrolls vertically, and no bar takes height from the tabs.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,2CAACA,yBAAc,MAAf;EAAoB,aAAU;EAAO,WAAWC,iBAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;CAEzC,IAAI,IAAI,SAAS,MAAM,OAAO;EAC7B,MAAM,MAAM,iBAAiB,QAAQ,CAAC,CAAC,cAAc;EACrD,SAAS,SAAS,EAAE,MAAM,MAAM,IAAI,QAAQ,MAAM,QAAQ,IAAI,OAAO,MAAM,KAAK,CAAC;CAClF,OAAO,IAAI,IAAI,OAAO,MAAM,MAAM,SAAS,SAAS,EAAE,MAAM,IAAI,OAAO,MAAM,OAAO,EAAE,CAAC;MAClF,IAAI,IAAI,QAAQ,MAAM,OAAO,SAAS,SAAS,EAAE,MAAM,IAAI,QAAQ,MAAM,QAAQ,EAAE,CAAC;AAC1F;;;;;AAMA,SAAS,SAAS,EAAE,WAAW,UAAU,OAAO,GAAG,SAA0D;CAC5G,MAAM,OAAOC,sCAA8B;CAE3C,MAAM,MAAMC,mCAAc,KAAK,KAAK,MAAM,GAAG;CAC7C,MAAM,EAAE,MAAM,MAAM,gBAAgB;CAEpC,MAAM,gBAAgB;EACrB,IAAI,CAAC,QAAQ,CAAC,aAAa;EAC3B,MAAM,qBAAqB;GAC1B,MAAM,SAAS,KAAK,cAA2B,eAAe;GAC9D,IAAI,QAAQ,aAAa,MAAM,MAAM;EACtC;EAGA,aAAa;EACb,MAAM,WAAW,IAAI,iBAAiB,YAAY;EAClD,SAAS,QAAQ,MAAM;GAAE,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,aAAa;EAAE,CAAC;EAC5F,aAAa,SAAS,WAAW;CAClC,GAAG,CAAC,MAAM,WAAW,CAAC;CAEtB,OACC,4CAACH,yBAAc,MAAf;EACC,aAAU;EACV,WAAWC,iBACV,wHAGA,eAAe,6HACf,SACD;EACA,OAAO,KAAK,QAAQ;GAAE,GAAG;GAAO,GAAG,KAAK;EAAM,IAAI;EAClD,GAAI;EACC;YAXN,CAaC,2CAAC,eAAD,CAAgB,IACf,QACkB;;AAEtB;;;;;;;AAQA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA+D;CACrG,OACC,2CAACD,yBAAc,WAAf;EACC,aAAU;EACV,WAAWC,iBACV;;4EAGA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyD;CAC7F,OACC,2CAACD,yBAAc,KAAf;EACC,aAAU;EACV,WAAWC,iBACV;;;sFAIA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2D;CAC/F,OAAO,2CAACD,yBAAc,OAAf;EAAqB,aAAU;EAAe,WAAWC,iBAAG,0DAA0D,SAAS;EAAG,GAAI;CAAQ;AACtJ"}
|
package/dist/components/tabs.js
CHANGED
|
@@ -19,7 +19,10 @@ function Tabs({ className, ...props }) {
|
|
|
19
19
|
function revealInline(scroller, target) {
|
|
20
20
|
const frame = scroller.getBoundingClientRect();
|
|
21
21
|
const box = target.getBoundingClientRect();
|
|
22
|
-
if (box.
|
|
22
|
+
if (box.width >= frame.width) {
|
|
23
|
+
const rtl = getComputedStyle(scroller).direction === "rtl";
|
|
24
|
+
scroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });
|
|
25
|
+
} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });
|
|
23
26
|
else if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
@@ -47,7 +50,7 @@ function TabsList({ className, children, style, ...props }) {
|
|
|
47
50
|
}, [list, overflowing]);
|
|
48
51
|
return /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
49
52
|
"data-slot": "tabs-list",
|
|
50
|
-
className: cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
53
|
+
className: cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
51
54
|
style: fade.style ? {
|
|
52
55
|
...style,
|
|
53
56
|
...fade.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\tif (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,oBAACA,OAAc,MAAf;EAAoB,aAAU;EAAO,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\t// A tab wider than the list shows its start, where the label begins, rather than its end.\n\tif (box.width >= frame.width) {\n\t\tconst rtl = getComputedStyle(scroller).direction === 'rtl';\n\t\tscroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });\n\t} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\t// Sideways only: a strip never scrolls vertically, and no bar takes height from the tabs.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,oBAACA,OAAc,MAAf;EAAoB,aAAU;EAAO,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;CAEzC,IAAI,IAAI,SAAS,MA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A,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyD;CAC7F,OACC,oBAACA,OAAc,KAAf;EACC,aAAU;EACV,WAAW,GACV;;;sFAIA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2D;CAC/F,OAAO,oBAACA,OAAc,OAAf;EAAqB,aAAU;EAAe,WAAW,GAAG,0DAA0D,SAAS;EAAG,GAAI;CAAQ;AACtJ"}
|
|
@@ -5,7 +5,7 @@ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
6
|
const require_text_runs = require('../text-runs-CdmlS5C7.cjs');
|
|
7
7
|
const require_components_toggle = require('./toggle.cjs');
|
|
8
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
8
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
9
9
|
let react = require("react");
|
|
10
10
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
4
|
import { t as truncateTextRuns } from "../text-runs-DqcEO8L_.js";
|
|
5
5
|
import { toggleVariants } from "./toggle.js";
|
|
6
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
6
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Toggle } from "@base-ui/react/toggle";
|