From 706d272e1e3e97809e2e3f5a91959b5e3aae5b93 Mon Sep 17 00:00:00 2001 From: Hussam Ghazzi Date: Fri, 8 Nov 2024 12:40:24 -0500 Subject: [PATCH] feat(TextInput): Update TextInput to use data attributes for styling (#5242) * chore(TextInput): Update TextInput to use data attributes for styling * remove variant functions * add data attrs * update jest snapshots * changeset * add width to block * add higher specificity to passing in sx * update snapshots * revert success border color --- .changeset/real-fans-tap.md | 5 + .../TextInputWithTokens.tsx | 6 +- .../react/src/__tests__/Textarea.test.tsx | 8 +- .../__snapshots__/Autocomplete.test.tsx.snap | 1141 +++- .../__snapshots__/TextInput.test.tsx.snap | 5547 +++++++++++++---- .../TextInputWithTokens.test.tsx.snap | 4871 +++++++++++---- .../internal/components/TextInputWrapper.tsx | 363 +- packages/react/src/utils/testing.tsx | 12 +- 8 files changed, 9221 insertions(+), 2732 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/TextInputWithTokens/TextInputWithTokens.tsx b/packages/react/src/TextInputWithTokens/TextInputWithTokens.tsx index e2c97ac77f1..fa03c61a48e 100644 --- a/packages/react/src/TextInputWithTokens/TextInputWithTokens.tsx +++ b/packages/react/src/TextInputWithTokens/TextInputWithTokens.tsx @@ -13,7 +13,7 @@ import Token from '../Token/Token' import type {TokenSizeKeys} from '../Token/TokenBase' import type {TextInputSizes} from '../internal/components/TextInputWrapper' -import TextInputWrapper, {textInputHorizPadding} from '../internal/components/TextInputWrapper' +import TextInputWrapper from '../internal/components/TextInputWrapper' import UnstyledTextInput from '../internal/components/UnstyledTextInput' import TextInputInnerVisualSlot from '../internal/components/TextInputInnerVisualSlot' @@ -266,8 +266,8 @@ function TextInputWithTokensInnerComponent { width: '100%', display: 'flex', } - const defaultStyles = renderStyles(