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
ephemeral updates on dropdown menu hover/highlighted
Sultan5e7a69df99c3
diff --git a/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx b/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsxindex 3027e725e3..a3aa40952c 100644--- a/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx@@ -65,8 +65,9 @@ export const MenuControl = ({label={styleConfig.label}items={items}value={String(currentValue)}- onChange={setValue}isActive={isFromCurrentBreakpoint}- ></IconButtonWithMenu>+ onChange={setValue}+ onHover={(value) => setValue(value, { isEphemeral: true })}+ />);};diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsxindex 853fb94883..3a6a6a0b4e 100644--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx@@ -154,12 +154,16 @@ export const TextControl = ({label: unit,}))}onChange={(unit) => setValue(value.value + unit)}+ onHover={(unit) =>+ setValue(value.value + unit, { isEphemeral: true })+ }/>) : (<Itemsvalue={value.value}items={styleConfig.items}onChange={(item) => setValue(item)}+ onHover={(item) => setValue(item, { isEphemeral: true })}/>)}<TextField@@ -210,10 +214,12 @@ const Units = ({value,items,onChange,+ onHover,}: {value: Unit;items: StyleConfig["items"];onChange?: (value: string) => void;+ onHover?: (value: string) => void;}) => {return (<Box css={iconButtonGridRightStyle}>@@ -226,6 +232,7 @@ const Units = ({items={items}value={String(value)}onChange={onChange}+ onHover={onHover}/></Box>);@@ -235,10 +242,12 @@ const Items = ({value,items,onChange,+ onHover,}: {value: StyleValue["value"];items: StyleConfig["items"];onChange?: (value: string) => void;+ onHover?: (value: string) => void;}) => {if (!items?.length) return null;return (@@ -248,6 +257,7 @@ const Items = ({items={items}value={String(value)}onChange={onChange}+ onHover={onHover}/></Box>);diff --git a/packages/design-system/src/components/icon-button-with-menu.tsx b/packages/design-system/src/components/icon-button-with-menu.tsxindex 3a4ec5cd06..44f6969b31 100644--- a/packages/design-system/src/components/icon-button-with-menu.tsx+++ b/packages/design-system/src/components/icon-button-with-menu.tsx@@ -30,31 +30,22 @@ const itemStyles = {paddingRight: "$space$5",userSelect: "none",gap: "$space$2",- "&:hover": {+ // @todo should be "&[data-highlighted]" don't know why radix isn't activating the attribute though+ "&[tabindex='0']": {background: "$colors$blue10",color: "$colors$blue1","& *": { fill: "$colors$blue1" },},};-const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, {- ...itemStyles,-});-const StyledItemIndicator = styled(DropdownMenuPrimitive.ItemIndicator, {+const itemIndicatorStyle = {position: "absolute",left: 0,width: 25,display: "inline-flex",alignItems: "center",justifyContent: "center",-});--const StyledArrow = styled(DropdownMenuPrimitive.Arrow, {- "& *": {- fill: "$colors$gray4",- stroke: "$colors$gray8",- },-});+};const iconButtonStyle = {width: "$6",@@ -72,8 +63,27 @@ const iconButtonActiveStyle = {"&:hover": {backgroundColor: "$colors$blue4",},+ "&:focus": {+ boxShadow: "inset 0 0 0 1px $colors$blue9, 0 0 0 1px $colors$blue9",+ },+};++const arrowStyle = {+ "& *": {+ fill: "$colors$gray4",+ stroke: "$colors$gray8",+ },};+const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, itemStyles);++const StyledItemIndicator = styled(+ DropdownMenuPrimitive.ItemIndicator,+ itemIndicatorStyle+);++const StyledArrow = styled(DropdownMenuPrimitive.Arrow, arrowStyle);+export const IconButtonWithMenu = ({icon: Icon,label,@@ -81,6 +91,7 @@ export const IconButtonWithMenu = ({items,isActive,onChange,+ onHover,}: {icon?: JSX.Element;label?: string;@@ -92,6 +103,7 @@ export const IconButtonWithMenu = ({}>;isActive?: boolean;onChange?: (value: string) => void;+ onHover?: (value: string) => void;}) => {return (<DropdownMenuPrimitive.Root modal={false}>@@ -104,9 +116,7 @@ export const IconButtonWithMenu = ({<IconButtoncss={{...iconButtonStyle,- ...(isActive && {- iconButtonActiveStyle,- }),+ ...(isActive && iconButtonActiveStyle),}}>{Icon}@@ -121,7 +131,12 @@ export const IconButtonWithMenu = ({>{items.map(({ name, label, icon }) => {return (- <StyledRadioItem key={name} value={label}>+ <StyledRadioItem+ key={name}+ value={label}+ onFocus={() => onHover?.(name)}+ onBlur={() => onHover?.(value)}+ ><StyledItemIndicator><CheckIcon /></StyledItemIndicator>