@constructive-io/ui 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{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/badge.d.cts +4 -4
- package/dist/components/badge.d.ts +4 -4
- package/dist/components/button-group.d.cts +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button.cjs +3 -3
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +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/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +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/sidebar.d.cts +1 -1
- package/dist/components/sidebar.d.ts +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/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +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
|
@@ -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 "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { SearchIcon } from "lucide-react";
|
|
@@ -50,9 +50,14 @@ function CommandInput({ className, placeholder, ...props }) {
|
|
|
50
50
|
})
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Small pickers such as a model or worktree list pack their rows tighter than a command palette: 4px of padding,
|
|
55
|
+
* a thin scrollbar, and group headings in small, quiet text so the rows carry the weight.
|
|
56
|
+
*/
|
|
57
|
+
const COMPACT_LIST_CLASS = "[scrollbar-width:thin] scroll-py-1 p-1 not-empty:scroll-py-1 not-empty:p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pt-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-[0.6875rem] [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-subtle-foreground";
|
|
58
|
+
function CommandList({ className, children, density = "default", ...props }) {
|
|
54
59
|
return /* @__PURE__ */ jsxs(Command$1.List, {
|
|
55
|
-
className: cn("relative not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
60
|
+
className: cn("relative not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", density === "compact" && COMPACT_LIST_CLASS, className),
|
|
56
61
|
"data-slot": "command-list",
|
|
57
62
|
...props,
|
|
58
63
|
children: [/* @__PURE__ */ jsx(FluidHighlight, {}), children]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["CommandPrimitive"],"sources":["../../src/components/command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { ModalPortalScope, useRootPortalContainer } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\nfunction CommandDialog({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Dialog>) {\n const container = useRootPortalContainer();\n\n return (\n <CommandPrimitive.Dialog\n container={container ?? undefined}\n overlayClassName={cn(\n\t\t\"fixed inset-0 z-[var(--z-layer-toast)] bg-black/32 backdrop-blur-sm data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_150ms_ease-in] motion-reduce:animate-none\",\n )}\n contentClassName={cn(\n \"fixed left-1/2 top-[max(--spacing(4),4vh)] sm:top-[10vh] z-[var(--z-layer-toast)] -translate-x-1/2 flex max-h-100 min-h-0 w-full min-w-0 max-w-xl flex-col rounded-lg border bg-popover bg-clip-padding text-popover-foreground shadow-lg max-sm:right-3 max-sm:left-3 max-sm:w-auto max-sm:translate-x-0 data-[state=open]:animate-[command-in_200ms_ease-out] data-[state=closed]:animate-[command-out_150ms_ease-in] motion-reduce:animate-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-muted/50 before:shadow-[0_1px_--theme(--color-black/4%)] **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]\",\n className,\n )}\n loop\n {...props}\n >\n <ModalPortalScope>{children}</ModalPortalScope>\n </CommandPrimitive.Dialog>\n );\n}\n\nfunction CommandDialogPopup({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div data-slot=\"command-dialog-popup\" className={className} {...props}>\n {children}\n </div>\n );\n}\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-lg\",\n className,\n )}\n data-slot=\"command\"\n {...props}\n />\n );\n}\n\nfunction CommandInput({\n className,\n placeholder,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div className=\"px-2.5 py-1.5\" data-slot=\"command-input-wrapper\">\n <div\n className={cn(\n \"flex items-center gap-2 rounded-lg px-3 text-base\",\n className,\n )}\n >\n <SearchIcon className=\"size-4 shrink-0 text-muted-foreground\" />\n <CommandPrimitive.Input\n className=\"flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-subtle-foreground disabled:cursor-not-allowed disabled:opacity-64\"\n placeholder={placeholder}\n data-slot=\"command-input\"\n {...props}\n />\n </div>\n </div>\n );\n}\n\nfunction CommandList({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n className={cn(\"relative not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n data-slot=\"command-list\"\n {...props}\n >\n <FluidHighlight />\n {children}\n </CommandPrimitive.List>\n );\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className={cn(\"text-center text-muted-foreground text-sm not-empty:px-2 not-empty:py-6\", className)}\n data-slot=\"command-empty\"\n {...props}\n />\n );\n}\n\nfunction CommandPanel({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"-mx-px relative min-h-0 rounded-t-lg border bg-popover bg-clip-padding shadow-xs [clip-path:inset(0_1px)] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-lg)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]\",\n className,\n )}\n data-slot=\"command-panel\"\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n heading,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group> & {\n heading?: React.ReactNode;\n}) {\n return (\n <CommandPrimitive.Group\n className={cn(\n \"overflow-hidden text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n heading={heading}\n data-slot=\"command-group\"\n {...props}\n >\n {children}\n </CommandPrimitive.Group>\n );\n}\n\nfunction CommandGroupLabel({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"px-2 py-1.5 text-xs font-medium text-muted-foreground\",\n className,\n )}\n data-slot=\"command-group-label\"\n {...props}\n />\n );\n}\n\nfunction CommandCollection({ children }: { children: React.ReactNode }) {\n return <>{children}</>;\n}\n\n/**\n * cmdk identifies an item by its `value` (or its text when `value` is omitted), so two items with the same value\n * highlight together. Give items that can share a name a unique `value` and put the name in `keywords`.\n */\nfunction CommandItem({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n className={cn(\n // `overflow-wrap:anywhere` lets an unbreakable label shrink and wrap, so the icon and shortcut keep their room.\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none [overflow-wrap:anywhere] pointer-coarse:min-h-11 data-[disabled=true]:pointer-events-none data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-64 [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"command-item\"\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn(\"-mx-1 my-2 h-px bg-border\", className)}\n data-slot=\"command-separator\"\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({ className, children, ...props }: React.ComponentProps<\"kbd\">) {\n return (\n <span\n className={cn(\n \"ms-auto shrink-0 whitespace-nowrap font-medium text-subtle-foreground text-xs tracking-widest\",\n className,\n )}\n data-slot=\"command-shortcut\"\n {...props}\n >\n {/* Key glyphs read left to right in every writing direction, so isolate them from the surrounding text. */}\n <span dir=\"ltr\" className=\"[unicode-bidi:isolate]\">\n {children}\n </span>\n </span>\n );\n}\n\nfunction CommandFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-lg)-1px)] px-5 py-3 text-subtle-foreground text-xs\",\n className,\n )}\n data-slot=\"command-footer\"\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandCollection,\n CommandDialog,\n CommandDialogPopup,\n CommandEmpty,\n CommandFooter,\n CommandGroup,\n CommandGroupLabel,\n CommandInput,\n CommandItem,\n CommandList,\n CommandPanel,\n CommandSeparator,\n CommandShortcut,\n};\n"],"mappings":";;;;;;;;;;;AASA,SAAS,cAAc,EACrB,WACA,U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SAGF;CACD,OACE,oBAACA,UAAiB,OAAlB;EACE,WAAW,GACT,sNACA,SACF;EACS;EACT,aAAU;EACV,GAAI;EAEH;CACqB;AAE5B;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,WAAW,GACT,yDACA,SACF;EACA,aAAU;EACV,GAAI;CACL;AAEL;AAEA,SAAS,kBAAkB,EAAE,YAA2C;CACtE,OAAO,gCAAG,SAAW;AACvB;;;;;AAMA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,UAAiB,MAAlB;EACE,WAAW,GAET,kSACA,SACF;EACA,aAAU;EACV,GAAI;CACL;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACA,UAAiB,WAAlB;EACE,WAAW,GAAG,6BAA6B,SAAS;EACpD,aAAU;EACV,GAAI;CACL;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAsC;CACvF,OACE,oBAAC,QAAD;EACE,WAAW,GACT,iGACA,SACF;EACA,aAAU;EACV,GAAI;YAGJ,oBAAC,QAAD;GAAM,KAAI;GAAM,WAAU;GACvB;EACG;CACF;AAEV;AAEA,SAAS,cAAc,EAAE,WAAW,GAAG,SAAsC;CAC3E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,2HACA,SACF;EACA,aAAU;EACV,GAAI;CACL;AAEL"}
|
|
1
|
+
{"version":3,"file":"command.js","names":["CommandPrimitive"],"sources":["../../src/components/command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { ModalPortalScope, useRootPortalContainer } from \"@constructive-io/ui/portal\";\nimport { FluidHighlight } from \"../lib/motion/fluid-highlight\";\nimport { cn } from \"../lib/utils\";\n\nfunction CommandDialog({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Dialog>) {\n const container = useRootPortalContainer();\n\n return (\n <CommandPrimitive.Dialog\n container={container ?? undefined}\n overlayClassName={cn(\n\t\t\"fixed inset-0 z-[var(--z-layer-toast)] bg-black/32 backdrop-blur-sm data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_150ms_ease-in] motion-reduce:animate-none\",\n )}\n contentClassName={cn(\n \"fixed left-1/2 top-[max(--spacing(4),4vh)] sm:top-[10vh] z-[var(--z-layer-toast)] -translate-x-1/2 flex max-h-100 min-h-0 w-full min-w-0 max-w-xl flex-col rounded-lg border bg-popover bg-clip-padding text-popover-foreground shadow-lg max-sm:right-3 max-sm:left-3 max-sm:w-auto max-sm:translate-x-0 data-[state=open]:animate-[command-in_200ms_ease-out] data-[state=closed]:animate-[command-out_150ms_ease-in] motion-reduce:animate-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-muted/50 before:shadow-[0_1px_--theme(--color-black/4%)] **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]\",\n className,\n )}\n loop\n {...props}\n >\n <ModalPortalScope>{children}</ModalPortalScope>\n </CommandPrimitive.Dialog>\n );\n}\n\nfunction CommandDialogPopup({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div data-slot=\"command-dialog-popup\" className={className} {...props}>\n {children}\n </div>\n );\n}\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-lg\",\n className,\n )}\n data-slot=\"command\"\n {...props}\n />\n );\n}\n\nfunction CommandInput({\n className,\n placeholder,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div className=\"px-2.5 py-1.5\" data-slot=\"command-input-wrapper\">\n <div\n className={cn(\n \"flex items-center gap-2 rounded-lg px-3 text-base\",\n className,\n )}\n >\n <SearchIcon className=\"size-4 shrink-0 text-muted-foreground\" />\n <CommandPrimitive.Input\n className=\"flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-subtle-foreground disabled:cursor-not-allowed disabled:opacity-64\"\n placeholder={placeholder}\n data-slot=\"command-input\"\n {...props}\n />\n </div>\n </div>\n );\n}\n\n/**\n * Small pickers such as a model or worktree list pack their rows tighter than a command palette: 4px of padding,\n * a thin scrollbar, and group headings in small, quiet text so the rows carry the weight.\n */\nconst COMPACT_LIST_CLASS =\n \"[scrollbar-width:thin] scroll-py-1 p-1 not-empty:scroll-py-1 not-empty:p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pt-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-[0.6875rem] [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:text-subtle-foreground\";\n\nfunction CommandList({\n className,\n children,\n density = \"default\",\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List> & {\n /** `compact` is for small pickers in a popover; the default suits a full command palette. */\n density?: \"default\" | \"compact\";\n}) {\n return (\n <CommandPrimitive.List\n className={cn(\n \"relative not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden\",\n density === \"compact\" && COMPACT_LIST_CLASS,\n className,\n )}\n data-slot=\"command-list\"\n {...props}\n >\n <FluidHighlight />\n {children}\n </CommandPrimitive.List>\n );\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className={cn(\"text-center text-muted-foreground text-sm not-empty:px-2 not-empty:py-6\", className)}\n data-slot=\"command-empty\"\n {...props}\n />\n );\n}\n\nfunction CommandPanel({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"-mx-px relative min-h-0 rounded-t-lg border bg-popover bg-clip-padding shadow-xs [clip-path:inset(0_1px)] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-lg)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]\",\n className,\n )}\n data-slot=\"command-panel\"\n {...props}\n />\n );\n}\n\nfunction CommandGroup({\n className,\n heading,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group> & {\n heading?: React.ReactNode;\n}) {\n return (\n <CommandPrimitive.Group\n className={cn(\n \"overflow-hidden text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n heading={heading}\n data-slot=\"command-group\"\n {...props}\n >\n {children}\n </CommandPrimitive.Group>\n );\n}\n\nfunction CommandGroupLabel({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"px-2 py-1.5 text-xs font-medium text-muted-foreground\",\n className,\n )}\n data-slot=\"command-group-label\"\n {...props}\n />\n );\n}\n\nfunction CommandCollection({ children }: { children: React.ReactNode }) {\n return <>{children}</>;\n}\n\n/**\n * cmdk identifies an item by its `value` (or its text when `value` is omitted), so two items with the same value\n * highlight together. Give items that can share a name a unique `value` and put the name in `keywords`.\n */\nfunction CommandItem({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n className={cn(\n // `overflow-wrap:anywhere` lets an unbreakable label shrink and wrap, so the icon and shortcut keep their room.\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none [overflow-wrap:anywhere] pointer-coarse:min-h-11 data-[disabled=true]:pointer-events-none data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-64 [&_svg]:shrink-0\",\n className,\n )}\n data-slot=\"command-item\"\n {...props}\n />\n );\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn(\"-mx-1 my-2 h-px bg-border\", className)}\n data-slot=\"command-separator\"\n {...props}\n />\n );\n}\n\nfunction CommandShortcut({ className, children, ...props }: React.ComponentProps<\"kbd\">) {\n return (\n <span\n className={cn(\n \"ms-auto shrink-0 whitespace-nowrap font-medium text-subtle-foreground text-xs tracking-widest\",\n className,\n )}\n data-slot=\"command-shortcut\"\n {...props}\n >\n {/* Key glyphs read left to right in every writing direction, so isolate them from the surrounding text. */}\n <span dir=\"ltr\" className=\"[unicode-bidi:isolate]\">\n {children}\n </span>\n </span>\n );\n}\n\nfunction CommandFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-lg)-1px)] px-5 py-3 text-subtle-foreground text-xs\",\n className,\n )}\n data-slot=\"command-footer\"\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandCollection,\n CommandDialog,\n CommandDialogPopup,\n CommandEmpty,\n CommandFooter,\n CommandGroup,\n CommandGroupLabel,\n CommandInput,\n CommandItem,\n CommandList,\n CommandPanel,\n CommandSeparator,\n CommandShortcut,\n};\n"],"mappings":";;;;;;;;;;;AASA,SAAS,cAAc,EACrB,WACA,UACA,GAAG,SACoD;CACvD,MAAM,YAAY,uBAAuB;CAEzC,OACE,oBAACA,UAAiB,QAAlB;EACE,WAAW,aAAa;EACxB,kBAAkB,GACtB,wMACI;EACA,kBAAkB,GAChB,suBACA,SACF;EACA;EACA,GAAI;YAEJ,oBAAC,kBAAD,EAAmB,SAA2B;CACvB;AAE7B;AAEA,SAAS,mBAAmB,EAC1B,UACA,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EAAK,aAAU;EAAkC;EAAW,GAAI;EAC7D;CACE;AAET;AAEA,SAAS,QAAQ,EACf,WACA,GAAG,SAC6C;CAChD,OACE,oBAACA,WAAD;EACE,WAAW,G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iB,MAAlB;EACE,WAAW,GAET,kSACA,SACF;EACA,aAAU;EACV,GAAI;CACL;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACA,UAAiB,WAAlB;EACE,WAAW,GAAG,6BAA6B,SAAS;EACpD,aAAU;EACV,GAAI;CACL;AAEL;AAEA,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAsC;CACvF,OACE,oBAAC,QAAD;EACE,WAAW,GACT,iGACA,SACF;EACA,aAAU;EACV,GAAI;YAGJ,oBAAC,QAAD;GAAM,KAAI;GAAM,WAAU;GACvB;EACG;CACF;AAEV;AAEA,SAAS,cAAc,EAAE,WAAW,GAAG,SAAsC;CAC3E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,2HACA,SACF;EACA,aAAU;EACV,GAAI;CACL;AAEL"}
|
|
@@ -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":";;;;;;;;;;;;;;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,SAAS,oBAAoB,EAAE,SAAS,UAAU,QAAQ,cAAc,GAAG,SAAmC;CAC7G,MAAM,cAAc,WAAW,UAAa,WAAWD,MAAM,eAAe,QAAQ,IAAI,WAAW;CAEnG,OACC,2CAACC,yBAAc,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,8EAA8C;CAEtD,OACC,2CAAC,oBAAD,YACC,2CAACA,yBAAc,YAAf;EAAgC;EAAa;EAAmB;EAAY,WAAW;YACtF,4CAACA,yBAAc,OAAf;GACC,aAAU;GACV,WAAWC,iBACV;;;;;;;wFAQA,SACD;GACA,GAAI;aAbL,CAeC,2CAACC,wCAAD,CAAiB,IAChB,QACmB;;CACI,GACP;AAEtB;AAEA,SAAS,kBAAkB,EAAE,GAAG,SAA2D;CAC1F,OACC,2CAAC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on","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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;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,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,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AI;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,2B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ACC,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"}
|
|
@@ -8,7 +8,7 @@ declare function FieldLegend({ className, variant, ...props }: React$1.Component
|
|
|
8
8
|
}): React$1.JSX.Element;
|
|
9
9
|
declare function FieldGroup({ className, ...props }: React$1.ComponentProps<'div'>): React$1.JSX.Element;
|
|
10
10
|
declare const fieldVariants: (props?: ({
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
type StructuralFieldProps = React$1.ComponentProps<'div'> & VariantProps<typeof fieldVariants>;
|
|
14
14
|
interface LegacyFieldProps {
|
|
@@ -8,7 +8,7 @@ declare function FieldLegend({ className, variant, ...props }: React$1.Component
|
|
|
8
8
|
}): React$1.JSX.Element;
|
|
9
9
|
declare function FieldGroup({ className, ...props }: React$1.ComponentProps<'div'>): React$1.JSX.Element;
|
|
10
10
|
declare const fieldVariants: (props?: ({
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
type StructuralFieldProps = React$1.ComponentProps<'div'> & VariantProps<typeof fieldVariants>;
|
|
14
14
|
interface LegacyFieldProps {
|
|
@@ -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";
|
|
@@ -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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,SAAS,cAAc,EAAE,GAAG,SAA+C;CAC1E,OAAO,2CAAC,OAAD;EAAK,aAAU;EAAiB,GAAI;CAAQ;AACpD;AAEA,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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|
|
|
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";
|
|
@@ -44,7 +44,7 @@ declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<'ul
|
|
|
44
44
|
declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<'li'>): React$1.JSX.Element;
|
|
45
45
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
46
46
|
variant?: "default" | "outline" | null | undefined;
|
|
47
|
-
size?: "default" | "
|
|
47
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
48
48
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
49
49
|
declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, ...props }: useRender.ComponentProps<'button'> & React$1.ComponentProps<'button'> & {
|
|
50
50
|
isActive?: boolean;
|
|
@@ -44,7 +44,7 @@ declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<'ul
|
|
|
44
44
|
declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<'li'>): React$1.JSX.Element;
|
|
45
45
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
46
46
|
variant?: "default" | "outline" | null | undefined;
|
|
47
|
-
size?: "default" | "
|
|
47
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
48
48
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
49
49
|
declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, ...props }: useRender.ComponentProps<'button'> & React$1.ComponentProps<'button'> & {
|
|
50
50
|
isActive?: boolean;
|
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
|