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
button input stays in active state now while fonts manager is open
Oleg Isonenae5df0b23282
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 20b8af6320..5ae320f6b5 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@@ -3,6 +3,7 @@ import { FontsManager } from "~/designer/shared/fonts-manager";import type { ControlProps } from "../../style-sections";import { getFinalValue } from "../../shared/get-final-value";import { ValuePickerPopover } from "../../shared/value-picker-popover";+import { useState } from "react";export const FontFamilyControl = ({currentStyle,@@ -16,6 +17,7 @@ export const FontFamilyControl = ({inheritedStyle,property: styleConfig.property,});+ const [isOpen, setIsOpen] = useState(false);if (value === undefined) return null;@@ -25,9 +27,10 @@ export const FontFamilyControl = ({<ValuePickerPopovertitle="Fonts"content={<FontsManager value={String(value.value)} onChange={setValue} />}+ onOpenChange={setIsOpen}>{/* @todo this should be part of the design system, probably a varian="button" */}- <TextField defaultValue={value.value} />+ <TextField defaultValue={value.value} active={isOpen} /></ValuePickerPopover>);};diff --git a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsxindex 63d2ae3df5..1aaa24140f 100644--- a/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/value-picker-popover.tsx@@ -17,27 +17,32 @@ const usePickerSideOffset = (return [ref, sideOffset];};-type AssetPickerProps = {+type ValuePickerPopoverProps = {title: string;content: JSX.Element;children: JSX.Element;+ onOpenChange?: (isOpen: boolean) => void;};export const ValuePickerPopover = ({title,content,children,-}: AssetPickerProps) => {+ onOpenChange,+}: ValuePickerPopoverProps) => {const [isOpen, setIsOpen] = useState(false);const [ref, sideOffset] = usePickerSideOffset(isOpen);-+ const handleOpenChange = (open: boolean) => {+ setIsOpen(open);+ onOpenChange?.(open);+ };return (- <Popover open={isOpen} onOpenChange={setIsOpen} modal>+ <Popover open={isOpen} onOpenChange={handleOpenChange} modal><PopoverTriggerasChildref={ref}onClick={() => {- setIsOpen(true);+ handleOpenChange(true);}}>{children}@@ -49,7 +54,7 @@ export const ValuePickerPopover = ({hideArrowalign="start"onEscapeKeyDown={() => {- setIsOpen(false);+ handleOpenChange(false);}}css={{ width: PANEL_WIDTH }}>diff --git a/packages/design-system/src/components/text-field.tsx b/packages/design-system/src/components/text-field.tsxindex 0cbd62bb83..f7c0e4ffae 100644--- a/packages/design-system/src/components/text-field.tsx+++ b/packages/design-system/src/components/text-field.tsx@@ -173,6 +173,13 @@ const TextFieldBase = styled("div", {paddingRight: 2,},},+ active: {+ true: {+ boxShadow:+ "inset 0px 0px 0px 1px $colors$primary, 0px 0px 0px 1px $colors$primary",+ ...getButtonSuffixCssVars("focus"),+ },+ },},});@@ -184,6 +191,7 @@ export type TextFieldProps = Pick<inputRef?: React.Ref<HTMLInputElement>;prefix?: React.ReactNode;suffix?: React.ReactNode;+ active?: boolean;};export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(@@ -199,6 +207,7 @@ export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(onBlur,onClick,type,+ active = false,...textFieldProps} = props;let { suffix } = props;@@ -238,6 +247,7 @@ export const TextField = React.forwardRef<HTMLDivElement, TextFieldProps>(withPrefix={Boolean(prefix)}withSuffix={Boolean(suffix)}onClickCapture={focusInnerInput}+ active={active}>{/* We want input to be the first element in DOM so it receives the focus first */}<InputBase