primer_view_components 0.0.61 → 0.0.62
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 +44 -2
- data/app/components/primer/alpha/border_box/header.rb +1 -2
- data/app/components/primer/alpha/button_marketing.rb +4 -4
- data/app/components/primer/alpha/tab_nav.rb +1 -1
- data/app/components/primer/alpha/tab_panels.rb +2 -2
- data/app/components/primer/alpha/underline_nav.rb +2 -1
- data/app/components/primer/alpha/underline_panels.rb +2 -2
- data/app/components/primer/base_component.rb +8 -36
- data/app/components/primer/beta/auto_complete/item.rb +1 -1
- data/app/components/primer/beta/auto_complete.rb +4 -2
- data/app/components/primer/beta/avatar.rb +1 -1
- data/app/components/primer/beta/blankslate.html.erb +2 -2
- data/app/components/primer/beta/blankslate.rb +6 -3
- data/app/components/primer/beta/breadcrumbs.rb +2 -2
- data/app/components/primer/beta/text.rb +1 -1
- data/app/components/primer/border_box_component.rb +1 -1
- data/app/components/primer/box_component.rb +3 -2
- data/app/components/primer/button_component.html.erb +3 -9
- data/app/components/primer/button_component.rb +21 -2
- data/app/components/primer/button_group.rb +1 -1
- data/app/components/primer/clipboard_copy.rb +1 -1
- data/app/components/primer/close_button.rb +1 -1
- data/app/components/primer/component.rb +71 -0
- data/app/components/primer/counter_component.rb +1 -1
- data/app/components/primer/details_component.rb +1 -1
- data/app/components/primer/dropdown/menu.rb +1 -1
- data/app/components/primer/dropdown.html.erb +0 -1
- data/app/components/primer/dropdown.rb +1 -0
- data/app/components/primer/dropdown_menu_component.rb +1 -1
- data/app/components/primer/flash_component.rb +2 -1
- data/app/components/primer/flex_component.rb +16 -16
- data/app/components/primer/flex_item_component.rb +1 -1
- data/app/components/primer/hellip_button.rb +1 -1
- data/app/components/primer/hidden_text_expander.rb +1 -1
- data/app/components/primer/image.rb +1 -1
- data/app/components/primer/image_crop.rb +2 -1
- data/app/components/primer/layout_component.rb +1 -0
- data/app/components/primer/local_time.rb +1 -1
- data/app/components/primer/markdown.rb +1 -1
- data/app/components/primer/menu_component.rb +2 -1
- data/app/components/primer/navigation/tab_component.rb +1 -0
- data/app/components/primer/octicon_symbols_component.rb +2 -2
- data/app/components/primer/popover_component.rb +1 -1
- data/app/components/primer/progress_bar_component.rb +7 -6
- data/app/components/primer/spinner_component.rb +1 -1
- data/app/components/primer/subhead_component.rb +3 -1
- data/app/components/primer/tab_container_component.rb +1 -1
- data/app/components/primer/time_ago_component.rb +1 -1
- data/app/components/primer/timeline_item_component.rb +4 -3
- data/app/components/primer/tooltip.rb +1 -0
- data/lib/primer/classify/utilities.rb +26 -23
- data/lib/primer/classify/utilities.yml +192 -68
- data/lib/primer/classify.rb +92 -178
- data/lib/primer/view_components/linters/blankslate_api_migration.rb +11 -5
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/deprecated_layout_component.rb +30 -0
- data/lib/rubocop/cop/primer/primer_octicon.rb +1 -3
- data/lib/tasks/custom_utilities.yml +192 -0
- data/lib/tasks/docs.rake +1 -1
- data/lib/tasks/utilities.rake +6 -2
- data/static/classes.yml +14 -14
- data/static/constants.json +3 -3
- metadata +4 -4
- data/lib/primer/classify/cache.rb +0 -109
- data/lib/primer/classify/flex.rb +0 -111
@@ -61,31 +61,31 @@ module Primer
|
|
61
61
|
ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse].freeze
|
62
62
|
|
63
63
|
# @example Default
|
64
|
-
# <%= render(Primer::FlexComponent.new(bg: :
|
65
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
66
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
67
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
64
|
+
# <%= render(Primer::FlexComponent.new(bg: :subtle)) do %>
|
65
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
66
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
67
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
68
68
|
# <% end %>
|
69
69
|
#
|
70
70
|
# @example Justify center
|
71
|
-
# <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :
|
72
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
73
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
74
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
71
|
+
# <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :subtle)) do %>
|
72
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
73
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
74
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
75
75
|
# <% end %>
|
76
76
|
#
|
77
77
|
# @example Align end
|
78
|
-
# <%= render(Primer::FlexComponent.new(align_items: :end, bg: :
|
79
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
80
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
81
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
78
|
+
# <%= render(Primer::FlexComponent.new(align_items: :end, bg: :subtle)) do %>
|
79
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
80
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
81
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
82
82
|
# <% end %>
|
83
83
|
#
|
84
84
|
# @example Direction column
|
85
|
-
# <%= render(Primer::FlexComponent.new(direction: :column, bg: :
|
86
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
87
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
88
|
-
# <%= render(Primer::BoxComponent.new(p: 5, bg: :
|
85
|
+
# <%= render(Primer::FlexComponent.new(direction: :column, bg: :subtle)) do %>
|
86
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
87
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
88
|
+
# <%= render(Primer::BoxComponent.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
89
89
|
# <% end %>
|
90
90
|
#
|
91
91
|
# @param justify_content [Symbol] Use this param to distribute space between and around flex items along the main axis of the container. <%= one_of(Primer::FlexComponent::JUSTIFY_CONTENT_OPTIONS) %>
|
@@ -20,7 +20,7 @@ module Primer
|
|
20
20
|
# @param inline [Boolean] Whether or not the button is inline.
|
21
21
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
22
22
|
def initialize(inline: false, **system_arguments)
|
23
|
-
@system_arguments = system_arguments
|
23
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
24
24
|
|
25
25
|
validate_aria_label
|
26
26
|
|
@@ -22,7 +22,7 @@ module Primer
|
|
22
22
|
# @param button_arguments [Hash] <%= link_to_system_arguments_docs %> for the button element.
|
23
23
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
24
24
|
def initialize(inline: false, button_arguments: {}, **system_arguments)
|
25
|
-
@system_arguments = system_arguments
|
25
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
26
26
|
@button_arguments = button_arguments
|
27
27
|
|
28
28
|
@system_arguments[:tag] = :span
|
@@ -27,7 +27,7 @@ module Primer
|
|
27
27
|
# @param lazy [Boolean] Whether or not to lazily load the image.
|
28
28
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
29
29
|
def initialize(src:, alt:, lazy: false, **system_arguments)
|
30
|
-
@system_arguments = system_arguments
|
30
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
31
31
|
|
32
32
|
@system_arguments[:tag] = :img
|
33
33
|
@system_arguments[:src] = src
|
@@ -6,6 +6,7 @@ module Primer
|
|
6
6
|
# A loading indicator that is shown while the image is loading.
|
7
7
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
8
8
|
renders_one :loading, lambda { |**system_arguments|
|
9
|
+
deny_tag_argument(**system_arguments)
|
9
10
|
system_arguments[:tag] = :div
|
10
11
|
system_arguments[:"data-loading-slot"] = true
|
11
12
|
|
@@ -27,7 +28,7 @@ module Primer
|
|
27
28
|
# @param rounded [Boolean] If the crop mask should be a circle. Defaults to true.
|
28
29
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
29
30
|
def initialize(src:, rounded: true, **system_arguments)
|
30
|
-
@system_arguments = system_arguments
|
31
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
31
32
|
@system_arguments[:tag] = "image-crop"
|
32
33
|
@system_arguments[:src] = src
|
33
34
|
@system_arguments[:rounded] = true if rounded
|
@@ -7,6 +7,7 @@ module Primer
|
|
7
7
|
#
|
8
8
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
9
9
|
renders_one :main, lambda { |**system_arguments|
|
10
|
+
deny_tag_argument(**system_arguments)
|
10
11
|
system_arguments[:classes] = class_names("flex-shrink-0", system_arguments[:classes])
|
11
12
|
system_arguments[:col] = (@responsive ? [12, nil, @main_col] : @main_col)
|
12
13
|
system_arguments[:mb] = (@responsive ? [4, nil, 0] : nil)
|
@@ -33,7 +33,7 @@ module Primer
|
|
33
33
|
# @param time_zone_name [Symbol] <%= one_of(Primer::LocalTime::TEXT_TYPE_OPTIONS) %>
|
34
34
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
35
35
|
def initialize(datetime:, initial_text: nil, weekday: DEFAULT_TEXT_TYPE, year: DEFAULT_DIGIT_TYPE, month: DEFAULT_TEXT_TYPE, day: DEFAULT_DIGIT_TYPE, hour: DEFAULT_DIGIT_TYPE, minute: DEFAULT_DIGIT_TYPE, second: DEFAULT_DIGIT_TYPE, time_zone_name: DEFAULT_TEXT_TYPE, **system_arguments)
|
36
|
-
@system_arguments = system_arguments
|
36
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
37
37
|
|
38
38
|
@datetime = datetime
|
39
39
|
|
@@ -26,6 +26,7 @@ module Primer
|
|
26
26
|
# @param selected [Boolean] Whether the item is the current selection
|
27
27
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
28
28
|
renders_many :items, lambda { |href:, selected: false, **system_arguments|
|
29
|
+
deny_tag_argument(**system_arguments)
|
29
30
|
system_arguments[:tag] = :a
|
30
31
|
system_arguments[:href] = href
|
31
32
|
system_arguments[:"aria-current"] = :page if selected
|
@@ -58,7 +59,7 @@ module Primer
|
|
58
59
|
#
|
59
60
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
60
61
|
def initialize(**system_arguments)
|
61
|
-
@system_arguments = system_arguments
|
62
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
62
63
|
@system_arguments[:tag] = :nav
|
63
64
|
@system_arguments[:classes] = class_names(
|
64
65
|
"menu",
|
@@ -6,8 +6,8 @@ module Primer
|
|
6
6
|
# OcticonSymbols renders a symbol dictionary using a list of <%= link_to_octicons %>.
|
7
7
|
class OcticonSymbolsComponent < Primer::Component
|
8
8
|
# @example Symbol dictionary
|
9
|
-
# <%= render(Primer::OcticonComponent.new(icon: :check, use_symbol: true, color: :
|
10
|
-
# <%= render(Primer::OcticonComponent.new(icon: :check, use_symbol: true, color: :
|
9
|
+
# <%= render(Primer::OcticonComponent.new(icon: :check, use_symbol: true, color: :success)) %>
|
10
|
+
# <%= render(Primer::OcticonComponent.new(icon: :check, use_symbol: true, color: :danger)) %>
|
11
11
|
# <%= render(Primer::OcticonComponent.new(icon: :check, use_symbol: true, size: :medium)) %>
|
12
12
|
# <%= render(Primer::OcticonSymbolsComponent.new(icons: [{ symbol: :check }, { symbol: :check, size: :medium }])) %>
|
13
13
|
#
|
@@ -108,7 +108,7 @@ module Primer
|
|
108
108
|
#
|
109
109
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
110
110
|
def initialize(**system_arguments)
|
111
|
-
@system_arguments = system_arguments
|
111
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
112
112
|
@system_arguments[:tag] = :div
|
113
113
|
@system_arguments[:classes] = class_names(
|
114
114
|
system_arguments[:classes],
|
@@ -10,7 +10,8 @@ module Primer
|
|
10
10
|
# @param percentage [Integer] The percent complete
|
11
11
|
# @param bg [Symbol] The background color
|
12
12
|
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
13
|
-
renders_many :items, lambda { |percentage: 0, bg: :
|
13
|
+
renders_many :items, lambda { |percentage: 0, bg: :success_emphasis, **system_arguments|
|
14
|
+
deny_tag_argument(**system_arguments)
|
14
15
|
system_arguments[:tag] = :span
|
15
16
|
system_arguments[:bg] = bg
|
16
17
|
system_arguments[:style] = join_style_arguments(system_arguments[:style], "width: #{percentage}%;")
|
@@ -35,25 +36,25 @@ module Primer
|
|
35
36
|
#
|
36
37
|
# @example Small
|
37
38
|
# <%= render(Primer::ProgressBarComponent.new(size: :small)) do |component| %>
|
38
|
-
# <% component.item(bg: :
|
39
|
+
# <% component.item(bg: :accent_emphasis, percentage: 50) %>
|
39
40
|
# <% end %>
|
40
41
|
#
|
41
42
|
# @example Large
|
42
43
|
# <%= render(Primer::ProgressBarComponent.new(size: :large)) do |component| %>
|
43
|
-
# <% component.item(bg: :
|
44
|
+
# <% component.item(bg: :danger_emphasis, percentage: 75) %>
|
44
45
|
# <% end %>
|
45
46
|
#
|
46
47
|
# @example Multiple items
|
47
48
|
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
48
49
|
# <% component.item(percentage: 10) %>
|
49
|
-
# <% component.item(bg: :
|
50
|
-
# <% component.item(bg: :
|
50
|
+
# <% component.item(bg: :accent_emphasis, percentage: 20) %>
|
51
|
+
# <% component.item(bg: :danger_emphasis, percentage: 30) %>
|
51
52
|
# <% end %>
|
52
53
|
#
|
53
54
|
# @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
|
54
55
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
55
56
|
def initialize(size: SIZE_DEFAULT, **system_arguments)
|
56
|
-
@system_arguments = system_arguments
|
57
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
57
58
|
@system_arguments[:classes] = class_names(
|
58
59
|
@system_arguments[:classes],
|
59
60
|
"Progress",
|
@@ -30,7 +30,7 @@ module Primer
|
|
30
30
|
# @param style [String] Custom element styles.
|
31
31
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
32
32
|
def initialize(size: DEFAULT_SIZE, style: DEFAULT_STYLE, **system_arguments)
|
33
|
-
@system_arguments = system_arguments
|
33
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
34
34
|
@system_arguments[:tag] = :svg
|
35
35
|
@system_arguments[:style] ||= style
|
36
36
|
@system_arguments[:animation] = :rotate
|
@@ -36,6 +36,7 @@ module Primer
|
|
36
36
|
#
|
37
37
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
38
38
|
renders_one :actions, lambda { |**system_arguments|
|
39
|
+
deny_tag_argument(**system_arguments)
|
39
40
|
system_arguments[:tag] = :div
|
40
41
|
system_arguments[:classes] = class_names(system_arguments[:classes], "Subhead-actions")
|
41
42
|
|
@@ -46,6 +47,7 @@ module Primer
|
|
46
47
|
#
|
47
48
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
48
49
|
renders_one :description, lambda { |**system_arguments|
|
50
|
+
deny_tag_argument(**system_arguments)
|
49
51
|
system_arguments[:tag] = :div
|
50
52
|
system_arguments[:classes] = class_names(system_arguments[:classes], "Subhead-description")
|
51
53
|
|
@@ -111,7 +113,7 @@ module Primer
|
|
111
113
|
# @param hide_border [Boolean] Whether to hide the border under the heading.
|
112
114
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
113
115
|
def initialize(spacious: false, hide_border: false, **system_arguments)
|
114
|
-
@system_arguments = system_arguments
|
116
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
115
117
|
|
116
118
|
@system_arguments[:tag] = :div
|
117
119
|
@system_arguments[:classes] =
|
@@ -26,7 +26,7 @@ module Primer
|
|
26
26
|
#
|
27
27
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
28
28
|
def initialize(**system_arguments)
|
29
|
-
@system_arguments = system_arguments
|
29
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
30
30
|
@system_arguments[:tag] = "tab-container"
|
31
31
|
end
|
32
32
|
|
@@ -12,7 +12,7 @@ module Primer
|
|
12
12
|
# @param micro [Boolean] If true then the text will be formatted in "micro" mode, using as few characters as possible
|
13
13
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
14
14
|
def initialize(time:, micro: false, **system_arguments)
|
15
|
-
@system_arguments = system_arguments
|
15
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
16
16
|
@system_arguments[:datetime] = time.utc.iso8601
|
17
17
|
@system_arguments[:classes] = class_names("no-wrap", @system_arguments[:classes])
|
18
18
|
@system_arguments[:tag] = "time-ago"
|
@@ -27,6 +27,7 @@ module Primer
|
|
27
27
|
#
|
28
28
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
29
29
|
renders_one :body, lambda { |**system_arguments|
|
30
|
+
deny_tag_argument(**system_arguments)
|
30
31
|
system_arguments[:tag] = :div
|
31
32
|
system_arguments[:classes] = class_names(
|
32
33
|
"TimelineItem-body",
|
@@ -40,7 +41,7 @@ module Primer
|
|
40
41
|
# <div style="padding-left: 60px">
|
41
42
|
# <%= render(Primer::TimelineItemComponent.new) do |component| %>
|
42
43
|
# <% component.avatar(src: "https://github.com/github.png", alt: "github") %>
|
43
|
-
# <% component.badge(bg: :
|
44
|
+
# <% component.badge(bg: :success_emphasis, color: :on_emphasis, icon: :check) %>
|
44
45
|
# <% component.body { "Success!" } %>
|
45
46
|
# <% end %>
|
46
47
|
# </div>
|
@@ -48,7 +49,7 @@ module Primer
|
|
48
49
|
# @param condensed [Boolean] Reduce the vertical padding and remove the background from the badge item. Most commonly used in commits.
|
49
50
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
50
51
|
def initialize(condensed: false, **system_arguments)
|
51
|
-
@system_arguments = system_arguments
|
52
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
52
53
|
@system_arguments[:tag] = :div
|
53
54
|
@system_arguments[:classes] = class_names(
|
54
55
|
"TimelineItem",
|
@@ -67,7 +68,7 @@ module Primer
|
|
67
68
|
def initialize(icon: nil, **system_arguments)
|
68
69
|
@icon = icon
|
69
70
|
|
70
|
-
@system_arguments = system_arguments
|
71
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
71
72
|
@system_arguments[:tag] = :div
|
72
73
|
@system_arguments[:classes] = class_names(
|
73
74
|
"TimelineItem-badge",
|
@@ -72,6 +72,7 @@ module Primer
|
|
72
72
|
@system_arguments = system_arguments
|
73
73
|
@system_arguments[:tag] ||= :span # rubocop:disable Primer/NoTagMemoize
|
74
74
|
@system_arguments[:aria] = { label: label }
|
75
|
+
@system_arguments[:skip_aria_label_check] = true
|
75
76
|
|
76
77
|
@system_arguments[:classes] = class_names(
|
77
78
|
@system_arguments[:classes],
|
@@ -16,6 +16,7 @@ module Primer
|
|
16
16
|
)
|
17
17
|
).freeze
|
18
18
|
# rubocop:enable Security/YAMLLoad
|
19
|
+
|
19
20
|
BREAKPOINTS = ["", "-sm", "-md", "-lg", "-xl"].freeze
|
20
21
|
|
21
22
|
# Replacements for some classnames that end up being a different argument key
|
@@ -145,6 +146,30 @@ module Primer
|
|
145
146
|
end.join(", ")
|
146
147
|
end
|
147
148
|
|
149
|
+
def validate(key, val, breakpoint)
|
150
|
+
unless supported_key?(key)
|
151
|
+
raise ArgumentError, "#{key} is not a valid Primer utility key" if validate_class_names?
|
152
|
+
|
153
|
+
return ""
|
154
|
+
end
|
155
|
+
|
156
|
+
unless breakpoint.empty? || responsive?(key, val)
|
157
|
+
raise ArgumentError, "#{key} does not support responsive values" if validate_class_names?
|
158
|
+
|
159
|
+
return ""
|
160
|
+
end
|
161
|
+
|
162
|
+
unless supported_value?(key, val)
|
163
|
+
raise ArgumentError, "#{val} is not a valid value for :#{key}. Use one of #{mappings(key)}" if validate_class_names?
|
164
|
+
|
165
|
+
return nil if [true, false].include?(val)
|
166
|
+
|
167
|
+
return "#{key.to_s.dasherize}-#{val.to_s.dasherize}"
|
168
|
+
end
|
169
|
+
|
170
|
+
nil
|
171
|
+
end
|
172
|
+
|
148
173
|
private
|
149
174
|
|
150
175
|
def find_selector(selector)
|
@@ -160,7 +185,7 @@ module Primer
|
|
160
185
|
next unless classnames.include?(selector)
|
161
186
|
|
162
187
|
# Return [:mr, 0, 1]
|
163
|
-
# has index of classname, so we can match it up with
|
188
|
+
# has index of classname, so we can match it up with responsive array `mr: [nil, 0]`
|
164
189
|
return [key, key_argument, classnames.index(selector)]
|
165
190
|
end
|
166
191
|
|
@@ -174,28 +199,6 @@ module Primer
|
|
174
199
|
|
175
200
|
selector.split("-").first.to_sym
|
176
201
|
end
|
177
|
-
|
178
|
-
def validate(key, val, breakpoint)
|
179
|
-
unless supported_key?(key)
|
180
|
-
raise ArgumentError, "#{key} is not a valid Primer utility key" if validate_class_names?
|
181
|
-
|
182
|
-
return ""
|
183
|
-
end
|
184
|
-
|
185
|
-
unless breakpoint.empty? || responsive?(key, val)
|
186
|
-
raise ArgumentError, "#{key} does not support responsive values" if validate_class_names?
|
187
|
-
|
188
|
-
return ""
|
189
|
-
end
|
190
|
-
|
191
|
-
unless supported_value?(key, val)
|
192
|
-
raise ArgumentError, "#{val} is not a valid value for :#{key}. Use one of #{mappings(key)}" if validate_class_names?
|
193
|
-
|
194
|
-
return "#{key.to_s.dasherize}-#{val.to_s.dasherize}"
|
195
|
-
end
|
196
|
-
|
197
|
-
nil
|
198
|
-
end
|
199
202
|
end
|
200
203
|
end
|
201
204
|
end
|