primer_view_components 0.47.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -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/assets/styles/primer_view_components.css +1 -1
  10. data/app/assets/styles/primer_view_components.css.map +1 -1
  11. data/app/components/primer/alpha/action_list.css +1 -1
  12. data/app/components/primer/alpha/action_list.css.map +1 -1
  13. data/app/components/primer/alpha/auto_complete/auto_complete.html.erb +8 -6
  14. data/app/components/primer/alpha/text_area.rb +1 -0
  15. data/app/components/primer/alpha/text_field.css +1 -1
  16. data/app/components/primer/alpha/text_field.css.map +1 -1
  17. data/app/components/primer/alpha/text_field.rb +1 -0
  18. data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
  19. data/app/components/primer/alpha/tool_tip.js +12 -5
  20. data/app/components/primer/alpha/tool_tip.ts +14 -5
  21. data/app/components/primer/alpha/underline_nav.css +1 -1
  22. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  23. data/app/components/primer/beta/auto_complete/item.html.erb +5 -4
  24. data/app/components/primer/beta/avatar.rb +10 -2
  25. data/app/components/primer/beta/avatar_stack.css +1 -1
  26. data/app/components/primer/beta/avatar_stack.css.json +5 -3
  27. data/app/components/primer/beta/avatar_stack.css.map +1 -1
  28. data/app/components/primer/beta/avatar_stack.pcss +12 -1
  29. data/app/components/primer/beta/avatar_stack.rb +6 -0
  30. data/app/components/primer/beta/button.css +1 -1
  31. data/app/components/primer/beta/button.css.map +1 -1
  32. data/app/components/primer/beta/spinner.html.erb +2 -2
  33. data/app/components/primer/primer.d.ts +1 -0
  34. data/app/components/primer/primer.js +1 -0
  35. data/app/components/primer/primer.ts +1 -0
  36. data/app/forms/text_area_with_character_limit_form.rb +13 -0
  37. data/app/forms/text_field_with_character_limit_form.rb +13 -0
  38. data/app/lib/primer/forms/caption.html.erb +16 -9
  39. data/app/lib/primer/forms/character_counter.d.ts +41 -0
  40. data/app/lib/primer/forms/character_counter.js +114 -0
  41. data/app/lib/primer/forms/character_counter.ts +129 -0
  42. data/app/lib/primer/forms/dsl/input.rb +23 -0
  43. data/app/lib/primer/forms/dsl/text_area_input.rb +12 -1
  44. data/app/lib/primer/forms/dsl/text_field_input.rb +10 -1
  45. data/app/lib/primer/forms/primer_text_area.d.ts +13 -0
  46. data/app/lib/primer/forms/primer_text_area.js +53 -0
  47. data/app/lib/primer/forms/primer_text_area.ts +37 -0
  48. data/app/lib/primer/forms/primer_text_field.d.ts +2 -0
  49. data/app/lib/primer/forms/primer_text_field.js +16 -2
  50. data/app/lib/primer/forms/primer_text_field.ts +16 -3
  51. data/app/lib/primer/forms/text_area.html.erb +6 -4
  52. data/app/lib/primer/forms/text_field.rb +8 -0
  53. data/lib/primer/view_components/version.rb +1 -1
  54. data/previews/primer/alpha/action_menu_preview/submitting_forms.html.erb +1 -1
  55. data/previews/primer/alpha/text_area_preview.rb +23 -2
  56. data/previews/primer/alpha/text_field_preview.rb +28 -7
  57. data/previews/primer/alpha/tree_view_preview/loading_failure.html.erb +53 -1
  58. data/previews/primer/beta/avatar_stack_preview.rb +9 -0
  59. data/previews/primer/forms_preview/text_area_with_character_limit_form.html.erb +3 -0
  60. data/previews/primer/forms_preview/text_field_with_character_limit_form.html.erb +3 -0
  61. data/previews/primer/forms_preview.rb +6 -0
  62. data/static/arguments.json +18 -0
  63. data/static/form_previews.json +10 -0
  64. data/static/info_arch.json +109 -0
  65. data/static/previews.json +91 -0
  66. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0f682e7337690e0fe1d5c020ab010381b30ea772ab5c0bf21c7eed911e67c13
4
- data.tar.gz: 3a06c5482c32f5fa77655e35f271bae0e7c2be88524b8d78e679d50c70b0ca57
3
+ metadata.gz: e7d509e9a9307fdbd82ab00604ce697321ae66150e5a48de692319bf347bedeb
4
+ data.tar.gz: 190adebddee0cf2dec941d19b5b90b1b16141381015eac139750cbb9f8890eb6
5
5
  SHA512:
6
- metadata.gz: d57afd621a61d90850157b11a2269095b6b448acc7f6463116f0cac63ad5c3e65d013cc6aa3ef719360662737cc6e72490daa25f278d354863a68ad0fe4176e7
7
- data.tar.gz: 1cacf26cd9d3793613dcf7fb75a8245cd42152a658fc7c39a60429a609a2e5e88d4bae4a390cc0f96b8c12dce253c0b1fb1e7bd0661aba00b7ff4c7044d5607a
6
+ metadata.gz: e19c2477a87cdc1636ade610c2bf05e772c9538b5eb0b0ee9b55876f66c1a184cbc9e416ba40d41660540d023ca58327fcaa4c2a64f72a26225f138d7aa620a2
7
+ data.tar.gz: 97ca0e52e8941bbd9c27b4f2ac707edc476a139053e8a4abcf6a0fc74ffc071cfab300a6b7f0f1ad659d732d0623310608485333112f3ce869641ecc8124abbe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
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
+
21
+ ## 0.48.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [#3776](https://github.com/primer/view_components/pull/3776) [`edc480f`](https://github.com/primer/view_components/commit/edc480fe8ac9352fa5584488e9f6d3887fe088d2) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AvatarStack: Adds support for individual tooltips on AvatarStack component, avatars.
26
+
3
27
  ## 0.47.0
4
28
 
5
29
  ### Minor Changes
@@ -376,7 +400,6 @@
376
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
377
401
 
378
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:
379
-
380
403
  1. If multiple server-rendered items are checked, the panel will only show one item checked.
381
404
  2. If no `data-value` attributes are provided, panels in single-select mode will allow multiple items to be checked.
382
405
 
@@ -553,7 +576,6 @@
553
576
  ### Patch Changes
554
577
 
555
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`
556
-
557
579
  - Bug fix: text overflows in SegmentedControl instead of ellipses
558
580
 
559
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
@@ -755,7 +777,6 @@
755
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
756
778
 
757
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:
758
-
759
780
  - inactive buttons need to meet the color contrast ratio minimum
760
781
  - inactive buttons shouldn't have aria-disabled since they can still accept interactions such as:
761
782
  - hover/focus to show a tooltip
@@ -825,7 +846,6 @@
825
846
  ### Minor Changes
826
847
 
827
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
828
-
829
849
  - Removes caret
830
850
  - Decrease offset
831
851
  - Remove animation delay
@@ -879,7 +899,6 @@
879
899
  <!-- Changed components: Primer::Alpha::ActionBar -->
880
900
 
881
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.
882
-
883
902
  - Adjusts `focus_group.ts` to set `tabindex="0"` back to invoker if it is non-focusable.
884
903
  - Prevents popover invokers from being triggered with 'left' and 'right' arrow keys.
885
904
 
@@ -918,7 +937,6 @@
918
937
  <!-- Changed components: _none_ -->
919
938
 
920
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)
921
-
922
940
  - Fix disabled button styles (v8 colors)
923
941
  - Bump Primitives to latest
924
942
 
@@ -1633,7 +1651,6 @@
1633
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
1634
1652
 
1635
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:
1636
-
1637
1654
  - Primer::Dropdown moving to Primer::Alpha::Dropdown
1638
1655
  - Primer::Dropdown::Menu moving to Primer::Alpha::Dropdown::Menu
1639
1656
  - Primer::Dropdown::Menu::Item moving to Primer::Alpha::Dropdown::Menu::Item
@@ -2451,7 +2468,6 @@
2451
2468
  _Manuel Puyol_
2452
2469
 
2453
2470
  - Change spacing in `Blankslate`:
2454
-
2455
2471
  - Between `description` and `primary_action` to `32px`.
2456
2472
  - Between `primary_action` and `secondary_action` to `16px`.
2457
2473
 
@@ -2809,7 +2825,6 @@
2809
2825
  _Manuel Puyol_
2810
2826
 
2811
2827
  - Linters can:
2812
-
2813
2828
  - convert values with ERB interpolations.
2814
2829
  - autocorrect cases with custom classes.
2815
2830
 
@@ -2924,7 +2939,6 @@
2924
2939
  _Kate Higa_
2925
2940
 
2926
2941
  - Renames:
2927
-
2928
2942
  - `Primer::AvatarStackComponent` to `Primer::Beta::AvatarStack`.
2929
2943
 
2930
2944
  _Manuel Puyol_
@@ -2966,7 +2980,6 @@
2966
2980
  _Kate Higa_
2967
2981
 
2968
2982
  - Renames:
2969
-
2970
2983
  - `Primer::AutoComplete` to `Primer::Beta::AutoComplete`
2971
2984
  - `Primer::AutoComplete::Item` to `Primer::Beta::AutoComplete::Item`
2972
2985
  - `Primer::AvatarComponent` to `Primer::Beta::Avatar`
@@ -3110,7 +3123,6 @@
3110
3123
  _Kate Higa_
3111
3124
 
3112
3125
  - Renames:
3113
-
3114
3126
  - `DropdownComponent` to `Dropdown`.
3115
3127
  - `Dropdown::MenuComponent` to `Dropdown::Menu`.
3116
3128
  - `Primer::ButtonMarketingComponent` to `Primer::Alpha::ButtonMarketing`.
@@ -3568,7 +3580,6 @@
3568
3580
  _Simon Taranto_
3569
3581
 
3570
3582
  - Update `LinkComponent`:
3571
-
3572
3583
  - use `Link--muted` instead of `muted-link`.
3573
3584
  - accept `variant` and `underline` options.
3574
3585
  - accept `:span` as a tag.
@@ -3878,7 +3889,6 @@
3878
3889
 
3879
3890
  - Add support for box_shadow
3880
3891
  - Add components:
3881
-
3882
3892
  - Popover
3883
3893
 
3884
3894
  _Sarah Vessels_
@@ -3900,7 +3910,6 @@
3900
3910
  _Joel Hawksley_
3901
3911
 
3902
3912
  - Add components:
3903
-
3904
3913
  - Avatar
3905
3914
  - Blankslate
3906
3915
 
@@ -3921,7 +3930,6 @@
3921
3930
  _Manuel Puyol_
3922
3931
 
3923
3932
  - Add components:
3924
-
3925
3933
  - BorderBox
3926
3934
  - Box
3927
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;