@tryghost/shade 0.1.0-alpha.47 → 0.1.0-alpha.49
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/README.md +7 -2
- package/es/app.js +2 -1
- package/es/components/page-templates/list-page.js +1 -1
- package/es/components/page-templates/list-page.js.map +1 -1
- package/es/components/patterns/color-picker.js +79 -56
- package/es/components/patterns/color-picker.js.map +1 -1
- package/es/components/patterns/page-header.js +1 -1
- package/es/components/patterns/page-header.js.map +1 -1
- package/es/components/ui/alert-dialog.js +22 -10
- package/es/components/ui/alert-dialog.js.map +1 -1
- package/es/components/ui/context-menu.js +18 -8
- package/es/components/ui/context-menu.js.map +1 -1
- package/es/components/ui/dialog.js +39 -23
- package/es/components/ui/dialog.js.map +1 -1
- package/es/components/ui/dropdown-menu.js +20 -10
- package/es/components/ui/dropdown-menu.js.map +1 -1
- package/es/components/ui/floating-sidebar.js +20 -2
- package/es/components/ui/floating-sidebar.js.map +1 -1
- package/es/components/ui/hover-card.js +13 -7
- package/es/components/ui/hover-card.js.map +1 -1
- package/es/components/ui/popover.js +14 -8
- package/es/components/ui/popover.js.map +1 -1
- package/es/components/ui/select.js +25 -15
- package/es/components/ui/select.js.map +1 -1
- package/es/components/ui/sheet.js +29 -18
- package/es/components/ui/sheet.js.map +1 -1
- package/es/components/ui/sortable-list.js +105 -10
- package/es/components/ui/sortable-list.js.map +1 -1
- package/es/components/ui/sticky-footer.js +7 -4
- package/es/components/ui/sticky-footer.js.map +1 -1
- package/es/components/ui/tooltip.js +81 -31
- package/es/components/ui/tooltip.js.map +1 -1
- package/es/components.js +1 -1
- package/es/index.js +1 -1
- package/es/lib/app-overlay.js +151 -0
- package/es/lib/app-overlay.js.map +1 -0
- package/es/lib/safe-area.js +168 -0
- package/es/lib/safe-area.js.map +1 -0
- package/es/providers/shade-provider.js +9 -1
- package/es/providers/shade-provider.js.map +1 -1
- package/es/shade-app.js +16 -4
- package/es/shade-app.js.map +1 -1
- package/package.json +1 -1
- package/styles.css +17 -0
- package/types/app.d.ts +2 -0
- package/types/app.d.ts.map +1 -1
- package/types/components/patterns/color-picker.d.ts +5 -0
- package/types/components/patterns/color-picker.d.ts.map +1 -1
- package/types/components/ui/alert-dialog.d.ts +1 -1
- package/types/components/ui/alert-dialog.d.ts.map +1 -1
- package/types/components/ui/context-menu.d.ts +1 -1
- package/types/components/ui/context-menu.d.ts.map +1 -1
- package/types/components/ui/dialog.d.ts +1 -1
- package/types/components/ui/dialog.d.ts.map +1 -1
- package/types/components/ui/dropdown-menu.d.ts +1 -1
- package/types/components/ui/dropdown-menu.d.ts.map +1 -1
- package/types/components/ui/floating-sidebar.d.ts.map +1 -1
- package/types/components/ui/hover-card.d.ts.map +1 -1
- package/types/components/ui/popover.d.ts.map +1 -1
- package/types/components/ui/select.d.ts.map +1 -1
- package/types/components/ui/sheet.d.ts +1 -1
- package/types/components/ui/sheet.d.ts.map +1 -1
- package/types/components/ui/sortable-list.d.ts +4 -1
- package/types/components/ui/sortable-list.d.ts.map +1 -1
- package/types/components/ui/sticky-footer.d.ts.map +1 -1
- package/types/components/ui/tooltip.d.ts.map +1 -1
- package/types/lib/app-overlay.d.ts +58 -0
- package/types/lib/app-overlay.d.ts.map +1 -0
- package/types/lib/safe-area.d.ts +27 -0
- package/types/lib/safe-area.d.ts.map +1 -0
- package/types/providers/shade-provider.d.ts.map +1 -1
- package/types/shade-app.d.ts +3 -0
- package/types/shade-app.d.ts.map +1 -1
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
2
|
import { useShade } from "../../providers/shade-context.js";
|
|
3
3
|
import { ShadeScope } from "../../shade-scope.js";
|
|
4
|
+
import { SAFE_AREA_DIALOG_X, overlayTint, useHostedModal, useModalOpen } from "../../lib/app-overlay.js";
|
|
4
5
|
import { buttonVariants } from "./button-variants.js";
|
|
5
6
|
import * as React$1 from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
8
9
|
//#region src/components/ui/alert-dialog.tsx
|
|
9
|
-
var AlertDialog =
|
|
10
|
+
var AlertDialog = (props) => {
|
|
11
|
+
const [rootProps, provideOpen] = useModalOpen(props);
|
|
12
|
+
return provideOpen(/* @__PURE__ */ jsx(AlertDialogPrimitive.Root, { ...rootProps }));
|
|
13
|
+
};
|
|
10
14
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
11
15
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
12
16
|
var AlertDialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, {
|
|
13
|
-
className: cn("fixed inset-0 z-[1100] transform-gpu
|
|
17
|
+
className: cn("fixed inset-0 z-[1100] transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", overlayTint("dialog"), className),
|
|
14
18
|
...props,
|
|
15
19
|
ref
|
|
16
20
|
}));
|
|
17
21
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
18
|
-
var AlertDialogContent = React$1.forwardRef(({ className, overlayClassName, ...props }, ref) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
var AlertDialogContent = React$1.forwardRef(({ className, overlayClassName, children, ...props }, ref) => {
|
|
23
|
+
const { container, inApp, overlayStyle, ref: contentRef, wrap } = useHostedModal("dialog", ref);
|
|
24
|
+
return /* @__PURE__ */ jsx(AlertDialogPortal, {
|
|
25
|
+
container,
|
|
26
|
+
children: /* @__PURE__ */ jsxs(ShadeScope, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {
|
|
27
|
+
className: overlayClassName,
|
|
28
|
+
style: overlayStyle,
|
|
29
|
+
onClick: (e) => e.stopPropagation()
|
|
30
|
+
}), wrap(/* @__PURE__ */ jsx(AlertDialogPrimitive.Content, {
|
|
31
|
+
ref: contentRef,
|
|
32
|
+
className: cn("fixed top-[20%] left-[50%] z-[1100] grid max-w-lg translate-y-[-20%] gap-6 bg-surface-elevated-2 p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-top-[18%] data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-top-[18%] sm:rounded-lg", SAFE_AREA_DIALOG_X, inApp && "max-h-[calc(100dvh_-_var(--ghost-safe-area-inset-top,0px)_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem)] overflow-y-auto", inApp && "translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_20dvh,-20%,80dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_100%)]", className),
|
|
33
|
+
...props,
|
|
34
|
+
children
|
|
35
|
+
}))] })
|
|
36
|
+
});
|
|
37
|
+
});
|
|
26
38
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
27
39
|
var AlertDialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
28
40
|
className: cn("flex flex-col gap-y-2 text-center sm:text-left", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","names":[],"sources":["../../../src/components/ui/alert-dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\n\nimport { cn } from '@/lib/utils';\nimport type { ButtonProps } from '@/components/ui/button';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { ShadeScope } from '@/shade-scope';\n\nconst AlertDialog = AlertDialogPrimitive.Root;\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n// Above SettingsModal (z-[1000]), so an alert opened from a settings modal shows in front of it.\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n className={cn(\n 'fixed inset-0 z-[1100] transform-gpu
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","names":[],"sources":["../../../src/components/ui/alert-dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';\n\nimport {\n overlayTint,\n SAFE_AREA_DIALOG_HEIGHT,\n SAFE_AREA_DIALOG_X,\n useHostedModal,\n useModalOpen,\n} from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport type { ButtonProps } from '@/components/ui/button';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { ShadeScope } from '@/shade-scope';\n\nconst AlertDialog = (props: React.ComponentProps<typeof AlertDialogPrimitive.Root>) => {\n const [rootProps, provideOpen] = useModalOpen(props);\n return provideOpen(<AlertDialogPrimitive.Root {...rootProps} />);\n};\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n// Above SettingsModal (z-[1000]), so an alert opened from a settings modal shows in front of it.\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n className={cn(\n 'fixed inset-0 z-[1100] transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0',\n overlayTint('dialog'),\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;\n\ntype AlertDialogContentProps = React.ComponentPropsWithoutRef<\n typeof AlertDialogPrimitive.Content\n> & {\n overlayClassName?: string;\n};\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, overlayClassName, children, ...props }, ref) => {\n const { container, inApp, overlayStyle, ref: contentRef, wrap } = useHostedModal('dialog', ref);\n return (\n <AlertDialogPortal container={container}>\n <ShadeScope>\n <AlertDialogOverlay\n className={overlayClassName}\n style={overlayStyle}\n onClick={(e) => e.stopPropagation()}\n />\n {wrap(\n <AlertDialogPrimitive.Content\n ref={contentRef}\n className={cn(\n 'fixed top-[20%] left-[50%] z-[1100] grid max-w-lg translate-y-[-20%] gap-6 bg-surface-elevated-2 p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-top-[18%] data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-top-[18%] sm:rounded-lg',\n SAFE_AREA_DIALOG_X,\n // Moves up only as far as it must to stay between the safe area's top and bottom.\n inApp && SAFE_AREA_DIALOG_HEIGHT,\n inApp &&\n 'translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_20dvh,-20%,80dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_100%)]',\n className,\n )}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Content>,\n )}\n </ShadeScope>\n </AlertDialogPortal>\n );\n});\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;\n\nconst AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-2 text-center sm:text-left', className)} {...props} />\n);\nAlertDialogHeader.displayName = 'AlertDialogHeader';\n\nconst AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-2', className)}\n {...props}\n />\n);\nAlertDialogFooter.displayName = 'AlertDialogFooter';\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn('text-xl font-semibold in-data-[admin7-design=true]:font-title', className)}\n {...props}\n />\n));\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description ref={ref} className={cn('text-base', className)} {...props} />\n));\nAlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> & Pick<ButtonProps, 'variant'>\n>(({ className, variant, ...props }, ref) => {\n const { controlShape } = useShade();\n\n return (\n <AlertDialogPrimitive.Action\n ref={ref}\n className={cn(buttonVariants({ shape: controlShape, variant }), className)}\n {...props}\n data-control-shape={controlShape}\n />\n );\n});\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => {\n const { controlShape } = useShade();\n\n return (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(\n buttonVariants({ shape: controlShape, variant: 'outline' }),\n 'mt-2 sm:mt-0',\n className,\n )}\n {...props}\n data-control-shape={controlShape}\n />\n );\n});\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAM,eAAe,UAAkE;CACrF,MAAM,CAAC,WAAW,eAAe,aAAa,KAAK;CACnD,OAAO,YAAY,oBAAC,qBAAqB,MAAtB,EAA2B,GAAI,UAAY,CAAA,CAAC;AACjE;AAEA,IAAM,qBAAqB,qBAAqB;AAEhD,IAAM,oBAAoB,qBAAqB;AAG/C,IAAM,qBAAqB,QAAM,YAG9B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,SAAtB;CACE,WAAW,GACT,gKACA,YAAY,QAAQ,GACpB,SACF;CACA,GAAI;CACC;AACN,CAAA,CACF;AACD,mBAAmB,cAAc,qBAAqB,QAAQ;AAQ9D,IAAM,qBAAqB,QAAM,YAG9B,EAAE,WAAW,kBAAkB,UAAU,GAAG,SAAS,QAAQ;CAC9D,MAAM,EAAE,WAAW,OAAO,cAAc,KAAK,YAAY,SAAS,eAAe,UAAU,GAAG;CAC9F,OACE,oBAAC,mBAAD;EAA8B;YAC5B,qBAAC,YAAD,EAAA,UAAA,CACE,oBAAC,oBAAD;GACE,WAAW;GACX,OAAO;GACP,UAAU,MAAM,EAAE,gBAAgB;EACnC,CAAA,GACA,KACC,oBAAC,qBAAqB,SAAtB;GACE,KAAK;GACL,WAAW,GACT,uZACA,oBAEA,SAAA,gIACA,SACE,wIACF,SACF;GACA,GAAI;GAEH;EAC2B,CAAA,CAChC,CACU,EAAA,CAAA;CACK,CAAA;AAEvB,CAAC;AACD,mBAAmB,cAAc,qBAAqB,QAAQ;AAE9D,IAAM,qBAAqB,EAAE,WAAW,GAAG,YACzC,oBAAC,OAAD;CAAK,WAAW,GAAG,kDAAkD,SAAS;CAAG,GAAI;AAAQ,CAAA;AAE/F,kB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{ safeAreaCollision } from "../../lib/safe-area.js";
|
|
4
|
+
import { usePortalContainer } from "../../lib/app-overlay.js";
|
|
3
5
|
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
4
6
|
import * as React$1 from "react";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -8,7 +10,10 @@ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
|
8
10
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
9
11
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
10
12
|
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
11
|
-
var ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
13
|
+
var ContextMenuPortal = (props) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, {
|
|
14
|
+
container: usePortalContainer(),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
12
17
|
var ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
13
18
|
var ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
14
19
|
var ContextMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.SubTrigger, {
|
|
@@ -18,17 +23,22 @@ var ContextMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ..
|
|
|
18
23
|
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
|
|
19
24
|
}));
|
|
20
25
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
21
|
-
var ContextMenuSubContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
26
|
+
var ContextMenuSubContent = React$1.forwardRef(({ className, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
22
27
|
ref,
|
|
23
|
-
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
|
|
28
|
+
className: cn("data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
|
|
29
|
+
...safeAreaCollision(collisionBoundary, usePortalContainer()),
|
|
24
30
|
...props
|
|
25
31
|
}) }));
|
|
26
32
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
27
|
-
var ContextMenuContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
var ContextMenuContent = React$1.forwardRef(({ className, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, {
|
|
34
|
+
container: usePortalContainer(),
|
|
35
|
+
children: /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
|
|
36
|
+
ref,
|
|
37
|
+
className: cn("data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
|
|
38
|
+
...safeAreaCollision(collisionBoundary, usePortalContainer()),
|
|
39
|
+
...props
|
|
40
|
+
}) })
|
|
41
|
+
}));
|
|
32
42
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
33
43
|
var ContextMenuItem = React$1.forwardRef(({ className, inset, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Item, {
|
|
34
44
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","names":[],"sources":["../../../src/components/ui/context-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ShadeScope>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </ShadeScope>\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ShadeScope>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </ShadeScope>\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n }\n>(({ className, inset, variant = 'default', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n variant === 'destructive' &&\n 'text-destructive focus:bg-destructive/10 focus:text-destructive',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nContextMenuShortcut.displayName = 'ContextMenuShortcut';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;AAOA,IAAM,cAAc,qBAAqB;AAEzC,IAAM,qBAAqB,qBAAqB;AAEhD,IAAM,mBAAmB,qBAAqB;AAE9C,IAAM,oBAAoB,qBAAqB;AAE/C,IAAM,iBAAiB,qBAAqB;AAE5C,IAAM,wBAAwB,qBAAqB;AAEnD,IAAM,wBAAwB,QAAM,YAKjC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,qBAAqB,YAAtB;CACO;CACL,WAAW,GACT,mOACA,SAAS,QACT,SACF;CACA,GAAI;WAPN,CASG,UACD,oBAAC,cAAD,EAAc,WAAU,UAAW,CAAA,CACJ;EAClC;AACD,sBAAsB,cAAc,qBAAqB,WAAW;AAEpE,IAAM,wBAAwB,QAAM,YAGjC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,YAAD,EAAA,UACE,oBAAC,qBAAqB,YAAtB;CACO;CACL,WAAW,GACT,2bACA,SACF;CACA,GAAI;AACL,CAAA,EACS,CAAA,CACb;AACD,sBAAsB,cAAc,qBAAqB,WAAW;AAEpE,IAAM,qBAAqB,QAAM,YAG9B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,QAAtB,EAAA,UACE,oBAAC,YAAD,EAAA,UACE,oBAAC,qBAAqB,SAAtB;CACO;CACL,WAAW,GACT,0GACA,oVACA,SACF;CACA,GAAI;AACL,CAAA,EACS,CAAA,EACe,CAAA,CAC9B;AACD,mBAAmB,cAAc,qBAAqB,QAAQ;AAE9D,IAAM,kBAAkB,QAAM,YAM3B,EAA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AU;AAElE,IAAM,uBAAuB,EAAE,WAAW,GAAG,YAAmD;CAC9F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,oBAAoB,cAAc"}
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":[],"sources":["../../../src/components/ui/context-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as ContextMenuPrimitive from '@radix-ui/react-context-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { usePortalContainer } from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\nimport { safeAreaCollision } from '@/lib/safe-area';\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = (props: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) => (\n <ContextMenuPrimitive.Portal container={usePortalContainer()} {...props} />\n);\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, collisionBoundary, ...props }, ref) => (\n <ShadeScope>\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n {...props}\n />\n </ShadeScope>\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, collisionBoundary, ...props }, ref) => (\n <ContextMenuPrimitive.Portal container={usePortalContainer()}>\n <ShadeScope>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-context-menu-content-available-height) data-[safe-area]:max-w-(--radix-context-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n {...props}\n />\n </ShadeScope>\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n }\n>(({ className, inset, variant = 'default', ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n variant === 'destructive' &&\n 'text-destructive focus:bg-destructive/10 focus:text-destructive',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nContextMenuShortcut.displayName = 'ContextMenuShortcut';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;;;AASA,IAAM,cAAc,qBAAqB;AAEzC,IAAM,qBAAqB,qBAAqB;AAEhD,IAAM,mBAAmB,qBAAqB;AAE9C,IAAM,qBAAqB,UACzB,oBAAC,qBAAqB,QAAtB;CAA6B,WAAW,mBAAmB;CAAG,GAAI;AAAQ,CAAA;AAG5E,IAAM,iBAAiB,qBAAqB;AAE5C,IAAM,wBAAwB,qBAAqB;AAEnD,IAAM,wBAAwB,QAAM,YAKjC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,qBAAqB,YAAtB;CACO;CACL,WAAW,GACT,mOACA,SAAS,QACT,SACF;CACA,GAAI;WAPN,CASG,UACD,oBAAC,cAAD,EAAc,WAAU,UAAW,CAAA,CACJ;EAClC;AACD,sBAAsB,cAAc,qBAAqB,WAAW;AAEpE,IAAM,wBAAwB,QAAM,YAGjC,EAAE,WAAW,mBAAmB,GAAG,SAAS,QAC7C,oBAAC,YAAD,EAAA,UACE,oBAAC,qBAAqB,YAAtB;CACO;CACL,WAAW,GACT,iLACA,2bACA,SACF;CACA,GAAI,kBAAkB,mBAAmB,mBAAmB,CAAC;CAC7D,GAAI;AACL,CAAA,EACS,CAAA,CACb;AACD,sBAAsB,cAAc,qBAAqB,WAAW;AAEpE,IAAM,qBAAqB,QAAM,YAG9B,EAAE,WAAW,mBAAmB,GAAG,SAAS,QAC7C,oBAAC,qBAAqB,QAAtB;CAA6B,WAAW,mBAAmB;WACzD,oBAAC,YAAD,EAAA,UACE,oBAAC,qBAAqB,SAAtB;EACO;EACL,WAAW,GACT,iLACA,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M;AAE1D,IAAM,uBAAuB,QAAM,YAGhC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,qBAAqB,WAAtB;CACO;CACL,WAAW,GAAG,4BAA4B,SAAS;CACnD,GAAI;AACL,CAAA,CACF;AACD,qBAAqB,cAAc,qBAAqB,UAAU;AAElE,IAAM,uBAAuB,EAAE,WAAW,GAAG,YAAmD;CAC9F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,oBAAoB,cAAc"}
|
|
@@ -1,48 +1,64 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
2
|
import { ShadeScope } from "../../shade-scope.js";
|
|
3
|
+
import { SAFE_AREA_DIALOG_HEIGHT, SAFE_AREA_DIALOG_X, overlayTint, useHostedModal, useModalOpen } from "../../lib/app-overlay.js";
|
|
3
4
|
import * as React$1 from "react";
|
|
4
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
7
|
//#region src/components/ui/dialog.tsx
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
modal,
|
|
12
|
-
...props
|
|
13
|
-
})
|
|
14
|
-
});
|
|
8
|
+
var Dialog = (props) => {
|
|
9
|
+
const [rootProps, provideOpen] = useModalOpen(props);
|
|
10
|
+
return provideOpen(/* @__PURE__ */ jsx(DialogPrimitive.Root, { ...rootProps }));
|
|
11
|
+
};
|
|
15
12
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
16
13
|
var DialogPortal = DialogPrimitive.Portal;
|
|
17
14
|
var DialogClose = DialogPrimitive.Close;
|
|
18
15
|
var DialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
19
16
|
ref,
|
|
20
|
-
className: cn("fixed inset-0 z-50 transform-gpu
|
|
17
|
+
className: cn("fixed inset-0 z-50 transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", overlayTint("dialog"), className),
|
|
21
18
|
"data-slot": "dialog-overlay",
|
|
22
19
|
...props
|
|
23
20
|
}));
|
|
24
21
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
22
|
+
var fixedDialogClassName = cn("fixed top-[max(8vmin,var(--ghost-safe-area-inset-top,0px))] left-[50%] sm:rounded-lg", SAFE_AREA_DIALOG_X);
|
|
23
|
+
var inAppFixedDialogClassName = cn(SAFE_AREA_DIALOG_HEIGHT, "translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_max(8vmin,var(--ghost-safe-area-inset-top,0px)),0px,100dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_max(8vmin,var(--ghost-safe-area-inset-top,0px))_-_100%)]");
|
|
24
|
+
var scrollingDialogClassName = "pointer-events-auto relative rounded-lg";
|
|
25
|
+
var inAppScrollerClassName = "top-[var(--ghost-safe-area-inset-top,0px)] right-[var(--ghost-safe-area-inset-right,0px)] bottom-[var(--ghost-safe-area-inset-bottom,0px)] left-[var(--ghost-safe-area-inset-left,0px)]";
|
|
26
|
+
var inAppScrollingWrapperClassName = "@container pt-[max(0px,calc(8vmin_-_var(--ghost-safe-area-inset-top,0px)))] pb-[max(1rem,calc(8vmin_-_var(--ghost-safe-area-inset-bottom,0px)))]";
|
|
27
|
+
var inAppScrollingDialogClassName = "translate-x-[clamp((100%_-_100cqw)/2,(var(--ghost-safe-area-inset-right,0px)_-_var(--ghost-safe-area-inset-left,0px))/2,(100cqw_-_100%)/2)]";
|
|
25
28
|
var dialogPanelClassName = "z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95";
|
|
26
29
|
var DialogContent = React$1.forwardRef(({ className, children, scroll = "fixed", ...props }, ref) => {
|
|
27
|
-
const modal =
|
|
28
|
-
const panel = /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
29
|
-
ref,
|
|
30
|
-
className: cn(scroll === "overlay" ?
|
|
30
|
+
const { container, inApp, modal, overlayStyle, ref: contentRef, wrap } = useHostedModal("dialog", ref);
|
|
31
|
+
const panel = wrap(/* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
32
|
+
ref: contentRef,
|
|
33
|
+
className: cn(dialogPanelClassName, scroll === "overlay" ? scrollingDialogClassName : fixedDialogClassName, inApp && (scroll === "overlay" ? inAppScrollingDialogClassName : inAppFixedDialogClassName), className),
|
|
31
34
|
...props,
|
|
32
35
|
children
|
|
33
|
-
});
|
|
36
|
+
}));
|
|
34
37
|
const scrollingPanel = /* @__PURE__ */ jsx("div", {
|
|
35
|
-
className: "flex min-h-full items-start justify-center px-4 py-[8vmin]",
|
|
38
|
+
className: cn("flex min-h-full items-start justify-center px-4 py-[8vmin]", inApp && inAppScrollingWrapperClassName),
|
|
36
39
|
children: panel
|
|
37
40
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const scroller = cn("overflow-y-auto", inApp && inAppScrollerClassName);
|
|
42
|
+
return /* @__PURE__ */ jsx(DialogPortal, {
|
|
43
|
+
container,
|
|
44
|
+
children: /* @__PURE__ */ jsx(ShadeScope, { children: scroll === "overlay" ? modal ? inApp ? /* @__PURE__ */ jsx(DialogOverlay, {
|
|
45
|
+
className: "duration-200",
|
|
46
|
+
style: overlayStyle,
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: cn("fixed z-50", scroller),
|
|
49
|
+
"data-slot": "dialog-scroller",
|
|
50
|
+
children: scrollingPanel
|
|
51
|
+
})
|
|
52
|
+
}) : /* @__PURE__ */ jsx(DialogOverlay, {
|
|
53
|
+
className: cn(scroller, "duration-200"),
|
|
54
|
+
style: overlayStyle,
|
|
55
|
+
children: scrollingPanel
|
|
56
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: cn("pointer-events-none fixed inset-0 z-50", scroller),
|
|
58
|
+
"data-slot": "dialog-scroller",
|
|
59
|
+
children: scrollingPanel
|
|
60
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DialogOverlay, { style: overlayStyle }), panel] }) })
|
|
61
|
+
});
|
|
46
62
|
});
|
|
47
63
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
48
64
|
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\n// Radix keeps whether a dialog is modal to itself, and the overlay scroll layout needs to know.\nconst DialogModalContext = React.createContext(true);\n\nconst Dialog = ({ modal = true, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) => (\n <DialogModalContext.Provider value={modal}>\n <DialogPrimitive.Root modal={modal} {...props} />\n </DialogModalContext.Provider>\n);\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\n// The panel itself, shared by both ways a dialog can sit on the page.\nconst dialogPanelClassName =\n 'z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95';\n\nexport interface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n /**\n * How a dialog taller than the window scrolls. `fixed` (the default) pins the dialog near\n * the top of the window, so it needs its own height limit and inner scroll. `overlay` makes\n * the backdrop the scroll container instead: the whole dialog scrolls as one piece, the way\n * a page does.\n */\n scroll?: 'fixed' | 'overlay';\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, scroll = 'fixed', ...props }, ref) => {\n const modal = React.useContext(DialogModalContext);\n\n const panel = (\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n scroll === 'overlay'\n ? 'pointer-events-auto relative rounded-lg'\n : 'fixed top-[8vmin] left-[50%] translate-x-[-50%] sm:rounded-lg',\n dialogPanelClassName,\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n );\n\n // The space around the dialog is padding on this wrapper, not on the scroll container:\n // browsers leave a scroll container's own bottom padding out of what it scrolls, which\n // would leave the dialog flush with the bottom of the window.\n const scrollingPanel = (\n <div className=\"flex min-h-full items-start justify-center px-4 py-[8vmin]\">{panel}</div>\n );\n\n return (\n <DialogPortal>\n <ShadeScope>\n {scroll === 'overlay' ? (\n modal ? (\n // The dialog sits inside the backdrop here, so the backdrop animates as long as the\n // dialog does; otherwise closing unmounts the dialog part-way through its animation.\n <DialogOverlay className=\"overflow-y-auto duration-200\">{scrollingPanel}</DialogOverlay>\n ) : (\n // Radix renders no backdrop for a non-modal dialog, and the page behind stays\n // usable, so this scroll container lets presses beside the dialog through.\n <div\n className=\"pointer-events-none fixed inset-0 z-50 overflow-y-auto\"\n data-slot=\"dialog-scroller\"\n >\n {scrollingPanel}\n </div>\n )\n ) : (\n <>\n <DialogOverlay />\n {panel}\n </>\n )}\n </ShadeScope>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title',\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogF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oBAAC,OAAD;CAAK,WAAW,GAAG,oDAAoD,SAAS;CAAG,GAAI;AAAQ,CAAA;AAEjG,aAAa,cAAc;AAE3B,IAAM,gBAAgB,EAAE,WAAW,GAAG,YACpC,oBAAC,OAAD;CACE,WAAW,GACT,0EACA,SACF;CACA,GAAI;AACL,CAAA;AAEH,aAAa,cAAc;AAE3B,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,OAAjB;CACO;CACL,WAAW,GACT,6FACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc,gBAAgB,MAAM;AAEhD,IAAM,oBAAoB,QAAM,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,aAAjB;CACO;CACL,WAAW,GAAG,yBAAyB,SAAS;CAChD,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,gBAAgB,YAAY"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport {\n overlayTint,\n SAFE_AREA_DIALOG_HEIGHT,\n SAFE_AREA_DIALOG_X,\n useHostedModal,\n useModalOpen,\n} from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst Dialog = (props: React.ComponentProps<typeof DialogPrimitive.Root>) => {\n const [rootProps, provideOpen] = useModalOpen(props);\n return provideOpen(<DialogPrimitive.Root {...rootProps} />);\n};\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0',\n overlayTint('dialog'),\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst fixedDialogClassName = cn(\n 'fixed top-[max(8vmin,var(--ghost-safe-area-inset-top,0px))] left-[50%] sm:rounded-lg',\n SAFE_AREA_DIALOG_X,\n);\n\n// Moves up only as far as it must to stay between the safe area's top and bottom.\nconst inAppFixedDialogClassName = cn(\n SAFE_AREA_DIALOG_HEIGHT,\n 'translate-y-[clamp(var(--ghost-safe-area-inset-top,0px)_-_max(8vmin,var(--ghost-safe-area-inset-top,0px)),0px,100dvh_-_var(--ghost-safe-area-inset-bottom,0px)_-_1rem_-_max(8vmin,var(--ghost-safe-area-inset-top,0px))_-_100%)]',\n);\n\nconst scrollingDialogClassName = 'pointer-events-auto relative rounded-lg';\n\n// The dialog keeps as near the window's centre as the safe area allows. It measures against its\n// wrapper, a size container, so the wrapper's padding and the scrollbar are allowed for.\nconst inAppScrollerClassName =\n 'top-[var(--ghost-safe-area-inset-top,0px)] right-[var(--ghost-safe-area-inset-right,0px)] bottom-[var(--ghost-safe-area-inset-bottom,0px)] left-[var(--ghost-safe-area-inset-left,0px)]';\nconst inAppScrollingWrapperClassName =\n '@container pt-[max(0px,calc(8vmin_-_var(--ghost-safe-area-inset-top,0px)))] pb-[max(1rem,calc(8vmin_-_var(--ghost-safe-area-inset-bottom,0px)))]';\nconst inAppScrollingDialogClassName =\n 'translate-x-[clamp((100%_-_100cqw)/2,(var(--ghost-safe-area-inset-right,0px)_-_var(--ghost-safe-area-inset-left,0px))/2,(100cqw_-_100%)/2)]';\n\n// The panel itself, shared by both ways a dialog can sit on the page.\nconst dialogPanelClassName =\n 'z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95';\n\nexport interface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n /**\n * How a dialog taller than the window scrolls. `fixed` (the default) pins the dialog near\n * the top of the window, so it needs its own height limit and inner scroll. `overlay` makes\n * the backdrop the scroll container instead: the whole dialog scrolls as one piece, the way\n * a page does.\n */\n scroll?: 'fixed' | 'overlay';\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, scroll = 'fixed', ...props }, ref) => {\n const {\n container,\n inApp,\n modal,\n overlayStyle,\n ref: contentRef,\n wrap,\n } = useHostedModal('dialog', ref);\n\n // Wrapped outside the content, so an `asChild` content's element still gets Radix's props.\n const panel = wrap(\n <DialogPrimitive.Content\n ref={contentRef}\n className={cn(\n dialogPanelClassName,\n scroll === 'overlay' ? scrollingDialogClassName : fixedDialogClassName,\n inApp && (scroll === 'overlay' ? inAppScrollingDialogClassName : inAppFixedDialogClassName),\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>,\n );\n\n // The space around the dialog is padding on this wrapper, not on the scroll container:\n // browsers leave a scroll container's own bottom padding out of what it scrolls, which\n // would leave the dialog flush with the bottom of the window.\n const scrollingPanel = (\n <div\n className={cn(\n 'flex min-h-full items-start justify-center px-4 py-[8vmin]',\n inApp && inAppScrollingWrapperClassName,\n )}\n >\n {panel}\n </div>\n );\n const scroller = cn('overflow-y-auto', inApp && inAppScrollerClassName);\n\n return (\n <DialogPortal container={container}>\n <ShadeScope>\n {scroll === 'overlay' ? (\n modal ? (\n // The dialog sits inside the backdrop here, so the backdrop animates as long as the\n // dialog does; otherwise closing unmounts the dialog part-way through its animation.\n inApp ? (\n <DialogOverlay className=\"duration-200\" style={overlayStyle}>\n <div className={cn('fixed z-50', scroller)} data-slot=\"dialog-scroller\">\n {scrollingPanel}\n </div>\n </DialogOverlay>\n ) : (\n <DialogOverlay className={cn(scroller, 'duration-200')} style={overlayStyle}>\n {scrollingPanel}\n </DialogOverlay>\n )\n ) : (\n // Radix renders no backdrop for a non-modal dialog, and the page behind stays\n // usable, so this scroll container lets presses beside the dialog through.\n <div\n className={cn('pointer-events-none fixed inset-0 z-50', scroller)}\n data-slot=\"dialog-scroller\"\n >\n {scrollingPanel}\n </div>\n )\n ) : (\n <>\n <DialogOverlay style={overlayStyle} />\n {panel}\n </>\n )}\n </ShadeScope>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title',\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;;AAaA,IAAM,UAAU,UAA6D;CAC3E,MAAM,CAAC,WAAW,eAAe,aAAa,KAAK;CACnD,OAAO,YAAY,oBAAC,gBAAgB,MAAjB,EAAsB,GAAI,UAAY,CAAA,CAAC;AAC5D;AAEA,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,4JACA,YAAY,QAAQ,GACpB,SACF;CACA,aAAU;CACV,GAAI;AACL,CAAA,CACF;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,uBAAuB,GAC3B,wFACA,kBACF;AAGA,IAAM,4BAA4B,GAChC,yBACA,kOACF;AAEA,IAAM,2BAA2B;AAIjC,IAAM,yBACJ;AACF,IAAM,iCACJ;AACF,IAAM,gCACJ;AAGF,IAAM,uBACJ;AAcF,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,UAAU,SAAS,SAAS,GAAG,SAAS,QAAQ;CAC9D,MAAM,EACJ,WACA,OACA,OACA,cACA,KAAK,YACL,SACE,eAAe,UAAU,GAAG;CAGhC,MAAM,QAAQ,KACZ,oBAAC,gBAAgB,SAAjB;EACE,KAAK;EACL,WAAW,GACT,sBACA,WAAW,YAAY,2BAA2B,sBAClD,UAAU,WAAW,YAAY,gCAAgC,4BACjE,SACF;EACA,GAAI;EAEH;CACsB,CAAA,CAC3B;CAKA,MAAM,iBACJ,oBAAC,OAAD;EACE,WAAW,GACT,8DACA,SAAS,8BACX;YAEC;CACE,CAAA;CAEP,MAAM,WAAW,GAAG,mBAAmB,SAAS,sBAAsB;CAEtE,OACE,oBAAC,cAAD;EA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ope.js";
|
|
3
|
+
import { safeAreaCollision } from "../../lib/safe-area.js";
|
|
4
|
+
import { usePortalContainer } from "../../lib/app-overlay.js";
|
|
3
5
|
import { consumeOverlayEscape } from "../../lib/overlay-escape.js";
|
|
4
6
|
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
5
7
|
import * as React$1 from "react";
|
|
@@ -9,7 +11,10 @@ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
|
9
11
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
10
12
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
11
13
|
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
12
|
-
var DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
14
|
+
var DropdownMenuPortal = (props) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
15
|
+
container: usePortalContainer(),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
13
18
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
14
19
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
15
20
|
var DropdownMenuSubTrigger = React$1.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
@@ -19,20 +24,25 @@ var DropdownMenuSubTrigger = React$1.forwardRef(({ className, inset, children, .
|
|
|
19
24
|
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
|
|
20
25
|
}));
|
|
21
26
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
22
|
-
var DropdownMenuSubContent = React$1.forwardRef(({ className, onEscapeKeyDown, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
27
|
+
var DropdownMenuSubContent = React$1.forwardRef(({ className, onEscapeKeyDown, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
23
28
|
ref,
|
|
24
|
-
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 dark:border-border/30", className),
|
|
29
|
+
className: cn("data-[safe-area]:max-h-(--radix-dropdown-menu-content-available-height) data-[safe-area]:max-w-(--radix-dropdown-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 dark:border-border/30", className),
|
|
30
|
+
...safeAreaCollision(collisionBoundary, usePortalContainer()),
|
|
25
31
|
onEscapeKeyDown: (event) => consumeOverlayEscape(event, onEscapeKeyDown),
|
|
26
32
|
...props
|
|
27
33
|
}) }));
|
|
28
34
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
29
|
-
var DropdownMenuContent = React$1.forwardRef(({ className, onEscapeKeyDown, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
var DropdownMenuContent = React$1.forwardRef(({ className, onEscapeKeyDown, sideOffset = 4, collisionBoundary, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, {
|
|
36
|
+
container: usePortalContainer(),
|
|
37
|
+
children: /* @__PURE__ */ jsx(ShadeScope, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
38
|
+
ref,
|
|
39
|
+
className: cn("data-[safe-area]:max-h-(--radix-dropdown-menu-content-available-height) data-[safe-area]:max-w-(--radix-dropdown-menu-content-available-width) data-[safe-area]:overflow-y-auto", "z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-md dark:border-border/30", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className),
|
|
40
|
+
...safeAreaCollision(collisionBoundary, usePortalContainer()),
|
|
41
|
+
sideOffset,
|
|
42
|
+
onEscapeKeyDown: (event) => consumeOverlayEscape(event, onEscapeKeyDown),
|
|
43
|
+
...props
|
|
44
|
+
}) })
|
|
45
|
+
}));
|
|
36
46
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
37
47
|
var DropdownMenuItem = React$1.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
38
48
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","names":[],"sources":["../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { consumeOverlayEscape } from '@/lib/overlay-escape';\nimport { ShadeScope } from '@/shade-scope';\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-control outline-hidden select-none hover:bg-interactive-hover focus:bg-interactive-hover data-[state=open]:bg-interactive-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, onEscapeKeyDown, ...props }, ref) => (\n <ShadeScope>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 dark:border-border/30',\n className,\n )}\n onEscapeKeyDown={(event) => consumeOverlayEscape(event, onEscapeKeyDown)}\n {...props}\n />\n </ShadeScope>\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, onEscapeKeyDown, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <ShadeScope>\n <DropdownMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-md dark:border-border/30',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n sideOffset={sideOffset}\n onEscapeKeyDown={(event) => consumeOverlayEscape(event, onEscapeKeyDown)}\n {...props}\n />\n </ShadeScope>\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-control font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n"],"mappings":";;;;;;;;AAOA,IAAM,eAAe,sBAAsB;AAE3C,IAAM,sBAAsB,sBAAsB;AAElD,IAAM,oBAAoB,sBAAsB;AAEhD,IAAM,qBAAqB,sBAAsB;AAEjD,IAAM,kBAAkB,sBAAsB;AAE9C,IAAM,yBAAyB,sBAAsB;AAErD,IAAM,yBAAyB,QAAM,YAKlC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,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,CAAA,EACQ,CAAA;CACjC,CAAA,GACL,QACiC;EACrC;AACD,yBAAyB,cAAc,sBAAsB,aAAa;AAE1E,IAAM,wBAAwB,QAAM,YAGjC,EAAE,WAAW,UAAU,GAAG,SAAS,QACpC,qBAAC,sBAAsB,WAAvB;CACO;CACL,WAAW,GACT,iQACA,SACF;CACA,GAAI;WANN,CAQE,oBAAC,QAAD;EAAM,WAAU;YACd,oBAAC,sBAAsB,eAAvB,EAAA,UACE,oBAAC,QAAD,EAAQ,WAAU,sBAAuB,CAAA,EACN,CAAA;CACjC,CAAA,GACL,QAC8B;EAClC;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,oBAAoB,QAAM,YAK7B,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC,oBAAC,sBAAsB,OAAvB;CACO;CACL,WAAW,GAAG,0CAA0C,SAAS,QAAQ,SAAS;CAClF,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,sBAAsB,MAAM;AAE5D,IAAM,wBAAwB,QAAM,YAGjC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB,WAAvB;CACO;CACL,WAAW,GAAG,4BAA4B,SAAS;CACnD,GAAI;AACL,CAAA,CACF;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,wBAAwB,EAAE,WAAW,GAAG,YAAmD;CAC/F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,qBAAqB,cAAc"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":[],"sources":["../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { usePortalContainer } from '@/lib/app-overlay';\nimport { cn } from '@/lib/utils';\nimport { consumeOverlayEscape } from '@/lib/overlay-escape';\nimport { ShadeScope } from '@/shade-scope';\nimport { safeAreaCollision } from '@/lib/safe-area';\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = (props: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) => (\n <DropdownMenuPrimitive.Portal container={usePortalContainer()} {...props} />\n);\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-control outline-hidden select-none hover:bg-interactive-hover focus:bg-interactive-hover data-[state=open]:bg-interactive-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, onEscapeKeyDown, collisionBoundary, ...props }, ref) => (\n <ShadeScope>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-dropdown-menu-content-available-height) data-[safe-area]:max-w-(--radix-dropdown-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 dark:border-border/30',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n onEscapeKeyDown={(event) => consumeOverlayEscape(event, onEscapeKeyDown)}\n {...props}\n />\n </ShadeScope>\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, onEscapeKeyDown, sideOffset = 4, collisionBoundary, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal container={usePortalContainer()}>\n <ShadeScope>\n <DropdownMenuPrimitive.Content\n ref={ref}\n className={cn(\n 'data-[safe-area]:max-h-(--radix-dropdown-menu-content-available-height) data-[safe-area]:max-w-(--radix-dropdown-menu-content-available-width) data-[safe-area]:overflow-y-auto',\n 'z-50 min-w-[8rem] overflow-hidden rounded-menu border border-border/60 bg-surface-elevated-2 p-1 text-popover-foreground shadow-md dark:border-border/30',\n 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',\n className,\n )}\n {...safeAreaCollision(collisionBoundary, usePortalContainer())}\n sideOffset={sideOffset}\n onEscapeKeyDown={(event) => consumeOverlayEscape(event, onEscapeKeyDown)}\n {...props}\n />\n </ShadeScope>\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-control outline-hidden transition-colors select-none focus:bg-interactive-hover focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-control font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return <span className={cn('ml-auto text-xs tracking-wider opacity-60', className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n"],"mappings":";;;;;;;;;;AASA,IAAM,eAAe,sBAAsB;AAE3C,IAAM,sBAAsB,sBAAsB;AAElD,IAAM,oBAAoB,sBAAsB;AAEhD,IAAM,sBAAsB,UAC1B,oBAAC,sBAAsB,QAAvB;CAA8B,WAAW,mBAAmB;CAAG,GAAI;AAAQ,CAAA;AAG7E,IAAM,kBAAkB,sBAAsB;AAE9C,IAAM,yBAAyB,sBAAsB;AAErD,IAAM,yBAAyB,QAAM,YAKlC,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,QAC3C,qBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,yQACA,SAAS,QACT,SACF;CACA,GAAI;WAPN,CASG,UACD,oBAAC,cAAD,EAAc,WAAU,UAAW,CAAA,CACH;EACnC;AACD,uBAAuB,cAAc,sBAAsB,WAAW;AAEtE,IAAM,yBAAyB,QAAM,YAGlC,EAAE,WAAW,iBAAiB,mBAAmB,GAAG,SAAS,QAC9D,oBAAC,YAAD,EAAA,UACE,oBAAC,sBAAsB,YAAvB;CACO;CACL,WAAW,GACT,mLACA,6eACA,SACF;CACA,GAAI,kBAAkB,mBAAmB,mBAAmB,CAAC;CAC7D,kBAAkB,UAAU,qBAAqB,OAAO,eAAe;CACvE,GAAI;AACL,CAAA,EACS,CAAA,CACb;AACD,uBAAuB,cAAc,sBAAsB,WAAW;AAEtE,IAAM,sBAAsB,QAAM,YAG/B,EAAE,WAAW,iBAAiB,aAAa,GAAG,mBAAmB,GAAG,SAAS,QAC9E,oBAAC,sBAAsB,QAAvB;CAA8B,WAAW,mBAAmB;WAC1D,oBAAC,YAAD,EAAA,UACE,oBAAC,sBAAsB,SAAvB;EACO;EACL,WAAW,GACT,mLACA,4JACA,oVACA,SACF;EACA,GAAI,kBAAkB,mBA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AwB,QAAM,YAGjC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,sBAAsB,WAAvB;CACO;CACL,WAAW,GAAG,4BAA4B,SAAS;CACnD,GAAI;AACL,CAAA,CACF;AACD,sBAAsB,cAAc,sBAAsB,UAAU;AAEpE,IAAM,wBAAwB,EAAE,WAAW,GAAG,YAAmD;CAC/F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,6CAA6C,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;AACA,qBAAqB,cAAc"}
|
|
@@ -48,8 +48,13 @@ var GLASS = "border border-border-glass bg-surface-glass backdrop-blur-md backdr
|
|
|
48
48
|
var SHADOW_FLOAT = "var(--shadow-glass-floating)";
|
|
49
49
|
/** Pinned: only a 1px outline; the other layers fade out so the panel reads as anchored. */
|
|
50
50
|
var SHADOW_PINNED = "var(--shadow-glass-docked)";
|
|
51
|
+
var FRAME_GUARD_ATTRIBUTE = "data-floating-sidebar-frame-guard";
|
|
51
52
|
var POPUP_TRIGGER_SELECTOR = "[aria-haspopup][aria-expanded=true]";
|
|
52
53
|
var OVERLAY_SELECTOR = "[role=dialog], [role=alertdialog], [role=menu], [role=listbox], [data-radix-popper-content-wrapper]";
|
|
54
|
+
function hasFrameBeside(outer) {
|
|
55
|
+
for (let sibling = outer?.nextElementSibling; sibling; sibling = sibling.nextElementSibling) if (sibling.querySelector("iframe")) return true;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
53
58
|
/**
|
|
54
59
|
* Whether a point is in the hot zone: the strip beneath the closed circle, as
|
|
55
60
|
* wide as its footprint, from the screen's left edge down to the bottom. With
|
|
@@ -169,10 +174,14 @@ var FloatingSidebar = React$1.forwardRef(({ pinned, onPinnedChange, pinLocked =
|
|
|
169
174
|
const [waitsForRest] = React$1.useState(armHoverOnRest);
|
|
170
175
|
const waitingForRest = React$1.useRef(waitsForRest);
|
|
171
176
|
const restTimer = React$1.useRef(void 0);
|
|
177
|
+
const setFrameGuard = React$1.useCallback((on) => {
|
|
178
|
+
wrapperRef.current?.parentElement?.toggleAttribute(FRAME_GUARD_ATTRIBUTE, on);
|
|
179
|
+
}, []);
|
|
172
180
|
const updateHover = React$1.useCallback((parts) => {
|
|
173
181
|
const state = hover.current;
|
|
174
182
|
Object.assign(state, parts);
|
|
175
183
|
const any = state.capsule || state.zone;
|
|
184
|
+
setFrameGuard(any);
|
|
176
185
|
if (waitingForRest.current) return;
|
|
177
186
|
if (!hoverArmed.current) {
|
|
178
187
|
hoverArmed.current = !any;
|
|
@@ -182,18 +191,23 @@ var FloatingSidebar = React$1.forwardRef(({ pinned, onPinnedChange, pinLocked =
|
|
|
182
191
|
state.any = any;
|
|
183
192
|
if (any) show();
|
|
184
193
|
else scheduleClose();
|
|
185
|
-
}, [
|
|
194
|
+
}, [
|
|
195
|
+
scheduleClose,
|
|
196
|
+
setFrameGuard,
|
|
197
|
+
show
|
|
198
|
+
]);
|
|
186
199
|
React$1.useEffect(() => {
|
|
187
200
|
if (disabled) return;
|
|
188
201
|
const onPointerMove = (event) => {
|
|
189
202
|
if (event.pointerType === "touch") return;
|
|
203
|
+
if (event.type === "pointerover" && (event.relatedTarget === null || event.relatedTarget instanceof HTMLIFrameElement) && hasFrameBeside(wrapperRef.current?.parentElement)) hoverArmed.current = true;
|
|
190
204
|
const target = event.target instanceof Element ? event.target : null;
|
|
191
205
|
const overOverlay = Boolean(target?.closest(OVERLAY_SELECTOR));
|
|
192
206
|
const parts = {};
|
|
193
207
|
if (!overOverlay && target) parts.capsule = Boolean(wrapperRef.current?.contains(target));
|
|
194
208
|
if (hotZone) parts.zone = !overOverlay && inHotZone(wrapperRef.current, event.clientX, event.clientY);
|
|
195
209
|
updateHover(parts);
|
|
196
|
-
if (waitingForRest.current) {
|
|
210
|
+
if (waitingForRest.current && event.type === "pointermove") {
|
|
197
211
|
window.clearTimeout(restTimer.current);
|
|
198
212
|
restTimer.current = window.setTimeout(() => {
|
|
199
213
|
waitingForRest.current = false;
|
|
@@ -209,16 +223,20 @@ var FloatingSidebar = React$1.forwardRef(({ pinned, onPinnedChange, pinLocked =
|
|
|
209
223
|
zone: false
|
|
210
224
|
});
|
|
211
225
|
document.addEventListener("pointermove", onPointerMove);
|
|
226
|
+
document.addEventListener("pointerover", onPointerMove);
|
|
212
227
|
document.documentElement.addEventListener("pointerleave", onPointerLeave);
|
|
213
228
|
return () => {
|
|
214
229
|
document.removeEventListener("pointermove", onPointerMove);
|
|
230
|
+
document.removeEventListener("pointerover", onPointerMove);
|
|
215
231
|
document.documentElement.removeEventListener("pointerleave", onPointerLeave);
|
|
216
232
|
window.clearTimeout(restTimer.current);
|
|
217
233
|
hover.current.zone = false;
|
|
234
|
+
setFrameGuard(false);
|
|
218
235
|
};
|
|
219
236
|
}, [
|
|
220
237
|
disabled,
|
|
221
238
|
hotZone,
|
|
239
|
+
setFrameGuard,
|
|
222
240
|
show,
|
|
223
241
|
updateHover
|
|
224
242
|
]);
|