primer_view_components 0.0.84 → 0.0.87

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -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.html.erb +0 -5
  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.rb +12 -5
  28. data/app/helpers/primer/form_helper.rb +10 -0
  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 +142 -0
  35. data/lib/primer/forms/base_component.rb +62 -0
  36. data/lib/primer/forms/buffer_rewriter.rb +51 -0
  37. data/lib/primer/forms/builder.rb +48 -0
  38. data/lib/primer/forms/caption.html.erb +10 -0
  39. data/lib/primer/forms/caption.rb +29 -0
  40. data/lib/primer/forms/check_box.html.erb +9 -0
  41. data/lib/primer/forms/check_box.rb +16 -0
  42. data/lib/primer/forms/check_box_group.html.erb +12 -0
  43. data/lib/primer/forms/check_box_group.rb +14 -0
  44. data/lib/primer/forms/dsl/check_box_group_input.rb +41 -0
  45. data/lib/primer/forms/dsl/check_box_input.rb +27 -0
  46. data/lib/primer/forms/dsl/form_object.rb +25 -0
  47. data/lib/primer/forms/dsl/form_reference_input.rb +36 -0
  48. data/lib/primer/forms/dsl/hidden_input.rb +29 -0
  49. data/lib/primer/forms/dsl/input.rb +237 -0
  50. data/lib/primer/forms/dsl/input_group.rb +34 -0
  51. data/lib/primer/forms/dsl/input_methods.rb +86 -0
  52. data/lib/primer/forms/dsl/multi_input.rb +58 -0
  53. data/lib/primer/forms/dsl/radio_button_group_input.rb +38 -0
  54. data/lib/primer/forms/dsl/radio_button_input.rb +37 -0
  55. data/lib/primer/forms/dsl/select_list_input.rb +53 -0
  56. data/lib/primer/forms/dsl/submit_button_input.rb +28 -0
  57. data/lib/primer/forms/dsl/text_area_input.rb +33 -0
  58. data/lib/primer/forms/dsl/text_field_input.rb +65 -0
  59. data/lib/primer/forms/form_control.html.erb +18 -0
  60. data/lib/primer/forms/form_control.rb +23 -0
  61. data/lib/primer/forms/form_list.html.erb +5 -0
  62. data/lib/primer/forms/form_list.rb +21 -0
  63. data/lib/primer/forms/form_reference.html.erb +3 -0
  64. data/lib/primer/forms/form_reference.rb +14 -0
  65. data/lib/primer/forms/group.html.erb +5 -0
  66. data/lib/primer/forms/group.rb +27 -0
  67. data/lib/primer/forms/hidden_field.html.erb +1 -0
  68. data/lib/primer/forms/hidden_field.rb +15 -0
  69. data/lib/primer/forms/multi.html.erb +3 -0
  70. data/lib/primer/forms/multi.rb +14 -0
  71. data/lib/primer/forms/radio_button.html.erb +14 -0
  72. data/lib/primer/forms/radio_button.rb +29 -0
  73. data/lib/primer/forms/radio_button_group.html.erb +12 -0
  74. data/lib/primer/forms/radio_button_group.rb +14 -0
  75. data/lib/primer/forms/select_list.html.erb +5 -0
  76. data/lib/primer/forms/select_list.rb +26 -0
  77. data/lib/primer/forms/separator.html.erb +1 -0
  78. data/lib/primer/forms/separator.rb +8 -0
  79. data/lib/primer/forms/spacing_wrapper.html.erb +3 -0
  80. data/lib/primer/forms/spacing_wrapper.rb +8 -0
  81. data/lib/primer/forms/submit_button.html.erb +4 -0
  82. data/lib/primer/forms/submit_button.rb +50 -0
  83. data/lib/primer/forms/text_area.html.erb +5 -0
  84. data/lib/primer/forms/text_area.rb +16 -0
  85. data/lib/primer/forms/text_field.html.erb +19 -0
  86. data/lib/primer/forms/text_field.rb +14 -0
  87. data/lib/primer/view_components/engine.rb +34 -0
  88. data/lib/primer/view_components/linters/argument_mappers/button.rb +2 -2
  89. data/lib/primer/view_components/linters/button_component_migration_counter.rb +1 -1
  90. data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +2 -8
  91. data/lib/primer/view_components/version.rb +1 -1
  92. data/lib/rubocop/cop/primer/component_name_migration.rb +3 -0
  93. data/lib/rubocop/cop/primer/deprecated_arguments.rb +0 -10
  94. data/lib/tasks/deprecated.rake +22 -0
  95. data/lib/tasks/docs.rake +5 -3
  96. data/static/arguments.yml +148 -39
  97. data/static/audited_at.json +4 -2
  98. data/static/classes.yml +2 -1
  99. data/static/constants.json +44 -39
  100. data/static/statuses.json +7 -5
  101. metadata +69 -8
  102. data/app/components/primer/base_button.rb +0 -43
@@ -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.to_component) %>
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.to_component) %>
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,8 +8,14 @@ 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
18
+ #{root}/app/helpers
13
19
  #{root}/app/lib
14
20
  ]
15
21
 
@@ -24,6 +30,34 @@ module Primer
24
30
  app.config.assets.precompile += %w[primer_view_components] if app.config.respond_to?(:assets)
25
31
  end
26
32
 
33
+ initializer "primer.forms.eager_load_actions" do
34
+ ActiveSupport.on_load(:after_initialize) do
35
+ if Rails.application.config.eager_load
36
+ Primer::Forms::Base.compile!
37
+ Primer::Forms::Base.descendants.each(&:compile!)
38
+ Primer::Forms::BaseComponent.descendants.each(&:compile!)
39
+ end
40
+ end
41
+ end
42
+
43
+ initializer "primer.forms.helpers" do
44
+ ActiveSupport.on_load :action_controller do
45
+ require "primer/form_helper"
46
+ helper Primer::FormHelper
47
+
48
+ # make primer_form_with available to view components also
49
+ ViewComponent::Base.prepend(Primer::FormHelper)
50
+ end
51
+ end
52
+
53
+ initializer "primer_view_components.zeitwerk_ignore" do
54
+ Rails.autoloaders.each do |autoloader|
55
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "linters.rb"))
56
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "linters", "**", "*.rb"))
57
+ autoloader.ignore(Engine.root.join("lib", "primer", "view_components", "statuses.rb"))
58
+ end
59
+ end
60
+
27
61
  config.after_initialize do |app|
28
62
  ::Primer::Classify::Utilities.validate_class_names = app.config.primer_view_components.delete(:validate_class_names)
29
63
  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 = 84
8
+ PATCH = 87
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
 
@@ -33,16 +33,6 @@ module RuboCop
33
33
  # }
34
34
  #
35
35
  DEPRECATED = {
36
- is_label_inline: nil,
37
- with_icon: nil,
38
- is_label_visible: {
39
- false => "visually_hide_label: true",
40
- true => "visually_hide_label: false"
41
- },
42
- is_clearable: {
43
- false => "show_clear_button: false",
44
- true => "show_clear_button: true"
45
- },
46
36
  bg: {
47
37
  white: "bg: :primary",
48
38
  gray_light: "bg: :secondary",
@@ -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