primer_view_components 0.0.15 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -0
  3. data/app/components/primer/avatar_component.rb +24 -6
  4. data/app/components/primer/avatar_stack_component.html.erb +10 -0
  5. data/app/components/primer/avatar_stack_component.rb +81 -0
  6. data/app/components/primer/base_component.rb +8 -4
  7. data/app/components/primer/blankslate_component.html.erb +4 -4
  8. data/app/components/primer/blankslate_component.rb +34 -8
  9. data/app/components/primer/border_box_component.rb +29 -13
  10. data/app/components/primer/box_component.rb +10 -0
  11. data/app/components/primer/breadcrumb_component.rb +3 -2
  12. data/app/components/primer/button_component.rb +3 -3
  13. data/app/components/primer/button_group_component.html.erb +5 -0
  14. data/app/components/primer/button_group_component.rb +37 -0
  15. data/app/components/primer/button_marketing_component.rb +73 -0
  16. data/app/components/primer/component.rb +13 -0
  17. data/app/components/primer/counter_component.rb +16 -9
  18. data/app/components/primer/details_component.rb +10 -6
  19. data/app/components/primer/dropdown/menu_component.html.erb +12 -0
  20. data/app/components/primer/dropdown/menu_component.rb +48 -0
  21. data/app/components/primer/dropdown_component.html.erb +9 -0
  22. data/app/components/primer/dropdown_component.rb +77 -0
  23. data/app/components/primer/dropdown_menu_component.rb +35 -3
  24. data/app/components/primer/flash_component.rb +10 -7
  25. data/app/components/primer/flex_component.rb +47 -9
  26. data/app/components/primer/flex_item_component.rb +16 -1
  27. data/app/components/primer/heading_component.rb +7 -0
  28. data/app/components/primer/label_component.rb +6 -6
  29. data/app/components/primer/layout_component.rb +2 -2
  30. data/app/components/primer/link_component.rb +7 -3
  31. data/app/components/primer/markdown_component.rb +293 -0
  32. data/app/components/primer/menu_component.html.erb +6 -0
  33. data/app/components/primer/menu_component.rb +71 -0
  34. data/app/components/primer/octicon_component.rb +11 -6
  35. data/app/components/primer/popover_component.rb +6 -4
  36. data/app/components/primer/progress_bar_component.rb +9 -9
  37. data/app/components/primer/slot.rb +1 -0
  38. data/app/components/primer/spinner_component.rb +10 -7
  39. data/app/components/primer/state_component.rb +6 -6
  40. data/app/components/primer/subhead_component.rb +6 -3
  41. data/app/components/primer/text_component.rb +1 -1
  42. data/app/components/primer/timeline_item_component.rb +4 -1
  43. data/app/components/primer/tooltip_component.rb +88 -0
  44. data/app/components/primer/truncate_component.rb +41 -0
  45. data/app/components/primer/underline_nav_component.rb +26 -1
  46. data/app/components/primer/view_components.rb +9 -0
  47. data/lib/primer/class_name_helper.rb +1 -0
  48. data/lib/primer/classify.rb +139 -107
  49. data/lib/primer/classify/cache.rb +125 -0
  50. data/lib/primer/fetch_or_fallback_helper.rb +9 -0
  51. data/lib/primer/join_style_arguments_helper.rb +14 -0
  52. data/lib/primer/view_components.rb +32 -0
  53. data/lib/primer/view_components/engine.rb +1 -0
  54. data/lib/primer/view_components/version.rb +1 -1
  55. data/lib/yard/renders_many_handler.rb +19 -0
  56. data/lib/yard/renders_one_handler.rb +19 -0
  57. data/static/statuses.json +1 -0
  58. metadata +80 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2957082e3fcbcfe88a4bed4f13c1dd8e46971a4792f4e4539cf396293d2b753
4
- data.tar.gz: 0cfc136341d4b04c8602851085131fb35eea924439c8b577081993e2540e4992
3
+ metadata.gz: dbf044be0f96f8b0e1e7e7f3d06b6e1c6a5a9171b87ae19eb6ba4034724567db
4
+ data.tar.gz: 116e2fedfe01623fb65cde89990f6988c9ccc557702c73428dd48c6a199ecf0f
5
5
  SHA512:
6
- metadata.gz: ba13e8bb5fab035a22483269d350ede659f95a36feaf07031c88076750c2ec9775bf3f8a34e65807dfdf5b874a3ba9efb0cdfdfafefcbaa22bef0f55b98e86ee
7
- data.tar.gz: d9c0d1615202ddc1f0a193a8555812cb97ad1f371df7e8ed2ce66ee2899f41a266af10d3e9eda205d187fb0e20f154a82034bda8e5f732c48ec17ab0cee9c9ac
6
+ metadata.gz: d114ba5fb5d3ff3d18f77d709befab2b9a6eb86a3f1abdc8bffb613af25e66874972d69e6aaabae553007c61cee947c46d7c37db75b504fe5fd49dd1f95d933a
7
+ data.tar.gz: 53cf3366dc7d0bebe8c0754ec411317da160a3cc549d0bfe02616ef4ed769a05e2d4a244be7c5038fcacf2626a232fb998af0ad340f19eda58306c6d0469b89b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,84 @@
2
2
 
3
3
  ## main
4
4
 
5
+ ## 0.0.20
6
+
7
+ * Fix bug when empty string was passed to Classify.
8
+
9
+ *Manuel Puyol*
10
+
11
+ ## 0.0.19
12
+
13
+ * Add support for functional colors to `color` system argument.
14
+
15
+ *Jake Shorty
16
+
17
+ * Add `AvatarStack`, `Dropdown`, `Markdown` and `Menu` components.
18
+
19
+ *Manuel Puyol*
20
+
21
+ * Deprecate `DropdownMenuComponent`.
22
+
23
+ *Manuel Puyol*
24
+
25
+ * Fix `Avatar` bug when used with links.
26
+
27
+ *Manuel Puyol*
28
+
29
+ * Add cache for common Primer values.
30
+
31
+ *Blake Williams*
32
+
33
+ * Add support for `octicons_helper` v12.
34
+
35
+ *Cole Bemis*
36
+
37
+ * Add support for `border: true` to apply the `border` class.
38
+
39
+ *Simon Taranto*
40
+
41
+ * Promote `Avatar`, `Link`, and `Counter` components to beta.
42
+
43
+ *Simon Taranto*
44
+
45
+ * **Breaking change**: Drop support for Ruby 2.4.
46
+
47
+ *Simon Taranto*
48
+
49
+ ## 0.0.18
50
+
51
+ * Add `border_radius` system argument.
52
+
53
+ *Ash Guillaume*
54
+
55
+ * Add `animation` system argument.
56
+
57
+ *Manuel Puyol*
58
+
59
+ * Add `Truncate`, `ButtonGroup` and `ButtonMarketing` components.
60
+
61
+ *Manuel Puyol*
62
+
63
+ * Add `Tooltip` component.
64
+
65
+ *Simon Taranto*
66
+
67
+ ## 0.0.17
68
+
69
+ * Ensure all components support inline styles.
70
+
71
+ *Joel Hawksley*
72
+
73
+ ## 0.0.16
74
+
75
+ * Adding a `spinner` slot to the `BlankslateComponent` that uses the `SpinnerComponent` added in `0.0.10`.
76
+
77
+ *Jon Rohan*
78
+
79
+ * Bumping node engine to version `15.x`
80
+
81
+ *Jon Rohan*
82
+
5
83
  ## 0.0.15
6
84
 
7
85
  * Add ability to disable `limit` on Counter.
@@ -7,15 +7,23 @@ module Primer
7
7
  class AvatarComponent < Primer::Component
8
8
  SMALL_THRESHOLD = 24
9
9
 
10
- #
11
- # @example 34|Default
10
+ # @example auto|Default
12
11
  # <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
13
12
  #
13
+ # @example auto|Square
14
+ # <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser", square: true)) %>
15
+ #
16
+ # @example auto|Link
17
+ # <%= render(Primer::AvatarComponent.new(href: "#", src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
18
+ #
14
19
  # @param src [String] The source url of the avatar image
15
20
  # @param alt [String] Passed through to alt on img tag
16
21
  # @param size [Integer] Adds the avatar-small class if less than 24
17
22
  # @param square [Boolean] Used to create a square avatar.
18
- def initialize(src:, alt:, size: 20, square: false, **system_arguments)
23
+ # @param href [String] The URL to link to. If used, component will be wrapped by an `<a>` tag
24
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
25
+ def initialize(src:, alt:, size: 20, square: false, href: nil, **system_arguments)
26
+ @href = href
19
27
  @system_arguments = system_arguments
20
28
  @system_arguments[:tag] = :img
21
29
  @system_arguments[:src] = src
@@ -25,15 +33,25 @@ module Primer
25
33
  @system_arguments[:width] = size
26
34
 
27
35
  @system_arguments[:classes] = class_names(
28
- "avatar",
29
36
  system_arguments[:classes],
37
+ "avatar" => !href,
30
38
  "avatar--small" => size < SMALL_THRESHOLD,
31
- "CircleBadge" => !square
39
+ "circle" => !square
32
40
  )
33
41
  end
34
42
 
35
43
  def call
36
- render(Primer::BaseComponent.new(**@system_arguments)) { content }
44
+ if @href
45
+ render(Primer::LinkComponent.new(href: @href, classes: "avatar")) do
46
+ render(Primer::BaseComponent.new(**@system_arguments)) { content }
47
+ end
48
+ else
49
+ render(Primer::BaseComponent.new(**@system_arguments)) { content }
50
+ end
51
+ end
52
+
53
+ def self.status
54
+ Primer::Component::STATUSES[:beta]
37
55
  end
38
56
  end
39
57
  end
@@ -0,0 +1,10 @@
1
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
+ <%= render body_component do %>
3
+ <% avatars.each_with_index do |avatar, i| %>
4
+ <% if i == 2 %>
5
+ <div class="avatar avatar-more"></div>
6
+ <% end %>
7
+ <%= avatar %>
8
+ <% end %>
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # Use AvatarStack to stack multiple avatars together.
5
+ class AvatarStackComponent < Primer::Component
6
+ include ViewComponent::SlotableV2
7
+
8
+ ALIGN_DEFAULT = :left
9
+ ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
10
+
11
+ # Required list of stacked avatars.
12
+ #
13
+ # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::AvatarComponent) %>.
14
+ renders_many :avatars, Primer::AvatarComponent
15
+
16
+ # @example auto|Default
17
+ # <%= render(Primer::AvatarStackComponent.new) do |c| %>
18
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
19
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
20
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
21
+ # <% end %>
22
+ #
23
+ # @example auto|Align right
24
+ # <%= render(Primer::AvatarStackComponent.new(align: :right)) do |c| %>
25
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
26
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
27
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
28
+ # <% end %>
29
+ #
30
+ # @example auto|With tooltip
31
+ # <%= render(Primer::AvatarStackComponent.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |c| %>
32
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
33
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
34
+ # <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
35
+ # <% end %>
36
+ #
37
+ # @param align [Symbol] <%= one_of(Primer::AvatarStackComponent::ALIGN_OPTIONS) %>
38
+ # @param tooltipped [Boolean] Whether to add a tooltip to the stack or not.
39
+ # @param body_arguments [Hash] Parameters to add to the Body. If `tooltipped` is set, has the same arguments as <%= link_to_component(Primer::TooltipComponent) %>.
40
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
41
+ def initialize(align: ALIGN_DEFAULT, tooltipped: false, body_arguments: {}, **system_arguments)
42
+ @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT)
43
+ @system_arguments = system_arguments
44
+ @tooltipped = tooltipped
45
+ @body_arguments = body_arguments
46
+
47
+ @body_arguments[:tag] ||= :div
48
+ @body_arguments[:classes] = class_names(
49
+ "AvatarStack-body",
50
+ @body_arguments[:classes]
51
+ )
52
+
53
+ @system_arguments[:tag] ||= :div
54
+ @system_arguments[:classes] = class_names(
55
+ "AvatarStack",
56
+ system_arguments[:classes],
57
+ "AvatarStack--right" => @align == :right
58
+ )
59
+ end
60
+
61
+ def body_component
62
+ if @tooltipped
63
+ Primer::TooltipComponent.new(**@body_arguments)
64
+ else
65
+ Primer::BaseComponent.new(**@body_arguments)
66
+ end
67
+ end
68
+
69
+ def before_render
70
+ @system_arguments[:classes] = class_names(
71
+ @system_arguments[:classes],
72
+ "AvatarStack--two" => avatars.size == 2,
73
+ "AvatarStack--three-plus" => avatars.size > 2
74
+ )
75
+ end
76
+
77
+ def render?
78
+ avatars.any?
79
+ end
80
+ end
81
+ end
@@ -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
@@ -61,7 +62,7 @@ module Primer
61
62
  # @param bottom [Boolean] If `false`, sets `bottom: 0`.
62
63
  # @param left [Boolean] If `false`, sets `left: 0`.
63
64
  #
64
- # @param display [Symbol] <%= one_of([:block, :none, :inline, :inline_block, :table, :table_cell]) %>
65
+ # @param display [Symbol] <%= one_of([:none, :block, :flex, :inline, :inline_block, :table, :table_cell]) %>
65
66
  #
66
67
  # @param v [Symbol] Visibility. <%= one_of([:hidden, :visible]) %>
67
68
  #
@@ -75,16 +76,17 @@ module Primer
75
76
  #
76
77
  # @param underline [Boolean] Whether text should be underlined.
77
78
  #
78
- # @param color [Symbol] Text color. <%= one_of([:blue, :red, :gray_light, :gray, :gray_dark, :green, :orange, :orange_light, :purple, :pink, :white, :inherit]) %> Note: this API is subject to change as we move to functional colors.
79
+ # @param color [Symbol] Text color. <%= one_of([:blue, :red, :gray_light, :gray, :gray_dark, :green, :orange, :orange_light, :purple, :pink, :white, :inherit, :text_primary, :text_secondary, :text_tertiary, :text_link, :text_success, :text_warning, :text_danger, :icon_primary, :icon_secondary, :icon_tertiary, :icon_info, :icon_success, :icon_warning, :icon_danger]) %>
79
80
  # @param bg [String, Symbol] Background color. Accepts either a hex value as a String or a color name as a Symbol.
80
81
  #
81
82
  # @param box_shadow [Boolean, Symbol] Box shadow. <%= one_of([true, :medium, :large, :extra_large, :none]) %>
82
- # @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x]) %>
83
+ # @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x, true]) %>
83
84
  # @param border_color [Symbol] <%= one_of([:blue, :blue_light, :gray, :gray_dark, :green, :purple, :red, :red_light, :white, :yellow, :black_fade]) %> Note: this API is subject to change as we move to functional colors.
84
85
  # @param border_top [Integer] Set to `0` to remove the top border.
85
86
  # @param border_bottom [Integer] Set to `0` to remove the bottom border.
86
87
  # @param border_left [Integer] Set to `0` to remove the left border.
87
88
  # @param border_right [Integer] Set to `0` to remove the right border.
89
+ # @param border_radius [Integer] <%= one_of([0, 1, 2, 3]) %>
88
90
  #
89
91
  # @param font_size [String, Integer] <%= one_of(["00", 0, 1, 2, 3, 4, 5, 6]) %>
90
92
  # @param text_align [Symbol] Text alignment. <%= one_of([:left, :right, :center]) %>
@@ -101,6 +103,8 @@ module Primer
101
103
  #
102
104
  # @param word_break [Symbol] Whether to break words on line breaks. Can only be `:break_all`.
103
105
  #
106
+ # @param animation [Symbol] <%= one_of([:fade_in, :fade_out, :fade_up, :fade_down, :scale_in, :pulse, :grow_x, :grow]) %>
107
+ #
104
108
  # @param tag [Symbol] HTML tag name to be passed to `tag.send`.
105
109
  # @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes.
106
110
  def initialize(tag:, classes: nil, **system_arguments)
@@ -112,7 +116,7 @@ module Primer
112
116
  end
113
117
 
114
118
  def call
115
- content_tag(@tag, content, **@content_tag_args.merge(@result))
119
+ content_tag(@tag, content, @content_tag_args.merge(@result))
116
120
  end
117
121
 
118
122
  private
@@ -1,13 +1,13 @@
1
1
  <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
- <% if @icon.present? %>
2
+ <% if spinner.present? %>
3
+ <%= render spinner.component %>
4
+ <% elsif @icon.present? %>
3
5
  <%= render(Primer::OcticonComponent.new(
4
6
  icon: @icon,
5
7
  size: @icon_size,
6
8
  classes: "blankslate-icon"
7
9
  )) %>
8
- <% end %>
9
-
10
- <% if @image_src.present? && @image_alt.present? %>
10
+ <% elsif @image_src.present? && @image_alt.present? %>
11
11
  <%= image_tag "#{@image_src}", class: "mb-3", size: "56x56", alt: "#{@image_alt}" %>
12
12
  <% end %>
13
13
 
@@ -3,28 +3,40 @@
3
3
  module Primer
4
4
  # Use Primer::BlankslateComponent when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
5
5
  class BlankslateComponent < Primer::Component
6
+ include ViewComponent::Slotable
7
+
8
+ with_slot :spinner, class_name: "Spinner"
9
+
6
10
  #
7
- # @example 150|Basic
11
+ # @example auto|Basic
8
12
  # <%= render Primer::BlankslateComponent.new(
9
13
  # title: "Title",
10
14
  # description: "Description",
11
15
  # ) %>
12
16
  #
13
- # @example 190|Icon|Add an `icon` to give additional context. Refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
17
+ # @example auto|Icon|Add an `icon` to give additional context. Refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
14
18
  # <%= render Primer::BlankslateComponent.new(
15
19
  # icon: "octoface",
16
20
  # title: "Title",
17
21
  # description: "Description",
18
22
  # ) %>
19
23
  #
20
- # @example 150|Custom content|Pass custom content as a block in place of `description`.
24
+ # @example auto|Loading|Add a [SpinnerComponent](https://primer.style/view-components/components/spinner) to the blankslate in place of an icon.
25
+ # <%= render Primer::BlankslateComponent.new(
26
+ # title: "Title",
27
+ # description: "Description",
28
+ # ) do |component| %>
29
+ # <% component.slot(:spinner, size: :large) %>
30
+ # <% end %>
31
+ #
32
+ # @example auto|Custom content|Pass custom content as a block in place of `description`.
21
33
  # <%= render Primer::BlankslateComponent.new(
22
34
  # title: "Title",
23
35
  # ) do %>
24
36
  # <em>Your custom content here</em>
25
37
  # <% end %>
26
38
  #
27
- # @example 270|Action button|Provide a button to guide users to take action from the blankslate. The button appears below the description and custom content.
39
+ # @example auto|Action button|Provide a button to guide users to take action from the blankslate. The button appears below the description and custom content.
28
40
  # <%= render Primer::BlankslateComponent.new(
29
41
  # icon: "book",
30
42
  # title: "Welcome to the mona wiki!",
@@ -34,7 +46,7 @@ module Primer
34
46
  # button_url: "https://github.com/monalisa/mona/wiki/_new",
35
47
  # ) %>
36
48
  #
37
- # @example 225|Link|Add an additional link to help users learn more about a feature. The link will be shown at the very bottom:
49
+ # @example auto|Link|Add an additional link to help users learn more about a feature. The link will be shown at the very bottom:
38
50
  # <%= render Primer::BlankslateComponent.new(
39
51
  # icon: "book",
40
52
  # title: "Welcome to the mona wiki!",
@@ -43,7 +55,7 @@ module Primer
43
55
  # link_url: "https://docs.github.com/en/github/building-a-strong-community/about-wikis",
44
56
  # ) %>
45
57
  #
46
- # @example 340|Variations|There are a few variations of how the Blankslate appears: `narrow` adds a maximum width, `large` increases the font size, and `spacious` adds extra padding.
58
+ # @example auto|Variations|There are a few variations of how the Blankslate appears: `narrow` adds a maximum width, `large` increases the font size, and `spacious` adds extra padding.
47
59
  # <%= render Primer::BlankslateComponent.new(
48
60
  # icon: "book",
49
61
  # title: "Welcome to the mona wiki!",
@@ -82,7 +94,7 @@ module Primer
82
94
  link_text: "",
83
95
  link_url: "",
84
96
 
85
- #variations
97
+ # variations
86
98
  narrow: false,
87
99
  large: false,
88
100
  spacious: false,
@@ -96,7 +108,7 @@ module Primer
96
108
  "blankslate",
97
109
  "blankslate-narrow": narrow,
98
110
  "blankslate-large": large,
99
- "blankslate-spacious": spacious,
111
+ "blankslate-spacious": spacious
100
112
  )
101
113
 
102
114
  @title_tag = title_tag
@@ -112,5 +124,19 @@ module Primer
112
124
  @link_text = link_text
113
125
  @link_url = link_url
114
126
  end
127
+
128
+ # :nodoc:
129
+ class Spinner < Primer::Slot
130
+ # @param size [Symbol] <%= one_of(Primer::SpinnerComponent::SIZE_MAPPINGS) %>
131
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
132
+ def initialize(**system_arguments)
133
+ @system_arguments = system_arguments
134
+ @system_arguments[:mb] ||= 3
135
+ end
136
+
137
+ def component
138
+ Primer::SpinnerComponent.new(**@system_arguments)
139
+ end
140
+ end
115
141
  end
116
142
  end
@@ -10,30 +10,43 @@ module Primer
10
10
  with_slot :footer, class_name: "Footer"
11
11
  with_slot :row, collection: true, class_name: "Row"
12
12
 
13
- # @example 350|Header, body, rows, and footer
14
- # <%= render(Primer::BorderBoxComponent.new) do |component|
15
- # component.slot(:header) { "Header" }
16
- # component.slot(:body) { "Body" }
17
- # component.slot(:row) { "Row one" }
18
- # component.slot(:row) { "Row two" }
19
- # component.slot(:row) { "Row three" }
20
- # component.slot(:footer) { "Footer" }
21
- # end %>
13
+ # @example auto|Header, body, rows, and footer
14
+ # <%= render(Primer::BorderBoxComponent.new) do |component| %>
15
+ # <% component.slot(:header) do %>
16
+ # Header
17
+ # <% end %>
18
+ # <% component.slot(:body) do %>
19
+ # Body
20
+ # <% end %>
21
+ # <% component.slot(:row) do %>
22
+ # <% if true %>
23
+ # Row one
24
+ # <% end %>
25
+ # <% end %>
26
+ # <% component.slot(:row) do %>
27
+ # Row two
28
+ # <% end %>
29
+ # <% component.slot(:footer) do %>
30
+ # Footer
31
+ # <% end %>
32
+ # <% end %>
22
33
  #
23
34
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
24
35
  def initialize(**system_arguments)
25
36
  @system_arguments = system_arguments
26
37
  @system_arguments[:tag] = :div
27
- @system_arguments[:classes] = class_names(
28
- "Box",
29
- system_arguments[:classes]
30
- )
38
+ @system_arguments[:classes] = class_names("Box", system_arguments[:classes])
31
39
  end
32
40
 
33
41
  def render?
34
42
  rows.any? || header.present? || body.present? || footer.present?
35
43
  end
36
44
 
45
+ def self.status
46
+ Primer::Component::STATUSES[:beta]
47
+ end
48
+
49
+ # :nodoc:
37
50
  class Header < Primer::Slot
38
51
  attr_reader :system_arguments
39
52
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -47,6 +60,7 @@ module Primer
47
60
  end
48
61
  end
49
62
 
63
+ # :nodoc:
50
64
  class Body < Primer::Slot
51
65
  attr_reader :system_arguments
52
66
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -60,6 +74,7 @@ module Primer
60
74
  end
61
75
  end
62
76
 
77
+ # :nodoc:
63
78
  class Footer < Primer::Slot
64
79
  attr_reader :system_arguments
65
80
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -73,6 +88,7 @@ module Primer
73
88
  end
74
89
  end
75
90
 
91
+ # :nodoc:
76
92
  class Row < Primer::Slot
77
93
  attr_reader :system_arguments
78
94
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>