diff --git a/.changeset/four-fans-pump.md b/.changeset/four-fans-pump.md new file mode 100644 index 00000000000..5aa62707c55 --- /dev/null +++ b/.changeset/four-fans-pump.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Adds character counts to TextInput and TextArea components diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-colorblind-linux.png new file mode 100644 index 00000000000..7848a14449e Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-dimmed-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-dimmed-linux.png new file mode 100644 index 00000000000..94e13d7404d Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-high-contrast-linux.png new file mode 100644 index 00000000000..12c44d4ad9f Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-linux.png new file mode 100644 index 00000000000..19ea68447e1 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-tritanopia-linux.png new file mode 100644 index 00000000000..19ea68447e1 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-colorblind-linux.png new file mode 100644 index 00000000000..09c527f70bf Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-high-contrast-linux.png new file mode 100644 index 00000000000..c058e943598 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-linux.png new file mode 100644 index 00000000000..7e4baa42c99 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-tritanopia-linux.png new file mode 100644 index 00000000000..7e4baa42c99 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-Exceeded-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-colorblind-linux.png new file mode 100644 index 00000000000..0fe557946a9 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-dimmed-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-dimmed-linux.png new file mode 100644 index 00000000000..75ed62db7ad Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-high-contrast-linux.png new file mode 100644 index 00000000000..37b3327b680 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-linux.png new file mode 100644 index 00000000000..0fe557946a9 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-tritanopia-linux.png new file mode 100644 index 00000000000..0fe557946a9 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-colorblind-linux.png new file mode 100644 index 00000000000..9e16b19115d Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-high-contrast-linux.png new file mode 100644 index 00000000000..05e9304d789 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-linux.png new file mode 100644 index 00000000000..9e16b19115d Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-tritanopia-linux.png new file mode 100644 index 00000000000..9e16b19115d Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-and-Caption-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-colorblind-linux.png new file mode 100644 index 00000000000..4be77a4a4a6 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-dimmed-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-dimmed-linux.png new file mode 100644 index 00000000000..8d1ab59bf5c Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-high-contrast-linux.png new file mode 100644 index 00000000000..81232723e8f Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-linux.png new file mode 100644 index 00000000000..4be77a4a4a6 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-tritanopia-linux.png new file mode 100644 index 00000000000..4be77a4a4a6 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-colorblind-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-colorblind-linux.png new file mode 100644 index 00000000000..24336fb51c7 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-high-contrast-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-high-contrast-linux.png new file mode 100644 index 00000000000..8a9099de3d2 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-linux.png new file mode 100644 index 00000000000..24336fb51c7 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-linux.png differ diff --git a/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-tritanopia-linux.png b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-tritanopia-linux.png new file mode 100644 index 00000000000..24336fb51c7 Binary files /dev/null and b/.playwright/snapshots/components/TextInput.test.ts-snapshots/TextInput-With-Character-Limit-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-colorblind-linux.png new file mode 100644 index 00000000000..94caf2a60c7 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-dimmed-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-dimmed-linux.png new file mode 100644 index 00000000000..6634eaa7900 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-high-contrast-linux.png new file mode 100644 index 00000000000..7942c3dda03 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-linux.png new file mode 100644 index 00000000000..c789e187374 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-tritanopia-linux.png new file mode 100644 index 00000000000..c789e187374 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-colorblind-linux.png new file mode 100644 index 00000000000..673628626b6 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-high-contrast-linux.png new file mode 100644 index 00000000000..67e40b6c01d Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-linux.png new file mode 100644 index 00000000000..7a5d6c8f2da Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-tritanopia-linux.png new file mode 100644 index 00000000000..7a5d6c8f2da Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-Exceeded-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-colorblind-linux.png new file mode 100644 index 00000000000..a8433e0bbc8 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-dimmed-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-dimmed-linux.png new file mode 100644 index 00000000000..312d4f9e07f Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-high-contrast-linux.png new file mode 100644 index 00000000000..99036a706ee Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-linux.png new file mode 100644 index 00000000000..a8433e0bbc8 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-tritanopia-linux.png new file mode 100644 index 00000000000..a8433e0bbc8 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-colorblind-linux.png new file mode 100644 index 00000000000..86f345890f0 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-high-contrast-linux.png new file mode 100644 index 00000000000..050d43f7d6b Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-linux.png new file mode 100644 index 00000000000..86f345890f0 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-tritanopia-linux.png new file mode 100644 index 00000000000..86f345890f0 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-and-Caption-light-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-colorblind-linux.png new file mode 100644 index 00000000000..d48542f2803 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-dimmed-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-dimmed-linux.png new file mode 100644 index 00000000000..3e050e1ec55 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-high-contrast-linux.png new file mode 100644 index 00000000000..5bad01f4d7a Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-linux.png new file mode 100644 index 00000000000..d48542f2803 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-tritanopia-linux.png new file mode 100644 index 00000000000..d48542f2803 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-colorblind-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-colorblind-linux.png new file mode 100644 index 00000000000..55302ab9683 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-high-contrast-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-high-contrast-linux.png new file mode 100644 index 00000000000..bfe54dd8cae Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-linux.png new file mode 100644 index 00000000000..55302ab9683 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-linux.png differ diff --git a/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-tritanopia-linux.png b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-tritanopia-linux.png new file mode 100644 index 00000000000..55302ab9683 Binary files /dev/null and b/.playwright/snapshots/components/Textarea.test.ts-snapshots/Textarea-With-Character-Limit-light-tritanopia-linux.png differ diff --git a/e2e/components/TextInput.test.ts b/e2e/components/TextInput.test.ts index 114854866b2..d640f166fae 100644 --- a/e2e/components/TextInput.test.ts +++ b/e2e/components/TextInput.test.ts @@ -165,6 +165,60 @@ test.describe('TextInput', () => { } }) + test.describe('With Character Limit', () => { + for (const theme of themes) { + test.describe(theme, () => { + test('default @vrt', async ({page}) => { + await visit(page, { + id: 'components-textinput-features--with-character-limit', + globals: { + colorScheme: theme, + }, + }) + + // Default state + expect(await page.screenshot()).toMatchSnapshot(`TextInput.With Character Limit.${theme}.png`) + }) + }) + } + }) + + test.describe('With Character Limit and Caption', () => { + for (const theme of themes) { + test.describe(theme, () => { + test('default @vrt', async ({page}) => { + await visit(page, { + id: 'components-textinput-features--with-character-limit-and-caption', + globals: { + colorScheme: theme, + }, + }) + + // Default state + expect(await page.screenshot()).toMatchSnapshot(`TextInput.With Character Limit and Caption.${theme}.png`) + }) + }) + } + }) + + test.describe('With Character Limit Exceeded', () => { + for (const theme of themes) { + test.describe(theme, () => { + test('default @vrt', async ({page}) => { + await visit(page, { + id: 'components-textinput-features--with-character-limit-exceeded', + globals: { + colorScheme: theme, + }, + }) + + // Default state + expect(await page.screenshot()).toMatchSnapshot(`TextInput.With Character Limit Exceeded.${theme}.png`) + }) + }) + } + }) + test.describe('With Leading Visual', () => { for (const theme of themes) { test.describe(theme, () => { diff --git a/e2e/components/Textarea.test.ts b/e2e/components/Textarea.test.ts index 4b57c97097a..a87a1743782 100644 --- a/e2e/components/Textarea.test.ts +++ b/e2e/components/Textarea.test.ts @@ -43,6 +43,18 @@ const stories = [ id: 'components-textarea-features--custom-width', title: 'Custom Width', }, + { + id: 'components-textarea-features--with-character-limit', + title: 'With Character Limit', + }, + { + id: 'components-textarea-features--with-character-limit-and-caption', + title: 'With Character Limit and Caption', + }, + { + id: 'components-textarea-features--with-character-limit-exceeded', + title: 'With Character Limit Exceeded', + }, { id: 'components-textarea-dev--dev-default', title: 'Dev Default', diff --git a/packages/react/src/TextInput/TextInput.docs.json b/packages/react/src/TextInput/TextInput.docs.json index 7da337b54cb..ff68d969c31 100644 --- a/packages/react/src/TextInput/TextInput.docs.json +++ b/packages/react/src/TextInput/TextInput.docs.json @@ -73,6 +73,11 @@ "defaultValue": "false", "description": "Creates a full-width input element" }, + { + "name": "characterLimit", + "type": "number", + "description": "The maximum number of characters allowed in the input" + }, { "name": "contrast", "type": "boolean", diff --git a/packages/react/src/TextInput/TextInput.features.stories.tsx b/packages/react/src/TextInput/TextInput.features.stories.tsx index 7f68ff98f1c..46009e46a2f 100644 --- a/packages/react/src/TextInput/TextInput.features.stories.tsx +++ b/packages/react/src/TextInput/TextInput.features.stories.tsx @@ -318,3 +318,44 @@ export const WithAutocompleteAttribute = () => ( ) + +export const WithCharacterLimit = () => { + const [value, setValue] = useState('') + + return ( +
+ ) +} + +export const WithCharacterLimitAndCaption = () => { + const [value, setValue] = useState('') + + return ( + + ) +} + +export const WithCharacterLimitExceeded = () => { + const [value, setValue] = useState('This is a very long text that exceeds the limit') + + return ( + + ) +} diff --git a/packages/react/src/TextInput/TextInput.module.css b/packages/react/src/TextInput/TextInput.module.css new file mode 100644 index 00000000000..c261a151557 --- /dev/null +++ b/packages/react/src/TextInput/TextInput.module.css @@ -0,0 +1,10 @@ +.CharacterCounter { + display: flex; + align-items: center; + gap: var(--control-xsmall-gap); + color: var(--fgColor-muted); +} + +.CharacterCounter--error { + color: var(--fgColor-danger); +} diff --git a/packages/react/src/TextInput/TextInput.test.tsx b/packages/react/src/TextInput/TextInput.test.tsx index a4aa0659153..a8928761d79 100644 --- a/packages/react/src/TextInput/TextInput.test.tsx +++ b/packages/react/src/TextInput/TextInput.test.tsx @@ -31,7 +31,7 @@ describe('TextInput', () => { }) it('renders error', () => { - expect(render(