primer_view_components 0.0.23 → 0.0.24
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 +14 -0
- data/app/components/primer/breadcrumb_component.html.erb +1 -2
- data/app/components/primer/breadcrumb_component.rb +23 -12
- data/app/components/primer/component.rb +1 -1
- data/app/components/primer/progress_bar_component.html.erb +1 -1
- data/app/components/primer/progress_bar_component.rb +23 -27
- data/app/lib/primer/view_helper/dsl.rb +2 -2
- data/lib/primer/view_components/version.rb +1 -1
- data/static/statuses.json +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: fbd4dec44b8225065e2087b90d0e1fb26c9a883635129c2161c3feaf6a72decc
|
4
|
+
data.tar.gz: b441554ed718efc5d0884a7cabcc05c1aba7ad07e1eb269c4772a11dc7baeff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b5aa5fb510b720756782bde172a510c039c0a5907f1225a433d4ff39eeea9ad92149fe9ba473796dfd33997650c9a791171e16e451925038316c20f0df9079
|
7
|
+
data.tar.gz: 6b0dc8e39581f66a08689206ada93f1791f14b26f3b5ac851e340ba403ad1fdeec9bb26d6d37c04c5f3d25d924c2d4ceb7eb0df60fc5e0e6322c9c507bf2fcae
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
## main
|
4
|
+
|
5
|
+
## 0.0.24
|
6
|
+
|
7
|
+
* Fix zeitwerk autoload integration.
|
8
|
+
|
9
|
+
*Manuel Puyol*
|
10
|
+
|
11
|
+
* **Breaking change**: Upgrade `ProgressBarComponent` to use Slots V2.
|
12
|
+
|
13
|
+
*Simon Taranto*
|
14
|
+
|
15
|
+
* **Breaking change**: Upgrade `BreadcrumbComponent` to use Slots V2.
|
16
|
+
|
17
|
+
*Manuel Puyol*
|
4
18
|
|
5
19
|
## 0.0.23
|
6
20
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<ol>
|
3
3
|
<% items.each do |item| %>
|
4
|
-
|
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 %>
|
4
|
+
<%= item %>
|
6
5
|
<% end %>
|
7
6
|
</ol>
|
8
7
|
<% end %>
|
@@ -3,15 +3,20 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use breadcrumbs to display page hierarchy within a section of the site. All of the items in the breadcrumb "trail" are links except for the final item, which is a plain string indicating the current page.
|
5
5
|
class BreadcrumbComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
-
|
8
|
+
# _Note: if both `href` and `selected: true` are passed in, `href` will be ignored and the item will not be rendered as a link._
|
9
|
+
#
|
10
|
+
# @param href [String] The URL to link to.
|
11
|
+
# @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
|
12
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
13
|
+
renders_many :items, "ItemComponent"
|
9
14
|
|
10
15
|
# @example Basic
|
11
16
|
# <%= render(Primer::BreadcrumbComponent.new) do |component| %>
|
12
|
-
# <% component.
|
13
|
-
# <% component.
|
14
|
-
# <% component.
|
17
|
+
# <% component.item(href: "/") do %>Home<% end %>
|
18
|
+
# <% component.item(href: "/about") do %>About<% end %>
|
19
|
+
# <% component.item(selected: true) do %>Team<% end %>
|
15
20
|
# <% end %>
|
16
21
|
#
|
17
22
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -25,13 +30,9 @@ module Primer
|
|
25
30
|
items.any?
|
26
31
|
end
|
27
32
|
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# @param href [String] The URL to link to.
|
33
|
-
# @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
|
34
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
33
|
+
# This component is part of `Primer::BreadcrumbComponent` and should not be
|
34
|
+
# used as a standalone component.
|
35
|
+
class ItemComponent < Primer::Component
|
35
36
|
def initialize(href: nil, selected: false, **system_arguments)
|
36
37
|
@href = href
|
37
38
|
@system_arguments = system_arguments
|
@@ -41,6 +42,16 @@ module Primer
|
|
41
42
|
@system_arguments[:"aria-current"] = "page" if selected
|
42
43
|
@system_arguments[:classes] = "breadcrumb-item #{@system_arguments[:classes]}"
|
43
44
|
end
|
45
|
+
|
46
|
+
def call
|
47
|
+
render(Primer::BaseComponent.new(**@system_arguments)) do
|
48
|
+
if @href.present?
|
49
|
+
render(Primer::LinkComponent.new(href: @href)) { content }
|
50
|
+
else
|
51
|
+
content
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
44
55
|
end
|
45
56
|
end
|
46
57
|
end
|
@@ -3,9 +3,24 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use ProgressBar to visualize task completion.
|
5
5
|
class ProgressBarComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
-
|
8
|
+
# Use the Item slot to add an item to the progress bas
|
9
|
+
#
|
10
|
+
# @param percentage [Integer] The percent complete
|
11
|
+
# @param bg [Symbol] The background color
|
12
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
13
|
+
renders_many :items, lambda { |percentage: 0, bg: :green, **system_arguments|
|
14
|
+
percentage = percentage
|
15
|
+
system_arguments = system_arguments
|
16
|
+
|
17
|
+
system_arguments[:tag] = :span
|
18
|
+
system_arguments[:bg] = bg
|
19
|
+
system_arguments[:style] = join_style_arguments(system_arguments[:style], "width: #{percentage}%;")
|
20
|
+
system_arguments[:classes] = class_names("Progress-item", system_arguments[:classes])
|
21
|
+
|
22
|
+
Primer::BaseComponent.new(**system_arguments)
|
23
|
+
}
|
9
24
|
|
10
25
|
SIZE_DEFAULT = :default
|
11
26
|
|
@@ -18,24 +33,24 @@ module Primer
|
|
18
33
|
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
19
34
|
# @example Default
|
20
35
|
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
21
|
-
# <% component.
|
36
|
+
# <% component.item(percentage: 25) %>
|
22
37
|
# <% end %>
|
23
38
|
#
|
24
39
|
# @example Small
|
25
40
|
# <%= render(Primer::ProgressBarComponent.new(size: :small)) do |component| %>
|
26
|
-
# <% component.
|
41
|
+
# <% component.item(bg: :blue_4, percentage: 50) %>
|
27
42
|
# <% end %>
|
28
43
|
#
|
29
44
|
# @example Large
|
30
45
|
# <%= render(Primer::ProgressBarComponent.new(size: :large)) do |component| %>
|
31
|
-
# <% component.
|
46
|
+
# <% component.item(bg: :red_4, percentage: 75) %>
|
32
47
|
# <% end %>
|
33
48
|
#
|
34
49
|
# @example Multiple items
|
35
50
|
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
36
|
-
# <% component.
|
37
|
-
# <% component.
|
38
|
-
# <% component.
|
51
|
+
# <% component.item(percentage: 10) %>
|
52
|
+
# <% component.item(bg: :blue_4, percentage: 20) %>
|
53
|
+
# <% component.item(bg: :red_4, percentage: 30) %>
|
39
54
|
# <% end %>
|
40
55
|
#
|
41
56
|
# @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
|
@@ -53,24 +68,5 @@ module Primer
|
|
53
68
|
def render?
|
54
69
|
items.any?
|
55
70
|
end
|
56
|
-
|
57
|
-
# :nodoc:
|
58
|
-
class Item < Primer::Slot
|
59
|
-
attr_reader :system_arguments
|
60
|
-
|
61
|
-
# @param percentage [Integer] Percentage completion of item.
|
62
|
-
# @param bg [Symbol] Color of item.
|
63
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
64
|
-
def initialize(percentage: 0, bg: :green, **system_arguments)
|
65
|
-
@percentage = percentage
|
66
|
-
@system_arguments = system_arguments
|
67
|
-
|
68
|
-
@system_arguments[:tag] = :span
|
69
|
-
@system_arguments[:bg] = bg
|
70
|
-
@system_arguments[:style] =
|
71
|
-
join_style_arguments(@system_arguments[:style], "width: #{@percentage}%;")
|
72
|
-
@system_arguments[:classes] = class_names("Progress-item", @system_arguments[:classes])
|
73
|
-
end
|
74
|
-
end
|
75
71
|
end
|
76
72
|
end
|
@@ -10,10 +10,10 @@ module Primer
|
|
10
10
|
# Example:
|
11
11
|
#
|
12
12
|
# class MyComponent < ViewComponent::Base
|
13
|
-
# include Primer::ViewHelper::
|
13
|
+
# include Primer::ViewHelper::Dsl
|
14
14
|
# view_helper :my_component
|
15
15
|
# end
|
16
|
-
module
|
16
|
+
module Dsl
|
17
17
|
extend ActiveSupport::Concern
|
18
18
|
|
19
19
|
class ViewHelperAlreadyDefined < StandardError; end
|
data/static/statuses.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"alpha","Primer::BaseComponent":"alpha","Primer::BlankslateComponent":"alpha","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"alpha","Primer::ButtonComponent":"alpha","Primer::ButtonGroupComponent":"alpha","Primer::ButtonMarketingComponent":"alpha","Primer::CounterComponent":"beta","Primer::DetailsComponent":"alpha","Primer::Dropdown::MenuComponent":"alpha","Primer::DropdownComponent":"alpha","Primer::DropdownMenuComponent":"deprecated","Primer::FlashComponent":"beta","Primer::FlexComponent":"alpha","Primer::FlexItemComponent":"alpha","Primer::HeadingComponent":"alpha","Primer::LabelComponent":"beta","Primer::LayoutComponent":"alpha","Primer::LinkComponent":"beta","Primer::MarkdownComponent":"alpha","Primer::MenuComponent":"alpha","Primer::OcticonComponent":"beta","Primer::PopoverComponent":"alpha","Primer::ProgressBarComponent":"alpha","Primer::SpinnerComponent":"beta","Primer::StateComponent":"beta","Primer::SubheadComponent":"alpha","Primer::TabContainerComponent":"alpha","Primer::TabNavComponent":"alpha","Primer::TabNavComponent::TabComponent":"alpha","Primer::TextComponent":"alpha","Primer::TimelineItemComponent":"alpha","Primer::TimelineItemComponent::BadgeComponent":"alpha","Primer::TooltipComponent":"alpha","Primer::TruncateComponent":"alpha","Primer::UnderlineNavComponent":"alpha"}
|
1
|
+
{"Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"alpha","Primer::BaseComponent":"alpha","Primer::BlankslateComponent":"alpha","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"alpha","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"alpha","Primer::ButtonGroupComponent":"alpha","Primer::ButtonMarketingComponent":"alpha","Primer::CounterComponent":"beta","Primer::DetailsComponent":"alpha","Primer::Dropdown::MenuComponent":"alpha","Primer::DropdownComponent":"alpha","Primer::DropdownMenuComponent":"deprecated","Primer::FlashComponent":"beta","Primer::FlexComponent":"alpha","Primer::FlexItemComponent":"alpha","Primer::HeadingComponent":"alpha","Primer::LabelComponent":"beta","Primer::LayoutComponent":"alpha","Primer::LinkComponent":"beta","Primer::MarkdownComponent":"alpha","Primer::MenuComponent":"alpha","Primer::OcticonComponent":"beta","Primer::PopoverComponent":"alpha","Primer::ProgressBarComponent":"alpha","Primer::SpinnerComponent":"beta","Primer::StateComponent":"beta","Primer::SubheadComponent":"alpha","Primer::TabContainerComponent":"alpha","Primer::TabNavComponent":"alpha","Primer::TabNavComponent::TabComponent":"alpha","Primer::TextComponent":"alpha","Primer::TimelineItemComponent":"alpha","Primer::TimelineItemComponent::BadgeComponent":"alpha","Primer::TooltipComponent":"alpha","Primer::TruncateComponent":"alpha","Primer::UnderlineNavComponent":"alpha"}
|
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.24
|
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-03-
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octicons_helper
|