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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +78 -0
- data/README.md +2 -2
- data/app/components/primer/auto_complete_component.rb +1 -1
- data/app/components/primer/auto_complete_item_component.rb +1 -1
- data/app/components/primer/avatar_stack_component.rb +1 -1
- data/app/components/primer/base_component.rb +115 -85
- data/app/components/primer/blankslate_component.html.erb +1 -1
- data/app/components/primer/blankslate_component.rb +0 -2
- data/app/components/primer/border_box_component.rb +0 -2
- data/app/components/primer/breadcrumb_component.rb +0 -1
- data/app/components/primer/button_component.rb +13 -11
- data/app/components/primer/button_group_component.rb +3 -5
- data/app/components/primer/button_marketing_component.rb +12 -12
- data/app/components/primer/component.rb +3 -0
- data/app/components/primer/details_component.rb +0 -1
- data/app/components/primer/dropdown/menu_component.rb +0 -2
- data/app/components/primer/dropdown_component.rb +1 -3
- data/app/components/primer/dropdown_menu_component.rb +1 -1
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flash_component.rb +10 -12
- data/app/components/primer/layout_component.rb +0 -2
- data/app/components/primer/link_component.rb +9 -9
- data/app/components/primer/menu_component.rb +2 -4
- data/app/components/primer/navigation/tab_component.html.erb +11 -0
- data/app/components/primer/navigation/tab_component.rb +126 -0
- data/app/components/primer/octicon_component.rb +5 -8
- data/app/components/primer/popover_component.rb +19 -3
- data/app/components/primer/progress_bar_component.rb +0 -1
- data/app/components/primer/spinner_component.html.erb +1 -3
- data/app/components/primer/spinner_component.rb +1 -0
- data/app/components/primer/state_component.rb +13 -13
- data/app/components/primer/subhead_component.rb +1 -3
- data/app/components/primer/tab_nav_component.html.erb +8 -10
- data/app/components/primer/tab_nav_component.rb +63 -76
- data/app/components/primer/time_ago_component.rb +2 -1
- data/app/components/primer/timeline_item_component.rb +1 -2
- data/app/components/primer/underline_nav_component.html.erb +19 -7
- data/app/components/primer/underline_nav_component.rb +114 -16
- data/app/lib/primer/classify.rb +5 -14
- data/app/lib/primer/classify/cache.rb +14 -4
- data/app/lib/primer/classify/spacing.rb +63 -0
- data/app/lib/primer/tabbed_component_helper.rb +39 -0
- data/app/lib/primer/view_helper.rb +2 -2
- data/lib/primer/view_components/version.rb +1 -1
- data/static/statuses.json +1 -1
- metadata +83 -22
- data/app/components/primer/slot.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d70eee70c97f320cb4708c39c1e2d6f53dc001fd2e0f0bc8fa2c83a0e1faf97b
|
4
|
+
data.tar.gz: 3326a41fbcfafdf23247769e7fac8ceedaf21fdb047470e38390560db6267778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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
|
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
|
-
|
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
|
-
|
6
|
+
status :beta
|
7
7
|
|
8
8
|
# @example Default
|
9
9
|
# <%= render(Primer::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
|
@@ -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
|
-
|
43
|
-
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
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
|
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 %>
|
@@ -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
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
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
|
31
|
+
# @example Schemes
|
30
32
|
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
31
|
-
# <%= render(Primer::ButtonComponent.new(
|
32
|
-
# <%= render(Primer::ButtonComponent.new(
|
33
|
-
# <%= render(Primer::ButtonComponent.new(
|
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
|
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
|
-
|
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
|
-
|
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
|
)
|