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
fix: Option list changes width on hover (#4363)
Ivan Starkovb762a922149b
diff --git a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsxindex 1fbfeca6f1..82420746bf 100644--- a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx+++ b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx@@ -79,9 +79,7 @@ export const PositionControl = ({<Flex direction="column" gap="1"><PropertyInlineLabellabel="Position"- description={- propertyDescriptions[property as keyof typeof propertyDescriptions]- }+ description={propertyDescriptions[property]}properties={[property]}/><Flex gap="6">diff --git a/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx b/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsxindex d53465e754..fed0b99500 100644--- a/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx+++ b/apps/builder/app/builder/features/style-panel/controls/select/select-control.tsx@@ -17,6 +17,7 @@ import {getRepeatedStyleItem,setRepeatedStyleItem,} from "../../shared/repeated-style";+import { noCase } from "change-case";export const SelectControl = ({property,@@ -50,6 +51,12 @@ export const SelectControl = ({options.push(valueString);}+ const hasDescription =+ options.length > 0 &&+ options.some(+ (option) => declarationDescriptions[`${property}:${option}`] !== undefined+ );+return (<Select// Show empty field instead of radix placeholder like css value input does.@@ -77,15 +84,16 @@ export const SelectControl = ({}}}getDescription={(option) => {- const description =- declarationDescriptions[- `${property}:${option}` as keyof typeof declarationDescriptions- ];-- if (description === undefined) {+ if (hasDescription === false) {return;}- return <Box css={{ width: theme.spacing[26] }}>{description}</Box>;++ const description = declarationDescriptions[`${property}:${option}`];+ return (+ <Box css={{ width: theme.spacing[26] }}>+ {description ?? `The ${noCase(property)} is ${option}`}+ </Box>+ );}}getItemProps={() => ({ text: "sentence" })}/>diff --git a/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx b/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsxindex 26bfd53b67..c806aaba95 100644--- a/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx+++ b/apps/builder/app/builder/features/style-panel/controls/toggle-group/toggle-group-control.tsx@@ -37,7 +37,7 @@ export const ToggleGroupTooltip = ({isSelected: boolean;label?: string;code?: string;- description: string;+ description: string | undefined;properties: StyleProperty[];isAdvanced?: boolean;children: ReactNode;diff --git a/apps/builder/app/builder/features/style-panel/property-label.tsx b/apps/builder/app/builder/features/style-panel/property-label.tsxindex c65a2c5b16..7d43394647 100644--- a/apps/builder/app/builder/features/style-panel/property-label.tsx+++ b/apps/builder/app/builder/features/style-panel/property-label.tsx@@ -219,7 +219,7 @@ export const PropertyLabel = ({properties,}: {label: string;- description: string;+ description?: string;properties: [StyleProperty, ...StyleProperty[]];}) => {const styles = useComputedStyles(properties);@@ -277,7 +277,7 @@ export const PropertySectionLabel = ({properties,}: {label: string;- description: string;+ description: string | undefined;properties: [StyleProperty, ...StyleProperty[]];}) => {const styles = useComputedStyles(properties);@@ -344,7 +344,7 @@ export const PropertyInlineLabel = ({}: {label: string;title?: string;- description: string;+ description?: string;properties?: [StyleProperty, ...StyleProperty[]];disabled?: boolean;}) => {@@ -400,7 +400,7 @@ export const PropertyValueTooltip = ({children,}: {label: string;- description: string;+ description: string | undefined;properties: [StyleProperty, ...StyleProperty[]];isAdvanced?: boolean;children: ReactNode;diff --git a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsxindex c0d68b7620..24890c9ef8 100644--- a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx@@ -138,10 +138,9 @@ const matchOrSuggestToCreate = (};const getNewPropertyDescription = (item: null | SearchItem) => {- let description = `Create CSS variable.`;+ let description: string | undefined = `Create CSS variable.`;if (item && item.value in propertyDescriptions) {- description =- propertyDescriptions[item.value as keyof typeof propertyDescriptions];+ description = propertyDescriptions[item.value];}return <Box css={{ width: theme.spacing[28] }}>{description}</Box>;};@@ -261,8 +260,7 @@ const AdvancedSearch = ({const AdvancedPropertyLabel = ({ property }: { property: StyleProperty }) => {const styleDecl = useComputedStyleDecl(property);const label = hyphenateProperty(property);- const description =- propertyDescriptions[property as keyof typeof propertyDescriptions];+ const description = propertyDescriptions[property];const color =styleDecl.source.name === "default" ? "code" : styleDecl.source.name;const [isOpen, setIsOpen] = useState(false);diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsxindex a431cebdc2..fa770da645 100644--- a/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/layout/layout.tsx@@ -86,10 +86,7 @@ const GapTooltip = ({children: ReactNode;}) => {const [isOpen, setIsOpen] = useState(false);- const description =- propertyDescriptions[- styleDecl.property as keyof typeof propertyDescriptions- ];+ const description = propertyDescriptions[styleDecl.property];return (<Tooltipopen={isOpen}diff --git a/apps/builder/app/builder/features/style-panel/sections/size/size.tsx b/apps/builder/app/builder/features/style-panel/sections/size/size.tsxindex ba944b5e1c..56f4860006 100644--- a/apps/builder/app/builder/features/style-panel/sections/size/size.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/size/size.tsx@@ -29,9 +29,7 @@ const SizeProperty = ({ property }: { property: StyleProperty }) => {<Grid gap={1}><PropertyLabellabel={humanizeString(property)}- description={- propertyDescriptions[property as keyof typeof propertyDescriptions]- }+ description={propertyDescriptions[property]}properties={[property]}/><TextControl property={property} />diff --git a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsxindex e531e3a4bf..4f280fe1c8 100644--- a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-and-perspective-origin.tsx@@ -153,9 +153,7 @@ export const TransformAndPerspectiveOrigin = ({<Grid gap="2"><PropertyLabellabel={label}- description={- propertyDescriptions[property as keyof typeof propertyDescriptions]- }+ description={propertyDescriptions[property]}properties={[property]}/><Flex gap="6">diff --git a/packages/css-data/bin/property-value-descriptions.ts b/packages/css-data/bin/property-value-descriptions.tsindex c5e10c4de1..f980b3e047 100755--- a/packages/css-data/bin/property-value-descriptions.ts+++ b/packages/css-data/bin/property-value-descriptions.ts@@ -331,7 +331,7 @@ function writeFile(descriptions: Record<string, unknown>) {([binding, value]) =>`export const ${binding} = ` +(typeof value === "string" ? value : JSON.stringify(value, null, 2)) +- " as const;"+ " as Record<string, string | undefined>;").join("\n\n");diff --git a/packages/css-data/src/__generated__/property-value-descriptions.ts b/packages/css-data/src/__generated__/property-value-descriptions.tsindex 0410d894d6..b13676ec70 100644--- a/packages/css-data/src/__generated__/property-value-descriptions.ts+++ b/packages/css-data/src/__generated__/property-value-descriptions.ts@@ -505,9 +505,9 @@ export const propertiesGenerated = {fieldSizing:"Controls the algorithm used to calculate the width of form controls.",zoom: "Specifies the zoom level of a document.",-} as const;+} as Record<string, string | undefined>;-export const propertiesOverrides = {} as const;+export const propertiesOverrides = {} as Record<string, string | undefined>;export const propertySyntaxesGenerated = {boxShadowOffsetX: "Controls the offset distance of the shadow on the X-axis.",@@ -544,12 +544,12 @@ export const propertySyntaxesGenerated = {transformOriginZ: "Sets the origin of transformation for the z-axis.",perspectiveOriginX: "Sets the origin of perspective for the x-axis.",perspectiveOriginY: "Sets the origin of perspective for the y-axis.",-} as const;+} as Record<string, string | undefined>;export const properties = {...propertiesGenerated,...propertiesOverrides,-} as const;+} as Record<string, string | undefined>;export const declarationsGenerated = {"alignContent:normal":@@ -4370,11 +4370,11 @@ export const declarationsGenerated = {"zoom:initial": "Sets the zoom level to the default value.","zoom:inherit": "Inherits the zoom level from the parent element.","zoom:unset": "Unsets the zoom level, allowing the browser to decide.",-} as const;+} as Record<string, string | undefined>;-export const declarationsOverrides = {} as const;+export const declarationsOverrides = {} as Record<string, string | undefined>;export const declarations = {...declarationsGenerated,...declarationsOverrides,-} as const;+} as Record<string, string | undefined>;