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: Show advanced typography styles state using ellipsis icon dots (#2888)
Oleg Isonena34afe816060
diff --git a/apps/builder/app/builder/features/sidebar-left/panels/pages/pages.tsx b/apps/builder/app/builder/features/sidebar-left/panels/pages/pages.tsxindex 5447faf95f..de2d2f4b6f 100644--- a/apps/builder/app/builder/features/sidebar-left/panels/pages/pages.tsx+++ b/apps/builder/app/builder/features/sidebar-left/panels/pages/pages.tsx@@ -18,7 +18,7 @@ import {ChevronRightIcon,FolderIcon,HomeIcon,- MenuIcon,+ EllipsesIcon,NewFolderIcon,NewPageIcon,PageIcon,@@ -110,7 +110,7 @@ const ItemSuffix = ({onClick={() => onEdit(isEditing ? undefined : itemId)}ref={buttonRef}>- {isEditing ? <ChevronRightIcon /> : <MenuIcon />}+ {isEditing ? <ChevronRightIcon /> : <EllipsesIcon />}</MenuButton></Tooltip>);diff --git a/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx b/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsxindex 8c225550c3..acbdbd8081 100644--- a/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx+++ b/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx@@ -1,7 +1,7 @@import { Flex, IconButton, theme } from "@webstudio-is/design-system";import type { ControlProps } from "../../style-sections";import { FloatingPanel } from "~/builder/shared/floating-panel";-import { MenuIcon } from "@webstudio-is/icons";+import { EllipsesIcon } from "@webstudio-is/icons";import { PositionControl } from "../position/position-control";export const ObjectPositionControl = ({@@ -26,7 +26,7 @@ export const ObjectPositionControl = ({}><IconButton>- <MenuIcon />+ <EllipsesIcon /></IconButton></FloatingPanel></Flex>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 83071041c1..d3fbec12cd 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@@ -4,6 +4,7 @@ import {EnhancedTooltip,theme,IconButton,+ rawTheme,} from "@webstudio-is/design-system";import { toValue } from "@webstudio-is/css-engine";import type { StyleProperty } from "@webstudio-is/css-engine";@@ -36,8 +37,8 @@ import {} from "@webstudio-is/icons";import { ToggleGroupControl } from "../../controls/toggle/toggle-control";import { FloatingPanel } from "~/builder/shared/floating-panel";-import { getStyleSource } from "../../shared/style-info";-import { CollapsibleSection } from "../../shared/collapsible-section";+import { getStyleSource, type StyleInfo } from "../../shared/style-info";+import { CollapsibleSection, getDots } from "../../shared/collapsible-section";import { forwardRef, type ComponentProps } from "react";const properties: StyleProperty[] = [@@ -363,13 +364,28 @@ export const TypographySectionAdvanced = (props: RenderCategoryProps) => {const AdvancedOptionsButton = forwardRef<HTMLButtonElement,- ComponentProps<typeof IconButton>->((props, ref) => {+ ComponentProps<typeof IconButton> & {+ currentStyle: StyleInfo;+ properties: StyleProperty[];+ /** https://www.radix-ui.com/docs/primitives/components/collapsible#trigger */+ "data-state"?: "open" | "closed";+ }+>(({ currentStyle, properties, ...rest }, ref) => {+ const dots = getDots(currentStyle, properties);+ const finalDots = rest["data-state"] === "open" ? [] : dots ?? [];+ const dotColors = {+ local: rawTheme.colors.foregroundLocalFlexUi,+ overwritten: rawTheme.colors.foregroundOverwrittenFlexUi,+ remote: rawTheme.colors.foregroundRemoteFlexUi,+ };++ const colors = finalDots.map((dot) => dotColors[dot]);+return (<Flex><EnhancedTooltip content="More typography options">- <IconButton {...props} ref={ref}>- <EllipsesIcon />+ <IconButton {...rest} ref={ref}>+ <EllipsesIcon colors={colors} /></IconButton></EnhancedTooltip></Flex>@@ -384,6 +400,13 @@ export const TypographySectionAdvancedPopover = (const setDirection = setProperty("direction");const setTextOverflow = setProperty("textOverflow");const setHyphens = setProperty("hyphens");+ const properties = {+ whiteSpace: "whiteSpace",+ direction: "direction",+ hyphens: "hyphens",+ textOverflow: "textOverflow",+ } as const;+return (<FloatingPaneltitle="Advanced Typography"@@ -398,12 +421,12 @@ export const TypographySectionAdvancedPopover = (<Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}><PropertyNamestyle={currentStyle}- properties={["whiteSpace"]}+ properties={[properties.whiteSpace]}label="White Space"- onReset={() => deleteProperty("whiteSpace")}+ onReset={() => deleteProperty(properties.whiteSpace)}/><SelectControl- property="whiteSpace"+ property={properties.whiteSpace}currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}@@ -412,9 +435,9 @@ export const TypographySectionAdvancedPopover = (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyNamestyle={currentStyle}- properties={["direction"]}+ properties={[properties.direction]}label="Direction"- onReset={() => deleteProperty("direction")}+ onReset={() => deleteProperty(properties.direction)}/><ToggleGroupControlstyle={currentStyle}@@ -445,9 +468,9 @@ export const TypographySectionAdvancedPopover = (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyNamestyle={currentStyle}- properties={["hyphens"]}+ properties={[properties.hyphens]}label="Hyphens"- onReset={() => deleteProperty("hyphens")}+ onReset={() => deleteProperty(properties.hyphens)}/><ToggleGroupControlstyle={currentStyle}@@ -476,9 +499,9 @@ export const TypographySectionAdvancedPopover = (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyNamestyle={currentStyle}- properties={["textOverflow"]}+ properties={[properties.textOverflow]}label="Text Overflow"- onReset={() => deleteProperty("textOverflow")}+ onReset={() => deleteProperty(properties.textOverflow)}/><ToggleGroupControlstyle={currentStyle}@@ -509,7 +532,10 @@ export const TypographySectionAdvancedPopover = (</Grid>}>- <AdvancedOptionsButton />+ <AdvancedOptionsButton+ currentStyle={currentStyle}+ properties={Object.values(properties)}+ /></FloatingPanel>);};diff --git a/apps/builder/app/builder/shared/fonts-manager/item-menu.tsx b/apps/builder/app/builder/shared/fonts-manager/item-menu.tsxindex 9bd3c68440..bc0f1eb15b 100644--- a/apps/builder/app/builder/shared/fonts-manager/item-menu.tsx+++ b/apps/builder/app/builder/shared/fonts-manager/item-menu.tsx@@ -10,7 +10,7 @@ import {styled,Tooltip,} from "@webstudio-is/design-system";-import { MenuIcon } from "@webstudio-is/icons";+import { EllipsesIcon } from "@webstudio-is/icons";import { type FocusEventHandler, useState, useRef, useEffect } from "react";import { theme } from "@webstudio-is/design-system";import { $authPermit } from "~/shared/nano-states";@@ -75,7 +75,7 @@ const ItemMenu = ({event.stopPropagation();}}>- <MenuIcon />+ <EllipsesIcon /></MenuButton></DropdownMenuTrigger><DropdownMenuPortal>diff --git a/apps/builder/app/dashboard/projects/project-card.tsx b/apps/builder/app/dashboard/projects/project-card.tsxindex 7dc7ab6109..d8ccd21960 100644--- a/apps/builder/app/dashboard/projects/project-card.tsx+++ b/apps/builder/app/dashboard/projects/project-card.tsx@@ -14,7 +14,7 @@ import {rawTheme,Link,} from "@webstudio-is/design-system";-import { InfoCircleIcon, MenuIcon } from "@webstudio-is/icons";+import { InfoCircleIcon, EllipsesIcon } from "@webstudio-is/icons";import { type KeyboardEvent, useEffect, useRef, useState } from "react";import { builderPath, getPublishedUrl } from "~/shared/router-utils";import {@@ -99,7 +99,7 @@ const Menu = ({tabIndex={tabIndex}css={{ alignSelf: "center" }}>- <MenuIcon width={15} height={15} />+ <EllipsesIcon width={15} height={15} /></IconButton></DropdownMenuTrigger><DropdownMenuPortal>diff --git a/apps/builder/app/shared/share-project/share-project.tsx b/apps/builder/app/shared/share-project/share-project.tsxindex 9dcdebc995..43a772495a 100644--- a/apps/builder/app/shared/share-project/share-project.tsx+++ b/apps/builder/app/shared/share-project/share-project.tsx@@ -21,7 +21,12 @@ import {Link,buttonStyle,} from "@webstudio-is/design-system";-import { CopyIcon, MenuIcon, PlusIcon, HelpIcon } from "@webstudio-is/icons";+import {+ CopyIcon,+ EllipsesIcon,+ PlusIcon,+ HelpIcon,+} from "@webstudio-is/icons";import { Fragment, useState, type ComponentProps, type ReactNode } from "react";const Item = (props: ComponentProps<typeof Flex>) => (@@ -112,7 +117,7 @@ const Menu = ({<Popover open={isOpen} onOpenChange={setIsOpen}><PopoverTrigger asChild><Button- prefix={<MenuIcon />}+ prefix={<EllipsesIcon />}color="ghost"aria-label="Menu Button for options"></Button>diff --git a/packages/design-system/src/components/__DEPRECATED__/list.stories.tsx b/packages/design-system/src/components/__DEPRECATED__/list.stories.tsxindex ecbbb037e7..6b535dbf72 100644--- a/packages/design-system/src/components/__DEPRECATED__/list.stories.tsx+++ b/packages/design-system/src/components/__DEPRECATED__/list.stories.tsx@@ -1,5 +1,5 @@import type { ComponentStory } from "@storybook/react";-import { CheckMarkIcon, MenuIcon } from "@webstudio-is/icons";+import { CheckMarkIcon, EllipsesIcon } from "@webstudio-is/icons";import { useState } from "react";import { DeprecatedList, DeprecatedListItem, useDeprecatedList } from "./list";@@ -13,12 +13,12 @@ export const Declarative: ComponentStory<typeof DeprecatedList> = () => {<DeprecatedListItem>Apple</DeprecatedListItem><DeprecatedListItem state="disabled">Banana</DeprecatedListItem><DeprecatedListItem state="selected">Orange</DeprecatedListItem>- <DeprecatedListItem prefix={<CheckMarkIcon />} suffix={<MenuIcon />}>+ <DeprecatedListItem prefix={<CheckMarkIcon />} suffix={<EllipsesIcon />}>Strawberry</DeprecatedListItem><DeprecatedListItemprefix={<CheckMarkIcon />}- suffix={<MenuIcon />}+ suffix={<EllipsesIcon />}currentstate="selected">diff --git a/packages/design-system/src/components/button.stories.tsx b/packages/design-system/src/components/button.stories.tsxindex 32ee09f52e..bc444aec62 100644--- a/packages/design-system/src/components/button.stories.tsx+++ b/packages/design-system/src/components/button.stories.tsx@@ -1,5 +1,5 @@import type { ComponentProps } from "react";-import { MenuIcon, CrossIcon, TrashIcon } from "@webstudio-is/icons";+import { EllipsesIcon, CrossIcon, TrashIcon } from "@webstudio-is/icons";import { Button as ButtonComponent } from "./button";import {Popover,@@ -16,7 +16,7 @@ export default {const iconsMap = {undefined: undefined,- "<MenuIcon>": <MenuIcon />,+ "<EllipsesIcon>": <EllipsesIcon />,"<CrossIcon>": <CrossIcon />,"<TrashIcon>": <TrashIcon />,} as const;diff --git a/packages/design-system/src/components/menu.stories.tsx b/packages/design-system/src/components/menu.stories.tsxindex c408f99a2d..6846d87524 100644--- a/packages/design-system/src/components/menu.stories.tsx+++ b/packages/design-system/src/components/menu.stories.tsx@@ -39,7 +39,7 @@ import { Button } from "./button";import {ChevronDownIcon,TrashIcon,- MenuIcon,+ EllipsesIcon,DotIcon,} from "@webstudio-is/icons";import { useState } from "react";@@ -55,7 +55,7 @@ const DropdownDemo = ({ withIndicator }: { withIndicator: boolean }) => {return (<DropdownMenu defaultOpen><DropdownMenuTrigger asChild>- <Button prefix={<MenuIcon />} />+ <Button prefix={<EllipsesIcon />} /></DropdownMenuTrigger><DropdownMenuContent width="regular"><DropdownMenuLabel>Not choosable</DropdownMenuLabel>diff --git a/packages/design-system/src/components/small-icon-button.stories.tsx b/packages/design-system/src/components/small-icon-button.stories.tsxindex b12af5e8f5..95621a7280 100644--- a/packages/design-system/src/components/small-icon-button.stories.tsx+++ b/packages/design-system/src/components/small-icon-button.stories.tsx@@ -1,5 +1,5 @@import type { ComponentProps } from "react";-import { MenuIcon, CrossIcon, TrashIcon } from "@webstudio-is/icons";+import { EllipsesIcon, CrossIcon, TrashIcon } from "@webstudio-is/icons";import {SmallIconButton,smallIconButtonStates,@@ -8,7 +8,7 @@ import {import { StorySection, StoryGrid } from "./storybook";const iconsMap = {- "<MenuIcon>": <MenuIcon />,+ "<EllipsesIcon>": <EllipsesIcon />,"<CrossIcon>": <CrossIcon />,"<TrashIcon>": <TrashIcon />,} as const;@@ -73,7 +73,7 @@ Demo.argTypes = {};Demo.args = {- icon: "<MenuIcon>",+ icon: "<EllipsesIcon>",variant: "normal",state: undefined,focused: false,diff --git a/packages/icons/src/ellipses.tsx b/packages/icons/src/ellipses.tsxindex 11679ad8cb..d69f9bdb2b 100644--- a/packages/icons/src/ellipses.tsx+++ b/packages/icons/src/ellipses.tsx@@ -1,8 +1,12 @@import * as React from "react";import type { IconProps } from "./types";-export const EllipsesIcon = React.forwardRef<SVGSVGElement, IconProps>(- ({ color = "currentColor", ...props }, forwardedRef) => {+type EllipsesIconProps = IconProps & {+ colors?: Array<string>;+};++export const EllipsesIcon = React.forwardRef<SVGSVGElement, EllipsesIconProps>(+ ({ color = "currentColor", colors = [], ...props }, forwardedRef) => {return (<svgxmlns="http://www.w3.org/2000/svg"@@ -13,9 +17,9 @@ export const EllipsesIcon = React.forwardRef<SVGSVGElement, IconProps>({...props}ref={forwardedRef}>- <circle cx="2.5" cy="8" r="1.5" fill={color} />- <circle cx="8" cy="8" r="1.5" fill={color} />- <circle cx="13.5" cy="8" r="1.5" fill={color} />+ <circle cx="2.3" cy="8" r="1.8" fill={colors[0] ?? color} />+ <circle cx="8" cy="8" r="1.8" fill={colors[1] ?? color} />+ <circle cx="14" cy="8" r="1.8" fill={colors[2] ?? color} /></svg>);}diff --git a/packages/icons/src/index.ts b/packages/icons/src/index.tsindex 294042b5af..b6b57c8998 100644--- a/packages/icons/src/index.ts+++ b/packages/icons/src/index.ts@@ -22,7 +22,6 @@ export * from "./chevron-double-right";export * from "./cross-circled-filled";export * from "./cross";export * from "./magnifying-glass";-export * from "./menu";export * from "./cross-small";export * from "./cross-large";export * from "./ellipses";diff --git a/packages/icons/src/menu.tsx b/packages/icons/src/menu.tsxdeleted file mode 100644index 930623cf46..0000000000--- a/packages/icons/src/menu.tsx+++ /dev/null@@ -1,33 +0,0 @@-import * as React from "react";-import type { IconProps } from "./types";--export const MenuIcon = React.forwardRef<SVGSVGElement, IconProps>(- ({ color = "currentColor", ...props }, forwardedRef) => {- return (- <svg- width="16"- height="16"- viewBox="0 0 16 16"- fill="none"- xmlns="http://www.w3.org/2000/svg"- {...props}- ref={forwardedRef}- >- <path- d="M4 8C4 8.82843 3.32843 9.5 2.5 9.5C1.67157 9.5 1 8.82843 1 8C1 7.17157 1.67157 6.5 2.5 6.5C3.32843 6.5 4 7.17157 4 8Z"- fill={color}- />- <path- d="M9.5 8C9.5 8.82843 8.82843 9.5 8 9.5C7.17157 9.5 6.5 8.82843 6.5 8C6.5 7.17157 7.17157 6.5 8 6.5C8.82843 6.5 9.5 7.17157 9.5 8Z"- fill={color}- />- <path- d="M15 8C15 8.82843 14.3284 9.5 13.5 9.5C12.6716 9.5 12 8.82843 12 8C12 7.17157 12.6716 6.5 13.5 6.5C14.3284 6.5 15 7.17157 15 8Z"- fill={color}- />- </svg>- );- }-);--MenuIcon.displayName = "MenuIcon";