primer_view_components 0.36.0 → 0.36.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/app/assets/javascripts/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -0
  4. data/app/assets/javascripts/components/primer/primer.d.ts +1 -0
  5. data/app/assets/javascripts/components/primer/utils.d.ts +1 -0
  6. data/app/assets/javascripts/primer_view_components.js +1 -1
  7. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  8. data/app/assets/styles/primer_view_components.css +1 -1
  9. data/app/assets/styles/primer_view_components.css.map +1 -1
  10. data/app/components/primer/alpha/action_list/item.html.erb +1 -4
  11. data/app/components/primer/alpha/action_list.css +1 -1
  12. data/app/components/primer/alpha/action_list.css.json +2 -6
  13. data/app/components/primer/alpha/action_list.css.map +1 -1
  14. data/app/components/primer/alpha/action_list.pcss +10 -43
  15. data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -0
  16. data/app/components/primer/alpha/action_menu/action_menu_element.js +31 -1
  17. data/app/components/primer/alpha/action_menu/action_menu_element.ts +37 -0
  18. data/app/components/primer/alpha/action_menu.rb +6 -0
  19. data/app/components/primer/alpha/select_panel_element.js +6 -19
  20. data/app/components/primer/alpha/select_panel_element.ts +9 -21
  21. data/app/components/primer/alpha/text_field.css +1 -1
  22. data/app/components/primer/alpha/text_field.css.json +30 -30
  23. data/app/components/primer/alpha/text_field.css.map +1 -1
  24. data/app/components/primer/alpha/text_field.pcss +2 -3
  25. data/app/components/primer/primer.d.ts +1 -0
  26. data/app/components/primer/primer.js +1 -0
  27. data/app/components/primer/primer.ts +1 -0
  28. data/app/components/primer/utils.d.ts +1 -0
  29. data/app/components/primer/utils.js +16 -0
  30. data/app/components/primer/utils.ts +16 -0
  31. data/app/lib/primer/forms/acts_as_component.rb +9 -2
  32. data/app/lib/primer/forms/base.rb +0 -5
  33. data/app/lib/primer/forms/base_component.rb +5 -3
  34. data/app/lib/primer/forms/radio_button_group.html.erb +1 -1
  35. data/app/lib/primer/forms/utils.rb +16 -1
  36. data/lib/primer/classify.rb +1 -1
  37. data/lib/primer/view_components/version.rb +1 -1
  38. data/lib/rubocop/config/default.yml +0 -3
  39. data/previews/primer/alpha/action_menu_preview/in_scroll_container.html.erb +3 -5
  40. data/static/classes.json +6 -0
  41. metadata +10 -7
  42. data/lib/rubocop/cop/primer/system_argument_instead_of_class.rb +0 -57
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.36.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -72,7 +72,7 @@ dependencies:
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '4.0'
75
- description:
75
+ description:
76
76
  email:
77
77
  - opensource+primer_view_components@github.com
78
78
  executables: []
@@ -105,6 +105,7 @@ files:
105
105
  - app/assets/javascripts/components/primer/primer.d.ts
106
106
  - app/assets/javascripts/components/primer/scrollable_region.d.ts
107
107
  - app/assets/javascripts/components/primer/shared_events.d.ts
108
+ - app/assets/javascripts/components/primer/utils.d.ts
108
109
  - app/assets/javascripts/lib/primer/forms/primer_multi_input.d.ts
109
110
  - app/assets/javascripts/lib/primer/forms/primer_text_field.d.ts
110
111
  - app/assets/javascripts/lib/primer/forms/toggle_switch_input.d.ts
@@ -496,6 +497,9 @@ files:
496
497
  - app/components/primer/truncate.css.map
497
498
  - app/components/primer/truncate.pcss
498
499
  - app/components/primer/truncate.rb
500
+ - app/components/primer/utils.d.ts
501
+ - app/components/primer/utils.js
502
+ - app/components/primer/utils.ts
499
503
  - app/forms/action_menu_form.rb
500
504
  - app/forms/after_content_form.rb
501
505
  - app/forms/after_content_form/after_content.html.erb
@@ -726,7 +730,6 @@ files:
726
730
  - lib/rubocop/cop/primer/deprecated_layout_component.rb
727
731
  - lib/rubocop/cop/primer/no_tag_memoize.rb
728
732
  - lib/rubocop/cop/primer/primer_octicon.rb
729
- - lib/rubocop/cop/primer/system_argument_instead_of_class.rb
730
733
  - lib/rubocop/cop/primer/test_selector.rb
731
734
  - lib/tasks/custom_utilities.yml
732
735
  - previews/pages/forms/01_introduction.md.erb
@@ -954,7 +957,7 @@ licenses:
954
957
  - MIT
955
958
  metadata:
956
959
  allowed_push_host: https://rubygems.org
957
- post_install_message:
960
+ post_install_message:
958
961
  rdoc_options: []
959
962
  require_paths:
960
963
  - lib
@@ -970,7 +973,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
970
973
  version: '0'
971
974
  requirements: []
972
975
  rubygems_version: 3.5.22
973
- signing_key:
976
+ signing_key:
974
977
  specification_version: 4
975
978
  summary: ViewComponents for the Primer Design System
976
979
  test_files: []
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
- require "primer/classify/utilities"
5
-
6
- # :nocov:
7
- module RuboCop
8
- module Cop
9
- module Primer
10
- # This cop ensures that components use System Arguments instead of CSS classes.
11
- #
12
- # bad
13
- # Component.new(classes: "mr-1")
14
- #
15
- # good
16
- # Component.new(mr: 1)
17
- class SystemArgumentInsteadOfClass < BaseCop
18
- INVALID_MESSAGE = <<~STR
19
- Avoid using CSS classes when you can use System Arguments: https://primer.style/view-components/system-arguments.
20
- STR
21
-
22
- def on_send(node)
23
- return unless valid_node?(node)
24
- return unless node.arguments?
25
-
26
- # we are looking for hash arguments and they are always last
27
- kwargs = node.arguments.last
28
-
29
- return unless kwargs.type == :hash
30
-
31
- # find classes pair
32
- classes_arg = kwargs.pairs.find { |kwarg| kwarg.key.value == :classes }
33
-
34
- return if classes_arg.nil?
35
- return unless classes_arg.value.type == :str
36
-
37
- # get actual classes
38
- classes = classes_arg.value.value
39
-
40
- system_arguments = ::Primer::Classify::Utilities.classes_to_hash(classes)
41
-
42
- # no classes are fixable
43
- return if system_arguments[:classes] == classes
44
-
45
- add_offense(classes_arg, message: INVALID_MESSAGE)
46
- end
47
-
48
- def autocorrect(node)
49
- lambda do |corrector|
50
- args = ::Primer::Classify::Utilities.classes_to_args(node.value.value)
51
- corrector.replace(node.loc.expression, args)
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end