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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +94 -0
  3. data/README.md +2 -2
  4. data/app/components/primer/{auto_complete_component.rb → auto_complete.rb} +12 -12
  5. data/app/components/primer/{auto_complete_component.d.ts → auto_complete/auto_complete.d.ts} +0 -0
  6. data/app/components/primer/{auto_complete_component.html.erb → auto_complete/auto_complete.html.erb} +0 -0
  7. data/app/components/primer/{auto_complete_component.js → auto_complete/auto_complete.js} +0 -0
  8. data/app/components/primer/{auto_complete_component.ts → auto_complete/auto_complete.ts} +0 -0
  9. data/app/components/primer/auto_complete/auto_component.d.ts +1 -0
  10. data/app/components/primer/auto_complete/auto_component.js +1 -0
  11. data/app/components/primer/auto_complete/item.rb +42 -0
  12. data/app/components/primer/avatar_stack_component.rb +1 -1
  13. data/app/components/primer/base_component.rb +115 -85
  14. data/app/components/primer/blankslate_component.html.erb +1 -1
  15. data/app/components/primer/blankslate_component.rb +0 -2
  16. data/app/components/primer/border_box_component.rb +0 -2
  17. data/app/components/primer/breadcrumb_component.rb +0 -1
  18. data/app/components/primer/button_component.rb +37 -16
  19. data/app/components/primer/button_group_component.rb +3 -5
  20. data/app/components/primer/button_marketing_component.rb +12 -12
  21. data/app/components/primer/close_button.rb +30 -0
  22. data/app/components/primer/component.rb +3 -0
  23. data/app/components/primer/details_component.rb +0 -1
  24. data/app/components/primer/dropdown/menu_component.rb +0 -2
  25. data/app/components/primer/dropdown_component.rb +1 -3
  26. data/app/components/primer/dropdown_menu_component.rb +1 -1
  27. data/app/components/primer/flash_component.html.erb +2 -2
  28. data/app/components/primer/flash_component.rb +10 -12
  29. data/app/components/primer/foo_bar.d.ts +1 -0
  30. data/app/components/primer/foo_bar.js +1 -0
  31. data/app/components/primer/hidden_text_expander.rb +43 -0
  32. data/app/components/primer/layout_component.rb +0 -2
  33. data/app/components/primer/link_component.rb +9 -9
  34. data/app/components/primer/menu_component.rb +2 -4
  35. data/app/components/primer/navigation/tab_component.html.erb +11 -0
  36. data/app/components/primer/navigation/tab_component.rb +126 -0
  37. data/app/components/primer/octicon_component.rb +5 -8
  38. data/app/components/primer/popover_component.rb +0 -1
  39. data/app/components/primer/primer.d.ts +1 -1
  40. data/app/components/primer/primer.js +1 -1
  41. data/app/components/primer/primer.ts +1 -1
  42. data/app/components/primer/progress_bar_component.rb +0 -1
  43. data/app/components/primer/spinner_component.html.erb +1 -3
  44. data/app/components/primer/spinner_component.rb +1 -0
  45. data/app/components/primer/state_component.rb +13 -13
  46. data/app/components/primer/subhead_component.rb +1 -3
  47. data/app/components/primer/tab_nav_component.html.erb +8 -10
  48. data/app/components/primer/tab_nav_component.rb +63 -76
  49. data/app/components/primer/time_ago_component.rb +2 -1
  50. data/app/components/primer/timeline_item_component.rb +1 -2
  51. data/app/components/primer/{truncate_component.rb → truncate.rb} +8 -6
  52. data/app/components/primer/underline_nav_component.html.erb +19 -7
  53. data/app/components/primer/underline_nav_component.rb +114 -16
  54. data/app/lib/primer/classify.rb +5 -14
  55. data/app/lib/primer/classify/cache.rb +14 -4
  56. data/app/lib/primer/classify/spacing.rb +63 -0
  57. data/app/lib/primer/tabbed_component_helper.rb +39 -0
  58. data/app/lib/primer/view_helper.rb +2 -2
  59. data/lib/primer/view_components/version.rb +1 -1
  60. data/static/statuses.json +1 -1
  61. metadata +110 -31
  62. data/app/assets/javascripts/primer_view_components.js.map.orig +0 -5
  63. data/app/assets/javascripts/primer_view_components.js.orig +0 -6
  64. data/app/components/primer/auto_complete_item_component.rb +0 -40
  65. data/app/components/primer/slot.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f3b2f2609173d59173576d7bd384ae8902540a1be4434930c9b982d3f86c50c
4
- data.tar.gz: 4d0d573d72270fcb808857fa502a9cda31279755dc7859121301e97ea6a1b305
3
+ metadata.gz: ccc56525f479af9da0ee1dea8985e5a54aad6567e9ec932eef93707b896b91d3
4
+ data.tar.gz: c718f55ccc5e7fc6d76640410c4c2f3df140f45ab4765eeef3d3e3355893ed07
5
5
  SHA512:
6
- metadata.gz: f14ba8ad8f0698e04791c839ac68f1f355c15d37436306c510589c3a67f1197cdc7449ee4301f87b5cecf6f0234c5d704c074ecdc52fd3d5dbad735d9b7bd6c9
7
- data.tar.gz: a6b4b86bd72500b3d853a5ca2f68a14b76188a6e219b33f091d992f509772dd7f0e707d1a609b2a8ff4e382f6237104b4423c5ba9bec6ca8a0b0cf8c7822417a
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/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
 
@@ -2,15 +2,15 @@
2
2
 
3
3
  module Primer
4
4
  # Use AutoComplete to populate input values from server search results.
5
- class AutoCompleteComponent < Primer::Component
6
- include ViewComponent::SlotableV2
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::AutoCompleteComponent::INPUT_TYPE_OPTIONS) %>
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::AutoCompleteComponent.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
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::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
43
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
44
44
  # Selected
45
45
  # <% end %>
46
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
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::AutoCompleteComponent.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
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::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
56
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
57
57
  # Selected
58
58
  # <% end %>
59
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
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::AutoCompleteComponent.new(src: "/users/search", id: "user-popup", position: :relative)) do |c| %>
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::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
70
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
71
71
  # Selected
72
72
  # <% end %>
73
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
73
+ # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
74
74
  # Not selected
75
75
  # <% end %>
76
76
  # <% end %>
@@ -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
@@ -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))