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 styles for font family and color picker
Oleg Isonenaf5ab7d62803
diff --git a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsxindex 4fbc1c2ba7..c2c2b9ac36 100644--- a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx@@ -12,13 +12,6 @@ import { PANEL_WIDTH } from "~/designer/shared/constants";import { MutableRefObject, useRef, useState } from "react";import { FontsManager } from "~/designer/shared/fonts-manager";-const textFieldStyle = {- paddingLeft: "calc($sizes$1 + $nudge$3)",- textAlign: "left",- height: "$6",- fontWeight: "500",-};-const usePickerSideOffset = (isOpen: boolean): [MutableRefObject<HTMLInputElement | null>, number] => {@@ -52,9 +45,7 @@ export const FontFamilyControl = ({<PopoverTrigger asChild><TextFieldref={textFieldRef}- css={textFieldStyle}spellCheck={false}- readOnlydefaultValue={value.value}onClick={() => {setIsOpen(true);diff --git a/apps/designer/app/designer/features/style-panel/shared/color-picker.tsx b/apps/designer/app/designer/features/style-panel/shared/color-picker.tsxindex e5b942a36a..7238aa912c 100644--- a/apps/designer/app/designer/features/style-panel/shared/color-picker.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/color-picker.tsx@@ -51,50 +51,53 @@ export const ColorPicker = ({// Color picker will use 0 as alpha value, which will force user to set alpha every time they have to change from transparentif (value === "transparent") value = "";+ const prefix = (+ <Popover+ modal+ open={displayColorPicker}+ onOpenChange={setDisplayColorPicker}+ >+ <PopoverTrigger+ asChild+ aria-label="Open color picker"+ onClick={() => setDisplayColorPicker((shown) => !shown)}+ >+ <Box+ css={{+ margin: "$sizes$1",+ width: "$sizes$4",+ height: "$sizes$4",+ borderRadius: 2,+ background: value,+ }}+ />+ </PopoverTrigger>+ <PopoverPortal>+ <PopoverContent>+ <SketchPicker+ color={value}+ onChange={(color: ColorResult) =>+ onChange(stringifyRGBA(color.rgb))+ }+ onChangeComplete={(color: ColorResult) => {+ onChangeComplete(stringifyRGBA(color.rgb));+ }}+ // @todo to remove both when we have preset colors+ presetColors={[]}+ className={pickerStyle()}+ styles={defaultPickerStyles}+ />+ </PopoverContent>+ </PopoverPortal>+ </Popover>+ );+return (<TextField- onChange={(e) => onChange(e.target.value)}+ onChange={(event) => onChange(event.target.value)}value={value}id={id}- prefix={- <Popover- modal- open={displayColorPicker}- onOpenChange={setDisplayColorPicker}- >- <PopoverTrigger- asChild- aria-label="Open color picker"- onClick={() => setDisplayColorPicker((shown) => !shown)}- >- <Box- css={{- width: "$sizes$3",- height: "$sizes$3",- borderRadius: 2,- background: value,- }}- />- </PopoverTrigger>- <PopoverPortal>- <PopoverContent>- <SketchPicker- color={value}- onChange={(color: ColorResult) =>- onChange(stringifyRGBA(color.rgb))- }- onChangeComplete={(color: ColorResult) => {- onChangeComplete(stringifyRGBA(color.rgb));- }}- // @todo to remove both when we have preset colors- presetColors={[]}- className={pickerStyle()}- styles={defaultPickerStyles}- />- </PopoverContent>- </PopoverPortal>- </Popover>- }+ prefix={prefix}/>);};diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsxindex a283a9827e..8f2c48f4fe 100644--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx@@ -139,14 +139,15 @@ type CssValueInputProps = {** Unit mode:* - When entire text is a number we automatically switch to unit mode on keydown- * - Unit selection on unit button click+ * - Unit selection on unit button click or focus+enter* - When selecting unit arrow keys are used to navigate unit items* - When selecting unit Enter key or click is used to select item* - When selecting unit Escape key is used to close list* - Key up and down on focused input increment/decrement the value* - shift key modifier increases/decreases value by 10* - option/alt key modifier increases/decreases value by 0.1- * - During typing the unit until unit is matched, input is in invalid mode+ * - no modifier increases/decreases value by 1+ * - During typing the number + unit (e.g. "12px"), input is in keyword mode, but then after blur/enter unit entered is taken as a unit value* - Scrub interaction** Keywords mode:diff --git a/packages/design-system/src/components/text-field.tsx b/packages/design-system/src/components/text-field.tsxindex 381874c8b8..e75b74c027 100644--- a/packages/design-system/src/components/text-field.tsx+++ b/packages/design-system/src/components/text-field.tsx@@ -26,7 +26,9 @@ const InputBase = styled("input", {// Focus should start on the input element then move to prefix and suffix elements.// DOM order reflects focus path and visually we use order to put them into the correct visual order.order: 1,-+ "&[type='button']": {+ textAlign: "left",+ },'&[type="search"]': {"&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{@@ -69,7 +71,7 @@ const TextFieldBase = styled("div", {boxShadow: "inset 0 0 0 1px $colors$slate7",color: "$hiContrast",fontVariantNumeric: "tabular-nums",-+ gap: "$1",px: "$2",borderRadius: "$1",fontFamily: "$sans",