primer_view_components 0.0.119 → 0.0.120

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/components/primer/alpha/modal_dialog.js +2 -0
  6. data/app/components/primer/alpha/modal_dialog.ts +2 -0
  7. data/lib/primer/deprecations.yml +0 -13
  8. data/lib/primer/view_components/linters/button_component_migration_counter.rb +2 -2
  9. data/lib/primer/view_components/version.rb +1 -1
  10. data/lib/primer/view_components.rb +5 -0
  11. data/lib/primer/yard/backend.rb +38 -0
  12. data/lib/primer/yard/component_manifest.rb +123 -0
  13. data/lib/primer/yard/docs_helper.rb +81 -0
  14. data/lib/primer/yard/legacy_gatsby_backend.rb +271 -0
  15. data/lib/primer/yard/registry.rb +146 -0
  16. data/lib/primer/yard/renders_many_handler.rb +23 -0
  17. data/lib/primer/yard/renders_one_handler.rb +23 -0
  18. data/lib/rubocop/config/default.yml +3 -0
  19. data/lib/rubocop/cop/primer/test_selector.rb +48 -0
  20. data/lib/tasks/docs.rake +37 -405
  21. data/previews/primer/alpha/dialog_preview/body_has_scrollbar_overflow.html.erb +9 -0
  22. data/previews/primer/alpha/dialog_preview.rb +15 -0
  23. data/static/arguments.json +0 -32
  24. data/static/audited_at.json +0 -3
  25. data/static/constants.json +0 -20
  26. data/static/statuses.json +0 -3
  27. metadata +17 -15
  28. data/app/components/primer/box_component.rb +0 -7
  29. data/app/components/primer/clipboard_copy.rb +0 -7
  30. data/app/components/primer/dropdown_menu_component.html.erb +0 -8
  31. data/app/components/primer/dropdown_menu_component.rb +0 -58
  32. data/lib/yard/docs_helper.rb +0 -79
  33. data/lib/yard/renders_many_handler.rb +0 -19
  34. data/lib/yard/renders_one_handler.rb +0 -19
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.0.119
4
+ version: 0.0.120
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-20 00:00:00.000000000 Z
11
+ date: 2023-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -56,22 +56,22 @@ dependencies:
56
56
  name: view_component
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ">"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.81.0
61
+ version: '2.0'
62
62
  - - "<"
63
63
  - !ruby/object:Gem::Version
64
- version: '3.0'
64
+ version: '4.0'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - ">"
70
70
  - !ruby/object:Gem::Version
71
- version: 2.81.0
71
+ version: '2.0'
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.0'
74
+ version: '4.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: allocation_stats
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -658,17 +658,13 @@ files:
658
658
  - app/components/primer/blankslate_component.html.erb
659
659
  - app/components/primer/blankslate_component.rb
660
660
  - app/components/primer/box.rb
661
- - app/components/primer/box_component.rb
662
661
  - app/components/primer/button_component.html.erb
663
662
  - app/components/primer/button_component.rb
664
- - app/components/primer/clipboard_copy.rb
665
663
  - app/components/primer/component.rb
666
664
  - app/components/primer/conditional_wrapper.rb
667
665
  - app/components/primer/content.rb
668
666
  - app/components/primer/dropdown.rb
669
667
  - app/components/primer/dropdown/menu.rb
670
- - app/components/primer/dropdown_menu_component.html.erb
671
- - app/components/primer/dropdown_menu_component.rb
672
668
  - app/components/primer/hellip_button.rb
673
669
  - app/components/primer/icon_button.html.erb
674
670
  - app/components/primer/icon_button.rb
@@ -877,6 +873,13 @@ files:
877
873
  - lib/primer/view_components/linters/two_column_layout_migration_counter.rb
878
874
  - lib/primer/view_components/statuses.rb
879
875
  - lib/primer/view_components/version.rb
876
+ - lib/primer/yard/backend.rb
877
+ - lib/primer/yard/component_manifest.rb
878
+ - lib/primer/yard/docs_helper.rb
879
+ - lib/primer/yard/legacy_gatsby_backend.rb
880
+ - lib/primer/yard/registry.rb
881
+ - lib/primer/yard/renders_many_handler.rb
882
+ - lib/primer/yard/renders_one_handler.rb
880
883
  - lib/rubocop/config/default.yml
881
884
  - lib/rubocop/cop/primer.rb
882
885
  - lib/rubocop/cop/primer/base_cop.rb
@@ -890,6 +893,7 @@ files:
890
893
  - lib/rubocop/cop/primer/no_tag_memoize.rb
891
894
  - lib/rubocop/cop/primer/primer_octicon.rb
892
895
  - lib/rubocop/cop/primer/system_argument_instead_of_class.rb
896
+ - lib/rubocop/cop/primer/test_selector.rb
893
897
  - lib/tasks/custom_utilities.yml
894
898
  - lib/tasks/docs.rake
895
899
  - lib/tasks/helpers/ast_processor.rb
@@ -898,9 +902,6 @@ files:
898
902
  - lib/tasks/static.rake
899
903
  - lib/tasks/test.rake
900
904
  - lib/tasks/utilities.rake
901
- - lib/yard/docs_helper.rb
902
- - lib/yard/renders_many_handler.rb
903
- - lib/yard/renders_one_handler.rb
904
905
  - previews/primer/alpha/action_list_preview.rb
905
906
  - previews/primer/alpha/action_list_preview/heading.html.erb
906
907
  - previews/primer/alpha/auto_complete_preview.rb
@@ -909,6 +910,7 @@ files:
909
910
  - previews/primer/alpha/banner_preview/with_action_content.html.erb
910
911
  - previews/primer/alpha/button_marketing_preview.rb
911
912
  - previews/primer/alpha/dialog_preview.rb
913
+ - previews/primer/alpha/dialog_preview/body_has_scrollbar_overflow.html.erb
912
914
  - previews/primer/alpha/dialog_preview/custom_header.html.erb
913
915
  - previews/primer/alpha/dialog_preview/nested_dialog.html.erb
914
916
  - previews/primer/alpha/dialog_preview/test.html.erb
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- class BoxComponent < Primer::Box
5
- status :deprecated
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- class ClipboardCopy < Primer::Beta::ClipboardCopy
5
- status :deprecated
6
- end
7
- end
@@ -1,8 +0,0 @@
1
- <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
- <% if @header.present? %>
3
- <div class="dropdown-header">
4
- <%= @header %>
5
- </div>
6
- <% end %>
7
- <%= content %>
8
- <% end %>
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- # DropdownMenus are lightweight context menus for housing navigation and actions.
5
- # They're great for instances where you don't need the full power (and code)
6
- # of the select menu.
7
- class DropdownMenuComponent < Primer::Component
8
- status :deprecated
9
-
10
- SCHEME_DEFAULT = :default
11
- SCHEME_MAPPINGS = {
12
- SCHEME_DEFAULT => "",
13
- :dark => "dropdown-menu-dark"
14
- }.freeze
15
-
16
- DIRECTION_DEFAULT = :se
17
- DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
18
-
19
- # @example With a header
20
- # <div>
21
- # <%= render(Primer::Beta::Details.new(overlay: :default, reset: true, position: :relative)) do |component| %>
22
- # <% component.with_summary do %>
23
- # Dropdown
24
- # <% end %>
25
- #
26
- # <% component.with_body do %>
27
- # <%= render(Primer::DropdownMenuComponent.new(header: "Options")) do %>
28
- # <ul>
29
- # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
30
- # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
31
- # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
32
- # </ul>
33
- # <% end %>
34
- # <% end %>
35
- # <% end %>
36
- # </div>
37
- #
38
- # @param direction [Symbol] <%= one_of(Primer::DropdownMenuComponent::DIRECTION_OPTIONS) %>
39
- # @param scheme [Symbol] Pass `:dark` for dark mode theming
40
- # @param header [String] Optional string to display as the header
41
- # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
42
- def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments)
43
- @header = header
44
- @direction = direction
45
- @system_arguments = deny_tag_argument(**system_arguments)
46
-
47
- @system_arguments[:tag] = "details-menu"
48
- @system_arguments[:role] = "menu"
49
-
50
- @system_arguments[:classes] = class_names(
51
- @system_arguments[:classes],
52
- "dropdown-menu",
53
- "dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}",
54
- SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)]
55
- )
56
- end
57
- end
58
- end
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
-
5
- module YARD
6
- # Helper methods to use for yard documentation
7
- module DocsHelper
8
- def one_of(enumerable, lower: false, sort: true)
9
- # Sort the array if requested
10
- if sort
11
- enumerable = enumerable.sort do |a, b|
12
- a.instance_of?(b.class) ? a <=> b : a.class.to_s <=> b.class.to_s
13
- end
14
- end
15
-
16
- values =
17
- case enumerable
18
- when Hash
19
- enumerable.map do |key, value|
20
- "#{pretty_value(key)} (#{pretty_value(value)})"
21
- end
22
- else
23
- enumerable.map do |key|
24
- pretty_value(key)
25
- end
26
- end
27
-
28
- prefix = "One of"
29
- prefix = prefix.downcase if lower
30
-
31
- "#{prefix} #{values.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')}."
32
- end
33
-
34
- def link_to_accessibility
35
- "[Accessibility](#accessibility)"
36
- end
37
-
38
- def link_to_system_arguments_docs
39
- "[System arguments](/system-arguments)"
40
- end
41
-
42
- def link_to_typography_docs
43
- "[Typography](/system-arguments#typography)"
44
- end
45
-
46
- def link_to_component(component)
47
- status_module, short_name, class_name = status_module_and_short_name(component)
48
- status_path = status_module.nil? ? "" : "#{status_module}/"
49
-
50
- "[#{class_name}](/components/#{status_path}#{short_name.downcase})"
51
- end
52
-
53
- def link_to_octicons
54
- "[Octicon](https://primer.style/octicons/)"
55
- end
56
-
57
- def link_to_heading_practices
58
- "[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)"
59
- end
60
-
61
- def status_module_and_short_name(component)
62
- name_with_status = component.name.gsub(/Primer::|Component/, "")
63
-
64
- m = name_with_status.match(/(?<status>Beta|Alpha|Deprecated)?(?<_colons>::)?(?<name>.*)/)
65
- [m[:status]&.downcase, m[:name].gsub("::", ""), m[:name]]
66
- end
67
-
68
- def pretty_value(val)
69
- case val
70
- when nil
71
- "`nil`"
72
- when Symbol
73
- "`:#{val}`"
74
- else
75
- "`#{val}`"
76
- end
77
- end
78
- end
79
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module YARD
4
- # YARD Handler to parse `renders_many` calls.
5
- class RendersManyHandler < YARD::Handlers::Ruby::Base
6
- handles method_call(:renders_many)
7
- namespace_only
8
-
9
- process do
10
- name = statement.parameters.first.jump(:tstring_content, :ident).source
11
- object = YARD::CodeObjects::MethodObject.new(namespace, name)
12
- register(object)
13
- parse_block(statement.last, owner: object)
14
-
15
- object.dynamic = true
16
- object[:renders_many] = true
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module YARD
4
- # YARD Handler to parse `renders_one` calls.
5
- class RendersOneHandler < YARD::Handlers::Ruby::Base
6
- handles method_call(:renders_one)
7
- namespace_only
8
-
9
- process do
10
- name = statement.parameters.first.jump(:tstring_content, :ident).source
11
- object = YARD::CodeObjects::MethodObject.new(namespace, name)
12
- register(object)
13
- parse_block(statement.last, owner: object)
14
-
15
- object.dynamic = true
16
- object[:renders_one] = true
17
- end
18
- end
19
- end