primer_view_components 0.0.16 → 0.0.17
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/app/components/primer/base_component.rb +1 -0
- data/app/components/primer/component.rb +1 -0
- data/app/components/primer/flash_component.rb +1 -3
- data/app/components/primer/link_component.rb +1 -1
- data/app/components/primer/popover_component.rb +1 -1
- data/app/components/primer/progress_bar_component.rb +3 -3
- data/app/components/primer/slot.rb +1 -0
- data/app/components/primer/spinner_component.rb +2 -2
- data/app/components/primer/view_components.rb +1 -0
- data/lib/primer/fetch_or_fallback_helper.rb +8 -0
- data/lib/primer/join_style_arguments_helper.rb +13 -0
- data/lib/primer/view_components/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70daa13e7909487e01c01f4759a88740922070c985ac9604df738614d48c57a1
|
4
|
+
data.tar.gz: 257383c54d408d94c8aac723804a1db9b75dee88527f60ce101f70514259567c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65bef1719944f20523e8670d382474fa15a49cd03eab6a39578ad3901933668c3d2bcfdff9da7e46ba9fdac8587447b92984a6e4c67028732f9ba2f18dc9cf52
|
7
|
+
data.tar.gz: b578660620dc448087463fd24361c652a8fd9ead88cd6693a658af94f497eb68361e3236cb43386da66f58666c72051d5728bb67b4be6c832ee815c54f59e4c8
|
data/CHANGELOG.md
CHANGED
@@ -34,6 +34,7 @@ module Primer
|
|
34
34
|
# | `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |
|
35
35
|
# | `aria` | `Hash` | Aria attributes: `aria: { label: "foo" }` renders `aria-label='foo'`. |
|
36
36
|
# | `title` | `String` | The `title` attribute. |
|
37
|
+
# | `style` | `String` | Inline styles. |
|
37
38
|
# | `hidden` | `Boolean` | Whether to assign the `hidden` attribute. |
|
38
39
|
class BaseComponent < Primer::Component
|
39
40
|
TEST_SELECTOR_TAG = :test_selector
|
@@ -57,9 +57,7 @@ module Primer
|
|
57
57
|
@system_arguments[:mb] ||= spacious ? 4 : nil
|
58
58
|
end
|
59
59
|
|
60
|
-
class Actions <
|
61
|
-
include ClassNameHelper
|
62
|
-
|
60
|
+
class Actions < Primer::Slot
|
63
61
|
attr_reader :system_arguments
|
64
62
|
|
65
63
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -18,7 +18,7 @@ module Primer
|
|
18
18
|
@system_arguments[:href] = href
|
19
19
|
@system_arguments[:classes] = class_names(
|
20
20
|
@system_arguments[:classes],
|
21
|
-
"muted-link" =>
|
21
|
+
"muted-link" => fetch_or_fallback_boolean(muted, false)
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
@@ -57,7 +57,7 @@ module Primer
|
|
57
57
|
body.present?
|
58
58
|
end
|
59
59
|
|
60
|
-
class Heading <
|
60
|
+
class Heading < Primer::Slot
|
61
61
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
62
62
|
def initialize(**system_arguments)
|
63
63
|
@system_arguments = system_arguments
|
@@ -55,8 +55,7 @@ module Primer
|
|
55
55
|
items.any?
|
56
56
|
end
|
57
57
|
|
58
|
-
class Item <
|
59
|
-
include ClassNameHelper
|
58
|
+
class Item < Primer::Slot
|
60
59
|
attr_reader :system_arguments
|
61
60
|
|
62
61
|
# @param percentage [Integer] Percentage completion of item.
|
@@ -68,7 +67,8 @@ module Primer
|
|
68
67
|
|
69
68
|
@system_arguments[:tag] = :span
|
70
69
|
@system_arguments[:bg] = bg
|
71
|
-
@system_arguments[:style] =
|
70
|
+
@system_arguments[:style] =
|
71
|
+
join_style_arguments(@system_arguments[:style], "width: #{@percentage}%;")
|
72
72
|
@system_arguments[:classes] = class_names("Progress-item", @system_arguments[:classes])
|
73
73
|
end
|
74
74
|
end
|
@@ -26,14 +26,14 @@ module Primer
|
|
26
26
|
# <%= render(Primer::SpinnerComponent.new(size: :large)) %>
|
27
27
|
#
|
28
28
|
# @param size [Symbol] <%= one_of(Primer::SpinnerComponent::SIZE_MAPPINGS) %>
|
29
|
-
def initialize(size: DEFAULT_SIZE,
|
29
|
+
def initialize(size: DEFAULT_SIZE, **system_arguments)
|
30
30
|
@system_arguments = system_arguments
|
31
31
|
@system_arguments[:tag] = :svg
|
32
|
+
@system_arguments[:style] ||= DEFAULT_STYLE
|
32
33
|
@system_arguments[:width] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
|
33
34
|
@system_arguments[:height] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
|
34
35
|
@system_arguments[:viewBox] = "0 0 16 16"
|
35
36
|
@system_arguments[:fill] = :none
|
36
|
-
@system_arguments[:style] = DEFAULT_STYLE unless style.nil?
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module JoinStyleArgumentsHelper
|
5
|
+
# Join two `style` arguments
|
6
|
+
#
|
7
|
+
# join_style_arguments("width: 100%", "height: 100%") =>
|
8
|
+
# "width: 100%;height: 100%"
|
9
|
+
def join_style_arguments(*args)
|
10
|
+
args.compact.join(";")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
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.17
|
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: 2020-
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/primer/class_name_helper.rb
|
238
238
|
- lib/primer/classify.rb
|
239
239
|
- lib/primer/fetch_or_fallback_helper.rb
|
240
|
+
- lib/primer/join_style_arguments_helper.rb
|
240
241
|
- lib/primer/view_components.rb
|
241
242
|
- lib/primer/view_components/engine.rb
|
242
243
|
- lib/primer/view_components/version.rb
|