primer_view_components 0.0.64 → 0.0.65

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,7 +81,7 @@ module Primer
81
81
  system_arguments[:tag] = :a
82
82
  system_arguments[:href] = href
83
83
  system_arguments[:mt] = 5
84
- system_arguments[:variant] = :medium
84
+ system_arguments[:size] = :medium
85
85
  system_arguments[:scheme] ||= :primary
86
86
 
87
87
  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
 
@@ -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(
@@ -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
@@ -19,20 +19,6 @@ module Primer
19
19
 
20
20
  BREAKPOINTS = ["", "-sm", "-md", "-lg", "-xl"].freeze
21
21
 
22
- # Replacements for some classnames that end up being a different argument key
23
- REPLACEMENT_KEYS = {
24
- "^anim" => "animation",
25
- "^v-align" => "vertical_align",
26
- "^d" => "display",
27
- "^wb" => "word_break",
28
- "^v" => "visibility",
29
- "^width" => "w",
30
- "^height" => "h",
31
- "^color-bg" => "bg",
32
- "^color-border" => "border_color",
33
- "^color-fg" => "color"
34
- }.freeze
35
-
36
22
  SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
37
23
  BREAKPOINT_INDEX_CACHE = Hash.new { |h, k| h[k] = BREAKPOINTS.index(k) }
38
24
 
@@ -173,31 +159,15 @@ module Primer
173
159
  private
174
160
 
175
161
  def find_selector(selector)
176
- key = infer_selector_key(selector)
177
- value_hash = UTILITIES[key]
178
-
179
- return nil if value_hash.blank?
180
-
181
- # Each value hash will also contain an array of classnames for breakpoints
182
- # Key argument `0`, classes `[ "mr-0", "mr-sm-0", "mr-md-0", "mr-lg-0", "mr-xl-0" ]`
183
- value_hash.each do |key_argument, classnames|
184
- # Skip each value hash until we get one with the selector
185
- next unless classnames.include?(selector)
186
-
187
- # Return [:mr, 0, 1]
188
- # has index of classname, so we can match it up with responsive array `mr: [nil, 0]`
189
- return [key, key_argument, classnames.index(selector)]
190
- end
191
-
192
- nil
193
- end
194
-
195
- def infer_selector_key(selector)
196
- REPLACEMENT_KEYS.each do |k, v|
197
- return v.to_sym if selector.match?(Regexp.new(k))
162
+ # Build hash indexed on the selector for fast lookup.
163
+ @selector_cache ||= UTILITIES.each_with_object({}) do |(keyword, argument_w_selectors), dict|
164
+ argument_w_selectors.each do |argument, selectors|
165
+ selectors.each_with_index do |css_selector, index|
166
+ dict[css_selector] = [keyword, argument, index]
167
+ end
168
+ end
198
169
  end
199
-
200
- selector.split("-").first.to_sym
170
+ @selector_cache[selector]
201
171
  end
202
172
  end
203
173
  end
@@ -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 = 64
8
+ PATCH = 65
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.
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop"
4
+
5
+ # :nocov:
6
+ module RuboCop
7
+ module Cop
8
+ module Primer
9
+ # This cop ensures that `ButtonComponent` doesn't use deprecated arguments.
10
+ #
11
+ # bad
12
+ # ButtonComponent.new(variant: :small)
13
+ #
14
+ # good
15
+ # ButtonComponent.new(size: :small)
16
+ class DeprecatedButtonArguments < BaseCop
17
+ INVALID_MESSAGE = <<~STR
18
+ `variant` is deprecated. Use `size` instead.
19
+ STR
20
+
21
+ def_node_matcher :button_component?, <<~PATTERN
22
+ (send (const (const nil? :Primer) :ButtonComponent) :new ...)
23
+ PATTERN
24
+
25
+ DEPRECATIONS = {
26
+ variant: :size
27
+ }.freeze
28
+
29
+ def on_send(node)
30
+ return unless button_component?(node)
31
+
32
+ kwargs = node.arguments.last
33
+
34
+ return if kwargs.nil?
35
+
36
+ pair = kwargs.pairs.find { |x| x.key.value == :variant }
37
+
38
+ return if pair.nil?
39
+
40
+ add_offense(pair.key, message: INVALID_MESSAGE)
41
+ end
42
+
43
+ def autocorrect(node)
44
+ lambda do |corrector|
45
+ corrector.replace(node, DEPRECATIONS[node.value])
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop"
4
+
5
+ # :nocov:
6
+ module RuboCop
7
+ module Cop
8
+ module Primer
9
+ # This cop ensures that components don't use deprecated `Label` schemes.
10
+ #
11
+ # bad
12
+ # Primer::LabelComponent.new(scheme: :info)
13
+ #
14
+ # good
15
+ # Primer::LabelComponent.new(scheme: :accent)
16
+ class DeprecatedLabelSchemes < BaseCop
17
+ INVALID_MESSAGE = <<~STR
18
+ Avoid using deprecated schemes: https://primer.style/view-components/deprecated#labelcomponent.
19
+ STR
20
+
21
+ # This is a hash of deprecated schemes and their replacements.
22
+ DEPRECATIONS = {
23
+ info: ":accent",
24
+ warning: ":attention",
25
+ orange: ":severe",
26
+ purple: ":done"
27
+ }.freeze
28
+
29
+ def on_send(node)
30
+ return unless label_node?(node)
31
+ return unless node.arguments?
32
+
33
+ # we are looking for hash arguments and they are always last
34
+ kwargs = node.arguments.last
35
+
36
+ return unless kwargs.type == :hash
37
+
38
+ kwargs.pairs.each do |pair|
39
+ # Skip if we're not dealing with a symbol
40
+ next if pair.key.type != :sym
41
+ next unless pair.value.type == :sym || pair.value.type == :str
42
+
43
+ value = pair.value.value.to_sym
44
+
45
+ next unless DEPRECATIONS.key?(value)
46
+
47
+ add_offense(pair.value, message: INVALID_MESSAGE)
48
+ end
49
+ end
50
+
51
+ def autocorrect(node)
52
+ lambda do |corrector|
53
+ replacement = DEPRECATIONS[node.value.to_sym]
54
+ corrector.replace(node, replacement)
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def label_node?(node)
61
+ return if node.nil?
62
+
63
+ node.method_name == :new && !node.receiver.nil? && node.receiver.const_name == "Primer::LabelComponent"
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -5,7 +5,6 @@ namespace :utilities do
5
5
  require "yaml"
6
6
  require "json"
7
7
  require File.expand_path("./../../demo/config/environment.rb", __dir__)
8
- require "primer/classify/utilities"
9
8
 
10
9
  # Keys that are looked for to be included in the utilities.yml file
11
10
  # rubocop:disable Lint/ConstantDefinitionInBlock
@@ -29,6 +28,20 @@ namespace :utilities do
29
28
  /^v\b/
30
29
  ].freeze
31
30
 
31
+ # Replacements for some classnames that end up being a different argument key
32
+ REPLACEMENT_KEYS = {
33
+ "^anim" => "animation",
34
+ "^v-align" => "vertical_align",
35
+ "^d" => "display",
36
+ "^wb" => "word_break",
37
+ "^v" => "visibility",
38
+ "^width" => "w",
39
+ "^height" => "h",
40
+ "^color-bg" => "bg",
41
+ "^color-border" => "border_color",
42
+ "^color-fg" => "color"
43
+ }.freeze
44
+
32
45
  BREAKPOINTS = [nil, "sm", "md", "lg", "xl"].freeze
33
46
  # rubocop:enable Lint/ConstantDefinitionInBlock
34
47
 
@@ -67,7 +80,7 @@ namespace :utilities do
67
80
  key = ""
68
81
 
69
82
  # Look for a replacement key
70
- Primer::Classify::Utilities::REPLACEMENT_KEYS.each do |k, v|
83
+ REPLACEMENT_KEYS.each do |k, v|
71
84
  next unless classname.match?(Regexp.new(k))
72
85
 
73
86
  key = v
data/static/arguments.yml CHANGED
@@ -324,6 +324,10 @@
324
324
  description: One of `:danger`, `:default`, `:invisible`, `:link`, `:outline`,
325
325
  or `:primary`.
326
326
  - name: variant
327
+ type: Symbol
328
+ default: "`nil`"
329
+ description: DEPRECATED. One of `:medium` and `:small`.
330
+ - name: size
327
331
  type: Symbol
328
332
  default: "`:medium`"
329
333
  description: One of `:medium` and `:small`.
@@ -355,6 +359,10 @@
355
359
  source: https://github.com/primer/view_components/tree/main/app/components/primer/button_group.rb
356
360
  parameters:
357
361
  - name: variant
362
+ type: Symbol
363
+ default: "`nil`"
364
+ description: DEPRECATED. One of `:medium` and `:small`.
365
+ - name: size
358
366
  type: Symbol
359
367
  default: "`:medium`"
360
368
  description: One of `:medium` and `:small`.
@@ -655,9 +663,10 @@
655
663
  description: One of `:a`, `:div`, `:span`, or `:summary`.
656
664
  - name: scheme
657
665
  type: Symbol
658
- default: "`nil`"
659
- description: One of `:danger`, `:info`, `:orange`, `:primary`, `:purple`, `:secondary`,
660
- `:success`, or `:warning`.
666
+ default: "`:default`"
667
+ description: One of `:accent`, `:attention`, `:danger`, `:default`, `:done`, `:info`,
668
+ `:orange`, `:primary`, `:purple`, `:secondary`, `:severe`, `:sponsors`, `:success`,
669
+ or `:warning`.
661
670
  - name: variant
662
671
  type: Symbol
663
672
  default: "`nil`"
data/static/classes.yml CHANGED
@@ -20,13 +20,16 @@
20
20
  - ".Counter--primary"
21
21
  - ".Counter--secondary"
22
22
  - ".Label"
23
+ - ".Label--accent"
24
+ - ".Label--attention"
23
25
  - ".Label--danger"
24
- - ".Label--info"
26
+ - ".Label--done"
25
27
  - ".Label--large"
26
28
  - ".Label--primary"
27
29
  - ".Label--secondary"
30
+ - ".Label--severe"
31
+ - ".Label--sponsors"
28
32
  - ".Label--success"
29
- - ".Label--warning"
30
33
  - ".Layout"
31
34
  - ".Layout--flowRow-until-lg"
32
35
  - ".Layout--flowRow-until-md"
@@ -191,7 +194,6 @@
191
194
  - ".pr-2"
192
195
  - ".pt-5"
193
196
  - ".right-0"
194
- - ".sr-only"
195
197
  - ".tabnav"
196
198
  - ".tabnav-tab"
197
199
  - ".tabnav-tabs"
@@ -202,4 +204,3 @@
202
204
  - ".tooltipped-n"
203
205
  - ".tooltipped-no-delay"
204
206
  - ".tooltipped-s"
205
- - ".v-align-bottom"
@@ -279,7 +279,7 @@
279
279
  },
280
280
  "Primer::ButtonComponent": {
281
281
  "DEFAULT_SCHEME": "default",
282
- "DEFAULT_VARIANT": "medium",
282
+ "DEFAULT_SIZE": "medium",
283
283
  "LINK_SCHEME": "link",
284
284
  "SCHEME_MAPPINGS": {
285
285
  "default": "",
@@ -297,11 +297,11 @@
297
297
  "invisible",
298
298
  "link"
299
299
  ],
300
- "VARIANT_MAPPINGS": {
300
+ "SIZE_MAPPINGS": {
301
301
  "small": "btn-sm",
302
302
  "medium": ""
303
303
  },
304
- "VARIANT_OPTIONS": [
304
+ "SIZE_OPTIONS": [
305
305
  "small",
306
306
  "medium"
307
307
  ]
@@ -504,29 +504,41 @@
504
504
  "Primer::ImageCrop": {
505
505
  },
506
506
  "Primer::LabelComponent": {
507
+ "DEFAULT_SCHEME": "default",
507
508
  "DEFAULT_TAG": "span",
508
509
  "DEPRECATED_SCHEME_OPTIONS": [
510
+ "info",
511
+ "warning",
509
512
  "orange",
510
513
  "purple"
511
514
  ],
512
515
  "SCHEME_MAPPINGS": {
516
+ "default": "",
513
517
  "primary": "Label--primary",
514
518
  "secondary": "Label--secondary",
515
- "info": "Label--info",
519
+ "accent": "Label--accent",
516
520
  "success": "Label--success",
517
- "warning": "Label--warning",
521
+ "attention": "Label--attention",
518
522
  "danger": "Label--danger",
523
+ "severe": "Label--severe",
524
+ "done": "Label--done",
525
+ "sponsors": "Label--sponsors",
526
+ "info": "Label--info",
527
+ "warning": "Label--warning",
519
528
  "orange": "Label--orange",
520
529
  "purple": "Label--purple"
521
530
  },
522
531
  "SCHEME_OPTIONS": [
532
+ "default",
523
533
  "primary",
524
534
  "secondary",
525
- "info",
535
+ "accent",
526
536
  "success",
527
- "warning",
537
+ "attention",
528
538
  "danger",
529
- null
539
+ "severe",
540
+ "done",
541
+ "sponsors"
530
542
  ],
531
543
  "TAG_OPTIONS": [
532
544
  "span",