Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: stop requiring dialog title and description (#4603)

Bogdan Chadkin7e414f9c6431
diff --git a/packages/sdk-components-react-radix/src/dialog.ws.ts b/packages/sdk-components-react-radix/src/dialog.ws.ts
index fdc2faede5..4e9cf7935d 100644
--- a/packages/sdk-components-react-radix/src/dialog.ws.ts
+++ b/packages/sdk-components-react-radix/src/dialog.ws.ts
@@ -78,6 +78,9 @@ export const metaDialogContent: WsComponentMeta = {
relation: "ancestor",
component: { $eq: "DialogOverlay" },
},
+ // often deleted by users
+ // though radix starts throwing warnings in console
+ /*
{
relation: "descendant",
component: { $eq: "DialogTitle" },
@@ -86,6 +89,7 @@ export const metaDialogContent: WsComponentMeta = {
relation: "descendant",
component: { $eq: "DialogDescription" },
},
+ */
{
relation: "descendant",
component: { $eq: "DialogClose" },
diff --git a/packages/sdk-components-react-radix/src/hooks.ts b/packages/sdk-components-react-radix/src/hooks.ts
index 136c0f5a03..a62294234c 100644
--- a/packages/sdk-components-react-radix/src/hooks.ts
+++ b/packages/sdk-components-react-radix/src/hooks.ts
@@ -3,7 +3,6 @@ import { hooksCollapsible } from "./collapsible";
import { hooksTabs } from "./tabs";
import { hooksDialog } from "./dialog";
import { hooksPopover } from "./popover";
-import { hooksSheet } from "./sheet";
import { hooksTooltip } from "./tooltip";
import { hooksAccordion } from "./accordion";
import { hooksNavigationMenu } from "./navigation-menu";
@@ -14,7 +13,6 @@ export const hooks: Hook[] = [
hooksTabs,
hooksDialog,
hooksPopover,
- hooksSheet,
hooksTooltip,
hooksAccordion,
hooksNavigationMenu,
diff --git a/packages/sdk-components-react-radix/src/sheet.tsx b/packages/sdk-components-react-radix/src/sheet.tsx
deleted file mode 100644
index dbc13b53ce..0000000000
--- a/packages/sdk-components-react-radix/src/sheet.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-import {
- forwardRef,
- type ElementRef,
- type ComponentPropsWithoutRef,
-} from "react";
-import { getClosestInstance, type Hook } from "@webstudio-is/react-sdk/runtime";
-import * as Dialog from "./dialog";
-
-export const Sheet = Dialog.Dialog;
-export const SheetTrigger = Dialog.DialogTrigger;
-export const SheetOverlay = Dialog.DialogOverlay;
-export const SheetClose = Dialog.DialogClose;
-export const SheetTitle = Dialog.DialogTitle;
-export const SheetDescription = Dialog.DialogDescription;
-
-export const SheetContent = forwardRef<
- ElementRef<"div">,
- ComponentPropsWithoutRef<typeof Dialog.DialogContent> & {
- tag?: "div" | "nav";
- side?: "top" | "right" | "bottom" | "left";
- }
->(
- (
- { tag = "nav", side = "left", role = "navigation", children, ...props },
- ref
- ) => {
- // Do not do this at args like { tag: Tag = "nav" }, generate-arg-types will not find defaultValue in that case
- const Tag = tag;
- return (
- <Dialog.DialogContent
- asChild={true}
- data-side={side}
- role={role}
- {...props}
- >
- <Tag ref={ref}>{children}</Tag>
- </Dialog.DialogContent>
- );
- }
-);
-
-/* BUILDER HOOKS */
-
-const namespace = "@webstudio-is/sdk-components-react-radix";
-
-// For each SheetOverlay component within the selection,
-// we identify its closest parent Sheet component
-// and update its open prop bound to variable.
-export const hooksSheet: Hook = {
- onNavigatorUnselect: (context, event) => {
- for (const instance of event.instancePath) {
- if (instance.component === `${namespace}:SheetOverlay`) {
- const sheet = getClosestInstance(
- event.instancePath,
- instance,
- `${namespace}:Sheet`
- );
-
- if (sheet) {
- context.setMemoryProp(sheet, "open", undefined);
- }
- }
- }
- },
- onNavigatorSelect: (context, event) => {
- for (const instance of event.instancePath) {
- if (instance.component === `${namespace}:SheetOverlay`) {
- const sheet = getClosestInstance(
- event.instancePath,
- instance,
- `${namespace}:Sheet`
- );
- if (sheet) {
- context.setMemoryProp(sheet, "open", true);
- }
- }
- }
- },
-};