From 4aa40c9acd90f432c505abba6ca9213dbd971f5c Mon Sep 17 00:00:00 2001 From: Hussam Ghazzi Date: Thu, 14 Nov 2024 12:48:25 -0500 Subject: [PATCH] feat(TextInput): Convert TextInput (Part 2) - Update CSS to use data attributes (#5257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(TextInput): Remove width props from TextInput * type fixes * Revert "Revert "feat(TextInput): Update TextInput to use data attributes for …" This reverts commit c424c36d50145371af67d0ff7a575dc5e4e30b7f. * lint fix * remove unused imports * fix type error and add test * Update to deprecate props * Fix media styling * revert back to get * revert more gets * Properly mark props as deprecated --- .changeset/real-fans-tap.md | 5 + packages/react/src/Select/Select.tsx | 4 +- .../TextInputWithTokens.tsx | 6 +- packages/react/src/__tests__/Select.test.tsx | 28 + .../react/src/__tests__/Textarea.test.tsx | 8 +- .../__snapshots__/Autocomplete.test.tsx.snap | 847 +++- .../__snapshots__/TextInput.test.tsx.snap | 4257 ++++++++++++++--- .../TextInputWithTokens.test.tsx.snap | 3877 ++++++++++++--- .../internal/components/TextInputWrapper.tsx | 335 +- packages/react/src/utils/testing.tsx | 12 +- 10 files changed, 7950 insertions(+), 1429 deletions(-) create mode 100644 .changeset/real-fans-tap.md diff --git a/.changeset/real-fans-tap.md b/.changeset/real-fans-tap.md new file mode 100644 index 00000000000..f419b1ad11d --- /dev/null +++ b/.changeset/real-fans-tap.md @@ -0,0 +1,5 @@ +--- +"@primer/react": minor +--- + +Convert TextInput to use data attributes diff --git a/packages/react/src/Select/Select.tsx b/packages/react/src/Select/Select.tsx index 7efd064982d..25260fb8eaf 100644 --- a/packages/react/src/Select/Select.tsx +++ b/packages/react/src/Select/Select.tsx @@ -5,6 +5,8 @@ import type {StyledWrapperProps} from '../internal/components/TextInputWrapper' import TextInputWrapper from '../internal/components/TextInputWrapper' import {toggleStyledComponent} from '../internal/utils/toggleStyledComponent' import {useFeatureFlag} from '../FeatureFlags' +import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic' + import classes from './Select.module.css' export type SelectProps = Omit< @@ -167,7 +169,7 @@ const Select = React.forwardRef( ) }, -) +) as PolymorphicForwardRefComponent<'select', SelectProps> const Option: React.FC & {value: string}>> = props => (