primer_view_components 0.0.30 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -0
  3. data/README.md +2 -2
  4. data/app/components/primer/auto_complete_component.rb +1 -1
  5. data/app/components/primer/auto_complete_item_component.rb +1 -1
  6. data/app/components/primer/avatar_stack_component.rb +1 -1
  7. data/app/components/primer/base_component.rb +115 -85
  8. data/app/components/primer/blankslate_component.html.erb +1 -1
  9. data/app/components/primer/blankslate_component.rb +0 -2
  10. data/app/components/primer/border_box_component.rb +0 -2
  11. data/app/components/primer/breadcrumb_component.rb +0 -1
  12. data/app/components/primer/button_component.rb +13 -11
  13. data/app/components/primer/button_group_component.rb +3 -5
  14. data/app/components/primer/button_marketing_component.rb +12 -12
  15. data/app/components/primer/component.rb +3 -0
  16. data/app/components/primer/details_component.rb +0 -1
  17. data/app/components/primer/dropdown/menu_component.rb +0 -2
  18. data/app/components/primer/dropdown_component.rb +1 -3
  19. data/app/components/primer/dropdown_menu_component.rb +1 -1
  20. data/app/components/primer/flash_component.html.erb +2 -2
  21. data/app/components/primer/flash_component.rb +10 -12
  22. data/app/components/primer/layout_component.rb +0 -2
  23. data/app/components/primer/link_component.rb +9 -9
  24. data/app/components/primer/menu_component.rb +2 -4
  25. data/app/components/primer/navigation/tab_component.html.erb +11 -0
  26. data/app/components/primer/navigation/tab_component.rb +126 -0
  27. data/app/components/primer/octicon_component.rb +5 -8
  28. data/app/components/primer/popover_component.rb +19 -3
  29. data/app/components/primer/progress_bar_component.rb +0 -1
  30. data/app/components/primer/spinner_component.html.erb +1 -3
  31. data/app/components/primer/spinner_component.rb +1 -0
  32. data/app/components/primer/state_component.rb +13 -13
  33. data/app/components/primer/subhead_component.rb +1 -3
  34. data/app/components/primer/tab_nav_component.html.erb +8 -10
  35. data/app/components/primer/tab_nav_component.rb +63 -76
  36. data/app/components/primer/time_ago_component.rb +2 -1
  37. data/app/components/primer/timeline_item_component.rb +1 -2
  38. data/app/components/primer/underline_nav_component.html.erb +19 -7
  39. data/app/components/primer/underline_nav_component.rb +114 -16
  40. data/app/lib/primer/classify.rb +5 -14
  41. data/app/lib/primer/classify/cache.rb +14 -4
  42. data/app/lib/primer/classify/spacing.rb +63 -0
  43. data/app/lib/primer/tabbed_component_helper.rb +39 -0
  44. data/app/lib/primer/view_helper.rb +2 -2
  45. data/lib/primer/view_components/version.rb +1 -1
  46. data/static/statuses.json +1 -1
  47. metadata +83 -22
  48. data/app/components/primer/slot.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a17e4735cb2057fb6c76458ff5cfdd4b833aeb4f6a7de14c4e6fbc3a556e010
4
- data.tar.gz: 7677caa7f8f052b51d983eb8581e198f7daff976c3793015b811c9edf48ed891
3
+ metadata.gz: d70eee70c97f320cb4708c39c1e2d6f53dc001fd2e0f0bc8fa2c83a0e1faf97b
4
+ data.tar.gz: 3326a41fbcfafdf23247769e7fac8ceedaf21fdb047470e38390560db6267778
5
5
  SHA512:
6
- metadata.gz: 600e505c9cdcc74243127140de5b5f5a6ff634ba6946d653f3473982b2affc2f343c78bc9f9d8913165b15f2986a9ffe16b174c694e8943f041c9b58814a04ae
7
- data.tar.gz: 25828e4691fed95aa5b9eb8401ecdbea09d6248f5ee7521402fbf9c84bb81f542df5108c785270496604ce48f0d086d964271ff2f12662aebbbced19fa364509
6
+ metadata.gz: a1e87c126d6bb647e24a95b8b3b8be6042bc3eef7ca8412573a4619d2bc9bcc2942cdac4269a7a6c1984037327f14ea1a1fcaa343d970c95d5dd269d65f9ff8e
7
+ data.tar.gz: f6d1ecc686b02448b9f6b201c5de79898a8bbc79e588d849b49dfa956111d8b589a437eb03d8ae6ae0a4aafe757028efafb1c40dc217c7bb0132400a7169ec4a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,84 @@
2
2
 
3
3
  ## main
4
4
 
5
+ ## 0.0.35
6
+
7
+ * Promote `AutoCompleteComponent`, `AutoCompleteItemComponent`, `AvatarStackComponent` and `ButtonComponent` to beta.
8
+
9
+ *Manuel Puyol*
10
+
11
+ * Allow `UnderlineNav` tabs to be rendered as a `<ul><li>` list.
12
+
13
+ *Manuel Puyol*
14
+
15
+ * _Accessibility:_ Don't add tab roles when `UnderlineNav` or `TabNav` use link redirects.
16
+
17
+ *Manuel Puyol*
18
+
19
+ * **Breaking change**: Make `label` required for `UnderlineNav` and `TabNav`.
20
+
21
+ *Manuel Puyol*
22
+
23
+ ## 0.0.34
24
+
25
+ * Add `p: :responsive` and `m: :auto` system arguments.
26
+
27
+ *Manuel Puyol*
28
+
29
+ * Remove `my: :auto` and negative `m:` system arguments.
30
+
31
+ *Manuel Puyol*
32
+
33
+ * **Breaking change**: Rename `FlashComponent` `variant` argument to `scheme`.
34
+
35
+ *Manuel Puyol*
36
+
37
+ * **Breaking change**: Rename `LinkComponent` `variant` argument to `scheme`.
38
+
39
+ *Manuel Puyol*
40
+
41
+ * **Breaking change**: Rename `ButtonComponent` `button_type` argument to `scheme`.
42
+
43
+ *Manuel Puyol*
44
+
45
+ * **Breaking change**: Rename `ButtonMarketingComponent` `button_type` argument to `scheme`.
46
+
47
+ *Manuel Puyol*
48
+
49
+ * **Breaking change**: Rename `StateComponent` `color` argument to `scheme`.
50
+
51
+ *Manuel Puyol*
52
+
53
+ ## 0.0.33
54
+
55
+ * Remove `TabbedComponent` validation requiring a tab to be selected.
56
+
57
+ *Manuel Puyol*
58
+
59
+ ## 0.0.32
60
+
61
+ * Allow passing the icon name as a positional argument to `OcticonComponent`.
62
+
63
+ *Manuel Puyol*
64
+
65
+ * Promote `TimeAgoComponent` to beta.
66
+
67
+ *Manuel Puyol*
68
+
69
+ * **Breaking change**: Update `TabNav#tab` API to accept the tab content as a block and panel content as a slot.
70
+
71
+ *Manuel Puyol*
72
+
73
+ * **Breaking change**: Update `UnderlineNavComponent` API be more strict and support `TabContainer`.
74
+
75
+ *Manuel Puyol*
76
+
77
+ ## 0.0.31
78
+
79
+ * Fix `Popover` bug where body was only returning the last line of the HTML.
80
+
81
+ *Manuel Puyol, Blake Williams*
82
+
5
83
  ## 0.0.30
6
84
 
7
85
  * Make `color:`, `bg:` and `border_color:` accept string values.
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
- <img width="300px" src="/static/assets/readme-components.png">
2
+ <img width="300px" src="/static/assets/view-components.svg">
3
3
  </p>
4
4
 
5
5
  <h1 align="center">Primer ViewComponents</h1>
6
6
 
7
7
  <p align="center">ViewComponents for the Primer Design System</p>
8
8
 
9
- _Note: This library is in pre-release development and should not be considered stable._
9
+ _Note: This library is under active pre-1.0 development. Breaking changes are likely in patch releases._
10
10
 
11
11
  ## Documentation
12
12
 
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # Use AutoComplete to populate input values from server search results.
5
5
  class AutoCompleteComponent < Primer::Component
6
- include ViewComponent::SlotableV2
6
+ status :beta
7
7
 
8
8
  DEFAULT_INPUT_TYPE = :text
9
9
  INPUT_TYPE_OPTIONS = [DEFAULT_INPUT_TYPE, :search].freeze
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # Use AutoCompleteItem to list results of an auto-completed search.
5
5
  class AutoCompleteItemComponent < Primer::Component
6
- include ViewComponent::SlotableV2
6
+ status :beta
7
7
 
8
8
  # @example Default
9
9
  # <%= render(Primer::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # Use AvatarStack to stack multiple avatars together.
5
5
  class AvatarStackComponent < Primer::Component
6
- include ViewComponent::SlotableV2
6
+ status :beta
7
7
 
8
8
  ALIGN_DEFAULT = :left
9
9
  ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
@@ -22,94 +22,124 @@ module Primer
22
22
  # ```html
23
23
  # <h1 class="mt-0 mt-lg-4 mt-xl-2">Hello world</h1>
24
24
  # ```
25
- #
26
- # ## HTML attributes
27
- #
28
- # System arguments include most HTML attributes. For example:
29
- #
30
- # | Name | Type | Description |
31
- # | :- | :- | :- |
32
- # | `width` | `Integer` | Width. |
33
- # | `height` | `Integer` | Height. |
34
- # | `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |
35
- # | `aria` | `Hash` | Aria attributes: `aria: { label: "foo" }` renders `aria-label='foo'`. |
36
- # | `title` | `String` | The `title` attribute. |
37
- # | `style` | `String` | Inline styles. |
38
- # | `hidden` | `Boolean` | Whether to assign the `hidden` attribute. |
39
25
  class BaseComponent < Primer::Component
40
26
  status :beta
41
27
 
42
- include TestSelectorHelper
43
-
44
- # @param test_selector [String] Adds `data-test-selector='given value'` in non-Production environments for testing purposes.
45
- #
46
- # @param m [Integer] Margin. <%= one_of((-6..6).to_a) %>
47
- # @param mt [Integer] Margin top. <%= one_of((-6..6).to_a) %>
48
- # @param mr [Integer] Margin right. <%= one_of((-6..6).to_a) %>
49
- # @param mb [Integer] Margin bottom. <%= one_of((-6..6).to_a) %>
50
- # @param ml [Integer] Margin left. <%= one_of((-6..6).to_a) %>
51
- # @param mx [Integer] Horizontal margins. <%= one_of((-6..6).to_a + [:auto]) %>
52
- # @param my [Integer] Vertical margins. <%= one_of((-6..6).to_a) %>
53
- # @param p [Integer] Padding. <%= one_of((0..6).to_a) %>
54
- # @param pt [Integer] Padding left. <%= one_of((0..6).to_a) %>
55
- # @param pr [Integer] Padding right. <%= one_of((0..6).to_a) %>
56
- # @param pb [Integer] Padding bottom. <%= one_of((0..6).to_a) %>
57
- # @param pl [Integer] Padding left. <%= one_of((0..6).to_a) %>
58
- # @param px [Integer] Horizontal padding. <%= one_of((0..6).to_a) %>
59
- # @param py [Integer] Vertical padding. <%= one_of((0..6).to_a) %>
60
- #
61
- # @param position [Symbol] <%= one_of([:relative, :absolute, :fixed]) %>
62
- #
63
- # @param top [Boolean] If `false`, sets `top: 0`.
64
- # @param right [Boolean] If `false`, sets `right: 0`.
65
- # @param bottom [Boolean] If `false`, sets `bottom: 0`.
66
- # @param left [Boolean] If `false`, sets `left: 0`.
67
- #
68
- # @param display [Symbol] <%= one_of([:none, :block, :flex, :inline, :inline_block, :table, :table_cell]) %>
69
- #
70
- # @param v [Symbol] Visibility. <%= one_of([:hidden, :visible]) %>
71
- #
72
- # @param hide [Symbol] Hide the element at a specific breakpoint. <%= one_of([:sm, :md, :lg, :xl]) %>
73
- #
74
- # @param vertical_align [Symbol] <%= one_of([:baseline, :top, :middle, :bottom, :text_top, :text_bottom]) %>
75
- #
76
- # @param float [Symbol] <%= one_of([:left, :right]) %>
77
- #
78
- # @param col [Integer] Number of columns.
79
- #
80
- # @param underline [Boolean] Whether text should be underlined.
81
- #
82
- # @param color [Symbol] Text color. <br /> <%= one_of(Primer::Classify::FunctionalTextColors::OPTIONS) %> <br /> Deprecated options: <%= one_of(Primer::Classify::FunctionalTextColors::DEPRECATED_OPTIONS) %>
83
- # @param bg [String, Symbol] Background color. Accepts either a hex value as a String or a color name as a Symbol.
84
- #
85
- # @param box_shadow [Boolean, Symbol] Box shadow. <%= one_of([true, :medium, :large, :extra_large, :none]) %>
86
- # @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x, true]) %>
87
- # @param border_color [Symbol] <%= one_of(Primer::Classify::FunctionalBorderColors::OPTIONS) %> <br /> Deprecated options: <%= one_of(Primer::Classify::FunctionalBorderColors::DEPRECATED_OPTIONS) %>
88
- # @param border_top [Integer] Set to `0` to remove the top border.
89
- # @param border_bottom [Integer] Set to `0` to remove the bottom border.
90
- # @param border_left [Integer] Set to `0` to remove the left border.
91
- # @param border_right [Integer] Set to `0` to remove the right border.
92
- # @param border_radius [Integer] <%= one_of([0, 1, 2, 3]) %>
93
- #
94
- # @param font_size [String, Integer] <%= one_of(["00", 0, 1, 2, 3, 4, 5, 6]) %>
95
- # @param text_align [Symbol] Text alignment. <%= one_of([:left, :right, :center]) %>
96
- # @param font_weight [Symbol] Font weight. <%= one_of([:light, :normal, :bold]) %>
97
- #
98
- # @param flex [Integer, Symbol] <%= one_of([1, :auto]) %>
99
- # @param flex_grow [Integer] To enable, set to `0`.
100
- # @param flex_shrink [Integer] To enable, set to `0`.
101
- # @param align_self [Symbol] <%= one_of([:auto, :start, :end, :center, :baseline, :stretch]) %>
102
- # @param justify_content [Symbol] <%= one_of([:flex_start, :flex_end, :center, :space_between, :space_around]) %>
103
- # @param align_items [Symbol] <%= one_of([:flex_start, :flex_end, :center, :baseline, :stretch]) %>
104
- # @param width [Symbol] <%= one_of([:fit, :fill]) %>
105
- # @param height [Symbol] <%= one_of([:fit, :fill]) %>
106
- #
107
- # @param word_break [Symbol] Whether to break words on line breaks. Can only be `:break_all`.
108
- #
109
- # @param animation [Symbol] <%= one_of([:fade_in, :fade_out, :fade_up, :fade_down, :scale_in, :pulse, :grow_x, :grow]) %>
110
- #
111
- # @param tag [Symbol] HTML tag name to be passed to `tag.send`.
112
- # @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes.
28
+ # ## HTML attributes
29
+ #
30
+ # System arguments include most HTML attributes. For example:
31
+ #
32
+ # | Name | Type | Description |
33
+ # | :- | :- | :- |
34
+ # | `aria` | `Hash` | Aria attributes: `aria: { label: "foo" }` renders `aria-label='foo'`. |
35
+ # | `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |
36
+ # | `height` | `Integer` | Height. |
37
+ # | `hidden` | `Boolean` | Whether to assign the `hidden` attribute. |
38
+ # | `style` | `String` | Inline styles. |
39
+ # | `title` | `String` | The `title` attribute. |
40
+ # | `width` | `Integer` | Width. |
41
+ #
42
+ # ## Animation
43
+ #
44
+ # | Name | Type | Description |
45
+ # | :- | :- | :- |
46
+ # | `animation` | Symbol | <%= one_of([:fade_in, :fade_out, :fade_up, :fade_down, :scale_in, :pulse, :grow_x, :grow]) %> |
47
+ #
48
+ # ## Border
49
+ #
50
+ # | Name | Type | Description |
51
+ # | :- | :- | :- |
52
+ # | `border_bottom` | Integer | Set to `0` to remove the bottom border. |
53
+ # | `border_left` | Integer | Set to `0` to remove the left border. |
54
+ # | `border_radius` | Integer | <%= one_of([0, 1, 2, 3]) %> |
55
+ # | `border_right` | Integer | Set to `0` to remove the right border. |
56
+ # | `border_top` | Integer | Set to `0` to remove the top border. |
57
+ # | `border` | Symbol | <%= one_of([:left, :top, :bottom, :right, :y, :x, true]) %> |
58
+ # | `box_shadow` | Boolean, Symbol | Box shadow. <%= one_of([true, :medium, :large, :extra_large, :none]) %> |
59
+ #
60
+ # ## Color
61
+ #
62
+ # | Name | Type | Description |
63
+ # | :- | :- | :- |
64
+ # | `bg` | String, Symbol | Background color. Accepts either a hex value as a String or <%= one_of(Primer::Classify::FunctionalBorderColors::OPTIONS, lower: true) %> |
65
+ # | `border_color` | Symbol | Border color. <%= one_of(Primer::Classify::FunctionalBorderColors::OPTIONS) %> |
66
+ # | `color` | Symbol | Text color. <%= one_of(Primer::Classify::FunctionalTextColors::OPTIONS) %> |
67
+ #
68
+ # ## Flex
69
+ #
70
+ # | Name | Type | Description |
71
+ # | :- | :- | :- |
72
+ # | `align_items` | Symbol | <%= one_of([:flex_start, :flex_end, :center, :baseline, :stretch]) %> |
73
+ # | `align_self` | Symbol | <%= one_of([:auto, :start, :end, :center, :baseline, :stretch]) %> |
74
+ # | `flex_grow` | Integer | To enable, set to `0`. |
75
+ # | `flex_shrink` | Integer | To enable, set to `0`. |
76
+ # | `flex` | Integer, Symbol | <%= one_of([1, :auto]) %> |
77
+ # | `justify_content` | Symbol | <%= one_of([:flex_start, :flex_end, :center, :space_between, :space_around]) %> |
78
+ # | `width` | Symbol | <%= one_of([:fit, :fill]) %> |
79
+ #
80
+ # ## Grid
81
+ #
82
+ # | Name | Type | Description |
83
+ # | :- | :- | :- |
84
+ # | `col` | Integer | Number of columns. |
85
+ #
86
+ # ## Layout
87
+ #
88
+ # | Name | Type | Description |
89
+ # | :- | :- | :- |
90
+ # | `display` | Symbol | <%= one_of([:none, :block, :flex, :inline, :inline_block, :table, :table_cell]) %> |
91
+ # | `height` | Symbol | <%= one_of([:fit, :fill]) %> |
92
+ # | `hide` | Symbol | Hide the element at a specific breakpoint. <%= one_of([:sm, :md, :lg, :xl]) %> |
93
+ # | `v` | Symbol | Visibility. <%= one_of([:hidden, :visible]) %> |
94
+ # | `vertical_align` | Symbol | <%= one_of([:baseline, :top, :middle, :bottom, :text_top, :text_bottom]) %> |
95
+ #
96
+ # ## Position
97
+ #
98
+ # | Name | Type | Description |
99
+ # | :- | :- | :- |
100
+ # | `bottom` | Boolean | If `false`, sets `bottom: 0`. |
101
+ # | `float` | Symbol | <%= one_of([:left, :right]) %> |
102
+ # | `left` | Boolean | If `false`, sets `left: 0`. |
103
+ # | `position` | Symbol | <%= one_of([:relative, :absolute, :fixed]) %> |
104
+ # | `right` | Boolean | If `false`, sets `right: 0`. |
105
+ # | `top` | Boolean | If `false`, sets `top: 0`. |
106
+ #
107
+ # ## Spacing
108
+ #
109
+ # | Name | Type | Description |
110
+ # | :- | :- | :- |
111
+ # | `m` | Integer | Margin. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:m]) %> |
112
+ # | `mb` | Integer | Margin bottom. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:mb]) %> |
113
+ # | `ml` | Integer | Margin left. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:ml]) %> |
114
+ # | `mr` | Integer | Margin right. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:mr]) %> |
115
+ # | `mt` | Integer | Margin top. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:mt]) %> |
116
+ # | `mx` | Integer | Horizontal margins. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:mx]) %> |
117
+ # | `my` | Integer | Vertical margins. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:my]) %> |
118
+ # | `p` | Integer | Padding. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:p]) %> |
119
+ # | `pb` | Integer | Padding bottom. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:pb]) %> |
120
+ # | `pl` | Integer | Padding left. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:pl]) %> |
121
+ # | `pr` | Integer | Padding right. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:pr]) %> |
122
+ # | `pt` | Integer | Padding left. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:pt]) %> |
123
+ # | `px` | Integer | Horizontal padding. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:px]) %> |
124
+ # | `py` | Integer | Vertical padding. <%= one_of(Primer::Classify::Spacing::MAPPINGS[:py]) %> |
125
+ #
126
+ # ## Typography
127
+ #
128
+ # | Name | Type | Description |
129
+ # | :- | :- | :- |
130
+ # | `font_size` | String, Integer | <%= one_of(["00", 0, 1, 2, 3, 4, 5, 6]) %> |
131
+ # | `font_weight` | Symbol | Font weight. <%= one_of([:light, :normal, :bold]) %> |
132
+ # | `text_align` | Symbol | Text alignment. <%= one_of([:left, :right, :center]) %> |
133
+ # | `underline` | Boolean | Whether text should be underlined. |
134
+ # | `word_break` | Symbol | Whether to break words on line breaks. Can only be `:break_all`. |
135
+ #
136
+ # ## Other
137
+ #
138
+ # | Name | Type | Description |
139
+ # | :- | :- | :- |
140
+ # | classes | String | CSS class name value to be concatenated with generated Primer CSS classes. |
141
+ # | tag | Symbol | HTML tag name to be passed to `content_tag`. |
142
+ # | test_selector | String | Adds `data-test-selector='given value'` in non-Production environments for testing purposes. |
113
143
  def initialize(tag:, classes: nil, **system_arguments)
114
144
  @tag = tag
115
145
  @result = Primer::Classify.call(**system_arguments.merge(classes: classes))
@@ -2,7 +2,7 @@
2
2
  <% if spinner.present? %>
3
3
  <%= spinner %>
4
4
  <% elsif @icon.present? %>
5
- <%= primer_octicon icon: @icon, size: @icon_size, classes: "blankslate-icon" %>
5
+ <%= primer_octicon @icon, size: @icon_size, classes: "blankslate-icon" %>
6
6
  <% elsif @image_src.present? && @image_alt.present? %>
7
7
  <%= image_tag "#{@image_src}", class: "mb-3", size: "56x56", alt: "#{@image_alt}" %>
8
8
  <% end %>
@@ -5,8 +5,6 @@ module Primer
5
5
  class BlankslateComponent < Primer::Component
6
6
  status :beta
7
7
 
8
- include ViewComponent::SlotableV2
9
-
10
8
  # Optional Spinner.
11
9
  #
12
10
  # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::SpinnerComponent) %>.
@@ -5,8 +5,6 @@ module Primer
5
5
  class BorderBoxComponent < Primer::Component
6
6
  status :beta
7
7
 
8
- include ViewComponent::SlotableV2
9
-
10
8
  DEFAULT_PADDING = :default
11
9
  PADDING_MAPPINGS = {
12
10
  DEFAULT_PADDING => "",
@@ -3,7 +3,6 @@
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::SlotableV2
7
6
  status :beta
8
7
 
9
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._
@@ -3,14 +3,16 @@
3
3
  module Primer
4
4
  # Use buttons for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
5
5
  class ButtonComponent < Primer::Component
6
- DEFAULT_BUTTON_TYPE = :default
7
- BUTTON_TYPE_MAPPINGS = {
8
- DEFAULT_BUTTON_TYPE => "",
6
+ status :beta
7
+
8
+ DEFAULT_SCHEME = :default
9
+ SCHEME_MAPPINGS = {
10
+ DEFAULT_SCHEME => "",
9
11
  :primary => "btn-primary",
10
12
  :danger => "btn-danger",
11
13
  :outline => "btn-outline"
12
14
  }.freeze
13
- BUTTON_TYPE_OPTIONS = BUTTON_TYPE_MAPPINGS.keys
15
+ SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
14
16
 
15
17
  DEFAULT_VARIANT = :medium
16
18
  VARIANT_MAPPINGS = {
@@ -26,24 +28,24 @@ module Primer
26
28
  DEFAULT_TYPE = :button
27
29
  TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
28
30
 
29
- # @example Button types
31
+ # @example Schemes
30
32
  # <%= render(Primer::ButtonComponent.new) { "Default" } %>
31
- # <%= render(Primer::ButtonComponent.new(button_type: :primary)) { "Primary" } %>
32
- # <%= render(Primer::ButtonComponent.new(button_type: :danger)) { "Danger" } %>
33
- # <%= render(Primer::ButtonComponent.new(button_type: :outline)) { "Outline" } %>
33
+ # <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Primary" } %>
34
+ # <%= render(Primer::ButtonComponent.new(scheme: :danger)) { "Danger" } %>
35
+ # <%= render(Primer::ButtonComponent.new(scheme: :outline)) { "Outline" } %>
34
36
  #
35
37
  # @example Variants
36
38
  # <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
37
39
  # <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
38
40
  # <%= render(Primer::ButtonComponent.new(variant: :large)) { "Large" } %>
39
41
  #
40
- # @param button_type [Symbol] <%= one_of(Primer::ButtonComponent::BUTTON_TYPE_OPTIONS) %>
42
+ # @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
41
43
  # @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
42
44
  # @param tag [Symbol] <%= one_of(Primer::ButtonComponent::TAG_OPTIONS) %>
43
45
  # @param type [Symbol] <%= one_of(Primer::ButtonComponent::TYPE_OPTIONS) %>
44
46
  # @param group_item [Boolean] Whether button is part of a ButtonGroup.
45
47
  def initialize(
46
- button_type: DEFAULT_BUTTON_TYPE,
48
+ scheme: DEFAULT_SCHEME,
47
49
  variant: DEFAULT_VARIANT,
48
50
  tag: DEFAULT_TAG,
49
51
  type: DEFAULT_TYPE,
@@ -62,7 +64,7 @@ module Primer
62
64
  @system_arguments[:classes] = class_names(
63
65
  "btn",
64
66
  system_arguments[:classes],
65
- BUTTON_TYPE_MAPPINGS[fetch_or_fallback(BUTTON_TYPE_OPTIONS, button_type, DEFAULT_BUTTON_TYPE)],
67
+ SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
66
68
  VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
67
69
  "BtnGroup-item" => group_item
68
70
  )