From 9ce7d1364a26fe777231fc35e192efec61e3a9c7 Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:19:37 +0000 Subject: [PATCH 01/33] Initial work to add character counts to TextField and TextArea components --- .erblint-rubocop20251203-37257-3idmxl | 13 +++ app/components/primer/alpha/form_control.rb | 10 +- app/components/primer/alpha/text_field.pcss | 6 ++ app/components/primer/primer.ts | 1 + .../text_area_with_character_limit_form.rb | 13 +++ .../text_field_with_character_limit_form.rb | 13 +++ app/lib/primer/forms/caption.html.erb | 23 +++-- app/lib/primer/forms/dsl/input.rb | 4 + app/lib/primer/forms/dsl/text_area_input.rb | 13 ++- app/lib/primer/forms/dsl/text_field_input.rb | 11 ++- app/lib/primer/forms/primer_text_area.ts | 97 +++++++++++++++++++ app/lib/primer/forms/primer_text_field.ts | 78 ++++++++++++++- app/lib/primer/forms/text_area.html.erb | 22 ++++- app/lib/primer/forms/text_area.rb | 7 ++ app/lib/primer/forms/text_field.html.erb | 6 ++ app/lib/primer/forms/text_field.rb | 7 ++ package-lock.json | 62 ++++++++++-- previews/primer/alpha/text_area_preview.rb | 19 +++- previews/primer/alpha/text_field_preview.rb | 19 +++- previews/primer/forms_preview.rb | 6 ++ ...xt_area_with_character_limit_form.html.erb | 3 + ...t_field_with_character_limit_form.html.erb | 3 + test/lib/primer/forms/text_area_input_test.rb | 34 +++++++ .../lib/primer/forms/text_field_input_test.rb | 34 +++++++ 24 files changed, 474 insertions(+), 30 deletions(-) create mode 100644 .erblint-rubocop20251203-37257-3idmxl create mode 100644 app/forms/text_area_with_character_limit_form.rb create mode 100644 app/forms/text_field_with_character_limit_form.rb create mode 100644 app/lib/primer/forms/primer_text_area.ts create mode 100644 previews/primer/forms_preview/text_area_with_character_limit_form.html.erb create mode 100644 previews/primer/forms_preview/text_field_with_character_limit_form.html.erb diff --git a/.erblint-rubocop20251203-37257-3idmxl b/.erblint-rubocop20251203-37257-3idmxl new file mode 100644 index 0000000000..5977a9e86d --- /dev/null +++ b/.erblint-rubocop20251203-37257-3idmxl @@ -0,0 +1,13 @@ +--- +inherit_from: +- lib/rubocop/config/default.yml +AllCops: + DisabledByDefault: true +Primer/DeprecatedComponents: + Enabled: false + Exclude: + - app/components/primer/layout_component.html.erb +Migrations/IconButtonComponent: + Enabled: true +Migrations/TruncateComponent: + Enabled: true diff --git a/app/components/primer/alpha/form_control.rb b/app/components/primer/alpha/form_control.rb index 0433f9c1f9..7758b96f36 100644 --- a/app/components/primer/alpha/form_control.rb +++ b/app/components/primer/alpha/form_control.rb @@ -48,14 +48,16 @@ class FormControl < Primer::Component # @param visually_hide_label [Boolean] When set to `true`, hides the label. Although the label will be hidden visually, it will still be visible to screen readers. # @param full_width [Boolean] When set to `true`, the form control will take up all the horizontal space allowed by its container. # @param label_arguments [Hash] HTML attributes to attach to the `