primer_view_components 0.0.39 → 0.0.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +269 -3
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/components/primer/alpha/button_marketing.rb +70 -0
  6. data/app/components/primer/auto_complete.rb +99 -41
  7. data/app/components/primer/auto_complete/auto_complete.html.erb +1 -0
  8. data/app/components/primer/avatar_stack_component.rb +7 -4
  9. data/app/components/primer/base_component.rb +17 -7
  10. data/app/components/primer/beta/text.rb +27 -0
  11. data/app/components/primer/blankslate_component.html.erb +1 -0
  12. data/app/components/primer/blankslate_component.rb +68 -49
  13. data/app/components/primer/button_component.rb +3 -2
  14. data/app/components/primer/button_group.rb +2 -2
  15. data/app/components/primer/clipboard_copy_component.js +13 -2
  16. data/app/components/primer/clipboard_copy_component.ts +15 -2
  17. data/app/components/primer/component.rb +6 -1
  18. data/app/components/primer/counter_component.rb +6 -1
  19. data/app/components/primer/details_component.rb +12 -1
  20. data/app/components/primer/dropdown.d.ts +1 -0
  21. data/app/components/primer/{dropdown_component.html.erb → dropdown.html.erb} +2 -1
  22. data/app/components/primer/dropdown.js +1 -0
  23. data/app/components/primer/dropdown.rb +149 -0
  24. data/app/components/primer/dropdown.ts +1 -0
  25. data/app/components/primer/dropdown/menu.d.ts +1 -0
  26. data/app/components/primer/dropdown/menu.html.erb +25 -0
  27. data/app/components/primer/dropdown/menu.js +1 -0
  28. data/app/components/primer/dropdown/menu.rb +99 -0
  29. data/app/components/primer/dropdown/menu.ts +1 -0
  30. data/app/components/primer/flash_component.rb +2 -2
  31. data/app/components/primer/flex_component.rb +27 -0
  32. data/app/components/primer/flex_item_component.rb +1 -1
  33. data/app/components/primer/heading_component.rb +11 -18
  34. data/app/components/primer/hidden_text_expander.rb +3 -3
  35. data/app/components/primer/icon_button.rb +20 -3
  36. data/app/components/primer/image.rb +46 -0
  37. data/app/components/primer/image_crop.d.ts +1 -0
  38. data/app/components/primer/image_crop.html.erb +12 -0
  39. data/app/components/primer/image_crop.js +1 -0
  40. data/app/components/primer/image_crop.rb +36 -0
  41. data/app/components/primer/image_crop.ts +1 -0
  42. data/app/components/primer/label_component.rb +6 -2
  43. data/app/components/primer/local_time.d.ts +1 -0
  44. data/app/components/primer/local_time.js +1 -0
  45. data/app/components/primer/local_time.rb +59 -0
  46. data/app/components/primer/local_time.ts +1 -0
  47. data/app/components/primer/{markdown_component.rb → markdown.rb} +11 -6
  48. data/app/components/primer/navigation/tab_component.rb +10 -3
  49. data/app/components/primer/octicon_component.html.erb +7 -0
  50. data/app/components/primer/octicon_component.rb +25 -15
  51. data/app/components/primer/octicon_symbols_component.html.erb +3 -0
  52. data/app/components/primer/octicon_symbols_component.rb +61 -0
  53. data/app/components/primer/primer.d.ts +3 -0
  54. data/app/components/primer/primer.js +3 -0
  55. data/app/components/primer/primer.ts +3 -0
  56. data/app/components/primer/spinner_component.rb +4 -2
  57. data/app/components/primer/subhead_component.rb +34 -4
  58. data/app/components/primer/tab_nav_component.html.erb +5 -1
  59. data/app/components/primer/tab_nav_component.rb +62 -9
  60. data/app/components/primer/{tooltip_component.rb → tooltip.rb} +10 -8
  61. data/app/components/primer/truncate.rb +6 -2
  62. data/app/components/primer/underline_nav_component.html.erb +1 -1
  63. data/app/components/primer/underline_nav_component.rb +17 -1
  64. data/app/lib/primer/classify.rb +21 -8
  65. data/app/lib/primer/classify/cache.rb +16 -1
  66. data/app/lib/primer/classify/grid.rb +45 -0
  67. data/app/lib/primer/octicon/cache.rb +4 -0
  68. data/app/lib/primer/tabbed_component_helper.rb +2 -2
  69. data/app/lib/primer/view_helper.rb +2 -1
  70. data/lib/primer/view_components.rb +1 -1
  71. data/lib/primer/view_components/engine.rb +2 -0
  72. data/lib/primer/view_components/linters.rb +3 -0
  73. data/lib/primer/view_components/linters/argument_mappers/button.rb +82 -0
  74. data/lib/primer/view_components/linters/argument_mappers/conversion_error.rb +10 -0
  75. data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +46 -0
  76. data/lib/primer/view_components/linters/button_component_migration_counter.rb +35 -0
  77. data/lib/primer/view_components/linters/flash_component_migration_counter.rb +16 -0
  78. data/lib/primer/view_components/linters/helpers.rb +93 -0
  79. data/lib/primer/view_components/version.rb +1 -1
  80. data/lib/tasks/coverage.rake +14 -0
  81. data/lib/tasks/docs.rake +387 -0
  82. data/lib/tasks/statuses.rake +12 -0
  83. data/lib/yard/docs_helper.rb +67 -0
  84. data/static/statuses.json +56 -1
  85. metadata +72 -13
  86. data/app/components/primer/button_marketing_component.rb +0 -68
  87. data/app/components/primer/dropdown/menu_component.html.erb +0 -12
  88. data/app/components/primer/dropdown/menu_component.rb +0 -46
  89. data/app/components/primer/dropdown_component.rb +0 -73
  90. data/app/components/primer/text_component.rb +0 -22
@@ -0,0 +1 @@
1
+ import './dropdown/menu';
@@ -1,6 +1,7 @@
1
1
  <%= render(Primer::DetailsComponent.new(**@system_arguments)) do |c| %>
2
- <% c.summary(classes: @summary_classes) do %>
2
+ <% c.summary(**@button_arguments) do %>
3
3
  <%= button %>
4
+ <% if @with_caret %><div class="dropdown-caret"></div><% end %>
4
5
  <% end %>
5
6
 
6
7
  <% c.body do %>
@@ -0,0 +1 @@
1
+ import './dropdown/menu';
@@ -0,0 +1,149 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # `Dropdown` is a lightweight context menu for housing navigation and actions.
5
+ # They're great for instances where you don't need the full power (and code) of the SelectMenu.
6
+ class Dropdown < Primer::Component
7
+ # Required trigger for the dropdown. Has the same arguments as <%= link_to_component(Primer::ButtonComponent) %>,
8
+ # but it is locked as a `summary` tag.
9
+ renders_one :button, lambda { |**system_arguments, &block|
10
+ @button_arguments = system_arguments
11
+ @button_arguments[:button] = true
12
+
13
+ view_context.capture { block&.call }
14
+ }
15
+
16
+ # Required context menu for the dropdown.
17
+ #
18
+ # @param as [Symbol] When `as` is `:list`, wraps the menu in a `<ul>` with a `<li>` for each item.
19
+ # @param direction [Symbol] <%= one_of(Primer::Dropdown::Menu::DIRECTION_OPTIONS) %>
20
+ # @param scheme [Symbol] Pass `:dark` for dark mode theming
21
+ # @param header [String] Optional string to display as the header
22
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
23
+ renders_one :menu, "Primer::Dropdown::Menu"
24
+
25
+ # @example Default
26
+ # <%= render(Primer::Dropdown.new) do |c| %>
27
+ # <% c.button do %>
28
+ # Dropdown
29
+ # <% end %>
30
+ #
31
+ # <%= c.menu(header: "Options") do |menu|
32
+ # menu.item { "Item 1" }
33
+ # menu.item { "Item 2" }
34
+ # menu.item { "Item 3" }
35
+ # end %>
36
+ # <% end %>
37
+ #
38
+ # @example With dividers
39
+ #
40
+ # @description
41
+ # Dividers can be used to separate a group of items. They don't have any content.
42
+ # @code
43
+ # <%= render(Primer::Dropdown.new) do |c| %>
44
+ # <% c.button do %>
45
+ # Dropdown
46
+ # <% end %>
47
+ #
48
+ # <%= c.menu(header: "Options") do |menu|
49
+ # menu.item { "Item 1" }
50
+ # menu.item { "Item 2" }
51
+ # menu.item(divider: true)
52
+ # menu.item { "Item 3" }
53
+ # menu.item { "Item 4" }
54
+ # menu.item(divider: true)
55
+ # menu.item { "Item 5" }
56
+ # menu.item { "Item 6" }
57
+ # end %>
58
+ # <% end %>
59
+ #
60
+ # @example With direction
61
+ # <%= render(Primer::Dropdown.new(display: :inline_block)) do |c| %>
62
+ # <% c.button do %>
63
+ # Dropdown
64
+ # <% end %>
65
+ #
66
+ # <%= c.menu(header: "Options", direction: :s) do |menu|
67
+ # menu.item { "Item 1" }
68
+ # menu.item { "Item 2" }
69
+ # menu.item { "Item 3" }
70
+ # menu.item { "Item 4" }
71
+ # end %>
72
+ # <% end %>
73
+ #
74
+ # @example With caret
75
+ # <%= render(Primer::Dropdown.new(with_caret: true)) do |c| %>
76
+ # <% c.button do %>
77
+ # Dropdown
78
+ # <% end %>
79
+ #
80
+ # <%= c.menu(header: "Options") do |menu|
81
+ # menu.item { "Item 1" }
82
+ # menu.item { "Item 2" }
83
+ # menu.item { "Item 3" }
84
+ # menu.item { "Item 4" }
85
+ # end %>
86
+ # <% end %>
87
+ #
88
+ # @example Customizing the button
89
+ # <%= render(Primer::Dropdown.new) do |c| %>
90
+ # <% c.button(scheme: :primary, variant: :small) do %>
91
+ # Dropdown
92
+ # <% end %>
93
+ #
94
+ # <%= c.menu(header: "Options") do |menu|
95
+ # menu.item { "Item 1" }
96
+ # menu.item { "Item 2" }
97
+ # menu.item { "Item 3" }
98
+ # menu.item { "Item 4" }
99
+ # end %>
100
+ # <% end %>
101
+ #
102
+ # @example Menu as list
103
+ # <%= render(Primer::Dropdown.new) do |c| %>
104
+ # <% c.button do %>
105
+ # Dropdown
106
+ # <% end %>
107
+ #
108
+ # <%= c.menu(as: :list, header: "Options") do |menu|
109
+ # menu.item { "Item 1" }
110
+ # menu.item { "Item 2" }
111
+ # menu.item(divider: true)
112
+ # menu.item { "Item 3" }
113
+ # menu.item { "Item 4" }
114
+ # end %>
115
+ # <% end %>
116
+ #
117
+ # @example Customizing menu items
118
+ # <%= render(Primer::Dropdown.new) do |c| %>
119
+ # <% c.button do %>
120
+ # Dropdown
121
+ # <% end %>
122
+ #
123
+ # <%= c.menu(header: "Options") do |menu|
124
+ # menu.item(tag: :button) { "Item 1" }
125
+ # menu.item(classes: "custom-class") { "Item 2" }
126
+ # menu.item { "Item 3" }
127
+ # end %>
128
+ # <% end %>
129
+ #
130
+ # @param overlay [Symbol] <%= one_of(Primer::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
131
+ # @param with_caret [Boolean] Whether or not a caret should be rendered in the button.
132
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
133
+ def initialize(overlay: :default, with_caret: false, **system_arguments)
134
+ @with_caret = with_caret
135
+
136
+ @system_arguments = system_arguments
137
+ @system_arguments[:overlay] = overlay
138
+ @system_arguments[:reset] = true
139
+ @system_arguments[:classes] = class_names(
140
+ @system_arguments[:classes],
141
+ "dropdown"
142
+ )
143
+ end
144
+
145
+ def render?
146
+ button.present? && menu.present?
147
+ end
148
+ end
149
+ end
@@ -0,0 +1 @@
1
+ import './dropdown/menu'
@@ -0,0 +1 @@
1
+ import '@github/details-menu-element';
@@ -0,0 +1,25 @@
1
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
+ <% if @header.present? %>
3
+ <div class="dropdown-header">
4
+ <%= @header %>
5
+ </div>
6
+ <% end %>
7
+
8
+ <% if list? %>
9
+ <ul>
10
+ <% items.each do |item| %>
11
+ <% if item.divider? %>
12
+ <%= item %>
13
+ <% else %>
14
+ <li>
15
+ <%= item %>
16
+ </li>
17
+ <% end %>
18
+ <% end %>
19
+ </ul>
20
+ <% else %>
21
+ <% items.each do |item| %>
22
+ <%= item %>
23
+ <% end %>
24
+ <% end %>
25
+ <% end %>
@@ -0,0 +1 @@
1
+ import '@github/details-menu-element';
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ class Dropdown
5
+ # This component is part of `Dropdown` and should not be
6
+ # used as a standalone component.
7
+ class Menu < Primer::Component
8
+ AS_DEFAULT = :default
9
+ AS_OPTIONS = [AS_DEFAULT, :list].freeze
10
+
11
+ SCHEME_DEFAULT = :default
12
+ SCHEME_MAPPINGS = {
13
+ SCHEME_DEFAULT => "",
14
+ :dark => "dropdown-menu-dark"
15
+ }.freeze
16
+
17
+ DIRECTION_DEFAULT = :se
18
+ DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
19
+
20
+ # @param tag [Symbol] <%= one_of(Primer::Dropdown::Menu::Item::TAG_OPTIONS) %>.
21
+ # @param divider [Boolean] Whether the item is a divider without any function.
22
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
23
+ renders_many :items, lambda { |divider: false, **system_arguments|
24
+ Primer::Dropdown::Menu::Item.new(as: @as, divider: divider, **system_arguments)
25
+ }
26
+
27
+ # @param as [Symbol] When `as` is `:list`, wraps the menu in a `<ul>` with a `<li>` for each item.
28
+ # @param direction [Symbol] <%= one_of(Primer::Dropdown::Menu::DIRECTION_OPTIONS) %>.
29
+ # @param header [String] Header to be displayed above the menu.
30
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
31
+ def initialize(as: AS_DEFAULT, direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments)
32
+ @header = header
33
+ @direction = direction
34
+ @as = fetch_or_fallback(AS_OPTIONS, as, AS_DEFAULT)
35
+
36
+ @system_arguments = system_arguments
37
+ @system_arguments[:tag] = "details-menu"
38
+ @system_arguments[:role] = "menu"
39
+
40
+ @system_arguments[:classes] = class_names(
41
+ @system_arguments[:classes],
42
+ "dropdown-menu",
43
+ "dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}",
44
+ SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)]
45
+ )
46
+ end
47
+
48
+ private
49
+
50
+ def list?
51
+ @as == :list
52
+ end
53
+
54
+ # Items to be rendered in the `Dropdown` menu.
55
+ class Item < Primer::Component
56
+ TAG_DEFAULT = :a
57
+ BUTTON_TAGS = [:button, :summary].freeze
58
+ TAG_OPTIONS = [TAG_DEFAULT, *BUTTON_TAGS].freeze
59
+
60
+ def initialize(as:, tag: TAG_DEFAULT, divider: false, **system_arguments)
61
+ @divider = divider
62
+ @as = as
63
+
64
+ @system_arguments = system_arguments
65
+ @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT)
66
+ @system_arguments[:tag] = :li if list? && divider?
67
+ @system_arguments[:role] ||= :menuitem
68
+ @system_arguments[:role] = :separator if divider
69
+ @system_arguments[:classes] = class_names(
70
+ @system_arguments[:classes],
71
+ "dropdown-item" => !divider,
72
+ "dropdown-divider" => divider
73
+ )
74
+ end
75
+
76
+ def call
77
+ component = if BUTTON_TAGS.include?(@system_arguments[:tag])
78
+ Primer::ButtonComponent.new(scheme: :link, **@system_arguments)
79
+ else
80
+ Primer::BaseComponent.new(**@system_arguments)
81
+ end
82
+
83
+ # divider has no content
84
+ render(component) if divider?
85
+
86
+ render(component) { content }
87
+ end
88
+
89
+ def divider?
90
+ @divider
91
+ end
92
+
93
+ def list?
94
+ @as == :list
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1 @@
1
+ import '@github/details-menu-element'
@@ -35,7 +35,7 @@ module Primer
35
35
  # <%= render(Primer::FlashComponent.new(dismissible: true)) { "This is a dismissible flash message!" } %>
36
36
  #
37
37
  # @example Icon
38
- # <%= render(Primer::FlashComponent.new(icon: "people")) { "This is a flash message with an icon!" } %>
38
+ # <%= render(Primer::FlashComponent.new(icon: :people)) { "This is a flash message with an icon!" } %>
39
39
  #
40
40
  # @example With actions
41
41
  # <%= render(Primer::FlashComponent.new) do |component| %>
@@ -48,7 +48,7 @@ module Primer
48
48
  # @param full [Boolean] Whether the component should take up the full width of the screen.
49
49
  # @param spacious [Boolean] Whether to add margin to the bottom of the component.
50
50
  # @param dismissible [Boolean] Whether the component can be dismissed with an X button.
51
- # @param icon [String] Name of Octicon icon to use.
51
+ # @param icon [Symbol] Name of Octicon icon to use.
52
52
  # @param scheme [Symbol] <%= one_of(Primer::FlashComponent::SCHEME_MAPPINGS.keys) %>
53
53
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
54
54
  def initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments)
@@ -5,7 +5,32 @@ module Primer
5
5
  # Before using these utilities, you should be familiar with CSS3 Flexible Box
6
6
  # spec. If you are not, check out MDN's guide [Using CSS Flexible
7
7
  # Boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox).
8
+ #
9
+ # @deprecated
10
+ # Use <%= link_to_component(Primer::BoxComponent) %> instead.
11
+ #
12
+ # **Before**:
13
+ #
14
+ # ```erb
15
+ # <%%= render Primer::FlexComponent.new(justify_content: :center) %>
16
+ # <%%= render Primer::FlexComponent.new(inline: true) %>
17
+ # <%%= render Primer::FlexComponent.new(flex_wrap: true) %>
18
+ # <%%= render Primer::FlexComponent.new(align_items: :start) %>
19
+ # <%%= render Primer::FlexComponent.new(direction: :column) %>
20
+ # ```
21
+ #
22
+ # **After**:
23
+ #
24
+ # ```erb
25
+ # <%%= render Primer::BoxComponent.new(display: :flex, justify_content: :center) %>
26
+ # <%%= render Primer::BoxComponent.new(display: :inline_flex) %>
27
+ # <%%= render Primer::BoxComponent.new(display: :flex, flex_wrap: :wrap) %>
28
+ # <%%= render Primer::BoxComponent.new(display: :flex, align_items: :start) %>
29
+ # <%%= render Primer::BoxComponent.new(display: :flex, direction: :column) %>
30
+ # ```
8
31
  class FlexComponent < Primer::Component
32
+ status :deprecated
33
+
9
34
  JUSTIFY_CONTENT_DEFAULT = nil
10
35
  JUSTIFY_CONTENT_MAPPINGS = {
11
36
  flex_start: "flex-justify-start",
@@ -77,6 +102,8 @@ module Primer
77
102
  direction: nil,
78
103
  **system_arguments
79
104
  )
105
+ deprecated_component_warning(new_class: Primer::BoxComponent, version: "0.0.40")
106
+
80
107
  @align_items = fetch_or_fallback(ALIGN_ITEMS_OPTIONS, align_items, ALIGN_ITEMS_DEFAULT)
81
108
  @justify_content = fetch_or_fallback(JUSTIFY_CONTENT_OPTIONS, justify_content, JUSTIFY_CONTENT_DEFAULT)
82
109
  @flex_wrap = fetch_or_fallback(FLEX_WRAP_OPTIONS, flex_wrap, FLEX_WRAP_DEFAULT)
@@ -38,7 +38,7 @@ module Primer
38
38
  # @param flex_auto [Boolean] Fills available space and auto-sizes based on the content. Defaults to <%= Primer::FlexItemComponent::FLEX_AUTO_DEFAULT %>
39
39
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
40
40
  def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
41
- deprecated_component_warning(new_class: Primer::BoxComponent, version: "0.0.39")
41
+ deprecated_component_warning(new_class: Primer::BoxComponent, version: "0.0.40")
42
42
 
43
43
  @system_arguments = system_arguments
44
44
  @system_arguments[:classes] =
@@ -1,20 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- # `Heading` can be used to communicate page organization and hierarchy.
4
+ # `Heading` should be used to communicate page organization and hierarchy.
5
5
  #
6
- # - Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is
7
- # appropriate for the page context.
6
+ # - Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is appropriate for the page context.
8
7
  # - Use `Heading` as the title of a section or sub section.
9
- # - Do not use `Heading` for styling alone. To style text without conveying heading semantics,
10
- # consider using <%= link_to_component(Primer::TextComponent) %> with relevant <%= link_to_typography_docs %>.
11
- # - Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should
12
- # increase by one in ascending order.
8
+ # - Do not use `Heading` for styling alone. For simply styling text, consider using <%= link_to_component(Primer::Beta::Text) %> with relevant <%= link_to_typography_docs %>
9
+ # such as `font_size` and `font_weight`.
10
+ # - Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should increase by one in ascending order.
13
11
  #
14
12
  # @accessibility
15
- # Headings convey semantic meaning. Assistive technology users rely on headings to quickly navigate and scan information on a page.
16
- # Inappropriate use of headings can lead to a confusing experience.
17
- # [Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)
13
+ # While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.
14
+ # When text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be
15
+ # consistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)
16
+ #
17
+ # Headings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.
18
+ # <%= link_to_heading_practices %>
18
19
  class HeadingComponent < Primer::Component
19
20
  status :beta
20
21
 
@@ -29,14 +30,6 @@ module Primer
29
30
  # <%= render(Primer::HeadingComponent.new(tag: :h5)) { "H5 Text" } %>
30
31
  # <%= render(Primer::HeadingComponent.new(tag: :h6)) { "H6 Text" } %>
31
32
  #
32
- # @example With `font_size`
33
- # <%= render(Primer::HeadingComponent.new(tag: :h1, font_size: 6)) { "h1 tag, font_size 6" } %>
34
- # <%= render(Primer::HeadingComponent.new(tag: :h2, font_size: 3)) { "h2 tag, font_size 3" } %>
35
- # <%= render(Primer::HeadingComponent.new(tag: :h3, font_size: 2)) { "h3 tag, font_size 2" } %>
36
- # <%= render(Primer::HeadingComponent.new(tag: :h4, font_size: 0)) { "h4 tag, font_size 0" } %>
37
- # <%= render(Primer::HeadingComponent.new(tag: :h5, font_size: 1)) { "h5 tag, font_size 1" } %>
38
- # <%= render(Primer::HeadingComponent.new(tag: :h6, font_size: 4)) { "h6 tag, font_size 4" } %>
39
- #
40
33
  # @param tag [String] <%= one_of(Primer::HeadingComponent::TAG_OPTIONS) %>
41
34
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
42
35
  def initialize(tag:, **system_arguments)
@@ -10,14 +10,14 @@ module Primer
10
10
  # <%= render(Primer::HiddenTextExpander.new(inline: true)) %>
11
11
  #
12
12
  # @example Styling the button
13
- # <%= render(Primer::HiddenTextExpander.new(button_arguments: { p: 1, classes: "my-custom-class" })) %>
13
+ # <%= render(Primer::HiddenTextExpander.new(button_arguments: { p: 1, classes: "custom-class" })) %>
14
14
  #
15
15
  # @param inline [Boolean] Whether or not the expander is inline.
16
16
  # @param button_arguments [Hash] <%= link_to_system_arguments_docs %> for the button element.
17
17
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
18
18
  def initialize(inline: false, button_arguments: {}, **system_arguments)
19
19
  @system_arguments = system_arguments
20
- @system_arguments[:tag] ||= :span
20
+ @system_arguments[:tag] = :span
21
21
  @system_arguments[:classes] = class_names(
22
22
  "hidden-text-expander",
23
23
  @system_arguments[:classes],
@@ -34,7 +34,7 @@ module Primer
34
34
 
35
35
  def call
36
36
  render(Primer::BaseComponent.new(**@system_arguments)) do
37
- render(Primer::BaseButton.new(**@button_arguments)) { "&hellip;" }
37
+ render(Primer::BaseButton.new(**@button_arguments)) { "&hellip;".html_safe }
38
38
  end
39
39
  end
40
40
  end