primer_view_components 0.0.8 → 0.0.13
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 +66 -37
- data/README.md +2 -161
- data/app/components/primer/avatar_component.rb +22 -11
- data/app/components/primer/base_component.rb +56 -11
- data/app/components/primer/blankslate_component.html.erb +2 -2
- data/app/components/primer/blankslate_component.rb +71 -116
- data/app/components/primer/border_box_component.html.erb +5 -5
- data/app/components/primer/border_box_component.rb +45 -33
- data/app/components/primer/box_component.rb +6 -4
- data/app/components/primer/breadcrumb_component.html.erb +2 -2
- data/app/components/primer/breadcrumb_component.rb +23 -30
- data/app/components/primer/button_component.rb +28 -11
- data/app/components/primer/component.rb +1 -0
- data/app/components/primer/counter_component.rb +14 -9
- data/app/components/primer/details_component.html.erb +1 -1
- data/app/components/primer/details_component.rb +18 -18
- data/app/components/primer/dropdown_menu_component.html.erb +1 -1
- data/app/components/primer/dropdown_menu_component.rb +6 -6
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flash_component.rb +43 -13
- data/app/components/primer/flex_component.rb +5 -5
- data/app/components/primer/flex_item_component.rb +5 -5
- data/app/components/primer/heading_component.rb +4 -4
- data/app/components/primer/label_component.rb +25 -8
- data/app/components/primer/layout_component.html.erb +1 -1
- data/app/components/primer/layout_component.rb +23 -6
- data/app/components/primer/link_component.rb +17 -7
- data/app/components/primer/octicon_component.rb +23 -5
- data/app/components/primer/popover_component.html.erb +1 -1
- data/app/components/primer/popover_component.rb +61 -23
- data/app/components/primer/progress_bar_component.html.erb +2 -2
- data/app/components/primer/progress_bar_component.rb +40 -30
- data/app/components/primer/slot.rb +1 -0
- data/app/components/primer/spinner_component.html.erb +6 -0
- data/app/components/primer/spinner_component.rb +39 -0
- data/app/components/primer/state_component.rb +26 -14
- data/app/components/primer/subhead_component.html.erb +4 -4
- data/app/components/primer/subhead_component.rb +68 -43
- data/app/components/primer/text_component.rb +10 -4
- data/app/components/primer/timeline_item_component.html.erb +4 -4
- data/app/components/primer/timeline_item_component.rb +48 -24
- data/app/components/primer/underline_nav_component.html.erb +1 -1
- data/app/components/primer/underline_nav_component.rb +5 -5
- data/app/components/primer/view_components.rb +1 -0
- data/lib/primer/classify.rb +2 -4
- data/lib/primer/view_components/version.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 055f773c8e99df5c9bce23d6a5199e71148d0331d6abe6c02fd1f16321a54130
|
4
|
+
data.tar.gz: e5310f927e76533daa46918acb24b48ea7bdd684a8f8e4c9090e3545a2e7f3fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b7159b56e4a0674a7ec68e4aa0666bb2a3e3cb5ef7b90e8c418149200af1255789adc87e4b3955a9a2d6e97afb9ebe2746928ccb32ece3395c28de315206dc
|
7
|
+
data.tar.gz: cc962a06f62249016eccfd224ab3655117ac193fa7f6ebb40aff91212690464047f95e2822bf4b5c8ae83d8c82df02e955f0c8ffc350e9aed85c313623388a61
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,38 @@
|
|
1
|
-
#
|
1
|
+
# CHANGELOG
|
2
2
|
|
3
|
-
|
3
|
+
## main
|
4
|
+
|
5
|
+
## 0.0.13
|
6
|
+
|
7
|
+
* Add support for `xl` breakpoint.
|
8
|
+
|
9
|
+
*Joel Hawksley*
|
10
|
+
|
11
|
+
## 0.0.12
|
12
|
+
|
13
|
+
* Adds support for disabling inline box-sizing style for `SpinnerComponent` via style parameter `Primer::SpinnerComponent.new(style: nil)`.
|
14
|
+
|
15
|
+
*Chris Wilson*
|
16
|
+
|
17
|
+
## 0.0.11
|
18
|
+
|
19
|
+
* Renames DetailsComponent::OVERLAY_DEFAULT to DetailsComponent::NO_OVERLAY to more correctly describe its value.
|
20
|
+
|
21
|
+
*Justin Kenyon*
|
22
|
+
|
23
|
+
## 0.0.10
|
24
|
+
|
25
|
+
* Add SpinnerComponent
|
26
|
+
|
27
|
+
*Cole Bemis*
|
28
|
+
|
29
|
+
## 0.0.9
|
30
|
+
|
31
|
+
* BREAKING CHANGE: OcticonComponent no longer accepts `class` parameter; use `classes` instead.
|
32
|
+
|
33
|
+
*heynan0*
|
34
|
+
|
35
|
+
## 0.0.8
|
4
36
|
|
5
37
|
* Add support for border margins, such as: `border_top: 0`.
|
6
38
|
|
@@ -10,19 +42,17 @@
|
|
10
42
|
|
11
43
|
*Joel Hawksley*
|
12
44
|
|
13
|
-
|
14
|
-
|
15
|
-
* BlankslateComponent accepts `icon_size` instead of `icon_height`.
|
45
|
+
* BREAKING CHANGE: BlankslateComponent accepts `icon_size` instead of `icon_height`.
|
16
46
|
|
17
47
|
*Joel Hawksley*
|
18
48
|
|
19
|
-
|
49
|
+
## 0.0.7
|
20
50
|
|
21
51
|
* Use `octicons_helper` v11.0.0.
|
22
52
|
|
23
53
|
*Joel Hawksley*
|
24
54
|
|
25
|
-
|
55
|
+
## 0.0.6
|
26
56
|
|
27
57
|
* Updated the invalid class name error message
|
28
58
|
|
@@ -40,21 +70,19 @@
|
|
40
70
|
|
41
71
|
*Manuel Puyol*
|
42
72
|
|
43
|
-
|
44
|
-
|
45
|
-
* Changed `DetailsComponent` summary and body to be slots
|
73
|
+
* BREAKING CHANGE: Changed `DetailsComponent` summary and body to be slots
|
46
74
|
|
47
75
|
*Manuel Puyol*
|
48
76
|
|
49
|
-
|
77
|
+
## 0.0.5
|
50
78
|
|
51
79
|
* Add support for box_shadow
|
52
80
|
* Add components:
|
53
|
-
|
81
|
+
* Popover
|
54
82
|
|
55
83
|
*Sarah Vessels*
|
56
84
|
|
57
|
-
|
85
|
+
## 0.0.4
|
58
86
|
|
59
87
|
* Added support for mx: and my: :auto.
|
60
88
|
|
@@ -63,19 +91,20 @@
|
|
63
91
|
* Added support for custom layout sizes.
|
64
92
|
|
65
93
|
*Manuel Puyol*
|
66
|
-
# 0.0.3
|
67
94
|
|
68
|
-
|
95
|
+
## 0.0.3
|
96
|
+
|
97
|
+
* Add support for responsive `float` system argument.
|
69
98
|
|
70
99
|
*Joel Hawksley*
|
71
100
|
|
72
101
|
* Add components:
|
73
|
-
|
74
|
-
|
102
|
+
* Avatar
|
103
|
+
* Blankslate
|
75
104
|
|
76
105
|
*Manuel Puyol, Ben Emdon*
|
77
106
|
|
78
|
-
|
107
|
+
## 0.0.1
|
79
108
|
|
80
109
|
* Add initial gem configuration.
|
81
110
|
|
@@ -90,24 +119,24 @@
|
|
90
119
|
*Manuel Puyol*
|
91
120
|
|
92
121
|
* Add components:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
122
|
+
* BorderBox
|
123
|
+
* Box
|
124
|
+
* Breadcrumb
|
125
|
+
* Button
|
126
|
+
* Counter
|
127
|
+
* Details
|
128
|
+
* Dropdown
|
129
|
+
* Flex
|
130
|
+
* FlexItem
|
131
|
+
* Heading
|
132
|
+
* Label
|
133
|
+
* Layout
|
134
|
+
* Link
|
135
|
+
* ProgressBar
|
136
|
+
* State
|
137
|
+
* Subhead
|
138
|
+
* Text
|
139
|
+
* TimelineItem
|
140
|
+
* UnderlineNav
|
112
141
|
|
113
142
|
*Manuel Puyol*
|
data/README.md
CHANGED
@@ -8,168 +8,9 @@
|
|
8
8
|
|
9
9
|
_Note: This library is in pre-release development and should not be considered stable._
|
10
10
|
|
11
|
-
##
|
11
|
+
## Documentation
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
## Installation
|
16
|
-
|
17
|
-
In `Gemfile`, add:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
gem "primer_view_components"
|
21
|
-
```
|
22
|
-
|
23
|
-
In `config/application.rb`, add **after the application definition**
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
require "primer/view_components/engine"
|
27
|
-
```
|
28
|
-
|
29
|
-
## Usage
|
30
|
-
|
31
|
-
### Built-in styling arguments
|
32
|
-
|
33
|
-
Primer components should be styled using the built-in arguments when possible. Most Primer utility classes for spacing, alignment, display, and colors have equivalent component arguments.
|
34
|
-
|
35
|
-
Example label built with Primer CSS:
|
36
|
-
|
37
|
-
```html
|
38
|
-
<span title="Label: Suggested" class="Label Label--outline Label--outline-green ml-2 v-align-middle">Suggested</span>
|
39
|
-
```
|
40
|
-
|
41
|
-
The same label using `Primer::LabelComponent`:
|
42
|
-
|
43
|
-
```erb
|
44
|
-
<%= render Primer::LabelComponent.new(ml: 2, vertical_align: :middle, scheme: :green, title: "Label: Suggested") do %>
|
45
|
-
Suggested
|
46
|
-
<% end %>
|
47
|
-
```
|
48
|
-
|
49
|
-
Some components have their own specific arguments, but they can all be styled with the following arguments.
|
50
|
-
|
51
|
-
| Component argument | Primer class | Example |
|
52
|
-
| --------------- | --------------- | -------- |
|
53
|
-
| `m` | `m-<value>` | `m: 4` → `.m-4` |
|
54
|
-
| `my` | `my-<value>` | `my: 4` → `.my-4` |
|
55
|
-
| `mx` | `my-<value>` | `mx: 4` → `.mx-4` |
|
56
|
-
| `mt` | `mt-<value>` | `mt: 4` → `.mt-4` |
|
57
|
-
| `mb` | `mb-<value>` | `mb: 4` → `.mb-4` |
|
58
|
-
| `ml` | `ml-<value>` | `ml: 4` → `.ml-4` |
|
59
|
-
| `mr` | `mr-<value>` | `mr: 4` → `.mr-4` |
|
60
|
-
| `p` | `p-<value>` | `p: 4` → `.p-4` |
|
61
|
-
| `py` | `py-<value>` | `py: 4` → `.py-4` |
|
62
|
-
| `px` | `py-<value>` | `px: 4` → `.px-4` |
|
63
|
-
| `pt` | `pt-<value>` | `pt: 4` → `.pt-4` |
|
64
|
-
| `pb` | `pb-<value>` | `pb: 4` → `.pb-4` |
|
65
|
-
| `pl` | `pl-<value>` | `pl: 4` → `.pl-4` |
|
66
|
-
| `pr` | `pr-<value>` | `pr: 4` → `.pr-4` |
|
67
|
-
| `pr` | `pr-<value>` | `pr: 4` → `.pr-4` |
|
68
|
-
| `f` | `f-<value>` | `f: 4` → `.f-4` |
|
69
|
-
| `color` | `color-<value>` | `color: :red_500` → `.color-red-500` |
|
70
|
-
| `text` | `text-<value>` | `text: :green` → `.text-green` |
|
71
|
-
| `bg` | `bg-<value>` | `bg: :blue_light` → `.bg-blue-light` |
|
72
|
-
| `display` | `d-<value>` | `display: :none` → `.d-none` |
|
73
|
-
| `float` | `float-<value>` | `float: :right` → `.float-right` |
|
74
|
-
| `vertical_align` | `v-align-<value>` | `vertical_align: :baseline` → `.v-align-baseline` |
|
75
|
-
| `text_align` | `text-<value>` | `text_align: :right` → `.text-right` |
|
76
|
-
| `font_size` | `f<value>` | `font_size: 4` → `.f4` |
|
77
|
-
| `font_weight` | `text-<value>` | `font_weight: :bold` → `.text-bold` |
|
78
|
-
| `border` | `border-<value>` | `border: :bottom` → `.border-bottom` |
|
79
|
-
| `border_color` | `border-<value>` | `border: :green` → `.border-green` |
|
80
|
-
| `border_top` | `border-top-<value>` | `border_top: 0` → `.border-top-0` |
|
81
|
-
| `border_bottom` | `border-bottom-<value>` | `border_bottom: 0` → `.border-bottom-0` |
|
82
|
-
| `border_left` | `border-left-<value>` | `border_left: 0` → `.border-left-0` |
|
83
|
-
| `border_right` | `border-right-<value>` | `border_right: 0` → `.border-right-0` |
|
84
|
-
| `word_break` | `wb-<value>` | `word_break: :break_all` → `.wb-break-all` |
|
85
|
-
| `direction` | `flex-<value>` | `direction: :row` → `.flex-row` |
|
86
|
-
| `justify_content` | `flex-justify-<value>` | `justify_content: :center` → `.flex-justify-center` |
|
87
|
-
| `align_items` | `flex-items-<value>` | `align_items: :baseline` → `.flex-items-baseline` |
|
88
|
-
| `box_shadow` | `box-shadow-<value>` | `box_shadow: :medium` → `.box-shadow-medium` |
|
89
|
-
|
90
|
-
#### Boolean arguments
|
91
|
-
| Component arguments | True | False |
|
92
|
-
| -------------- | ------- | ------ |
|
93
|
-
| `underline` | `underline: true` → `.text-underline` | `underline: false` → `.no-underline` |
|
94
|
-
| `top` | n/a | `top: false` → `.top-0` |
|
95
|
-
| `bottom` | n/a | `bottom: false` → `.bottom-0` |
|
96
|
-
| `left` | n/a | `left: false` → `.left-0` |
|
97
|
-
| `right` | n/a | `right: false` → `.right-0` |
|
98
|
-
|
99
|
-
#### Responsive arguments
|
100
|
-
|
101
|
-
Different classes can be used for different breakpoints just like in Primer CSS. Simply use an array with the four values required for `[none, small, medium, large]`. If no breakpoint is needed for a breakpoint, pass `nil`.
|
102
|
-
|
103
|
-
Example heading built with Primer CSS:
|
104
|
-
|
105
|
-
```html
|
106
|
-
<h1 class="mt-0 mt-lg-4">Hello world</h1>
|
107
|
-
```
|
108
|
-
|
109
|
-
The same label using `Primer::HeadingComponent`:
|
110
|
-
|
111
|
-
```erb
|
112
|
-
<%= render Primer::HeadingComponent.new(mt: [0, nil, nil, 4]) do %>
|
113
|
-
Hello world
|
114
|
-
<% end %>
|
115
|
-
```
|
116
|
-
|
117
|
-
## Contributing
|
118
|
-
|
119
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/primer/view_components. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
120
|
-
|
121
|
-
### Setting up
|
122
|
-
|
123
|
-
Run
|
124
|
-
|
125
|
-
```bash
|
126
|
-
script/setup
|
127
|
-
```
|
128
|
-
|
129
|
-
to install all necessary dependencies
|
130
|
-
|
131
|
-
|
132
|
-
### Running tests
|
133
|
-
|
134
|
-
To run the full test suite:
|
135
|
-
|
136
|
-
```bash
|
137
|
-
bundle exec rake
|
138
|
-
```
|
139
|
-
|
140
|
-
### Storybook
|
141
|
-
|
142
|
-
*We recommend having [overmind](https://github.com/DarthSim/overmind) installed to run both rails and storybook, but it is not required.*
|
143
|
-
|
144
|
-
To run storybook:
|
145
|
-
|
146
|
-
```bash
|
147
|
-
script/storybook
|
148
|
-
```
|
149
|
-
|
150
|
-
### Developing with another app
|
151
|
-
|
152
|
-
In your `Gemfile`, change:
|
153
|
-
|
154
|
-
```ruby
|
155
|
-
gem "primer_view_components"
|
156
|
-
```
|
157
|
-
|
158
|
-
to
|
159
|
-
|
160
|
-
```ruby
|
161
|
-
gem "primer_view_components", path: "path_to_the_gem" # e.g. path: "~/primer/view_components"
|
162
|
-
```
|
163
|
-
|
164
|
-
Then, `bundle install` to update references. You'll now be able to see changes from the gem without having to build it.
|
165
|
-
Remember that restarting the Rails server is necessary to see changes, as the gem is loaded at boot time.
|
166
|
-
|
167
|
-
To minimize the number of restarts, we recommend checking the component in Storybook first, and then when it's in a good state,
|
168
|
-
you can check it in your app.
|
169
|
-
|
170
|
-
### Documentation
|
171
|
-
|
172
|
-
Document components with [YARD](https://yardoc.org/). Docs are published to [RubyDoc.info](https://rubydoc.info/github/primer/view_components).
|
13
|
+
Visit [https://primer.style/view-components/](https://primer.style/view-components//) to view documentation.
|
173
14
|
|
174
15
|
## License
|
175
16
|
|
@@ -1,28 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
+
# Avatars are images used to represent users and organizations on GitHub.
|
5
|
+
# Use the default round avatar for users, and the `square` argument
|
6
|
+
# for organizations or any other non-human avatars.
|
4
7
|
class AvatarComponent < Primer::Component
|
5
8
|
SMALL_THRESHOLD = 24
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
#
|
11
|
+
# @example 34|Default
|
12
|
+
# <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
|
13
|
+
#
|
14
|
+
# @param src [String] The source url of the avatar image
|
15
|
+
# @param alt [String] Passed through to alt on img tag
|
16
|
+
# @param size [Integer] Adds the avatar-small class if less than 24
|
17
|
+
# @param square [Boolean] Used to create a square avatar.
|
18
|
+
def initialize(src:, alt:, size: 20, square: false, **system_arguments)
|
19
|
+
@system_arguments = system_arguments
|
20
|
+
@system_arguments[:tag] = :img
|
21
|
+
@system_arguments[:src] = src
|
22
|
+
@system_arguments[:alt] = alt
|
23
|
+
@system_arguments[:size] = size
|
24
|
+
@system_arguments[:height] = size
|
25
|
+
@system_arguments[:width] = size
|
15
26
|
|
16
|
-
@
|
27
|
+
@system_arguments[:classes] = class_names(
|
17
28
|
"avatar",
|
18
|
-
|
29
|
+
system_arguments[:classes],
|
19
30
|
"avatar--small" => size < SMALL_THRESHOLD,
|
20
31
|
"CircleBadge" => !square
|
21
32
|
)
|
22
33
|
end
|
23
34
|
|
24
35
|
def call
|
25
|
-
render(Primer::BaseComponent.new(**@
|
36
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
26
37
|
end
|
27
38
|
end
|
28
39
|
end
|
@@ -1,25 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
#
|
4
|
+
# All Primer ViewComponents accept a standard set of options called System Arguments, mimicking the [styled-system API](https://styled-system.com/table) [used by Primer React](https://primer.style/components/system-props).
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# Under the hood, System Arguments are [mapped](https://github.com/primer/view_components/blob/main/lib/primer/classify.rb) to Primer CSS classes, with any remaining options passed to Rails' [`content_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).
|
7
|
+
#
|
8
|
+
# ## Responsive values
|
9
|
+
#
|
10
|
+
# To apply different values across responsive breakpoints, pass an array with up to five values in the order `[default, small, medium, large, xlarge]`. To skip a breakpoint, pass `nil`.
|
11
|
+
#
|
12
|
+
# For example:
|
13
|
+
#
|
14
|
+
# ```erb
|
15
|
+
# <%= render Primer::HeadingComponent.new(mt: [0, nil, nil, 4, 2]) do %>
|
16
|
+
# Hello world
|
17
|
+
# <% end %>
|
18
|
+
# ```
|
19
|
+
#
|
20
|
+
# Renders:
|
21
|
+
#
|
22
|
+
# ```html
|
23
|
+
# <h1 class="mt-0 mt-lg-4 mt-xl-2">Hello world</h1>
|
24
|
+
# ```
|
9
25
|
#
|
10
|
-
# Example usage:
|
11
|
-
# <%= render Primer::BaseComponent, tag: :a, href: "http://www.google.com", mt: 4 do %>Link<% end %>
|
12
|
-
# generates:
|
13
|
-
# <a href="http://www.google.com" class="mt-4">Link</a>
|
14
26
|
class BaseComponent < Primer::Component
|
15
27
|
TEST_SELECTOR_TAG = :test_selector
|
16
28
|
|
17
|
-
|
29
|
+
# @param m [Integer] Margin. <%= one_of((-6..6).to_a) %>
|
30
|
+
# @param mt [Integer] Margin left. <%= one_of((-6..6).to_a) %>
|
31
|
+
# @param mr [Integer] Margin right. <%= one_of((-6..6).to_a) %>
|
32
|
+
# @param mb [Integer] Margin bottom. <%= one_of((-6..6).to_a) %>
|
33
|
+
# @param ml [Integer] Margin left. <%= one_of((-6..6).to_a) %>
|
34
|
+
# @param mx [Integer] Horizontal margins. <%= one_of((-6..6).to_a + [:auto]) %>
|
35
|
+
# @param my [Integer] Vertical margins. <%= one_of((-6..6).to_a) %>
|
36
|
+
# @param m [Integer] Padding. <%= one_of((0..6).to_a) %>
|
37
|
+
# @param mt [Integer] Padding left. <%= one_of((0..6).to_a) %>
|
38
|
+
# @param mr [Integer] Padding right. <%= one_of((0..6).to_a) %>
|
39
|
+
# @param mb [Integer] Padding bottom. <%= one_of((0..6).to_a) %>
|
40
|
+
# @param ml [Integer] Padding left. <%= one_of((0..6).to_a) %>
|
41
|
+
# @param mx [Integer] Horizontal padding. <%= one_of((0..6).to_a) %>
|
42
|
+
# @param my [Integer] Vertical padding. <%= one_of((0..6).to_a) %>
|
43
|
+
#
|
44
|
+
# @param position [Symbol] <%= one_of([:relative, :absolute, :fixed]) %>
|
45
|
+
#
|
46
|
+
# @param top [Boolean] If `false`, sets `top: 0`.
|
47
|
+
# @param right [Boolean] If `false`, sets `right: 0`.
|
48
|
+
# @param bottom [Boolean] If `false`, sets `bottom: 0`.
|
49
|
+
# @param left [Boolean] If `false`, sets `left: 0`.
|
50
|
+
#
|
51
|
+
# @param display [Symbol] <%= one_of([:block, :none, :inline, :inline_block, :table, :table_cell]) %>
|
52
|
+
#
|
53
|
+
# @param hide [Symbol] Hide the element at a specific breakpoint. <%= one_of([:sm, :md, :lg, :xl]) %>
|
54
|
+
#
|
55
|
+
# @param vertical_align [Symbol] <%= one_of([:baseline, :top, :middle, :bottom, :text_top, :text_bottom]) %>
|
56
|
+
#
|
57
|
+
# @param float [Symbol] <%= one_of([:left, :right]) %>
|
58
|
+
#
|
59
|
+
# @param font_size [String] <%= one_of(["00", "0", "1", "2", "3", "4", "5", "6"]) %>
|
60
|
+
# @param tag [Symbol] HTML tag name to be passed to `tag.send`
|
61
|
+
# @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes
|
62
|
+
def initialize(tag:, classes: nil, **system_arguments)
|
18
63
|
@tag = tag
|
19
|
-
@result = Primer::Classify.call(**
|
64
|
+
@result = Primer::Classify.call(**system_arguments.merge(classes: classes))
|
20
65
|
|
21
66
|
# Filter out Primer keys so they don't get assigned as HTML attributes
|
22
|
-
@content_tag_args = add_test_selector(
|
67
|
+
@content_tag_args = add_test_selector(system_arguments).except(*Primer::Classify::VALID_KEYS)
|
23
68
|
end
|
24
69
|
|
25
70
|
def call
|