primer_view_components 0.0.63 → 0.0.67

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +718 -641
  3. data/app/components/primer/auto_complete/auto_complete.d.ts +1 -0
  4. data/app/components/primer/auto_complete/auto_complete.js +1 -0
  5. data/app/components/primer/beta/blankslate.rb +5 -3
  6. data/app/components/primer/button_component.html.erb +1 -1
  7. data/app/components/primer/button_component.rb +12 -10
  8. data/app/components/primer/button_group.rb +8 -7
  9. data/app/components/primer/component.rb +9 -4
  10. data/app/components/primer/content.rb +12 -0
  11. data/app/components/primer/dropdown.rb +3 -3
  12. data/app/components/primer/flash_component.rb +1 -1
  13. data/app/components/primer/image.rb +2 -2
  14. data/app/components/primer/label_component.rb +23 -13
  15. data/app/components/primer/octicon_component.rb +4 -2
  16. data/app/components/primer/popover_component.rb +10 -11
  17. data/app/components/primer/spinner_component.html.erb +2 -13
  18. data/app/components/primer/spinner_component.rb +6 -5
  19. data/app/lib/primer/octicon/cache.rb +4 -10
  20. data/lib/primer/classify/utilities.rb +0 -1
  21. data/lib/primer/classify/utilities.yml +98 -0
  22. data/lib/primer/classify.rb +1 -1
  23. data/lib/primer/view_components/engine.rb +1 -0
  24. data/lib/primer/view_components/linters/argument_mappers/button.rb +4 -4
  25. data/lib/primer/view_components/version.rb +1 -1
  26. data/lib/rubocop/cop/primer/deprecated_arguments.rb +1 -1
  27. data/lib/rubocop/cop/primer/deprecated_button_arguments.rb +51 -0
  28. data/lib/rubocop/cop/primer/deprecated_label_schemes.rb +68 -0
  29. data/lib/tasks/custom_utilities.yml +98 -0
  30. data/lib/tasks/docs.rake +9 -4
  31. data/static/arguments.yml +12 -3
  32. data/static/audited_at.json +1 -0
  33. data/static/classes.yml +5 -4
  34. data/static/constants.json +22 -8
  35. data/static/statuses.json +1 -0
  36. metadata +10 -5
@@ -0,0 +1 @@
1
+ import '@github/auto-complete-element';
@@ -0,0 +1 @@
1
+ import '@github/auto-complete-element';
@@ -5,9 +5,11 @@ module Primer
5
5
  # Use `Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
6
6
  #
7
7
  # @accessibility
8
- # - Set the `heading` level based on what is appropriate for your page hierarchy. <%= link_to_heading_practices %>
9
- # - `secondary_action` can be set to provide more information that is relevant in the context of the `Blankslate`.
8
+ # - The blankslate uses a semantic heading that must be set at the appropriate level based on the hierarchy of the page.
9
+ # - All blankslate visuals have been programmed as decorative images, using `aria-hidden=”true”` and `img alt=””`, which will hide the visual from screen reader users.
10
+ # - The blankslate supports a primary and secondary action. Both actions have been built as semantic links with primary and secondary styling.
10
11
  # - `secondary_action` text should be meaningful out of context and clearly describe the destination. Avoid using vague text like, "Learn more" or "Click here".
12
+ # - The blankslate can leverage the spinner component, which will communicate to screen reader users that the content is still loading.
11
13
  class Blankslate < Primer::Component
12
14
  status :beta
13
15
 
@@ -81,7 +83,7 @@ module Primer
81
83
  system_arguments[:tag] = :a
82
84
  system_arguments[:href] = href
83
85
  system_arguments[:mt] = 5
84
- system_arguments[:variant] = :medium
86
+ system_arguments[:size] = :medium
85
87
  system_arguments[:scheme] ||= :primary
86
88
 
87
89
  Primer::ButtonComponent.new(**system_arguments)
@@ -1,3 +1,3 @@
1
1
  <%= render Primer::BaseButton.new(**@system_arguments) do -%>
2
- <%= leading_visual %><%= trimmed_content %><%= trailing_visual %><%= primer_octicon("triangle-down", mr: -1) if @dropdown %>
2
+ <%= leading_visual %><%= trimmed_content %><%= trailing_visual %><%= primer_octicon("triangle-down", ml: 2, mr: -1) if @dropdown %>
3
3
  <% end -%>
@@ -17,12 +17,12 @@ module Primer
17
17
  }.freeze
18
18
  SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
19
19
 
20
- DEFAULT_VARIANT = :medium
21
- VARIANT_MAPPINGS = {
20
+ DEFAULT_SIZE = :medium
21
+ SIZE_MAPPINGS = {
22
22
  :small => "btn-sm",
23
- DEFAULT_VARIANT => ""
23
+ DEFAULT_SIZE => ""
24
24
  }.freeze
25
- VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
25
+ SIZE_OPTIONS = SIZE_MAPPINGS.keys
26
26
 
27
27
  # Leading visuals appear to the left of the button text.
28
28
  #
@@ -64,9 +64,9 @@ module Primer
64
64
  # <%= render(Primer::ButtonComponent.new(scheme: :invisible)) { "Invisible" } %>
65
65
  # <%= render(Primer::ButtonComponent.new(scheme: :link)) { "Link" } %>
66
66
  #
67
- # @example Variants
68
- # <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
69
- # <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
67
+ # @example Sizes
68
+ # <%= render(Primer::ButtonComponent.new(size: :small)) { "Small" } %>
69
+ # <%= render(Primer::ButtonComponent.new(size: :medium)) { "Medium" } %>
70
70
  #
71
71
  # @example Block
72
72
  # <%= render(Primer::ButtonComponent.new(block: :true)) { "Block" } %>
@@ -97,7 +97,8 @@ module Primer
97
97
  # <% end %>
98
98
  #
99
99
  # @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
100
- # @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
100
+ # @param variant [Symbol] DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
101
+ # @param size [Symbol] <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
101
102
  # @param tag [Symbol] (Primer::BaseButton::DEFAULT_TAG) <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
102
103
  # @param type [Symbol] (Primer::BaseButton::DEFAULT_TYPE) <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
103
104
  # @param group_item [Boolean] Whether button is part of a ButtonGroup.
@@ -106,7 +107,8 @@ module Primer
106
107
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
107
108
  def initialize(
108
109
  scheme: DEFAULT_SCHEME,
109
- variant: DEFAULT_VARIANT,
110
+ variant: nil,
111
+ size: DEFAULT_SIZE,
110
112
  group_item: false,
111
113
  block: false,
112
114
  dropdown: false,
@@ -119,7 +121,7 @@ module Primer
119
121
  @system_arguments[:classes] = class_names(
120
122
  system_arguments[:classes],
121
123
  SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
122
- VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
124
+ SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, variant || size, DEFAULT_SIZE)],
123
125
  "btn" => !link?,
124
126
  "btn-block" => block,
125
127
  "BtnGroup-item" => group_item
@@ -7,10 +7,10 @@ module Primer
7
7
 
8
8
  # Required list of buttons to be rendered.
9
9
  #
10
- # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %> except for `variant` and `group_item`.
10
+ # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %> except for `size` and `group_item`.
11
11
  renders_many :buttons, lambda { |**kwargs|
12
12
  kwargs[:group_item] = true
13
- kwargs[:variant] = @variant
13
+ kwargs[:size] = @size
14
14
 
15
15
  Primer::ButtonComponent.new(**kwargs)
16
16
  }
@@ -25,19 +25,20 @@ module Primer
25
25
  # <% component.button(classes: "custom-class") { "Custom class" } %>
26
26
  # <% end %>
27
27
  #
28
- # @example Variants
28
+ # @example Sizes
29
29
  #
30
- # <%= render(Primer::ButtonGroup.new(variant: :small)) do |component| %>
30
+ # <%= render(Primer::ButtonGroup.new(size: :small)) do |component| %>
31
31
  # <% component.button { "Default" } %>
32
32
  # <% component.button(scheme: :primary) { "Primary" } %>
33
33
  # <% component.button(scheme: :danger) { "Danger" } %>
34
34
  # <% component.button(scheme: :outline) { "Outline" } %>
35
35
  # <% end %>
36
36
  #
37
- # @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
37
+ # @param variant [Symbol] DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
38
+ # @param size [Symbol] <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
38
39
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
39
- def initialize(variant: Primer::ButtonComponent::DEFAULT_VARIANT, **system_arguments)
40
- @variant = variant
40
+ def initialize(variant: nil, size: Primer::ButtonComponent::DEFAULT_SIZE, **system_arguments)
41
+ @size = variant || size
41
42
  @system_arguments = deny_tag_argument(**system_arguments)
42
43
  @system_arguments[:tag] = :div
43
44
 
@@ -23,6 +23,10 @@ module Primer
23
23
  Rails.application.config.primer_view_components.raise_on_invalid_options
24
24
  end
25
25
 
26
+ def raise_on_invalid_aria?
27
+ Rails.application.config.primer_view_components.raise_on_invalid_aria
28
+ end
29
+
26
30
  def deprecated_component_warning(new_class: nil, version: nil)
27
31
  return if Rails.env.production? || silence_deprecations?
28
32
 
@@ -101,10 +105,7 @@ module Primer
101
105
  return unless aria(:label, arguments)
102
106
  return unless INVALID_ARIA_LABEL_TAGS.include?(tag)
103
107
 
104
- raise ArgumentError, "Don't use `aria-label` on `#{tag}` elements. See https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/" if should_raise_error?
105
-
106
- arguments.except!(:"aria-label")
107
- arguments[:aria] = arguments[:aria].except!(:label) if arguments[:aria]
108
+ raise ArgumentError, "Don't use `aria-label` on `#{tag}` elements. See https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/" if should_raise_aria_error?
108
109
  end
109
110
 
110
111
  def deny_tag_argument(**arguments)
@@ -114,5 +115,9 @@ module Primer
114
115
  def should_raise_error?
115
116
  raise_on_invalid_options? && !ENV["PRIMER_WARNINGS_DISABLED"]
116
117
  end
118
+
119
+ def should_raise_aria_error?
120
+ raise_on_invalid_aria? && !ENV["PRIMER_WARNINGS_DISABLED"]
121
+ end
117
122
  end
118
123
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # Use `Content` as a helper to render content passed to a slot without adding any tags.
5
+ class Content < Primer::Component
6
+ status :stable
7
+
8
+ def call
9
+ content
10
+ end
11
+ end
12
+ end
@@ -6,12 +6,12 @@ module Primer
6
6
  class Dropdown < Primer::Component
7
7
  # Required trigger for the dropdown. Has the same arguments as <%= link_to_component(Primer::ButtonComponent) %>,
8
8
  # but it is locked as a `summary` tag.
9
- renders_one :button, lambda { |**system_arguments, &block|
9
+ renders_one :button, lambda { |**system_arguments|
10
10
  @button_arguments = system_arguments
11
11
  @button_arguments[:button] = true
12
12
  @button_arguments[:dropdown] = @with_caret
13
13
 
14
- view_context.capture { block&.call }
14
+ Primer::Content.new
15
15
  }
16
16
 
17
17
  # Required context menu for the dropdown.
@@ -88,7 +88,7 @@ module Primer
88
88
  #
89
89
  # @example Customizing the button
90
90
  # <%= render(Primer::Dropdown.new) do |c| %>
91
- # <% c.button(scheme: :primary, variant: :small) do %>
91
+ # <% c.button(scheme: :primary, size: :small) do %>
92
92
  # Dropdown
93
93
  # <% end %>
94
94
  #
@@ -42,7 +42,7 @@ module Primer
42
42
  # <%= render(Primer::FlashComponent.new) do |component| %>
43
43
  # This is a flash message with actions!
44
44
  # <% component.action do %>
45
- # <%= render(Primer::ButtonComponent.new(variant: :small)) { "Take action" } %>
45
+ # <%= render(Primer::ButtonComponent.new(size: :small)) { "Take action" } %>
46
46
  # <% end %>
47
47
  # <% end %>
48
48
  #
@@ -29,8 +29,8 @@ module Primer
29
29
  def initialize(src:, alt:, lazy: false, **system_arguments)
30
30
  @system_arguments = deny_tag_argument(**system_arguments)
31
31
 
32
+ @src = src
32
33
  @system_arguments[:tag] = :img
33
- @system_arguments[:src] = src
34
34
  @system_arguments[:alt] = alt
35
35
 
36
36
  return unless lazy
@@ -40,7 +40,7 @@ module Primer
40
40
  end
41
41
 
42
42
  def call
43
- render(Primer::BaseComponent.new(**@system_arguments))
43
+ render(Primer::BaseComponent.new(src: image_path(@src), **@system_arguments))
44
44
  end
45
45
  end
46
46
  end
@@ -11,19 +11,26 @@ module Primer
11
11
  DEFAULT_TAG = :span
12
12
  TAG_OPTIONS = [DEFAULT_TAG, :summary, :a, :div].freeze
13
13
 
14
+ DEFAULT_SCHEME = :default
14
15
  SCHEME_MAPPINGS = {
15
- primary: "Label--primary",
16
- secondary: "Label--secondary",
17
- info: "Label--info",
18
- success: "Label--success",
19
- warning: "Label--warning",
20
- danger: "Label--danger",
16
+ DEFAULT_SCHEME => "",
17
+ :primary => "Label--primary",
18
+ :secondary => "Label--secondary",
19
+ :accent => "Label--accent",
20
+ :success => "Label--success",
21
+ :attention => "Label--attention",
22
+ :danger => "Label--danger",
23
+ :severe => "Label--severe",
24
+ :done => "Label--done",
25
+ :sponsors => "Label--sponsors",
21
26
  # deprecated
22
- orange: "Label--orange",
23
- purple: "Label--purple"
27
+ :info => "Label--info",
28
+ :warning => "Label--warning",
29
+ :orange => "Label--orange",
30
+ :purple => "Label--purple"
24
31
  }.freeze
25
- DEPRECATED_SCHEME_OPTIONS = [:orange, :purple].freeze
26
- SCHEME_OPTIONS = ([*SCHEME_MAPPINGS.keys, nil] - DEPRECATED_SCHEME_OPTIONS).freeze
32
+ DEPRECATED_SCHEME_OPTIONS = [:info, :warning, :orange, :purple].freeze
33
+ SCHEME_OPTIONS = (SCHEME_MAPPINGS.keys - DEPRECATED_SCHEME_OPTIONS).freeze
27
34
 
28
35
  VARIANT_MAPPINGS = {
29
36
  large: "Label--large",
@@ -35,10 +42,13 @@ module Primer
35
42
  # <%= render(Primer::LabelComponent.new) { "Default" } %>
36
43
  # <%= render(Primer::LabelComponent.new(scheme: :primary)) { "Primary" } %>
37
44
  # <%= render(Primer::LabelComponent.new(scheme: :secondary)) { "Secondary" } %>
38
- # <%= render(Primer::LabelComponent.new(scheme: :info)) { "Info" } %>
45
+ # <%= render(Primer::LabelComponent.new(scheme: :accent)) { "Accent" } %>
39
46
  # <%= render(Primer::LabelComponent.new(scheme: :success)) { "Success" } %>
40
- # <%= render(Primer::LabelComponent.new(scheme: :warning)) { "Warning" } %>
47
+ # <%= render(Primer::LabelComponent.new(scheme: :attention)) { "Attention" } %>
41
48
  # <%= render(Primer::LabelComponent.new(scheme: :danger)) { "Danger" } %>
49
+ # <%= render(Primer::LabelComponent.new(scheme: :severe)) { "Severe" } %>
50
+ # <%= render(Primer::LabelComponent.new(scheme: :done)) { "Done" } %>
51
+ # <%= render(Primer::LabelComponent.new(scheme: :sponsors)) { "Sponsors" } %>
42
52
  #
43
53
  # @example Variants
44
54
  # <%= render(Primer::LabelComponent.new) { "Default" } %>
@@ -48,7 +58,7 @@ module Primer
48
58
  # @param scheme [Symbol] <%= one_of(Primer::LabelComponent::SCHEME_MAPPINGS.keys) %>
49
59
  # @param variant [Symbol] <%= one_of(Primer::LabelComponent::VARIANT_OPTIONS) %>
50
60
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
51
- def initialize(tag: DEFAULT_TAG, scheme: nil, variant: nil, **system_arguments)
61
+ def initialize(tag: DEFAULT_TAG, scheme: DEFAULT_SCHEME, variant: nil, **system_arguments)
52
62
  @system_arguments = system_arguments
53
63
  @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
54
64
  @system_arguments[:classes] = class_names(
@@ -65,8 +65,10 @@ module Primer
65
65
  # Filter out classify options to prevent them from becoming invalid html attributes.
66
66
  # Note height and width are both classify options and valid html attributes.
67
67
  octicon_options = {
68
- height: SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
69
- }.merge(@system_arguments.slice(:height, :width))
68
+ height: @system_arguments[:height] || SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)],
69
+ width: @system_arguments[:width]
70
+ }
71
+ octicon_options.compact!
70
72
 
71
73
  @icon = Octicons::Octicon.new(icon_key, octicon_options)
72
74
  Primer::Octicon::Cache.set(cache_key, @icon)
@@ -41,22 +41,21 @@ module Primer
41
41
  # @param caret [Symbol] <%= one_of(Primer::PopoverComponent::CARET_MAPPINGS.keys) %>
42
42
  # @param large [Boolean] Whether to use the large version of the component.
43
43
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
44
- renders_one :body, lambda { |caret: CARET_DEFAULT, large: false, **system_arguments, &block|
45
- system_arguments[:classes] = class_names(
46
- system_arguments[:classes],
44
+ renders_one :body, lambda { |caret: CARET_DEFAULT, large: false, **system_arguments|
45
+ @body_arguments = system_arguments
46
+ @body_arguments[:classes] = class_names(
47
+ @body_arguments[:classes],
47
48
  "Popover-message Box",
48
49
  CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)],
49
50
  "Popover-message--large" => large
50
51
  )
51
- system_arguments[:p] ||= 4
52
- system_arguments[:mt] ||= 2
53
- system_arguments[:mx] ||= :auto
54
- system_arguments[:text_align] ||= :left
55
- system_arguments[:box_shadow] ||= :large
52
+ @body_arguments[:p] ||= 4
53
+ @body_arguments[:mt] ||= 2
54
+ @body_arguments[:mx] ||= :auto
55
+ @body_arguments[:text_align] ||= :left
56
+ @body_arguments[:box_shadow] ||= :large
56
57
 
57
- # This is a hack to allow the parent to set the slot's content
58
- @body_arguments = system_arguments
59
- view_context.capture { block&.call }
58
+ Primer::Content.new
60
59
  }
61
60
 
62
61
  # @example Default
@@ -1,15 +1,4 @@
1
1
  <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
- <span class="sr-only">Loading</span>
3
- <%= render Primer::BaseComponent.new(
4
- tag: :svg,
5
- viewBox: '0 0 16 16',
6
- fill: :none,
7
- animation: :rotate,
8
- width: @size,
9
- height: @size,
10
- vertical_align: :bottom
11
- ) do %>
12
- <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" />
13
- <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" />
14
- <% end %>
2
+ <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" />
3
+ <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" />
15
4
  <% end %>
@@ -31,12 +31,13 @@ module Primer
31
31
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
32
32
  def initialize(size: DEFAULT_SIZE, style: DEFAULT_STYLE, **system_arguments)
33
33
  @system_arguments = deny_tag_argument(**system_arguments)
34
- @system_arguments[:tag] = :span
35
- @system_arguments[:role] = :status
36
- @system_arguments[:display] = :inline_block
34
+ @system_arguments[:tag] = :svg
37
35
  @system_arguments[:style] ||= style
38
-
39
- @size = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
36
+ @system_arguments[:animation] = :rotate
37
+ @system_arguments[:width] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
38
+ @system_arguments[:height] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
39
+ @system_arguments[:viewBox] = "0 0 16 16"
40
+ @system_arguments[:fill] = :none
40
41
  end
41
42
  end
42
43
  end
@@ -9,9 +9,10 @@ module Primer
9
9
  PRELOADED_ICONS = [:alert, :check, :"chevron-down", :paste, :clock, :"dot-fill", :info, :"kebab-horizontal", :link, :lock, :mail, :pencil, :plus, :question, :repo, :search, :"shield-lock", :star, :trash, :x].freeze
10
10
 
11
11
  class << self
12
- def get_key(**kwargs)
13
- correct_key_args?(**kwargs)
14
- kwargs.hash
12
+ def get_key(symbol:, size:, width: nil, height: nil)
13
+ attrs = { symbol: symbol, size: size, width: width, height: height }
14
+ attrs.compact!
15
+ attrs.hash
15
16
  end
16
17
 
17
18
  def read(key)
@@ -37,13 +38,6 @@ module Primer
37
38
  def preload!
38
39
  PRELOADED_ICONS.each { |icon| Primer::OcticonComponent.new(icon: icon) }
39
40
  end
40
-
41
- private
42
-
43
- def correct_key_args?(symbol:, size:, width: nil, height: nil)
44
- # This method does nothing but will raise an ArgumentError if the
45
- # wrong args are passed.
46
- end
47
41
  end
48
42
  end
49
43
  end
@@ -196,7 +196,6 @@ module Primer
196
196
  REPLACEMENT_KEYS.each do |k, v|
197
197
  return v.to_sym if selector.match?(Regexp.new(k))
198
198
  end
199
-
200
199
  selector.split("-").first.to_sym
201
200
  end
202
201
  end
@@ -1578,6 +1578,12 @@
1578
1578
  - border-x
1579
1579
  true:
1580
1580
  - border
1581
+ 0:
1582
+ - border-0
1583
+ false:
1584
+ - border-0
1585
+ :dashed:
1586
+ - border-dashed
1581
1587
  :border_top:
1582
1588
  0:
1583
1589
  - border-top-0
@@ -1602,32 +1608,84 @@
1602
1608
  :justify_content:
1603
1609
  :flex_start:
1604
1610
  - flex-justify-start
1611
+ - flex-sm-justify-start
1612
+ - flex-md-justify-start
1613
+ - flex-lg-justify-start
1614
+ - flex-xl-justify-start
1605
1615
  :flex_end:
1606
1616
  - flex-justify-end
1617
+ - flex-sm-justify-end
1618
+ - flex-md-justify-end
1619
+ - flex-lg-justify-end
1620
+ - flex-xl-justify-end
1607
1621
  :center:
1608
1622
  - flex-justify-center
1623
+ - flex-sm-justify-center
1624
+ - flex-md-justify-center
1625
+ - flex-lg-justify-center
1626
+ - flex-xl-justify-center
1609
1627
  :space_between:
1610
1628
  - flex-justify-between
1629
+ - flex-sm-justify-between
1630
+ - flex-md-justify-between
1631
+ - flex-lg-justify-between
1632
+ - flex-xl-justify-between
1611
1633
  :space_around:
1612
1634
  - flex-justify-around
1635
+ - flex-sm-justify-around
1636
+ - flex-md-justify-around
1637
+ - flex-lg-justify-around
1638
+ - flex-xl-justify-around
1613
1639
  :align_items:
1614
1640
  :flex_start:
1615
1641
  - flex-items-start
1642
+ - flex-sm-items-start
1643
+ - flex-md-items-start
1644
+ - flex-lg-items-start
1645
+ - flex-xl-items-start
1616
1646
  :flex_end:
1617
1647
  - flex-items-end
1648
+ - flex-sm-items-end
1649
+ - flex-md-items-end
1650
+ - flex-lg-items-end
1651
+ - flex-xl-items-end
1618
1652
  :center:
1619
1653
  - flex-items-center
1654
+ - flex-sm-items-center
1655
+ - flex-md-items-center
1656
+ - flex-lg-items-center
1657
+ - flex-xl-items-center
1620
1658
  :baseline:
1621
1659
  - flex-items-baseline
1660
+ - flex-sm-items-baseline
1661
+ - flex-md-items-baseline
1662
+ - flex-lg-items-baseline
1663
+ - flex-xl-items-baseline
1622
1664
  :stretch:
1623
1665
  - flex-items-stretch
1666
+ - flex-sm-items-stretch
1667
+ - flex-md-items-stretch
1668
+ - flex-lg-items-stretch
1669
+ - flex-xl-items-stretch
1624
1670
  :flex_wrap:
1625
1671
  :wrap:
1626
1672
  - flex-wrap
1673
+ - flex-sm-wrap
1674
+ - flex-md-wrap
1675
+ - flex-lg-wrap
1676
+ - flex-xl-wrap
1627
1677
  :nowrap:
1628
1678
  - flex-nowrap
1679
+ - flex-sm-nowrap
1680
+ - flex-md-nowrap
1681
+ - flex-lg-nowrap
1682
+ - flex-xl-nowrap
1629
1683
  :reverse:
1630
1684
  - flex-wrap-reverse
1685
+ - flex-sm-wrap-reverse
1686
+ - flex-md-wrap-reverse
1687
+ - flex-lg-wrap-reverse
1688
+ - flex-xl-wrap-reverse
1631
1689
  :direction:
1632
1690
  :column:
1633
1691
  - flex-column
@@ -1656,24 +1714,64 @@
1656
1714
  :flex:
1657
1715
  1:
1658
1716
  - flex-1
1717
+ - flex-sm-1
1718
+ - flex-md-1
1719
+ - flex-lg-1
1720
+ - flex-xl-1
1659
1721
  :auto:
1660
1722
  - flex-auto
1723
+ - flex-sm-auto
1724
+ - flex-md-auto
1725
+ - flex-lg-auto
1726
+ - flex-xl-auto
1661
1727
  :align_self:
1662
1728
  :auto:
1663
1729
  - flex-self-auto
1730
+ - flex-sm-self-auto
1731
+ - flex-md-self-auto
1732
+ - flex-lg-self-auto
1733
+ - flex-xl-self-auto
1664
1734
  :start:
1665
1735
  - flex-self-start
1736
+ - flex-sm-self-start
1737
+ - flex-md-self-start
1738
+ - flex-lg-self-start
1739
+ - flex-xl-self-start
1666
1740
  :end:
1667
1741
  - flex-self-end
1742
+ - flex-sm-self-end
1743
+ - flex-md-self-end
1744
+ - flex-lg-self-end
1745
+ - flex-xl-self-end
1668
1746
  :center:
1669
1747
  - flex-self-center
1748
+ - flex-sm-self-center
1749
+ - flex-md-self-center
1750
+ - flex-lg-self-center
1751
+ - flex-xl-self-center
1670
1752
  :baseline:
1671
1753
  - flex-self-baseline
1754
+ - flex-sm-self-baseline
1755
+ - flex-md-self-baseline
1756
+ - flex-lg-self-baseline
1757
+ - flex-xl-self-baseline
1672
1758
  :stretch:
1673
1759
  - flex-self-stretch
1760
+ - flex-sm-self-stretch
1761
+ - flex-md-self-stretch
1762
+ - flex-lg-self-stretch
1763
+ - flex-xl-self-stretch
1674
1764
  :flex_grow:
1675
1765
  0:
1676
1766
  - flex-grow-0
1767
+ - flex-sm-grow-0
1768
+ - flex-md-grow-0
1769
+ - flex-lg-grow-0
1770
+ - flex-xl-grow-0
1677
1771
  :flex_shrink:
1678
1772
  0:
1679
1773
  - flex-shrink-0
1774
+ - flex-sm-shrink-0
1775
+ - flex-md-shrink-0
1776
+ - flex-lg-shrink-0
1777
+ - flex-xl-shrink-0
@@ -42,7 +42,7 @@ module Primer
42
42
  # extract_css_attrs(classes: "d-flex", mt: 4, py: 2) => { classes: "d-flex mt-4 py-2", style: nil }
43
43
  # extract_css_attrs(classes: "d-flex", style: "float: left", mt: 4, py: 2) => { classes: "d-flex mt-4 py-2", style: "float: left" }
44
44
  #
45
- def call(**args)
45
+ def call(args = {})
46
46
  style = nil
47
47
  classes = [].tap do |result|
48
48
  args.each do |key, val|
@@ -18,6 +18,7 @@ module Primer
18
18
  config.primer_view_components.raise_on_invalid_options = false
19
19
  config.primer_view_components.silence_deprecations = false
20
20
  config.primer_view_components.validate_class_names = !Rails.env.production?
21
+ config.primer_view_components.raise_on_invalid_aria = false
21
22
 
22
23
  initializer "primer_view_components.assets" do |app|
23
24
  app.config.assets.precompile += %w[primer_view_components] if app.config.respond_to?(:assets)
@@ -13,9 +13,9 @@ module ERBLint
13
13
  symbolize: true
14
14
  ).freeze
15
15
 
16
- VARIANT_MAPPINGS = Primer::ViewComponents::Constants.get(
16
+ SIZE_MAPPINGS = Primer::ViewComponents::Constants.get(
17
17
  component: "Primer::ButtonComponent",
18
- constant: "VARIANT_MAPPINGS",
18
+ constant: "SIZE_MAPPINGS",
19
19
  symbolize: true
20
20
  ).freeze
21
21
 
@@ -55,8 +55,8 @@ module ERBLint
55
55
 
56
56
  if SCHEME_MAPPINGS[class_name] && acc[:scheme].nil?
57
57
  acc[:scheme] = SCHEME_MAPPINGS[class_name]
58
- elsif VARIANT_MAPPINGS[class_name] && acc[:variant].nil?
59
- acc[:variant] = VARIANT_MAPPINGS[class_name]
58
+ elsif SIZE_MAPPINGS[class_name] && acc[:size].nil?
59
+ acc[:size] = SIZE_MAPPINGS[class_name]
60
60
  elsif class_name == "btn-block"
61
61
  acc[:block] = true
62
62
  elsif class_name == "BtnGroup-item"
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 63
8
+ PATCH = 67
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end
@@ -22,7 +22,7 @@ module RuboCop
22
22
  #
23
23
  # * The top level key is the argument.
24
24
  # * The second level key is the value.
25
- # * The seceond level value is a string of the full replacement. e.g. "new_argument: :new_value"
25
+ # * The second level value is a string of the full replacement. e.g. "new_argument: :new_value"
26
26
  # If the value is nil, then there is no replacement.
27
27
  #
28
28
  # e.g.