primer_view_components 0.0.27 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/auto_complete_component.d.ts +1 -0
- data/app/components/primer/auto_complete_component.html.erb +5 -0
- data/app/components/primer/auto_complete_component.rb +98 -0
- data/app/components/primer/auto_complete_component.ts +1 -0
- data/app/components/primer/auto_complete_item_component.rb +40 -0
- data/app/components/primer/avatar_component.rb +6 -5
- data/app/components/primer/base_component.rb +2 -2
- data/app/components/primer/blankslate_component.html.erb +1 -5
- data/app/components/primer/border_box_component.rb +30 -2
- data/app/components/primer/box_component.rb +1 -1
- data/app/components/primer/component.rb +0 -1
- data/app/components/primer/counter_component.rb +15 -5
- data/app/components/primer/details_component.rb +1 -0
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flex_component.rb +16 -16
- data/app/components/primer/heading_component.rb +1 -1
- data/app/components/primer/label_component.rb +3 -7
- data/app/components/primer/link_component.rb +37 -7
- data/app/components/primer/octicon_component.rb +0 -1
- data/app/components/primer/popover_component.html.erb +3 -7
- data/app/components/primer/popover_component.rb +58 -62
- data/app/components/primer/primer.d.ts +3 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/progress_bar_component.rb +5 -5
- data/app/components/primer/tab_container_component.d.ts +1 -0
- data/app/components/primer/text_component.rb +3 -1
- data/app/components/primer/time_ago_component.d.ts +1 -0
- data/app/components/primer/timeline_item_component.rb +2 -1
- data/app/lib/primer/classify.rb +9 -14
- data/app/lib/primer/classify/cache.rb +7 -2
- data/app/lib/primer/classify/functional_background_colors.rb +61 -0
- data/app/lib/primer/classify/functional_border_colors.rb +51 -0
- data/app/lib/primer/classify/functional_colors.rb +66 -0
- data/app/lib/primer/classify/functional_text_colors.rb +62 -0
- data/app/lib/primer/fetch_or_fallback_helper.rb +13 -4
- data/app/lib/primer/view_helper.rb +9 -12
- data/lib/primer/view_components/engine.rb +4 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/static/statuses.json +1 -1
- metadata +28 -4
- data/app/lib/primer/classify/functional_colors.rb.orig +0 -124
- data/app/lib/primer/view_helper/dsl.rb +0 -34
@@ -3,7 +3,7 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use the Heading component to wrap a component that will create a heading element
|
5
5
|
class HeadingComponent < Primer::Component
|
6
|
-
|
6
|
+
status :beta
|
7
7
|
|
8
8
|
# @example Default
|
9
9
|
# <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
|
@@ -16,7 +16,8 @@ module Primer
|
|
16
16
|
orange: "Label--orange",
|
17
17
|
purple: "Label--purple"
|
18
18
|
}.freeze
|
19
|
-
|
19
|
+
DEPRECATED_SCHEME_OPTIONS = [:orange, :purple].freeze
|
20
|
+
SCHEME_OPTIONS = ([*SCHEME_MAPPINGS.keys, nil] - DEPRECATED_SCHEME_OPTIONS).freeze
|
20
21
|
|
21
22
|
VARIANT_MAPPINGS = {
|
22
23
|
large: "Label--large",
|
@@ -37,23 +38,18 @@ module Primer
|
|
37
38
|
# <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "Default" } %>
|
38
39
|
# <%= render(Primer::LabelComponent.new(title: "Label: Label", variant: :large)) { "Large" } %>
|
39
40
|
#
|
40
|
-
# @example Deprecated schemes
|
41
|
-
# <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :orange)) { "Orange" } %>
|
42
|
-
# <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :purple)) { "Purple" } %>
|
43
|
-
#
|
44
41
|
# @param title [String] `title` attribute for the component element.
|
45
42
|
# @param scheme [Symbol] <%= one_of(Primer::LabelComponent::SCHEME_MAPPINGS.keys) %>
|
46
43
|
# @param variant [Symbol] <%= one_of(Primer::LabelComponent::VARIANT_OPTIONS) %>
|
47
44
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
48
45
|
def initialize(title:, scheme: nil, variant: nil, **system_arguments)
|
49
46
|
@system_arguments = system_arguments
|
50
|
-
@system_arguments[:bg] = :blue if scheme.nil?
|
51
47
|
@system_arguments[:tag] ||= :span
|
52
48
|
@system_arguments[:title] = title
|
53
49
|
@system_arguments[:classes] = class_names(
|
54
50
|
"Label",
|
55
51
|
system_arguments[:classes],
|
56
|
-
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme)],
|
52
|
+
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, deprecated_values: DEPRECATED_SCHEME_OPTIONS)],
|
57
53
|
VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant)]
|
58
54
|
)
|
59
55
|
end
|
@@ -5,27 +5,57 @@ module Primer
|
|
5
5
|
class LinkComponent < Primer::Component
|
6
6
|
status :beta
|
7
7
|
|
8
|
+
DEFAULT_VARIANT = :default
|
9
|
+
VARIANT_MAPPINGS = {
|
10
|
+
DEFAULT_VARIANT => "",
|
11
|
+
:primary => "Link--primary",
|
12
|
+
:secondary => "Link--secondary"
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
DEFAULT_TAG = :a
|
16
|
+
TAG_OPTIONS = [DEFAULT_TAG, :span].freeze
|
17
|
+
|
8
18
|
# @example Default
|
9
|
-
# <%= render(Primer::LinkComponent.new(href: "
|
19
|
+
# <%= render(Primer::LinkComponent.new(href: "#")) { "Link" } %>
|
10
20
|
#
|
11
21
|
# @example Muted
|
12
|
-
# <%= render(Primer::LinkComponent.new(href: "
|
22
|
+
# <%= render(Primer::LinkComponent.new(href: "#", muted: true)) { "Link" } %>
|
23
|
+
#
|
24
|
+
# @example Variants
|
25
|
+
# <%= render(Primer::LinkComponent.new(href: "#", variant: :primary)) { "Primary" } %>
|
26
|
+
# <%= render(Primer::LinkComponent.new(href: "#", variant: :secondary)) { "Secondary" } %>
|
27
|
+
#
|
28
|
+
# @example Without underline
|
29
|
+
# <%= render(Primer::LinkComponent.new(href: "#", underline: false)) { "Link" } %>
|
13
30
|
#
|
14
|
-
# @
|
15
|
-
#
|
31
|
+
# @example Span as link
|
32
|
+
# <%= render(Primer::LinkComponent.new(tag: :span)) { "Span as a link" } %>
|
33
|
+
#
|
34
|
+
# @param tag [String] <%= one_of(Primer::LinkComponent::TAG_OPTIONS) %>
|
35
|
+
# @param href [String] URL to be used for the Link. Required if tag is `:a`. If the requirements are not met an error will be raised in non production environments. In production, an empty link element will be rendered.
|
36
|
+
# @param variant [Symbol] <%= one_of(Primer::LinkComponent::VARIANT_MAPPINGS.keys) %>
|
37
|
+
# @param muted [Boolean] Uses light gray for Link color, and blue on hover.
|
38
|
+
# @param underline [Boolean] Whether or not to underline the link.
|
16
39
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
17
|
-
def initialize(href
|
40
|
+
def initialize(href: nil, tag: DEFAULT_TAG, variant: DEFAULT_VARIANT, muted: false, underline: true, **system_arguments)
|
18
41
|
@system_arguments = system_arguments
|
19
|
-
@system_arguments[:tag] =
|
42
|
+
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
20
43
|
@system_arguments[:href] = href
|
21
44
|
@system_arguments[:classes] = class_names(
|
22
45
|
@system_arguments[:classes],
|
23
|
-
|
46
|
+
VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_MAPPINGS.keys, variant, DEFAULT_VARIANT)],
|
47
|
+
"Link" => tag == :span,
|
48
|
+
"Link--muted" => muted,
|
49
|
+
"no-underline" => !underline
|
24
50
|
)
|
25
51
|
end
|
26
52
|
|
27
53
|
def call
|
28
54
|
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
29
55
|
end
|
56
|
+
|
57
|
+
def before_render
|
58
|
+
raise ArgumentError, "href is required when using <a> tag" if @system_arguments[:tag] == :a && @system_arguments[:href].nil? && !Rails.env.production?
|
59
|
+
end
|
30
60
|
end
|
31
61
|
end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
|
-
<%= render
|
3
|
-
|
4
|
-
|
5
|
-
<%= heading.content %>
|
6
|
-
<% end %>
|
7
|
-
<% end %>
|
8
|
-
<%= body.content %>
|
2
|
+
<%= render(body_component) do %>
|
3
|
+
<%= heading %>
|
4
|
+
<%= body %>
|
9
5
|
<% end %>
|
10
6
|
<% end %>
|
@@ -5,37 +5,84 @@ module Primer
|
|
5
5
|
#
|
6
6
|
# By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.
|
7
7
|
class PopoverComponent < Primer::Component
|
8
|
-
include ViewComponent::
|
8
|
+
include ViewComponent::SlotableV2
|
9
|
+
status :beta
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
CARET_DEFAULT = :top
|
12
|
+
CARET_MAPPINGS = {
|
13
|
+
CARET_DEFAULT => "",
|
14
|
+
:bottom => "Popover-message--bottom",
|
15
|
+
:bottom_right => "Popover-message--bottom-right",
|
16
|
+
:bottom_left => "Popover-message--bottom-left",
|
17
|
+
:left => "Popover-message--left",
|
18
|
+
:left_bottom => "Popover-message--left-bottom",
|
19
|
+
:left_top => "Popover-message--left-top",
|
20
|
+
:right => "Popover-message--right",
|
21
|
+
:right_bottom => "Popover-message--right-bottom",
|
22
|
+
:right_top => "Popover-message--right-top",
|
23
|
+
:top_left => "Popover-message--top-left",
|
24
|
+
:top_right => "Popover-message--top-right"
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
# The heading
|
28
|
+
#
|
29
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
30
|
+
renders_one :heading, lambda { |**system_arguments|
|
31
|
+
system_arguments[:mb] ||= 2
|
32
|
+
system_arguments[:tag] ||= :h4
|
33
|
+
|
34
|
+
Primer::HeadingComponent.new(**system_arguments)
|
35
|
+
}
|
36
|
+
|
37
|
+
# The body
|
38
|
+
#
|
39
|
+
# @param caret [Symbol] <%= one_of(Primer::PopoverComponent::CARET_MAPPINGS.keys) %>
|
40
|
+
# @param large [Boolean] Whether to use the large version of the component.
|
41
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
42
|
+
renders_one :body, lambda { |caret: CARET_DEFAULT, large: false, **system_arguments, &block|
|
43
|
+
system_arguments[:classes] = class_names(
|
44
|
+
system_arguments[:classes],
|
45
|
+
"Popover-message Box",
|
46
|
+
CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)],
|
47
|
+
"Popover-message--large" => large
|
48
|
+
)
|
49
|
+
system_arguments[:p] ||= 4
|
50
|
+
system_arguments[:mt] ||= 2
|
51
|
+
system_arguments[:mx] ||= :auto
|
52
|
+
system_arguments[:text_align] ||= :left
|
53
|
+
system_arguments[:box_shadow] ||= :large
|
54
|
+
|
55
|
+
# This is a hack to allow the parent to set the slot's content
|
56
|
+
@body_arguments = system_arguments
|
57
|
+
block&.call
|
58
|
+
}
|
12
59
|
|
13
60
|
# @example Default
|
14
61
|
# <%= render Primer::PopoverComponent.new do |component| %>
|
15
|
-
# <% component.
|
62
|
+
# <% component.heading do %>
|
16
63
|
# Activity feed
|
17
64
|
# <% end %>
|
18
|
-
# <% component.
|
65
|
+
# <% component.body do %>
|
19
66
|
# This is the Popover body.
|
20
67
|
# <% end %>
|
21
68
|
# <% end %>
|
22
69
|
#
|
23
70
|
# @example Large
|
24
71
|
# <%= render Primer::PopoverComponent.new do |component| %>
|
25
|
-
# <% component.
|
72
|
+
# <% component.heading do %>
|
26
73
|
# Activity feed
|
27
74
|
# <% end %>
|
28
|
-
# <% component.
|
75
|
+
# <% component.body(large: true) do %>
|
29
76
|
# This is the large Popover body.
|
30
77
|
# <% end %>
|
31
78
|
# <% end %>
|
32
79
|
#
|
33
80
|
# @example Caret position
|
34
81
|
# <%= render Primer::PopoverComponent.new do |component| %>
|
35
|
-
# <% component.
|
82
|
+
# <% component.heading do %>
|
36
83
|
# Activity feed
|
37
84
|
# <% end %>
|
38
|
-
# <% component.
|
85
|
+
# <% component.body(caret: :left) do %>
|
39
86
|
# This is the large Popover body.
|
40
87
|
# <% end %>
|
41
88
|
# <% end %>
|
@@ -57,59 +104,8 @@ module Primer
|
|
57
104
|
body.present?
|
58
105
|
end
|
59
106
|
|
60
|
-
|
61
|
-
|
62
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
63
|
-
def initialize(**system_arguments)
|
64
|
-
@system_arguments = system_arguments
|
65
|
-
@system_arguments[:mb] ||= 2
|
66
|
-
@system_arguments[:tag] ||= :h4
|
67
|
-
end
|
68
|
-
|
69
|
-
def component
|
70
|
-
Primer::HeadingComponent.new(**@system_arguments)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# :nodoc:
|
75
|
-
class Body < Slot
|
76
|
-
CARET_DEFAULT = :top
|
77
|
-
CARET_MAPPINGS = {
|
78
|
-
CARET_DEFAULT => "",
|
79
|
-
:bottom => "Popover-message--bottom",
|
80
|
-
:bottom_right => "Popover-message--bottom-right",
|
81
|
-
:bottom_left => "Popover-message--bottom-left",
|
82
|
-
:left => "Popover-message--left",
|
83
|
-
:left_bottom => "Popover-message--left-bottom",
|
84
|
-
:left_top => "Popover-message--left-top",
|
85
|
-
:right => "Popover-message--right",
|
86
|
-
:right_bottom => "Popover-message--right-bottom",
|
87
|
-
:right_top => "Popover-message--right-top",
|
88
|
-
:top_left => "Popover-message--top-left",
|
89
|
-
:top_right => "Popover-message--top-right"
|
90
|
-
}.freeze
|
91
|
-
|
92
|
-
# @param caret [Symbol] <%= one_of(Primer::PopoverComponent::Body::CARET_MAPPINGS.keys) %>
|
93
|
-
# @param large [Boolean] Whether to use the large version of the component.
|
94
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
95
|
-
def initialize(caret: CARET_DEFAULT, large: false, **system_arguments)
|
96
|
-
@system_arguments = system_arguments
|
97
|
-
@system_arguments[:classes] = class_names(
|
98
|
-
system_arguments[:classes],
|
99
|
-
"Popover-message Box",
|
100
|
-
CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)],
|
101
|
-
"Popover-message--large" => large
|
102
|
-
)
|
103
|
-
@system_arguments[:p] ||= 4
|
104
|
-
@system_arguments[:mt] ||= 2
|
105
|
-
@system_arguments[:mx] ||= :auto
|
106
|
-
@system_arguments[:text_align] ||= :left
|
107
|
-
@system_arguments[:box_shadow] ||= :large
|
108
|
-
end
|
109
|
-
|
110
|
-
def component
|
111
|
-
Primer::BoxComponent.new(**@system_arguments)
|
112
|
-
end
|
107
|
+
def body_component
|
108
|
+
Primer::BoxComponent.new(**@body_arguments)
|
113
109
|
end
|
114
110
|
end
|
115
111
|
end
|
@@ -11,7 +11,7 @@ module Primer
|
|
11
11
|
# @param percentage [Integer] The percent complete
|
12
12
|
# @param bg [Symbol] The background color
|
13
13
|
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
14
|
-
renders_many :items, lambda { |percentage: 0, bg: :
|
14
|
+
renders_many :items, lambda { |percentage: 0, bg: :success_inverse, **system_arguments|
|
15
15
|
percentage = percentage
|
16
16
|
system_arguments = system_arguments
|
17
17
|
|
@@ -39,19 +39,19 @@ module Primer
|
|
39
39
|
#
|
40
40
|
# @example Small
|
41
41
|
# <%= render(Primer::ProgressBarComponent.new(size: :small)) do |component| %>
|
42
|
-
# <% component.item(bg: :
|
42
|
+
# <% component.item(bg: :info_inverse, percentage: 50) %>
|
43
43
|
# <% end %>
|
44
44
|
#
|
45
45
|
# @example Large
|
46
46
|
# <%= render(Primer::ProgressBarComponent.new(size: :large)) do |component| %>
|
47
|
-
# <% component.item(bg: :
|
47
|
+
# <% component.item(bg: :danger_inverse, percentage: 75) %>
|
48
48
|
# <% end %>
|
49
49
|
#
|
50
50
|
# @example Multiple items
|
51
51
|
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
52
52
|
# <% component.item(percentage: 10) %>
|
53
|
-
# <% component.item(bg: :
|
54
|
-
# <% component.item(bg: :
|
53
|
+
# <% component.item(bg: :info_inverse, percentage: 20) %>
|
54
|
+
# <% component.item(bg: :danger_inverse, percentage: 30) %>
|
55
55
|
# <% end %>
|
56
56
|
#
|
57
57
|
# @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@github/tab-container-element';
|
@@ -3,9 +3,11 @@
|
|
3
3
|
module Primer
|
4
4
|
# The Text component is a wrapper component that will apply typography styles to the text inside.
|
5
5
|
class TextComponent < Primer::Component
|
6
|
+
status :beta
|
7
|
+
|
6
8
|
# @example Default
|
7
9
|
# <%= render(Primer::TextComponent.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
|
8
|
-
# <%= render(Primer::TextComponent.new(tag: :p, color: :
|
10
|
+
# <%= render(Primer::TextComponent.new(tag: :p, color: :text_danger)) { "Danger Text" } %>
|
9
11
|
#
|
10
12
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
11
13
|
def initialize(**system_arguments)
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@github/time-elements';
|
@@ -4,6 +4,7 @@ module Primer
|
|
4
4
|
# Use `TimelineItem` to display items on a vertical timeline, connected by badge elements.
|
5
5
|
class TimelineItemComponent < Primer::Component
|
6
6
|
include ViewComponent::SlotableV2
|
7
|
+
status :beta
|
7
8
|
|
8
9
|
# Avatar to be rendered to the left of the Badge.
|
9
10
|
#
|
@@ -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_inverse, color: :text_white, icon: :check) %>
|
44
45
|
# <% component.body { "Success!" } %>
|
45
46
|
# <% end %>
|
46
47
|
# </div>
|
data/app/lib/primer/classify.rb
CHANGED
@@ -17,7 +17,6 @@ module Primer
|
|
17
17
|
|
18
18
|
INVALID_CLASS_NAME_PREFIXES =
|
19
19
|
(["bg-", "color-", "text-", "d-", "v-align-", "wb-", "text-", "box-shadow-"] + CONCAT_KEYS.map { |k| "#{k}-" }).freeze
|
20
|
-
FUNCTIONAL_COLOR_REGEX = /(primary|secondary|tertiary|link|success|warning|danger|info)/.freeze
|
21
20
|
|
22
21
|
COLOR_KEY = :color
|
23
22
|
BG_KEY = :bg
|
@@ -80,18 +79,20 @@ module Primer
|
|
80
79
|
]
|
81
80
|
}
|
82
81
|
}.freeze
|
83
|
-
|
82
|
+
BORDER_KEY = :border
|
83
|
+
BORDER_COLOR_KEY = :border_color
|
84
84
|
BORDER_MARGIN_KEYS = %i[border_top border_bottom border_left border_right].freeze
|
85
85
|
BORDER_RADIUS_KEY = :border_radius
|
86
86
|
TYPOGRAPHY_KEYS = [:font_size].freeze
|
87
87
|
VALID_KEYS = (
|
88
88
|
CONCAT_KEYS +
|
89
89
|
BOOLEAN_MAPPINGS.keys +
|
90
|
-
BORDER_KEYS +
|
91
90
|
BORDER_MARGIN_KEYS +
|
92
91
|
TYPOGRAPHY_KEYS +
|
93
92
|
TEXT_KEYS +
|
94
93
|
[
|
94
|
+
BORDER_KEY,
|
95
|
+
BORDER_COLOR_KEY,
|
95
96
|
BORDER_RADIUS_KEY,
|
96
97
|
COLOR_KEY,
|
97
98
|
BG_KEY,
|
@@ -198,25 +199,17 @@ module Primer
|
|
198
199
|
if val.to_s.start_with?("#")
|
199
200
|
memo[:styles] << "background-color: #{val};"
|
200
201
|
else
|
201
|
-
memo[:classes] <<
|
202
|
+
memo[:classes] << Primer::Classify::FunctionalBackgroundColors.color(val)
|
202
203
|
end
|
203
204
|
elsif key == COLOR_KEY
|
204
|
-
|
205
|
-
# Does this string end in a character that is NOT a number?
|
206
|
-
memo[:classes] <<
|
207
|
-
if (char_code >= 48 && char_code <= 57) || # 48 is the charcode for 0; 57 is the charcode for 9
|
208
|
-
FUNCTIONAL_COLOR_REGEX.match?(val)
|
209
|
-
"color-#{val.to_s.dasherize}"
|
210
|
-
else
|
211
|
-
"text-#{val.to_s.dasherize}"
|
212
|
-
end
|
205
|
+
memo[:classes] << Primer::Classify::FunctionalTextColors.color(val)
|
213
206
|
elsif key == DISPLAY_KEY
|
214
207
|
memo[:classes] << "d#{breakpoint}-#{val.to_s.dasherize}"
|
215
208
|
elsif key == VERTICAL_ALIGN_KEY
|
216
209
|
memo[:classes] << "v-align-#{val.to_s.dasherize}"
|
217
210
|
elsif key == WORD_BREAK_KEY
|
218
211
|
memo[:classes] << "wb-#{val.to_s.dasherize}"
|
219
|
-
elsif
|
212
|
+
elsif key == BORDER_KEY
|
220
213
|
border_value = if val == true
|
221
214
|
"border"
|
222
215
|
else
|
@@ -224,6 +217,8 @@ module Primer
|
|
224
217
|
end
|
225
218
|
|
226
219
|
memo[:classes] << border_value
|
220
|
+
elsif key == BORDER_COLOR_KEY
|
221
|
+
memo[:classes] << Primer::Classify::FunctionalBorderColors.color(val)
|
227
222
|
elsif BORDER_MARGIN_KEYS.include?(key)
|
228
223
|
memo[:classes] << "#{key.to_s.dasherize}-#{val}"
|
229
224
|
elsif key == BORDER_RADIUS_KEY
|
@@ -50,8 +50,13 @@ module Primer
|
|
50
50
|
)
|
51
51
|
|
52
52
|
preload(
|
53
|
-
keys: [Primer::Classify::COLOR_KEY
|
54
|
-
values: [
|
53
|
+
keys: [Primer::Classify::COLOR_KEY],
|
54
|
+
values: [*Primer::Classify::FunctionalTextColors::OPTIONS, *Primer::Classify::FunctionalTextColors::DEPRECATED_OPTIONS]
|
55
|
+
)
|
56
|
+
|
57
|
+
preload(
|
58
|
+
keys: [Primer::Classify::BG_KEY],
|
59
|
+
values: [*Primer::Classify::FunctionalBackgroundColors::OPTIONS, *Primer::Classify::FunctionalBackgroundColors::DEPRECATED_OPTIONS]
|
55
60
|
)
|
56
61
|
|
57
62
|
preload(
|