@epilot/spark-ui 0.25.1 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/accordion.d.cts +1 -1
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.cjs +5 -3
- package/dist/components/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog.d.cts +4 -1
- package/dist/components/alert-dialog.d.ts +4 -1
- package/dist/components/alert-dialog.js +5 -3
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete.cjs +3 -2
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +3 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.cjs +74 -0
- package/dist/components/banner.cjs.map +1 -0
- package/dist/components/banner.d.cts +27 -0
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +72 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/box.js +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.cjs.map +1 -1
- package/dist/components/callout.js +1 -1
- package/dist/components/callout.js.map +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/data-list.cjs +39 -0
- package/dist/components/data-list.cjs.map +1 -0
- package/dist/components/data-list.d.cts +33 -0
- package/dist/components/data-list.d.ts +33 -0
- package/dist/components/data-list.js +35 -0
- package/dist/components/data-list.js.map +1 -0
- package/dist/components/dialog.cjs +5 -3
- package/dist/components/dialog.cjs.map +1 -1
- package/dist/components/dialog.d.cts +4 -1
- package/dist/components/dialog.d.ts +4 -1
- package/dist/components/dialog.js +5 -3
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.cjs +13 -3
- package/dist/components/drawer.cjs.map +1 -1
- package/dist/components/drawer.d.cts +4 -1
- package/dist/components/drawer.d.ts +4 -1
- package/dist/components/drawer.js +14 -4
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +5 -3
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.d.cts +1 -0
- package/dist/components/dropdown-menu.d.ts +1 -0
- package/dist/components/dropdown-menu.js +5 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty-state.cjs +97 -25
- package/dist/components/empty-state.cjs.map +1 -1
- package/dist/components/empty-state.d.cts +28 -11
- package/dist/components/empty-state.d.ts +28 -11
- package/dist/components/empty-state.js +94 -26
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/energy-breakdown.cjs +1 -1
- package/dist/components/energy-breakdown.cjs.map +1 -1
- package/dist/components/energy-breakdown.js +1 -1
- package/dist/components/energy-breakdown.js.map +1 -1
- package/dist/components/entity-card.cjs +1 -1
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.js +1 -1
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +4 -4
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +4 -4
- package/dist/components/field.js.map +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/kbd.cjs +14 -0
- package/dist/components/kbd.cjs.map +1 -0
- package/dist/components/kbd.d.cts +13 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +13 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- package/dist/components/message-scroller.cjs.map +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/message-scroller.js.map +1 -1
- package/dist/components/pill.js +1 -1
- package/dist/components/popover.cjs +3 -2
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.js +3 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/schedule-list.cjs +1 -1
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +1 -1
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/select.cjs +4 -3
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +4 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +35 -17
- package/dist/components/separator.cjs.map +1 -1
- package/dist/components/separator.d.cts +1 -0
- package/dist/components/separator.d.ts +1 -0
- package/dist/components/separator.js +35 -17
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.cjs +4 -2
- package/dist/components/sheet.cjs.map +1 -1
- package/dist/components/sheet.d.cts +4 -1
- package/dist/components/sheet.d.ts +4 -1
- package/dist/components/sheet.js +4 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/stat-card.cjs +1 -1
- package/dist/components/stat-card.cjs.map +1 -1
- package/dist/components/stat-card.js +1 -1
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/textarea.cjs +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/theme.cjs +118 -24
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.d.cts +7 -1
- package/dist/components/theme.d.ts +7 -1
- package/dist/components/theme.js +120 -27
- package/dist/components/theme.js.map +1 -1
- package/dist/components/toast.cjs +4 -3
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +4 -3
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.cjs +1 -1
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.cjs +5 -3
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +1 -0
- package/dist/components/tooltip.d.ts +1 -0
- package/dist/components/tooltip.js +5 -3
- package/dist/components/tooltip.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { buttonVariants } from "./button.js";
|
|
4
|
+
import { PortalTheme } from "./theme.js";
|
|
4
5
|
import "react";
|
|
5
6
|
import { Close } from "@epilot/spark-icons";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -28,10 +29,11 @@ function DialogTrigger(props) {
|
|
|
28
29
|
...props
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
function DialogPortal(props) {
|
|
32
|
+
function DialogPortal({ children, ...props }) {
|
|
32
33
|
return /* @__PURE__ */ jsx(Dialog$1.Portal, {
|
|
33
34
|
"data-slot": "dialog-portal",
|
|
34
|
-
...props
|
|
35
|
+
...props,
|
|
36
|
+
children: /* @__PURE__ */ jsx(PortalTheme, { children })
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
function DialogClose({ className, children, ...props }) {
|
|
@@ -69,7 +71,7 @@ function DialogContent({ className, ...props }) {
|
|
|
69
71
|
function DialogHeader({ className, ...props }) {
|
|
70
72
|
return /* @__PURE__ */ jsx("div", {
|
|
71
73
|
"data-slot": "dialog-header",
|
|
72
|
-
className: cn("flex flex-col gap-
|
|
74
|
+
className: cn("flex flex-col gap-2", className),
|
|
73
75
|
...props
|
|
74
76
|
});
|
|
75
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["DialogPrimitive"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\n// Our dialogs contain interactive elements that are mounted outside of the dialog\n// Browser extensions like password managers or grammar checkers are also mounted outside\n// We still dismiss on a click/tap outside: a genuine outside press lands on a\n// backdrop (our styled one, or Base UI's internal inert backdrop when modal)\nfunction isBackdropPress(event: Event | undefined) {\n const target = event?.target\n return (\n target instanceof HTMLElement &&\n (target.dataset.overlay === 'true' ||\n target.hasAttribute('data-base-ui-inert'))\n )\n}\n\nfunction Dialog({\n onOpenChange,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return (\n <DialogPrimitive.Root\n {...props}\n onOpenChange={(open, eventDetails) => {\n if (\n !open &&\n eventDetails.reason === 'outside-press' &&\n !isBackdropPress(eventDetails.event)\n ) {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n />\n )\n}\n\nfunction DialogTrigger(\n props: React.ComponentProps<typeof DialogPrimitive.Trigger>,\n) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal(\n props: React.ComponentProps<typeof DialogPrimitive.Portal
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["DialogPrimitive"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from '@base-ui/react/dialog'\nimport { Close } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { PortalTheme } from './theme'\n\n// Our dialogs contain interactive elements that are mounted outside of the dialog\n// Browser extensions like password managers or grammar checkers are also mounted outside\n// We still dismiss on a click/tap outside: a genuine outside press lands on a\n// backdrop (our styled one, or Base UI's internal inert backdrop when modal)\nfunction isBackdropPress(event: Event | undefined) {\n const target = event?.target\n return (\n target instanceof HTMLElement &&\n (target.dataset.overlay === 'true' ||\n target.hasAttribute('data-base-ui-inert'))\n )\n}\n\nfunction Dialog({\n onOpenChange,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return (\n <DialogPrimitive.Root\n {...props}\n onOpenChange={(open, eventDetails) => {\n if (\n !open &&\n eventDetails.reason === 'outside-press' &&\n !isBackdropPress(eventDetails.event)\n ) {\n eventDetails.cancel()\n return\n }\n onOpenChange?.(open, eventDetails)\n }}\n />\n )\n}\n\nfunction DialogTrigger(\n props: React.ComponentProps<typeof DialogPrimitive.Trigger>,\n) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n children,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return (\n <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props}>\n <PortalTheme>{children}</PortalTheme>\n </DialogPrimitive.Portal>\n )\n}\n\n// bare = the ready-made corner X (label is the consumer's, via aria-label);\n// with children or a render prop it stays the bare primitive (footer buttons, custom closes)\nfunction DialogClose({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n if (children || props.render) {\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={className}\n {...props}\n >\n {children}\n </DialogPrimitive.Close>\n )\n }\n\n return (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-2.5 right-3 rounded-full',\n className,\n )}\n {...props}\n >\n <Close className=\"[--spark-icon-size:calc(20px*var(--spark-scaling,1))]\" />\n </DialogPrimitive.Close>\n )\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Backdrop>) {\n return (\n <DialogPrimitive.Backdrop\n data-slot=\"dialog-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs motion-reduce:transition-none',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Popup>) {\n return (\n <DialogPrimitive.Popup\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-(--spark-viewport-center-y,50%) left-[50%] z-50 grid w-[90%] max-w-lg min-w-80 translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg bg-gray-2 p-4 text-gray shadow-lg transition-[top,opacity,translate,scale] duration-200 motion-reduce:transition-none sm:w-1/2',\n // enter/exit: fade + zoom + a slight upward offset (was animate-in/out)\n 'data-starting-style:translate-y-[-52%] data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:translate-y-[-52%] data-ending-style:scale-95 data-ending-style:opacity-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2', className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-4 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"mappings":";;;;;;;;;AAWA,SAAS,gBAAgB,O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FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,uBAAuB,SAAS;EAC9C,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0DACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,SAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAACA,SAAgB,aAAjB;EACE,aAAU;EACV,WAAW,GAAG,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
+
const require_components_theme = require("./theme.cjs");
|
|
4
5
|
let react = require("react");
|
|
5
6
|
react = require_chunk.__toESM(react);
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
7
9
|
let vaul = require("vaul");
|
|
8
10
|
let cn = require("cn");
|
|
9
11
|
//#region src/components/drawer.tsx
|
|
@@ -20,12 +22,20 @@ function DrawerTrigger(props) {
|
|
|
20
22
|
...props
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
|
-
function DrawerPortal(props) {
|
|
25
|
+
function DrawerPortal({ children, ...props }) {
|
|
24
26
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Portal, {
|
|
25
27
|
"data-slot": "drawer-portal",
|
|
26
|
-
...props
|
|
28
|
+
...props,
|
|
29
|
+
children: react.Children.map(children, (child) => react.isValidElement(child) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerPortalChild, { children: child }) : child)
|
|
27
30
|
});
|
|
28
31
|
}
|
|
32
|
+
const DrawerPortalChild = react.forwardRef(function DrawerPortalChild({ children }, ref) {
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_theme.PortalTheme, { children: (0, _base_ui_react_use_render.useRender)({
|
|
34
|
+
render: children,
|
|
35
|
+
ref,
|
|
36
|
+
props: {}
|
|
37
|
+
}) });
|
|
38
|
+
});
|
|
29
39
|
function DrawerClose(props) {
|
|
30
40
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(vaul.Drawer.Close, {
|
|
31
41
|
"data-slot": "drawer-close",
|
|
@@ -55,7 +65,7 @@ function DrawerContent({ className, pillClassName, children, ...props }) {
|
|
|
55
65
|
function DrawerHeader({ className, ...props }) {
|
|
56
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
67
|
"data-slot": "drawer-header",
|
|
58
|
-
className: (0, cn.cn)("flex flex-col gap-
|
|
68
|
+
className: (0, cn.cn)("flex flex-col gap-2 px-6 py-3", className),
|
|
59
69
|
...props
|
|
60
70
|
});
|
|
61
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.cjs","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal
|
|
1
|
+
{"version":3,"file":"drawer.cjs","names":["DrawerPrimitive","React","PortalTheme"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal({\n children,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return (\n <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props}>\n {React.Children.map(children, (child) =>\n React.isValidElement(child) ? (\n <DrawerPortalChild>{child}</DrawerPortalChild>\n ) : (\n child\n ),\n )}\n </DrawerPrimitive.Portal>\n )\n}\n\n// Radix clones each portal child with the Presence ref that gates the exit animation; it must land on the part, not the theme wrapper.\nconst DrawerPortalChild = React.forwardRef<\n HTMLElement,\n { children: React.ReactElement }\n>(function DrawerPortalChild({ children }, ref) {\n const part = useRender({ render: children, ref, props: {} })\n return <PortalTheme>{part}</PortalTheme>\n})\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs motion-reduce:animate-none! motion-reduce:transition-none!',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface DrawerContentProps extends React.ComponentProps<\n typeof DrawerPrimitive.Content\n> {\n pillClassName?: string\n}\n\nconst onInteractOutsideHandler = (event: CustomEvent) => {\n const target = event.target as HTMLElement\n const isOverlay = target.dataset.overlay === 'true'\n\n // Our drawers contain interactive elements that are mounted outside of the drawer\n // Browser extensions like password managers or grammar checkers are also mounted outside\n // We still dismiss on a click/tap outside\n if (!isOverlay) event.preventDefault()\n}\n\nfunction DrawerContent({\n className,\n pillClassName,\n children,\n ...props\n}: DrawerContentProps) {\n return (\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray motion-reduce:animate-none! motion-reduce:transition-none!',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg',\n 'data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm',\n className,\n )}\n onInteractOutside={onInteractOutsideHandler}\n {...props}\n >\n <div\n className={cn(\n 'mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block',\n pillClassName,\n )}\n />\n {children}\n </DrawerPrimitive.Content>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('flex flex-col gap-2 px-6 py-3', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n}\nexport type { DrawerContentProps }\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,OAAO,EACd,wBAAwB,MACxB,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,KAA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YAAA,GAAA,GAAA,IACE,uIACA,2QACA,+OACA,gWACA,wWACA,SACF;EACA,mBAAmB;EACnB,GAAI;YAXN,CAaE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EACE,YAAA,GAAA,GAAA,IACE,2IACA,aACF,EACD,CAAA,GACA,QACsB;;AAE7B;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,yCAAyC,SAAS;EAChE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,OAAjB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,iBAAA,GAAA,kBAAA,KAACA,KAAAA,OAAgB,aAAjB;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -9,7 +9,10 @@ declare function Drawer({
|
|
|
9
9
|
...props
|
|
10
10
|
}: React$1.ComponentProps<typeof Drawer$1.Root>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function DrawerTrigger(props: React$1.ComponentProps<typeof Drawer$1.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare function DrawerPortal(
|
|
12
|
+
declare function DrawerPortal({
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: React$1.ComponentProps<typeof Drawer$1.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
declare function DrawerClose(props: React$1.ComponentProps<typeof Drawer$1.Close>): import("react/jsx-runtime").JSX.Element;
|
|
14
17
|
declare function DrawerOverlay({
|
|
15
18
|
className,
|
|
@@ -9,7 +9,10 @@ declare function Drawer({
|
|
|
9
9
|
...props
|
|
10
10
|
}: React$1.ComponentProps<typeof Drawer$1.Root>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function DrawerTrigger(props: React$1.ComponentProps<typeof Drawer$1.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare function DrawerPortal(
|
|
12
|
+
declare function DrawerPortal({
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: React$1.ComponentProps<typeof Drawer$1.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
declare function DrawerClose(props: React$1.ComponentProps<typeof Drawer$1.Close>): import("react/jsx-runtime").JSX.Element;
|
|
14
17
|
declare function DrawerOverlay({
|
|
15
18
|
className,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import "
|
|
3
|
+
import { PortalTheme } from "./theme.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
7
|
import { Drawer as Drawer$1 } from "vaul";
|
|
6
8
|
//#region src/components/drawer.tsx
|
|
7
9
|
function Drawer({ shouldScaleBackground = true, ...props }) {
|
|
@@ -17,12 +19,20 @@ function DrawerTrigger(props) {
|
|
|
17
19
|
...props
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
|
-
function DrawerPortal(props) {
|
|
22
|
+
function DrawerPortal({ children, ...props }) {
|
|
21
23
|
return /* @__PURE__ */ jsx(Drawer$1.Portal, {
|
|
22
24
|
"data-slot": "drawer-portal",
|
|
23
|
-
...props
|
|
25
|
+
...props,
|
|
26
|
+
children: React$1.Children.map(children, (child) => React$1.isValidElement(child) ? /* @__PURE__ */ jsx(DrawerPortalChild, { children: child }) : child)
|
|
24
27
|
});
|
|
25
28
|
}
|
|
29
|
+
const DrawerPortalChild = React$1.forwardRef(function DrawerPortalChild({ children }, ref) {
|
|
30
|
+
return /* @__PURE__ */ jsx(PortalTheme, { children: useRender({
|
|
31
|
+
render: children,
|
|
32
|
+
ref,
|
|
33
|
+
props: {}
|
|
34
|
+
}) });
|
|
35
|
+
});
|
|
26
36
|
function DrawerClose(props) {
|
|
27
37
|
return /* @__PURE__ */ jsx(Drawer$1.Close, {
|
|
28
38
|
"data-slot": "drawer-close",
|
|
@@ -52,7 +62,7 @@ function DrawerContent({ className, pillClassName, children, ...props }) {
|
|
|
52
62
|
function DrawerHeader({ className, ...props }) {
|
|
53
63
|
return /* @__PURE__ */ jsx("div", {
|
|
54
64
|
"data-slot": "drawer-header",
|
|
55
|
-
className: cn("flex flex-col gap-
|
|
65
|
+
className: cn("flex flex-col gap-2 px-6 py-3", className),
|
|
56
66
|
...props
|
|
57
67
|
});
|
|
58
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":["DrawerPrimitive"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal(\n props: React.ComponentProps<typeof DrawerPrimitive.Portal
|
|
1
|
+
{"version":3,"file":"drawer.js","names":["DrawerPrimitive","React"],"sources":["../../src/components/drawer.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { Drawer as DrawerPrimitive } from 'vaul'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction Drawer({\n shouldScaleBackground = true,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n />\n )\n}\n\nfunction DrawerTrigger(\n props: React.ComponentProps<typeof DrawerPrimitive.Trigger>,\n) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal({\n children,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return (\n <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props}>\n {React.Children.map(children, (child) =>\n React.isValidElement(child) ? (\n <DrawerPortalChild>{child}</DrawerPortalChild>\n ) : (\n child\n ),\n )}\n </DrawerPrimitive.Portal>\n )\n}\n\n// Radix clones each portal child with the Presence ref that gates the exit animation; it must land on the part, not the theme wrapper.\nconst DrawerPortalChild = React.forwardRef<\n HTMLElement,\n { children: React.ReactElement }\n>(function DrawerPortalChild({ children }, ref) {\n const part = useRender({ render: children, ref, props: {} })\n return <PortalTheme>{part}</PortalTheme>\n})\n\nfunction DrawerClose(\n props: React.ComponentProps<typeof DrawerPrimitive.Close>,\n) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n 'fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) supports-backdrop-filter:backdrop-blur-xs motion-reduce:animate-none! motion-reduce:transition-none!',\n className,\n )}\n data-overlay=\"true\"\n {...props}\n />\n )\n}\n\ninterface DrawerContentProps extends React.ComponentProps<\n typeof DrawerPrimitive.Content\n> {\n pillClassName?: string\n}\n\nconst onInteractOutsideHandler = (event: CustomEvent) => {\n const target = event.target as HTMLElement\n const isOverlay = target.dataset.overlay === 'true'\n\n // Our drawers contain interactive elements that are mounted outside of the drawer\n // Browser extensions like password managers or grammar checkers are also mounted outside\n // We still dismiss on a click/tap outside\n if (!isOverlay) event.preventDefault()\n}\n\nfunction DrawerContent({\n className,\n pillClassName,\n children,\n ...props\n}: DrawerContentProps) {\n return (\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content fixed z-50 flex h-auto flex-col bg-gray-2 text-gray motion-reduce:animate-none! motion-reduce:transition-none!',\n 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-(--spark-viewport-bottom-offset,0) data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg',\n 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg',\n 'data-[vaul-drawer-direction=left]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:border-gray-a1 data-[vaul-drawer-direction=left]:sm:max-w-sm',\n 'data-[vaul-drawer-direction=right]:top-(--spark-viewport-top,0) data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:h-(--spark-viewport-height,100%) data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:border-gray-a1 data-[vaul-drawer-direction=right]:sm:max-w-sm',\n className,\n )}\n onInteractOutside={onInteractOutsideHandler}\n {...props}\n >\n <div\n className={cn(\n 'mx-auto mt-2.5 hidden h-1.5 w-16 shrink-0 rounded-full bg-base-gray-soft group-data-[vaul-drawer-direction=bottom]/drawer-content:block',\n pillClassName,\n )}\n />\n {children}\n </DrawerPrimitive.Content>\n )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn('flex flex-col gap-2 px-6 py-3', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-lg font-bold text-gray', className)}\n {...props}\n />\n )\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-sm text-gray-light', className)}\n {...props}\n />\n )\n}\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n}\nexport type { DrawerContentProps }\n"],"mappings":";;;;;;;;AAMA,SAAS,OAAO,EACd,wBAAwB,MACxB,GAAG,SACiD;CACpD,OACE,oBAACA,SAAgB,MAAjB;EACE,aAAU;EACa;EACvB,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cACP,OACA;CACA,OAAO,oBAACA,SAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aAAa,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G,yCAAyC,SAAS;EAChE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,SAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAACA,SAAgB,aAAjB;EACE,aAAU;EACV,WAAW,GAAG,2BAA2B,SAAS;EAClD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
4
|
+
const require_components_theme = require("./theme.cjs");
|
|
4
5
|
let react = require("react");
|
|
5
6
|
react = require_chunk.__toESM(react);
|
|
6
7
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
@@ -11,10 +12,11 @@ let cn = require("cn");
|
|
|
11
12
|
function DropdownMenu({ ...props }) {
|
|
12
13
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Root, { ...props });
|
|
13
14
|
}
|
|
14
|
-
function DropdownMenuPortal({ ...props }) {
|
|
15
|
+
function DropdownMenuPortal({ children, ...props }) {
|
|
15
16
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Portal, {
|
|
16
17
|
"data-slot": "dropdown-menu-portal",
|
|
17
|
-
...props
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_theme.PortalTheme, { children })
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
22
|
function DropdownMenuTrigger({ ...props }) {
|
|
@@ -24,7 +26,7 @@ function DropdownMenuTrigger({ ...props }) {
|
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
28
|
function DropdownMenuContent({ className, align = "start", alignOffset, side, sideOffset = 4, container, ...props }) {
|
|
27
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuPortal, {
|
|
28
30
|
container,
|
|
29
31
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_menu.Menu.Positioner, {
|
|
30
32
|
align,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,GAAG,SACiD;CACpD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;CAAQ,CAAA;AAC5E;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CACrD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,SAAf;EAAuB,aAAU;EAAwB,GAAI;CAAQ,CAAA;AAC9E;AAYA,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,aACA,MACA,aAAa,GACb,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAiC;YAC/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iBAAA,GAAA,kBAAA,KAACE,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,GAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.cjs","names":["MenuPrimitive","PortalTheme","Check","ChevronRight"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return (\n <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props}>\n <PortalTheme>{children}</PortalTheme>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,UACA,GAAG,SACiD;CACpD,OACE,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;YACzD,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,aAAD,EAAc,SAAsB,CAAA;CAChB,CAAA;AAE1B;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CACrD,OAAO,iBAAA,GAAA,kBAAA,KAACD,oBAAAA,KAAc,SAAf;EAAuB,aAAU;EAAwB,GAAI;CA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AAG,SAGF;CACD,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,YAAA,GAAA,GAAA,IACE,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,iBAAA,GAAA,kBAAA,KAACG,oBAAAA,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,YAAA,GAAA,GAAA,IAAc,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -8,6 +8,7 @@ declare function DropdownMenu({
|
|
|
8
8
|
...props
|
|
9
9
|
}: React$1.ComponentProps<typeof Menu.Root>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function DropdownMenuPortal({
|
|
11
|
+
children,
|
|
11
12
|
...props
|
|
12
13
|
}: React$1.ComponentProps<typeof Menu.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare function DropdownMenuTrigger({
|
|
@@ -8,6 +8,7 @@ declare function DropdownMenu({
|
|
|
8
8
|
...props
|
|
9
9
|
}: React$1.ComponentProps<typeof Menu.Root>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare function DropdownMenuPortal({
|
|
11
|
+
children,
|
|
11
12
|
...props
|
|
12
13
|
}: React$1.ComponentProps<typeof Menu.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare function DropdownMenuTrigger({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { PortalTheme } from "./theme.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { Check, ChevronRight } from "@epilot/spark-icons";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -8,10 +9,11 @@ import { Menu } from "@base-ui/react/menu";
|
|
|
8
9
|
function DropdownMenu({ ...props }) {
|
|
9
10
|
return /* @__PURE__ */ jsx(Menu.Root, { ...props });
|
|
10
11
|
}
|
|
11
|
-
function DropdownMenuPortal({ ...props }) {
|
|
12
|
+
function DropdownMenuPortal({ children, ...props }) {
|
|
12
13
|
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
13
14
|
"data-slot": "dropdown-menu-portal",
|
|
14
|
-
...props
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(PortalTheme, { children })
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
function DropdownMenuTrigger({ ...props }) {
|
|
@@ -21,7 +23,7 @@ function DropdownMenuTrigger({ ...props }) {
|
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
25
|
function DropdownMenuContent({ className, align = "start", alignOffset, side, sideOffset = 4, container, ...props }) {
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
+
return /* @__PURE__ */ jsx(DropdownMenuPortal, {
|
|
25
27
|
container,
|
|
26
28
|
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
27
29
|
align,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","names":["MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;AAKA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,oBAACA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA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,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":["MenuPrimitive"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import { Menu as MenuPrimitive } from '@base-ui/react/menu'\nimport { Check, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { PortalTheme } from './theme'\n\nfunction DropdownMenu({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Root>) {\n return <MenuPrimitive.Root {...props} />\n}\n\nfunction DropdownMenuPortal({\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Portal>) {\n return (\n <MenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props}>\n <PortalTheme>{children}</PortalTheme>\n </MenuPrimitive.Portal>\n )\n}\n\nfunction DropdownMenuTrigger({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Trigger>) {\n return <MenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />\n}\n\ntype DropdownMenuContentProps = React.ComponentProps<\n typeof MenuPrimitive.Popup\n> &\n Pick<\n MenuPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > & {\n container?: React.ComponentProps<typeof MenuPrimitive.Portal>['container']\n }\n\nfunction DropdownMenuContent({\n className,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuPortal container={container}>\n <MenuPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n className=\"isolate z-50 outline-none\"\n side={side}\n sideOffset={sideOffset}\n >\n <MenuPrimitive.Popup\n data-slot=\"dropdown-menu-content\"\n className={cn(\n 'z-50 max-h-(--available-height) min-w-40 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg outline-none dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=top]:data-starting-style:translate-y-2',\n className,\n )}\n {...props}\n />\n </MenuPrimitive.Positioner>\n </DropdownMenuPortal>\n )\n}\n\nfunction DropdownMenuGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Group>) {\n return <MenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Item> & {\n inset?: boolean\n variant?: 'default' | 'destructive'\n}) {\n return (\n <MenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n 'group/dropdown-menu-item relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 data-[variant=destructive]:text-error data-[variant=destructive]:data-highlighted:bg-base-error-soft motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.CheckboxItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-checkbox-item-indicator\"\n >\n <MenuPrimitive.CheckboxItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.CheckboxItemIndicator>\n </span>\n {children}\n </MenuPrimitive.CheckboxItem>\n )\n}\n\nfunction DropdownMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioGroup>) {\n return (\n <MenuPrimitive.RadioGroup\n data-slot=\"dropdown-menu-radio-group\"\n {...props}\n />\n )\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n inset,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.RadioItem> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n data-inset={inset}\n className={cn(\n 'relative flex min-h-7 cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-10 pl-2 text-sm outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n className=\"pointer-events-none absolute inset-y-0 top-1 right-2 flex items-center justify-center\"\n data-slot=\"dropdown-menu-radio-item-indicator\"\n >\n <MenuPrimitive.RadioItemIndicator>\n <Check className=\"text-sm\" />\n </MenuPrimitive.RadioItemIndicator>\n </span>\n {children}\n </MenuPrimitive.RadioItem>\n )\n}\n\n// plain div, not Menu.GroupLabel: Base UI's GroupLabel throws outside a\n// Group, while our labels float freely (radix Label was an unwired div too)\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<'div'> & {\n inset?: boolean\n}) {\n return (\n <div\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\n 'px-2 py-1 text-xs text-gray-light data-[inset=true]:pl-7 [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return (\n <MenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\n '-mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\n 'ml-auto text-xs tracking-widest text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction DropdownMenuSub({\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>) {\n return <MenuPrimitive.SubmenuRoot data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean\n}) {\n return (\n <MenuPrimitive.SubmenuTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n 'flex min-h-7 cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none touch-target-row data-highlighted:bg-gray-a3 data-popup-open:bg-gray-a3 data-[inset=true]:pl-7 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto text-sm text-gray-light\" />\n </MenuPrimitive.SubmenuTrigger>\n )\n}\n\n// composes the public Content; the align/offset defaults visually align the\n// submenu with its parent menu\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: DropdownMenuContentProps) {\n return (\n <DropdownMenuContent\n data-slot=\"dropdown-menu-sub-content\"\n align=\"start\"\n alignOffset={-3}\n side=\"right\"\n sideOffset={0}\n className={cn('w-auto min-w-32', className)}\n {...props}\n />\n )\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n}\n"],"mappings":";;;;;;;;AAMA,SAAS,aAAa,EACpB,GAAG,SAC+C;CAClD,OAAO,oBAACA,KAAc,MAAf,EAAoB,GAAI,MAAQ,CAAA;AACzC;AAEA,SAAS,mBAAmB,EAC1B,UACA,GAAG,SACiD;CACpD,OACE,oBAACA,KAAc,QAAf;EAAsB,aAAU;EAAuB,GAAI;YACzD,oBAAC,aAAD,EAAc,SAAsB,CAAA;CAChB,CAAA;AAE1B;AAEA,SAAS,oBAAoB,EAC3B,GAAG,SACkD;CACrD,OAAO,oBAACA,KAAc,SAAf;EAAuB,aAAU;EAAwB,GAAI;CAAQ,CAAA;AAC9E;AAYA,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,aACA,MACA,aAAa,GACb,WACA,GAAG,SACwB;CAC3B,OACE,oBAAC,oBAAD;EAA+B;YAC7B,oBAACA,KAAc,YAAf;GACS;GACM;GACb,WAAU;GACJ;GACM;aAEZ,oBAACA,KAAc,OAAf;IACE,aAAU;IACV,WAAW,GACT,sPACA,qMACA,mNACA,SACF;IACA,GAAI;GACL,CAAA;EACuB,CAAA;CACR,CAAA;AAExB;AAEA,SAAS,kBAAkB,EACzB,GAAG,SACgD;CACnD,OAAO,oBAACA,KAAc,OAAf;EAAqB,aAAU;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,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC4B;CAC/B,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,EACvB,GAAG,SACsD;CACzD,OAAO,oBAACA,KAAc,aAAf;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SAGF;CACD,OACE,qBAACA,KAAc,gBAAf;EACE,aAAU;EACV,cAAY;EACZ,WAAW,GACT,2UACA,SACF;EACA,GAAI;YAPN,CASG,UACD,oBAAC,cAAD,EAAc,WAAU,kCAAmC,CAAA,CAC/B;;AAElC;AAIA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SACwB;CAC3B,OACE,oBAAC,qBAAD;EACE,aAAU;EACV,OAAM;EACN,aAAa;EACb,MAAK;EACL,YAAY;EACZ,WAAW,GAAG,mBAAmB,SAAS;EAC1C,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,38 +1,110 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_components_icon = require("./icon.cjs");
|
|
4
|
+
let react = require("react");
|
|
4
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let class_variance_authority = require("class-variance-authority");
|
|
7
|
+
let cn = require("cn");
|
|
5
8
|
//#region src/components/empty-state.tsx
|
|
6
|
-
const emptyStateVariants = (0,
|
|
7
|
-
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const emptyStateVariants = (0, class_variance_authority.cva)("flex", {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
dashed: "rounded-lg border border-dashed border-gray",
|
|
13
|
+
ghost: ""
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "",
|
|
17
|
+
sm: ""
|
|
18
|
+
},
|
|
19
|
+
layout: {
|
|
20
|
+
stacked: "flex-col items-center text-center",
|
|
21
|
+
inline: "flex-row items-start text-left"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
compoundVariants: [
|
|
25
|
+
{
|
|
26
|
+
layout: "stacked",
|
|
27
|
+
size: "default",
|
|
28
|
+
class: "gap-4 px-6 py-12"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
layout: "stacked",
|
|
32
|
+
size: "sm",
|
|
33
|
+
class: "gap-2 px-4 py-5"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
layout: "inline",
|
|
37
|
+
size: "default",
|
|
38
|
+
class: "gap-4 p-6"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
layout: "inline",
|
|
42
|
+
size: "sm",
|
|
43
|
+
class: "gap-3 px-4 py-3"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
variant: "dashed",
|
|
48
|
+
size: "default",
|
|
49
|
+
layout: "stacked"
|
|
50
|
+
}
|
|
12
51
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
52
|
+
const EmptyStateContext = (0, react.createContext)({
|
|
53
|
+
size: "default",
|
|
54
|
+
layout: "stacked"
|
|
55
|
+
});
|
|
56
|
+
function EmptyStateTitle({ className, ...props }) {
|
|
57
|
+
const { size } = (0, react.useContext)(EmptyStateContext);
|
|
58
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
59
|
+
"data-slot": "empty-state-title",
|
|
60
|
+
className: (0, cn.cn)("text-gray", size === "sm" ? "text-sm font-semibold" : "text-base font-bold", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function EmptyStateDescription({ className, ...props }) {
|
|
65
|
+
const { size, layout } = (0, react.useContext)(EmptyStateContext);
|
|
66
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
67
|
+
"data-slot": "empty-state-description",
|
|
68
|
+
className: (0, cn.cn)(layout !== "inline" && "mx-auto", "max-w-md text-gray-light", size === "sm" ? "text-xs" : "text-sm", className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function EmptyStateActions({ className, ...props }) {
|
|
73
|
+
const { layout } = (0, react.useContext)(EmptyStateContext);
|
|
74
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
75
|
+
"data-slot": "empty-state-actions",
|
|
76
|
+
className: (0, cn.cn)("mt-2 flex flex-wrap gap-2", layout === "stacked" && "justify-center", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function EmptyState({ children, className, icon: Glyph, layout = "stacked", size = "default", variant, ...props }) {
|
|
81
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyStateContext.Provider, {
|
|
82
|
+
value: {
|
|
83
|
+
size,
|
|
84
|
+
layout
|
|
85
|
+
},
|
|
86
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
87
|
+
"data-slot": "empty-state",
|
|
88
|
+
className: (0, cn.cn)(emptyStateVariants({
|
|
89
|
+
variant,
|
|
90
|
+
size,
|
|
91
|
+
layout
|
|
92
|
+
}), className),
|
|
93
|
+
...props,
|
|
94
|
+
children: [Glyph ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_icon.Icon, {
|
|
95
|
+
size: size === "sm" ? "small" : "xl",
|
|
19
96
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Glyph, {})
|
|
20
|
-
}) : null,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: title
|
|
26
|
-
}), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
27
|
-
className: "mx-auto max-w-md text-sm text-gray-light",
|
|
28
|
-
children: description
|
|
29
|
-
})]
|
|
30
|
-
}),
|
|
31
|
-
action
|
|
32
|
-
]
|
|
97
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
98
|
+
className: (0, cn.cn)("flex flex-col gap-2", layout === "inline" && "min-w-0 flex-1"),
|
|
99
|
+
children
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
33
102
|
});
|
|
34
103
|
}
|
|
35
104
|
//#endregion
|
|
36
105
|
exports.EmptyState = EmptyState;
|
|
106
|
+
exports.EmptyStateActions = EmptyStateActions;
|
|
107
|
+
exports.EmptyStateDescription = EmptyStateDescription;
|
|
108
|
+
exports.EmptyStateTitle = EmptyStateTitle;
|
|
37
109
|
|
|
38
110
|
//# sourceMappingURL=empty-state.cjs.map
|