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
refactor: switch to new property labels for basic properties (#4013)
Bogdan Chadkin33299c4b6e42
diff --git a/apps/builder/app/builder/features/style-panel/property-label.tsx b/apps/builder/app/builder/features/style-panel/property-label.tsxindex 78cf77b324..f8e4f6a437 100644--- a/apps/builder/app/builder/features/style-panel/property-label.tsx+++ b/apps/builder/app/builder/features/style-panel/property-label.tsx@@ -103,11 +103,7 @@ export const PropertyInfo = ({variant="monoBold"color="moreSubtle"userSelect="text"- css={{- whiteSpace: "break-spaces",- maxHeight: "3em",- cursor: "text",- }}+ css={{ whiteSpace: "break-spaces", cursor: "text" }}>{properties.join("\n")}</Text>diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsxindex 7c8095b008..6b3ef65832 100644--- a/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/borders/border-color.tsx@@ -1,6 +1,5 @@import { type StyleProperty } from "@webstudio-is/css-engine";import { Box, Grid } from "@webstudio-is/design-system";-import { PropertyName } from "../../shared/property-name";import { ColorControl } from "../../controls";import { styleConfigByName } from "../../shared/configs";import type { SectionProps } from "../shared/section";@@ -10,13 +9,14 @@ import {rowCss,isAdvancedValue,} from "./utils";+import { PropertyLabel } from "../../property-label";export const properties = ["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor",-] satisfies Array<StyleProperty>;+] satisfies [StyleProperty, ...StyleProperty[]];// We do not use shorthand properties such as borderWidth or borderRadius in our code.// However, in the UI, we can display a single field, and in that case, we can use any property@@ -36,12 +36,10 @@ export const BorderColor = (props: SectionProps) => {return (<Grid css={rowCss}>- <PropertyName- style={currentStyle}- properties={properties}- label={"Color"}+ <PropertyLabel+ label="Color"description="Sets the color of the border"- onReset={() => deleteColorProperties(borderColorProperty)}+ properties={properties}/><Box css={{ gridColumn: `span 2` }}>diff --git a/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsxindex 4283671c89..806871b251 100644--- a/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/borders/border-property.tsx@@ -9,11 +9,11 @@ import {} from "@webstudio-is/design-system";import { CssValueInputContainer } from "../../shared/css-value-input";import { styleConfigByName } from "../../shared/configs";-import { PropertyName } from "../../shared/property-name";import { getStyleSource } from "../../shared/style-info";import type { SectionProps } from "../shared/section";import { deleteAllProperties, rowCss, setAllProperties } from "./utils";import { useSelectedInstanceKv } from "../../shared/instances-kv";+import { PropertyLabel } from "../../property-label";const borderPropertyStyleValueDefault: UnitValue = {type: "unit",@@ -39,11 +39,12 @@ export const BorderProperty = ({[property in StyleProperty]: { icon?: ReactNode };}>;label: string;- description?: string;+ description: string;}) => {- const borderProperties = Object.keys(borderPropertyOptions) as Array<- keyof typeof borderPropertyOptions- >;+ const borderProperties = Object.keys(borderPropertyOptions) as [+ StyleProperty,+ ...StyleProperty[],+ ];const allPropertyValuesAreEqual =new Set(@@ -109,12 +110,10 @@ export const BorderProperty = ({return (<Grid gap={1}><Grid css={rowCss}>- <PropertyName- style={currentStyle}- properties={borderProperties}+ <PropertyLabellabel={label}description={description}- onReset={() => deleteBorderProperties(firstPropertyName)}+ properties={borderProperties}/><Boxdiff --git a/apps/builder/app/builder/features/style-panel/sections/borders/border-style.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/border-style.tsxindex f09f65d612..13795f0e39 100644--- a/apps/builder/app/builder/features/style-panel/sections/borders/border-style.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/borders/border-style.tsx@@ -6,7 +6,6 @@ import {DottedBorderIcon,SmallXIcon,} from "@webstudio-is/icons";-import { PropertyName } from "../../shared/property-name";import type { SectionProps } from "../shared/section";import { ToggleGroupControl } from "../../controls/toggle-group/toggle-group-control";import {@@ -19,13 +18,14 @@ import {rowCss,isAdvancedValue,} from "./utils";+import { PropertyLabel } from "../../property-label";-export const properties: StyleProperty[] = [+export const properties: [StyleProperty, ...StyleProperty[]] = ["borderTopStyle","borderRightStyle","borderLeftStyle","borderBottomStyle",-] satisfies Array<StyleProperty>;+];const items = [{@@ -83,12 +83,10 @@ export const BorderStyle = (return (<Grid css={rowCss}>- <PropertyName- style={props.currentStyle}- properties={properties}+ <PropertyLabellabel="Style"description={propertyDescriptions.borderBlockStyle}- onReset={handleDelete}+ properties={properties}/><Box css={{ gridColumn: `span 2`, justifySelf: "end" }}><ToggleGroupControldiff --git a/apps/builder/app/builder/features/style-panel/sections/borders/select-group.tsx b/apps/builder/app/builder/features/style-panel/sections/borders/select-group.tsxdeleted file mode 100644index d76a6fb672..0000000000--- a/apps/builder/app/builder/features/style-panel/sections/borders/select-group.tsx+++ /dev/null@@ -1,44 +0,0 @@-import { toValue, type StyleProperty } from "@webstudio-is/css-engine";-import { Grid } from "@webstudio-is/design-system";-import { PropertyName } from "../../shared/property-name";-import { SelectControl } from "../../controls";-import { styleConfigByName } from "../../shared/configs";-import type { SectionProps } from "..";-import type { StyleInfo } from "../../shared/style-info";--export const canUseToggleGroup = (- properties: Array<StyleProperty>,- currentStyle: StyleInfo-) => {- const values = properties.map((property) =>- toValue(currentStyle[property]?.value)- );-- // We can represent the value with a toggle group if all values are the same.- return (- values[0] === values[1] &&- values[0] === values[2] &&- values[0] === values[3]- );-};--export const SelectGroup = ({- properties,- ...props-}: SectionProps & { properties: Array<StyleProperty> }) => {- return (- <Grid columns="2" gap="2">- {properties.map((property) => (- <Grid gap="1" css={{ gridTemplateColumns: "auto" }} key={property}>- <PropertyName- style={props.currentStyle}- properties={[property]}- label={styleConfigByName(property).label}- onReset={() => props.deleteProperty(property)}- />- <SelectControl property={property} {...props} />- </Grid>- ))}- </Grid>- );-};diff --git a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsxindex f206428cd6..d1617b5bd5 100644--- a/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/flex-child/flex-child.tsx@@ -3,7 +3,6 @@ import { toValue } from "@webstudio-is/css-engine";import type { StyleProperty, StyleValue } from "@webstudio-is/css-engine";import type { SectionProps } from "../shared/section";import { ToggleGroupControl } from "../../controls/toggle-group/toggle-group-control";-import { PropertyName } from "../../shared/property-name";import { TextControl } from "../../controls";import {SmallXIcon,@@ -20,6 +19,8 @@ import {} from "@webstudio-is/icons";import { FloatingPanel } from "~/builder/shared/floating-panel";import { CollapsibleSection } from "../../shared/collapsible-section";+import { PropertyLabel } from "../../property-label";+import { propertyDescriptions } from "@webstudio-is/css-data";export const properties = ["flexShrink",@@ -46,20 +47,17 @@ export const Section = (props: SectionProps) => {};const FlexChildSectionAlign = (props: SectionProps) => {- const { deleteProperty, currentStyle } = props;- const property = "alignSelf";return (<Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={[property]}+ <PropertyLabellabel="Align"- onReset={() => deleteProperty(property)}+ description={propertyDescriptions.alignSelf}+ properties={["alignSelf"]}/><ToggleGroupControl{...props}// We don't support "flex" shorthand and this control is manipulating 3 properties at once- property={property}+ property="alignSelf"items={[{child: <SmallXIcon />,@@ -125,12 +123,10 @@ const FlexChildSectionSizing = (props: SectionProps) => {return (<Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={["flexGrow", "flexShrink", "flexBasis"]}+ <PropertyLabellabel="Sizing"description="Specifies the ability of a flex item to grow, shrink, or set its initial size within a flex container."- onReset={onReset}+ properties={["flexGrow", "flexShrink", "flexBasis"]}/><ToggleGroupControl{...props}@@ -252,11 +248,10 @@ const FlexChildSectionSizingPopover = ({}}><Grid css={{ gridTemplateColumns: "auto", gap: theme.spacing[3] }}>- <PropertyName- style={currentStyle}+ <PropertyLabelproperties={["flexGrow"]}+ description={propertyDescriptions.flexGrow}label="Grow"- onReset={() => deleteProperty("flexGrow")}/><TextControlproperty="flexGrow"@@ -266,11 +261,10 @@ const FlexChildSectionSizingPopover = ({/></Grid><Grid css={{ gridTemplateColumns: "auto", gap: theme.spacing[3] }}>- <PropertyName- style={currentStyle}- properties={["flexShrink"]}+ <PropertyLabellabel="Shrink"- onReset={() => deleteProperty("flexShrink")}+ description={propertyDescriptions.flexShrink}+ properties={["flexShrink"]}/><TextControlproperty="flexShrink"@@ -280,11 +274,10 @@ const FlexChildSectionSizingPopover = ({/></Grid><Grid css={{ gridTemplateColumns: "auto", gap: theme.spacing[3] }}>- <PropertyName- style={currentStyle}- properties={["flexBasis"]}+ <PropertyLabellabel="Basis"- onReset={() => deleteProperty("flexBasis")}+ description={propertyDescriptions.flexBasis}+ properties={["flexBasis"]}/><TextControlproperty="flexBasis"@@ -304,21 +297,19 @@ const FlexChildSectionSizingPopover = ({};const FlexChildSectionOrder = (props: SectionProps) => {- const { deleteProperty, setProperty, currentStyle } = props;- const property = "order";- const setOrder = setProperty(property);+ const { setProperty, currentStyle } = props;+ const setOrder = setProperty("order");return (<Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={[property]}+ <PropertyLabellabel="Order"- onReset={() => deleteProperty(property)}+ description={propertyDescriptions.order}+ properties={["order"]}/><ToggleGroupControl{...props}- property={property}+ property="order"setProperty={() => {return (styleValue: StyleValue) => {if (styleValue.type !== "keyword") {@@ -382,11 +373,10 @@ const FlexChildSectionOrderPopover = (props: SectionProps) => {content={<Grid css={{ padding: theme.spacing[9] }}><Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>- <PropertyName- style={currentStyle}- properties={["order"]}+ <PropertyLabellabel="Order"- onReset={() => deleteProperty("order")}+ description={propertyDescriptions.order}+ properties={["order"]}/><TextControlproperty="order"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 3dae9ec1d0..7bafa77428 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@@ -6,6 +6,7 @@ import {Grid,SmallToggleButton,} from "@webstudio-is/design-system";+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty, StyleValue } from "@webstudio-is/css-engine";import { toValue } from "@webstudio-is/css-engine";import {@@ -39,7 +40,6 @@ import {import type { SectionProps } from "../shared/section";import { FlexGrid } from "./shared/flex-grid";import { MenuControl, SelectControl } from "../../controls";-import { PropertyName } from "../../shared/property-name";import { styleConfigByName } from "../../shared/configs";import type { CreateBatchUpdate } from "../../shared/use-style-data";import { getStyleSource, type StyleInfo } from "../../shared/style-info";@@ -52,6 +52,7 @@ import { theme } from "@webstudio-is/design-system";import { TooltipContent } from "../../../style-panel/shared/property-name";import { isFeatureEnabled } from "@webstudio-is/feature-flags";import { ToggleControl } from "../../controls/toggle/toggle-control";+import { PropertyLabel } from "../../property-label";const GapLinked = ({isLinked,@@ -507,7 +508,7 @@ export const Section = ({}: SectionProps) => {const value = toValue(currentStyle.display?.value);- const { label, items } = styleConfigByName("display");+ const { items } = styleConfigByName("display");return (<CollapsibleSectionlabel="Layout"@@ -522,11 +523,10 @@ export const Section = ({alignItems: "center",}}>- <PropertyName- style={currentStyle}+ <PropertyLabel+ label="Display"+ description={propertyDescriptions.display}properties={["display"]}- label={label}- onReset={() => deleteProperty("display")}/><SelectControlproperty="display"diff --git a/apps/builder/app/builder/features/style-panel/sections/list-item.tsx b/apps/builder/app/builder/features/style-panel/sections/list-item.tsxindex 4afbe80481..d7e17acf66 100644--- a/apps/builder/app/builder/features/style-panel/sections/list-item.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/list-item.tsx@@ -1,11 +1,10 @@+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty } from "@webstudio-is/css-engine";import { Grid, theme } from "@webstudio-is/design-system";-import { styleConfigByName } from "../shared/configs";import type { SectionProps } from "./shared/section";-import { PropertyName } from "../shared/property-name";import { SelectControl } from "../controls";-import { CollapsibleSection } from "../shared/collapsible-section";+import { PropertyLabel } from "../property-label";export const properties = ["listStyleType"] satisfies Array<StyleProperty>;@@ -21,11 +20,10 @@ export const Section = ({properties={properties}><Grid gap={2} css={{ gridTemplateColumns: `1fr ${theme.spacing[21]}` }}>- <PropertyName- label={styleConfigByName("listStyleType").label}+ <PropertyLabel+ label="List Style Type"+ description={propertyDescriptions.listStyleType}properties={["listStyleType"]}- style={style}- onReset={() => deleteProperty("listStyleType")}/><SelectControlproperty={"listStyleType"}diff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline-offset.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline-offset.tsxindex 59545f5c4a..4d193bdba0 100644--- a/apps/builder/app/builder/features/style-panel/sections/outline/outline-offset.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline-offset.tsx@@ -1,10 +1,11 @@+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty, UnitValue } from "@webstudio-is/css-engine";import { Grid, theme } from "@webstudio-is/design-system";import { CssValueInputContainer } from "../../shared/css-value-input";import type { SectionProps } from "../shared/section";-import { PropertyName } from "../../shared/property-name";import { styleConfigByName } from "../../shared/configs";import { getStyleSource } from "../../shared/style-info";+import { PropertyLabel } from "../../property-label";const property: StyleProperty = "outlineOffset";const defaultOutlineOffsetValue: UnitValue = {@@ -34,15 +35,13 @@ export const OutlineOffset = (}}gap={2}>- <PropertyName- properties={[property]}- style={props.currentStyle}- label={"Offset"}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Offset"+ description={propertyDescriptions.outlineOffset}+ properties={["outlineOffset"]}/><CssValueInputContainer- key={property}property={property}styleSource={getStyleSource(currentStyle[property])}keywords={outlineOffsetWidthKeywords}diff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline-style.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline-style.tsxindex ff297274ed..27477602ea 100644--- a/apps/builder/app/builder/features/style-panel/sections/outline/outline-style.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline-style.tsx@@ -7,9 +7,12 @@ import {SmallXIcon,} from "@webstudio-is/icons";import type { SectionProps } from "../shared/section";-import { PropertyName } from "../../shared/property-name";-import { declarationDescriptions } from "@webstudio-is/css-data";+import {+ declarationDescriptions,+ propertyDescriptions,+} from "@webstudio-is/css-data";import { ToggleGroupControl } from "../../controls/toggle-group/toggle-group-control";+import { PropertyLabel } from "../../property-label";const property: StyleProperty = "outlineStyle";@@ -47,8 +50,6 @@ const items = [export const OutlineStyle = (props: Pick<SectionProps, "currentStyle" | "setProperty" | "deleteProperty">) => {- const { deleteProperty } = props;-return (<Gridcss={{@@ -56,11 +57,10 @@ export const OutlineStyle = (}}gap={2}>- <PropertyName- properties={[property]}- style={props.currentStyle}- label={"Style"}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Style"+ description={propertyDescriptions.outlineStyle}+ properties={["outlineStyle"]}/><Box css={{ gridColumn: `span 2`, justifySelf: "end" }}><ToggleGroupControl {...props} items={items} property={property} />{" "}diff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline-width.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline-width.tsxindex 2da9498c9f..082e80b189 100644--- a/apps/builder/app/builder/features/style-panel/sections/outline/outline-width.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline-width.tsx@@ -1,10 +1,11 @@+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty } from "@webstudio-is/css-engine";import { Grid, theme } from "@webstudio-is/design-system";import type { SectionProps } from "../shared/section";-import { PropertyName } from "../../shared/property-name";import { CssValueInputContainer } from "../../shared/css-value-input";import { styleConfigByName } from "../../shared/configs";import { getStyleSource } from "../../shared/style-info";+import { PropertyLabel } from "../../property-label";const property: StyleProperty = "outlineWidth";@@ -26,11 +27,10 @@ export const OutlineWidth = (}}gap={2}>- <PropertyName- properties={[property]}- style={props.currentStyle}- label={"Width"}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Width"+ description={propertyDescriptions.outlineWidth}+ properties={["outlineWidth"]}/><CssValueInputContainerdiff --git a/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx b/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsxindex 6c5cf0d1da..7245effa30 100644--- a/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/outline/outline.tsx@@ -1,14 +1,14 @@import { Flex, Grid, theme, Box } from "@webstudio-is/design-system";+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty } from "@webstudio-is/css-engine";import { ColorControl } from "../../controls";import { CollapsibleSection } from "../../shared/collapsible-section";import type { SectionProps } from "../shared/section";import { OutlineStyle } from "./outline-style";-import { PropertyName } from "../../shared/property-name";import { OutlineWidth } from "./outline-width";import { OutlineOffset } from "./outline-offset";+import { PropertyLabel } from "../../property-label";-const property: StyleProperty = "outlineColor";export const properties = ["outlineStyle","outlineColor",@@ -44,11 +44,10 @@ export const Section = (props: SectionProps) => {}}gapX={2}>- <PropertyName- style={currentStyle}- properties={[property]}- label={"Color"}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Color"+ description={propertyDescriptions.outlineColor}+ properties={["outlineColor"]}/><Box@@ -57,7 +56,7 @@ export const Section = (props: SectionProps) => {}}><ColorControl- property={property}+ property="outlineColor"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}diff --git a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx b/apps/builder/app/builder/features/style-panel/sections/position/position.tsxindex d5de8a5384..6aad599e10 100644--- a/apps/builder/app/builder/features/style-panel/sections/position/position.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/position/position.tsx@@ -3,10 +3,11 @@ import type { SectionProps } from "../shared/section";import { CollapsibleSection } from "../../shared/collapsible-section";import { Grid, theme } from "@webstudio-is/design-system";import { SelectControl, TextControl } from "../../controls";-import { PropertyName } from "../../shared/property-name";import { styleConfigByName } from "../../shared/configs";import { PositionControl } from "./position-control";import { useParentStyle } from "../../parent-style";+import { PropertyLabel } from "../../property-label";+import { propertyDescriptions } from "@webstudio-is/css-data";export const properties = ["position",@@ -66,11 +67,10 @@ export const Section = ({gridTemplateColumns: `1fr ${theme.spacing[23]}`,}}>- <PropertyName- label={styleConfigByName("position").label}+ <PropertyLabel+ label="Position"+ description={propertyDescriptions.position}properties={["position"]}- style={currentStyle}- onReset={() => deleteProperty("position")}/><SelectControlproperty={"position"}@@ -81,11 +81,10 @@ export const Section = ({/>{showZindexControl && showPositionControls === false && (<>- <PropertyName- label={styleConfigByName("zIndex").label}+ <PropertyLabel+ label="Z Index"+ description={propertyDescriptions.zIndex}properties={["zIndex"]}- style={currentStyle}- onReset={() => deleteProperty("zIndex")}/><TextControlproperty={"zIndex"}@@ -105,11 +104,10 @@ export const Section = ({createBatchUpdate={createBatchUpdate}/><Grid gap={1}>- <PropertyName- label={styleConfigByName("zIndex").label}+ <PropertyLabel+ label="Z Index"+ description={propertyDescriptions.zIndex}properties={["zIndex"]}- style={currentStyle}- onReset={() => deleteProperty("zIndex")}/><TextControlproperty={"zIndex"}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 62e9eb4560..ea07de32a7 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@@ -1,3 +1,4 @@+import { propertyDescriptions } from "@webstudio-is/css-data";import type { StyleProperty } from "@webstudio-is/css-engine";import {Flex,@@ -6,9 +7,7 @@ import {Separator,styled,} from "@webstudio-is/design-system";-import { styleConfigByName } from "../../shared/configs";import type { SectionProps } from "../shared/section";-import { PropertyName } from "../../shared/property-name";import {PositionControl,SelectControl,@@ -27,6 +26,8 @@ import { theme } from "@webstudio-is/design-system";import { ToggleGroupControl } from "../../controls/toggle-group/toggle-group-control";import { getStyleSourceColor } from "../../shared/style-info";import { FloatingPanel } from "~/builder/shared/floating-panel";+import { humanizeString } from "~/shared/string-utils";+import { PropertyLabel } from "../../property-label";const SizeProperty = ({property,@@ -34,14 +35,14 @@ const SizeProperty = ({setProperty,deleteProperty,}: ControlProps) => {- const { label } = styleConfigByName(property);return (<Grid gap={1}>- <PropertyName- label={label}+ <PropertyLabel+ label={humanizeString(property)}+ description={+ propertyDescriptions[property as keyof typeof propertyDescriptions]+ }properties={[property]}- style={currentStyle}- onReset={() => deleteProperty(property)}/><TextControlproperty={property}@@ -167,11 +168,10 @@ export const Section = ({setProperty={setProperty}deleteProperty={deleteProperty}/>- <PropertyName- label={styleConfigByName("aspectRatio").label}+ <PropertyLabel+ label="Aspect Ratio"+ description={propertyDescriptions.aspectRatio}properties={["aspectRatio"]}- style={currentStyle}- onReset={() => deleteProperty("aspectRatio")}/><TextControlproperty={"aspectRatio"}@@ -182,16 +182,10 @@ export const Section = ({</SectionLayout><Separator /><SectionLayout columns={2}>- <PropertyName+ <PropertyLabellabel="Overflow"+ description={propertyDescriptions.overflow}properties={["overflowX", "overflowY"]}- style={currentStyle}- onReset={() => {- const batch = createBatchUpdate();- deleteProperty("overflowX");- deleteProperty("overflowY");- batch.publish();- }}/><ToggleGroupControlproperty="overflowX"@@ -244,11 +238,10 @@ export const Section = ({},]}/>- <PropertyName- label={styleConfigByName("objectFit").label}+ <PropertyLabel+ label="Object Fit"+ description={propertyDescriptions.objectFit}properties={["objectFit"]}- style={currentStyle}- onReset={() => deleteProperty("objectFit")}/><SelectControlproperty="objectFit"@@ -256,11 +249,10 @@ export const Section = ({setProperty={setProperty}deleteProperty={deleteProperty}/>- <PropertyName- label={styleConfigByName("objectPosition").label}+ <PropertyLabel+ label="Object Position"+ description={propertyDescriptions.objectPosition}properties={["objectPosition"]}- style={currentStyle}- onReset={() => deleteProperty("objectPosition")}/><ObjectPositionproperty="objectPosition"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 21505c796b..871a3ced32 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@@ -1,3 +1,4 @@+import { propertyDescriptions } from "@webstudio-is/css-data";import type { SectionProps } from "../shared/section";import {Label,@@ -13,13 +14,13 @@ import {UnitValue,type StyleProperty,} from "@webstudio-is/css-engine";-import { PropertyName } from "../../shared/property-name";import { styleConfigByName } from "../../shared/configs";import { useMemo } from "react";import { extractTransformOrPerspectiveOriginValues } from "./transform-extractors";import { CssValueInputContainer } from "../../shared/css-value-input";import type { StyleUpdateOptions } from "../../shared/use-style-data";import { calculatePositionFromOrigin } from "./transform-utils";+import { PropertyLabel } from "../../property-label";// Fake properties to use in the CssValueInputContainer// x, y axis takes length | percentage | keyword@@ -31,7 +32,7 @@ const fakePropertyZ: StyleProperty = "outlineOffset";export const TransformAndPerspectiveOrigin = (props: SectionProps & { property: StyleProperty }) => {- const { currentStyle, deleteProperty, setProperty, property } = props;+ const { currentStyle, setProperty, property } = props;const value = currentStyle[property]?.local;const { label } = styleConfigByName(property);const origin = useMemo(() => {@@ -132,11 +133,12 @@ export const TransformAndPerspectiveOrigin = (px: theme.spacing[9],}}>- <PropertyName+ <PropertyLabellabel={label}+ description={+ propertyDescriptions[property as keyof typeof propertyDescriptions]+ }properties={[property]}- style={currentStyle}- onReset={() => deleteProperty(property)}/><Flex gap="6"><Grid css={{ gridTemplateColumns: "1fr 1fr" }} align="center" gapX="2">diff --git a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-backface-visibility.tsx b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-backface-visibility.tsxindex 8b4ecdbc66..1d3c8cc2d7 100644--- a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-backface-visibility.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-backface-visibility.tsx@@ -1,16 +1,12 @@-import { type StyleProperty } from "@webstudio-is/css-engine";+import { propertyDescriptions } from "@webstudio-is/css-data";import { Grid, theme } from "@webstudio-is/design-system";import { TextControl } from "../../controls";-import { PropertyName } from "../../shared/property-name";-import { styleConfigByName } from "../../shared/configs";import type { SectionProps } from "../shared/section";--const property: StyleProperty = "backfaceVisibility";+import { PropertyLabel } from "../../property-label";export const BackfaceVisibility = (props: SectionProps) => {const { currentStyle, setProperty, deleteProperty } = props;- const value = currentStyle[property]?.local;- const { label } = styleConfigByName(property);+ const value = currentStyle.backfaceVisibility?.local;if (value?.type !== "keyword") {return;@@ -23,14 +19,13 @@ export const BackfaceVisibility = (props: SectionProps) => {gridTemplateColumns: `2fr 1fr`,}}>- <PropertyName- label={label}- properties={[property]}- style={currentStyle}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Backface Visibility"+ description={propertyDescriptions.backfaceVisibility}+ properties={["backfaceVisibility"]}/><TextControl- property={property}+ property="backfaceVisibility"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}diff --git a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-perspective.tsx b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-perspective.tsxindex 6d01a3f94c..b462006c74 100644--- a/apps/builder/app/builder/features/style-panel/sections/transforms/transform-perspective.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transforms/transform-perspective.tsx@@ -1,16 +1,12 @@-import { type StyleProperty } from "@webstudio-is/css-engine";+import { propertyDescriptions } from "@webstudio-is/css-data";import { Grid, theme } from "@webstudio-is/design-system";import { TextControl } from "../../controls";-import { PropertyName } from "../../shared/property-name";-import { styleConfigByName } from "../../shared/configs";import type { SectionProps } from "../shared/section";--const property: StyleProperty = "perspective";+import { PropertyLabel } from "../../property-label";export const TransformPerspective = (props: SectionProps) => {const { currentStyle, setProperty, deleteProperty } = props;- const { label } = styleConfigByName(property);- const value = currentStyle[property]?.local;+ const value = currentStyle.perspective?.local;if (value?.type !== "keyword" && value?.type !== "unit") {return;@@ -23,14 +19,13 @@ export const TransformPerspective = (props: SectionProps) => {gridTemplateColumns: `2fr 1fr`,}}>- <PropertyName- label={label}- properties={[property]}- style={currentStyle}- onReset={() => deleteProperty(property)}+ <PropertyLabel+ label="Perspective"+ description={propertyDescriptions.perspective}+ properties={["perspective"]}/><TextControl- property={property}+ property="perspective"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}diff --git a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsxindex f2239c1194..87143814c1 100644--- a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx@@ -9,7 +9,6 @@ import {import { propertyDescriptions } from "@webstudio-is/css-data";import { toValue, type StyleProperty } from "@webstudio-is/css-engine";import type { SectionProps } from "../shared/section";-import { PropertyName } from "../../shared/property-name";import {ColorControl,FontFamilyControl,@@ -124,11 +123,10 @@ export const TypographySectionSizing = (props: SectionProps) => {return (<Grid gap="2" css={{ gridTemplateColumns: "1fr 1fr 1fr" }}><Grid gap="1">- <PropertyName- style={currentStyle}- properties={["fontSize"]}+ <PropertyLabellabel="Size"- onReset={() => deleteProperty("fontSize")}+ description={propertyDescriptions.fontSize}+ properties={["fontSize"]}/><TextControlproperty="fontSize"@@ -138,11 +136,10 @@ export const TypographySectionSizing = (props: SectionProps) => {/></Grid><Grid gap="1">- <PropertyName- style={currentStyle}- properties={["lineHeight"]}+ <PropertyLabellabel="Height"- onReset={() => deleteProperty("lineHeight")}+ description={propertyDescriptions.lineHeight}+ properties={["lineHeight"]}/><TextControlproperty="lineHeight"@@ -152,11 +149,10 @@ export const TypographySectionSizing = (props: SectionProps) => {/></Grid><Grid gap="1">- <PropertyName- style={currentStyle}- properties={["letterSpacing"]}+ <PropertyLabellabel="Spacing"- onReset={() => deleteProperty("letterSpacing")}+ description={propertyDescriptions.letterSpacing}+ properties={["letterSpacing"]}/><TextControlproperty="letterSpacing"@@ -349,18 +345,18 @@ const AdvancedOptionsButton = forwardRef<});AdvancedOptionsButton.displayName = "AdvancedOptionsButton";+const advancedProperties: StyleProperty[] = [+ "whiteSpaceCollapse",+ "textWrapMode",+ "textWrapStyle",+ "direction",+ "hyphens",+ "textOverflow",+];+export const TypographySectionAdvancedPopover = (props: SectionProps) => {const { deleteProperty, setProperty, createBatchUpdate, currentStyle } =props;- const properties = {- whiteSpaceCollapse: "whiteSpaceCollapse",- textWrapMode: "textWrapMode",- textWrapStyle: "textWrapStyle",- direction: "direction",- hyphens: "hyphens",- textOverflow: "textOverflow",- } as const; // in Record<StyleProperty, StyleProperty>//{ [key: StyleProperty]: StyleProperty } { [key in StyleProperty]: string };-return (<FloatingPaneltitle="Advanced Typography"@@ -373,58 +369,53 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {}}><Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>- <PropertyName- style={currentStyle}- properties={[properties.whiteSpaceCollapse]}+ <PropertyLabellabel="White Space"- onReset={() => deleteProperty(properties.whiteSpaceCollapse)}+ description={propertyDescriptions.whiteSpaceCollapse}+ properties={["whiteSpaceCollapse"]}/><SelectControl- property={properties.whiteSpaceCollapse}+ property="whiteSpaceCollapse"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}/></Grid>- {/* @todo cannot set because not supported in browser ??? */}<Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>- <PropertyName- style={currentStyle}- properties={[properties.textWrapMode]}+ <PropertyLabellabel="Wrap Mode"- onReset={() => deleteProperty(properties.textWrapMode)}+ description={propertyDescriptions.textWrapMode}+ properties={["textWrapMode"]}/><SelectControl- property={properties.textWrapMode}+ property="textWrapMode"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}/></Grid><Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>- <PropertyName- style={currentStyle}- properties={[properties.textWrapStyle]}+ <PropertyLabellabel="Wrap Style"- onReset={() => deleteProperty(properties.textWrapStyle)}+ description={propertyDescriptions.textWrapStyle}+ properties={["textWrapStyle"]}/><SelectControl- property={properties.textWrapStyle}+ property="textWrapStyle"currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}/></Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={[properties.direction]}+ <PropertyLabellabel="Direction"- onReset={() => deleteProperty(properties.direction)}+ description={propertyDescriptions.direction}+ properties={["direction"]}/><ToggleGroupControl{...props}- property={properties.direction}+ property="direction"items={[{child: <TextDirectionLTRIcon />,@@ -446,15 +437,14 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {/></Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={[properties.hyphens]}+ <PropertyLabellabel="Hyphens"- onReset={() => deleteProperty(properties.hyphens)}+ description={propertyDescriptions.hyphens}+ properties={["hyphens"]}/><ToggleGroupControl{...props}- property={properties.hyphens}+ property="hyphens"items={[{child: <CrossSmallIcon />,@@ -476,15 +466,14 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {/></Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}>- <PropertyName- style={currentStyle}- properties={[properties.textOverflow]}+ <PropertyLabellabel="Text Overflow"- onReset={() => deleteProperty(properties.textOverflow)}+ description={propertyDescriptions.textOverflow}+ properties={["textOverflow"]}/><ToggleGroupControl{...props}- property={properties.textOverflow}+ property="textOverflow"items={[{child: <CrossSmallIcon />,@@ -510,10 +499,10 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {><AdvancedOptionsButtoncurrentStyle={currentStyle}- properties={Object.values(properties)}+ properties={advancedProperties}onReset={() => {const batch = createBatchUpdate();- Object.values(properties).forEach((property) => {+ Object.values(advancedProperties).forEach((property) => {batch.deleteProperty(property);});batch.publish();