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
Menu design update (#799)
Roman Pominovee8e1bedd38f
diff --git a/.lostpixel/baseline/components-combobox--complex.png b/.lostpixel/baseline/components-combobox--complex.pngindex aaa35a7e39..99eaf17975 100644Binary files a/.lostpixel/baseline/components-combobox--complex.png and b/.lostpixel/baseline/components-combobox--complex.png differdiff --git a/.lostpixel/baseline/components-combobox--simple.png b/.lostpixel/baseline/components-combobox--simple.pngdeleted file mode 100644index 6cf00a3973..0000000000Binary files a/.lostpixel/baseline/components-combobox--simple.png and /dev/null differdiff --git a/.lostpixel/baseline/library-menu--menu.png b/.lostpixel/baseline/library-menu--menu.pngnew file mode 100644index 0000000000..3f2ccffb2fBinary files /dev/null and b/.lostpixel/baseline/library-menu--menu.png differdiff --git a/apps/designer/app/designer/features/topbar/menu/menu.tsx b/apps/designer/app/designer/features/topbar/menu/menu.tsxindex 8bcaf2404f..46a5260d61 100644--- a/apps/designer/app/designer/features/topbar/menu/menu.tsx+++ b/apps/designer/app/designer/features/topbar/menu/menu.tsx@@ -4,6 +4,7 @@ import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuItemRightSlot,DropdownMenuSub,DropdownMenuSubContent,DropdownMenuTrigger,@@ -14,7 +15,7 @@ import {DeprecatedIconButton,Box,} from "@webstudio-is/design-system";-import { HamburgerMenuIcon, ChevronRightIcon } from "@webstudio-is/icons";+import { HamburgerMenuIcon } from "@webstudio-is/icons";import { type Publish } from "~/shared/pubsub";import { ShortcutHint } from "./shortcut-hint";import {@@ -30,14 +31,6 @@ import { useClientSettings } from "~/designer/shared/client-settings";import { dashboardPath } from "~/shared/router-utils";import { theme } from "@webstudio-is/design-system";-const menuItemCss = {- display: "flex",- gap: theme.spacing[9],- justifyContent: "space-between",- flexGrow: 1,- minWidth: 140,-};-const ThemeMenuItem = () => {if (isFeatureEnabled("dark") === false) {return null;@@ -53,16 +46,12 @@ const ThemeMenuItem = () => {return (<DropdownMenuSub>- <DropdownMenuSubTrigger>- Theme- <ChevronRightIcon />- </DropdownMenuSubTrigger>+ <DropdownMenuSubTrigger>Theme</DropdownMenuSubTrigger><DropdownMenuSubContent>{settings.map((setting) => (<DropdownMenuCheckboxItemkey={setting}checked={currentSetting === setting}- css={menuItemCss}onSelect={() => {setThemeSetting(setting);}}@@ -80,14 +69,10 @@ const ViewMenuItem = () => {return (<DropdownMenuSub>- <DropdownMenuSubTrigger>- View- <ChevronRightIcon />- </DropdownMenuSubTrigger>+ <DropdownMenuSubTrigger>View</DropdownMenuSubTrigger><DropdownMenuSubContent><DropdownMenuCheckboxItemchecked={clientSettings.navigatorLayout === "undocked"}- css={menuItemCss}onSelect={() => {const setting =clientSettings.navigatorLayout === "undocked"@@ -140,7 +125,6 @@ export const Menu = ({ publish }: MenuProps) => {collisionPadding={4}><DropdownMenuItem- css={menuItemCss}onSelect={() => {navigate(dashboardPath());}}@@ -149,7 +133,6 @@ export const Menu = ({ publish }: MenuProps) => {</DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "shortcut",@@ -158,10 +141,11 @@ export const Menu = ({ publish }: MenuProps) => {}}>Undo- <ShortcutHint value={["cmd", "z"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["cmd", "z"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "shortcut",@@ -170,33 +154,32 @@ export const Menu = ({ publish }: MenuProps) => {}}>Redo- <ShortcutHint value={["shift", "cmd", "z"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["shift", "cmd", "z"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuSeparator />{/* https://github.com/webstudio-is/webstudio-designer/issues/499<DropdownMenuItem- css={menuItemCss}onSelect={() => {// TODO}}>Copy- <ShortcutHint value={["cmd", "c"]} />+ <DropdownMenuItemRightSlot><ShortcutHint value={["cmd", "c"]} /></DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {// TODO}}>Paste- <ShortcutHint value={["cmd", "v"]} />+ <DropdownMenuItemRightSlot><ShortcutHint value={["cmd", "v"]} /></DropdownMenuItemRightSlot></DropdownMenuItem>*/}<DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "shortcut",@@ -205,20 +188,22 @@ export const Menu = ({ publish }: MenuProps) => {}}>Delete- <ShortcutHint value={["backspace"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["backspace"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({ type: "openBreakpointsMenu" });}}>Breakpoints- <ShortcutHint value={["cmd", "b"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["cmd", "b"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "zoom",@@ -227,10 +212,11 @@ export const Menu = ({ publish }: MenuProps) => {}}>Zoom in- <ShortcutHint value={["+"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["+"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "zoom",@@ -239,13 +225,14 @@ export const Menu = ({ publish }: MenuProps) => {}}>Zoom out- <ShortcutHint value={["-"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["-"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuSeparator /><ThemeMenuItem /><ViewMenuItem /><DropdownMenuItem- css={menuItemCss}onSelect={() => {publish({type: "togglePreviewMode",@@ -253,10 +240,11 @@ export const Menu = ({ publish }: MenuProps) => {}}>Preview- <ShortcutHint value={["cmd", "shift", "p"]} />+ <DropdownMenuItemRightSlot>+ <ShortcutHint value={["cmd", "shift", "p"]} />+ </DropdownMenuItemRightSlot></DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {setIsShareOpen(true);}}@@ -264,7 +252,6 @@ export const Menu = ({ publish }: MenuProps) => {Share</DropdownMenuItem><DropdownMenuItem- css={menuItemCss}onSelect={() => {setIsPublishOpen(true);}}diff --git a/packages/design-system/package.json b/packages/design-system/package.jsonindex 9d786cd2c5..a7b28dccfd 100644--- a/packages/design-system/package.json+++ b/packages/design-system/package.json@@ -52,7 +52,6 @@"@radix-ui/react-dropdown-menu": "^1.0.0","@radix-ui/react-id": "^1.0.0","@radix-ui/react-label": "^1.0.0",- "@radix-ui/react-menu": "^1.0.0","@radix-ui/react-popover": "^1.0.0","@radix-ui/react-popper": "^1.0.0","@radix-ui/react-portal": "^1.0.0",diff --git a/packages/design-system/src/components/combobox.stories.tsx b/packages/design-system/src/components/combobox.stories.tsxindex c4a735d467..4a0912caee 100644--- a/packages/design-system/src/components/combobox.stories.tsx+++ b/packages/design-system/src/components/combobox.stories.tsx@@ -1,9 +1,7 @@-import type { ComponentStory } from "@storybook/react";import { MagnifyingGlassIcon } from "@webstudio-is/icons";import React, { useCallback } from "react";import { TextField } from "./text-field";import {- Combobox,ComboboxListboxItem,useCombobox,comboboxStateChangeTypes,@@ -11,32 +9,7 @@ import {import { Flex } from "./flex";import { theme } from "../stitches.config";-export default {- component: Combobox,-};--export const Simple: ComponentStory<typeof Combobox> = () => {- const items = [{ label: "Apple" }, { label: "Banana" }, { label: "Orange" }];- const [value, setValue] = React.useState<typeof items[number] | null>(null);- return (- <Combobox- name="fruit"- placeholder="Select a fruit"- items={items}- value={value}- selectedItem={value}- onItemSelect={(value) => {- // If the value is cleared, we revert to previous state- if (value !== null) {- setValue(value);- }- }}- itemToString={(item) => item?.label ?? ""}- />- );-};--export const Complex: ComponentStory<typeof Combobox> = () => {+export const Complex = () => {const [value, setValue] = React.useState<string | null>(null);const stateReducer = useCallback((state, actionAndChanges) => {@@ -108,3 +81,7 @@ export const Complex: ComponentStory<typeof Combobox> = () => {</Flex>);};++export default {+ component: Complex,+};diff --git a/packages/design-system/src/components/combobox.tsx b/packages/design-system/src/components/combobox.tsxindex 4e2682ed87..f37b410c2d 100644--- a/packages/design-system/src/components/combobox.tsx+++ b/packages/design-system/src/components/combobox.tsx@@ -7,8 +7,12 @@ import {useEffect,useRef,type ChangeEvent,+ type ReactNode,} from "react";-import { CheckIcon, ChevronDownIcon } from "@webstudio-is/icons";+import { CheckMarkIcon } from "@webstudio-is/icons";+// @todo:+// react-popper "is an internal utility, not intended for public usage"+// probably need to switch to @radix-ui/react-popoverimport { Popper, PopperContent, PopperAnchor } from "@radix-ui/react-popper";import {type DownshiftState,@@ -18,66 +22,66 @@ import {useCombobox as useDownshiftCombobox,} from "downshift";import { matchSorter } from "match-sorter";-import { styled } from "../stitches.config";-import { DeprecatedIconButton } from "./__DEPRECATED__/icon-button";-import { itemCss } from "./menu";-import { panelStyles } from "./panel";-import { TextField } from "./text-field";-import { Box } from "./box";-import { Grid } from "./grid";-import { theme } from "../stitches.config";--const Listbox = styled("ul", panelStyles, {- p: theme.spacing[3],- margin: 0,- overflow: "auto",- // @todo need some non-hardcoded value- maxHeight: 400,- minWidth: 214,- variants: {- state: {- open: {},- closed: {- display: "none",- },- },- empty: {- true: {- display: "none",- },+import { styled, theme } from "../stitches.config";+import {+ itemCss,+ menuCss,+ itemIndicatorCss,+ labelCss,+ separatorCss,+} from "./menu";++const Listbox = styled(+ "ul",+ {+ margin: "unset", // reset <ul>+ overflow: "auto",+ maxHeight: theme.spacing[34],+ variants: {+ state: { closed: { display: "none" } },+ empty: { true: { display: "none" } },},},-});+ menuCss+);++const ListboxItem = styled("li", itemCss);-const ListboxItem = styled("li", itemCss, {- padding: `0 ${theme.spacing[5]}`,- margin: 0,- borderRadius: theme.borderRadius[4],-});+const Indicator = styled("span", itemIndicatorCss);++export const ComboboxLabel = styled("li", labelCss);++export const ComboboxSeparator = styled("li", separatorCss);const ListboxItemBase: ForwardRefRenderFunction<HTMLLIElement,ComponentProps<typeof ListboxItem> & {disabled?: boolean;selected?: boolean;+ selectable?: boolean;highlighted?: boolean;+ icon?: ReactNode;}> = (props, ref) => {- const { disabled, selected, highlighted, children, ...rest } = props;+ const {+ disabled,+ selected,+ selectable = true,+ highlighted,+ children,+ icon = <CheckMarkIcon />,+ ...rest+ } = props;return (<ListboxItemref={ref}{...(disabled ? { "aria-disabled": true, disabled: true } : {})}{...(selected ? { "aria-current": true } : {})}- {...rest}+ {...(disabled ? {} : rest)}+ withIndicator={selectable}>- <Grid- align="center"- css={{ gridTemplateColumns: `${theme.spacing[10]} 1fr` }}- >- {selected && <CheckIcon />}- <Box css={{ gridColumn: 2 }}>{children}</Box>- </Grid>+ {selectable && selected && <Indicator>{icon}</Indicator>}+ {children}</ListboxItem>);};@@ -285,74 +289,3 @@ export const useCombobox = <Item,>({resetFilter,};};--type ComboboxProps<Item> = UseComboboxProps<Item> & {- name: string;- label?: string;- placeholder?: string;-};--export const Combobox = <Item,>({- items,- value = null,- name,- selectedItem,- placeholder,- itemToString,- onItemSelect,- onItemHighlight,-}: ComboboxProps<Item>) => {- const {- items: foundItems,- getInputProps,- getComboboxProps,- getToggleButtonProps,- getMenuProps,- getItemProps,- isOpen,- } = useCombobox({- items,- value,- selectedItem,- itemToString,- onItemSelect,- onItemHighlight,- });- return (- <Popper>- <Box {...getComboboxProps()}>- <PopperAnchor>- <TextField- {...getInputProps({- name,- placeholder,- })}- suffix={- <DeprecatedIconButton {...getToggleButtonProps()}>- <ChevronDownIcon />- </DeprecatedIconButton>- }- />- </PopperAnchor>- <PopperContent>- <Listbox {...getMenuProps()}>- {isOpen &&- foundItems.map((item, index) => {- return (- // eslint-disable-next-line react/jsx-key- <ComboboxListboxItem- key={index}- {...getItemProps({ item, index })}- >- {itemToString(item)}- </ComboboxListboxItem>- );- })}- </Listbox>- </PopperContent>- </Box>- </Popper>- );-};--Combobox.displayName = "Combobox";diff --git a/packages/design-system/src/components/dropdown-menu.tsx b/packages/design-system/src/components/dropdown-menu.tsxindex 4c0a048461..46485106c2 100644--- a/packages/design-system/src/components/dropdown-menu.tsx+++ b/packages/design-system/src/components/dropdown-menu.tsx@@ -1,103 +1,125 @@-import React from "react";-import { CheckIcon } from "@webstudio-is/icons";-import { styled, CSS } from "../stitches.config";+import {+ forwardRef,+ type ComponentProps,+ type ElementRef,+ type ReactNode,+} from "react";+import { CheckMarkIcon, ChevronFilledRightIcon } from "@webstudio-is/icons";+import { styled } from "../stitches.config";import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";-import { menuCss, separatorCss, itemCss, labelCss } from "./menu";-import { Box } from "./box";-import { panelStyles } from "./panel";-import { theme } from "../stitches.config";+import {+ menuCss,+ subMenuCss,+ separatorCss,+ itemCss,+ labelCss,+ itemIndicatorCss,+ subContentProps,+} from "./menu";+export { DropdownMenuArrow } from "./menu";export const DropdownMenu = DropdownMenuPrimitive.Root;-export const DropdownMenuArrow = styled(DropdownMenuPrimitive.Arrow, {- fill: theme.colors.slate4,- stroke: theme.colors.slate1,-});+export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;export const DropdownMenuSub = DropdownMenuPrimitive.Sub;-export const DropdownMenuSubTrigger = styled(- DropdownMenuPrimitive.SubTrigger,- itemCss-);-export const DropdownMenuContent = styled(DropdownMenuPrimitive.Content,menuCss,- panelStyles+ { defaultVariants: { width: "regular" } });-export const DropdownMenuSubContent = styled(- DropdownMenuPrimitive.SubContent,- menuCss,- panelStyles-);+const SubContentStyled = styled(DropdownMenuPrimitive.SubContent, subMenuCss, {+ defaultVariants: { width: "regular" },+});+export const DropdownMenuSubContent = forwardRef<+ ElementRef<typeof SubContentStyled>,+ ComponentProps<typeof SubContentStyled>+>((props, forwardedRef) => (+ <SubContentStyled {...subContentProps} {...props} ref={forwardedRef} />+));+DropdownMenuSubContent.displayName = "DropdownMenuSubContent";+export const DropdownMenuSeparator = styled(DropdownMenuPrimitive.Separator,separatorCss);-export const DropdownMenuItem = styled(DropdownMenuPrimitive.Item, itemCss);-const StyledDropdownMenuRadioItem = styled(- DropdownMenuPrimitive.RadioItem,- itemCss-);+export const DropdownMenuLabel = styled(DropdownMenuPrimitive.Label, labelCss);-type DialogMenuRadioItemPrimitiveProps = React.ComponentProps<- typeof DropdownMenuPrimitive.RadioItem->;-type DialogMenuRadioItemProps = DialogMenuRadioItemPrimitiveProps & {- css?: CSS;-};--export const DropdownMenuRadioItem = React.forwardRef<- React.ElementRef<typeof StyledDropdownMenuRadioItem>,- DialogMenuRadioItemProps->(({ children, ...props }, forwardedRef) => (- <StyledDropdownMenuRadioItem {...props} ref={forwardedRef}>- <Box as="span" css={{ position: "absolute", left: theme.spacing[3] }}>- <DropdownMenuPrimitive.ItemIndicator>- <CheckIcon />- </DropdownMenuPrimitive.ItemIndicator>- </Box>+export const StyledMenuItem = styled(DropdownMenuPrimitive.Item, itemCss, {+ defaultVariants: { withIndicator: true },+});+export const DropdownMenuItem = forwardRef<+ ElementRef<typeof StyledMenuItem>,+ ComponentProps<typeof StyledMenuItem> & { icon?: ReactNode }+>(({ icon, children, withIndicator, ...props }, forwardedRef) => (+ <StyledMenuItem+ withIndicator={withIndicator || Boolean(icon)}+ {...props}+ ref={forwardedRef}+ >+ {icon && <div className={itemIndicatorCss()}>{icon}</div>}{children}- </StyledDropdownMenuRadioItem>+ </StyledMenuItem>));+DropdownMenuItem.displayName = "DropdownMenuItem";-DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";+export const DropdownMenuItemRightSlot = styled("span", {+ marginLeft: "auto",+ display: "flex",+});-const StyledDropdownMenuCheckboxItem = styled(- DropdownMenuPrimitive.CheckboxItem,- itemCss-);+const SubTriggerStyled = styled(DropdownMenuPrimitive.SubTrigger, itemCss, {+ defaultVariants: { withIndicator: true },+});+export const DropdownMenuSubTrigger = forwardRef<+ ElementRef<typeof SubTriggerStyled>,+ ComponentProps<typeof SubTriggerStyled> & { icon?: ReactNode }+>(({ children, withIndicator, icon, ...props }, forwardedRef) => (+ <SubTriggerStyled+ withIndicator={withIndicator || Boolean(icon)}+ {...props}+ ref={forwardedRef}+ >+ {icon && <div className={itemIndicatorCss()}>{icon}</div>}+ {children}+ <DropdownMenuItemRightSlot>+ <ChevronFilledRightIcon />+ </DropdownMenuItemRightSlot>+ </SubTriggerStyled>+));+DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";++const Indicator = styled(DropdownMenuPrimitive.ItemIndicator, itemIndicatorCss);-type DialogMenuCheckboxItemPrimitiveProps = React.ComponentProps<- typeof DropdownMenuPrimitive.CheckboxItem->;-type DialogMenuCheckboxItemProps = DialogMenuCheckboxItemPrimitiveProps & {- css?: CSS;-};--export const DropdownMenuCheckboxItem = React.forwardRef<- React.ElementRef<typeof StyledDropdownMenuCheckboxItem>,- DialogMenuCheckboxItemProps->(({ children, ...props }, forwardedRef) => (- <StyledDropdownMenuCheckboxItem {...props} ref={forwardedRef}>- <Box as="span" css={{ position: "absolute", left: theme.spacing[3] }}>- <DropdownMenuPrimitive.ItemIndicator>- <CheckIcon />- </DropdownMenuPrimitive.ItemIndicator>- </Box>+const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, itemCss);+export const DropdownMenuRadioItem = forwardRef<+ ElementRef<typeof StyledRadioItem>,+ ComponentProps<typeof StyledRadioItem> & { icon?: ReactNode }+>(({ children, icon = <CheckMarkIcon />, ...props }, forwardedRef) => (+ <StyledRadioItem withIndicator {...props} ref={forwardedRef}>+ <Indicator>{icon}</Indicator>{children}- </StyledDropdownMenuCheckboxItem>+ </StyledRadioItem>));+DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";+const StyledCheckboxItem = styled(DropdownMenuPrimitive.CheckboxItem, itemCss);+export const DropdownMenuCheckboxItem = forwardRef<+ ElementRef<typeof StyledCheckboxItem>,+ ComponentProps<typeof StyledCheckboxItem> & { icon?: ReactNode }+>(({ children, icon = <CheckMarkIcon />, ...props }, forwardedRef) => (+ <StyledCheckboxItem withIndicator {...props} ref={forwardedRef}>+ <Indicator>{icon}</Indicator>+ {children}+ </StyledCheckboxItem>+));DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";-export const DropdownMenuLabel = styled(DropdownMenuPrimitive.Label, labelCss);-export const DropdownMenuRadioGroup = styled(- DropdownMenuPrimitive.RadioGroup,- {}-);-export const DropdownMenuGroup = styled(DropdownMenuPrimitive.Group, {});+export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;++export const DropdownMenuGroup = DropdownMenuPrimitive.Group;+export const DropdownMenuPortal = DropdownMenuPrimitive.Portal;diff --git a/packages/design-system/src/components/icon-button-with-menu.tsx b/packages/design-system/src/components/icon-button-with-menu.tsxindex 81a6e27336..814df082a9 100644--- a/packages/design-system/src/components/icon-button-with-menu.tsx+++ b/packages/design-system/src/components/icon-button-with-menu.tsx@@ -1,66 +1,15 @@-import { CheckIcon, IconComponent } from "@webstudio-is/icons";-import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";-import { styled } from "../stitches.config";+import { IconComponent } from "@webstudio-is/icons";+import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuPortal,+ DropdownMenuContent,+ DropdownMenuArrow,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+} from "./dropdown-menu";import { Tooltip } from "./tooltip";import { IconButton } from "./icon-button";-import { theme } from "../stitches.config";--const StyledContent = styled(DropdownMenuPrimitive.Content, {- width: 192,- maxHeight: 238,- overflow: "auto",- backgroundColor: theme.colors.slate4,- borderRadius: theme.borderRadius[4],- padding: theme.spacing[5],- boxShadow: `0px 2px 7px rgba(0, 0, 0, 0.1), 0px 5px 17px rgba(0, 0, 0, 0.15), inset 0 0 1px 1px ${theme.colors.gray1}, 0 0 0 1px ${theme.colors.gray8}`,-});--const itemStyles = {- all: "unset",- fontSize: theme.fontSize[3],- lineHeight: 1,- color: theme.colors.slate12,- borderRadius: theme.borderRadius[4],- display: "flex",- alignItems: "center",- height: theme.spacing[11],- padding: `0 ${theme.spacing[11]}`,- position: "relative",- paddingLeft: theme.spacing[11],- paddingRight: theme.spacing[11],- userSelect: "none",- gap: theme.spacing[5],- "&[data-highlighted]": {- background: theme.colors.blue10,- color: theme.colors.blue1,- "& *": { fill: theme.colors.blue1 },- },-};--const itemIndicatorStyle = {- position: "absolute",- left: 0,- width: 25,- display: "inline-flex",- alignItems: "center",- justifyContent: "center",-};--const arrowStyle = {- "& *": {- fill: theme.colors.gray4,- stroke: theme.colors.gray8,- },-};--const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, itemStyles);--const StyledItemIndicator = styled(- DropdownMenuPrimitive.ItemIndicator,- itemIndicatorStyle-);--const StyledArrow = styled(DropdownMenuPrimitive.Arrow, arrowStyle);export const IconButtonWithMenu = ({variant,@@ -84,42 +33,36 @@ export const IconButtonWithMenu = ({onHover?: (value: string) => void;}) => {return (- <DropdownMenuPrimitive.Root modal={false}>+ <DropdownMenu modal={false}><Tooltipcontent={label}delayDuration={400}disableHoverableContent={true}>- <DropdownMenuPrimitive.Trigger asChild>+ <DropdownMenuTrigger asChild><IconButton variant={variant}>{Icon}</IconButton>- </DropdownMenuPrimitive.Trigger>+ </DropdownMenuTrigger></Tooltip>- <DropdownMenuPrimitive.Portal>- <StyledContent sideOffset={4} collisionPadding={16} side="bottom">- <DropdownMenuPrimitive.RadioGroup- value={value}- onValueChange={onChange}- >+ <DropdownMenuPortal>+ <DropdownMenuContent sideOffset={4} collisionPadding={16} side="bottom">+ <DropdownMenuRadioGroup value={value} onValueChange={onChange}>{items.map(({ name, label, icon }) => {return (- <StyledRadioItem+ <DropdownMenuRadioItemkey={name}value={label}onFocus={() => onHover?.(name)}onBlur={() => onHover?.(value)}>- <StyledItemIndicator>- <CheckIcon />- </StyledItemIndicator>{icon}{label}- </StyledRadioItem>+ </DropdownMenuRadioItem>);})}- </DropdownMenuPrimitive.RadioGroup>- <StyledArrow offset={12} />- </StyledContent>- </DropdownMenuPrimitive.Portal>- </DropdownMenuPrimitive.Root>+ </DropdownMenuRadioGroup>+ <DropdownMenuArrow />+ </DropdownMenuContent>+ </DropdownMenuPortal>+ </DropdownMenu>);};diff --git a/packages/design-system/src/components/menu.stories.tsx b/packages/design-system/src/components/menu.stories.tsxnew file mode 100644index 0000000000..516e65be88--- /dev/null+++ b/packages/design-system/src/components/menu.stories.tsx@@ -0,0 +1,290 @@+// We demonstrate dropdown-menu/combobox/etc instead of menu.tsx,+// because what menu.tsx exports is not intended to be used directly++import {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuArrow,+ DropdownMenuSeparator,+ DropdownMenuCheckboxItem,+ DropdownMenuSub,+ DropdownMenuSubTrigger,+ DropdownMenuSubContent,+ DropdownMenuLabel,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+} from "./dropdown-menu";+import {+ useCombobox,+ ComboboxPopper,+ ComboboxPopperContent,+ ComboboxPopperAnchor,+ ComboboxListbox,+ ComboboxListboxItem,+ ComboboxLabel,+ ComboboxSeparator,+} from "./combobox";+import {+ Select,+ SelectItem,+ SelectLabel,+ SelectSeparator,+ SelectGroup,+} from "./select";+import { TextField } from "./text-field";+import { Button } from "./button";+import {+ ChevronDownIcon,+ TrashIcon,+ MenuIcon,+ DotIcon,+} from "@webstudio-is/icons";+import { useState } from "react";+import { DeprecatedIconButton } from "./__DEPRECATED__/icon-button";++const DropdownDemo = ({ withIndicator }: { withIndicator: boolean }) => {+ const [isApple, setIsApple] = useState(true);+ const [isOrange, setIsOrange] = useState(true);+ const [radioValue, setRadioValue] = useState("apple");++ return (+ <DropdownMenu defaultOpen>+ <DropdownMenuTrigger asChild>+ <Button prefix={<MenuIcon />} />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuLabel>Not choosable</DropdownMenuLabel>++ <DropdownMenuItem withIndicator={withIndicator}>+ Create+ </DropdownMenuItem>+ <DropdownMenuItem+ withIndicator={withIndicator}+ icon={withIndicator ? <TrashIcon /> : null}+ destructive+ >+ Delete+ </DropdownMenuItem>+ <DropdownMenuItem withIndicator={withIndicator} disabled>+ Disabled+ </DropdownMenuItem>++ <DropdownMenuSeparator />+ <DropdownMenuLabel>Sub-menu</DropdownMenuLabel>++ <DropdownMenuSub>+ <DropdownMenuSubTrigger withIndicator={withIndicator}>+ Open sub-menu+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ <DropdownMenuItem withIndicator={withIndicator}>+ Regular+ </DropdownMenuItem>+ <DropdownMenuItem withIndicator={withIndicator} destructive>+ Destructive+ </DropdownMenuItem>+ </DropdownMenuSubContent>+ </DropdownMenuSub>++ {withIndicator && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuLabel>Choose many</DropdownMenuLabel>++ <DropdownMenuCheckboxItem+ checked={isApple}+ onSelect={() => setIsApple(isApple === false)}+ >+ Apple+ </DropdownMenuCheckboxItem>+ <DropdownMenuCheckboxItem+ checked={isOrange}+ onSelect={() => setIsOrange(isOrange === false)}+ >+ Orange+ </DropdownMenuCheckboxItem>++ <DropdownMenuSeparator />+ <DropdownMenuLabel>Choose one</DropdownMenuLabel>++ <DropdownMenuRadioGroup+ value={radioValue}+ onValueChange={setRadioValue}+ >+ <DropdownMenuRadioItem value="apple">Apple</DropdownMenuRadioItem>+ <DropdownMenuRadioItem value="orange">+ Orange+ </DropdownMenuRadioItem>+ </DropdownMenuRadioGroup>+ </>+ )}++ <DropdownMenuArrow />+ </DropdownMenuContent>+ </DropdownMenu>+ );+};++type Fruit = "Apple" | "Banana" | "Orange" | "Peach";+const fruits: Fruit[] = ["Orange", "Apple", "Peach", "Banana"];++const ComboboxDemo = () => {+ const [selectedItem, onItemSelect] = useState<Fruit>();++ const {+ items,+ getInputProps,+ getComboboxProps,+ getToggleButtonProps,+ getMenuProps,+ getItemProps,+ } = useCombobox<Fruit>({+ items: fruits,+ itemToString: (item) => item ?? "",+ value: null,+ selectedItem,+ onItemSelect,+ });++ const renderItem = (item: Fruit) => (+ <ComboboxListboxItem+ {...getItemProps({ item, index: items.indexOf(item) })}+ key={item}+ destructive={item === "Orange"}+ disabled={item === "Peach"}+ icon={item === "Apple" ? <DotIcon /> : undefined}+ >+ {item}+ </ComboboxListboxItem>+ );++ const roundItems = items.filter((item) => item !== "Banana");+ const longItems = items.filter((item) => item === "Banana");++ return (+ <ComboboxPopper>+ <div {...getComboboxProps()}>+ <ComboboxPopperAnchor>+ <TextField+ {...getInputProps()}+ placeholder="Enter: Apple"+ suffix={+ <DeprecatedIconButton {...getToggleButtonProps()}>+ <ChevronDownIcon />+ </DeprecatedIconButton>+ }+ />+ </ComboboxPopperAnchor>+ <ComboboxPopperContent align="end" sideOffset={5}>+ <ComboboxListbox {...getMenuProps()}>+ {roundItems.length > 0 && (+ <>+ <ComboboxLabel>Round</ComboboxLabel>+ {roundItems.map(renderItem)}+ </>+ )}+ {roundItems.length > 0 && longItems.length > 0 && (+ <ComboboxSeparator />+ )}+ {longItems.length > 0 && (+ <>+ <ComboboxLabel>Long</ComboboxLabel>+ {longItems.map(renderItem)}+ </>+ )}+ </ComboboxListbox>+ </ComboboxPopperContent>+ </div>+ </ComboboxPopper>+ );+};++const BasicSelectDemo = () => {+ const [value, setValue] = useState<Fruit>("Apple");+ return (+ <Select+ options={fruits}+ value={value}+ onChange={(value) => {+ setValue(value as Fruit);+ }}+ />+ );+};++const ComplexSelectDemo = () => {+ const [value, setValue] = useState<Fruit>("Orange");+ return (+ <Select+ options={fruits}+ value={value}+ onChange={(value) => {+ setValue(value as Fruit);+ }}+ >+ <SelectGroup>+ <SelectLabel>Round</SelectLabel>+ <SelectItem destructive value="Orange" textValue="Orange">+ Orange (destructive)+ </SelectItem>+ <SelectItem icon={<DotIcon />} value="Apple" textValue="Apple">+ Apple (custom icon)+ </SelectItem>+ <SelectItem disabled value="Peach" textValue="Peach">+ Peach (disabled)+ </SelectItem>+ </SelectGroup>+ <SelectSeparator />+ <SelectGroup>+ <SelectLabel>Long</SelectLabel>+ <SelectItem value="Banana" textValue="Banana">+ Banana+ </SelectItem>+ </SelectGroup>+ </Select>+ );+};++export const Menu = () => (+ <>+ <Section title="Dropdown menu">+ <div style={{ display: "flex", paddingBottom: 360 }}>+ <div style={{ paddingLeft: 100, paddingRight: 100 }}>+ <DropdownDemo withIndicator={true} />+ </div>+ <div style={{ paddingLeft: 100, paddingRight: 100 }}>+ <DropdownDemo withIndicator={false} />+ </div>+ </div>+ </Section>+ <Section title="Select menu (Combobox component)">+ <ComboboxDemo />+ </Section>+ <Section title="Basic select menu (Select component)">+ <BasicSelectDemo />+ </Section>+ <Section title="Complex select menu (Select component)">+ <ComplexSelectDemo />+ </Section>+ </>+);++export default {+ title: "Library/Menu",+ component: Menu,+};++const Section = ({+ title,+ children,+}: {+ title: string;+ children: React.ReactNode;+}) => (+ <>+ <h3 style={{ fontFamily: "sans-serif" }}>{title}</h3>+ <div style={{ display: "flex", gap: 12 }}>{children}</div>+ </>+);diff --git a/packages/design-system/src/components/menu.tsx b/packages/design-system/src/components/menu.tsxindex 24ff328d5a..f0d6321007 100644--- a/packages/design-system/src/components/menu.tsx+++ b/packages/design-system/src/components/menu.tsx@@ -1,107 +1,128 @@-import React from "react";-import * as MenuPrimitive from "@radix-ui/react-menu";-import { CheckIcon } from "@webstudio-is/icons";-import { styled, css, CSS } from "../stitches.config";-import { Box } from "./box";-import { panelStyles } from "./panel";-import { theme } from "../stitches.config";+/**+ * Implementation of the "Menu" and "Menu Item" components from:+ * https://www.figma.com/file/sfCE7iLS0k25qCxiifQNLE/%F0%9F%93%9A-Webstudio-Library?node-id=6%3A2104&t=xHSB8rNf2VXrwLAU-0+ *+ * Only CSS is implemented here, and intended to be used with:+ * - @radix-ui/react-dropdown-menu+ * - @radix-ui/react-select+ * - @radix-ui/react-popper & downshift+ * - @radix-ui/react-context-menu (@todo, not implemented yet)+ *+ * @todo not implemented yet Figma features:+ * - Component: "Menu Item Large"+ * - Type of "Menu" component: "Dropdown w/large items"+ * - Type of "Menu" component: "Context menu"+ */-export const baseItemCss = css({+import { css, styled, theme } from "../stitches.config";+import { typography } from "./typography";+import {+ Arrow as BaseDropdownMenuArrow,+ SubContent,+} from "@radix-ui/react-dropdown-menu";+import { type ComponentProps } from "react";++export const labelCss = css(typography.title, {+ color: theme.colors.foregroundMain,+ mx: theme.spacing[3],+ padding: theme.spacing[3],+});++const indicatorSize = theme.spacing[9];+export const itemIndicatorCss = css({+ position: "absolute",display: "flex",alignItems: "center",- justifyContent: "space-between",- fontFamily: theme.fonts.sans,- fontSize: theme.fontSize[3],- fontVariantNumeric: "tabular-nums",- lineHeight: "1",- cursor: "default",- userSelect: "none",- whiteSpace: "nowrap",- height: theme.spacing[11],- px: theme.spacing[11],+ justifyContent: "center",+ left: theme.spacing[3],+ width: indicatorSize,+ height: indicatorSize,});-export const itemCss = css(baseItemCss, {+export const itemCss = css(typography.labelTitleCase, {+ outline: "none",+ cursor: "default",position: "relative",- color: theme.colors.hiContrast,- "&:focus, &[data-found], &[aria-selected=true]": {- outline: "none",- backgroundColor: theme.colors.blue10,- color: "white",+ display: "flex",+ alignItems: "center",+ color: theme.colors.foregroundMain,+ mx: theme.spacing[3],+ padding: theme.spacing[3],+ borderRadius: theme.borderRadius[3],+ "&:focus, &[data-found], &[aria-selected=true], &[data-state=open]": {+ backgroundColor: theme.colors.backgroundItemMenuItemHover,},"&[data-disabled], &[aria-disabled]": {- color: theme.colors.slate9,+ color: theme.colors.foregroundDisabled,+ },+ variants: {+ withIndicator: {+ true: {+ paddingLeft: `calc(${theme.spacing[3]} + ${indicatorSize} + ${theme.spacing[3]})`,+ },+ },+ destructive: {+ true: {+ color: theme.colors.foregroundDestructive,+ },+ },},-});--export const labelCss = css(baseItemCss, {- color: theme.colors.slate11,-});--export const menuCss = css({- boxSizing: "border-box",- minWidth: 120,- py: theme.spacing[3],});export const separatorCss = css({height: 1,my: theme.spacing[3],- backgroundColor: theme.colors.slate6,+ backgroundColor: theme.colors.borderMain,});-export const Menu = styled(MenuPrimitive.Root, menuCss);-export const MenuContent = styled(MenuPrimitive.Content, panelStyles);--export const MenuSeparator = styled(MenuPrimitive.Separator, separatorCss);+const menuPadding = theme.spacing[3];+const menuBorderWidth = "1px";-export const MenuItem = styled(MenuPrimitive.Item, itemCss);+export const menuCss = css({+ boxSizing: "border-box",-const StyledMenuRadioItem = styled(MenuPrimitive.RadioItem, itemCss);+ borderRadius: theme.borderRadius[6],+ backgroundColor: theme.colors.backgroundMenu,-type MenuRadioItemPrimitiveProps = React.ComponentProps<- typeof MenuPrimitive.RadioItem->;-type MenuRadioItemProps = MenuRadioItemPrimitiveProps & { css?: CSS };+ // in Figma there are 2 borders on two rectangles,+ // but we have only one element to work with,+ // so we implement borders using shadows+ boxShadow: `${theme.shadows.menuDropShadow}, inset 0 0 0 1px ${theme.colors.borderMain}, inset 0 0 0 2px ${theme.colors.borderMenuInner}`,-export const MenuRadioItem = React.forwardRef<- React.ElementRef<typeof StyledMenuRadioItem>,- MenuRadioItemProps->(({ children, ...props }, forwardedRef) => (- <StyledMenuRadioItem {...props} ref={forwardedRef}>- <Box as="span" css={{ position: "absolute", left: theme.spacing[3] }}>- <MenuPrimitive.ItemIndicator>- <CheckIcon />- </MenuPrimitive.ItemIndicator>- </Box>- {children}- </StyledMenuRadioItem>-));-MenuRadioItem.displayName = "MenuRadioItem";+ // extra 1px padding to account for one of the shadow-borders above+ padding: `calc(${menuBorderWidth} + ${menuPadding}) ${menuBorderWidth}`,-const StyledMenuCheckboxItem = styled(MenuPrimitive.CheckboxItem, itemCss);+ variants: {+ width: {+ regular: { width: theme.spacing[26] },+ },+ },+});-type MenuCheckboxItemPrimitiveProps = React.ComponentProps<- typeof MenuPrimitive.CheckboxItem->;-type MenuCheckboxItemProps = MenuCheckboxItemPrimitiveProps & { css?: CSS };+export const subMenuCss = css(menuCss, {+ // the goal is to align the top menu item in a sub menu+ // with the menu item in the parent menu that opened it+ marginTop: `calc((${menuPadding} + ${menuBorderWidth}) * -1)`,+});-export const MenuCheckboxItem = React.forwardRef<- React.ElementRef<typeof StyledMenuCheckboxItem>,- MenuCheckboxItemProps->(({ children, ...props }, forwardedRef) => (- <StyledMenuCheckboxItem {...props} ref={forwardedRef}>- <Box as="span" css={{ position: "absolute", left: theme.spacing[3] }}>- <MenuPrimitive.ItemIndicator>- <CheckIcon />- </MenuPrimitive.ItemIndicator>- </Box>- {children}- </StyledMenuCheckboxItem>-));-MenuCheckboxItem.displayName = "MenuCheckboxItem";+export const subContentProps: Partial<ComponentProps<typeof SubContent>> = {+ // this depends on itemCss.margin and menuCss.padding,+ // the goal is to make sub-menu overlap the parent menu by exactly 2px+ sideOffset: 3,+};-export const MenuLabel = styled(MenuPrimitive.Label, labelCss);-export const MenuRadioGroup = styled(MenuPrimitive.RadioGroup, {});-export const MenuGroup = styled(MenuPrimitive.Group, {});-export const MenuAnchor = MenuPrimitive.MenuAnchor;+// Arrow is hard to implement with just CSS,+// so we implement it as a component+const ArrowBackground = styled("path", { fill: theme.colors.backgroundMenu });+const ArrowInnerBorder = styled("path", { fill: theme.colors.borderMenuInner });+const ArrowOuterBorder = styled("path", { fill: theme.colors.borderMain });+const ArrowSgv = styled("svg", { transform: "translateY(-3px)" });+export const DropdownMenuArrow = () => (+ <BaseDropdownMenuArrow width={16} height={11} asChild>+ <ArrowSgv xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 11">+ <ArrowOuterBorder d="M8.73 9.76a1 1 0 0 1-1.46 0L.5 2.54h15L8.73 9.76Z" />+ <ArrowInnerBorder d="M8.146 8.909a.2.2 0 0 1-.292 0L.5 1.065h15L8.146 8.909Z" />+ <ArrowBackground d="M8.073 7.52a.1.1 0 0 1-.146 0L.877 0h14.246l-7.05 7.52Z" />+ </ArrowSgv>+ </BaseDropdownMenuArrow>+);diff --git a/packages/design-system/src/components/select.tsx b/packages/design-system/src/components/select.tsxindex 5120377923..3cf2cb7b9f 100644--- a/packages/design-system/src/components/select.tsx+++ b/packages/design-system/src/components/select.tsx@@ -1,12 +1,20 @@import * as SelectPrimitive from "@radix-ui/react-select";-import React, { ReactNode, Ref } from "react";-import { Grid } from "./grid";-import { Box } from "./box";-import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@webstudio-is/icons";-import { styled } from "../stitches.config";-import { theme } from "../stitches.config";--const StyledTrigger = styled(SelectPrimitive.SelectTrigger, {+import React, { ReactNode, Ref, type ComponentProps } from "react";+import {+ menuCss,+ itemCss,+ itemIndicatorCss,+ labelCss,+ separatorCss,+} from "./menu";+import {+ CheckMarkIcon,+ ChevronDownIcon,+ ChevronUpIcon,+} from "@webstudio-is/icons";+import { styled, theme } from "../stitches.config";++const StyledTrigger = styled(SelectPrimitive.Trigger, {all: "unset",display: "inline-flex",alignItems: "center",@@ -59,40 +67,19 @@ const StyledIcon = styled(SelectPrimitive.Icon, {padding: `${theme.spacing[2]} ${theme.spacing[2]} ${theme.spacing[2]} 0px`,});-export const SelectContent = styled(SelectPrimitive.Content, {- overflow: "hidden",- backgroundColor: theme.colors.slate4,- borderRadius: theme.borderRadius[4],- boxShadow: `0px 2px 7px rgba(0, 0, 0, 0.1), 0px 5px 17px rgba(0, 0, 0, 0.15), inset 0 0 1px 1px ${theme.colors.slate1}, 0 0 0 1px ${theme.colors.slate8}`,-});+export const SelectContent = styled(SelectPrimitive.Content, menuCss);-export const SelectViewport = styled(SelectPrimitive.Viewport, {- p: theme.spacing[3],-});+export const SelectViewport = SelectPrimitive.Viewport;-const StyledItem = styled(SelectPrimitive.Item, {- all: "unset",- fontSize: theme.fontSize[3],- lineHeight: 1,- color: theme.colors.hiContrast,- display: "flex",- alignItems: "center",- height: theme.spacing[11],- padding: `0 ${theme.spacing[5]}`,- position: "relative",- userSelect: "none",- borderRadius: theme.borderRadius[4],+export const SelectLabel = styled(SelectPrimitive.Label, labelCss);- "&[data-disabled]": {- color: theme.colors.muted,- pointerEvents: "none",- },+export const SelectSeparator = styled(SelectPrimitive.Separator, separatorCss);- "&:focus": {- backgroundColor: theme.colors.blue10,- color: "white",- },-});+export const SelectGroup = SelectPrimitive.Group;++const StyledItem = styled(SelectPrimitive.Item, itemCss);++const StyledIndicator = styled(SelectPrimitive.ItemIndicator, itemIndicatorCss);const scrollButtonStyles = {display: "flex",@@ -114,35 +101,27 @@ export const SelectScrollDownButton = styled();const SelectItemBase = (- { children, ...props }: SelectItemProps,+ { children, icon = <CheckMarkIcon />, ...props }: SelectItemProps,forwardedRef: Ref<HTMLDivElement>) => {return (- <StyledItem {...props} ref={forwardedRef}>- <Grid- align="center"- css={{ gridTemplateColumns: `${theme.spacing[10]} 1fr` }}- >- <SelectPrimitive.ItemIndicator>- <CheckIcon />- </SelectPrimitive.ItemIndicator>- <Box css={{ gridColumn: 2 }}>- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>- </Box>- </Grid>+ <StyledItem {...props} withIndicator ref={forwardedRef}>+ <StyledIndicator>{icon}</StyledIndicator>+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText></StyledItem>);};-type SelectItemProps = SelectPrimitive.SelectItemProps & {+type SelectItemProps = ComponentProps<typeof StyledItem> & {children: ReactNode;+ icon?: ReactNode;};export const SelectItem = React.forwardRef(SelectItemBase);export type SelectOption = string;export type SelectProps<Option = SelectOption> = Omit<- React.ComponentProps<typeof StyledTrigger>,+ ComponentProps<typeof StyledTrigger>,"onChange" | "value" | "defaultValue"> & {options: Option[];@@ -154,6 +133,7 @@ export type SelectProps<Option = SelectOption> = Omit<placeholder?: string;getLabel?: (option: Option) => string | undefined;getValue?: (option: Option) => string | undefined;+ children?: ReactNode;};const SelectBase = (@@ -168,6 +148,7 @@ const SelectBase = (getLabel = (option) => option,getValue = (option) => option,name,+ children,...props}: SelectProps,forwardedRef: Ref<HTMLButtonElement>@@ -195,15 +176,16 @@ const SelectBase = (<ChevronUpIcon /></SelectScrollUpButton><SelectViewport>- {options.map((option) => (- <SelectItem- key={getValue(option)}- value={getValue(option) ?? ""}- textValue={getLabel(option)}- >- {getLabel(option)}- </SelectItem>- ))}+ {children ||+ options.map((option) => (+ <SelectItem+ key={getValue(option)}+ value={getValue(option) ?? ""}+ textValue={getLabel(option)}+ >+ {getLabel(option)}+ </SelectItem>+ ))}</SelectViewport><SelectScrollDownButton><ChevronDownIcon />diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.tsindex 9b45922c00..3ab862adee 100644--- a/packages/design-system/src/index.ts+++ b/packages/design-system/src/index.ts@@ -37,7 +37,6 @@ export { IconButton } from "./components/icon-button";export { Box } from "./components/box";export * from "./components/popover";export { DeprecatedHeading } from "./components/__DEPRECATED__/heading";-export { MenuContent, MenuItem, Menu, MenuAnchor } from "./components/menu";export { Paragraph } from "./components/paragraph";export { Link } from "./components/link";export { Panel } from "./components/panel";diff --git a/packages/icons/icons/chevron-big-down.svg b/packages/icons/icons/chevron-big-down.svgnew file mode 100644index 0000000000..658a5b1a96--- /dev/null+++ b/packages/icons/icons/chevron-big-down.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.46094 10.9469L13.0133 5.48411C13.3389 5.09331 13.061 4.5 12.5523 4.5L3.4477 4.5C2.939 4.5 2.66111 5.09331 2.98677 5.48411L7.53908 10.9469C7.77895 11.2347 8.22107 11.2347 8.46094 10.9469Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-big-left.svg b/packages/icons/icons/chevron-big-left.svgnew file mode 100644index 0000000000..d9f4fdad27--- /dev/null+++ b/packages/icons/icons/chevron-big-left.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M5.05312 8.46094L10.5159 13.0133C10.9067 13.3389 11.5 13.061 11.5 12.5523L11.5 3.4477C11.5 2.939 10.9067 2.66111 10.5159 2.98677L5.05312 7.53908C4.76527 7.77895 4.76527 8.22106 5.05312 8.46094Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-big-right.svg b/packages/icons/icons/chevron-big-right.svgnew file mode 100644index 0000000000..759b3fd9c3--- /dev/null+++ b/packages/icons/icons/chevron-big-right.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.9469 7.53906L5.48411 2.98675C5.09331 2.66109 4.5 2.93898 4.5 3.44768L4.5 12.5523C4.5 13.061 5.09331 13.3389 5.48411 13.0132L10.9469 8.46092C11.2347 8.22105 11.2347 7.77893 10.9469 7.53906Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-big-up.svg b/packages/icons/icons/chevron-big-up.svgnew file mode 100644index 0000000000..d06f901600--- /dev/null+++ b/packages/icons/icons/chevron-big-up.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.53906 5.05312L2.98675 10.5159C2.66109 10.9067 2.93898 11.5 3.44768 11.5L12.5523 11.5C13.061 11.5 13.3389 10.9067 13.0132 10.5159L8.46092 5.05312C8.22105 4.76527 7.77893 4.76527 7.53906 5.05312Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-filled-down.svg b/packages/icons/icons/chevron-filled-down.svgnew file mode 100644index 0000000000..ac080bc946--- /dev/null+++ b/packages/icons/icons/chevron-filled-down.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8.49923 10.2512L11.3781 5.93282C11.6439 5.53409 11.3581 5 10.8789 5L5.12111 5C4.64189 5 4.35606 5.53409 4.62188 5.93282L7.50077 10.2512C7.73826 10.6074 8.26174 10.6074 8.49923 10.2512Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-filled-left.svg b/packages/icons/icons/chevron-filled-left.svgnew file mode 100644index 0000000000..c907d54d00--- /dev/null+++ b/packages/icons/icons/chevron-filled-left.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M5.74885 8.49923L10.0672 11.3781C10.4659 11.6439 11 11.3581 11 10.8789L11 5.12111C11 4.64189 10.4659 4.35606 10.0672 4.62188L5.74885 7.50077C5.39261 7.73826 5.39261 8.26174 5.74885 8.49923Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-filled-right.svg b/packages/icons/icons/chevron-filled-right.svgnew file mode 100644index 0000000000..1a6c5525bd--- /dev/null+++ b/packages/icons/icons/chevron-filled-right.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10.2512 7.50077L5.93282 4.62188C5.53409 4.35606 5 4.64189 5 5.12111V10.8789C5 11.3581 5.53409 11.6439 5.93282 11.3781L10.2512 8.49923C10.6074 8.26174 10.6074 7.73826 10.2512 7.50077Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/chevron-filled-up.svg b/packages/icons/icons/chevron-filled-up.svgnew file mode 100644index 0000000000..b6a7db884f--- /dev/null+++ b/packages/icons/icons/chevron-filled-up.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M7.50078 5.50802L4.62189 9.82636C4.35607 10.2251 4.6419 10.7592 5.12112 10.7592H10.8789C11.3581 10.7592 11.644 10.2251 11.3781 9.82636L8.49924 5.50802C8.26175 5.15178 7.73827 5.15178 7.50078 5.50802Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/icons/dot.svg b/packages/icons/icons/dot.svgnew file mode 100644index 0000000000..eb2a3e11f6--- /dev/null+++ b/packages/icons/icons/dot.svg@@ -0,0 +1,3 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M10 8C10 9.10457 9.10457 10 8 10C6.89543 10 6 9.10457 6 8C6 6.89543 6.89543 6 8 6C9.10457 6 10 6.89543 10 8Z" fill="#11181C"/>+</svg>diff --git a/packages/icons/src/__generated__/chevron-big-down.tsx b/packages/icons/src/__generated__/chevron-big-down.tsxnew file mode 100644index 0000000000..3256fdc965--- /dev/null+++ b/packages/icons/src/__generated__/chevron-big-down.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-big-down.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronBigDownIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="m8.46 10.947 4.553-5.463a.6.6 0 0 0-.46-.984H3.447a.6.6 0 0 0-.461.984l4.552 5.463a.6.6 0 0 0 .922 0Z" /></svg>+ );+ }+);++ChevronBigDownIcon.displayName = "ChevronBigDownIcon";diff --git a/packages/icons/src/__generated__/chevron-big-left.tsx b/packages/icons/src/__generated__/chevron-big-left.tsxnew file mode 100644index 0000000000..23bfa2363a--- /dev/null+++ b/packages/icons/src/__generated__/chevron-big-left.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-big-left.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronBigLeftIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="m5.053 8.46 5.463 4.553a.6.6 0 0 0 .984-.46V3.447a.6.6 0 0 0-.984-.461L5.053 7.539a.6.6 0 0 0 0 .922Z" /></svg>+ );+ }+);++ChevronBigLeftIcon.displayName = "ChevronBigLeftIcon";diff --git a/packages/icons/src/__generated__/chevron-big-right.tsx b/packages/icons/src/__generated__/chevron-big-right.tsxnew file mode 100644index 0000000000..bb4169741c--- /dev/null+++ b/packages/icons/src/__generated__/chevron-big-right.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-big-right.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronBigRightIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M10.947 7.54 5.484 2.986a.6.6 0 0 0-.984.46v9.105a.6.6 0 0 0 .984.461l5.463-4.552a.6.6 0 0 0 0-.922Z" /></svg>+ );+ }+);++ChevronBigRightIcon.displayName = "ChevronBigRightIcon";diff --git a/packages/icons/src/__generated__/chevron-big-up.tsx b/packages/icons/src/__generated__/chevron-big-up.tsxnew file mode 100644index 0000000000..3e04651ea3--- /dev/null+++ b/packages/icons/src/__generated__/chevron-big-up.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-big-up.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronBigUpIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="m7.54 5.053-4.553 5.463a.6.6 0 0 0 .46.984h9.105a.6.6 0 0 0 .461-.984L8.461 5.053a.6.6 0 0 0-.922 0Z" /></svg>+ );+ }+);++ChevronBigUpIcon.displayName = "ChevronBigUpIcon";diff --git a/packages/icons/src/__generated__/chevron-filled-down.tsx b/packages/icons/src/__generated__/chevron-filled-down.tsxnew file mode 100644index 0000000000..74c050b5b6--- /dev/null+++ b/packages/icons/src/__generated__/chevron-filled-down.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-filled-down.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronFilledDownIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="m8.5 10.251 2.878-4.318a.6.6 0 0 0-.5-.933H5.122a.6.6 0 0 0-.5.933l2.88 4.318a.6.6 0 0 0 .998 0Z" /></svg>+ );+ }+);++ChevronFilledDownIcon.displayName = "ChevronFilledDownIcon";diff --git a/packages/icons/src/__generated__/chevron-filled-left.tsx b/packages/icons/src/__generated__/chevron-filled-left.tsxnew file mode 100644index 0000000000..1c121e4423--- /dev/null+++ b/packages/icons/src/__generated__/chevron-filled-left.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-filled-left.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronFilledLeftIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="m5.749 8.5 4.318 2.878a.6.6 0 0 0 .933-.5V5.122a.6.6 0 0 0-.933-.5L5.75 7.502a.6.6 0 0 0 0 .998Z" /></svg>+ );+ }+);++ChevronFilledLeftIcon.displayName = "ChevronFilledLeftIcon";diff --git a/packages/icons/src/__generated__/chevron-filled-right.tsx b/packages/icons/src/__generated__/chevron-filled-right.tsxnew file mode 100644index 0000000000..e136b7ef69--- /dev/null+++ b/packages/icons/src/__generated__/chevron-filled-right.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-filled-right.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronFilledRightIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M10.251 7.5 5.933 4.623a.6.6 0 0 0-.933.5v5.757a.6.6 0 0 0 .933.5l4.318-2.88a.6.6 0 0 0 0-.998Z" /></svg>+ );+ }+);++ChevronFilledRightIcon.displayName = "ChevronFilledRightIcon";diff --git a/packages/icons/src/__generated__/chevron-filled-up.tsx b/packages/icons/src/__generated__/chevron-filled-up.tsxnew file mode 100644index 0000000000..bf936fff60--- /dev/null+++ b/packages/icons/src/__generated__/chevron-filled-up.tsx@@ -0,0 +1,15 @@+// Generated from icons/chevron-filled-up.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const ChevronFilledUpIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M7.5 5.508 4.623 9.826a.6.6 0 0 0 .5.933h5.757a.6.6 0 0 0 .5-.933l-2.88-4.318a.6.6 0 0 0-.998 0Z" /></svg>+ );+ }+);++ChevronFilledUpIcon.displayName = "ChevronFilledUpIcon";diff --git a/packages/icons/src/__generated__/dot.tsx b/packages/icons/src/__generated__/dot.tsxnew file mode 100644index 0000000000..65ecad1e09--- /dev/null+++ b/packages/icons/src/__generated__/dot.tsx@@ -0,0 +1,15 @@+// Generated from icons/dot.svg++import { forwardRef } from "react";+import { IconProps } from "../types";++// prettier-ignore+export const DotIcon = forwardRef<SVGSVGElement, IconProps>(+ ({ color = "currentColor", ...props }, forwardedRef) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z" /></svg>+ );+ }+);++DotIcon.displayName = "DotIcon";diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.tsindex 36c9a86693..245e5d8779 100644--- a/packages/icons/src/__generated__/index.ts+++ b/packages/icons/src/__generated__/index.ts@@ -7,3 +7,12 @@ export * from "./subscript";export * from "./superscript";export * from "./unlinked";export * from "./webstudio";+export * from "./chevron-big-down";+export * from "./chevron-big-left";+export * from "./chevron-big-right";+export * from "./chevron-big-up";+export * from "./chevron-filled-down";+export * from "./chevron-filled-left";+export * from "./chevron-filled-right";+export * from "./chevron-filled-up";+export * from "./dot";diff --git a/packages/icons/src/check-mark.tsx b/packages/icons/src/check-mark.tsxnew file mode 100644index 0000000000..3e3b5655b7--- /dev/null+++ b/packages/icons/src/check-mark.tsx@@ -0,0 +1,28 @@+import { forwardRef } from "react";+import { IconProps } from "./types";++export const CheckMarkIcon = 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.75 8.25L6.75 10.25L11.25 5.75"+ stroke={color}+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+ }+);++CheckMarkIcon.displayName = "CheckMarkIcon";diff --git a/packages/icons/src/index.ts b/packages/icons/src/index.tsindex 0e7b4c64f8..8accff8bbf 100644--- a/packages/icons/src/index.ts+++ b/packages/icons/src/index.ts@@ -89,3 +89,4 @@ export * from "./text-underline";export * from "./text-uppercase";export * from "./text-direction-ltr";export * from "./text-direction-rtl";+export * from "./check-mark";diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f5aea22b6e..6e9f05ccc5 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -395,7 +395,6 @@ importers:'@radix-ui/react-dropdown-menu': ^1.0.0'@radix-ui/react-id': ^1.0.0'@radix-ui/react-label': ^1.0.0- '@radix-ui/react-menu': ^1.0.0'@radix-ui/react-popover': ^1.0.0'@radix-ui/react-popper': ^1.0.0'@radix-ui/react-portal': ^1.0.0@@ -453,7 +452,6 @@ importers:'@radix-ui/react-dropdown-menu': 1.0.0_nn45z5sr7igu7sfun6tiae5hx4'@radix-ui/react-id': [email protected]'@radix-ui/react-label': 1.0.0_sfoxds7t5ydpegc3knd667wn6m- '@radix-ui/react-menu': 1.0.0_nn45z5sr7igu7sfun6tiae5hx4'@radix-ui/react-popover': 1.0.0_nn45z5sr7igu7sfun6tiae5hx4'@radix-ui/react-popper': 1.0.0_nn45z5sr7igu7sfun6tiae5hx4'@radix-ui/react-portal': 1.0.0_sfoxds7t5ydpegc3knd667wn6m