Skip to content

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.

chore: Remove deprecated input-field component (#3866)

Oleg Isonen9a6e547c4c8e
diff --git a/apps/builder/app/auth/secret-login.tsx b/apps/builder/app/auth/secret-login.tsx
index b0694d2885..5542acece7 100644
--- a/apps/builder/app/auth/secret-login.tsx
+++ b/apps/builder/app/auth/secret-login.tsx
@@ -1,9 +1,4 @@
-import {
- Button,
- Flex,
- DeprecatedTextField,
- theme,
-} from "@webstudio-is/design-system";
+import { Button, Flex, InputField, theme } from "@webstudio-is/design-system";
import { CommitIcon } from "@webstudio-is/icons";
import { useState } from "react";
import { authPath } from "~/shared/router-utils";
@@ -23,7 +18,7 @@ export const SecretLogin = () => {
gap: theme.spacing[5],
}}
>
- <DeprecatedTextField
+ <InputField
name="secret"
type="text"
minLength={2}
diff --git a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
index 11c6b86eaf..4f8e2619ff 100644
--- a/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx
@@ -152,7 +152,7 @@ export const Section = ({
}
}}
variant="chromeless"
- size="1"
+ size="2"
text="mono"
fieldSizing="content"
property={property}
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.stories.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
index b2e221a742..4fa4976fed 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.stories.tsx
@@ -1,5 +1,5 @@
import * as React from "react";
-import { Flex, DeprecatedTextField } from "@webstudio-is/design-system";
+import { Flex, InputField } from "@webstudio-is/design-system";
import type { StyleValue } from "@webstudio-is/css-engine";
import { CssValueInput, type IntermediateStyleValue } from "./css-value-input";
import { action } from "@storybook/addon-actions";
@@ -135,7 +135,7 @@ export const WithUnits = () => {
action("onAbort")();
}}
/>
- <DeprecatedTextField
+ <InputField
readOnly
value={
value
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
index ab25b3cd3f..b95fa665ec 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -284,7 +284,6 @@ export type ChangeReason =
type CssValueInputProps = Pick<
ComponentProps<typeof InputField>,
| "variant"
- | "size"
| "text"
| "autoFocus"
| "disabled"
@@ -292,6 +291,7 @@ type CssValueInputProps = Pick<
| "prefix"
| "inputRef"
> & {
+ size?: "1" | "2";
styleSource: StyleSource;
property: StyleProperty;
value: StyleValue | undefined;
@@ -458,7 +458,7 @@ export const CssValueInput = ({
const inputProps = getInputProps();
const [isUnitsOpen, unitSelectElement] = useUnitSelect({
- size,
+ size: size === "2" ? "1" : "2",
property,
value,
onChange: (unitOrKeyword) => {
@@ -624,7 +624,7 @@ export const CssValueInput = ({
{...getToggleButtonProps()}
data-state={isOpen ? "open" : "closed"}
tabIndex={-1}
- size={size}
+ size={size === "2" ? "1" : "2"}
/>
);
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.tsx
index 58ef920c92..aeb40f684d 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
@@ -19,8 +19,6 @@ import {
ComboboxRoot,
ComboboxAnchor,
ComboboxContent,
- DeprecatedTextFieldInput,
- useDeprecatedTextFieldFocus,
useCombobox,
type CSS,
ComboboxLabel,
@@ -33,6 +31,7 @@ import {
styled,
Flex,
ComboboxScrollArea,
+ InputField,
} from "@webstudio-is/design-system";
import { CheckMarkIcon, DotIcon, LocalStyleIcon } from "@webstudio-is/icons";
import {
@@ -43,6 +42,8 @@ import {
type ForwardRefRenderFunction,
type RefObject,
type ReactNode,
+ useRef,
+ useCallback,
} from "react";
import { mergeRefs } from "@react-aria/utils";
import { type ComponentState, stateCategories } from "@webstudio-is/react-sdk";
@@ -51,6 +52,7 @@ import { useSortable } from "./use-sortable";
import { matchSorter } from "match-sorter";
import { StyleSourceBadge } from "./style-source-badge";
import { humanizeString } from "~/shared/string-utils";
+import { useFocusWithin } from "@react-aria/interactions";
type IntermediateItem = {
id: string;
@@ -84,7 +86,7 @@ const TextFieldContainer = styled("div", {
});
type TextFieldBaseWrapperProps<Item extends IntermediateItem> = Omit<
- ComponentProps<"input">,
+ ComponentProps<typeof InputField>,
"value"
> &
Pick<ComponentProps<typeof TextFieldContainer>, "css"> & {
@@ -113,7 +115,6 @@ const TextFieldBase: ForwardRefRenderFunction<
onFocus,
onBlur,
onClick,
- type,
onKeyDown,
label,
value,
@@ -127,17 +128,30 @@ const TextFieldBase: ForwardRefRenderFunction<
states,
...textFieldProps
} = props;
- const [internalInputRef, focusProps] = useDeprecatedTextFieldFocus({
- onFocus,
- onBlur,
- });
const { sortableRefCallback, dragItemId, placementIndicator } = useSortable({
items: value,
onSort,
});
+ const internalInputRef = useRef<HTMLInputElement>(null);
+
+ const { focusWithinProps } = useFocusWithin({
+ onFocusWithin: onFocus,
+ onBlurWithin: onBlur,
+ });
+
+ const onClickCapture = useCallback(() => {
+ internalInputRef.current?.focus();
+ }, [internalInputRef]);
+
return (
<TextFieldContainer
- {...focusProps}
+ {...focusWithinProps}
+ onClickCapture={onClickCapture}
+ // Setting tabIndex to -1 to allow this element to be focused via JavaScript.
+ // This is used when we need to hide the caret but want to:
+ // 1. keep the visual focused state of the component
+ // 2. keep focus somewhere insisde the component to not trigger some focus-trap logic
+ tabIndex={-1}
ref={mergeRefs(forwardedRef, containerRef ?? null, sortableRefCallback)}
css={css}
style={
@@ -147,8 +161,9 @@ const TextFieldBase: ForwardRefRenderFunction<
>
{/* We want input to be the first element in DOM so it receives the focus first */}
{editingItemId === undefined && (
- <DeprecatedTextFieldInput
+ <InputField
{...textFieldProps}
+ variant="chromeless"
css={{
color: theme.colors.hiContrast,
fontVariantNumeric: "tabular-nums",
@@ -156,11 +171,17 @@ const TextFieldBase: ForwardRefRenderFunction<
fontSize: theme.deprecatedFontSize[3],
lineHeight: 1,
order: 1,
+ border: "none",
+ flex: 1,
+ "&:focus-within, &:hover": {
+ outline: "none",
+ },
}}
+ size="1"
value={label}
- type={type}
onClick={onClick}
- ref={mergeRefs(internalInputRef, inputRef ?? null)}
+ ref={inputRef}
+ inputRef={internalInputRef}
spellCheck={false}
aria-label="New Style Source Input"
/>
diff --git a/apps/builder/app/dashboard/projects/project-dialogs.tsx b/apps/builder/app/dashboard/projects/project-dialogs.tsx
index 457f23dce0..6deba630b3 100644
--- a/apps/builder/app/dashboard/projects/project-dialogs.tsx
+++ b/apps/builder/app/dashboard/projects/project-dialogs.tsx
@@ -6,7 +6,7 @@ import {
Flex,
Label,
Text,
- DeprecatedTextField,
+ InputField,
DialogActions,
Dialog as BaseDialog,
DialogTrigger,
@@ -95,11 +95,11 @@ const DialogContent = ({
</DialogDescription>
)}
{typeof label === "string" ? <Label>{label}</Label> : label}
- <DeprecatedTextField
+ <InputField
placeholder={placeholder}
name="title"
defaultValue={title}
- state={errors ? "invalid" : undefined}
+ color={errors ? "error" : undefined}
onChange={(event) => {
onChange?.({ title: event.currentTarget.value });
}}
diff --git a/packages/design-system/src/components/__DEPRECATED__/text-field.stories.tsx b/packages/design-system/src/components/__DEPRECATED__/text-field.stories.tsx
deleted file mode 100644
index fe8368f366..0000000000
--- a/packages/design-system/src/components/__DEPRECATED__/text-field.stories.tsx
+++ /dev/null
@@ -1,183 +0,0 @@
-import * as React from "react";
-import type { StoryFn } from "@storybook/react";
-import { GapVerticalIcon, ChevronDownIcon } from "@webstudio-is/icons";
-import { Button } from "../button";
-import { Flex } from "../flex";
-import { DeprecatedIconButton } from "./icon-button";
-import { DeprecatedTextField } from "./text-field";
-import { Box } from "../box";
-import { Grid } from "../grid";
-import { DeprecatedText2 } from "./text2";
-import { theme } from "../../stitches.config";
-
-export default {
- component: DeprecatedTextField,
- argTypes: {
- onFocus: { action: true },
- onBlur: { action: true },
- },
-};
-
-export const Default: StoryFn<typeof DeprecatedTextField> = () => {
- return <DeprecatedTextField />;
-};
-
-export const NativeProps: StoryFn<typeof DeprecatedTextField> = () => {
- return (
- <Flex direction="column" gap={3}>
- <DeprecatedTextField placeholder="This is a placeholder" />
- <DeprecatedTextField
- disabled
- placeholder="This is a disabled placeholder"
- />
- <DeprecatedTextField type="number" defaultValue={25} />
- <DeprecatedTextField type="search" placeholder="This is a search input" />
- <DeprecatedTextField type="button" defaultValue={"Arial"} />
- <DeprecatedTextField readOnly value="Read-only" />
- <DeprecatedTextField disabled value="Disabled" />
- </Flex>
- );
-};
-
-export const Variants: StoryFn<typeof DeprecatedTextField> = () => {
- return (
- <Flex direction="column" gap={3}>
- <DeprecatedTextField />
- <DeprecatedTextField variant="ghost" />
- <DeprecatedTextField type="button" />
- <DeprecatedTextField type="button" state="active" />
- </Flex>
- );
-};
-
-export const State: StoryFn<typeof DeprecatedTextField> = () => {
- return (
- <Flex direction="column" gap={3}>
- <DeprecatedTextField />
- <DeprecatedTextField state="invalid" />
- <DeprecatedTextField state="valid" />
- </Flex>
- );
-};
-
-export const PrefixSuffix: StoryFn<typeof DeprecatedTextField> = () => {
- return (
- <Flex direction="column" gap={3}>
- <DeprecatedTextField
- prefix={<GapVerticalIcon />}
- suffix={
- <DeprecatedIconButton>
- <ChevronDownIcon />
- </DeprecatedIconButton>
- }
- />
- <DeprecatedTextField
- state="invalid"
- prefix={<GapVerticalIcon />}
- suffix={
- <DeprecatedIconButton>
- <ChevronDownIcon />
- </DeprecatedIconButton>
- }
- />
- <DeprecatedTextField
- disabled
- prefix={<GapVerticalIcon />}
- suffix={
- <DeprecatedIconButton>
- <ChevronDownIcon />
- </DeprecatedIconButton>
- }
- />
- </Flex>
- );
-};
-
-export const Layout: StoryFn<typeof DeprecatedTextField> = () => {
- return (
- <>
- <Flex direction="row" gap={2} css={{ justifyContent: "space-between" }}>
- <DeprecatedTextField
- value="Long content comes here and it doesn't wrap"
- prefix={<GapVerticalIcon />}
- suffix={
- <DeprecatedIconButton>
- <ChevronDownIcon />
- </DeprecatedIconButton>
- }
- css={{
- flexGrow: 1,
- maxWidth: "25%",
- }}
- />
- <Box css={{ background: theme.colors.muted }}>Content</Box>
- <DeprecatedTextField
- state="invalid"
- value="Long content comes here and it doesn't wrap"
- />
- </Flex>
-
- <Grid
- gap={2}
- css={{
- gridTemplateColumns: "100px 1fr",
- width: 250,
- border: "1px solid",
- }}
- >
- <Box css={{ background: theme.colors.muted }}>
- <DeprecatedText2 as="label" htmlFor="field">
- This is a label
- </DeprecatedText2>
- </Box>
- <Box css={{ background: theme.colors.muted }}>
- <DeprecatedTextField
- id="field"
- value="Long content comes here and it doesn't wrap"
- prefix={<GapVerticalIcon />}
- />
- </Box>
- <Box css={{ background: theme.colors.muted }}>
- <DeprecatedText2 as="label" htmlFor="field2">
- This is a label
- </DeprecatedText2>
- </Box>
- <DeprecatedTextField
- id="field2"
- value="Long content comes here and it doesn't wrap"
- />
- </Grid>
- </>
- );
-};
-
-export const Interactive: StoryFn<typeof DeprecatedTextField> = () => {
- const [value, setValue] = React.useState("");
- const wrapperRef = React.useRef<HTMLDivElement>(null);
- const inputRef = React.useRef<HTMLInputElement>(null);
-
- return (
- <Flex direction="column" gap={3}>
- <DeprecatedTextField
- ref={wrapperRef}
- inputRef={inputRef}
- value={value}
- readOnly
- />
- <Button
- onClick={() => {
- setValue(JSON.stringify(wrapperRef.current?.getBoundingClientRect()));
- }}
- >
- Measure TextField
- </Button>
- <Button
- onClick={() => {
- inputRef.current?.focus();
- }}
- >
- Focus TextField
- </Button>
- </Flex>
- );
-};
diff --git a/packages/design-system/src/components/__DEPRECATED__/text-field.tsx b/packages/design-system/src/components/__DEPRECATED__/text-field.tsx
deleted file mode 100644
index 6581e316a3..0000000000
--- a/packages/design-system/src/components/__DEPRECATED__/text-field.tsx
+++ /dev/null
@@ -1,334 +0,0 @@
-import { mergeRefs } from "@react-aria/utils";
-import {
- type ComponentProps,
- type RefObject,
- type FocusEventHandler,
- forwardRef,
- useRef,
- useCallback,
-} from "react";
-import { useFocusWithin } from "@react-aria/interactions";
-import { css, styled, theme } from "../../stitches.config";
-import { ChevronLeftIcon } from "@webstudio-is/icons";
-
-const backgroundColorVar = `--ws-text-field-background-color`;
-const colorVar = `--ws-text-field-color`;
-
-const getTextFieldSuffixCssVars = (state: "focus" | "hover") => {
- if (state === "focus") {
- return {
- [backgroundColorVar]: theme.colors.blue10,
- [colorVar]: "white",
- };
- }
-
- return {
- [backgroundColorVar]: theme.colors.slate7,
- [colorVar]: theme.colors.hiContrast,
- };
-};
-
-const textFieldIconBaseStyle = css({
- height: theme.spacing[11],
- minWidth: theme.spacing[5],
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- borderRadius: 2,
-});
-
-const DeprecatedTextFieldIcon = styled("span", textFieldIconBaseStyle, {
- // Icon receives colors from parent.
- backgroundColor: `var(${backgroundColorVar})`,
- color: `var(${colorVar})`,
-});
-
-export const DeprecatedTextFieldInput = styled("input", {
- // Reset
- appearance: "none",
- borderWidth: "0",
- backgroundColor: "transparent",
- boxSizing: "border-box",
- fontFamily: "inherit",
- fontSize: "inherit",
- color: "inherit",
- padding: "0",
- height: theme.spacing[9],
- flexGrow: 1,
- flexShrink: 1,
- flexBasis: theme.spacing[10],
- minWidth: 0,
- textOverflow: "ellipsis",
- outline: "none",
- WebkitTapHighlightColor: "rgba(0,0,0,0)",
- cursor: "inherit",
-
- // 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":
- {
- display: "none",
- },
- },
-
- '&[type="number"]': {
- "&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": {
- WebkitAppearance: "none",
- MozAppearance: "textfield",
- margin: 0,
- display: "none",
- },
- },
-
- "&:-webkit-autofill::first-line": {
- fontFamily: theme.fonts.sans,
- color: theme.colors.hiContrast,
- },
-
- "&::placeholder": {
- color: theme.colors.hint,
- },
-
- "&:disabled": {
- color: theme.colors.slate8,
- cursor: "not-allowed",
- "&::placeholder": {
- color: theme.colors.slate7,
- },
- },
-});
-
-export const DeprecatedTextFieldContainer = styled("div", {
- // Custom
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- backgroundColor: theme.colors.backgroundControls,
- boxShadow: `inset 0 0 0 1px ${theme.colors.slate7}`,
- color: theme.colors.hiContrast,
- fontVariantNumeric: "tabular-nums",
- gap: theme.spacing[3],
- px: theme.spacing[4],
- borderRadius: theme.borderRadius[4],
- fontFamily: theme.fonts.sans,
- fontSize: theme.deprecatedFontSize[3],
- minHeight: theme.spacing[12],
- lineHeight: 1,
- minWidth: 0,
- "&:focus-within": {
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.blue10}, 0px 0px 0px 1px ${theme.colors.blue10}`,
- },
- "&[aria-disabled=true]": {
- pointerEvents: "none",
- backgroundColor: theme.colors.slate2,
- },
- "&:has(input:read-only)": {
- backgroundColor: theme.colors.slate2,
- "&:focus": {
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.slate7}`,
- },
- },
- variants: {
- variant: {
- ghost: {
- boxShadow: "none",
- backgroundColor: "transparent",
- "@hover": {
- "&:hover": {
- boxShadow: `inset 0 0 0 1px ${theme.colors.slateA7}`,
- },
- },
- "&:focus": {
- backgroundColor: theme.colors.backgroundControls,
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.blue10}, 0px 0px 0px 1px ${theme.colors.blue10}`,
- },
- "&:disabled": {
- backgroundColor: "transparent",
- },
- "&:read-only": {
- backgroundColor: "transparent",
- },
- },
- button: {
- "&:hover": getTextFieldSuffixCssVars("hover"),
- "&:focus-within": getTextFieldSuffixCssVars("focus"),
- },
- },
- state: {
- invalid: {
- boxShadow: `inset 0 0 0 1px ${theme.colors.red8}`,
- "&:focus-within": {
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.red8}, 0px 0px 0px 1px ${theme.colors.red8}`,
- },
- },
- valid: {
- boxShadow: `inset 0 0 0 1px ${theme.colors.green7}`,
- "&:focus-within": {
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.green8}, 0px 0px 0px 1px ${theme.colors.green8}`,
- },
- },
- active: {
- boxShadow: `inset 0px 0px 0px 1px ${theme.colors.blue10}, 0px 0px 0px 1px ${theme.colors.blue10}`,
- ...getTextFieldSuffixCssVars("focus"),
- },
- },
- // Preffix and suffix are responsible for their spacing
- withPrefix: {
- true: {
- paddingLeft: 0,
- },
- },
- withSuffix: {
- true: {
- paddingRight: 0,
- },
- },
- },
-});
-
-const PrefixSlot = styled("div", {
- display: "flex",
- alignItems: "center",
- flexShrink: 0,
- order: 0,
- padding: 2,
- paddingRight: 0,
- borderRadius: 2,
-});
-
-const SuffixSlot = styled("div", {
- display: "flex",
- alignItems: "center",
- flexShrink: 0,
- order: 2,
- padding: 2,
- paddingLeft: 0,
- borderRadius: 2,
-});
-
-export const useDeprecatedTextFieldFocus = ({
- disabled,
- onFocus,
- onBlur,
-}: {
- disabled?: boolean;
- onFocus?: FocusEventHandler<HTMLInputElement>;
- onBlur?: FocusEventHandler<HTMLInputElement>;
-}): [
- RefObject<HTMLInputElement>,
- ComponentProps<typeof DeprecatedTextFieldContainer>,
-] => {
- const ref = useRef<HTMLInputElement>(null);
-
- const onClickCapture = useCallback(() => {
- ref.current?.focus();
- }, [ref]);
-
- const { focusWithinProps } = useFocusWithin({
- isDisabled: disabled,
- // @ts-expect-error Type mismatch from react-aria
- onFocusWithin: onFocus,
- // @ts-expect-error Type mismatch from react-aria
- onBlurWithin: onBlur,
- });
-
- return [
- ref,
- {
- ...focusWithinProps,
- onClickCapture,
- // Setting tabIndex to -1 to allow this element to be focused via JavaScript.
- // This is used when we need to hide the caret but want to:
- // 1. keep the visual focused state of the component
- // 2. keep focus somewhere insisde the component to not trigger some focus-trap logic
- tabIndex: -1,
- },
- ];
-};
-
-export type DeprecatedTextFieldProps = Pick<
- React.ComponentProps<typeof DeprecatedTextFieldContainer>,
- "variant" | "state" | "css"
-> &
- Omit<React.ComponentProps<"input">, "prefix" | "children"> & {
- containerRef?: React.Ref<HTMLDivElement>;
- inputRef?: React.Ref<HTMLInputElement>;
- prefix?: React.ReactNode;
- suffix?: React.ReactNode;
- };
-
-export const DeprecatedTextField = forwardRef<
- HTMLDivElement,
- DeprecatedTextFieldProps
->((props, forwardedRef) => {
- const {
- prefix,
- css,
- disabled,
- containerRef,
- inputRef,
- state,
- variant: variantProp,
- onFocus,
- onBlur,
- onClick,
- type,
- onKeyDown,
- // prevent spreading it into the dom
- suffix: suffixProp,
- ...textFieldProps
- } = props;
- let suffix = suffixProp;
- const variant =
- type === "button" && variantProp === undefined ? "button" : variantProp;
-
- const [internalInputRef, focusProps] = useDeprecatedTextFieldFocus({
- disabled,
- onFocus,
- onBlur,
- });
-
- if (type === "button" && suffix === undefined) {
- suffix = (
- <DeprecatedTextFieldIcon
- as={ChevronLeftIcon}
- onClick={() => {
- internalInputRef.current?.click();
- }}
- />
- );
- }
-
- return (
- <DeprecatedTextFieldContainer
- {...focusProps}
- aria-disabled={disabled}
- ref={mergeRefs(forwardedRef, containerRef ?? null)}
- state={state}
- variant={variant}
- css={css}
- withPrefix={Boolean(prefix)}
- withSuffix={Boolean(suffix)}
- onKeyDown={onKeyDown}
- >
- {/* We want input to be the first element in DOM so it receives the focus first */}
- <DeprecatedTextFieldInput
- {...textFieldProps}
- type={type}
- disabled={disabled}
- onClick={onClick}
- ref={mergeRefs(internalInputRef, inputRef ?? null)}
- />
-
- {prefix && <PrefixSlot>{prefix}</PrefixSlot>}
- {suffix && <SuffixSlot>{suffix}</SuffixSlot>}
- </DeprecatedTextFieldContainer>
- );
-});
-
-DeprecatedTextField.displayName = "TextField";
diff --git a/packages/design-system/src/components/__DEPRECATED__/text2.tsx b/packages/design-system/src/components/__DEPRECATED__/text2.tsx
index 2456d53de1..4c57017dd8 100644
--- a/packages/design-system/src/components/__DEPRECATED__/text2.tsx
+++ b/packages/design-system/src/components/__DEPRECATED__/text2.tsx
@@ -1,6 +1,6 @@
import { css, styled, theme } from "../../stitches.config";
-export const deprecatedTextStyle = css({
+const deprecatedTextStyle = css({
// Reset
margin: 0,
lineHeight: 1,
diff --git a/packages/design-system/src/components/enhanced-tooltip.stories.tsx b/packages/design-system/src/components/enhanced-tooltip.stories.tsx
index 90461559de..116a928ff6 100644
--- a/packages/design-system/src/components/enhanced-tooltip.stories.tsx
+++ b/packages/design-system/src/components/enhanced-tooltip.stories.tsx
@@ -1,7 +1,6 @@
-// import React, { useCallback } from "react";
-import { DeprecatedTextField } from "./__DEPRECATED__/text-field";
import { EnhancedTooltip, EnhancedTooltipProvider } from "./enhanced-tooltip";
import { Flex } from "./flex";
+import { InputField } from "./input-field";
export default {
component: EnhancedTooltip,
@@ -12,7 +11,7 @@ export const Simple = () => {
<EnhancedTooltipProvider>
<Flex>
<EnhancedTooltip content="Hello world">
- <DeprecatedTextField />
+ <InputField />
</EnhancedTooltip>
</Flex>
</EnhancedTooltipProvider>
diff --git a/packages/design-system/src/components/input-field.tsx b/packages/design-system/src/components/input-field.tsx
index 8866bf45b4..0b2efe5f40 100644
--- a/packages/design-system/src/components/input-field.tsx
+++ b/packages/design-system/src/components/input-field.tsx
@@ -75,7 +75,7 @@ const containerStyle = css({
borderRadius: theme.borderRadius[4],
border: `solid 1px ${theme.colors.borderMain}`,
backgroundColor: theme.colors.backgroundControls,
- "&:has([data-input-field-input]:focus), &:focus": {
+ "&:focus-within": {
outline: `solid 2px ${theme.colors.borderFocus}`,
outlineOffset: "-1px",
},
@@ -83,10 +83,9 @@ const containerStyle = css({
"&:has([data-input-field-input][data-color=error])": {
borderColor: theme.colors.borderDestructiveMain,
},
- "&:has([data-input-field-input][data-color=error]:focus), &[data-color=error]:focus":
- {
- outlineColor: theme.colors.borderDestructiveMain,
- },
+ "&:focus-within:has([data-color=error])": {
+ outlineColor: theme.colors.borderDestructiveMain,
+ },
"&:has([data-input-field-input]:disabled)": {
backgroundColor: theme.colors.backgroundInputDisabled,
@@ -102,15 +101,18 @@ const containerStyle = css({
},
size: {
1: {
- height: theme.spacing[11],
+ height: theme.spacing[9],
},
2: {
+ height: theme.spacing[11],
+ },
+ 3: {
height: theme.spacing[12],
},
},
},
defaultVariants: {
- size: 2,
+ size: 3,
},
});
@@ -221,7 +223,7 @@ type InputFieldProps = {
onFocus?: FocusEventHandler;
onBlur?: FocusEventHandler;
variant?: "chromeless";
- size?: "1" | "2";
+ size?: "1" | "2" | "3";
};
export const InputField = forwardRef(
diff --git a/packages/design-system/src/components/menu.stories.tsx b/packages/design-system/src/components/menu.stories.tsx
index 5b80d91476..5b07ecc63d 100644
--- a/packages/design-system/src/components/menu.stories.tsx
+++ b/packages/design-system/src/components/menu.stories.tsx
@@ -34,7 +34,6 @@ import {
SelectGroup,
} from "./select";
import { MenuCheckedAndSetIcon, MenuSetDotIcon } from "./menu";
-import { DeprecatedTextField } from "./__DEPRECATED__/text-field";
import { Button } from "./button";
import {
ChevronDownIcon,
@@ -45,6 +44,7 @@ import {
import { useState } from "react";
import { DeprecatedIconButton } from "./__DEPRECATED__/icon-button";
import { StorySection } from "./storybook";
+import { InputField } from "./input-field";
const DropdownDemo = ({ withIndicator }: { withIndicator: boolean }) => {
const [isApple, setIsApple] = useState(true);
@@ -180,7 +180,7 @@ const ComboboxDemo = () => {
<ComboboxRoot open={isOpen}>
<div {...getComboboxProps()}>
<ComboboxAnchor>
- <DeprecatedTextField
+ <InputField
{...getInputProps()}
placeholder="Enter: Apple"
suffix={
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index acacec3d53..0df0315418 100644
--- a/packages/design-system/src/index.ts
+++ b/packages/design-system/src/index.ts
@@ -88,5 +88,4 @@ export * from "./components/kbd";
export * from "./components/__DEPRECATED__/text2";
export { DeprecatedIconButton } from "./components/__DEPRECATED__/icon-button";
export * from "./components/__DEPRECATED__/popover";
-export * from "./components/__DEPRECATED__/text-field";
export * from "./components/__DEPRECATED__/list";
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index 4d954820ec..cf4ee0aac2 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -1,12 +1,9 @@
import { createStitches } from "@stitches/react";
import {
blue,
- blueA,
gray,
green,
- greenA,
red,
- redA,
slate,
slateA,
yellow,
@@ -67,11 +64,8 @@ const { styled, css, getCssText, globalCss, keyframes, config, reset } =
slate7: slate.slate7,
slate6: slate.slate6,
slate8: slate.slate8,
- slate9: slate.slate9,
slate11: slate.slate11,
slate12: slate.slate12,
- slateA3: slateA.slateA3,
- slateA4: slateA.slateA4,
slateA7: slateA.slateA7,
slateA8: slateA.slateA8,
gray2: gray.gray2,
@@ -79,26 +73,14 @@ const { styled, css, getCssText, globalCss, keyframes, config, reset } =
blue9: blue.blue9,
blue10: blue.blue10,
blue11: blue.blue11,
- blueA3: blueA.blueA3,
- blueA4: blueA.blueA4,
red4: red.red4,
- red8: red.red8,
red9: red.red9,
red11: red.red11,
red10: red.red10,
- redA3: redA.redA3,
- redA4: redA.redA4,
- redA8: redA.redA8,
- green2: green.green2,
green3: green.green3,
green4: green.green4,
- green7: green.green7,
- green8: green.green8,
green9: green.green9,
green11: green.green11,
- greenA3: greenA.greenA3,
- greenA4: greenA.greenA4,
- greenA8: greenA.greenA8,
yellow9: yellow.yellow9,
yellow10: yellow.yellow10,
mint5: mint.mint5,