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
feat: updated inputs design system (#4635)
Oleg Isonen62c4ae17d82a
diff --git a/apps/builder/app/builder/features/breakpoints/breakpoints-popover.tsx b/apps/builder/app/builder/features/breakpoints/breakpoints-popover.tsxindex 81921e2f90..c9481d683a 100644--- a/apps/builder/app/builder/features/breakpoints/breakpoints-popover.tsx+++ b/apps/builder/app/builder/features/breakpoints/breakpoints-popover.tsx@@ -18,6 +18,7 @@ import {Box,PopoverMenuItemRightSlot,Tooltip,+ InputField,} from "@webstudio-is/design-system";import { BreakpointsEditor } from "./breakpoints-editor";import { BreakpointsPopoverToolbarButton } from "./breakpoints-popover-toolbar-button";@@ -94,7 +95,12 @@ export const BreakpointsPopover = () => {<BreakpointsPopoverToolbarButton css={{ gap: theme.spacing[5] }} /></PopoverTrigger></Tooltip>- <PopoverContent sideOffset={0} collisionPadding={4} align="start">+ <PopoverContent+ sideOffset={0}+ collisionPadding={4}+ align="start"+ css={{ width: theme.spacing[30] }}+ >{view === "confirmation" && breakpointToDelete && (<ConfirmationDialogbreakpoint={breakpointToDelete}@@ -115,17 +121,15 @@ export const BreakpointsPopover = () => {)}{view === "initial" && (<>- <Flex css={{ p: theme.panel.padding }} gap="3">+ <Flex css={{ padding: theme.panel.padding }} gap="3"><WidthInput min={minCanvasWidth} /><Flex align="center" gap="2"><Label>Scale</Label>- <Button- color="neutral"- css={{ width: theme.spacing[17] }}+ <InputField+ value={`${Math.round(scale)}%`}tabIndex={-1}- >- {Math.round(scale)}%- </Button>+ readOnly+ /></Flex></Flex><PopoverSeparator />diff --git a/apps/builder/app/builder/features/breakpoints/confirmation-dialog.tsx b/apps/builder/app/builder/features/breakpoints/confirmation-dialog.tsxindex aef8d25062..4d2155abc5 100644--- a/apps/builder/app/builder/features/breakpoints/confirmation-dialog.tsx+++ b/apps/builder/app/builder/features/breakpoints/confirmation-dialog.tsx@@ -13,11 +13,7 @@ export const ConfirmationDialog = ({onAbort,}: ConfirmationDialogProps) => {return (- <Flex- gap="2"- direction="column"- css={{ px: theme.spacing[11], py: theme.spacing[5], width: 300 }}- >+ <Flex gap="2" direction="column" css={{ padding: theme.spacing[5] }}><Text>{`Are you sure you want to delete "${breakpoint.label}"?`}</Text><Text>{`Deleting a breakpoint will also delete all styles associated with thisdiff --git a/apps/builder/app/builder/features/breakpoints/width-input.tsx b/apps/builder/app/builder/features/breakpoints/width-input.tsxindex fc77fabd79..23e7c4caae 100644--- a/apps/builder/app/builder/features/breakpoints/width-input.tsx+++ b/apps/builder/app/builder/features/breakpoints/width-input.tsx@@ -134,14 +134,13 @@ export const WidthInput = ({ min }: { min: number }) => {<Label htmlFor={id}>Width</Label><InputField{...inputProps}- css={{ width: theme.spacing[19] }}id={id}suffix={<Textvariant="unit"color="subtle"align="center"- css={{ width: theme.spacing[10] }}+ css={{ paddingInline: theme.spacing[3] }}>PX</Text>diff --git a/apps/builder/app/builder/features/style-panel/sections/layout/shared/flex-grid.tsx b/apps/builder/app/builder/features/style-panel/sections/layout/shared/flex-grid.tsxindex 4c43926f0b..1ab1439dd3 100644--- a/apps/builder/app/builder/features/style-panel/sections/layout/shared/flex-grid.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/layout/shared/flex-grid.tsx@@ -49,18 +49,14 @@ export const FlexGrid = () => {flexDirectionValue === "column" || flexDirectionValue === "column-reverse";let color = theme.colors.foregroundFlexUiMain;- let borderColor = theme.colors.foregroundFlexUiMain;if (styleValueSourceColor === "local") {- borderColor = theme.colors.borderLocalMain;color = theme.colors.foregroundLocalFlexUi;}if (styleValueSourceColor === "overwritten") {- borderColor = theme.colors.borderOverwrittenFlexUi;color = theme.colors.foregroundOverwrittenFlexUi;}if (styleValueSourceColor === "remote") {- borderColor = theme.colors.borderRemoteFlexUi;color = theme.colors.foregroundRemoteFlexUi;}@@ -77,9 +73,8 @@ export const FlexGrid = () => {<GridtabIndex={0}css={{- padding: theme.spacing[2],+ padding: theme.spacing[3],borderRadius: theme.borderRadius[4],- outline: `1px solid ${borderColor}`,background: theme.colors.backgroundControls,alignItems: "center",gap: 0,@@ -120,8 +115,7 @@ export const FlexGrid = () => {minWidth: "auto",color: theme.colors.foregroundFlexUiMain,"&:hover": {- // @todo not clear which token to use here- background: theme.colors.backgroundHover,+ background: theme.colors.foregroundFlexUiHover,},"&:focus": {background: "none",diff --git a/apps/builder/app/builder/features/style-panel/sections/position/inset-layout.tsx b/apps/builder/app/builder/features/style-panel/sections/position/inset-layout.tsxindex 701e1fa443..731804f27b 100644--- a/apps/builder/app/builder/features/style-panel/sections/position/inset-layout.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/position/inset-layout.tsx@@ -27,7 +27,7 @@ const Trapezoid = styled("div", {const TopBottom = styled(Trapezoid, {zIndex: 0,- backgroundColor: theme.colors.backgroundPanel,+ backgroundColor: theme.colors.backgroundSpacingTopBottom,});const LeftRight = styled(Trapezoid, {diff --git a/apps/builder/app/builder/features/style-panel/sections/space/layout.tsx b/apps/builder/app/builder/features/style-panel/sections/space/layout.tsxindex 3d29d2a613..438803a176 100644--- a/apps/builder/app/builder/features/style-panel/sections/space/layout.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/space/layout.tsx@@ -41,7 +41,7 @@ const emulateInnerStroke = ({});const ValueArea = styled("path", {- fill: theme.colors.backgroundPanel,+ fill: theme.colors.backgroundSpacingTopBottom,variants: {side: {top: { cursor: "n-resize" },@@ -55,7 +55,11 @@ const ValueArea = styled("path", {fill: theme.colors.backgroundSpacingLeftRight,},},- isActive: { true: { fill: theme.colors.backgroundSpacingHover } },+ isActive: {+ true: {+ fill: theme.colors.backgroundSpacingHover,+ },+ },},});diff --git a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsxindex a86bf0e478..73ecc4ed0f 100644--- a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx+++ b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx@@ -80,10 +80,13 @@ const TextFieldContainer = styled("div", {alignItems: "center",backgroundColor: theme.colors.backgroundControls,gap: theme.spacing[2],- p: theme.spacing[2],+ padding: theme.spacing[2],borderRadius: theme.borderRadius[4],minWidth: 0,- border: `1px solid ${theme.colors.borderMain}`,+ border: `1px solid transparent`,+ "&:hover": {+ borderColor: theme.colors.borderMain,+ },"&:focus-within": {borderColor: theme.colors.borderFocus,},diff --git a/apps/builder/app/builder/shared/image-manager/image-info.tsx b/apps/builder/app/builder/shared/image-manager/image-info.tsxindex 3228d54eea..02eb0fb51d 100644--- a/apps/builder/app/builder/shared/image-manager/image-info.tsx+++ b/apps/builder/app/builder/shared/image-manager/image-info.tsx@@ -50,13 +50,13 @@ export const ImageInfo = ({ asset, onDelete }: ImageInfoProps) => {{"width" in meta && "height" in meta ? (<Box css={{ padding: theme.panel.padding }}><Grid columns={2} gap={2} align="center">- <Flex align="center" css={{ gap: theme.spacing[3] }}>+ <Flex align="center" gap={1}><SizeIcon /><Text variant="labelsSentenceCase">{meta.width} x {meta.height}</Text></Flex>{" "}- <Flex align="center" css={{ gap: theme.spacing[3] }}>+ <Flex align="center" gap={1}><AspectRatioIcon /><Text variant="labelsSentenceCase">{getFormattedAspectRatio(meta)}diff --git a/apps/builder/app/builder/sidebar-left/sidebar-tabs.tsx b/apps/builder/app/builder/sidebar-left/sidebar-tabs.tsxindex 2449ce2b87..4483ec65b3 100644--- a/apps/builder/app/builder/sidebar-left/sidebar-tabs.tsx+++ b/apps/builder/app/builder/sidebar-left/sidebar-tabs.tsx@@ -34,19 +34,17 @@ const buttonStyle = css({outline: "none",alignItems: "center",justifyContent: "center",- color: theme.colors.foregroundSubtle,+ color: theme.colors.foregroundMain,backgroundColor: theme.colors.backgroundPanel,border: "none","&:focus-visible": triggerFocusRing,"@hover": {"&:hover": {- color: theme.colors.foregroundMain,backgroundColor: theme.colors.backgroundHover,},},'&[data-state="active"]': {- color: theme.colors.foregroundMain,backgroundColor: theme.colors.backgroundHover,},});diff --git a/packages/design-system/src/__generated__/figma-design-tokens.json b/packages/design-system/src/__generated__/figma-design-tokens.jsonindex 182e46376c..ca3f93801c 100644--- a/packages/design-system/src/__generated__/figma-design-tokens.json+++ b/packages/design-system/src/__generated__/figma-design-tokens.json@@ -397,7 +397,7 @@"description": "primary color, used in button"},"hover": {- "value": "#dfe3e6",+ "value": "#efefef","type": "color","description": "hover color for toggle group button, icon button, toggle button, small icon button, small toggle button, nested select button, menu item large"},@@ -412,7 +412,7 @@"description": "background color for menu and select menu"},"controls": {- "value": "#ffffff",+ "value": "#f5f5f5","type": "color","description": "background color for text input, toggle group, input field, color input, select button, panel button, text-area, search field, checkbox, spacing, flex control"},@@ -438,7 +438,7 @@"description": "background color on neutral toast"},"dark": {- "value": "#7e868c",+ "value": "#b2b2b2","type": "color"}},@@ -491,7 +491,7 @@},"preset": {"main": {- "value": "#e6e8eb",+ "value": "#e6e6e6","type": "color"},"hover": {@@ -538,7 +538,7 @@},"button": {"hover": {- "value": "#ffffff17",+ "value": "#00000010","type": "color","description": "transparent color to create the hover state for button"},@@ -575,7 +575,7 @@"description": "color for the hidden current item in the navigator item component"},"menu-item-hover": {- "value": "#dfe3e6",+ "value": "#efefef","type": "color","description": "The hover state on menu item components."}@@ -596,7 +596,7 @@},"spacing": {"top-bottom": {- "value": "#f1f3f5",+ "value": "#f8f8f8","type": "color"},"left-right": {@@ -605,7 +605,7 @@"description": "Left and right padding and margin background colors for the Position section UI."},"hover": {- "value": "#d7dbdf",+ "value": "#e3e3e3","type": "color"}},@@ -819,7 +819,7 @@},"border": {"main": {- "value": "#d9d9d9",+ "value": "#e6e6e6","type": "color","description": "color for separators, panel borders, preset borders, input fields, select buttons, panel buttons, text area, search field, menu, select menu, spacing controls,"},@@ -986,7 +986,7 @@"description": "color for flex control ui elements"},"hover": {- "value": "#96c7f2",+ "value": "#e3e3e3","type": "color","description": "color for hovered state of flex control ui elements"}@@ -1052,7 +1052,7 @@"type": "color"},"flex-hover": {- "value": "#96c7f2",+ "value": "#e3e3e3","type": "color","description": "color for hovered state of flex control ui elements"}@@ -1493,8 +1493,6 @@},"$themes": [],"$metadata": {- "tokenSetOrder": [- "global"- ]+ "tokenSetOrder": ["global"]}-}\ No newline at end of file+}diff --git a/packages/design-system/src/__generated__/figma-design-tokens.ts b/packages/design-system/src/__generated__/figma-design-tokens.tsindex da9158e1ff..697d007c76 100644--- a/packages/design-system/src/__generated__/figma-design-tokens.ts+++ b/packages/design-system/src/__generated__/figma-design-tokens.ts@@ -386,15 +386,15 @@ export const color = {black: "#000000",backgroundPanel: "#fff",backgroundPrimary: "#096cff",- backgroundHover: "#dfe3e6",+ backgroundHover: "#efefef",backgroundActive: "#096cff",backgroundMenu: "#fff",- backgroundControls: "#ffffff",+ backgroundControls: "#f5f5f5",backgroundAssetcardHover: "#e6e8eb",backgroundNeutralMain: "#d7dbdf",backgroundNeutralAccent: "#11181c",backgroundNeutralNotification: "#ffffff",- backgroundNeutralDark: "#7e868c",+ backgroundNeutralDark: "#b2b2b2",backgroundDestructiveMain: "#dc2929",backgroundDestructiveNotification: "#ffe9e9",backgroundSuccessMain: "#00894a",@@ -403,7 +403,7 @@ export const color = {backgroundAlertNotification: "#fffbd1",backgroundInfoMain: "#0175dc",backgroundInfoNotification: "#e0f0ff",- backgroundPresetMain: "#e6e8eb",+ backgroundPresetMain: "#e6e6e6",backgroundPresetHover: "#dfe3e6",backgroundLocalMain: "#e1f0ff",backgroundLocalHover: "#cee7fe",@@ -412,20 +412,20 @@ export const color = {backgroundInputSelected: "#b7d9f8",backgroundInputDisabled: "#f8f8f8",backgroundInputHighlight: "#b7d9f8",- backgroundButtonHover: "#ffffff17",+ backgroundButtonHover: "#00000010",backgroundButtonPressed: "#0000001c",backgroundButtonDisabled: "#e9ebed",backgroundButtonDisabledDark: "#646464",backgroundItemCurrent: "#e1f0ff",backgroundItemCurrentChild: "#fff",backgroundItemCurrentHidden: "#7e868c",- backgroundItemMenuItemHover: "#dfe3e6",+ backgroundItemMenuItemHover: "#efefef",backgroundTooltipMain: "#11181c",backgroundTooltipBuilder: "#ffffff",backgroundTooltipDesigner: "#ffffff",- backgroundSpacingTopBottom: "#f1f3f5",+ backgroundSpacingTopBottom: "#f8f8f8",backgroundSpacingLeftRight: "#f1f3f5",- backgroundSpacingHover: "#d7dbdf",+ backgroundSpacingHover: "#e3e3e3",backgroundStyleSourceToken: "#834df4",backgroundStyleSourceTag: "#d54113",backgroundStyleSourceState: "#00894a",@@ -481,7 +481,7 @@ export const color = {brandSpinnerBlue: "#4a4efa",brandSpinnerPurple: "#e63cfe",brandSpinnerOrange: "#ffae3c",- borderMain: "#d9d9d9",+ borderMain: "#e6e6e6",borderFocus: "#096cff",borderMenuInner: "#fcfcfc",borderColorSwatch: "#687076",@@ -512,7 +512,7 @@ export const color = {foregroundDisabled: "#c1c8cd",foregroundHiddenItem: "#7e868c",foregroundFlexUiMain: "#c7c7c7",- foregroundFlexUiHover: "#96c7f2",+ foregroundFlexUiHover: "#e3e3e3",foregroundContrastMain: "#ffffff",foregroundContrastSubtle: "#c1c8cd",foregroundLocalMain: "#016ccc",@@ -524,7 +524,7 @@ export const color = {foregroundSuccessText: "#008447",foregroundGridControlsDot: "#c7c7c7",foregroundGridControlsDotHover: "#707375",- foregroundGridControlsFlexHover: "#96c7f2",+ foregroundGridControlsFlexHover: "#e3e3e3",foregroundIconSecondary: "#c1c8cd",foregroundIconMain: "#11181c",foregroundMoreSubtle: "#adb1b4",diff --git a/packages/design-system/src/components/button.tsx b/packages/design-system/src/components/button.tsxindex aba723fe43..0a23a8a298 100644--- a/packages/design-system/src/components/button.tsx+++ b/packages/design-system/src/components/button.tsx@@ -54,10 +54,6 @@ const foregrounds: Record<ButtonColor, string> = {"dark-ghost": theme.colors.foregroundContrastMain,};-// CSS supports multiple gradients as backgrounds but not multiple colors-const backgroundColors = (base: string, overlay: string) =>- `linear-gradient(${overlay}, ${overlay}), linear-gradient(${base}, ${base})`;-const perColorStyle = (variant: ButtonColor) => ({background:variant === "ghost" || variant === "dark-ghost"@@ -73,10 +69,7 @@ const perColorStyle = (variant: ButtonColor) => ({background:variant === "gradient"? `linear-gradient(${theme.colors.backgroundButtonHover}, ${theme.colors.backgroundButtonHover}), ${backgrounds[variant]}`- : backgroundColors(- backgrounds[variant],- theme.colors.backgroundButtonHover- ),+ : `oklch(from ${backgrounds[variant]} l c h / 0.8)`,},"&[data-state=auto]:focus-visible, &[data-state=focus]": {@@ -90,10 +83,7 @@ const perColorStyle = (variant: ButtonColor) => ({background:variant === "gradient"? `linear-gradient(${theme.colors.backgroundButtonPressed}, ${theme.colors.backgroundButtonPressed}), ${backgrounds[variant]}`- : backgroundColors(- backgrounds[variant],- theme.colors.backgroundButtonPressed- ),+ : `oklch(from ${backgrounds[variant]} l c h / 0.8)`,},"&:disabled:not([data-state=pending]), &[data-state=disabled], &[aria-disabled=true], &[aria-disabled=true]:hover, &[aria-disabled=true]:visited":diff --git a/packages/design-system/src/components/combobox.tsx b/packages/design-system/src/components/combobox.tsxindex b5f948cae0..6d10185048 100644--- a/packages/design-system/src/components/combobox.tsx+++ b/packages/design-system/src/components/combobox.tsx@@ -480,7 +480,9 @@ export const Combobox = <Item,>({color={color}suffix={suffix ?? (- <NestedInputButton {...combobox.getToggleButtonProps()} />+ <Flex>+ <NestedInputButton {...combobox.getToggleButtonProps()} />+ </Flex>)}/>diff --git a/packages/design-system/src/components/input-field.tsx b/packages/design-system/src/components/input-field.tsxindex 9657cb483f..d12236db55 100644--- a/packages/design-system/src/components/input-field.tsx+++ b/packages/design-system/src/components/input-field.tsx@@ -82,8 +82,11 @@ const containerStyle = css({minWidth: 0,alignItems: "center",borderRadius: theme.borderRadius[4],- border: `solid 1px ${theme.colors.borderMain}`,+ border: `solid 1px transparent`,backgroundColor: theme.colors.backgroundControls,+ "&:hover": {+ borderColor: theme.colors.borderMain,+ },"&:focus-within": {borderColor: theme.colors.borderFocus,},diff --git a/packages/design-system/src/components/position-grid.tsx b/packages/design-system/src/components/position-grid.tsxindex 01418aa531..5e1799484a 100644--- a/packages/design-system/src/components/position-grid.tsx+++ b/packages/design-system/src/components/position-grid.tsx@@ -65,7 +65,7 @@ const dotStyle = css({borderRadius: "50%",},"&[data-selected=true], &:hover": {- background: theme.colors.backgroundHover,+ background: theme.colors.foregroundGridControlsFlexHover,"&::before": {background: theme.colors.foregroundGridControlsDotHover,},diff --git a/packages/design-system/src/components/select-button.tsx b/packages/design-system/src/components/select-button.tsxindex 9b4f5dd1d8..4b05140c11 100644--- a/packages/design-system/src/components/select-button.tsx+++ b/packages/design-system/src/components/select-button.tsx@@ -27,12 +27,15 @@ const style = css({display: "flex",alignItems: "center",background: theme.colors.backgroundControls,- border: `1px solid ${theme.colors.borderMain}`,+ border: `1px solid transparent`,borderRadius: theme.borderRadius[4],paddingRight: theme.spacing[1],paddingLeft: theme.spacing[1],color: theme.colors.foregroundMain,[chevronColor]: theme.colors.foregroundSubtle,+ "&:hover": {+ borderColor: theme.colors.borderMain,+ },"&[data-placeholder]:not([data-state=open], :hover, :disabled)": {color: theme.colors.foregroundSubtle,},diff --git a/packages/design-system/src/components/switch.tsx b/packages/design-system/src/components/switch.tsxindex 8a2cd2307d..5c68a56e21 100644--- a/packages/design-system/src/components/switch.tsx+++ b/packages/design-system/src/components/switch.tsx@@ -8,7 +8,7 @@ import * as Primitive from "@radix-ui/react-switch";import { type CSS, css, theme } from "../stitches.config";const padding = theme.spacing[1];-const thumbOffset = `calc(${padding} + ${theme.spacing[2]})`;+const thumbOffset = `calc(${padding} + ${theme.spacing[1]})`;const switchStyle = css({all: "unset", // reset <button>@@ -44,8 +44,8 @@ const switchStyle = css({});const thumbStyle = css({- width: theme.spacing[6],- height: theme.spacing[6],+ width: theme.spacing[7],+ height: theme.spacing[7],borderRadius: theme.borderRadius.round,backgroundColor: theme.colors.foregroundContrastMain,position: "absolute",diff --git a/packages/design-system/src/components/text-area.tsx b/packages/design-system/src/components/text-area.tsxindex 013780dac7..c4e446b8b7 100644--- a/packages/design-system/src/components/text-area.tsx+++ b/packages/design-system/src/components/text-area.tsx@@ -17,7 +17,7 @@ const borderWidth = 1;const gridStyle = css({color: theme.colors.foregroundMain,borderRadius: theme.borderRadius[4],- border: `${borderWidth}px solid ${theme.colors.borderMain}`,+ border: `${borderWidth}px solid transparent`,background: theme.colors.backgroundControls,paddingTop: paddingY,paddingBottom: paddingY,@@ -25,6 +25,9 @@ const gridStyle = css({resize: "vertical",overflow: "auto",width: "100%",+ "&:hover": {+ borderColor: theme.colors.borderMain,+ },"&:focus-within": {borderColor: theme.colors.borderFocus,},