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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
feat: Add native select control (#3616)
Ivan Starkov38d49f9f69df
diff --git a/apps/builder/app/canvas/canvas.tsx b/apps/builder/app/canvas/canvas.tsxindex 42fd30b5fd..5896097543 100644--- a/apps/builder/app/canvas/canvas.tsx+++ b/apps/builder/app/canvas/canvas.tsx@@ -12,6 +12,7 @@ import {import * as baseComponents from "@webstudio-is/sdk-components-react";import * as baseComponentMetas from "@webstudio-is/sdk-components-react/metas";import * as baseComponentPropsMetas from "@webstudio-is/sdk-components-react/props";+import { hooks as baseComponentHooks } from "@webstudio-is/sdk-components-react/hooks";import * as remixComponents from "@webstudio-is/sdk-components-react-remix";import * as remixComponentMetas from "@webstudio-is/sdk-components-react-remix/metas";import * as remixComponentPropsMetas from "@webstudio-is/sdk-components-react-remix/props";@@ -159,6 +160,7 @@ export const Canvas = ({ params, imageLoader }: CanvasProps) => {components: baseComponents,metas: baseComponentMetas,propsMetas: baseComponentPropsMetas,+ hooks: baseComponentHooks,});registerComponentLibrary({components: remixComponents,diff --git a/apps/builder/app/canvas/collapsed.ts b/apps/builder/app/canvas/collapsed.tsindex 8a59e4141a..d91839d83b 100644--- a/apps/builder/app/canvas/collapsed.ts+++ b/apps/builder/app/canvas/collapsed.ts@@ -168,7 +168,11 @@ const recalculate = () => {const elementPosition = window.getComputedStyle(element).position;if (element.parentElement) {- if (elementPosition === "absolute" || elementPosition === "fixed") {+ if (+ elementPosition === "absolute" ||+ elementPosition === "fixed" ||+ element.offsetParent == null+ ) {parentsWithAbsoluteChildren.set(element.parentElement,parentsWithAbsoluteChildren.get(element.parentElement) ?? 0diff --git a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsxindex a90f06a8b2..e6e50bd3df 100644--- a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx+++ b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx@@ -31,7 +31,7 @@ import {} from "@webstudio-is/react-sdk";import { rawTheme } from "@webstudio-is/design-system";import {- $propValuesByInstanceSelector,+ $propValuesByInstanceSelectorWithMemoryProps,getIndexedInstanceId,$instances,$registeredComponentMetas,@@ -216,7 +216,7 @@ const useInstanceProps = (instanceSelector: InstanceSelector) => {const [instanceId] = instanceSelector;const $instancePropsObject = useMemo(() => {return computed(- [$propValuesByInstanceSelector, $indexesWithinAncestors],+ [$propValuesByInstanceSelectorWithMemoryProps, $indexesWithinAncestors],(propValuesByInstanceSelector, indexesWithinAncestors) => {const instancePropsObject: Record<Prop["name"], unknown> = {};const index = indexesWithinAncestors.get(instanceId);@@ -407,9 +407,14 @@ export const WebstudioComponentCanvas = forwardRef<[idAttribute]: instance.id,};+ // React ignores defaultValue changes after first render.+ // Key prop forces re-creation to reflect updates on canvas.+ const key =+ props.defaultValue != null ? props.defaultValue.toString() : undefined;+const instanceElement = (<>- <Component {...props} ref={ref}>+ <Component key={key} {...props} ref={ref}>{children}</Component></>diff --git a/apps/builder/app/canvas/instance-selected.ts b/apps/builder/app/canvas/instance-selected.tsindex d9718d0c78..0b326ab0e5 100644--- a/apps/builder/app/canvas/instance-selected.ts+++ b/apps/builder/app/canvas/instance-selected.ts@@ -10,7 +10,7 @@ import {$stylesIndex,$instances,$selectedInstanceSelector,- $propValuesByInstanceSelector,+ $propValuesByInstanceSelectorWithMemoryProps,$styles,$selectedInstanceStates,$styleSourceSelections,@@ -250,7 +250,7 @@ const subscribeSelectedInstance = (const unsubscribe$stylesIndex = $stylesIndex.subscribe(update);const unsubscribe$instances = $instances.subscribe(update);const unsubscribePropValuesStore =- $propValuesByInstanceSelector.subscribe(update);+ $propValuesByInstanceSelectorWithMemoryProps.subscribe(update);const unsubscribeIsResizingCanvas = $isResizingCanvas.subscribe((isResizing) => {diff --git a/apps/builder/app/canvas/interceptor.ts b/apps/builder/app/canvas/interceptor.tsindex eecb9694d3..55144ed01c 100644--- a/apps/builder/app/canvas/interceptor.ts+++ b/apps/builder/app/canvas/interceptor.ts@@ -93,6 +93,16 @@ export const subscribeInterceptedEvents = () => {}};+ const handlePointerDown = (event: PointerEvent) => {+ if (false === event.target instanceof HTMLElement) {+ return;+ }++ if (event.target.closest("select") && $isPreviewMode.get() === false) {+ event.preventDefault();+ }+ };+const handleSubmit = (event: SubmitEvent) => {if ($isPreviewMode.get()) {const form =@@ -138,7 +148,14 @@ export const subscribeInterceptedEvents = () => {});document.documentElement.addEventListener("keydown", handleKeydown);++ document.documentElement.addEventListener("pointerdown", handlePointerDown);+return () => {+ document.documentElement.removeEventListener(+ "pointerdown",+ handlePointerDown+ );document.documentElement.removeEventListener("click", handleClick, {capture: true,});diff --git a/apps/builder/app/shared/dom-utils.ts b/apps/builder/app/shared/dom-utils.tsindex f1b2c7ecee..940f3b2170 100644--- a/apps/builder/app/shared/dom-utils.ts+++ b/apps/builder/app/shared/dom-utils.ts@@ -67,7 +67,23 @@ export const getElementsByInstanceSelector = (rootSelectorSet.has(element.getAttribute(selectorIdAttribute) ?? ""));- return rootElements;+ return rootElements.map((element) => {+ // We are not interested in display:none or option elements (they have offsetParent === null)+ let elementResult: HTMLElement = element;++ while (+ elementResult.offsetParent === null &&+ elementResult.parentElement !== null+ ) {+ if (getComputedStyle(element).position === "fixed") {+ return element;+ }++ elementResult = elementResult.parentElement;+ }++ return elementResult;+ });};type Rect = {diff --git a/apps/builder/app/shared/nano-states/props.ts b/apps/builder/app/shared/nano-states/props.tsindex f07c96c2d0..5cf86c6db4 100644--- a/apps/builder/app/shared/nano-states/props.ts+++ b/apps/builder/app/shared/nano-states/props.ts@@ -246,8 +246,6 @@ export const $propValuesByInstanceSelector = computed($pages,$assets,$uploadingFilesDataStore,- $memoryProps,- $isPreviewMode,],(instances,@@ -257,9 +255,7 @@ export const $propValuesByInstanceSelector = computed(params,pages,assets,- uploadingFilesDataStore,- memoryProps,- isPreviewMode+ uploadingFilesDataStore) => {const variableValues = new Map<string, unknown>(unscopedVariableValues);@@ -387,19 +383,27 @@ export const $propValuesByInstanceSelector = computed(traverseInstances([page.rootInstanceId]);+ return propValuesByInstanceSelector;+ }+);++export const $propValuesByInstanceSelectorWithMemoryProps = computed(+ [$propValuesByInstanceSelector, $memoryProps, $isPreviewMode],+ (propValuesByInstanceSelector, memoryProps, isPreviewMode) => {if (false === isPreviewMode) {+ const result = new Map(propValuesByInstanceSelector);+for (const [memoryKey, memoryValue] of memoryProps) {- const propsBySelector =- propValuesByInstanceSelector.get(memoryKey) ?? new Map();+ const propsBySelector = new Map(result.get(memoryKey));for (const [memoryProp, memoryPropValue] of memoryValue) {propsBySelector.set(memoryProp, memoryPropValue.value);}- propValuesByInstanceSelector.set(memoryKey, propsBySelector);+ result.set(memoryKey, propsBySelector);}+ return result;}-return propValuesByInstanceSelector;});diff --git a/packages/generate-arg-types/src/arg-types.ts b/packages/generate-arg-types/src/arg-types.tsindex f4e41762ad..28f5505ecb 100644--- a/packages/generate-arg-types/src/arg-types.ts+++ b/packages/generate-arg-types/src/arg-types.ts@@ -88,6 +88,8 @@ export const getArgType = (propItem: PropItem): PropMeta | undefined => {return makePropMeta("number", "number");case "string":return makePropMeta("string", "text");+ case "string | number | readonly string[]":+ return makePropMeta("string", "text");case "string | number":case "number | string":if (defaultValue?.value === "") {diff --git a/packages/sdk-components-react/package.json b/packages/sdk-components-react/package.jsonindex 659a7a9628..9225da7ea7 100644--- a/packages/sdk-components-react/package.json+++ b/packages/sdk-components-react/package.json@@ -27,6 +27,11 @@"webstudio": "./src/props.ts","types": "./lib/types/props.d.ts","import": "./lib/props.js"+ },+ "./hooks": {+ "webstudio": "./src/hooks.ts",+ "types": "./lib/types/hooks.d.ts",+ "import": "./lib/hooks.js"}},"scripts": {diff --git a/packages/sdk-components-react/src/__generated__/blockquote.props.ts b/packages/sdk-components-react/src/__generated__/blockquote.props.tsindex bc3bf8e4cc..3e8306ac45 100644--- a/packages/sdk-components-react/src/__generated__/blockquote.props.ts+++ b/packages/sdk-components-react/src/__generated__/blockquote.props.ts@@ -429,6 +429,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/body.props.ts b/packages/sdk-components-react/src/__generated__/body.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/body.props.ts+++ b/packages/sdk-components-react/src/__generated__/body.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/bold.props.ts b/packages/sdk-components-react/src/__generated__/bold.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/bold.props.ts+++ b/packages/sdk-components-react/src/__generated__/bold.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/box.props.ts b/packages/sdk-components-react/src/__generated__/box.props.tsindex 9e7f38db7e..fd4fe71d8d 100644--- a/packages/sdk-components-react/src/__generated__/box.props.ts+++ b/packages/sdk-components-react/src/__generated__/box.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/button.props.ts b/packages/sdk-components-react/src/__generated__/button.props.tsindex 2c7552cefe..8d340b0952 100644--- a/packages/sdk-components-react/src/__generated__/button.props.ts+++ b/packages/sdk-components-react/src/__generated__/button.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",@@ -620,5 +621,12 @@ export const props: Record<string, PropMeta> = {type: "string",options: ["on", "off"],},+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },vocab: { required: false, control: "text", type: "string" },};diff --git a/packages/sdk-components-react/src/__generated__/checkbox.props.ts b/packages/sdk-components-react/src/__generated__/checkbox.props.tsindex fb420d37f4..0358e0677f 100644--- a/packages/sdk-components-react/src/__generated__/checkbox.props.ts+++ b/packages/sdk-components-react/src/__generated__/checkbox.props.ts@@ -442,6 +442,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/code-text.props.ts b/packages/sdk-components-react/src/__generated__/code-text.props.tsindex 8b50cecea3..ec016e76f7 100644--- a/packages/sdk-components-react/src/__generated__/code-text.props.ts+++ b/packages/sdk-components-react/src/__generated__/code-text.props.ts@@ -423,6 +423,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/form.props.ts b/packages/sdk-components-react/src/__generated__/form.props.tsindex 469c3c329e..42cffe6c02 100644--- a/packages/sdk-components-react/src/__generated__/form.props.ts+++ b/packages/sdk-components-react/src/__generated__/form.props.ts@@ -442,6 +442,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/heading.props.ts b/packages/sdk-components-react/src/__generated__/heading.props.tsindex 3cdd005e91..45b52539ee 100644--- a/packages/sdk-components-react/src/__generated__/heading.props.ts+++ b/packages/sdk-components-react/src/__generated__/heading.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/image.props.ts b/packages/sdk-components-react/src/__generated__/image.props.tsindex af6ba50dd4..f43f110545 100644--- a/packages/sdk-components-react/src/__generated__/image.props.ts+++ b/packages/sdk-components-react/src/__generated__/image.props.ts@@ -443,6 +443,7 @@ export const props: Record<string, PropMeta> = {description: "Indicates the preferred method to decode the image.",},defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/input.props.ts b/packages/sdk-components-react/src/__generated__/input.props.tsindex b002fb2a15..c1a6e66403 100644--- a/packages/sdk-components-react/src/__generated__/input.props.ts+++ b/packages/sdk-components-react/src/__generated__/input.props.ts@@ -442,6 +442,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",@@ -751,6 +752,13 @@ export const props: Record<string, PropMeta> = {type: "string",options: ["off", "on"],},+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },vocab: { required: false, control: "text", type: "string" },width: {required: false,diff --git a/packages/sdk-components-react/src/__generated__/italic.props.ts b/packages/sdk-components-react/src/__generated__/italic.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/italic.props.ts+++ b/packages/sdk-components-react/src/__generated__/italic.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/label.props.ts b/packages/sdk-components-react/src/__generated__/label.props.tsindex 69a114765a..f13380ad6c 100644--- a/packages/sdk-components-react/src/__generated__/label.props.ts+++ b/packages/sdk-components-react/src/__generated__/label.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/link.props.ts b/packages/sdk-components-react/src/__generated__/link.props.tsindex 9b8c7b2dd2..b48ad2cc83 100644--- a/packages/sdk-components-react/src/__generated__/link.props.ts+++ b/packages/sdk-components-react/src/__generated__/link.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/list-item.props.ts b/packages/sdk-components-react/src/__generated__/list-item.props.tsindex 659b4ec6e0..14d9290189 100644--- a/packages/sdk-components-react/src/__generated__/list-item.props.ts+++ b/packages/sdk-components-react/src/__generated__/list-item.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",@@ -557,5 +558,12 @@ export const props: Record<string, PropMeta> = {type: "string",options: ["on", "off"],},+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },vocab: { required: false, control: "text", type: "string" },};diff --git a/packages/sdk-components-react/src/__generated__/list.props.ts b/packages/sdk-components-react/src/__generated__/list.props.tsindex 2411a22e97..0d588af966 100644--- a/packages/sdk-components-react/src/__generated__/list.props.ts+++ b/packages/sdk-components-react/src/__generated__/list.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/option.props.ts b/packages/sdk-components-react/src/__generated__/option.props.tsnew file mode 100644index 0000000000..75a27b26e0--- /dev/null+++ b/packages/sdk-components-react/src/__generated__/option.props.ts@@ -0,0 +1,587 @@+import type { PropMeta } from "@webstudio-is/react-sdk";++export const props: Record<string, PropMeta> = {+ about: { required: false, control: "text", type: "string" },+ accessKey: {+ required: false,+ control: "text",+ type: "string",+ description: "Keyboard shortcut to activate or add focus to the element.",+ },+ "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-braillelabel": {+ description:+ "Defines a string value that labels the current element, which is intended to be converted into Braille.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-brailleroledescription": {+ description:+ "Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-busy": { required: false, control: "boolean", type: "boolean" },+ "aria-checked": {+ description:+ 'Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.',+ required: false,+ control: "text",+ type: "string",+ },+ "aria-colcount": {+ description:+ "Defines the total number of columns in a table, grid, or treegrid.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-colindextext": {+ description: "Defines a human readable text alternative of aria-colindex.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-colspan": {+ description:+ "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-controls": {+ description:+ "Identifies the element (or elements) whose contents or presence are controlled by the current element.",+ 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.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-description": {+ description:+ "Defines a string value that describes or annotates the current element.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-details": {+ description:+ "Identifies the element that provides a detailed, extended description for the object.",+ 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.",+ 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.",+ 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.",+ 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.',+ 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.",+ required: false,+ control: "boolean",+ type: "boolean",+ },+ "aria-invalid": {+ description:+ "Indicates the entered value does not conform to the format expected by the application.",+ 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:+ "Provides the accessible name that describes an interactive element if no other accessible name exists, for example in a button that contains an image with no text.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-labelledby": {+ description:+ "Identifies the element (or elements) that labels the current element.",+ 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.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-pressed": {+ description: 'Indicates the current "pressed" state of toggle buttons.',+ required: false,+ control: "text",+ type: "string",+ },+ "aria-readonly": {+ description:+ "Indicates that the element is not editable, but is otherwise operable.",+ 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.",+ 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.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-rowindextext": {+ description: "Defines a human readable text alternative of aria-rowindex.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-rowspan": {+ description:+ "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-selected": {+ description: 'Indicates the current "selected" state of various widgets.',+ 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.",+ 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.",+ 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",+ },+ autoCapitalize: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Sets whether input is automatically capitalized when entered by user.",+ },+ autoCorrect: { required: false, control: "text", type: "string" },+ autoFocus: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Indicates that an element should be focused on page load, or when its parent dialog is displayed.",+ },+ autoSave: { required: false, control: "text", type: "string" },+ className: { required: false, control: "text", type: "string" },+ color: {+ required: false,+ control: "color",+ type: "string",+ description:+ "This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. Note: This is a legacy attribute. Please use the CSS color property instead.",+ },+ content: {+ required: false,+ control: "text",+ type: "string",+ description:+ "A value associated with http-equiv orname depending on the context.",+ },+ contextMenu: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines the ID of a menu element which willserve as the element's context menu.",+ },+ datatype: { required: false, control: "text", type: "string" },+ defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },+ dir: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)",+ },+ disabled: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Indicates whether the user can interact with the element.",+ },+ draggable: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Defines whether the element can be dragged.",+ },+ hidden: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Prevents rendering of given element, while keeping child elements, e.g. script elements, active.",+ },+ id: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Often used with CSS to style a specific element. The value of this attribute must be unique.",+ },+ inputMode: {+ description:+ "Hints at the type of data that might be entered by the user while editing the element or its contents",+ required: false,+ control: "select",+ type: "string",+ options: [+ "search",+ "text",+ "none",+ "tel",+ "url",+ "email",+ "numeric",+ "decimal",+ ],+ },+ is: {+ description:+ "Specify that a standard HTML element should behave like a defined custom built-in element",+ required: false,+ control: "text",+ type: "string",+ },+ itemID: { required: false, control: "text", type: "string" },+ itemProp: { required: false, control: "text", type: "string" },+ itemRef: { required: false, control: "text", type: "string" },+ itemScope: { required: false, control: "boolean", type: "boolean" },+ itemType: { required: false, control: "text", type: "string" },+ label: {+ required: false,+ control: "text",+ type: "string",+ description: "Specifies a user-readable title of the element.",+ },+ lang: {+ required: false,+ control: "text",+ type: "string",+ description: "Defines the language used in the element.",+ },+ nonce: { required: false, control: "text", type: "string" },+ prefix: { required: false, control: "text", type: "string" },+ property: { required: false, control: "text", type: "string" },+ radioGroup: { required: false, control: "text", type: "string" },+ rel: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Specifies the relationship of the target object to the link object.",+ },+ resource: { required: false, control: "text", type: "string" },+ results: { required: false, control: "number", type: "number" },+ rev: { required: false, control: "text", type: "string" },+ role: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines an explicit role for an element for use by assistive technologies.",+ },+ security: { required: false, control: "text", type: "string" },+ selected: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Defines a value which will be selected on page load.",+ },+ slot: {+ required: false,+ control: "text",+ type: "string",+ description: "Assigns a slot in a shadow DOM shadow tree to an element.",+ },+ spellCheck: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Indicates whether spell checking is allowed for the element.",+ },+ suppressContentEditableWarning: {+ required: false,+ control: "boolean",+ type: "boolean",+ },+ suppressHydrationWarning: {+ required: false,+ control: "boolean",+ type: "boolean",+ },+ tabIndex: {+ required: false,+ control: "number",+ type: "number",+ description:+ "Overrides the browser's default tab order and follows the one specified instead.",+ },+ title: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Text to be displayed in a tooltip when hovering over the element.",+ },+ translate: {+ required: false,+ control: "radio",+ type: "string",+ options: ["yes", "no"],+ description:+ "Specify whether an element's attribute values and the values of its text node children are to be translated when the page is localized, or whether to leave them unchanged.",+ },+ typeof: { required: false, control: "text", type: "string" },+ unselectable: {+ required: false,+ control: "radio",+ type: "string",+ options: ["on", "off"],+ },+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },+ vocab: { required: false, control: "text", type: "string" },+};diff --git a/packages/sdk-components-react/src/__generated__/paragraph.props.ts b/packages/sdk-components-react/src/__generated__/paragraph.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/paragraph.props.ts+++ b/packages/sdk-components-react/src/__generated__/paragraph.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/radio-button.props.ts b/packages/sdk-components-react/src/__generated__/radio-button.props.tsindex fb420d37f4..0358e0677f 100644--- a/packages/sdk-components-react/src/__generated__/radio-button.props.ts+++ b/packages/sdk-components-react/src/__generated__/radio-button.props.ts@@ -442,6 +442,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/rich-text-link.props.ts b/packages/sdk-components-react/src/__generated__/rich-text-link.props.tsindex 9b8c7b2dd2..b48ad2cc83 100644--- a/packages/sdk-components-react/src/__generated__/rich-text-link.props.ts+++ b/packages/sdk-components-react/src/__generated__/rich-text-link.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/select.props.ts b/packages/sdk-components-react/src/__generated__/select.props.tsnew file mode 100644index 0000000000..6e07d779e2--- /dev/null+++ b/packages/sdk-components-react/src/__generated__/select.props.ts@@ -0,0 +1,616 @@+import type { PropMeta } from "@webstudio-is/react-sdk";++export const props: Record<string, PropMeta> = {+ about: { required: false, control: "text", type: "string" },+ accessKey: {+ required: false,+ control: "text",+ type: "string",+ description: "Keyboard shortcut to activate or add focus to the element.",+ },+ "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-braillelabel": {+ description:+ "Defines a string value that labels the current element, which is intended to be converted into Braille.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-brailleroledescription": {+ description:+ "Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-busy": { required: false, control: "boolean", type: "boolean" },+ "aria-checked": {+ description:+ 'Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.',+ required: false,+ control: "text",+ type: "string",+ },+ "aria-colcount": {+ description:+ "Defines the total number of columns in a table, grid, or treegrid.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-colindextext": {+ description: "Defines a human readable text alternative of aria-colindex.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-colspan": {+ description:+ "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-controls": {+ description:+ "Identifies the element (or elements) whose contents or presence are controlled by the current element.",+ 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.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-description": {+ description:+ "Defines a string value that describes or annotates the current element.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-details": {+ description:+ "Identifies the element that provides a detailed, extended description for the object.",+ 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.",+ 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.",+ 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.",+ 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.',+ 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.",+ required: false,+ control: "boolean",+ type: "boolean",+ },+ "aria-invalid": {+ description:+ "Indicates the entered value does not conform to the format expected by the application.",+ 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:+ "Provides the accessible name that describes an interactive element if no other accessible name exists, for example in a button that contains an image with no text.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-labelledby": {+ description:+ "Identifies the element (or elements) that labels the current element.",+ 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.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-pressed": {+ description: 'Indicates the current "pressed" state of toggle buttons.',+ required: false,+ control: "text",+ type: "string",+ },+ "aria-readonly": {+ description:+ "Indicates that the element is not editable, but is otherwise operable.",+ 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.",+ 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.",+ 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.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-rowindextext": {+ description: "Defines a human readable text alternative of aria-rowindex.",+ required: false,+ control: "text",+ type: "string",+ },+ "aria-rowspan": {+ description:+ "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.",+ required: false,+ control: "number",+ type: "number",+ },+ "aria-selected": {+ description: 'Indicates the current "selected" state of various widgets.',+ 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.",+ 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.",+ 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",+ },+ autoCapitalize: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Sets whether input is automatically capitalized when entered by user.",+ },+ autoComplete: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Indicates whether controls in this form can by default have their valuesautomatically completed by the browser.",+ },+ autoCorrect: { required: false, control: "text", type: "string" },+ autoFocus: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Indicates that an element should be focused on page load, or when its parent dialog is displayed.",+ },+ autoSave: { required: false, control: "text", type: "string" },+ className: { required: false, control: "text", type: "string" },+ color: {+ required: false,+ control: "color",+ type: "string",+ description:+ "This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. Note: This is a legacy attribute. Please use the CSS color property instead.",+ },+ content: {+ required: false,+ control: "text",+ type: "string",+ description:+ "A value associated with http-equiv orname depending on the context.",+ },+ contextMenu: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines the ID of a menu element which willserve as the element's context menu.",+ },+ datatype: { required: false, control: "text", type: "string" },+ defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },+ dir: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)",+ },+ disabled: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Indicates whether the user can interact with the element.",+ },+ draggable: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Defines whether the element can be dragged.",+ },+ form: {+ required: false,+ control: "text",+ type: "string",+ description: "Indicates the form that is the owner of the element.",+ },+ hidden: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Prevents rendering of given element, while keeping child elements, e.g. script elements, active.",+ },+ id: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Often used with CSS to style a specific element. The value of this attribute must be unique.",+ },+ inputMode: {+ description:+ "Hints at the type of data that might be entered by the user while editing the element or its contents",+ required: false,+ control: "select",+ type: "string",+ options: [+ "search",+ "text",+ "none",+ "tel",+ "url",+ "email",+ "numeric",+ "decimal",+ ],+ },+ is: {+ description:+ "Specify that a standard HTML element should behave like a defined custom built-in element",+ required: false,+ control: "text",+ type: "string",+ },+ itemID: { required: false, control: "text", type: "string" },+ itemProp: { required: false, control: "text", type: "string" },+ itemRef: { required: false, control: "text", type: "string" },+ itemScope: { required: false, control: "boolean", type: "boolean" },+ itemType: { required: false, control: "text", type: "string" },+ lang: {+ required: false,+ control: "text",+ type: "string",+ description: "Defines the language used in the element.",+ },+ multiple: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Indicates whether multiple values can be entered in an input of the type email or file.",+ },+ name: {+ required: false,+ control: "text",+ type: "string",+ description:+ "This name is important when submitting form data to the server, as it identifies the data associated with the input. When multiple inputs share the same name attribute, they are treated as part of the same group (e.g., radio buttons or checkboxes).",+ },+ nonce: { required: false, control: "text", type: "string" },+ prefix: { required: false, control: "text", type: "string" },+ property: { required: false, control: "text", type: "string" },+ radioGroup: { required: false, control: "text", type: "string" },+ rel: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Specifies the relationship of the target object to the link object.",+ },+ required: {+ required: false,+ control: "boolean",+ type: "boolean",+ description:+ "Indicates whether this form element must be filled before the form can be submitted.",+ },+ resource: { required: false, control: "text", type: "string" },+ results: { required: false, control: "number", type: "number" },+ rev: { required: false, control: "text", type: "string" },+ role: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines an explicit role for an element for use by assistive technologies.",+ },+ security: { required: false, control: "text", type: "string" },+ size: {+ required: false,+ control: "number",+ type: "number",+ description:+ "Defines the width of the element (in pixels). If the element'stype attribute is text or password then it's the number of characters.",+ },+ slot: {+ required: false,+ control: "text",+ type: "string",+ description: "Assigns a slot in a shadow DOM shadow tree to an element.",+ },+ spellCheck: {+ required: false,+ control: "boolean",+ type: "boolean",+ description: "Indicates whether spell checking is allowed for the element.",+ },+ suppressContentEditableWarning: {+ required: false,+ control: "boolean",+ type: "boolean",+ },+ suppressHydrationWarning: {+ required: false,+ control: "boolean",+ type: "boolean",+ },+ tabIndex: {+ required: false,+ control: "number",+ type: "number",+ description:+ "Overrides the browser's default tab order and follows the one specified instead.",+ },+ title: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Text to be displayed in a tooltip when hovering over the element.",+ },+ translate: {+ required: false,+ control: "radio",+ type: "string",+ options: ["yes", "no"],+ description:+ "Specify whether an element's attribute values and the values of its text node children are to be translated when the page is localized, or whether to leave them unchanged.",+ },+ typeof: { required: false, control: "text", type: "string" },+ unselectable: {+ required: false,+ control: "radio",+ type: "string",+ options: ["on", "off"],+ },+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },+ vocab: { required: false, control: "text", type: "string" },+};diff --git a/packages/sdk-components-react/src/__generated__/separator.props.ts b/packages/sdk-components-react/src/__generated__/separator.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/separator.props.ts+++ b/packages/sdk-components-react/src/__generated__/separator.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/span.props.ts b/packages/sdk-components-react/src/__generated__/span.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/span.props.ts+++ b/packages/sdk-components-react/src/__generated__/span.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/subscript.props.ts b/packages/sdk-components-react/src/__generated__/subscript.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/subscript.props.ts+++ b/packages/sdk-components-react/src/__generated__/subscript.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/superscript.props.ts b/packages/sdk-components-react/src/__generated__/superscript.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/superscript.props.ts+++ b/packages/sdk-components-react/src/__generated__/superscript.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/text.props.ts b/packages/sdk-components-react/src/__generated__/text.props.tsindex ad8284b08f..434025d4af 100644--- a/packages/sdk-components-react/src/__generated__/text.props.ts+++ b/packages/sdk-components-react/src/__generated__/text.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/textarea.props.ts b/packages/sdk-components-react/src/__generated__/textarea.props.tsindex 3f54420b08..ab7e7a4906 100644--- a/packages/sdk-components-react/src/__generated__/textarea.props.ts+++ b/packages/sdk-components-react/src/__generated__/textarea.props.ts@@ -435,6 +435,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",@@ -630,6 +631,13 @@ export const props: Record<string, PropMeta> = {type: "string",options: ["on", "off"],},+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },vocab: { required: false, control: "text", type: "string" },wrap: {required: false,diff --git a/packages/sdk-components-react/src/__generated__/vimeo-play-button.props.ts b/packages/sdk-components-react/src/__generated__/vimeo-play-button.props.tsindex 9deee2f0ec..16c7263a3a 100644--- a/packages/sdk-components-react/src/__generated__/vimeo-play-button.props.ts+++ b/packages/sdk-components-react/src/__generated__/vimeo-play-button.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",@@ -618,5 +619,12 @@ export const props: Record<string, PropMeta> = {type: "string",options: ["on", "off"],},+ value: {+ required: false,+ control: "text",+ type: "string",+ description:+ "Defines a default value which will be displayed in the element on pageload.",+ },vocab: { required: false, control: "text", type: "string" },};diff --git a/packages/sdk-components-react/src/__generated__/vimeo-preview-image.props.ts b/packages/sdk-components-react/src/__generated__/vimeo-preview-image.props.tsindex 39e5c187b2..ef5233e023 100644--- a/packages/sdk-components-react/src/__generated__/vimeo-preview-image.props.ts+++ b/packages/sdk-components-react/src/__generated__/vimeo-preview-image.props.ts@@ -443,6 +443,7 @@ export const props: Record<string, PropMeta> = {description: "Indicates the preferred method to decode the image.",},defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/vimeo-spinner.props.ts b/packages/sdk-components-react/src/__generated__/vimeo-spinner.props.tsindex 659b4ec6e0..b22b1021eb 100644--- a/packages/sdk-components-react/src/__generated__/vimeo-spinner.props.ts+++ b/packages/sdk-components-react/src/__generated__/vimeo-spinner.props.ts@@ -422,6 +422,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/__generated__/vimeo.props.ts b/packages/sdk-components-react/src/__generated__/vimeo.props.tsindex 50213868b3..ccd37bb5e3 100644--- a/packages/sdk-components-react/src/__generated__/vimeo.props.ts+++ b/packages/sdk-components-react/src/__generated__/vimeo.props.ts@@ -460,6 +460,7 @@ export const props: Record<string, PropMeta> = {},datatype: { required: false, control: "text", type: "string" },defaultChecked: { required: false, control: "boolean", type: "boolean" },+ defaultValue: { required: false, control: "text", type: "string" },dir: {required: false,control: "text",diff --git a/packages/sdk-components-react/src/components.ts b/packages/sdk-components-react/src/components.tsindex fdb772c7a4..72a763fab8 100644--- a/packages/sdk-components-react/src/components.ts+++ b/packages/sdk-components-react/src/components.ts@@ -32,3 +32,5 @@ export { VimeoPlayButton } from "./vimeo-play-button";export { VimeoSpinner } from "./vimeo-spinner";export { XmlNode } from "./xml-node";export { Time } from "./time";+export { Select } from "./select";+export { Option } from "./option";diff --git a/packages/sdk-components-react/src/hooks.ts b/packages/sdk-components-react/src/hooks.tsnew file mode 100644index 0000000000..a724726ed1--- /dev/null+++ b/packages/sdk-components-react/src/hooks.ts@@ -0,0 +1,4 @@+import type { Hook } from "@webstudio-is/react-sdk";+import { hooksSelect } from "./select";++export const hooks: Hook[] = [hooksSelect];diff --git a/packages/sdk-components-react/src/metas.ts b/packages/sdk-components-react/src/metas.tsindex 6f81aec1d0..cd8a8c3a4a 100644--- a/packages/sdk-components-react/src/metas.ts+++ b/packages/sdk-components-react/src/metas.ts@@ -33,3 +33,5 @@ export { meta as VimeoPlayButton } from "./vimeo-play-button.ws";export { meta as VimeoSpinner } from "./vimeo-spinner.ws";export { meta as XmlNode } from "./xml-node.ws";export { meta as Time } from "./time.ws";+export { meta as Select } from "./select.ws";+export { meta as Option } from "./option.ws";diff --git a/packages/sdk-components-react/src/option.tsx b/packages/sdk-components-react/src/option.tsxnew file mode 100644index 0000000000..ecbdd52ecd--- /dev/null+++ b/packages/sdk-components-react/src/option.tsx@@ -0,0 +1,10 @@+import { forwardRef, type ElementRef, type ComponentProps } from "react";++export const defaultTag = "option";++export const Option = forwardRef<+ ElementRef<typeof defaultTag>,+ ComponentProps<typeof defaultTag>+>((props, ref) => <option {...props} ref={ref} />);++Option.displayName = "Option";diff --git a/packages/sdk-components-react/src/option.ws.ts b/packages/sdk-components-react/src/option.ws.tsnew file mode 100644index 0000000000..67fec3268e--- /dev/null+++ b/packages/sdk-components-react/src/option.ws.ts@@ -0,0 +1,52 @@+import { ItemIcon } from "@webstudio-is/icons/svg";+import {+ type PresetStyle,+ type WsComponentMeta,+ type WsComponentPropsMeta,+} from "@webstudio-is/react-sdk";++import type { defaultTag } from "./option";+import { props } from "./__generated__/option.props";++const presetStyle = {+ option: [+ {+ property: "backgroundColor",+ state: ":checked",+ value: {+ type: "rgb",+ alpha: 1,+ r: 209,+ g: 209,+ b: 209,+ },+ },+ ],+} satisfies PresetStyle<typeof defaultTag>;++export const meta: WsComponentMeta = {+ category: "hidden",+ // @todo: requiredAncestors should be ["Select", "Optgroup", "Datalist"] but that gives unreadable error when adding Select onto Canvas+ requiredAncestors: ["Select"],+ type: "control",+ label: "Option",+ description:+ "An item within a drop-down menu that users can select as their chosen value.",+ icon: ItemIcon,+ presetStyle,+ states: [+ // Applies when option is being activated (clicked)+ { selector: ":active", label: "Active" },+ // Applies to the currently selected option+ { selector: ":checked", label: "Checked" },+ // For <option> elements: The :default pseudo-class selects the <option> that has the selected attribute when the page loads. This is true even if the user later selects a different option.+ { selector: ":default", label: "Default" },+ { selector: ":hover", label: "Hover" },+ { selector: ":disabled", label: "Disabled" },+ ],+};++export const propsMeta: WsComponentPropsMeta = {+ props,+ initialProps: ["label", "selected", "value", "label", "disabled"],+};diff --git a/packages/sdk-components-react/src/props.ts b/packages/sdk-components-react/src/props.tsindex c40fcf9f79..781f7c1bf6 100644--- a/packages/sdk-components-react/src/props.ts+++ b/packages/sdk-components-react/src/props.ts@@ -32,3 +32,5 @@ export { propsMeta as VimeoPlayButton } from "./vimeo-play-button.ws";export { propsMeta as VimeoSpinner } from "./vimeo-spinner.ws";export { propsMeta as XmlNode } from "./xml-node.ws";export { propsMeta as Time } from "./time.ws";+export { propsMeta as Select } from "./select.ws";+export { propsMeta as Option } from "./option.ws";diff --git a/packages/sdk-components-react/src/select.tsx b/packages/sdk-components-react/src/select.tsxnew file mode 100644index 0000000000..7b40090569--- /dev/null+++ b/packages/sdk-components-react/src/select.tsx@@ -0,0 +1,57 @@+import {+ getClosestInstance,+ getInstanceSelectorById,+ type Hook,+} from "@webstudio-is/react-sdk";+import { forwardRef, type ElementRef, type ComponentProps } from "react";++export const defaultTag = "select";++export const Select = forwardRef<+ ElementRef<typeof defaultTag>,+ ComponentProps<typeof defaultTag>+>((props, ref) => <select {...props} ref={ref} />);++Select.displayName = "Select";++// For each CollapsibleContent component within the selection,+// we identify its closest parent Collapsible component+// and update its open prop bound to variable.+export const hooksSelect: Hook = {+ onNavigatorUnselect: (context, event) => {+ for (const instance of event.instancePath) {+ if (instance.component === `Option`) {+ const option = getClosestInstance(+ event.instancePath,+ instance,+ `Option`+ );+ if (option) {+ const instanceSelector = getInstanceSelectorById(+ event.instanceSelector,+ option.id+ );+ context.setMemoryProp(instanceSelector, "selected", undefined);+ }+ }+ }+ },+ onNavigatorSelect: (context, event) => {+ for (const instance of event.instancePath) {+ if (instance.component === `Option`) {+ const option = getClosestInstance(+ event.instancePath,+ instance,+ `Option`+ );+ if (option) {+ const instanceSelector = getInstanceSelectorById(+ event.instanceSelector,+ option.id+ );+ context.setMemoryProp(instanceSelector, "selected", true);+ }+ }+ }+ },+};diff --git a/packages/sdk-components-react/src/select.ws.ts b/packages/sdk-components-react/src/select.ws.tsnew file mode 100644index 0000000000..3dde3e3ba7--- /dev/null+++ b/packages/sdk-components-react/src/select.ws.ts@@ -0,0 +1,102 @@+import { SelectIcon } from "@webstudio-is/icons/svg";+import {+ defaultStates,+ type PresetStyle,+ type WsComponentMeta,+ type WsComponentPropsMeta,+} from "@webstudio-is/react-sdk";+import { select } from "@webstudio-is/react-sdk/css-normalize";+import type { defaultTag } from "./select";+import { props } from "./__generated__/select.props";++const presetStyle = {+ select: [+ ...select,+ {+ property: "display",+ value: { type: "keyword", value: "block" },+ },+ ],+} satisfies PresetStyle<typeof defaultTag>;++export const meta: WsComponentMeta = {+ category: "forms",+ invalidAncestors: ["Button", "Link"],+ type: "container",+ label: "Select",+ description:+ "A drop-down menu for users to select a single option from a predefined list.",+ icon: SelectIcon,+ presetStyle,+ order: 4,+ states: [+ ...defaultStates,+ { selector: "::placeholder", label: "Placeholder" },+ { selector: ":valid", label: "Valid" },+ { selector: ":invalid", label: "Invalid" },+ { selector: ":required", label: "Required" },+ { selector: ":optional", label: "Optional" },+ ],+ template: [+ {+ type: "instance",+ component: "Select",+ label: "Select",+ children: [+ {+ type: "instance",+ component: "Option",+ label: "Option",+ props: [+ { type: "string", name: "label", value: "Please choose an option" },+ { type: "string", name: "value", value: "" },+ ],+ children: [],+ },+ {+ type: "instance",+ component: "Option",+ label: "Option",+ props: [+ { type: "string", name: "label", value: "Option A" },+ { type: "string", name: "value", value: "a" },+ ],+ children: [],+ },+ {+ type: "instance",+ component: "Option",+ label: "Option",+ props: [+ { type: "string", name: "label", value: "Option B" },+ { type: "string", name: "value", value: "b" },+ ],+ children: [],+ },+ {+ type: "instance",+ component: "Option",+ label: "Option",+ props: [+ { type: "string", name: "label", value: "Option C" },+ { type: "string", name: "value", value: "c" },+ ],+ children: [],+ },+ ],+ },+ ],+};++export const propsMeta: WsComponentPropsMeta = {+ props,+ initialProps: [+ "id",+ "className",+ "name",+ "multiple",+ "defaultValue",+ "required",+ "autoFocus",+ ],+};