primer_view_components 0.0.55 → 0.0.56

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24d9b6954280f4366b91f69fe7d29af41b8ce480b015a6d2f281c9e6c3bd4637
4
- data.tar.gz: cae48c352697db57fd18b2712850cdc5a47da809449dcbd1f32398a777135cda
3
+ metadata.gz: 1263f18dfe58150640310bfea1bd27f14e3854656f77606ed824fb4cc068b47e
4
+ data.tar.gz: 6dc1be9c61762bc31d0274b9402853d53c9a8e75438ffb3361179f0104c1896c
5
5
  SHA512:
6
- metadata.gz: e334ce2c9e71f8b54f0a22d094a333ce1df7216a601885732c2a1f669e03d67f4b0e2d9799c39600edc33e9ef972949a02de1a8adc4081c702b14d4bfe6bacbc
7
- data.tar.gz: 4640a31794a5e6df77bcf1a707758bb970d80a33afbcd42a812efd3ce3c9f032b7789de55f3ab0d74d7d8657c1d06f3965f926437cf609455f3db4b2c4a2bc6f
6
+ metadata.gz: da4c5a2f914f1b08177830023af568d4cc9970bf8047c95fa39ce13d3ea46b6a30687ae6df89a9fefbfb65b5e9f52f37ace2801370f9582513c43b0e5e26ccfb
7
+ data.tar.gz: 66e9eb50c0f9a91aecd6804d7b44aa5d6644f094edbf6011e60361a54d9de1c51dcb0ec157c162458139ca69d2cb7a469c8978b53b63d5f2aa06f59b79ebdc1f
data/CHANGELOG.md CHANGED
@@ -30,6 +30,36 @@ The category for changes related to documentation, testing and tooling. Also, fo
30
30
 
31
31
  ## main
32
32
 
33
+ ## 0.0.56
34
+
35
+ ### Updates
36
+
37
+ * `Octicon` linter will autocorrect colors.
38
+
39
+ *Manuel Puyol*
40
+
41
+ * `Button` linter will autocorrect when button uses `href`, `name`, `value` or `tabindex`.
42
+
43
+ *Manuel Puyol*
44
+
45
+ * `Flash` linter won't autocorrect flashes with ERB in their content.
46
+
47
+ *Manuel Puyol*
48
+
49
+ * Eager load components.
50
+
51
+ *Cameron Dutro*
52
+
53
+ ### Misc
54
+
55
+ * Refactor some of the rubocop valid_node? logic into BaseCop class.
56
+
57
+ *Jon Rohan*
58
+
59
+ * Fix validation checker to use Utilities for color-* classes.
60
+
61
+ *Jon Rohan*
62
+
33
63
  ## 0.0.55
34
64
 
35
65
  ### Breaking changes
@@ -59,10 +89,6 @@ The category for changes related to documentation, testing and tooling. Also, fo
59
89
 
60
90
  *Kate Higa*
61
91
 
62
- * Refactor some of the rubocop valid_node? logic into BaseCop class.
63
-
64
- *Jon Rohan*
65
-
66
92
  ## 0.0.54
67
93
 
68
94
  ### Breaking changes
@@ -115,7 +115,11 @@ module Primer
115
115
  end
116
116
 
117
117
  def classes_to_args(classes)
118
- classes_to_hash(classes).map do |key, value|
118
+ hash_to_args(classes_to_hash(classes))
119
+ end
120
+
121
+ def hash_to_args(hash)
122
+ hash.map do |key, value|
119
123
  val = case value
120
124
  when Symbol
121
125
  ":#{value}"
@@ -6,7 +6,7 @@ module Primer
6
6
  class Classify
7
7
  # :nodoc:
8
8
  class Validation
9
- INVALID_CLASS_NAME_PREFIXES = /bg-|color-|text-|box-shadow-|text-|box_shadow-/.freeze
9
+ INVALID_CLASS_NAME_PREFIXES = /bg-|color-bg-|text-|box-shadow-|box_shadow-/.freeze
10
10
 
11
11
  class << self
12
12
  def invalid?(class_name)
@@ -7,7 +7,7 @@ module Primer
7
7
  # :nodoc:
8
8
  class Engine < ::Rails::Engine
9
9
  isolate_namespace Primer::ViewComponents
10
- config.autoload_once_paths = %W[
10
+ config.eager_load_paths = %W[
11
11
  #{root}/app/components
12
12
  #{root}/app/lib
13
13
  ]
@@ -23,12 +23,13 @@ module ERBLint
23
23
  component: "Primer::BaseButton",
24
24
  constant: "TYPE_OPTIONS"
25
25
  ).freeze
26
+
26
27
  DEFAULT_TAG = Primer::ViewComponents::Constants.get(
27
28
  component: "Primer::BaseButton",
28
29
  constant: "DEFAULT_TAG"
29
30
  ).freeze
30
31
 
31
- ATTRIBUTES = %w[disabled type].freeze
32
+ ATTRIBUTES = %w[disabled type href name value tabindex].freeze
32
33
 
33
34
  def attribute_to_args(attribute)
34
35
  attr_name = attribute.name
@@ -43,6 +44,8 @@ module ERBLint
43
44
  raise ConversionError, "Button component does not support type \"#{attribute.value}\"" unless TYPE_OPTIONS.include?(attribute.value)
44
45
 
45
46
  { type: ":#{attribute.value}" }
47
+ else
48
+ { attr_name.to_sym => erb_helper.convert(attribute) }
46
49
  end
47
50
  end
48
51
 
@@ -22,6 +22,11 @@ module ERBLint
22
22
  # Hash children indicates that there are tags in the content.
23
23
  return nil if tag_tree[:children].first.is_a?(Hash)
24
24
 
25
+ content = tag_tree[:children].first
26
+
27
+ # Don't accept content with ERB blocks
28
+ return nil if content.type != :text || content.children&.any? { |n| n.try(:type) == :erb }
29
+
25
30
  ARGUMENT_MAPPER.new(tag).to_s
26
31
  rescue ArgumentMappers::ConversionError
27
32
  nil
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 55
8
+ PATCH = 56
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end
@@ -128,12 +128,29 @@ module RuboCop
128
128
  string_args = string_args_to_string(node)
129
129
 
130
130
  args = "#{args}, #{size_attributes_to_string(size_attributes)}" if size_args.present?
131
- args = "#{args}, #{::Primer::Classify::Utilities.classes_to_args(classes)}" if classes.present?
131
+ args = "#{args}, #{utilities_args(classes)}" if classes.present?
132
132
  args = "#{args}, #{string_args}" if string_args.present?
133
133
 
134
134
  args
135
135
  end
136
136
 
137
+ def utilities_args(classes)
138
+ args = ::Primer::Classify::Utilities.classes_to_hash(classes)
139
+
140
+ color = case args[:color]
141
+ when :text_white
142
+ :text_white
143
+ when :text_link
144
+ :icon_info
145
+ else
146
+ args[:color].to_s.gsub("text_", "icon_").to_sym
147
+ end
148
+
149
+ args[:color] = color
150
+
151
+ ::Primer::Classify::Utilities.hash_to_args(args)
152
+ end
153
+
137
154
  def size_attributes_to_string(size_attributes)
138
155
  # No arguments if they map to the default size
139
156
  return if size_attributes.blank? || size_attributes.values.all?(&:blank?)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.55
4
+ version: 0.0.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -366,7 +366,7 @@ dependencies:
366
366
  - - "~>"
367
367
  - !ruby/object:Gem::Version
368
368
  version: 0.9.25
369
- description:
369
+ description:
370
370
  email:
371
371
  - opensource+primer_view_components@github.com
372
372
  executables: []
@@ -387,8 +387,6 @@ files:
387
387
  - app/components/primer/alpha/underline_nav.rb
388
388
  - app/components/primer/alpha/underline_panels.html.erb
389
389
  - app/components/primer/alpha/underline_panels.rb
390
- - app/components/primer/auto_complete/auto_complete.d.ts
391
- - app/components/primer/auto_complete/auto_complete.js
392
390
  - app/components/primer/base_button.rb
393
391
  - app/components/primer/base_component.rb
394
392
  - app/components/primer/beta/auto_complete.rb
@@ -557,7 +555,7 @@ licenses:
557
555
  - MIT
558
556
  metadata:
559
557
  allowed_push_host: https://rubygems.org
560
- post_install_message:
558
+ post_install_message:
561
559
  rdoc_options: []
562
560
  require_paths:
563
561
  - lib
@@ -572,8 +570,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
572
570
  - !ruby/object:Gem::Version
573
571
  version: '0'
574
572
  requirements: []
575
- rubygems_version: 3.1.2
576
- signing_key:
573
+ rubygems_version: 3.2.22
574
+ signing_key:
577
575
  specification_version: 4
578
576
  summary: ViewComponents for the Primer Design System
579
577
  test_files: []
@@ -1 +0,0 @@
1
- import '@github/auto-complete-element';
@@ -1 +0,0 @@
1
- import '@github/auto-complete-element';