primer_view_components 0.0.61 → 0.0.62
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,192 @@
|
|
1
|
+
:font_size:
|
2
|
+
"00":
|
3
|
+
- f00
|
4
|
+
1:
|
5
|
+
- f1
|
6
|
+
2:
|
7
|
+
- f2
|
8
|
+
3:
|
9
|
+
- f3
|
10
|
+
4:
|
11
|
+
- f4
|
12
|
+
5:
|
13
|
+
- f5
|
14
|
+
6:
|
15
|
+
- f6
|
16
|
+
:small:
|
17
|
+
- text-small
|
18
|
+
:normal:
|
19
|
+
- text-normal
|
20
|
+
:top:
|
21
|
+
false:
|
22
|
+
- top-0
|
23
|
+
:bottom:
|
24
|
+
false:
|
25
|
+
- bottom-0
|
26
|
+
:left:
|
27
|
+
false:
|
28
|
+
- left-0
|
29
|
+
:right:
|
30
|
+
false:
|
31
|
+
- right-0
|
32
|
+
:underline:
|
33
|
+
true:
|
34
|
+
- text-underline
|
35
|
+
false:
|
36
|
+
- no-underline
|
37
|
+
:font_family:
|
38
|
+
:mono:
|
39
|
+
- text-mono
|
40
|
+
:font_style:
|
41
|
+
:italic:
|
42
|
+
- text-italic
|
43
|
+
:text_transform:
|
44
|
+
:uppercase:
|
45
|
+
- text-uppercase
|
46
|
+
:text_align:
|
47
|
+
:right:
|
48
|
+
- text-right
|
49
|
+
:left:
|
50
|
+
- text-left
|
51
|
+
:center:
|
52
|
+
- text-center
|
53
|
+
:font_weight:
|
54
|
+
:light:
|
55
|
+
- text-light
|
56
|
+
:normal:
|
57
|
+
- text-normal
|
58
|
+
:bold:
|
59
|
+
- text-bold
|
60
|
+
:semibold:
|
61
|
+
- text-semibold
|
62
|
+
:emphasized:
|
63
|
+
- text-emphasized
|
64
|
+
:box_shadow:
|
65
|
+
true:
|
66
|
+
- color-shadow-small
|
67
|
+
:small:
|
68
|
+
- color-shadow-small
|
69
|
+
:medium:
|
70
|
+
- color-shadow-medium
|
71
|
+
:large:
|
72
|
+
- color-shadow-large
|
73
|
+
:extra_large:
|
74
|
+
- color-shadow-extra-large
|
75
|
+
:none:
|
76
|
+
- box-shadow-none
|
77
|
+
false:
|
78
|
+
- box-shadow-none
|
79
|
+
:border:
|
80
|
+
:left:
|
81
|
+
- border-left
|
82
|
+
:top:
|
83
|
+
- border-top
|
84
|
+
:bottom:
|
85
|
+
- border-bottom
|
86
|
+
:right:
|
87
|
+
- border-right
|
88
|
+
:y:
|
89
|
+
- border-y
|
90
|
+
:x:
|
91
|
+
- border-x
|
92
|
+
true:
|
93
|
+
- border
|
94
|
+
:border_top:
|
95
|
+
0:
|
96
|
+
- border-top-0
|
97
|
+
:border_bottom:
|
98
|
+
0:
|
99
|
+
- border-bottom-0
|
100
|
+
:border_left:
|
101
|
+
0:
|
102
|
+
- border-left-0
|
103
|
+
:border_right:
|
104
|
+
0:
|
105
|
+
- border-right-0
|
106
|
+
:border_radius:
|
107
|
+
0:
|
108
|
+
- rounded-0
|
109
|
+
1:
|
110
|
+
- rounded-1
|
111
|
+
2:
|
112
|
+
- rounded-2
|
113
|
+
3:
|
114
|
+
- rounded-3
|
115
|
+
:justify_content:
|
116
|
+
:flex_start:
|
117
|
+
- flex-justify-start
|
118
|
+
:flex_end:
|
119
|
+
- flex-justify-end
|
120
|
+
:center:
|
121
|
+
- flex-justify-center
|
122
|
+
:space_between:
|
123
|
+
- flex-justify-between
|
124
|
+
:space_around:
|
125
|
+
- flex-justify-around
|
126
|
+
:align_items:
|
127
|
+
:flex_start:
|
128
|
+
- flex-items-start
|
129
|
+
:flex_end:
|
130
|
+
- flex-items-end
|
131
|
+
:center:
|
132
|
+
- flex-items-center
|
133
|
+
:baseline:
|
134
|
+
- flex-items-baseline
|
135
|
+
:stretch:
|
136
|
+
- flex-items-stretch
|
137
|
+
:flex_wrap:
|
138
|
+
:wrap:
|
139
|
+
- flex-wrap
|
140
|
+
:nowrap:
|
141
|
+
- flex-nowrap
|
142
|
+
:reverse:
|
143
|
+
- flex-wrap-reverse
|
144
|
+
:direction:
|
145
|
+
:column:
|
146
|
+
- flex-column
|
147
|
+
- flex-sm-column
|
148
|
+
- flex-md-column
|
149
|
+
- flex-lg-column
|
150
|
+
- flex-xl-column
|
151
|
+
:column_reverse:
|
152
|
+
- flex-column-reverse
|
153
|
+
- flex-sm-column-reverse
|
154
|
+
- flex-md-column-reverse
|
155
|
+
- flex-lg-column-reverse
|
156
|
+
- flex-xl-column-reverse
|
157
|
+
:row:
|
158
|
+
- flex-row
|
159
|
+
- flex-sm-row
|
160
|
+
- flex-md-row
|
161
|
+
- flex-lg-row
|
162
|
+
- flex-xl-row
|
163
|
+
:row_reverse:
|
164
|
+
- flex-row-reverse
|
165
|
+
- flex-sm-row-reverse
|
166
|
+
- flex-md-row-reverse
|
167
|
+
- flex-lg-row-reverse
|
168
|
+
- flex-xl-row-reverse
|
169
|
+
:flex:
|
170
|
+
1:
|
171
|
+
- flex-1
|
172
|
+
:auto:
|
173
|
+
- flex-auto
|
174
|
+
:align_self:
|
175
|
+
:auto:
|
176
|
+
- flex-self-auto
|
177
|
+
:start:
|
178
|
+
- flex-self-start
|
179
|
+
:end:
|
180
|
+
- flex-self-end
|
181
|
+
:center:
|
182
|
+
- flex-self-center
|
183
|
+
:baseline:
|
184
|
+
- flex-self-baseline
|
185
|
+
:stretch:
|
186
|
+
- flex-self-stretch
|
187
|
+
:flex_grow:
|
188
|
+
0:
|
189
|
+
- flex-grow-0
|
190
|
+
:flex_shrink:
|
191
|
+
0:
|
192
|
+
- flex-shrink-0
|
data/lib/tasks/docs.rake
CHANGED
@@ -312,7 +312,7 @@ namespace :docs do
|
|
312
312
|
FileUtils.rm_rf(File.join(adr_content_dir))
|
313
313
|
FileUtils.mkdir(adr_content_dir)
|
314
314
|
|
315
|
-
nav_entries = Dir[File.join(*%w[adr *.md])].map do |orig_path|
|
315
|
+
nav_entries = Dir[File.join(*%w[adr *.md])].sort.map do |orig_path|
|
316
316
|
orig_file_name = File.basename(orig_path)
|
317
317
|
url_name = orig_file_name.chomp(".md")
|
318
318
|
title = ActiveSupport::Inflector.titleize(url_name.sub(/\A\d+-/, ""))
|
data/lib/tasks/utilities.rake
CHANGED
@@ -13,8 +13,6 @@ namespace :utilities do
|
|
13
13
|
/^anim\b/,
|
14
14
|
/^color-bg\b/,
|
15
15
|
/^color-border\b/,
|
16
|
-
/^color-icon\b/,
|
17
|
-
/^color-text\b/,
|
18
16
|
/^color-fg\b/,
|
19
17
|
/^col\b/,
|
20
18
|
/^container\b/,
|
@@ -41,6 +39,10 @@ namespace :utilities do
|
|
41
39
|
)
|
42
40
|
)["selectors"]["values"]
|
43
41
|
|
42
|
+
custom_utility_data = YAML.load_file(
|
43
|
+
File.join(__dir__, "custom_utilities.yml")
|
44
|
+
)
|
45
|
+
|
44
46
|
layout_data =
|
45
47
|
JSON.parse(
|
46
48
|
File.read(
|
@@ -112,6 +114,8 @@ namespace :utilities do
|
|
112
114
|
x.transform_values { |y| y.reverse.drop_while(&:nil?).reverse }
|
113
115
|
end
|
114
116
|
|
117
|
+
output.merge!(custom_utility_data)
|
118
|
+
|
115
119
|
File.open("lib/primer/classify/utilities.yml", "w") do |f|
|
116
120
|
f.puts YAML.dump(output)
|
117
121
|
end
|
data/static/classes.yml
CHANGED
@@ -100,31 +100,29 @@
|
|
100
100
|
- ".btn-large-mktg"
|
101
101
|
- ".btn-link"
|
102
102
|
- ".btn-mktg"
|
103
|
+
- ".btn-muted-mktg"
|
103
104
|
- ".btn-octicon"
|
104
105
|
- ".btn-octicon-danger"
|
105
106
|
- ".btn-outline"
|
106
|
-
- ".btn-outline-mktg"
|
107
107
|
- ".btn-primary"
|
108
|
-
- ".btn-
|
108
|
+
- ".btn-signup-mktg"
|
109
109
|
- ".btn-sm"
|
110
|
-
- ".btn-
|
110
|
+
- ".btn-subtle-mktg"
|
111
111
|
- ".circle"
|
112
112
|
- ".close-button"
|
113
113
|
- ".col-2"
|
114
114
|
- ".col-3"
|
115
115
|
- ".col-9"
|
116
|
-
- ".color-bg-
|
117
|
-
- ".color-bg-danger-
|
118
|
-
- ".color-bg-
|
119
|
-
- ".color-bg-
|
120
|
-
- ".color-bg-success-
|
121
|
-
- ".color-
|
122
|
-
- ".color-
|
116
|
+
- ".color-bg-accent-emphasis"
|
117
|
+
- ".color-bg-danger-emphasis"
|
118
|
+
- ".color-bg-emphasis"
|
119
|
+
- ".color-bg-subtle"
|
120
|
+
- ".color-bg-success-emphasis"
|
121
|
+
- ".color-border-accent-emphasis"
|
122
|
+
- ".color-fg-danger"
|
123
|
+
- ".color-fg-on-emphasis"
|
123
124
|
- ".color-fg-success"
|
124
|
-
- ".color-icon-success"
|
125
125
|
- ".color-shadow-large"
|
126
|
-
- ".color-text-danger"
|
127
|
-
- ".color-text-white"
|
128
126
|
- ".container-lg"
|
129
127
|
- ".container-md"
|
130
128
|
- ".container-xl"
|
@@ -138,7 +136,6 @@
|
|
138
136
|
- ".details-overlay"
|
139
137
|
- ".details-reset"
|
140
138
|
- ".dropdown"
|
141
|
-
- ".dropdown-caret"
|
142
139
|
- ".dropdown-divider"
|
143
140
|
- ".dropdown-header"
|
144
141
|
- ".dropdown-item"
|
@@ -178,8 +175,11 @@
|
|
178
175
|
- ".menu"
|
179
176
|
- ".menu-heading"
|
180
177
|
- ".menu-item"
|
178
|
+
- ".ml-2"
|
181
179
|
- ".mr-2"
|
180
|
+
- ".mr-n1"
|
182
181
|
- ".mt-2"
|
182
|
+
- ".mt-3"
|
183
183
|
- ".mt-5"
|
184
184
|
- ".mx-auto"
|
185
185
|
- ".no-underline"
|
data/static/constants.json
CHANGED
@@ -17,9 +17,9 @@
|
|
17
17
|
"DEFAULT_VARIANT": "default",
|
18
18
|
"SCHEME_MAPPINGS": {
|
19
19
|
"default": "",
|
20
|
-
"primary": "btn-
|
21
|
-
"outline": "btn-
|
22
|
-
"transparent": "btn-
|
20
|
+
"primary": "btn-signup-mktg",
|
21
|
+
"outline": "btn-muted-mktg",
|
22
|
+
"transparent": "btn-subtle-mktg"
|
23
23
|
},
|
24
24
|
"SCHEME_OPTIONS": [
|
25
25
|
"default",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.62
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -511,8 +511,6 @@ files:
|
|
511
511
|
- app/lib/primer/underline_nav_helper.rb
|
512
512
|
- app/lib/primer/view_helper.rb
|
513
513
|
- lib/primer/classify.rb
|
514
|
-
- lib/primer/classify/cache.rb
|
515
|
-
- lib/primer/classify/flex.rb
|
516
514
|
- lib/primer/classify/utilities.rb
|
517
515
|
- lib/primer/classify/utilities.yml
|
518
516
|
- lib/primer/classify/validation.rb
|
@@ -549,10 +547,12 @@ files:
|
|
549
547
|
- lib/rubocop/cop/primer.rb
|
550
548
|
- lib/rubocop/cop/primer/base_cop.rb
|
551
549
|
- lib/rubocop/cop/primer/deprecated_arguments.rb
|
550
|
+
- lib/rubocop/cop/primer/deprecated_layout_component.rb
|
552
551
|
- lib/rubocop/cop/primer/no_tag_memoize.rb
|
553
552
|
- lib/rubocop/cop/primer/primer_octicon.rb
|
554
553
|
- lib/rubocop/cop/primer/system_argument_instead_of_class.rb
|
555
554
|
- lib/tasks/coverage.rake
|
555
|
+
- lib/tasks/custom_utilities.yml
|
556
556
|
- lib/tasks/docs.rake
|
557
557
|
- lib/tasks/helpers/ast_processor.rb
|
558
558
|
- lib/tasks/helpers/ast_traverser.rb
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "flex"
|
4
|
-
|
5
|
-
module Primer
|
6
|
-
class Classify
|
7
|
-
# :nodoc:
|
8
|
-
class Cache
|
9
|
-
include Singleton
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@cache_enabled = true
|
13
|
-
@lookup = {}
|
14
|
-
end
|
15
|
-
|
16
|
-
private :initialize
|
17
|
-
|
18
|
-
def fetch(breakpoint, key, val)
|
19
|
-
found = @lookup.dig(breakpoint, key, val)
|
20
|
-
return found if found
|
21
|
-
|
22
|
-
yield.tap do |result|
|
23
|
-
set(result, breakpoint, key, val) if @cache_enabled
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def disable
|
28
|
-
@cache_enabled = false
|
29
|
-
yield
|
30
|
-
@cache_enabled = true
|
31
|
-
end
|
32
|
-
|
33
|
-
def clear!
|
34
|
-
@lookup.clear
|
35
|
-
end
|
36
|
-
|
37
|
-
def preload!
|
38
|
-
preload(
|
39
|
-
keys: Primer::Classify::Flex::DIRECTION_KEY,
|
40
|
-
values: Primer::Classify::Flex::DIRECTION_VALUES
|
41
|
-
)
|
42
|
-
|
43
|
-
preload(
|
44
|
-
keys: Primer::Classify::Flex::JUSTIFY_CONTENT_KEY,
|
45
|
-
values: Primer::Classify::Flex::JUSTIFY_CONTENT_VALUES
|
46
|
-
)
|
47
|
-
|
48
|
-
preload(
|
49
|
-
keys: Primer::Classify::Flex::ALIGN_ITEMS_KEY,
|
50
|
-
values: Primer::Classify::Flex::ALIGN_ITEMS_VALUES
|
51
|
-
)
|
52
|
-
|
53
|
-
preload(
|
54
|
-
keys: :text_align,
|
55
|
-
values: [:left, :center, :right]
|
56
|
-
)
|
57
|
-
|
58
|
-
preload(
|
59
|
-
keys: :font_weight,
|
60
|
-
values: [:bold, :light, :normal]
|
61
|
-
)
|
62
|
-
|
63
|
-
preload(
|
64
|
-
keys: Primer::Classify::Flex::FLEX_KEY,
|
65
|
-
values: Primer::Classify::Flex::FLEX_VALUES
|
66
|
-
)
|
67
|
-
|
68
|
-
preload(
|
69
|
-
keys: Primer::Classify::Flex::GROW_KEY,
|
70
|
-
values: Primer::Classify::Flex::GROW_VALUES
|
71
|
-
)
|
72
|
-
|
73
|
-
preload(
|
74
|
-
keys: Primer::Classify::Flex::SHRINK_KEY,
|
75
|
-
values: Primer::Classify::Flex::SHRINK_VALUES
|
76
|
-
)
|
77
|
-
|
78
|
-
preload(
|
79
|
-
keys: Primer::Classify::Flex::ALIGN_SELF_KEY,
|
80
|
-
values: Primer::Classify::Flex::ALIGN_SELF_VALUES
|
81
|
-
)
|
82
|
-
|
83
|
-
preload(
|
84
|
-
keys: Primer::Classify::BOX_SHADOW_KEY,
|
85
|
-
values: [true, :small, :medium, :large, :extra_large, :none]
|
86
|
-
)
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def preload(keys:, values:)
|
92
|
-
BREAKPOINTS.each do |breakpoint|
|
93
|
-
Array(keys).each do |key|
|
94
|
-
values.each do |value|
|
95
|
-
classes = Primer::Classify.send(:classes_from, key, value, breakpoint)
|
96
|
-
set(classes, breakpoint, key, value)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def set(item, breakpoint, key, val)
|
103
|
-
@lookup[breakpoint] ||= {}
|
104
|
-
@lookup[breakpoint][key] ||= {}
|
105
|
-
@lookup[breakpoint][key][val] = item
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
data/lib/primer/classify/flex.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
class Classify
|
5
|
-
# Handler for PrimerCSS flex classes.
|
6
|
-
class Flex
|
7
|
-
extend Primer::FetchOrFallbackHelper
|
8
|
-
|
9
|
-
FLEX_KEY = :flex
|
10
|
-
FLEX_VALUES = [1, :auto].freeze
|
11
|
-
|
12
|
-
WRAP_KEY = :flex_wrap
|
13
|
-
WRAP_MAPPINGS = {
|
14
|
-
wrap: "flex-wrap",
|
15
|
-
nowrap: "flex-nowrap",
|
16
|
-
reverse: "flex-wrap-reverse"
|
17
|
-
}.freeze
|
18
|
-
|
19
|
-
SHRINK_KEY = :flex_shrink
|
20
|
-
SHRINK_VALUES = [0].freeze
|
21
|
-
|
22
|
-
GROW_KEY = :flex_grow
|
23
|
-
GROW_VALUES = [0].freeze
|
24
|
-
|
25
|
-
ALIGN_SELF_KEY = :align_self
|
26
|
-
ALIGN_SELF_VALUES = [:auto, :start, :end, :center, :baseline, :stretch].freeze
|
27
|
-
|
28
|
-
DIRECTION_KEY = :direction
|
29
|
-
DIRECTION_VALUES = [:column, :column_reverse, :row, :row_reverse].freeze
|
30
|
-
|
31
|
-
JUSTIFY_CONTENT_KEY = :justify_content
|
32
|
-
JUSTIFY_CONTENT_VALUES = [:flex_start, :flex_end, :center, :space_between, :space_around].freeze
|
33
|
-
|
34
|
-
ALIGN_ITEMS_KEY = :align_items
|
35
|
-
ALIGN_ITEMS_VALUES = [:flex_start, :flex_end, :center, :baseline, :stretch].freeze
|
36
|
-
|
37
|
-
KEYS = [FLEX_KEY, WRAP_KEY, SHRINK_KEY, GROW_KEY, ALIGN_SELF_KEY, DIRECTION_KEY, JUSTIFY_CONTENT_KEY, ALIGN_ITEMS_KEY].freeze
|
38
|
-
RESPONSIVE_KEYS = [DIRECTION_KEY, JUSTIFY_CONTENT_KEY, ALIGN_ITEMS_KEY].freeze
|
39
|
-
|
40
|
-
class << self
|
41
|
-
def classes(key, value, breakpoint)
|
42
|
-
send(key, value, breakpoint)
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def flex(value, _breakpoint)
|
48
|
-
generate(
|
49
|
-
value: value,
|
50
|
-
allowed_values: FLEX_VALUES,
|
51
|
-
prefix: "flex"
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
def flex_shrink(value, _breakpoint)
|
56
|
-
generate(
|
57
|
-
value: value,
|
58
|
-
allowed_values: SHRINK_VALUES,
|
59
|
-
prefix: "flex-shrink"
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
def flex_grow(value, _breakpoint)
|
64
|
-
generate(
|
65
|
-
value: value,
|
66
|
-
allowed_values: GROW_VALUES,
|
67
|
-
prefix: "flex-grow"
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
def align_self(value, _breakpoint)
|
72
|
-
generate(
|
73
|
-
value: value,
|
74
|
-
allowed_values: ALIGN_SELF_VALUES,
|
75
|
-
prefix: "flex-self"
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
def flex_wrap(value, _breakpoint)
|
80
|
-
WRAP_MAPPINGS[fetch_or_fallback(WRAP_MAPPINGS.keys, value)]
|
81
|
-
end
|
82
|
-
|
83
|
-
def direction(value, breakpoint)
|
84
|
-
val = fetch_or_fallback(DIRECTION_VALUES, value)
|
85
|
-
|
86
|
-
"flex#{breakpoint}-#{val.to_s.dasherize}"
|
87
|
-
end
|
88
|
-
|
89
|
-
def justify_content(value, breakpoint)
|
90
|
-
val = fetch_or_fallback(JUSTIFY_CONTENT_VALUES, value)
|
91
|
-
|
92
|
-
formatted_value = val.to_s.gsub(/(flex_|space_)/, "")
|
93
|
-
"flex#{breakpoint}-justify-#{formatted_value}"
|
94
|
-
end
|
95
|
-
|
96
|
-
def align_items(value, breakpoint)
|
97
|
-
val = fetch_or_fallback(ALIGN_ITEMS_VALUES, value)
|
98
|
-
|
99
|
-
formatted_value = val.to_s.gsub("flex_", "")
|
100
|
-
"flex#{breakpoint}-items-#{formatted_value}"
|
101
|
-
end
|
102
|
-
|
103
|
-
def generate(value:, allowed_values:, prefix:)
|
104
|
-
val = fetch_or_fallback(allowed_values, value)
|
105
|
-
|
106
|
-
"#{prefix}-#{val}"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|