primer_view_components 0.0.85 → 0.0.86

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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -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/auto_complete/item.rb +1 -1
  6. data/app/components/primer/alpha/auto_complete.rb +1 -1
  7. data/app/components/primer/alpha/button_marketing.rb +1 -1
  8. data/app/components/primer/alpha/text_field.rb +105 -0
  9. data/app/components/primer/alpha/tool-tip-element.d.ts +3 -1
  10. data/app/components/primer/alpha/tool-tip-element.js +20 -13
  11. data/app/components/primer/alpha/tool-tip-element.ts +23 -14
  12. data/app/components/primer/alpha/tooltip.rb +1 -1
  13. data/app/components/primer/beta/base_button.rb +47 -0
  14. data/app/components/primer/{alpha → beta}/border_box/header.html.erb +0 -0
  15. data/app/components/primer/{alpha → beta}/border_box/header.rb +6 -6
  16. data/app/components/primer/{border_box_component.html.erb → beta/border_box.html.erb} +0 -0
  17. data/app/components/primer/beta/border_box.rb +147 -0
  18. data/app/components/primer/blankslate_component.rb +2 -150
  19. data/app/components/primer/border_box_component.rb +2 -140
  20. data/app/components/primer/button_component.html.erb +12 -4
  21. data/app/components/primer/button_component.rb +2 -2
  22. data/app/components/primer/clipboard_copy.rb +6 -2
  23. data/app/components/primer/close_button.rb +1 -1
  24. data/app/components/primer/hellip_button.rb +1 -1
  25. data/app/components/primer/icon_button.html.erb +6 -0
  26. data/app/components/primer/icon_button.rb +46 -10
  27. data/app/components/primer/link_component.html.erb +12 -0
  28. data/app/components/primer/link_component.rb +2 -9
  29. data/app/lib/primer/join_style_arguments_helper.rb +1 -1
  30. data/lib/primer/classify/utilities.rb +3 -6
  31. data/lib/primer/form_components.rb +36 -0
  32. data/lib/primer/forms/acts_as_component.rb +118 -0
  33. data/lib/primer/forms/base.html.erb +8 -0
  34. data/lib/primer/forms/base.rb +137 -0
  35. data/lib/primer/forms/base_component.rb +58 -0
  36. data/lib/primer/forms/buffer_rewriter.rb +50 -0
  37. data/lib/primer/forms/caption.html.erb +10 -0
  38. data/lib/primer/forms/caption.rb +29 -0
  39. data/lib/primer/forms/check_box.html.erb +9 -0
  40. data/lib/primer/forms/check_box.rb +16 -0
  41. data/lib/primer/forms/check_box_group.html.erb +12 -0
  42. data/lib/primer/forms/check_box_group.rb +14 -0
  43. data/lib/primer/forms/dsl/check_box_group_input.rb +41 -0
  44. data/lib/primer/forms/dsl/check_box_input.rb +27 -0
  45. data/lib/primer/forms/dsl/form_object.rb +25 -0
  46. data/lib/primer/forms/dsl/form_reference_input.rb +36 -0
  47. data/lib/primer/forms/dsl/hidden_input.rb +29 -0
  48. data/lib/primer/forms/dsl/input.rb +259 -0
  49. data/lib/primer/forms/dsl/input_group.rb +41 -0
  50. data/lib/primer/forms/dsl/input_methods.rb +86 -0
  51. data/lib/primer/forms/dsl/multi_input.rb +58 -0
  52. data/lib/primer/forms/dsl/radio_button_group_input.rb +38 -0
  53. data/lib/primer/forms/dsl/radio_button_input.rb +37 -0
  54. data/lib/primer/forms/dsl/select_list_input.rb +53 -0
  55. data/lib/primer/forms/dsl/submit_button_input.rb +28 -0
  56. data/lib/primer/forms/dsl/text_area_input.rb +33 -0
  57. data/lib/primer/forms/dsl/text_field_input.rb +65 -0
  58. data/lib/primer/forms/form_control.html.erb +18 -0
  59. data/lib/primer/forms/form_control.rb +23 -0
  60. data/lib/primer/forms/form_list.html.erb +5 -0
  61. data/lib/primer/forms/form_list.rb +21 -0
  62. data/lib/primer/forms/form_reference.html.erb +3 -0
  63. data/lib/primer/forms/form_reference.rb +14 -0
  64. data/lib/primer/forms/group.html.erb +5 -0
  65. data/lib/primer/forms/group.rb +27 -0
  66. data/lib/primer/forms/hidden_field.html.erb +1 -0
  67. data/lib/primer/forms/hidden_field.rb +15 -0
  68. data/lib/primer/forms/multi.html.erb +3 -0
  69. data/lib/primer/forms/multi.rb +14 -0
  70. data/lib/primer/forms/radio_button.html.erb +14 -0
  71. data/lib/primer/forms/radio_button.rb +29 -0
  72. data/lib/primer/forms/radio_button_group.html.erb +12 -0
  73. data/lib/primer/forms/radio_button_group.rb +14 -0
  74. data/lib/primer/forms/select_list.html.erb +5 -0
  75. data/lib/primer/forms/select_list.rb +26 -0
  76. data/lib/primer/forms/separator.html.erb +1 -0
  77. data/lib/primer/forms/separator.rb +8 -0
  78. data/lib/primer/forms/spacing_wrapper.html.erb +3 -0
  79. data/lib/primer/forms/spacing_wrapper.rb +8 -0
  80. data/lib/primer/forms/submit_button.html.erb +4 -0
  81. data/lib/primer/forms/submit_button.rb +50 -0
  82. data/lib/primer/forms/text_area.html.erb +5 -0
  83. data/lib/primer/forms/text_area.rb +16 -0
  84. data/lib/primer/forms/text_field.html.erb +19 -0
  85. data/lib/primer/forms/text_field.rb +14 -0
  86. data/lib/primer/view_components/engine.rb +23 -0
  87. data/lib/primer/view_components/linters/argument_mappers/button.rb +2 -2
  88. data/lib/primer/view_components/linters/button_component_migration_counter.rb +1 -1
  89. data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +2 -8
  90. data/lib/primer/view_components/version.rb +1 -1
  91. data/lib/rubocop/cop/primer/component_name_migration.rb +3 -0
  92. data/lib/tasks/deprecated.rake +22 -0
  93. data/lib/tasks/docs.rake +5 -3
  94. data/static/arguments.yml +148 -39
  95. data/static/audited_at.json +4 -2
  96. data/static/classes.yml +2 -1
  97. data/static/constants.json +44 -39
  98. data/static/statuses.json +7 -5
  99. metadata +66 -7
  100. data/app/components/primer/base_button.rb +0 -43
  101. data/app/components/primer/blankslate_component.html.erb +0 -30
@@ -0,0 +1,18 @@
1
+ <%= content_tag(:div, style: "flex-grow: 1", **@form_group_arguments) do %>
2
+ <% if @input.label %>
3
+ <%= builder.label(@input.name, **@input.label_arguments) do %>
4
+ <%= @input.label %>
5
+ <% if @input.required? %>
6
+ <span aria-hidden="true">*</span>
7
+ <% end %>
8
+ <% end %>
9
+ <% end %>
10
+ <%= content %>
11
+ <% if @input.invalid? && @input.validation_messages.present? %>
12
+ <div class="FormControl-inlineValidation" id="<%= @input.validation_id %>">
13
+ <%= render(Primer::OcticonComponent.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %>
14
+ <span><%= @input.validation_messages.first %></span>
15
+ </div>
16
+ <% end %>
17
+ <%= render(Caption.new(input: @input)) %>
18
+ <% end %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class FormControl < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ @input.add_label_classes("FormControl-label")
12
+ @form_group_arguments = {
13
+ class: class_names(
14
+ "FormControl",
15
+ "FormControl--fullWidth" => @input.full_width?
16
+ )
17
+ }
18
+
19
+ @form_group_arguments[:hidden] = "hidden" if @input.hidden?
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ <%= render(SpacingWrapper.new) do %>
2
+ <% @forms.each do |form| %>
3
+ <%= render(form) %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class FormList
7
+ extend ActsAsComponent
8
+
9
+ renders_template File.join(__dir__, "form_list.html.erb")
10
+
11
+ def initialize(*forms)
12
+ @forms = forms
13
+ end
14
+
15
+ def perform_render(&_block)
16
+ self.class.compile!
17
+ render_form_list
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ <%= builder.fields_for(*@input.fields_for_args, **@input.fields_for_kwargs) do |fields| %>
2
+ <%= render(@input.ref_block.call(fields)) %>
3
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class FormReference < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ <%= content_tag_if(horizontal?, :div, class: "d-flex", style: "gap: 15px;") do %>
2
+ <% @inputs.each do |input| %>
3
+ <%= render(input) %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "primer/classify"
4
+
5
+ module Primer
6
+ module Forms
7
+ # :nodoc:
8
+ class Group < BaseComponent
9
+ VERTICAL = :vertical
10
+ HORIZONTAL = :horizontal
11
+ DEFAULT_LAYOUT = VERTICAL
12
+ LAYOUTS = [VERTICAL, HORIZONTAL].freeze
13
+
14
+ def initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments)
15
+ @inputs = inputs
16
+ @builder = builder
17
+ @form = form
18
+ @layout = layout
19
+ @system_arguments = system_arguments
20
+ end
21
+
22
+ def horizontal?
23
+ @layout == HORIZONTAL
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1 @@
1
+ <%= builder.hidden_field(@input.name, **@input.input_arguments) %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class HiddenField < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ @input.add_input_classes("FormField-input")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ <% @input.inputs.each do |child_input| %>
2
+ <%= render(child_input) %>
3
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class Multi < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ <div class="FormControl-radio-wrap">
2
+ <%= builder.radio_button(@input.name, @input.value, **@input.input_arguments) %>
3
+ <span class="FormControl-radio-labelWrap">
4
+ <%= builder.label(@input.name, value: @input.value, **@input.label_arguments) do %>
5
+ <%= @input.label %>
6
+ <% end %>
7
+ <%= render(Caption.new(input: @input)) %>
8
+ </span>
9
+ </div>
10
+ <% if @input.nested_form_block %>
11
+ <%= content_tag(:div, nested_form_arguments) do %>
12
+ <%= render(@input.nested_form_block.call(builder)) %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class RadioButton < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ @input.add_label_classes("FormControl-label")
12
+ @input.add_input_classes("FormControl-radio")
13
+ end
14
+
15
+ def nested_form_arguments
16
+ return @nested_form_arguments if defined?(@nested_form_arguments)
17
+
18
+ @nested_form_arguments = { **@input.nested_form_arguments }
19
+ @nested_form_arguments[:class] = class_names(
20
+ @nested_form_arguments[:class],
21
+ @nested_form_arguments.delete(:classes),
22
+ "ml-4"
23
+ )
24
+
25
+ @nested_form_arguments
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ <fieldset>
2
+ <% if @input.label %>
3
+ <%= content_tag(:legend, **@input.label_arguments) do %>
4
+ <%= @input.label %>
5
+ <% end %>
6
+ <% end %>
7
+ <%= render(SpacingWrapper.new) do %>
8
+ <% @input.radio_buttons.each do |radio_button| %>
9
+ <%= render(radio_button.to_component) %>
10
+ <% end %>
11
+ <% end %>
12
+ </fieldset>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class RadioButtonGroup < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ <%= render(FormControl.new(input: @input)) do %>
2
+ <%= content_tag(:div, class: @field_wrap_classes) do %>
3
+ <%= builder.select(@input.name, options, {}, **@input.input_arguments) %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class SelectList < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ @input.add_input_classes(
12
+ "FormControl-select",
13
+ "FormControl--medium"
14
+ )
15
+
16
+ @field_wrap_classes = class_names("FormControl-select-wrap")
17
+ end
18
+
19
+ def options
20
+ @options ||= @input.options.map do |option|
21
+ [option.label, option.value, option.system_arguments]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ <div class="border-top color-border-muted"></div>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ class Separator < BaseComponent
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ <div class="d-flex flex-column" style="row-gap: 15px">
2
+ <%= content %>
3
+ </div>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ class SpacingWrapper < BaseComponent
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ <%= render(Primer::ButtonComponent.new(**input_arguments)) do |c| %>
2
+ <% @input.block.call(c) if @input.block %>
3
+ <%= @input.label %>
4
+ <% end %>
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class SubmitButton < BaseComponent
7
+ # :nodoc:
8
+ module SubmitAttributeGenerator
9
+ extend ActionView::Helpers::FormTagHelper
10
+
11
+ class << self
12
+ alias submit_tag_attributes submit_tag
13
+
14
+ private
15
+
16
+ # FormTagHelper#submit_tag ultimately calls the #tag method. We return the options hash here instead
17
+ # of returning a string so it can be merged into the hash of options we pass to the Primer::ButtonComponent.
18
+ def tag(_name, options)
19
+ options
20
+ end
21
+ end
22
+ end
23
+
24
+ delegate :builder, :form, to: :@input
25
+
26
+ def initialize(input:)
27
+ @input = input
28
+ @input.add_input_classes("FormField-input flex-self-start")
29
+ @input.merge_input_arguments!(
30
+ SubmitAttributeGenerator.submit_tag_attributes(input.label, name: input.name).deep_symbolize_keys
31
+ )
32
+
33
+ # rails uses a string for this, but PVC wants a symbol
34
+ @input.merge_input_arguments!(type: :submit)
35
+
36
+ # Never disable submit buttons. This overrides the global
37
+ # ActionView::Base.automatically_disable_submit_tag setting.
38
+ # Disabling the submit button is not accessible.
39
+ @input.remove_input_data(:disable_with)
40
+ end
41
+
42
+ def input_arguments
43
+ @input_arguments ||= @input.input_arguments.deep_dup.tap do |args|
44
+ # rails uses :class but PVC wants :classes
45
+ args[:classes] = args.delete(:class)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ <%= render(FormControl.new(input: @input)) do %>
2
+ <%= content_tag(:div, class: @field_wrap_classes) do %>
3
+ <%= builder.text_area(@input.name, **@input.input_arguments) %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class TextArea < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ @input.add_input_classes("FormControl-input", "FormControl--medium")
12
+ @field_wrap_classes = class_names("FormControl-input-wrap")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ <%= render(FormControl.new(input: @input)) do %>
2
+ <% if @input.leading_visual || @input.show_clear_button? %>
3
+ <%= content_tag(:div, class: @input.field_wrap_classes) do %>
4
+ <% if @input.leading_visual %>
5
+ <span class="FormControl-input-leadingVisualWrap">
6
+ <%= render(Primer::OcticonComponent.new(**@input.leading_visual)) %>
7
+ </span>
8
+ <% end %>
9
+ <%= builder.text_field(@input.name, **@input.input_arguments) %>
10
+ <% if @input.show_clear_button? %>
11
+ <button id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear">
12
+ <%= render(Primer::OcticonComponent.new(icon: :"x-circle-fill")) %>
13
+ </button>
14
+ <% end %>
15
+ <% end %>
16
+ <% else %>
17
+ <%= builder.text_field(@input.name, **@input.input_arguments) %>
18
+ <% end %>
19
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Forms
5
+ # :nodoc:
6
+ class TextField < BaseComponent
7
+ delegate :builder, :form, to: :@input
8
+
9
+ def initialize(input:)
10
+ @input = input
11
+ end
12
+ end
13
+ end
14
+ end
@@ -8,6 +8,11 @@ module Primer
8
8
  # :nodoc:
9
9
  class Engine < ::Rails::Engine
10
10
  isolate_namespace Primer::ViewComponents
11
+
12
+ config.autoload_paths = %W[
13
+ #{root}/lib
14
+ ]
15
+
11
16
  config.eager_load_paths = %W[
12
17
  #{root}/app/components
13
18
  #{root}/app/lib
@@ -24,6 +29,24 @@ module Primer
24
29
  app.config.assets.precompile += %w[primer_view_components] if app.config.respond_to?(:assets)
25
30
  end
26
31
 
32
+ initializer "primer.forms.eager_load_actions" do
33
+ ActiveSupport.on_load(:after_initialize) do
34
+ if Rails.application.config.eager_load
35
+ Primer::Forms::Base.compile!
36
+ Primer::Forms::Base.descendants.each(&:compile!)
37
+ Primer::Forms::BaseComponent.descendants.each(&:compile!)
38
+ end
39
+ end
40
+ end
41
+
42
+ initializer "primer_view_components.zeitwerk_ignore" do
43
+ Rails.autoloaders.each do |autoloader|
44
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "linters.rb"))
45
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "linters", "**", "*.rb"))
46
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "statuses.rb"))
47
+ end
48
+ end
49
+
27
50
  config.after_initialize do |app|
28
51
  ::Primer::Classify::Utilities.validate_class_names = app.config.primer_view_components.delete(:validate_class_names)
29
52
  end
@@ -20,12 +20,12 @@ module ERBLint
20
20
  ).freeze
21
21
 
22
22
  TYPE_OPTIONS = Primer::ViewComponents::Constants.get(
23
- component: "Primer::BaseButton",
23
+ component: "Primer::Beta::BaseButton",
24
24
  constant: "TYPE_OPTIONS"
25
25
  ).freeze
26
26
 
27
27
  DEFAULT_TAG = Primer::ViewComponents::Constants.get(
28
- component: "Primer::BaseButton",
28
+ component: "Primer::Beta::BaseButton",
29
29
  constant: "DEFAULT_TAG"
30
30
  ).freeze
31
31
 
@@ -11,7 +11,7 @@ module ERBLint
11
11
  include Autocorrectable
12
12
 
13
13
  TAGS = Primer::ViewComponents::Constants.get(
14
- component: "Primer::BaseButton",
14
+ component: "Primer::Beta::BaseButton",
15
15
  constant: "TAG_OPTIONS"
16
16
  ).freeze
17
17
 
@@ -10,6 +10,7 @@ module ERBLint
10
10
  "Primer::Alpha::AutoComplete::Item" => "Primer::Beta::AutoComplete::Item",
11
11
  "Primer::Alpha::AutoComplete" => "Primer::Beta::AutoComplete",
12
12
  "Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
13
+ "Primer::BorderBoxComponent" => "Primer::Beta::BorderBox",
13
14
  "Primer::DropdownMenuComponent" => nil,
14
15
  "Primer::Tooltip" => "Primer::Alpha::Tooltip",
15
16
  "Primer::FlexComponent" => nil,
@@ -31,14 +32,7 @@ module ERBLint
31
32
  end
32
33
 
33
34
  def deprecated_components
34
- @deprecated_components ||= statuses_json.select { |_, value| value == "deprecated" }.keys.tap do |deprecated_components|
35
- deprecated_components.each do |deprecated|
36
- unless COMPONENT_TO_USE_INSTEAD.key?(deprecated)
37
- raise "Please provide a component that should be used in place of #{deprecated} in COMPONENT_TO_USE_INSTEAD. "\
38
- "If there is no alternative, set the value to nil."
39
- end
40
- end
41
- end
35
+ @deprecated_components ||= statuses_json.select { |_, value| value == "deprecated" }.keys
42
36
  end
43
37
  end
44
38
  end
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 85
8
+ PATCH = 86
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end
@@ -15,6 +15,9 @@ module RuboCop
15
15
  # Primer::Beta::ComponentName.new()
16
16
  class ComponentNameMigration < BaseCop
17
17
  DEPRECATIONS = {
18
+ "Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
19
+ "Primer::BorderBoxComponent" => "Primer::Beta::BorderBox",
20
+ "Primer::BaseButton" => "Primer::Beta::BaseButton",
18
21
  "Primer::TestComponent" => "Primer::Beta::Test"
19
22
  }.freeze
20
23
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :deprecated do
4
+ task :check do
5
+ require_relative "./../primer/view_components/linters/helpers/deprecated_components_helpers"
6
+ require_relative "../primer/view_components/statuses"
7
+
8
+ puts "Checking that officially deprecated components are linted by `DeprecatedComponents` linter...."
9
+
10
+ if Primer::ViewComponents::STATUSES.select { |_, value| value == "deprecated" }.keys.sort != ERBLint::Linters::Helpers::DeprecatedComponentsHelpers::COMPONENT_TO_USE_INSTEAD.keys.sort
11
+ puts "\n**************************************************************************************************************************"
12
+ raise "Please make sure that components are officially deprecated by setting the `status :deprecated` within the component file.\n"\
13
+ "Run `bundle exec rake static:dump` so the deprecated status is reflected in `statuses.json`.\n"\
14
+ "Make sure to provide an alternative component for each deprecated component in `ERBLint::Linters::Helpers::DeprecatedComponentsHelpers::COMPONENT_TO_USE_INSTEAD`.\n"\
15
+ "If there is no alternative to suggest, set the value to nil."
16
+ end
17
+
18
+ puts "\n============================================================================="
19
+ puts "All good!"
20
+ puts "============================================================================="
21
+ end
22
+ end
data/lib/tasks/docs.rake CHANGED
@@ -31,7 +31,6 @@ namespace :docs do
31
31
  components = [
32
32
  Primer::Alpha::Layout,
33
33
  Primer::HellipButton,
34
- Primer::Alpha::BorderBox::Header,
35
34
  Primer::Image,
36
35
  Primer::LocalTime,
37
36
  Primer::OcticonSymbolsComponent,
@@ -41,9 +40,10 @@ namespace :docs do
41
40
  Primer::Beta::AutoComplete::Item,
42
41
  Primer::Beta::Avatar,
43
42
  Primer::Beta::AvatarStack,
44
- Primer::BaseButton,
43
+ Primer::Beta::BaseButton,
45
44
  Primer::Beta::Blankslate,
46
- Primer::BorderBoxComponent,
45
+ Primer::Beta::BorderBox,
46
+ Primer::Beta::BorderBox::Header,
47
47
  Primer::BoxComponent,
48
48
  Primer::Beta::Breadcrumbs,
49
49
  Primer::ButtonComponent,
@@ -74,6 +74,7 @@ namespace :docs do
74
74
  Primer::SubheadComponent,
75
75
  Primer::TabContainerComponent,
76
76
  Primer::Beta::Text,
77
+ Primer::Alpha::TextField,
77
78
  Primer::TimeAgoComponent,
78
79
  Primer::TimelineItemComponent,
79
80
  Primer::Tooltip,
@@ -98,6 +99,7 @@ namespace :docs do
98
99
  Primer::Alpha::TabPanels,
99
100
  Primer::Alpha::Tooltip,
100
101
  Primer::ButtonComponent,
102
+ Primer::IconButton,
101
103
  Primer::LinkComponent
102
104
  ]
103
105