primer_view_components 0.0.63 → 0.0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/app/components/primer/component.rb +9 -4
- data/app/components/primer/octicon_component.rb +4 -2
- data/app/lib/primer/octicon/cache.rb +4 -10
- data/lib/primer/classify/utilities.yml +98 -0
- data/lib/primer/classify.rb +1 -1
- data/lib/primer/view_components/engine.rb +1 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/custom_utilities.yml +98 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 293526832927614dca06b1e03788d2db4f94fef8a5572a20304bd85e5498bd53
|
4
|
+
data.tar.gz: 419cd1ea3365120b4a3bb4429a1b9da105b2dc3c8474015a661b6e44d319f359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2da4816e43ed7a7b7a13436d83d767bb5d6ee100748c7058f8a2f201e41132f34a17df862bf0f798b216f4b2b2cb6249b2bd61a3d620fbc401ce6fa06a16ce43
|
7
|
+
data.tar.gz: ca7bbc94ecdc2a39b57892f881b9be545b4af17456ac14094880a5154ebd6a2d6e69fe1e1b219f9ec1bbddac607a4c25b6f12c7117a32dd06366c3125f521f1b
|
data/CHANGELOG.md
CHANGED
@@ -30,6 +30,20 @@ The category for changes related to documentation, testing and tooling. Also, fo
|
|
30
30
|
|
31
31
|
## main
|
32
32
|
|
33
|
+
## 0.0.64
|
34
|
+
|
35
|
+
### New
|
36
|
+
|
37
|
+
* Add `raise_on_invalid_aria` config option to silence `aria-label` errors.
|
38
|
+
|
39
|
+
*Manuel Puyol*
|
40
|
+
|
41
|
+
### Bug Fixes
|
42
|
+
|
43
|
+
* Add missing `border: 0`, `font_size: 0` and responsive `flex` system arguments.
|
44
|
+
|
45
|
+
*Manuel Puyol*
|
46
|
+
|
33
47
|
## 0.0.63
|
34
48
|
|
35
49
|
### Breaking Changes
|
@@ -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
|
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
|
@@ -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
|
-
|
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)
|
@@ -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(
|
13
|
-
|
14
|
-
|
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
|
@@ -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
|
data/lib/primer/classify.rb
CHANGED
@@ -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(
|
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)
|
@@ -99,6 +99,12 @@
|
|
99
99
|
- border-x
|
100
100
|
true:
|
101
101
|
- border
|
102
|
+
0:
|
103
|
+
- border-0
|
104
|
+
false:
|
105
|
+
- border-0
|
106
|
+
:dashed:
|
107
|
+
- border-dashed
|
102
108
|
:border_top:
|
103
109
|
0:
|
104
110
|
- border-top-0
|
@@ -123,32 +129,84 @@
|
|
123
129
|
:justify_content:
|
124
130
|
:flex_start:
|
125
131
|
- flex-justify-start
|
132
|
+
- flex-sm-justify-start
|
133
|
+
- flex-md-justify-start
|
134
|
+
- flex-lg-justify-start
|
135
|
+
- flex-xl-justify-start
|
126
136
|
:flex_end:
|
127
137
|
- flex-justify-end
|
138
|
+
- flex-sm-justify-end
|
139
|
+
- flex-md-justify-end
|
140
|
+
- flex-lg-justify-end
|
141
|
+
- flex-xl-justify-end
|
128
142
|
:center:
|
129
143
|
- flex-justify-center
|
144
|
+
- flex-sm-justify-center
|
145
|
+
- flex-md-justify-center
|
146
|
+
- flex-lg-justify-center
|
147
|
+
- flex-xl-justify-center
|
130
148
|
:space_between:
|
131
149
|
- flex-justify-between
|
150
|
+
- flex-sm-justify-between
|
151
|
+
- flex-md-justify-between
|
152
|
+
- flex-lg-justify-between
|
153
|
+
- flex-xl-justify-between
|
132
154
|
:space_around:
|
133
155
|
- flex-justify-around
|
156
|
+
- flex-sm-justify-around
|
157
|
+
- flex-md-justify-around
|
158
|
+
- flex-lg-justify-around
|
159
|
+
- flex-xl-justify-around
|
134
160
|
:align_items:
|
135
161
|
:flex_start:
|
136
162
|
- flex-items-start
|
163
|
+
- flex-sm-items-start
|
164
|
+
- flex-md-items-start
|
165
|
+
- flex-lg-items-start
|
166
|
+
- flex-xl-items-start
|
137
167
|
:flex_end:
|
138
168
|
- flex-items-end
|
169
|
+
- flex-sm-items-end
|
170
|
+
- flex-md-items-end
|
171
|
+
- flex-lg-items-end
|
172
|
+
- flex-xl-items-end
|
139
173
|
:center:
|
140
174
|
- flex-items-center
|
175
|
+
- flex-sm-items-center
|
176
|
+
- flex-md-items-center
|
177
|
+
- flex-lg-items-center
|
178
|
+
- flex-xl-items-center
|
141
179
|
:baseline:
|
142
180
|
- flex-items-baseline
|
181
|
+
- flex-sm-items-baseline
|
182
|
+
- flex-md-items-baseline
|
183
|
+
- flex-lg-items-baseline
|
184
|
+
- flex-xl-items-baseline
|
143
185
|
:stretch:
|
144
186
|
- flex-items-stretch
|
187
|
+
- flex-sm-items-stretch
|
188
|
+
- flex-md-items-stretch
|
189
|
+
- flex-lg-items-stretch
|
190
|
+
- flex-xl-items-stretch
|
145
191
|
:flex_wrap:
|
146
192
|
:wrap:
|
147
193
|
- flex-wrap
|
194
|
+
- flex-sm-wrap
|
195
|
+
- flex-md-wrap
|
196
|
+
- flex-lg-wrap
|
197
|
+
- flex-xl-wrap
|
148
198
|
:nowrap:
|
149
199
|
- flex-nowrap
|
200
|
+
- flex-sm-nowrap
|
201
|
+
- flex-md-nowrap
|
202
|
+
- flex-lg-nowrap
|
203
|
+
- flex-xl-nowrap
|
150
204
|
:reverse:
|
151
205
|
- flex-wrap-reverse
|
206
|
+
- flex-sm-wrap-reverse
|
207
|
+
- flex-md-wrap-reverse
|
208
|
+
- flex-lg-wrap-reverse
|
209
|
+
- flex-xl-wrap-reverse
|
152
210
|
:direction:
|
153
211
|
:column:
|
154
212
|
- flex-column
|
@@ -177,24 +235,64 @@
|
|
177
235
|
:flex:
|
178
236
|
1:
|
179
237
|
- flex-1
|
238
|
+
- flex-sm-1
|
239
|
+
- flex-md-1
|
240
|
+
- flex-lg-1
|
241
|
+
- flex-xl-1
|
180
242
|
:auto:
|
181
243
|
- flex-auto
|
244
|
+
- flex-sm-auto
|
245
|
+
- flex-md-auto
|
246
|
+
- flex-lg-auto
|
247
|
+
- flex-xl-auto
|
182
248
|
:align_self:
|
183
249
|
:auto:
|
184
250
|
- flex-self-auto
|
251
|
+
- flex-sm-self-auto
|
252
|
+
- flex-md-self-auto
|
253
|
+
- flex-lg-self-auto
|
254
|
+
- flex-xl-self-auto
|
185
255
|
:start:
|
186
256
|
- flex-self-start
|
257
|
+
- flex-sm-self-start
|
258
|
+
- flex-md-self-start
|
259
|
+
- flex-lg-self-start
|
260
|
+
- flex-xl-self-start
|
187
261
|
:end:
|
188
262
|
- flex-self-end
|
263
|
+
- flex-sm-self-end
|
264
|
+
- flex-md-self-end
|
265
|
+
- flex-lg-self-end
|
266
|
+
- flex-xl-self-end
|
189
267
|
:center:
|
190
268
|
- flex-self-center
|
269
|
+
- flex-sm-self-center
|
270
|
+
- flex-md-self-center
|
271
|
+
- flex-lg-self-center
|
272
|
+
- flex-xl-self-center
|
191
273
|
:baseline:
|
192
274
|
- flex-self-baseline
|
275
|
+
- flex-sm-self-baseline
|
276
|
+
- flex-md-self-baseline
|
277
|
+
- flex-lg-self-baseline
|
278
|
+
- flex-xl-self-baseline
|
193
279
|
:stretch:
|
194
280
|
- flex-self-stretch
|
281
|
+
- flex-sm-self-stretch
|
282
|
+
- flex-md-self-stretch
|
283
|
+
- flex-lg-self-stretch
|
284
|
+
- flex-xl-self-stretch
|
195
285
|
:flex_grow:
|
196
286
|
0:
|
197
287
|
- flex-grow-0
|
288
|
+
- flex-sm-grow-0
|
289
|
+
- flex-md-grow-0
|
290
|
+
- flex-lg-grow-0
|
291
|
+
- flex-xl-grow-0
|
198
292
|
:flex_shrink:
|
199
293
|
0:
|
200
294
|
- flex-shrink-0
|
295
|
+
- flex-sm-shrink-0
|
296
|
+
- flex-md-shrink-0
|
297
|
+
- flex-lg-shrink-0
|
298
|
+
- flex-xl-shrink-0
|
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.
|
4
|
+
version: 0.0.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|