Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
// @vitest-environment jsdom
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { render } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ContextMenu } from ".";
|
||||
|
||||
describe("ContextMenu motion", () => {
|
||||
it("applies the global open and close animation contract", () => {
|
||||
const { container } = render(<ContextMenu>Menu content</ContextMenu>);
|
||||
const menu = container.firstElementChild;
|
||||
|
||||
expect(menu).toHaveClass(
|
||||
"data-[state=open]:animate-in",
|
||||
"data-[state=closed]:animate-out",
|
||||
"data-[state=open]:zoom-in-[0.96]",
|
||||
"data-[state=closed]:zoom-out-[0.98]",
|
||||
"data-[state=open]:duration-200",
|
||||
"motion-reduce:animate-none",
|
||||
);
|
||||
});
|
||||
});
|
||||
+5
-1
@@ -99,7 +99,11 @@ const ContextMenuRoot = React.forwardRef<HTMLDivElement, ContextMenuRootProps>(
|
||||
return children ? (
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
|
||||
// Local adjustment: `relative z-50`, same as DropdownMenu. The panel
|
||||
// opens in a portal whose wrapper has no z-index, so any positioned
|
||||
// `z-10` in the page (e.g. the ProjectCard price row) paints over the
|
||||
// open menu.
|
||||
"relative z-50 flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
|
||||
+15
-1
@@ -1,5 +1,9 @@
|
||||
// @subframe/sync-disable
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { ContextMenu as ContextMenuComponent } from "./ContextMenu";
|
||||
import { CONTEXT_MENU_MOTION_CLASS } from "../../floating-motion";
|
||||
import * as SubframeUtils from "../../utils";
|
||||
|
||||
/**
|
||||
* Add wrapper components and business logic here.
|
||||
@@ -7,4 +11,14 @@ import { ContextMenu as ContextMenuComponent } from "./ContextMenu";
|
||||
* Learn more: https://docs.subframe.com/concepts/syncing-components#wrapping-components
|
||||
*/
|
||||
|
||||
export const ContextMenu = ContextMenuComponent;
|
||||
const ContextMenuRoot = React.forwardRef<
|
||||
React.ElementRef<typeof ContextMenuComponent>,
|
||||
React.ComponentProps<typeof ContextMenuComponent>
|
||||
>(function ContextMenuRoot({ className, ...otherProps }, ref) {
|
||||
return <ContextMenuComponent className={SubframeUtils.twClassNames(CONTEXT_MENU_MOTION_CLASS, className)} ref={ref} {...otherProps} />;
|
||||
});
|
||||
|
||||
export const ContextMenu = Object.assign(ContextMenuRoot, {
|
||||
ContextDivider: ContextMenuComponent.ContextDivider,
|
||||
ContextItem: ContextMenuComponent.ContextItem,
|
||||
});
|
||||
Reference in new issue
Block a user