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.

Link block sdk component (#1174)

Oleg Isonen3d18d71bb3d1
diff --git a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
index d259dde614..4242ac6536 100644
--- a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
+++ b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
@@ -113,10 +113,7 @@ export const WebstudioComponentDev = ({
[componentAttribute]: instance.component,
[idAttribute]: instance.id,
onClick: (event: MouseEvent) => {
- if (
- instance.component === "Link" ||
- instance.component === "RichTextLink"
- ) {
+ if ((event.target as HTMLElement).closest("a")) {
event.preventDefault();
}
},
diff --git a/packages/icons/icons/box-link.svg b/packages/icons/icons/box-link.svg
new file mode 100644
index 0000000000..991e12a873
--- /dev/null
+++ b/packages/icons/icons/box-link.svg
@@ -0,0 +1,5 @@
+<svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.8815 2H7.11797C6.37488 1.99999 5.77172 1.99999 5.28249 2.03996C4.77754 2.08121 4.32827 2.16876 3.91079 2.38148C3.25222 2.71703 2.71679 3.25247 2.38123 3.91103C2.16852 4.32851 2.08097 4.77778 2.03971 5.28273C1.99974 5.77196 1.99975 6.37511 1.99976 7.11819V14.8818C1.99975 15.6249 1.99974 16.228 2.03971 16.7173C2.08097 17.2222 2.16852 17.6715 2.38123 18.089C2.71679 18.7475 3.25222 19.283 3.91079 19.6185C4.32827 19.8312 4.77754 19.9188 5.28249 19.96C5.77172 20 6.37487 20 7.11795 20H14.8816C15.6246 20 16.2278 20 16.717 19.96C17.222 19.9188 17.6712 19.8312 18.0887 19.6185C18.7473 19.283 19.2827 18.7475 19.6183 18.089C19.831 17.6715 19.9185 17.2222 19.9598 16.7173C19.9998 16.228 19.9998 15.6249 19.9998 14.8818V7.11821C19.9998 6.37512 19.9998 5.77197 19.9598 5.28273C19.9185 4.77778 19.831 4.32851 19.6183 3.91103C19.2827 3.25247 18.7473 2.71703 18.0887 2.38148C17.6712 2.16876 17.222 2.08121 16.717 2.03996C16.2278 1.99999 15.6246 1.99999 14.8815 2ZM16.5949 3.53498C17.0071 3.56865 17.237 3.63097 17.4077 3.71799C17.7841 3.90973 18.09 4.2157 18.2818 4.59202C18.3688 4.7628 18.4311 4.99269 18.4648 5.40488C18.4992 5.82582 18.4998 6.36755 18.4998 7.15V14.85C18.4998 15.6324 18.4992 16.1742 18.4648 16.5951C18.4311 17.0073 18.3688 17.2372 18.2818 17.408C18.09 17.7843 17.7841 18.0903 17.4077 18.282C17.237 18.369 17.0071 18.4313 16.5949 18.465C16.1739 18.4994 15.6322 18.5 14.8498 18.5H7.14976C6.36731 18.5 5.82558 18.4994 5.40463 18.465C4.99245 18.4313 4.76255 18.369 4.59177 18.282C4.21545 18.0903 3.90949 17.7843 3.71774 17.408C3.63073 17.2372 3.56841 17.0073 3.53473 16.5951C3.50034 16.1742 3.49976 15.6324 3.49976 14.85V7.15C3.49976 6.36755 3.50034 5.82582 3.53473 5.40488C3.56841 4.99269 3.63073 4.7628 3.71774 4.59202C3.90949 4.2157 4.21545 3.90973 4.59178 3.71799C4.76255 3.63097 4.99245 3.56865 5.40463 3.53498C5.82558 3.50058 6.36731 3.5 7.14976 3.5H14.8498C15.6322 3.5 16.1739 3.50058 16.5949 3.53498Z"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.4663 7.53872C13.8957 6.96818 12.7604 6.94244 11.9203 7.78258L11.1874 8.51539C10.8946 8.80828 10.4197 8.80828 10.1268 8.51539C9.83389 8.22249 9.83389 7.74762 10.1268 7.45473L10.8596 6.72192C12.146 5.43547 14.2402 5.19137 15.5269 6.47806C16.8136 7.76475 16.5695 9.85894 15.2831 11.1454L14.5503 11.8782C14.2574 12.1711 13.7825 12.1711 13.4896 11.8782C13.1967 11.5853 13.1967 11.1104 13.4896 10.8175L14.2224 10.0847C15.0625 9.24459 15.0368 8.10926 14.4663 7.53872ZM12.8592 9.14596C13.1521 9.43885 13.1521 9.91372 12.8592 10.2066L10.2065 12.8593C9.91359 13.1522 9.43871 13.1522 9.14582 12.8593C8.85293 12.5664 8.85293 12.0915 9.14582 11.7987L11.7985 9.14596C12.0914 8.85306 12.5663 8.85306 12.8592 9.14596ZM8.51538 10.1271C8.80827 10.42 8.80827 10.8949 8.51538 11.1878L7.78257 11.9206C6.94243 12.7607 6.96817 13.896 7.53871 14.4666C8.10924 15.0371 9.24457 15.0628 10.0847 14.2227L10.8175 13.4899C11.1104 13.197 11.5853 13.197 11.8782 13.4899C12.1711 13.7828 12.1711 14.2577 11.8782 14.5506L11.1454 15.2834C9.85893 16.5698 7.76473 16.8139 6.47805 15.5272C5.19136 14.2405 5.43546 12.1464 6.72191 10.8599L7.45472 10.1271C7.74761 9.83421 8.22248 9.83421 8.51538 10.1271Z" />
+</svg>
+
\ No newline at end of file
diff --git a/packages/icons/icons/box.svg b/packages/icons/icons/box.svg
new file mode 100644
index 0000000000..b7b5ab6343
--- /dev/null
+++ b/packages/icons/icons/box.svg
@@ -0,0 +1,4 @@
+<svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.8818 2H7.11821C6.37512 1.99999 5.77197 1.99999 5.28273 2.03996C4.77778 2.08121 4.32851 2.16876 3.91103 2.38148C3.25246 2.71703 2.71703 3.25247 2.38148 3.91103C2.16876 4.32851 2.08121 4.77778 2.03996 5.28273C1.99998 5.77196 1.99999 6.37511 2 7.11819V14.8818C1.99999 15.6249 1.99998 16.228 2.03996 16.7173C2.08121 17.2222 2.16876 17.6715 2.38148 18.089C2.71703 18.7475 3.25246 19.283 3.91103 19.6185C4.32851 19.8312 4.77778 19.9188 5.28273 19.96C5.77196 20 6.37511 20 7.11819 20H14.8818C15.6249 20 16.228 20 16.7173 19.96C17.2222 19.9188 17.6715 19.8312 18.089 19.6185C18.7475 19.283 19.283 18.7475 19.6185 18.089C19.8312 17.6715 19.9188 17.2222 19.96 16.7173C20 16.228 20 15.6249 20 14.8818V7.11821C20 6.37512 20 5.77197 19.96 5.28273C19.9188 4.77778 19.8312 4.32851 19.6185 3.91103C19.283 3.25247 18.7475 2.71703 18.089 2.38148C17.6715 2.16876 17.2222 2.08121 16.7173 2.03996C16.228 1.99999 15.6249 1.99999 14.8818 2ZM16.5951 3.53498C17.0073 3.56865 17.2372 3.63097 17.408 3.71799C17.7843 3.90973 18.0903 4.2157 18.282 4.59202C18.369 4.7628 18.4313 4.99269 18.465 5.40488C18.4994 5.82582 18.5 6.36755 18.5 7.15V14.85C18.5 15.6324 18.4994 16.1742 18.465 16.5951C18.4313 17.0073 18.369 17.2372 18.282 17.408C18.0903 17.7843 17.7843 18.0903 17.408 18.282C17.2372 18.369 17.0073 18.4313 16.5951 18.465C16.1742 18.4994 15.6324 18.5 14.85 18.5H7.15C6.36755 18.5 5.82582 18.4994 5.40488 18.465C4.99269 18.4313 4.7628 18.369 4.59202 18.282C4.21569 18.0903 3.90973 17.7843 3.71799 17.408C3.63097 17.2372 3.56865 17.0073 3.53498 16.5951C3.50058 16.1742 3.5 15.6324 3.5 14.85V7.15C3.5 6.36755 3.50058 5.82582 3.53498 5.40488C3.56865 4.99269 3.63097 4.7628 3.71799 4.59202C3.90973 4.2157 4.2157 3.90973 4.59202 3.71799C4.7628 3.63097 4.99269 3.56865 5.40488 3.53498C5.82582 3.50058 6.36755 3.5 7.15 3.5H14.85C15.6324 3.5 16.1742 3.50058 16.5951 3.53498Z" />
+</svg>
+
\ No newline at end of file
diff --git a/packages/icons/src/__generated__/box-link.tsx b/packages/icons/src/__generated__/box-link.tsx
new file mode 100644
index 0000000000..c7b35d6b3d
--- /dev/null
+++ b/packages/icons/src/__generated__/box-link.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/box-link.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const BoxLinkIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M14.882 2H7.118c-.743 0-1.346 0-1.836.04-.504.041-.954.129-1.371.341a3.5 3.5 0 0 0-1.53 1.53c-.212.418-.3.867-.341 1.372C2 5.772 2 6.375 2 7.118v7.764c0 .743 0 1.346.04 1.835.041.505.129.955.341 1.372a3.5 3.5 0 0 0 1.53 1.53c.417.212.867.3 1.371.341.49.04 1.093.04 1.836.04h7.764c.743 0 1.346 0 1.835-.04.505-.041.954-.129 1.372-.341a3.5 3.5 0 0 0 1.53-1.53c.212-.417.3-.867.34-1.372.04-.489.04-1.092.04-1.835V7.118c0-.743 0-1.346-.04-1.835-.04-.505-.128-.954-.34-1.372a3.5 3.5 0 0 0-1.53-1.53c-.418-.212-.867-.3-1.372-.341C16.227 2 15.625 2 14.882 2Zm1.713 1.535c.412.034.642.096.813.183a2 2 0 0 1 .874.874c.087.17.15.4.183.813.034.42.035.963.035 1.745v7.7c0 .782 0 1.324-.035 1.745-.034.412-.096.642-.183.813a2 2 0 0 1-.874.874c-.171.087-.4.15-.813.183-.421.034-.963.035-1.745.035h-7.7c-.783 0-1.324 0-1.745-.035-.413-.034-.642-.096-.813-.183a2 2 0 0 1-.874-.874c-.087-.17-.15-.4-.183-.813-.035-.42-.035-.963-.035-1.745v-7.7c0-.782 0-1.324.035-1.745.033-.412.096-.642.183-.813a2 2 0 0 1 .874-.874c.17-.087.4-.15.813-.183.42-.034.962-.035 1.745-.035h7.7c.782 0 1.324 0 1.745.035Z" clipRule="evenodd" /><path fillRule="evenodd" d="M14.466 7.539c-.57-.57-1.706-.597-2.546.244l-.733.732a.75.75 0 1 1-1.06-1.06l.733-.733c1.286-1.287 3.38-1.53 4.667-.244 1.287 1.287 1.043 3.38-.244 4.667l-.733.733a.75.75 0 0 1-1.06-1.06l.732-.733c.84-.84.815-1.976.244-2.546ZM12.86 9.146a.75.75 0 0 1 0 1.06l-2.652 2.653a.75.75 0 0 1-1.061-1.06l2.652-2.653a.75.75 0 0 1 1.061 0Zm-4.344.981a.75.75 0 0 1 0 1.06l-.732.734c-.84.84-.815 1.975-.244 2.546.57.57 1.706.596 2.546-.244l.732-.733a.75.75 0 0 1 1.061 1.06l-.733.733c-1.286 1.287-3.38 1.53-4.667.244s-1.043-3.38.244-4.667l.733-.733a.75.75 0 0 1 1.06 0Z" clipRule="evenodd" /></svg>
+ );
+ }
+);
+
+BoxLinkIcon.displayName = "BoxLinkIcon";
diff --git a/packages/icons/src/__generated__/box.tsx b/packages/icons/src/__generated__/box.tsx
new file mode 100644
index 0000000000..4439837bd5
--- /dev/null
+++ b/packages/icons/src/__generated__/box.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/box.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const BoxIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fillRule="evenodd" d="M14.882 2H7.118c-.743 0-1.346 0-1.835.04-.505.041-.954.129-1.372.341a3.5 3.5 0 0 0-1.53 1.53c-.212.418-.3.867-.341 1.372C2 5.772 2 6.375 2 7.118v7.764c0 .743 0 1.346.04 1.835.041.505.129.955.341 1.372a3.5 3.5 0 0 0 1.53 1.53c.418.212.867.3 1.372.341.489.04 1.092.04 1.835.04h7.764c.743 0 1.346 0 1.835-.04.505-.041.955-.129 1.372-.341a3.5 3.5 0 0 0 1.53-1.53c.212-.417.3-.867.341-1.372.04-.489.04-1.092.04-1.835V7.118c0-.743 0-1.346-.04-1.835-.041-.505-.129-.954-.341-1.372a3.5 3.5 0 0 0-1.53-1.53c-.417-.212-.867-.3-1.372-.341C16.228 2 15.625 2 14.882 2Zm1.713 1.535c.412.034.642.096.813.183a2 2 0 0 1 .874.874c.087.17.15.4.183.813.034.42.035.963.035 1.745v7.7c0 .782 0 1.324-.035 1.745-.034.412-.096.642-.183.813a2 2 0 0 1-.874.874c-.17.087-.4.15-.813.183-.42.034-.963.035-1.745.035h-7.7c-.782 0-1.324 0-1.745-.035-.412-.034-.642-.096-.813-.183a2 2 0 0 1-.874-.874c-.087-.17-.15-.4-.183-.813-.034-.42-.035-.963-.035-1.745v-7.7c0-.782 0-1.324.035-1.745.034-.412.096-.642.183-.813a2 2 0 0 1 .874-.874c.17-.087.4-.15.813-.183.42-.034.963-.035 1.745-.035h7.7c.782 0 1.324 0 1.745.035Z" clipRule="evenodd" /></svg>
+ );
+ }
+);
+
+BoxIcon.displayName = "BoxIcon";
diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.ts
index 47b8ebd6e7..d6471b9920 100644
--- a/packages/icons/src/__generated__/index.ts
+++ b/packages/icons/src/__generated__/index.ts
@@ -1,5 +1,7 @@
export * from "./auto-scroll";
export * from "./blockquote";
+export * from "./box-link";
+export * from "./box";
export * from "./checkbox-checked-filled";
export * from "./checkbox-empty";
export * from "./checkbox-mixed-filled";
diff --git a/packages/icons/src/legacy.ts b/packages/icons/src/legacy.ts
index 4d26c5b201..a9ad529e2c 100644
--- a/packages/icons/src/legacy.ts
+++ b/packages/icons/src/legacy.ts
@@ -18,7 +18,6 @@ export {
ButtonIcon,
HeadingIcon,
TextIcon,
- SquareIcon,
CrossCircledIcon,
CheckCircledIcon,
} from "@radix-ui/react-icons";
diff --git a/packages/react-sdk/src/components/__generated__/link-block.props.ts b/packages/react-sdk/src/components/__generated__/link-block.props.ts
new file mode 100644
index 0000000000..62f777e08d
--- /dev/null
+++ b/packages/react-sdk/src/components/__generated__/link-block.props.ts
@@ -0,0 +1,473 @@
+import type { PropMeta } from "@webstudio-is/generate-arg-types";
+
+export const props: Record<string, PropMeta> = {
+ slot: { required: false, control: "text", type: "string" },
+ style: { required: false, control: "text", type: "string" },
+ title: { required: false, control: "text", type: "string" },
+ download: { required: false, control: "text", type: "string" },
+ href: { required: false, control: "text", type: "string" },
+ hrefLang: { required: false, control: "text", type: "string" },
+ media: { required: false, control: "text", type: "string" },
+ ping: { required: false, control: "text", type: "string" },
+ rel: { required: false, control: "text", type: "string" },
+ target: {
+ required: false,
+ control: "select",
+ type: "string",
+ options: ["self", "blank", "parent", "top"],
+ },
+ type: { required: false, control: "text", type: "string" },
+ referrerPolicy: {
+ required: false,
+ control: "select",
+ type: "string",
+ options: [
+ "",
+ "no-referrer",
+ "no-referrer-when-downgrade",
+ "origin",
+ "origin-when-cross-origin",
+ "same-origin",
+ "strict-origin",
+ "strict-origin-when-cross-origin",
+ "unsafe-url",
+ ],
+ },
+ defaultChecked: { required: false, control: "boolean", type: "boolean" },
+ defaultValue: { required: false, control: "text", type: "string" },
+ suppressContentEditableWarning: {
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ suppressHydrationWarning: {
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ accessKey: { required: false, control: "text", type: "string" },
+ className: { required: false, control: "text", type: "string" },
+ contentEditable: { required: false, control: "text", type: "string" },
+ contextMenu: { required: false, control: "text", type: "string" },
+ dir: { required: false, control: "text", type: "string" },
+ draggable: { required: false, control: "boolean", type: "boolean" },
+ hidden: { required: false, control: "boolean", type: "boolean" },
+ id: { required: false, control: "text", type: "string" },
+ lang: { required: false, control: "text", type: "string" },
+ placeholder: { required: false, control: "text", type: "string" },
+ spellCheck: { required: false, control: "boolean", type: "boolean" },
+ tabIndex: { required: false, control: "number", type: "number" },
+ translate: {
+ required: false,
+ control: "radio",
+ type: "string",
+ options: ["yes", "no"],
+ },
+ radioGroup: { required: false, control: "text", type: "string" },
+ role: { required: false, control: "text", type: "string" },
+ about: { required: false, control: "text", type: "string" },
+ datatype: { required: false, control: "text", type: "string" },
+ inlist: { required: false, control: "text", type: "string" },
+ prefix: { required: false, control: "text", type: "string" },
+ property: { required: false, control: "text", type: "string" },
+ resource: { required: false, control: "text", type: "string" },
+ typeof: { required: false, control: "text", type: "string" },
+ vocab: { required: false, control: "text", type: "string" },
+ autoCapitalize: { required: false, control: "text", type: "string" },
+ autoCorrect: { required: false, control: "text", type: "string" },
+ autoSave: { required: false, control: "text", type: "string" },
+ color: { required: false, control: "color", type: "string" },
+ itemProp: { required: false, control: "text", type: "string" },
+ itemScope: { required: false, control: "boolean", type: "boolean" },
+ itemType: { required: false, control: "text", type: "string" },
+ itemID: { required: false, control: "text", type: "string" },
+ itemRef: { required: false, control: "text", type: "string" },
+ results: { required: false, control: "number", type: "number" },
+ security: { required: false, control: "text", type: "string" },
+ unselectable: {
+ required: false,
+ control: "radio",
+ type: "string",
+ options: ["on", "off"],
+ },
+ inputMode: {
+ description:
+ "Hints at the type of data that might be entered by the user while editing the element or its contents\n@see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute",
+ required: false,
+ control: "select",
+ type: "string",
+ options: [
+ "text",
+ "none",
+ "search",
+ "tel",
+ "url",
+ "email",
+ "numeric",
+ "decimal",
+ ],
+ },
+ is: {
+ description:
+ "Specify that a standard HTML element should behave like a defined custom built-in element\n@see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-activedescendant": {
+ description:
+ "Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-atomic": {
+ description:
+ "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-autocomplete": {
+ description:
+ "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made.",
+ required: false,
+ control: "select",
+ type: "string",
+ options: ["list", "none", "inline", "both"],
+ },
+ "aria-busy": {
+ description:
+ "Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-checked": {
+ description:
+ 'Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.\n@see aria-pressed\n@see aria-selected.',
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-colcount": {
+ description:
+ "Defines the total number of columns in a table, grid, or treegrid.\n@see aria-colindex.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-colindex": {
+ description:
+ "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.\n@see aria-colcount\n@see aria-colspan.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-colspan": {
+ description:
+ "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.\n@see aria-colindex\n@see aria-rowspan.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-controls": {
+ description:
+ "Identifies the element (or elements) whose contents or presence are controlled by the current element.\n@see aria-owns.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-current": {
+ description:
+ "Indicates the element that represents the current item within a container or set of related elements.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-describedby": {
+ description:
+ "Identifies the element (or elements) that describes the object.\n@see aria-labelledby",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-details": {
+ description:
+ "Identifies the element that provides a detailed, extended description for the object.\n@see aria-describedby.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-disabled": {
+ description:
+ "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.\n@see aria-hidden\n@see aria-readonly.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-dropeffect": {
+ description:
+ "Indicates what functions can be performed when a dragged object is released on the drop target.\n@deprecated in ARIA 1.1",
+ required: false,
+ control: "select",
+ type: "string",
+ options: ["link", "none", "copy", "execute", "move", "popup"],
+ },
+ "aria-errormessage": {
+ description:
+ "Identifies the element that provides an error message for the object.\n@see aria-invalid\n@see aria-describedby.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-expanded": {
+ description:
+ "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-flowto": {
+ description:
+ "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,\nallows assistive technology to override the general default of reading in document source order.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-grabbed": {
+ description:
+ 'Indicates an element\'s "grabbed" state in a drag-and-drop operation.\n@deprecated in ARIA 1.1',
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-haspopup": {
+ description:
+ "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-hidden": {
+ description:
+ "Indicates whether the element is exposed to an accessibility API.\n@see aria-disabled.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-invalid": {
+ description:
+ "Indicates the entered value does not conform to the format expected by the application.\n@see aria-errormessage.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-keyshortcuts": {
+ description:
+ "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-label": {
+ description:
+ "Defines a string value that labels the current element.\n@see aria-labelledby.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-labelledby": {
+ description:
+ "Identifies the element (or elements) that labels the current element.\n@see aria-describedby.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-level": {
+ description:
+ "Defines the hierarchical level of an element within a structure.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-live": {
+ description:
+ "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.",
+ required: false,
+ control: "radio",
+ type: "string",
+ options: ["off", "assertive", "polite"],
+ },
+ "aria-modal": {
+ description: "Indicates whether an element is modal when displayed.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-multiline": {
+ description:
+ "Indicates whether a text box accepts multiple lines of input or only a single line.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-multiselectable": {
+ description:
+ "Indicates that the user may select more than one item from the current selectable descendants.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-orientation": {
+ description:
+ "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.",
+ required: false,
+ control: "radio",
+ type: "string",
+ options: ["horizontal", "vertical"],
+ },
+ "aria-owns": {
+ description:
+ "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship\nbetween DOM elements where the DOM hierarchy cannot be used to represent the relationship.\n@see aria-controls.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-placeholder": {
+ description:
+ "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.\nA hint could be a sample value or a brief description of the expected format.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-posinset": {
+ description:
+ "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.\n@see aria-setsize.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-pressed": {
+ description:
+ 'Indicates the current "pressed" state of toggle buttons.\n@see aria-checked\n@see aria-selected.',
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-readonly": {
+ description:
+ "Indicates that the element is not editable, but is otherwise operable.\n@see aria-disabled.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-relevant": {
+ description:
+ "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.\n@see aria-atomic.",
+ required: false,
+ control: "select",
+ type: "string",
+ options: [
+ "text",
+ "additions",
+ "additions removals",
+ "additions text",
+ "all",
+ "removals",
+ "removals additions",
+ "removals text",
+ "text additions",
+ "text removals",
+ ],
+ },
+ "aria-required": {
+ description:
+ "Indicates that user input is required on the element before a form may be submitted.",
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-roledescription": {
+ description:
+ "Defines a human-readable, author-localized description for the role of an element.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ "aria-rowcount": {
+ description:
+ "Defines the total number of rows in a table, grid, or treegrid.\n@see aria-rowindex.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-rowindex": {
+ description:
+ "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.\n@see aria-rowcount\n@see aria-rowspan.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-rowspan": {
+ description:
+ "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.\n@see aria-rowindex\n@see aria-colspan.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-selected": {
+ description:
+ 'Indicates the current "selected" state of various widgets.\n@see aria-checked\n@see aria-pressed.',
+ required: false,
+ control: "boolean",
+ type: "boolean",
+ },
+ "aria-setsize": {
+ description:
+ "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.\n@see aria-posinset.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-sort": {
+ description:
+ "Indicates if items in a table or grid are sorted in ascending or descending order.",
+ required: false,
+ control: "select",
+ type: "string",
+ options: ["none", "ascending", "descending", "other"],
+ },
+ "aria-valuemax": {
+ description: "Defines the maximum allowed value for a range widget.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-valuemin": {
+ description: "Defines the minimum allowed value for a range widget.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-valuenow": {
+ description:
+ "Defines the current value for a range widget.\n@see aria-valuetext.",
+ required: false,
+ control: "number",
+ type: "number",
+ },
+ "aria-valuetext": {
+ description:
+ "Defines the human readable text alternative of aria-valuenow for a range widget.",
+ required: false,
+ control: "text",
+ type: "string",
+ },
+ prefetch: {
+ required: false,
+ control: "radio",
+ type: "string",
+ options: ["none", "intent", "render"],
+ },
+};
diff --git a/packages/react-sdk/src/components/box.ws.ts b/packages/react-sdk/src/components/box.ws.ts
index efd62db360..2be1ae39d8 100644
--- a/packages/react-sdk/src/components/box.ws.ts
+++ b/packages/react-sdk/src/components/box.ws.ts
@@ -1,4 +1,4 @@
-import { SquareIcon } from "@webstudio-is/icons";
+import { BoxIcon } from "@webstudio-is/icons";
import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
import { props } from "./__generated__/box.props";
@@ -12,7 +12,7 @@ const presetStyle = {
export const meta: WsComponentMeta = {
type: "container",
label: "Box",
- Icon: SquareIcon,
+ Icon: BoxIcon,
presetStyle,
};
diff --git a/packages/react-sdk/src/components/components-utils.ts b/packages/react-sdk/src/components/components-utils.ts
index 5873ed7064..9b104fbb58 100644
--- a/packages/react-sdk/src/components/components-utils.ts
+++ b/packages/react-sdk/src/components/components-utils.ts
@@ -14,6 +14,7 @@ const componentNames = Object.keys({
Heading: 1,
Paragraph: 1,
Link: 1,
+ LinkBlock: 1,
RichTextLink: 1,
Span: 1,
Bold: 1,
diff --git a/packages/react-sdk/src/components/components.ts b/packages/react-sdk/src/components/components.ts
index 69c4da8b41..c1e4f8540e 100644
--- a/packages/react-sdk/src/components/components.ts
+++ b/packages/react-sdk/src/components/components.ts
@@ -11,6 +11,7 @@ export { TextBlock } from "./text-block";
export { Heading } from "./heading";
export { Paragraph } from "./paragraph";
export { Link } from "./link";
+export { LinkBlock } from "./link-block";
export { RichTextLink } from "./rich-text-link";
export { Span } from "./span";
export { Bold } from "./bold";
diff --git a/packages/react-sdk/src/components/index.ts b/packages/react-sdk/src/components/index.ts
index 7898ed9dec..f6bd730541 100644
--- a/packages/react-sdk/src/components/index.ts
+++ b/packages/react-sdk/src/components/index.ts
@@ -7,6 +7,7 @@ import { meta as TextBlockMeta } from "./text-block.ws";
import { meta as HeadingMeta } from "./heading.ws";
import { meta as ParagraphMeta } from "./paragraph.ws";
import { meta as LinkMeta } from "./link.ws";
+import { meta as LinkBlockMeta } from "./link-block.ws";
import { meta as RichTextLinkMeta } from "./rich-text-link.ws";
import { meta as SpanMeta } from "./span.ws";
import { meta as BoldMeta } from "./bold.ws";
@@ -30,6 +31,7 @@ import { propsMeta as TextBlockMetaPropsMeta } from "./text-block.ws";
import { propsMeta as HeadingMetaPropsMeta } from "./heading.ws";
import { propsMeta as ParagraphMetaPropsMeta } from "./paragraph.ws";
import { propsMeta as LinkMetaPropsMeta } from "./link.ws";
+import { propsMeta as LinkBlockPropsMeta } from "./link-block.ws";
import { propsMeta as RichTextLinkMetaPropsMeta } from "./rich-text-link.ws";
import { propsMeta as SpanMetaPropsMeta } from "./span.ws";
import { propsMeta as BoldMetaPropsMeta } from "./bold.ws";
@@ -53,6 +55,7 @@ const defaultMetas: Record<string, WsComponentMeta> = {
Heading: HeadingMeta,
Paragraph: ParagraphMeta,
Link: LinkMeta,
+ LinkBlock: LinkBlockMeta,
RichTextLink: RichTextLinkMeta,
Span: SpanMeta,
Bold: BoldMeta,
@@ -93,6 +96,7 @@ const defaultPropsMetasRaw = {
Heading: HeadingMetaPropsMeta,
Paragraph: ParagraphMetaPropsMeta,
Link: LinkMetaPropsMeta,
+ LinkBlock: LinkBlockPropsMeta,
RichTextLink: RichTextLinkMetaPropsMeta,
Span: SpanMetaPropsMeta,
Bold: BoldMetaPropsMeta,
diff --git a/packages/react-sdk/src/components/link-block.stories.tsx b/packages/react-sdk/src/components/link-block.stories.tsx
new file mode 100644
index 0000000000..a4d46dc82c
--- /dev/null
+++ b/packages/react-sdk/src/components/link-block.stories.tsx
@@ -0,0 +1,13 @@
+import type { ComponentStory, ComponentMeta } from "@storybook/react";
+import { Link as LinkPrimitive } from "./link";
+
+export default {
+ title: "Components/Link Block",
+ component: LinkPrimitive,
+} as ComponentMeta<typeof LinkPrimitive>;
+
+const Template: ComponentStory<typeof LinkPrimitive> = (args) => (
+ <LinkPrimitive {...args} />
+);
+
+export const Link = Template.bind({});
diff --git a/packages/react-sdk/src/components/link-block.tsx b/packages/react-sdk/src/components/link-block.tsx
new file mode 100644
index 0000000000..a2d3e0ab8e
--- /dev/null
+++ b/packages/react-sdk/src/components/link-block.tsx
@@ -0,0 +1,8 @@
+import { forwardRef } from "react";
+import { Link } from "./link";
+
+export const LinkBlock: typeof Link = forwardRef((props, ref) => (
+ <Link {...props} ref={ref} />
+));
+
+LinkBlock.displayName = "LinkBlock";
diff --git a/packages/react-sdk/src/components/link-block.ws.tsx b/packages/react-sdk/src/components/link-block.ws.tsx
new file mode 100644
index 0000000000..f9f950d605
--- /dev/null
+++ b/packages/react-sdk/src/components/link-block.ws.tsx
@@ -0,0 +1,26 @@
+import { BoxLinkIcon } from "@webstudio-is/icons";
+import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
+import { props } from "./__generated__/link-block.props";
+
+const presetStyle = {
+ boxSizing: {
+ type: "keyword",
+ value: "border-box",
+ },
+ display: {
+ type: "keyword",
+ value: "inline-block",
+ },
+} as const;
+
+export const meta: WsComponentMeta = {
+ type: "container",
+ label: "Link Block",
+ Icon: BoxLinkIcon,
+ presetStyle,
+};
+
+export const propsMeta: WsComponentPropsMeta = {
+ props,
+ initialProps: ["href", "target", "prefetch"],
+};
diff --git a/packages/react-sdk/src/components/link.ws.tsx b/packages/react-sdk/src/components/link.ws.tsx
index 8dd965ebb5..c16792ffd4 100644
--- a/packages/react-sdk/src/components/link.ws.tsx
+++ b/packages/react-sdk/src/components/link.ws.tsx
@@ -16,7 +16,7 @@ const presetStyle = {
export const meta: WsComponentMeta = {
type: "rich-text",
- label: "Link",
+ label: "Link Text",
Icon: Link2Icon,
presetStyle,
children: ["Link text you can edit"],