primer_view_components 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -16
  3. data/app/assets/javascripts/components/primer/primer.d.ts +1 -0
  4. data/app/assets/javascripts/lib/primer/forms/character_counter.d.ts +41 -0
  5. data/app/assets/javascripts/lib/primer/forms/primer_text_area.d.ts +13 -0
  6. data/app/assets/javascripts/lib/primer/forms/primer_text_field.d.ts +2 -0
  7. data/app/assets/javascripts/primer_view_components.js +1 -1
  8. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  9. data/app/components/primer/alpha/auto_complete/auto_complete.html.erb +8 -6
  10. data/app/components/primer/alpha/text_area.rb +1 -0
  11. data/app/components/primer/alpha/text_field.rb +1 -0
  12. data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
  13. data/app/components/primer/alpha/tool_tip.js +12 -5
  14. data/app/components/primer/alpha/tool_tip.ts +14 -5
  15. data/app/components/primer/beta/auto_complete/item.html.erb +5 -4
  16. data/app/components/primer/beta/avatar.rb +4 -0
  17. data/app/components/primer/beta/avatar_stack.rb +6 -0
  18. data/app/components/primer/beta/spinner.html.erb +2 -2
  19. data/app/components/primer/primer.d.ts +1 -0
  20. data/app/components/primer/primer.js +1 -0
  21. data/app/components/primer/primer.ts +1 -0
  22. data/app/forms/text_area_with_character_limit_form.rb +13 -0
  23. data/app/forms/text_field_with_character_limit_form.rb +13 -0
  24. data/app/lib/primer/forms/caption.html.erb +16 -9
  25. data/app/lib/primer/forms/character_counter.d.ts +41 -0
  26. data/app/lib/primer/forms/character_counter.js +114 -0
  27. data/app/lib/primer/forms/character_counter.ts +129 -0
  28. data/app/lib/primer/forms/dsl/input.rb +23 -0
  29. data/app/lib/primer/forms/dsl/text_area_input.rb +12 -1
  30. data/app/lib/primer/forms/dsl/text_field_input.rb +10 -1
  31. data/app/lib/primer/forms/primer_text_area.d.ts +13 -0
  32. data/app/lib/primer/forms/primer_text_area.js +53 -0
  33. data/app/lib/primer/forms/primer_text_area.ts +37 -0
  34. data/app/lib/primer/forms/primer_text_field.d.ts +2 -0
  35. data/app/lib/primer/forms/primer_text_field.js +16 -2
  36. data/app/lib/primer/forms/primer_text_field.ts +16 -3
  37. data/app/lib/primer/forms/text_area.html.erb +6 -4
  38. data/app/lib/primer/forms/text_field.rb +8 -0
  39. data/lib/primer/view_components/version.rb +1 -1
  40. data/previews/primer/alpha/action_menu_preview/submitting_forms.html.erb +1 -1
  41. data/previews/primer/alpha/text_area_preview.rb +23 -2
  42. data/previews/primer/alpha/text_field_preview.rb +28 -7
  43. data/previews/primer/alpha/tree_view_preview/loading_failure.html.erb +53 -1
  44. data/previews/primer/forms_preview/text_area_with_character_limit_form.html.erb +3 -0
  45. data/previews/primer/forms_preview/text_field_with_character_limit_form.html.erb +3 -0
  46. data/previews/primer/forms_preview.rb +6 -0
  47. data/static/arguments.json +12 -0
  48. data/static/form_previews.json +10 -0
  49. data/static/info_arch.json +90 -0
  50. data/static/previews.json +78 -0
  51. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ecebf361a0a9f970f9988a38a273b068f25e814829ff53b05cd62c5371ab994
4
- data.tar.gz: 93dfdbd63070b23ea32b4ed998170111acdf82eee7230e9172e5835685ed9ca3
3
+ metadata.gz: e7d509e9a9307fdbd82ab00604ce697321ae66150e5a48de692319bf347bedeb
4
+ data.tar.gz: 190adebddee0cf2dec941d19b5b90b1b16141381015eac139750cbb9f8890eb6
5
5
  SHA512:
6
- metadata.gz: b94999bd5be6d2b53e948c4416dcb8b90ca5d9e9327e0dabd7959647aa58d80f2f5fc6856c8dbd93849e3a2fe78eb0b3f5af1bc3b5dda47005560525bbbdb83c
7
- data.tar.gz: abddb151adc4586f697bf3243c91552407f03acead38942eede2ba70b35fda2d6bbf248ff68fa53d023abd0399575e88bcdf0658705b18387ee4b2de2edef5c4
6
+ metadata.gz: e19c2477a87cdc1636ade610c2bf05e772c9538b5eb0b0ee9b55876f66c1a184cbc9e416ba40d41660540d023ca58327fcaa4c2a64f72a26225f138d7aa620a2
7
+ data.tar.gz: 97ca0e52e8941bbd9c27b4f2ac707edc476a139053e8a4abcf6a0fc74ffc071cfab300a6b7f0f1ad659d732d0623310608485333112f3ce869641ecc8124abbe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.49.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3785](https://github.com/primer/view_components/pull/3785) [`7526370`](https://github.com/primer/view_components/commit/75263700b8c00ffdd525c81feed0de61b81d1067) Thanks [@lindseywild](https://github.com/lindseywild)! - Adds character_limit option to TextArea and TextField components
8
+
9
+ ### Patch Changes
10
+
11
+ - [#3832](https://github.com/primer/view_components/pull/3832) [`15ac0d4`](https://github.com/primer/view_components/commit/15ac0d498dca5947ca38992fb74b1e485d97a88a) Thanks [@llastflowers](https://github.com/llastflowers)! - Make Retry button focusable in loading_failure_story
12
+
13
+ - [#3848](https://github.com/primer/view_components/pull/3848) [`20d2e9f`](https://github.com/primer/view_components/commit/20d2e9f195864fb900fab2473592d2249eed5ac0) Thanks [@joelhawksley](https://github.com/joelhawksley)! - Add support for Ruby 4 in test suite.
14
+
15
+ - [#3823](https://github.com/primer/view_components/pull/3823) [`954596a`](https://github.com/primer/view_components/commit/954596a07c4230f107c24dad2967f25577828d5b) Thanks [@TylerJDev](https://github.com/TylerJDev)! - Tooltip: Prevents tooltip from appearing when popover (e.g. ActionMenu) is opened
16
+
17
+ - [#3850](https://github.com/primer/view_components/pull/3850) [`d722644`](https://github.com/primer/view_components/commit/d722644d98e7b80ee684ccd53d3192f51322512c) Thanks [@joelhawksley](https://github.com/joelhawksley)! - Fix compatibility issues with Herb, add linter to CI.
18
+
19
+ - [#3849](https://github.com/primer/view_components/pull/3849) [`7efbd32`](https://github.com/primer/view_components/commit/7efbd32a4d90388a13a524f41261b91693b3b222) Thanks [@llastflowers](https://github.com/llastflowers)! - Make AvatarStack accessible via keyboard navigation
20
+
3
21
  ## 0.48.0
4
22
 
5
23
  ### Minor Changes
@@ -382,7 +400,6 @@
382
400
  - [#2983](https://github.com/primer/view_components/pull/2983) [`5d68193`](https://github.com/primer/view_components/commit/5d681938247c4a957d62b05c2560fef24195ff51) Thanks [@keithamus](https://github.com/keithamus)! - Ensure ActionMenu restores focus on close of a dialog, if a menu item opened that dialog
383
401
 
384
402
  - [#3010](https://github.com/primer/view_components/pull/3010) [`ebab85a`](https://github.com/primer/view_components/commit/ebab85a3a3d2644079aaf495fd1e6689b89f713b) Thanks [@camertron](https://github.com/camertron)! - Fixes several SelectPanel bugs:
385
-
386
403
  1. If multiple server-rendered items are checked, the panel will only show one item checked.
387
404
  2. If no `data-value` attributes are provided, panels in single-select mode will allow multiple items to be checked.
388
405
 
@@ -559,7 +576,6 @@
559
576
  ### Patch Changes
560
577
 
561
578
  - [#2751](https://github.com/primer/view_components/pull/2751) [`b1fef3c`](https://github.com/primer/view_components/commit/b1fef3cf8ae547241b4d63fde81bc6c127fbd862) Thanks [@langermank](https://github.com/langermank)! - - Add `label_wrap` param to `Beta::Button`
562
-
563
579
  - Bug fix: text overflows in SegmentedControl instead of ellipses
564
580
 
565
581
  - [#2765](https://github.com/primer/view_components/pull/2765) [`1857983`](https://github.com/primer/view_components/commit/1857983591752336d34133c83af3c8cfe232f1af) Thanks [@camertron](https://github.com/camertron)! - Fix issue preventing expansion and collapse of nav list items with tooltips
@@ -761,7 +777,6 @@
761
777
  - [#2414](https://github.com/primer/view_components/pull/2414) [`48a2405a`](https://github.com/primer/view_components/commit/48a2405a2cdb6865eb57c2ea411fcece026590d0) Thanks [@keithamus](https://github.com/keithamus)! - Prevent other Overlays closing when Escape is pressed while Tooltips are open
762
778
 
763
779
  - [#2379](https://github.com/primer/view_components/pull/2379) [`2c59c33b`](https://github.com/primer/view_components/commit/2c59c33bf54e392d743fbdd1076d06bff2151b42) Thanks [@mperrotti](https://github.com/mperrotti)! - Updates 'inactive' state for buttons based on feedback from the a11y team:
764
-
765
780
  - inactive buttons need to meet the color contrast ratio minimum
766
781
  - inactive buttons shouldn't have aria-disabled since they can still accept interactions such as:
767
782
  - hover/focus to show a tooltip
@@ -831,7 +846,6 @@
831
846
  ### Minor Changes
832
847
 
833
848
  - [#2284](https://github.com/primer/view_components/pull/2284) [`374d10fd`](https://github.com/primer/view_components/commit/374d10fd18e7371f49abf75dde135c3ed29fe33d) Thanks [@langermank](https://github.com/langermank)! - Update tooltip design
834
-
835
849
  - Removes caret
836
850
  - Decrease offset
837
851
  - Remove animation delay
@@ -885,7 +899,6 @@
885
899
  <!-- Changed components: Primer::Alpha::ActionBar -->
886
900
 
887
901
  - [#2259](https://github.com/primer/view_components/pull/2259) [`a2fe6134`](https://github.com/primer/view_components/commit/a2fe61342b2f3527533902d845f5a9d500d6910c) Thanks [@TylerJDev](https://github.com/TylerJDev)! - \* Includes ActionMenu in ActionBar focus trap when present.
888
-
889
902
  - Adjusts `focus_group.ts` to set `tabindex="0"` back to invoker if it is non-focusable.
890
903
  - Prevents popover invokers from being triggered with 'left' and 'right' arrow keys.
891
904
 
@@ -924,7 +937,6 @@
924
937
  <!-- Changed components: _none_ -->
925
938
 
926
939
  - [#2250](https://github.com/primer/view_components/pull/2250) [`66c4dd69`](https://github.com/primer/view_components/commit/66c4dd6936b386caa42868beef9ea1b33f84b11b) Thanks [@langermank](https://github.com/langermank)! - - Improve contrast for icons in `invisible` button on hover in dark mode (within v8 colors)
927
-
928
940
  - Fix disabled button styles (v8 colors)
929
941
  - Bump Primitives to latest
930
942
 
@@ -1639,7 +1651,6 @@
1639
1651
  - [#1632](https://github.com/primer/view_components/pull/1632) [`7f1181be`](https://github.com/primer/view_components/commit/7f1181be49960337254db834e9b2b9a5fdb7b0b8) Thanks [@camertron](https://github.com/camertron)! - Improve performance of the deny\_\* methods
1640
1652
 
1641
1653
  * [#1625](https://github.com/primer/view_components/pull/1625) [`3af9bf5e`](https://github.com/primer/view_components/commit/3af9bf5e778bb1fe475ed7efda9fc1a5ed36d695) Thanks [@jonrohan](https://github.com/jonrohan)! - Deprecate components and moving to new namespace:
1642
-
1643
1654
  - Primer::Dropdown moving to Primer::Alpha::Dropdown
1644
1655
  - Primer::Dropdown::Menu moving to Primer::Alpha::Dropdown::Menu
1645
1656
  - Primer::Dropdown::Menu::Item moving to Primer::Alpha::Dropdown::Menu::Item
@@ -2457,7 +2468,6 @@
2457
2468
  _Manuel Puyol_
2458
2469
 
2459
2470
  - Change spacing in `Blankslate`:
2460
-
2461
2471
  - Between `description` and `primary_action` to `32px`.
2462
2472
  - Between `primary_action` and `secondary_action` to `16px`.
2463
2473
 
@@ -2815,7 +2825,6 @@
2815
2825
  _Manuel Puyol_
2816
2826
 
2817
2827
  - Linters can:
2818
-
2819
2828
  - convert values with ERB interpolations.
2820
2829
  - autocorrect cases with custom classes.
2821
2830
 
@@ -2930,7 +2939,6 @@
2930
2939
  _Kate Higa_
2931
2940
 
2932
2941
  - Renames:
2933
-
2934
2942
  - `Primer::AvatarStackComponent` to `Primer::Beta::AvatarStack`.
2935
2943
 
2936
2944
  _Manuel Puyol_
@@ -2972,7 +2980,6 @@
2972
2980
  _Kate Higa_
2973
2981
 
2974
2982
  - Renames:
2975
-
2976
2983
  - `Primer::AutoComplete` to `Primer::Beta::AutoComplete`
2977
2984
  - `Primer::AutoComplete::Item` to `Primer::Beta::AutoComplete::Item`
2978
2985
  - `Primer::AvatarComponent` to `Primer::Beta::Avatar`
@@ -3116,7 +3123,6 @@
3116
3123
  _Kate Higa_
3117
3124
 
3118
3125
  - Renames:
3119
-
3120
3126
  - `DropdownComponent` to `Dropdown`.
3121
3127
  - `Dropdown::MenuComponent` to `Dropdown::Menu`.
3122
3128
  - `Primer::ButtonMarketingComponent` to `Primer::Alpha::ButtonMarketing`.
@@ -3574,7 +3580,6 @@
3574
3580
  _Simon Taranto_
3575
3581
 
3576
3582
  - Update `LinkComponent`:
3577
-
3578
3583
  - use `Link--muted` instead of `muted-link`.
3579
3584
  - accept `variant` and `underline` options.
3580
3585
  - accept `:span` as a tag.
@@ -3884,7 +3889,6 @@
3884
3889
 
3885
3890
  - Add support for box_shadow
3886
3891
  - Add components:
3887
-
3888
3892
  - Popover
3889
3893
 
3890
3894
  _Sarah Vessels_
@@ -3906,7 +3910,6 @@
3906
3910
  _Joel Hawksley_
3907
3911
 
3908
3912
  - Add components:
3909
-
3910
3913
  - Avatar
3911
3914
  - Blankslate
3912
3915
 
@@ -3927,7 +3930,6 @@
3927
3930
  _Manuel Puyol_
3928
3931
 
3929
3932
  - Add components:
3930
-
3931
3933
  - BorderBox
3932
3934
  - Box
3933
3935
  - Breadcrumb
@@ -22,6 +22,7 @@ import './beta/relative_time';
22
22
  import './alpha/tab_container';
23
23
  import '../../lib/primer/forms/primer_multi_input';
24
24
  import '../../lib/primer/forms/primer_text_field';
25
+ import '../../lib/primer/forms/primer_text_area';
25
26
  import '../../lib/primer/forms/toggle_switch_input';
26
27
  import './alpha/action_menu/action_menu_element';
27
28
  import './alpha/select_panel_element';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Shared character counting functionality for text inputs with character limits.
3
+ * Handles real-time character count updates, validation, and aria-live announcements.
4
+ */
5
+ export declare class CharacterCounter {
6
+ private inputElement;
7
+ private characterLimitElement;
8
+ private characterLimitSrElement;
9
+ private SCREEN_READER_DELAY;
10
+ private announceTimeout;
11
+ private isInitialLoad;
12
+ constructor(inputElement: HTMLInputElement | HTMLTextAreaElement, characterLimitElement: HTMLElement, characterLimitSrElement: HTMLElement);
13
+ /**
14
+ * Initialize character counting by setting up event listener and initial count
15
+ */
16
+ initialize(signal?: AbortSignal): void;
17
+ /**
18
+ * Clean up any pending timeouts
19
+ */
20
+ cleanup(): void;
21
+ /**
22
+ * Pluralizes a word based on the count
23
+ */
24
+ private pluralize;
25
+ /**
26
+ * Update the character count display and validation state
27
+ */
28
+ private updateCharacterCount;
29
+ /**
30
+ * Announce character count to screen readers with debouncing
31
+ */
32
+ private announceToScreenReader;
33
+ /**
34
+ * Set error when character limit is exceeded
35
+ */
36
+ private setError;
37
+ /**
38
+ * Clear error when back under character limit
39
+ */
40
+ private clearError;
41
+ }
@@ -0,0 +1,13 @@
1
+ export declare class PrimerTextAreaElement extends HTMLElement {
2
+ #private;
3
+ inputElement: HTMLTextAreaElement;
4
+ characterLimitElement: HTMLElement;
5
+ characterLimitSrElement: HTMLElement;
6
+ connectedCallback(): void;
7
+ disconnectedCallback(): void;
8
+ }
9
+ declare global {
10
+ interface Window {
11
+ PrimerTextAreaElement: typeof PrimerTextAreaElement;
12
+ }
13
+ }
@@ -15,6 +15,8 @@ export declare class PrimerTextFieldElement extends HTMLElement {
15
15
  validationErrorIcon: HTMLElement;
16
16
  leadingVisual: HTMLElement;
17
17
  leadingSpinner: HTMLElement;
18
+ characterLimitElement: HTMLElement;
19
+ characterLimitSrElement: HTMLElement;
18
20
  connectedCallback(): void;
19
21
  disconnectedCallback(): void;
20
22
  clearContents(): void;