primer_view_components 0.0.51 → 0.0.52

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -0
  3. data/app/components/primer/beta/avatar_stack.rb +9 -9
  4. data/app/components/primer/beta/truncate.html.erb +5 -0
  5. data/app/components/primer/beta/truncate.rb +110 -0
  6. data/app/components/primer/border_box_component.rb +27 -1
  7. data/app/components/primer/clipboard_copy.rb +1 -1
  8. data/app/components/primer/dropdown.rb +7 -7
  9. data/app/components/primer/icon_button.rb +1 -1
  10. data/app/components/primer/navigation/tab_component.rb +1 -1
  11. data/app/components/primer/progress_bar_component.rb +0 -3
  12. data/app/lib/primer/fetch_or_fallback_helper.rb +2 -0
  13. data/app/lib/primer/tabbed_component_helper.rb +1 -1
  14. data/app/lib/primer/view_helper.rb +1 -0
  15. data/lib/primer/classify.rb +4 -6
  16. data/lib/primer/classify/flex.rb +1 -1
  17. data/lib/primer/classify/functional_colors.rb +1 -1
  18. data/lib/primer/classify/utilities.rb +16 -1
  19. data/lib/primer/classify/validation.rb +18 -0
  20. data/lib/primer/view_components/linters/argument_mappers/base.rb +33 -7
  21. data/lib/primer/view_components/linters/argument_mappers/button.rb +5 -6
  22. data/lib/primer/view_components/linters/argument_mappers/clipboard_copy.rb +1 -2
  23. data/lib/primer/view_components/linters/argument_mappers/helpers/erb_block.rb +48 -5
  24. data/lib/primer/view_components/linters/argument_mappers/label.rb +3 -4
  25. data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +5 -7
  26. data/lib/primer/view_components/linters/autocorrectable.rb +2 -2
  27. data/lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb +1 -1
  28. data/lib/primer/view_components/linters/helpers.rb +8 -4
  29. data/lib/primer/view_components/version.rb +1 -1
  30. data/lib/rubocop/config/default.yml +5 -0
  31. data/lib/rubocop/cop/primer.rb +1 -2
  32. data/lib/rubocop/cop/primer/deprecated_arguments.rb +173 -0
  33. data/lib/rubocop/cop/primer/no_tag_memoize.rb +1 -0
  34. data/lib/rubocop/cop/primer/primer_octicon.rb +178 -0
  35. data/lib/rubocop/cop/primer/system_argument_instead_of_class.rb +3 -17
  36. data/lib/tasks/coverage.rake +4 -0
  37. data/lib/tasks/docs.rake +3 -2
  38. data/lib/tasks/utilities.rake +5 -3
  39. data/lib/yard/docs_helper.rb +4 -3
  40. data/static/arguments.yml +7 -0
  41. data/static/classes.yml +8 -0
  42. data/static/constants.json +13 -1
  43. data/static/statuses.json +3 -1
  44. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e619cd65db4a67059cc81f1d9f7d57a9c3b6c9cf9dadf9cfb2cd4c37fdcedc2
4
- data.tar.gz: 18eaf89147d7a3e415520b09f117bf4b748fbb9a06e166df12ccc3a930506007
3
+ metadata.gz: ad52227798e79cb0259c00e61d24a3e72854dfb4fa4ffb4901fb30a2fa7f3370
4
+ data.tar.gz: 5f2e4decc740b1e9712744819d655091a2a45e9ac8b403beed54c8c9e6a6e332
5
5
  SHA512:
6
- metadata.gz: 821f1b4b53b823049bbc8e1a740b1f21d36ada796e69c59471c9f9a28183b5d94a61958544ef3c3e6386424b595e72627abcab2cd05d61de10104ea40941e201
7
- data.tar.gz: 58d0e5f7961736bee805ed3d99d5432bb4dfa16df8170abe89b1f24f2857cf80a17a578fb762b0f6f1e5b307fe96a9803e960cce6a1a2901282908e678295f79
6
+ metadata.gz: c7cac3105837c025730e7c6e01395db680d1c750bf4d2240594f00c4758a7d404802d184dd3bd53a14c8a2e14e25776152792e97fceb2a686182aaf1474ae162
7
+ data.tar.gz: f296ae7b5e8f6217b05e719169db5f08b1d1d8d7fb9293e083ae9a836f12d98c73e88cc320df3522a902f4dada28ac10ce7c9f37a96f0b175aaa1e2940e1bec9
data/CHANGELOG.md CHANGED
@@ -30,6 +30,60 @@ The category for changes related to documentation, testing and tooling. Also, fo
30
30
 
31
31
  ## main
32
32
 
33
+ ## 0.0.52
34
+
35
+ ### New
36
+
37
+ * Adding `Primer::Beta::Truncate` component to reflect changes in primer/css component [Truncate](https://primer.style/css/components/truncate).
38
+
39
+ *Jon Rohan*
40
+
41
+ * Add cop to look for deprecated system arguments and suggest replacements.
42
+
43
+ *Jon Rohan*
44
+
45
+ * Add cop to use `primer_octicon` in favor of `octicon`.
46
+
47
+ *Manuel Puyol*
48
+
49
+ * Fix release script so it doesn't loop continuously.
50
+
51
+ *Cameron Dutro*
52
+
53
+ ### Updates
54
+
55
+ * Promote `ClipboardCopy` to beta.
56
+
57
+ *Manuel Puyol*
58
+
59
+ * PrimerOcticon linter supports `aria-` and `data-` attributes.
60
+
61
+ *Manuel Puyol*
62
+
63
+ * Linters can:
64
+ * convert values with ERB interpolations.
65
+ * autocorrect cases with custom classes.
66
+
67
+ *Manuel Puyol*
68
+
69
+ * Add a `scheme` option to `BorderBoxComponent` rows.
70
+
71
+ *Cameron Dutro*
72
+
73
+ * Upgrade rubocop and support Ruby 3.0.
74
+
75
+ *Cameron Dutro*
76
+
77
+ * Linters will not autocorrect cases where a required argument is missing.
78
+
79
+ *Manuel Puyol*
80
+
81
+ ### Misc
82
+
83
+ * Update benchmarks to run in every supported Ruby version.
84
+
85
+ *Manuel Puyol*
86
+
33
87
  ## 0.0.51
34
88
 
35
89
  ### Breaking changes
@@ -46,6 +100,12 @@ The category for changes related to documentation, testing and tooling. Also, fo
46
100
 
47
101
  ## 0.0.50
48
102
 
103
+ ### Updates
104
+
105
+ * Fix incorrect slots syntax in docs.
106
+
107
+ *Joel Hawksley*, *Blake Williams*
108
+
49
109
  ### New
50
110
 
51
111
  * Add linter suggestions for `CloseButton` component.
@@ -21,23 +21,23 @@ module Primer
21
21
 
22
22
  # @example Default
23
23
  # <%= render(Primer::Beta::AvatarStack.new) do |c| %>
24
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
25
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
26
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
24
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
25
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
26
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
27
27
  # <% end %>
28
28
  #
29
29
  # @example Align right
30
30
  # <%= render(Primer::Beta::AvatarStack.new(align: :right)) do |c| %>
31
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
32
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
33
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
31
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
32
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
33
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
34
34
  # <% end %>
35
35
  #
36
36
  # @example With tooltip
37
37
  # <%= render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |c| %>
38
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
39
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
40
- # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
38
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
39
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
40
+ # <% c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
41
41
  # <% end %>
42
42
  #
43
43
  # @param tag [Symbol] <%= one_of(Primer::Beta::AvatarStack::TAG_OPTIONS) %>
@@ -0,0 +1,5 @@
1
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
+ <% items.each do |item| %>
3
+ <%= item %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # Use `Truncate` to shorten overflowing text with an ellipsis.
6
+ class Truncate < Primer::Component
7
+ status :beta
8
+
9
+ # Text slot used for the truncated text.
10
+ #
11
+ # @param priority [Boolean] if true, the text will be given priority
12
+ # @param expandable [Boolean] if true, the text will expand on hover or focus
13
+ # @param max_width [Integer] if provided, the text will be truncated at a maximum width
14
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
15
+ renders_many :items, "TruncateText"
16
+
17
+ # @example Default
18
+ # <%= render(Primer::Beta::Truncate.new) { "branch-name-that-is-really-long" } %>
19
+ #
20
+ # @example Multiple items
21
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
22
+ # <% component.item do %>really-long-repository-owner-name<% end %>
23
+ # <% component.item(font_weight: :bold) do %>
24
+ # <%= render(Primer::BaseComponent.new(tag: :span, font_weight: :normal)) { "/" } %> really-long-repository-name
25
+ # <% end %>
26
+ # <% end %>
27
+ #
28
+ # @example Advanced multiple items
29
+ # <%= render(Primer::Beta::Truncate.new(tag: :ol)) do |component| %>
30
+ # <% component.item(tag: :li) do %>primer<% end %>
31
+ # <% component.item(tag: :li, priority: true) do %>/ css<% end %>
32
+ # <% component.item(tag: :li) do %>/ Issues<% end %>
33
+ # <% component.item(tag: :li) do %>/ #123 —<% end %>
34
+ # <% component.item(tag: :li, priority: true) do %>
35
+ # Visual bug on primer.style found in lists
36
+ # <% end %>
37
+ # <% end %>
38
+ #
39
+ # @example Expand on hover or focus
40
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
41
+ # <% component.item(tag: :a, href: "#", expandable: true) do %>really-long-repository-owner-name<% end %>
42
+ # <% component.item(tag: :a, href: "#", expandable: true) do %>really-long-repository-owner-name<% end %>
43
+ # <% component.item(tag: :a, href: "#", expandable: true) do %>really-long-repository-owner-name<% end %>
44
+ # <% component.item(tag: :a, href: "#", expandable: true) do %>really-long-repository-owner-name<% end %>
45
+ # <% end %>
46
+ #
47
+ # @example Max widths
48
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
49
+ # <% component.item(max_width: 300, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
50
+ # <% component.item(max_width: 200, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
51
+ # <% component.item(max_width: 100, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
52
+ # <% end %>
53
+ #
54
+ # @example Max widths on new lines
55
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
56
+ # <% component.item(max_width: 300, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
57
+ # <% end %>
58
+ # <br/>
59
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
60
+ # <% component.item(max_width: 200, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
61
+ # <% end %>
62
+ # <br/>
63
+ # <%= render(Primer::Beta::Truncate.new) do |component| %>
64
+ # <% component.item(max_width: 100, expandable: true) do %>branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long<% end %>
65
+ # <% end %>
66
+ #
67
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
68
+ def initialize(**system_arguments)
69
+ @system_arguments = system_arguments
70
+ @system_arguments[:tag] = system_arguments[:tag] || :span
71
+ @system_arguments[:classes] = class_names(
72
+ "Truncate",
73
+ system_arguments[:classes]
74
+ )
75
+ end
76
+
77
+ def before_render
78
+ return unless content.present? && items.empty?
79
+
80
+ item { content }
81
+ end
82
+
83
+ def render?
84
+ items.any?
85
+ end
86
+
87
+ # This component is part of `Primer::Beta::Truncate` and should not be
88
+ # used as a standalone component.
89
+ class TruncateText < Primer::Component
90
+ def initialize(priority: false, expandable: false, max_width: nil, **system_arguments)
91
+ @system_arguments = system_arguments
92
+ @system_arguments[:tag] = system_arguments[:tag] || :span
93
+ @system_arguments[:classes] = class_names(
94
+ "Truncate-text",
95
+ "Truncate-text--primary": priority,
96
+ "Truncate-text--expandable": expandable
97
+ )
98
+
99
+ @system_arguments[:style] = join_style_arguments(@system_arguments[:style], "max-width: #{max_width}px;") unless max_width.nil?
100
+ end
101
+
102
+ def call
103
+ render(Primer::BaseComponent.new(**@system_arguments)) do
104
+ content
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -13,6 +13,14 @@ module Primer
13
13
  }.freeze
14
14
  PADDING_SUGGESTION = "Perhaps you could consider using :padding options of #{PADDING_MAPPINGS.keys.to_sentence}?"
15
15
 
16
+ DEFAULT_ROW_SCHEME = :default
17
+ ROW_SCHEME_MAPPINGS = {
18
+ DEFAULT_ROW_SCHEME => "",
19
+ :neutral => "Box-row--gray",
20
+ :info => "Box-row--blue",
21
+ :warning => "Box-row--yellow"
22
+ }.freeze
23
+
16
24
  # Optional Header.
17
25
  #
18
26
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -54,11 +62,13 @@ module Primer
54
62
 
55
63
  # Use Rows to add rows with borders and maintain the same padding.
56
64
  #
65
+ # @param scheme [Symbol] Color scheme. <%= one_of(Primer::BorderBoxComponent::ROW_SCHEME_MAPPINGS.keys) %>
57
66
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
58
- renders_many :rows, lambda { |**system_arguments|
67
+ renders_many :rows, lambda { |scheme: DEFAULT_ROW_SCHEME, **system_arguments|
59
68
  system_arguments[:tag] = :li
60
69
  system_arguments[:classes] = class_names(
61
70
  "Box-row",
71
+ ROW_SCHEME_MAPPINGS[fetch_or_fallback(ROW_SCHEME_MAPPINGS.keys, scheme, DEFAULT_ROW_SCHEME)],
62
72
  system_arguments[:classes]
63
73
  )
64
74
 
@@ -102,6 +112,22 @@ module Primer
102
112
  # <% end %>
103
113
  # <% end %>
104
114
  #
115
+ # @example Row colors
116
+ # <%= render(Primer::BorderBoxComponent.new) do |component| %>
117
+ # <% component.row do %>
118
+ # Default
119
+ # <% end %>
120
+ # <% component.row(scheme: :neutral) do %>
121
+ # Neutral
122
+ # <% end %>
123
+ # <% component.row(scheme: :info) do %>
124
+ # Info
125
+ # <% end %>
126
+ # <% component.row(scheme: :warning) do %>
127
+ # Warning
128
+ # <% end %>
129
+ # <% end %>
130
+ #
105
131
  # @param padding [Symbol] <%= one_of(Primer::BorderBoxComponent::PADDING_MAPPINGS.keys) %>
106
132
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
107
133
  def initialize(padding: DEFAULT_PADDING, **system_arguments)
@@ -6,7 +6,7 @@ module Primer
6
6
  # @accessibility
7
7
  # Always set an accessible label to help the user interact with the component.
8
8
  class ClipboardCopy < Primer::Component
9
- status :alpha
9
+ status :beta
10
10
 
11
11
  # @example Default
12
12
  # <%= render(Primer::ClipboardCopy.new(value: "Text to copy", "aria-label": "Copy text to the system clipboard")) %>
@@ -28,7 +28,7 @@ module Primer
28
28
  # Dropdown
29
29
  # <% end %>
30
30
  #
31
- # <%= c.menu(header: "Options") do |menu|
31
+ # <% c.menu(header: "Options") do |menu|
32
32
  # menu.item { "Item 1" }
33
33
  # menu.item { "Item 2" }
34
34
  # menu.item { "Item 3" }
@@ -45,7 +45,7 @@ module Primer
45
45
  # Dropdown
46
46
  # <% end %>
47
47
  #
48
- # <%= c.menu(header: "Options") do |menu|
48
+ # <% c.menu(header: "Options") do |menu|
49
49
  # menu.item { "Item 1" }
50
50
  # menu.item { "Item 2" }
51
51
  # menu.item(divider: true)
@@ -63,7 +63,7 @@ module Primer
63
63
  # Dropdown
64
64
  # <% end %>
65
65
  #
66
- # <%= c.menu(header: "Options", direction: :s) do |menu|
66
+ # <% c.menu(header: "Options", direction: :s) do |menu|
67
67
  # menu.item { "Item 1" }
68
68
  # menu.item { "Item 2" }
69
69
  # menu.item { "Item 3" }
@@ -77,7 +77,7 @@ module Primer
77
77
  # Dropdown
78
78
  # <% end %>
79
79
  #
80
- # <%= c.menu(header: "Options") do |menu|
80
+ # <% c.menu(header: "Options") do |menu|
81
81
  # menu.item { "Item 1" }
82
82
  # menu.item { "Item 2" }
83
83
  # menu.item { "Item 3" }
@@ -91,7 +91,7 @@ module Primer
91
91
  # Dropdown
92
92
  # <% end %>
93
93
  #
94
- # <%= c.menu(header: "Options") do |menu|
94
+ # <% c.menu(header: "Options") do |menu|
95
95
  # menu.item { "Item 1" }
96
96
  # menu.item { "Item 2" }
97
97
  # menu.item { "Item 3" }
@@ -105,7 +105,7 @@ module Primer
105
105
  # Dropdown
106
106
  # <% end %>
107
107
  #
108
- # <%= c.menu(as: :list, header: "Options") do |menu|
108
+ # <% c.menu(as: :list, header: "Options") do |menu|
109
109
  # menu.item { "Item 1" }
110
110
  # menu.item { "Item 2" }
111
111
  # menu.item(divider: true)
@@ -120,7 +120,7 @@ module Primer
120
120
  # Dropdown
121
121
  # <% end %>
122
122
  #
123
- # <%= c.menu(header: "Options") do |menu|
123
+ # <% c.menu(header: "Options") do |menu|
124
124
  # menu.item(tag: :button) { "Item 1" }
125
125
  # menu.item(classes: "custom-class") { "Item 2" }
126
126
  # menu.item { "Item 3" }
@@ -42,7 +42,7 @@ module Primer
42
42
  # @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
43
43
  # @param box [Boolean] Whether the button is in a <%= link_to_component(Primer::BorderBoxComponent) %>. If `true`, the button will have the `Box-btn-octicon` class.
44
44
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
45
- def initialize(scheme: DEFAULT_SCHEME, icon:, box: false, **system_arguments)
45
+ def initialize(icon:, scheme: DEFAULT_SCHEME, box: false, **system_arguments)
46
46
  @icon = icon
47
47
 
48
48
  @system_arguments = system_arguments
@@ -142,7 +142,7 @@ module Primer
142
142
  end
143
143
 
144
144
  render(Primer::BaseComponent.new(**@wrapper_arguments)) do
145
- yield
145
+ yield if block_given?
146
146
  end
147
147
  end
148
148
 
@@ -11,9 +11,6 @@ module Primer
11
11
  # @param bg [Symbol] The background color
12
12
  # @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
13
13
  renders_many :items, lambda { |percentage: 0, bg: :success_inverse, **system_arguments|
14
- percentage = percentage
15
- system_arguments = system_arguments
16
-
17
14
  system_arguments[:tag] = :span
18
15
  system_arguments[:bg] = bg
19
16
  system_arguments[:style] = join_style_arguments(system_arguments[:style], "width: #{percentage}%;")
@@ -48,6 +48,7 @@ module Primer
48
48
  end
49
49
  end
50
50
 
51
+ # rubocop:disable Style/OptionalBooleanParameter
51
52
  def fetch_or_fallback_boolean(given_value, fallback = false)
52
53
  if [true, false].include?(given_value)
53
54
  given_value
@@ -55,6 +56,7 @@ module Primer
55
56
  fallback
56
57
  end
57
58
  end
59
+ # rubocop:enable Style/OptionalBooleanParameter
58
60
 
59
61
  def silence_deprecations?
60
62
  Rails.application.config.primer_view_components.silence_deprecations
@@ -24,7 +24,7 @@ module Primer
24
24
  return yield unless @with_panel
25
25
 
26
26
  render Primer::TabContainerComponent.new(**system_arguments) do
27
- yield
27
+ yield if block_given?
28
28
  end
29
29
  end
30
30
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :nocov:
3
4
  module Primer
4
5
  # Module to allow shorthand calls for Primer components
5
6
  module ViewHelper
@@ -7,6 +7,7 @@ require_relative "classify/functional_border_colors"
7
7
  require_relative "classify/functional_text_colors"
8
8
  require_relative "classify/grid"
9
9
  require_relative "classify/utilities"
10
+ require_relative "classify/validation"
10
11
 
11
12
  module Primer
12
13
  # :nodoc:
@@ -14,9 +15,6 @@ module Primer
14
15
  # Keys where we can simply translate { key: value } into ".key-value"
15
16
  CONCAT_KEYS = %i[text box_shadow].freeze
16
17
 
17
- INVALID_CLASS_NAME_PREFIXES =
18
- (["bg-", "color-", "text-", "box-shadow-"] + CONCAT_KEYS.map { |k| "#{k}-" }).freeze
19
-
20
18
  COLOR_KEY = :color
21
19
  BG_KEY = :bg
22
20
  TEXT_KEYS = %i[font_family font_style font_weight text_align text_transform].freeze
@@ -109,7 +107,7 @@ module Primer
109
107
  extracted_results[:style] = [
110
108
  extracted_results.delete(:styles),
111
109
  style
112
- ].compact.join("").presence
110
+ ].compact.join.presence
113
111
 
114
112
  extracted_results
115
113
  end
@@ -121,8 +119,8 @@ module Primer
121
119
 
122
120
  if force_system_arguments? && !ENV["PRIMER_WARNINGS_DISABLED"]
123
121
  invalid_class_names =
124
- classes.split(" ").each_with_object([]) do |class_name, memo|
125
- memo << class_name if INVALID_CLASS_NAME_PREFIXES.any? { |prefix| class_name.start_with?(prefix) } || Primer::Classify::Utilities.supported_selector?(class_name)
122
+ classes.split.each_with_object([]) do |class_name, memo|
123
+ memo << class_name if Primer::Classify::Validation.invalid?(class_name)
126
124
  end
127
125
 
128
126
  raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. This warning will not be raised in production. Set PRIMER_WARNINGS_DISABLED=1 to disable this warning." if invalid_class_names.any?