primer_view_components 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/app/components/primer/avatar_component.rb +11 -11
- data/app/components/primer/base_component.rb +55 -7
- data/app/components/primer/blankslate_component.html.erb +1 -1
- data/app/components/primer/blankslate_component.rb +6 -6
- data/app/components/primer/border_box_component.html.erb +5 -5
- data/app/components/primer/border_box_component.rb +34 -34
- data/app/components/primer/box_component.rb +5 -5
- data/app/components/primer/breadcrumb_component.html.erb +2 -2
- data/app/components/primer/breadcrumb_component.rb +12 -12
- data/app/components/primer/button_component.rb +9 -9
- data/app/components/primer/counter_component.rb +9 -9
- data/app/components/primer/details_component.html.erb +1 -1
- data/app/components/primer/details_component.rb +15 -15
- data/app/components/primer/dropdown_menu_component.html.erb +1 -1
- data/app/components/primer/dropdown_menu_component.rb +6 -6
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flash_component.rb +13 -13
- data/app/components/primer/flex_component.rb +5 -5
- data/app/components/primer/flex_item_component.rb +5 -5
- data/app/components/primer/heading_component.rb +4 -4
- data/app/components/primer/label_component.rb +9 -9
- data/app/components/primer/layout_component.html.erb +1 -1
- data/app/components/primer/layout_component.rb +6 -6
- data/app/components/primer/link_component.rb +8 -8
- data/app/components/primer/octicon_component.rb +10 -10
- data/app/components/primer/popover_component.html.erb +1 -1
- data/app/components/primer/popover_component.rb +26 -26
- data/app/components/primer/progress_bar_component.html.erb +2 -2
- data/app/components/primer/progress_bar_component.rb +14 -14
- data/app/components/primer/spinner_component.html.erb +1 -1
- data/app/components/primer/spinner_component.rb +9 -9
- data/app/components/primer/state_component.rb +8 -8
- data/app/components/primer/subhead_component.html.erb +4 -4
- data/app/components/primer/subhead_component.rb +26 -26
- data/app/components/primer/text_component.rb +5 -5
- data/app/components/primer/timeline_item_component.html.erb +4 -4
- data/app/components/primer/timeline_item_component.rb +28 -28
- data/app/components/primer/underline_nav_component.html.erb +1 -1
- data/app/components/primer/underline_nav_component.rb +5 -5
- data/lib/primer/classify.rb +2 -4
- data/lib/primer/view_components/version.rb +1 -1
- 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: 055f773c8e99df5c9bce23d6a5199e71148d0331d6abe6c02fd1f16321a54130
|
4
|
+
data.tar.gz: e5310f927e76533daa46918acb24b48ea7bdd684a8f8e4c9090e3545a2e7f3fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b7159b56e4a0674a7ec68e4aa0666bb2a3e3cb5ef7b90e8c418149200af1255789adc87e4b3955a9a2d6e97afb9ebe2746928ccb32ece3395c28de315206dc
|
7
|
+
data.tar.gz: cc962a06f62249016eccfd224ab3655117ac193fa7f6ebb40aff91212690464047f95e2822bf4b5c8ae83d8c82df02e955f0c8ffc350e9aed85c313623388a61
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 0.0.13
|
6
|
+
|
7
|
+
* Add support for `xl` breakpoint.
|
8
|
+
|
9
|
+
*Joel Hawksley*
|
10
|
+
|
5
11
|
## 0.0.12
|
6
12
|
|
7
13
|
* Adds support for disabling inline box-sizing style for `SpinnerComponent` via style parameter `Primer::SpinnerComponent.new(style: nil)`.
|
@@ -88,7 +94,7 @@
|
|
88
94
|
|
89
95
|
## 0.0.3
|
90
96
|
|
91
|
-
* Add support for responsive `float`
|
97
|
+
* Add support for responsive `float` system argument.
|
92
98
|
|
93
99
|
*Joel Hawksley*
|
94
100
|
|
@@ -15,25 +15,25 @@ module Primer
|
|
15
15
|
# @param alt [String] Passed through to alt on img tag
|
16
16
|
# @param size [Integer] Adds the avatar-small class if less than 24
|
17
17
|
# @param square [Boolean] Used to create a square avatar.
|
18
|
-
def initialize(src:, alt:, size: 20, square: false, **
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
18
|
+
def initialize(src:, alt:, size: 20, square: false, **system_arguments)
|
19
|
+
@system_arguments = system_arguments
|
20
|
+
@system_arguments[:tag] = :img
|
21
|
+
@system_arguments[:src] = src
|
22
|
+
@system_arguments[:alt] = alt
|
23
|
+
@system_arguments[:size] = size
|
24
|
+
@system_arguments[:height] = size
|
25
|
+
@system_arguments[:width] = size
|
26
26
|
|
27
|
-
@
|
27
|
+
@system_arguments[:classes] = class_names(
|
28
28
|
"avatar",
|
29
|
-
|
29
|
+
system_arguments[:classes],
|
30
30
|
"avatar--small" => size < SMALL_THRESHOLD,
|
31
31
|
"CircleBadge" => !square
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
35
|
def call
|
36
|
-
render(Primer::BaseComponent.new(**@
|
36
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -1,22 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
#
|
4
|
+
# All Primer ViewComponents accept a standard set of options called System Arguments, mimicking the [styled-system API](https://styled-system.com/table) [used by Primer React](https://primer.style/components/system-props).
|
5
|
+
#
|
6
|
+
# Under the hood, System Arguments are [mapped](https://github.com/primer/view_components/blob/main/lib/primer/classify.rb) to Primer CSS classes, with any remaining options passed to Rails' [`content_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).
|
7
|
+
#
|
8
|
+
# ## Responsive values
|
9
|
+
#
|
10
|
+
# To apply different values across responsive breakpoints, pass an array with up to five values in the order `[default, small, medium, large, xlarge]`. To skip a breakpoint, pass `nil`.
|
11
|
+
#
|
12
|
+
# For example:
|
13
|
+
#
|
14
|
+
# ```erb
|
15
|
+
# <%= render Primer::HeadingComponent.new(mt: [0, nil, nil, 4, 2]) do %>
|
16
|
+
# Hello world
|
17
|
+
# <% end %>
|
18
|
+
# ```
|
19
|
+
#
|
20
|
+
# Renders:
|
21
|
+
#
|
22
|
+
# ```html
|
23
|
+
# <h1 class="mt-0 mt-lg-4 mt-xl-2">Hello world</h1>
|
24
|
+
# ```
|
25
|
+
#
|
5
26
|
class BaseComponent < Primer::Component
|
6
27
|
TEST_SELECTOR_TAG = :test_selector
|
7
28
|
|
29
|
+
# @param m [Integer] Margin. <%= one_of((-6..6).to_a) %>
|
30
|
+
# @param mt [Integer] Margin left. <%= one_of((-6..6).to_a) %>
|
31
|
+
# @param mr [Integer] Margin right. <%= one_of((-6..6).to_a) %>
|
32
|
+
# @param mb [Integer] Margin bottom. <%= one_of((-6..6).to_a) %>
|
33
|
+
# @param ml [Integer] Margin left. <%= one_of((-6..6).to_a) %>
|
34
|
+
# @param mx [Integer] Horizontal margins. <%= one_of((-6..6).to_a + [:auto]) %>
|
35
|
+
# @param my [Integer] Vertical margins. <%= one_of((-6..6).to_a) %>
|
36
|
+
# @param m [Integer] Padding. <%= one_of((0..6).to_a) %>
|
37
|
+
# @param mt [Integer] Padding left. <%= one_of((0..6).to_a) %>
|
38
|
+
# @param mr [Integer] Padding right. <%= one_of((0..6).to_a) %>
|
39
|
+
# @param mb [Integer] Padding bottom. <%= one_of((0..6).to_a) %>
|
40
|
+
# @param ml [Integer] Padding left. <%= one_of((0..6).to_a) %>
|
41
|
+
# @param mx [Integer] Horizontal padding. <%= one_of((0..6).to_a) %>
|
42
|
+
# @param my [Integer] Vertical padding. <%= one_of((0..6).to_a) %>
|
8
43
|
#
|
9
|
-
# @
|
10
|
-
# <%= render(Primer::BaseComponent.new(tag: :a, href: "http://www.google.com", mt: 4)) { "Link" } %>
|
44
|
+
# @param position [Symbol] <%= one_of([:relative, :absolute, :fixed]) %>
|
11
45
|
#
|
12
|
-
# @param
|
46
|
+
# @param top [Boolean] If `false`, sets `top: 0`.
|
47
|
+
# @param right [Boolean] If `false`, sets `right: 0`.
|
48
|
+
# @param bottom [Boolean] If `false`, sets `bottom: 0`.
|
49
|
+
# @param left [Boolean] If `false`, sets `left: 0`.
|
50
|
+
#
|
51
|
+
# @param display [Symbol] <%= one_of([:block, :none, :inline, :inline_block, :table, :table_cell]) %>
|
52
|
+
#
|
53
|
+
# @param hide [Symbol] Hide the element at a specific breakpoint. <%= one_of([:sm, :md, :lg, :xl]) %>
|
54
|
+
#
|
55
|
+
# @param vertical_align [Symbol] <%= one_of([:baseline, :top, :middle, :bottom, :text_top, :text_bottom]) %>
|
56
|
+
#
|
57
|
+
# @param float [Symbol] <%= one_of([:left, :right]) %>
|
58
|
+
#
|
59
|
+
# @param font_size [String] <%= one_of(["00", "0", "1", "2", "3", "4", "5", "6"]) %>
|
60
|
+
# @param tag [Symbol] HTML tag name to be passed to `tag.send`
|
13
61
|
# @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes
|
14
|
-
def initialize(tag:, classes: nil, **
|
62
|
+
def initialize(tag:, classes: nil, **system_arguments)
|
15
63
|
@tag = tag
|
16
|
-
@result = Primer::Classify.call(**
|
64
|
+
@result = Primer::Classify.call(**system_arguments.merge(classes: classes))
|
17
65
|
|
18
66
|
# Filter out Primer keys so they don't get assigned as HTML attributes
|
19
|
-
@content_tag_args = add_test_selector(
|
67
|
+
@content_tag_args = add_test_selector(system_arguments).except(*Primer::Classify::VALID_KEYS)
|
20
68
|
end
|
21
69
|
|
22
70
|
def call
|
@@ -56,7 +56,7 @@ module Primer
|
|
56
56
|
# @param title [String] Text that appears in a larger bold font.
|
57
57
|
# @param title_tag [Symbol] HTML tag to use for title.
|
58
58
|
# @param icon [String] Octicon icon to use at top of component.
|
59
|
-
# @param icon_size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS
|
59
|
+
# @param icon_size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS) %>
|
60
60
|
# @param image_src [String] Image to display.
|
61
61
|
# @param image_alt [String] Alt text for image.
|
62
62
|
# @param description [String] Text that appears below the title. Typically a whole sentence.
|
@@ -87,12 +87,12 @@ module Primer
|
|
87
87
|
large: false,
|
88
88
|
spacious: false,
|
89
89
|
|
90
|
-
**
|
90
|
+
**system_arguments
|
91
91
|
)
|
92
|
-
@
|
93
|
-
@
|
94
|
-
@
|
95
|
-
@
|
92
|
+
@system_arguments = system_arguments
|
93
|
+
@system_arguments[:tag] ||= :div
|
94
|
+
@system_arguments[:classes] = class_names(
|
95
|
+
@system_arguments[:classes],
|
96
96
|
"blankslate",
|
97
97
|
"blankslate-narrow": narrow,
|
98
98
|
"blankslate-large": large,
|
@@ -1,25 +1,25 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<% if header %>
|
3
|
-
<%= render Primer::BaseComponent.new(**header.
|
3
|
+
<%= render Primer::BaseComponent.new(**header.system_arguments) do %>
|
4
4
|
<%= header.content %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
7
7
|
<% if body %>
|
8
|
-
<%= render Primer::BaseComponent.new(**body.
|
8
|
+
<%= render Primer::BaseComponent.new(**body.system_arguments) do %>
|
9
9
|
<%= body.content %>
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
<% if rows.any? %>
|
13
13
|
<ul>
|
14
14
|
<% rows.each do |row| %>
|
15
|
-
<%= render Primer::BaseComponent.new(**row.
|
15
|
+
<%= render Primer::BaseComponent.new(**row.system_arguments) do %>
|
16
16
|
<%= row.content %>
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
19
19
|
</ul>
|
20
20
|
<% end %>
|
21
21
|
<% if footer %>
|
22
|
-
<%= render Primer::BaseComponent.new(**footer.
|
22
|
+
<%= render Primer::BaseComponent.new(**footer.system_arguments) do %>
|
23
23
|
<%= footer.content %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
@@ -20,13 +20,13 @@ module Primer
|
|
20
20
|
# component.slot(:footer) { "Footer" }
|
21
21
|
# end %>
|
22
22
|
#
|
23
|
-
# @param
|
24
|
-
def initialize(**
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
23
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
24
|
+
def initialize(**system_arguments)
|
25
|
+
@system_arguments = system_arguments
|
26
|
+
@system_arguments[:tag] = :div
|
27
|
+
@system_arguments[:classes] = class_names(
|
28
28
|
"Box",
|
29
|
-
|
29
|
+
system_arguments[:classes]
|
30
30
|
)
|
31
31
|
end
|
32
32
|
|
@@ -35,53 +35,53 @@ module Primer
|
|
35
35
|
end
|
36
36
|
|
37
37
|
class Header < Primer::Slot
|
38
|
-
attr_reader :
|
39
|
-
# @param
|
40
|
-
def initialize(**
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
38
|
+
attr_reader :system_arguments
|
39
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
40
|
+
def initialize(**system_arguments)
|
41
|
+
@system_arguments = system_arguments
|
42
|
+
@system_arguments[:tag] = :div
|
43
|
+
@system_arguments[:classes] = class_names(
|
44
44
|
"Box-header",
|
45
|
-
|
45
|
+
system_arguments[:classes]
|
46
46
|
)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
class Body < Primer::Slot
|
51
|
-
attr_reader :
|
52
|
-
# @param
|
53
|
-
def initialize(**
|
54
|
-
@
|
55
|
-
@
|
56
|
-
@
|
51
|
+
attr_reader :system_arguments
|
52
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
53
|
+
def initialize(**system_arguments)
|
54
|
+
@system_arguments = system_arguments
|
55
|
+
@system_arguments[:tag] = :div
|
56
|
+
@system_arguments[:classes] = class_names(
|
57
57
|
"Box-body",
|
58
|
-
|
58
|
+
system_arguments[:classes]
|
59
59
|
)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
class Footer < Primer::Slot
|
64
|
-
attr_reader :
|
65
|
-
# @param
|
66
|
-
def initialize(**
|
67
|
-
@
|
68
|
-
@
|
69
|
-
@
|
64
|
+
attr_reader :system_arguments
|
65
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
66
|
+
def initialize(**system_arguments)
|
67
|
+
@system_arguments = system_arguments
|
68
|
+
@system_arguments[:tag] = :div
|
69
|
+
@system_arguments[:classes] = class_names(
|
70
70
|
"Box-footer",
|
71
|
-
|
71
|
+
system_arguments[:classes]
|
72
72
|
)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
class Row < Primer::Slot
|
77
|
-
attr_reader :
|
78
|
-
# @param
|
79
|
-
def initialize(**
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
77
|
+
attr_reader :system_arguments
|
78
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
79
|
+
def initialize(**system_arguments)
|
80
|
+
@system_arguments = system_arguments
|
81
|
+
@system_arguments[:tag] = :li
|
82
|
+
@system_arguments[:classes] = class_names(
|
83
83
|
"Box-row",
|
84
|
-
|
84
|
+
system_arguments[:classes]
|
85
85
|
)
|
86
86
|
end
|
87
87
|
end
|
@@ -3,14 +3,14 @@
|
|
3
3
|
module Primer
|
4
4
|
# A basic wrapper component for most layout related needs.
|
5
5
|
class BoxComponent < Primer::Component
|
6
|
-
# @param
|
7
|
-
def initialize(**
|
8
|
-
@
|
9
|
-
@
|
6
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
7
|
+
def initialize(**system_arguments)
|
8
|
+
@system_arguments = system_arguments
|
9
|
+
@system_arguments[:tag] = :div
|
10
10
|
end
|
11
11
|
|
12
12
|
def call
|
13
|
-
render(Primer::BaseComponent.new(**@
|
13
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<ol>
|
3
3
|
<% items.each do |item| %>
|
4
4
|
<%# The <li> and <a> need to be on the same line to prevent unwanted whitespace %>
|
5
|
-
<%= render Primer::BaseComponent.new(**item.
|
5
|
+
<%= render Primer::BaseComponent.new(**item.system_arguments) do %><%- if item.href.present? %><a href="<%= item.href %>"><%= item.content %></a><%- else %><%= item.content %><%- end %><%- end %>
|
6
6
|
<% end %>
|
7
7
|
</ol>
|
8
8
|
<% end %>
|
@@ -14,11 +14,11 @@ module Primer
|
|
14
14
|
# <% component.slot(:item, selected: true) do %>Team<% end %>
|
15
15
|
# <% end %>
|
16
16
|
#
|
17
|
-
# @param
|
18
|
-
def initialize(**
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
17
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
18
|
+
def initialize(**system_arguments)
|
19
|
+
@system_arguments = system_arguments
|
20
|
+
@system_arguments[:tag] = :nav
|
21
|
+
@system_arguments[:aria] = { label: "Breadcrumb" }
|
22
22
|
end
|
23
23
|
|
24
24
|
def render?
|
@@ -27,18 +27,18 @@ module Primer
|
|
27
27
|
|
28
28
|
# _Note: if both `href` and `selected: true` are passed in, `href` will be ignored and the item will not be rendered as a link._
|
29
29
|
class BreadcrumbItem < Primer::Slot
|
30
|
-
attr_reader :href, :
|
30
|
+
attr_reader :href, :system_arguments
|
31
31
|
|
32
32
|
# @param href [String] The URL to link to.
|
33
33
|
# @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
|
34
|
-
# @param
|
35
|
-
def initialize(href: nil, selected: false, **
|
36
|
-
@href, @
|
34
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
35
|
+
def initialize(href: nil, selected: false, **system_arguments)
|
36
|
+
@href, @system_arguments = href, system_arguments
|
37
37
|
|
38
38
|
@href = nil if selected
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
39
|
+
@system_arguments[:tag] = :li
|
40
|
+
@system_arguments[:"aria-current"] = "page" if selected
|
41
|
+
@system_arguments[:classes] = "breadcrumb-item #{@system_arguments[:classes]}"
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -48,20 +48,20 @@ module Primer
|
|
48
48
|
tag: DEFAULT_TAG,
|
49
49
|
type: DEFAULT_TYPE,
|
50
50
|
group_item: false,
|
51
|
-
**
|
51
|
+
**system_arguments
|
52
52
|
)
|
53
|
-
@
|
54
|
-
@
|
53
|
+
@system_arguments = system_arguments
|
54
|
+
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
55
55
|
|
56
|
-
if @
|
57
|
-
@
|
56
|
+
if @system_arguments[:tag] == :a
|
57
|
+
@system_arguments[:role] = :button
|
58
58
|
else
|
59
|
-
@
|
59
|
+
@system_arguments[:type] = type
|
60
60
|
end
|
61
61
|
|
62
|
-
@
|
62
|
+
@system_arguments[:classes] = class_names(
|
63
63
|
"btn",
|
64
|
-
|
64
|
+
system_arguments[:classes],
|
65
65
|
BUTTON_TYPE_MAPPINGS[fetch_or_fallback(BUTTON_TYPE_OPTIONS, button_type, DEFAULT_BUTTON_TYPE)],
|
66
66
|
VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
|
67
67
|
"BtnGroup-item" => group_item
|
@@ -69,7 +69,7 @@ module Primer
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def call
|
72
|
-
render(Primer::BaseComponent.new(**@
|
72
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -20,7 +20,7 @@ module Primer
|
|
20
20
|
# @param hide_if_zero [Boolean] If true, a `hidden` attribute is added to the counter if `count` is zero.
|
21
21
|
# @param text [String] Text to display instead of count.
|
22
22
|
# @param round [Boolean] Whether to apply our standard rounding logic to value.
|
23
|
-
# @param
|
23
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
24
24
|
def initialize(
|
25
25
|
count: 0,
|
26
26
|
scheme: DEFAULT_SCHEME,
|
@@ -28,23 +28,23 @@ module Primer
|
|
28
28
|
hide_if_zero: false,
|
29
29
|
text: "",
|
30
30
|
round: false,
|
31
|
-
**
|
31
|
+
**system_arguments
|
32
32
|
)
|
33
|
-
@count, @limit, @hide_if_zero, @text, @round, @
|
33
|
+
@count, @limit, @hide_if_zero, @text, @round, @system_arguments = count, limit, hide_if_zero, text, round, system_arguments
|
34
34
|
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
35
|
+
@system_arguments[:title] = title
|
36
|
+
@system_arguments[:tag] = :span
|
37
|
+
@system_arguments[:classes] = class_names(
|
38
|
+
@system_arguments[:classes],
|
39
39
|
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME)]
|
40
40
|
)
|
41
41
|
if count == 0 && hide_if_zero
|
42
|
-
@
|
42
|
+
@system_arguments[:hidden] = true
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def call
|
47
|
-
render(Primer::BaseComponent.new(**@
|
47
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { value }
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|