primer_view_components 0.0.32 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -0
  3. data/README.md +1 -1
  4. data/app/components/primer/{auto_complete_component.rb → auto_complete.rb} +13 -11
  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 +2 -0
  13. data/app/components/primer/base_component.rb +115 -85
  14. data/app/components/primer/button_component.rb +37 -16
  15. data/app/components/primer/button_group_component.rb +3 -3
  16. data/app/components/primer/button_marketing_component.rb +12 -12
  17. data/app/components/primer/close_button.rb +30 -0
  18. data/app/components/primer/component.rb +1 -0
  19. data/app/components/primer/dropdown_component.rb +1 -1
  20. data/app/components/primer/dropdown_menu_component.rb +1 -1
  21. data/app/components/primer/flash_component.rb +10 -10
  22. data/app/components/primer/foo_bar.d.ts +1 -0
  23. data/app/components/primer/foo_bar.js +1 -0
  24. data/app/components/primer/hidden_text_expander.rb +43 -0
  25. data/app/components/primer/link_component.rb +9 -9
  26. data/app/components/primer/navigation/tab_component.html.erb +9 -7
  27. data/app/components/primer/navigation/tab_component.rb +27 -3
  28. data/app/components/primer/octicon_component.rb +0 -4
  29. data/app/components/primer/primer.d.ts +1 -1
  30. data/app/components/primer/primer.js +1 -1
  31. data/app/components/primer/primer.ts +1 -1
  32. data/app/components/primer/state_component.rb +13 -13
  33. data/app/components/primer/subhead_component.rb +1 -1
  34. data/app/components/primer/tab_nav_component.html.erb +2 -2
  35. data/app/components/primer/tab_nav_component.rb +22 -8
  36. data/app/components/primer/{truncate_component.rb → truncate.rb} +8 -6
  37. data/app/components/primer/underline_nav_component.rb +46 -14
  38. data/app/lib/primer/classify.rb +3 -12
  39. data/app/lib/primer/classify/cache.rb +14 -4
  40. data/app/lib/primer/classify/spacing.rb +63 -0
  41. data/app/lib/primer/tabbed_component_helper.rb +4 -2
  42. data/lib/primer/view_components/version.rb +1 -1
  43. data/static/statuses.json +1 -1
  44. metadata +107 -30
  45. data/app/assets/javascripts/primer_view_components.js.map.orig +0 -5
  46. data/app/assets/javascripts/primer_view_components.js.orig +0 -6
  47. data/app/components/primer/auto_complete_item_component.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b994be67e7454dab595ebdf8745db530f855ef34a9ce292e6b8110ae4f2cf060
4
- data.tar.gz: 33c5ee3a0e757c39434451c2c86ff32586add5f06636e4dfb6f89a52ac89cd59
3
+ metadata.gz: 99ba38719e7e512bdae00f2cacc9ccfcadfd9e6e1aa3be9cf35609a726f35683
4
+ data.tar.gz: 7b070fe5c45b26c99028e66c3eefc42e40bdd7ce1384ecfa37190ebc6e31d976
5
5
  SHA512:
6
- metadata.gz: 3f526574142849b3312b6029688b59532faa4e7f82e6377128eadbcfeec78decba9ed2aa514a452029afe6946102114338d681348e91eedb681a3a964e1c8463
7
- data.tar.gz: 20b4c8a3541de434cdebf3b40c1e07e610dc366a456f937003a05c31f0f9a074090337849fcf4c72cccbca06641ab3705952805c13f211013abe8549e58645bb
6
+ metadata.gz: 48d665ac5c95897a59d7ba73ccc669ea202d20067e8e4a2389262556129f55354bb14d1e131ae987dfe16b2757e62a2dfb7916da8b84bccea039a84a5cde6ee7
7
+ data.tar.gz: cad49d95fb02936ebd247c808c44498708aaf1febefff38155845f244a94bbd6fbd4bc55ef3924d164b8df6dc739de95ee914312598082a966bff57789fb28c3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,88 @@
2
2
 
3
3
  ## main
4
4
 
5
+ ## 0.0.37
6
+
7
+ * Update NPM package to include subdirectory JS files.
8
+
9
+ *Manuel Puyol*
10
+
11
+ ## 0.0.36
12
+
13
+ * Add `block` flag to `ButtonComponent`.
14
+
15
+ *Manuel Puyol*
16
+
17
+ * Add `link` and `invisible` schemes to `ButtonComponent`.
18
+
19
+ *Manuel Puyol*
20
+
21
+ * Create `CloseButton` and `HiddenTextExpander` component.
22
+
23
+ *Manuel Puyol*
24
+
25
+ * **Breaking change**: Rename `AutoCompleteComponent` to `AutoComplete` and `AutoCompleteItemComponent` to `AutoComplete::Item`.
26
+
27
+ *Manuel Puyol*
28
+
29
+ * **Breaking change**: Rename `TruncateComponent` to `Truncate` and promote it to beta.
30
+
31
+ *Manuel Puyol*
32
+
33
+ ## 0.0.35
34
+
35
+ * Promote `AutoCompleteComponent`, `AutoCompleteItemComponent`, `AvatarStackComponent` and `ButtonComponent` to beta.
36
+
37
+ *Manuel Puyol*
38
+
39
+ * Allow `UnderlineNav` tabs to be rendered as a `<ul><li>` list.
40
+
41
+ *Manuel Puyol*
42
+
43
+ * _Accessibility:_ Don't add tab roles when `UnderlineNav` or `TabNav` use link redirects.
44
+
45
+ *Manuel Puyol*
46
+
47
+ * **Breaking change**: Make `label` required for `UnderlineNav` and `TabNav`.
48
+
49
+ *Manuel Puyol*
50
+
51
+ ## 0.0.34
52
+
53
+ * Add `p: :responsive` and `m: :auto` system arguments.
54
+
55
+ *Manuel Puyol*
56
+
57
+ * Remove `my: :auto` and negative `m:` system arguments.
58
+
59
+ *Manuel Puyol*
60
+
61
+ * **Breaking change**: Rename `FlashComponent` `variant` argument to `scheme`.
62
+
63
+ *Manuel Puyol*
64
+
65
+ * **Breaking change**: Rename `LinkComponent` `variant` argument to `scheme`.
66
+
67
+ *Manuel Puyol*
68
+
69
+ * **Breaking change**: Rename `ButtonComponent` `button_type` argument to `scheme`.
70
+
71
+ *Manuel Puyol*
72
+
73
+ * **Breaking change**: Rename `ButtonMarketingComponent` `button_type` argument to `scheme`.
74
+
75
+ *Manuel Puyol*
76
+
77
+ * **Breaking change**: Rename `StateComponent` `color` argument to `scheme`.
78
+
79
+ *Manuel Puyol*
80
+
81
+ ## 0.0.33
82
+
83
+ * Remove `TabbedComponent` validation requiring a tab to be selected.
84
+
85
+ *Manuel Puyol*
86
+
5
87
  ## 0.0.32
6
88
 
7
89
  * Allow passing the icon name as a positional argument to `OcticonComponent`.
data/README.md CHANGED
@@ -1,5 +1,5 @@
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>
@@ -2,13 +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
5
+ class AutoComplete < Primer::Component
6
+ status :beta
7
+
6
8
  DEFAULT_INPUT_TYPE = :text
7
9
  INPUT_TYPE_OPTIONS = [DEFAULT_INPUT_TYPE, :search].freeze
8
10
 
9
11
  # Required input used to search for results
10
12
  #
11
- # @param type [Symbol] <%= one_of(Primer::AutoCompleteComponent::INPUT_TYPE_OPTIONS) %>
13
+ # @param type [Symbol] <%= one_of(Primer::AutoComplete::INPUT_TYPE_OPTIONS) %>
12
14
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
13
15
  renders_one :input, lambda { |type: DEFAULT_INPUT_TYPE, classes: "form-control", **system_arguments|
14
16
  system_arguments[:tag] = :input
@@ -35,40 +37,40 @@ module Primer
35
37
  }
36
38
 
37
39
  # @example Default
38
- # <%= 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| %>
39
41
  # <% c.input(type: :text, name: "input") %>
40
42
  # <% c.results do %>
41
- # <%= render(Primer::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
43
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
42
44
  # Selected
43
45
  # <% end %>
44
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
46
+ # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
45
47
  # Not selected
46
48
  # <% end %>
47
49
  # <% end %>
48
50
  # <% end %>
49
51
  #
50
52
  # @example With custom classes for the results
51
- # <%= 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| %>
52
54
  # <% c.input(type: :text, name: "input") %>
53
55
  # <% c.results(classes: "my-custom-class") do %>
54
- # <%= render(Primer::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
56
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
55
57
  # Selected
56
58
  # <% end %>
57
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
59
+ # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
58
60
  # Not selected
59
61
  # <% end %>
60
62
  # <% end %>
61
63
  # <% end %>
62
64
  #
63
65
  # @example With Icon
64
- # <%= 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| %>
65
67
  # <% c.input(type: :text, name: "input") %>
66
68
  # <% c.icon(icon: :search) %>
67
69
  # <% c.results do %>
68
- # <%= render(Primer::AutoCompleteItemComponent.new(selected: true, value: "value")) do |c| %>
70
+ # <%= render(Primer::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
69
71
  # Selected
70
72
  # <% end %>
71
- # <%= render(Primer::AutoCompleteItemComponent.new(value: "value")) do |c| %>
73
+ # <%= render(Primer::AutoComplete::Item.new(value: "value")) do |c| %>
72
74
  # Not selected
73
75
  # <% end %>
74
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,6 +3,8 @@
3
3
  module Primer
4
4
  # Use AvatarStack to stack multiple avatars together.
5
5
  class AvatarStackComponent < Primer::Component
6
+ status :beta
7
+
6
8
  ALIGN_DEFAULT = :left
7
9
  ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
8
10
 
@@ -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))