primer_view_components 0.0.31 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +94 -0
- data/README.md +2 -2
- data/app/components/primer/{auto_complete_component.rb → auto_complete.rb} +12 -12
- data/app/components/primer/{auto_complete_component.d.ts → auto_complete/auto_complete.d.ts} +0 -0
- data/app/components/primer/{auto_complete_component.html.erb → auto_complete/auto_complete.html.erb} +0 -0
- data/app/components/primer/{auto_complete_component.js → auto_complete/auto_complete.js} +0 -0
- data/app/components/primer/{auto_complete_component.ts → auto_complete/auto_complete.ts} +0 -0
- data/app/components/primer/auto_complete/auto_component.d.ts +1 -0
- data/app/components/primer/auto_complete/auto_component.js +1 -0
- data/app/components/primer/auto_complete/item.rb +42 -0
- 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 +37 -16
- data/app/components/primer/button_group_component.rb +3 -5
- data/app/components/primer/button_marketing_component.rb +12 -12
- data/app/components/primer/close_button.rb +30 -0
- 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/foo_bar.d.ts +1 -0
- data/app/components/primer/foo_bar.js +1 -0
- data/app/components/primer/hidden_text_expander.rb +43 -0
- 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 +0 -1
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.ts +1 -1
- 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/{truncate_component.rb → truncate.rb} +8 -6
- 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 +110 -31
- data/app/assets/javascripts/primer_view_components.js.map.orig +0 -5
- data/app/assets/javascripts/primer_view_components.js.orig +0 -6
- data/app/components/primer/auto_complete_item_component.rb +0 -40
- 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: ccc56525f479af9da0ee1dea8985e5a54aad6567e9ec932eef93707b896b91d3
|
4
|
+
data.tar.gz: c718f55ccc5e7fc6d76640410c4c2f3df140f45ab4765eeef3d3e3355893ed07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3859007d82a2ae6653a215894021f6f49318c21cd608d333cfbb0beef659b17d66e71bc913933ab758846c07dc35c72a791ddd12d05e40795e17798c5fffe53
|
7
|
+
data.tar.gz: 26898a446277ee8df6be61241af11506220e29bcf94a180cdf334b54b19df932486f42737320f61b87c3c4cdc867f0b5980c99cc4623d8760d85cf92e0510ade
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,100 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 0.0.36
|
6
|
+
|
7
|
+
* Add `block` flag to `ButtonComponent`.
|
8
|
+
|
9
|
+
*Manuel Puyol*
|
10
|
+
|
11
|
+
* Add `link` and `invisible` schemes to `ButtonComponent`.
|
12
|
+
|
13
|
+
*Manuel Puyol*
|
14
|
+
|
15
|
+
* Create `CloseButton` and `HiddenTextExpander` component.
|
16
|
+
|
17
|
+
*Manuel Puyol*
|
18
|
+
|
19
|
+
* **Breaking change**: Rename `AutoCompleteComponent` to `AutoComplete` and `AutoCompleteItemComponent` to `AutoComplete::Item`.
|
20
|
+
|
21
|
+
*Manuel Puyol*
|
22
|
+
|
23
|
+
* **Breaking change**: Rename `TruncateComponent` to `Truncate` and promote it to beta.
|
24
|
+
|
25
|
+
*Manuel Puyol*
|
26
|
+
|
27
|
+
## 0.0.35
|
28
|
+
|
29
|
+
* Promote `AutoCompleteComponent`, `AutoCompleteItemComponent`, `AvatarStackComponent` and `ButtonComponent` to beta.
|
30
|
+
|
31
|
+
*Manuel Puyol*
|
32
|
+
|
33
|
+
* Allow `UnderlineNav` tabs to be rendered as a `<ul><li>` list.
|
34
|
+
|
35
|
+
*Manuel Puyol*
|
36
|
+
|
37
|
+
* _Accessibility:_ Don't add tab roles when `UnderlineNav` or `TabNav` use link redirects.
|
38
|
+
|
39
|
+
*Manuel Puyol*
|
40
|
+
|
41
|
+
* **Breaking change**: Make `label` required for `UnderlineNav` and `TabNav`.
|
42
|
+
|
43
|
+
*Manuel Puyol*
|
44
|
+
|
45
|
+
## 0.0.34
|
46
|
+
|
47
|
+
* Add `p: :responsive` and `m: :auto` system arguments.
|
48
|
+
|
49
|
+
*Manuel Puyol*
|
50
|
+
|
51
|
+
* Remove `my: :auto` and negative `m:` system arguments.
|
52
|
+
|
53
|
+
*Manuel Puyol*
|
54
|
+
|
55
|
+
* **Breaking change**: Rename `FlashComponent` `variant` argument to `scheme`.
|
56
|
+
|
57
|
+
*Manuel Puyol*
|
58
|
+
|
59
|
+
* **Breaking change**: Rename `LinkComponent` `variant` argument to `scheme`.
|
60
|
+
|
61
|
+
*Manuel Puyol*
|
62
|
+
|
63
|
+
* **Breaking change**: Rename `ButtonComponent` `button_type` argument to `scheme`.
|
64
|
+
|
65
|
+
*Manuel Puyol*
|
66
|
+
|
67
|
+
* **Breaking change**: Rename `ButtonMarketingComponent` `button_type` argument to `scheme`.
|
68
|
+
|
69
|
+
*Manuel Puyol*
|
70
|
+
|
71
|
+
* **Breaking change**: Rename `StateComponent` `color` argument to `scheme`.
|
72
|
+
|
73
|
+
*Manuel Puyol*
|
74
|
+
|
75
|
+
## 0.0.33
|
76
|
+
|
77
|
+
* Remove `TabbedComponent` validation requiring a tab to be selected.
|
78
|
+
|
79
|
+
*Manuel Puyol*
|
80
|
+
|
81
|
+
## 0.0.32
|
82
|
+
|
83
|
+
* Allow passing the icon name as a positional argument to `OcticonComponent`.
|
84
|
+
|
85
|
+
*Manuel Puyol*
|
86
|
+
|
87
|
+
* Promote `TimeAgoComponent` to beta.
|
88
|
+
|
89
|
+
*Manuel Puyol*
|
90
|
+
|
91
|
+
* **Breaking change**: Update `TabNav#tab` API to accept the tab content as a block and panel content as a slot.
|
92
|
+
|
93
|
+
*Manuel Puyol*
|
94
|
+
|
95
|
+
* **Breaking change**: Update `UnderlineNavComponent` API be more strict and support `TabContainer`.
|
96
|
+
|
97
|
+
*Manuel Puyol*
|
98
|
+
|
5
99
|
## 0.0.31
|
6
100
|
|
7
101
|
* Fix `Popover` bug where body was only returning the last line of the HTML.
|
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
|
|
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
module Primer
|
4
4
|
# Use AutoComplete to populate input values from server search results.
|
5
|
-
class
|
6
|
-
|
5
|
+
class AutoComplete < Primer::Component
|
6
|
+
status :beta
|
7
7
|
|
8
8
|
DEFAULT_INPUT_TYPE = :text
|
9
9
|
INPUT_TYPE_OPTIONS = [DEFAULT_INPUT_TYPE, :search].freeze
|
10
10
|
|
11
11
|
# Required input used to search for results
|
12
12
|
#
|
13
|
-
# @param type [Symbol] <%= one_of(Primer::
|
13
|
+
# @param type [Symbol] <%= one_of(Primer::AutoComplete::INPUT_TYPE_OPTIONS) %>
|
14
14
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
15
15
|
renders_one :input, lambda { |type: DEFAULT_INPUT_TYPE, classes: "form-control", **system_arguments|
|
16
16
|
system_arguments[:tag] = :input
|
@@ -37,40 +37,40 @@ module Primer
|
|
37
37
|
}
|
38
38
|
|
39
39
|
# @example Default
|
40
|
-
# <%= render(Primer::
|
40
|
+
# <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
|
41
41
|
# <% c.input(type: :text, name: "input") %>
|
42
42
|
# <% c.results do %>
|
43
|
-
# <%= render(Primer::
|
43
|
+
# <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
|
44
44
|
# Selected
|
45
45
|
# <% end %>
|
46
|
-
# <%= render(Primer::
|
46
|
+
# <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
|
47
47
|
# Not selected
|
48
48
|
# <% end %>
|
49
49
|
# <% end %>
|
50
50
|
# <% end %>
|
51
51
|
#
|
52
52
|
# @example With custom classes for the results
|
53
|
-
# <%= render(Primer::
|
53
|
+
# <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
|
54
54
|
# <% c.input(type: :text, name: "input") %>
|
55
55
|
# <% c.results(classes: "my-custom-class") do %>
|
56
|
-
# <%= render(Primer::
|
56
|
+
# <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
|
57
57
|
# Selected
|
58
58
|
# <% end %>
|
59
|
-
# <%= render(Primer::
|
59
|
+
# <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
|
60
60
|
# Not selected
|
61
61
|
# <% end %>
|
62
62
|
# <% end %>
|
63
63
|
# <% end %>
|
64
64
|
#
|
65
65
|
# @example With Icon
|
66
|
-
# <%= render(Primer::
|
66
|
+
# <%= render(Primer::AutoComplete.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
|
67
67
|
# <% c.input(type: :text, name: "input") %>
|
68
68
|
# <% c.icon(icon: :search) %>
|
69
69
|
# <% c.results do %>
|
70
|
-
# <%= render(Primer::
|
70
|
+
# <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
|
71
71
|
# Selected
|
72
72
|
# <% end %>
|
73
|
-
# <%= render(Primer::
|
73
|
+
# <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
|
74
74
|
# Not selected
|
75
75
|
# <% end %>
|
76
76
|
# <% end %>
|
data/app/components/primer/{auto_complete_component.d.ts → auto_complete/auto_complete.d.ts}
RENAMED
File without changes
|
data/app/components/primer/{auto_complete_component.html.erb → auto_complete/auto_complete.html.erb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@github/auto-complete-element';
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@github/auto-complete-element';
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
class AutoComplete
|
5
|
+
# Use AutoCompleteItem to list results of an auto-completed search.
|
6
|
+
class Item < Primer::Component
|
7
|
+
status :beta
|
8
|
+
|
9
|
+
# @example Default
|
10
|
+
# <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
|
11
|
+
# Selected
|
12
|
+
# <% end %>
|
13
|
+
# <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
|
14
|
+
# Not selected
|
15
|
+
# <% end %>
|
16
|
+
#
|
17
|
+
# @param value [String] Value of the item.
|
18
|
+
# @param selected [Boolean] Whether the item is selected.
|
19
|
+
# @param disabled [Boolean] Whether the item is disabled.
|
20
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
21
|
+
def initialize(value:, selected: false, disabled: false, **system_arguments)
|
22
|
+
@system_arguments = system_arguments
|
23
|
+
@system_arguments[:tag] = :li
|
24
|
+
@system_arguments[:role] = :option
|
25
|
+
@system_arguments[:"data-autocomplete-value"] = value
|
26
|
+
|
27
|
+
@system_arguments[:"aria-selected"] = true if selected
|
28
|
+
@system_arguments[:"aria-disabled"] = true if disabled
|
29
|
+
|
30
|
+
@system_arguments[:classes] = class_names(
|
31
|
+
"autocomplete-item",
|
32
|
+
system_arguments[:classes],
|
33
|
+
"disabled" => disabled
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def call
|
38
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -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))
|