playbook_ui 10.21.0 → 10.21.1.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +3 -3
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +88 -0
- data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
- data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +81 -96
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +3 -0
- data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
- data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
- data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
- data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
- data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
- data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
- data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
- data/app/pb_kits/playbook/utilities/_order.scss +55 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +121 -3
- data/lib/playbook/align_content.rb +29 -0
- data/lib/playbook/align_items.rb +29 -0
- data/lib/playbook/align_self.rb +29 -0
- data/lib/playbook/classnames.rb +11 -0
- data/lib/playbook/flex.rb +29 -0
- data/lib/playbook/flex_direction.rb +29 -0
- data/lib/playbook/flex_grow.rb +29 -0
- data/lib/playbook/flex_shrink.rb +29 -0
- data/lib/playbook/flex_wrap.rb +29 -0
- data/lib/playbook/justify_content.rb +29 -0
- data/lib/playbook/justify_self.rb +29 -0
- data/lib/playbook/kit_base.rb +22 -0
- data/lib/playbook/order.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- metadata +28 -5
@@ -0,0 +1,19 @@
|
|
1
|
+
.flex_direction_row {
|
2
|
+
display: flex;
|
3
|
+
flex-direction: row !important;
|
4
|
+
}
|
5
|
+
|
6
|
+
.flex_direction_column {
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column !important;
|
9
|
+
}
|
10
|
+
|
11
|
+
.flex_direction_row_reverse {
|
12
|
+
display: flex;
|
13
|
+
flex-direction: row-reverse !important;
|
14
|
+
}
|
15
|
+
|
16
|
+
.flex_direction_column_reverse {
|
17
|
+
display: flex;
|
18
|
+
flex-direction: column-reverse !important;
|
19
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
@import './utilities/flex_direction';
|
2
|
+
@import './utilities/justify_content';
|
3
|
+
@import './utilities/flex_wrap';
|
4
|
+
@import './utilities/justify_self';
|
5
|
+
@import './utilities/align_items';
|
6
|
+
@import './utilities/align_content';
|
7
|
+
@import './utilities/align_self';
|
8
|
+
@import './utilities/flex';
|
9
|
+
@import './utilities/flex_grow';
|
10
|
+
@import './utilities/flex_shrink';
|
11
|
+
@import './utilities/order';
|
@@ -0,0 +1,23 @@
|
|
1
|
+
.justify_content_start {
|
2
|
+
justify-content: start !important;
|
3
|
+
}
|
4
|
+
|
5
|
+
.justify_content_end {
|
6
|
+
justify-content: end !important;
|
7
|
+
}
|
8
|
+
|
9
|
+
.justify_content_center {
|
10
|
+
justify-content: center !important;
|
11
|
+
}
|
12
|
+
|
13
|
+
.justify_content_space_between {
|
14
|
+
justify-content: space-between !important;
|
15
|
+
}
|
16
|
+
|
17
|
+
.justify_content_space_around {
|
18
|
+
justify-content: space-around !important;
|
19
|
+
}
|
20
|
+
|
21
|
+
.justify_content_space_evenly {
|
22
|
+
justify-content: space-evenly !important;
|
23
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.justify_self_auto {
|
2
|
+
justify-self: auto !important;
|
3
|
+
}
|
4
|
+
|
5
|
+
.justify_self_start {
|
6
|
+
justify-self: start !important;
|
7
|
+
}
|
8
|
+
|
9
|
+
.justify_self_end {
|
10
|
+
justify-self: end !important;
|
11
|
+
}
|
12
|
+
|
13
|
+
.justify_self_center {
|
14
|
+
justify-self: center !important;
|
15
|
+
}
|
16
|
+
|
17
|
+
.justify_self_stretch {
|
18
|
+
justify-self: stretch !important;
|
19
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
.order_1 {
|
2
|
+
order: 1 !important;
|
3
|
+
}
|
4
|
+
|
5
|
+
.order_2 {
|
6
|
+
order: 2 !important;
|
7
|
+
}
|
8
|
+
|
9
|
+
.order_3 {
|
10
|
+
order: 3 !important;
|
11
|
+
}
|
12
|
+
|
13
|
+
.order_4 {
|
14
|
+
order: 4 !important;
|
15
|
+
}
|
16
|
+
|
17
|
+
.order_5 {
|
18
|
+
order: 5 !important;
|
19
|
+
}
|
20
|
+
|
21
|
+
.order_6 {
|
22
|
+
order: 6 !important;
|
23
|
+
}
|
24
|
+
|
25
|
+
.order_7 {
|
26
|
+
order: 7 !important;
|
27
|
+
}
|
28
|
+
|
29
|
+
.order_8 {
|
30
|
+
order: 8 !important;
|
31
|
+
}
|
32
|
+
|
33
|
+
.order_9 {
|
34
|
+
order: 9 !important;
|
35
|
+
}
|
36
|
+
|
37
|
+
.order_10 {
|
38
|
+
order: 10 !important;
|
39
|
+
}
|
40
|
+
|
41
|
+
.order_11 {
|
42
|
+
order: 11 !important;
|
43
|
+
}
|
44
|
+
|
45
|
+
.order_12 {
|
46
|
+
order: 12 !important;
|
47
|
+
}
|
48
|
+
|
49
|
+
.order_none {
|
50
|
+
order: none !important;
|
51
|
+
}
|
52
|
+
|
53
|
+
.order_first {
|
54
|
+
order: -1 !important;
|
55
|
+
}
|
@@ -59,7 +59,59 @@ type BorderRadius = {
|
|
59
59
|
borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
|
60
60
|
}
|
61
61
|
|
62
|
-
|
62
|
+
type Flex = {
|
63
|
+
flex?: "none" | "initial" | "auto" | 1
|
64
|
+
}
|
65
|
+
|
66
|
+
type FlexDirection = {
|
67
|
+
flexDirection?: "row" | "column" | "rowReverse" | "columnReverse"
|
68
|
+
}
|
69
|
+
|
70
|
+
type FlexGrow = {
|
71
|
+
flexGrow?: 0 | 1
|
72
|
+
}
|
73
|
+
|
74
|
+
type FlexShrink = {
|
75
|
+
flexShrink?: 0 | 1
|
76
|
+
}
|
77
|
+
|
78
|
+
type FlexWrap = {
|
79
|
+
flexWrap?: "wrap" | "nowrap" | "wrapReverse"
|
80
|
+
}
|
81
|
+
|
82
|
+
type Alignment = "start" | "end" | "center"
|
83
|
+
|
84
|
+
type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
|
85
|
+
|
86
|
+
type JustifyContent = {
|
87
|
+
justifyContent?: Alignment & Space
|
88
|
+
}
|
89
|
+
|
90
|
+
type JustifySelf = {
|
91
|
+
justifySelf?: Alignment & ("auto" | "stretch")
|
92
|
+
}
|
93
|
+
|
94
|
+
type AlignContent = {
|
95
|
+
alignContent?: Alignment & Space
|
96
|
+
}
|
97
|
+
|
98
|
+
type AlignItems = {
|
99
|
+
alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
|
100
|
+
}
|
101
|
+
|
102
|
+
type AlignSelf = {
|
103
|
+
alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
|
104
|
+
}
|
105
|
+
|
106
|
+
type Order = {
|
107
|
+
order?: "none" | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
108
|
+
}
|
109
|
+
|
110
|
+
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
111
|
+
BorderRadius & Cursor & Dark & Display & Flex & FlexDirection &
|
112
|
+
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
113
|
+
LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
|
114
|
+
Shadow & ZIndex
|
63
115
|
|
64
116
|
// Prop categories
|
65
117
|
const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
|
@@ -135,15 +187,81 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
135
187
|
let css = ''
|
136
188
|
css += cursor ? `cursor_${cursor} ` : ''
|
137
189
|
return css
|
190
|
+
},
|
191
|
+
flexDirectionProps: ({ flexDirection }: FlexDirection) => {
|
192
|
+
let css = ''
|
193
|
+
css += flexDirection == 'columnReverse' ? 'flex_direction_column_reverse' :
|
194
|
+
flexDirection == 'rowReverse' ? 'flex_direction_row_reverse' :
|
195
|
+
flexDirection ? `flex_direction_${flexDirection} ` : ''
|
196
|
+
return css
|
197
|
+
},
|
198
|
+
flexWrapProps: ({ flexWrap }: FlexWrap) => {
|
199
|
+
let css = ''
|
200
|
+
css += flexWrap == 'wrapReverse' ? 'flex_wrap_reverse' :
|
201
|
+
flexWrap == 'nowrap' ? 'flex_nowrap' :
|
202
|
+
flexWrap ? `flex_wrap_${flexWrap} ` : ''
|
203
|
+
return css
|
204
|
+
},
|
205
|
+
justifyContentProps: ({ justifyContent }: JustifyContent) => {
|
206
|
+
let css = ''
|
207
|
+
css += justifyContent == 'spaceBetween' ? 'justify_content_space_between' :
|
208
|
+
justifyContent == 'spaceEvenly' ? 'justify_content_space_evenly' :
|
209
|
+
justifyContent == 'spaceAround' ? 'justify_content_space_around' :
|
210
|
+
justifyContent ? `justify_content_${justifyContent}` : ''
|
211
|
+
return css
|
212
|
+
},
|
213
|
+
justifySelfProps: ({ justifySelf }: JustifySelf) => {
|
214
|
+
let css = ''
|
215
|
+
css += justifySelf ? `justify_self_${justifySelf}` : ''
|
216
|
+
return css
|
217
|
+
},
|
218
|
+
alignItemsProps: ({ alignItems }: AlignItems) => {
|
219
|
+
let css = ''
|
220
|
+
css += alignItems == 'flexStart' ? 'align_items_flex_start' :
|
221
|
+
alignItems == 'flexEnd' ? 'align_items_flex_end' :
|
222
|
+
alignItems ? `align_items_${alignItems}` : ''
|
223
|
+
return css
|
224
|
+
},
|
225
|
+
alignContentProps: ({ alignContent }: AlignContent) => {
|
226
|
+
let css = ''
|
227
|
+
css += alignContent == 'spaceBetween' ? 'align_content_space_between' :
|
228
|
+
alignContent == 'spaceEvenly' ? 'align_content_space_evenly' :
|
229
|
+
alignContent == 'spaceAround' ? 'align_content_space_around' :
|
230
|
+
alignContent ? `align_content_${alignContent}` : ''
|
231
|
+
return css
|
232
|
+
},
|
233
|
+
alignSelfProps: ({ alignSelf }: AlignSelf) => {
|
234
|
+
let css = ''
|
235
|
+
css += alignSelf ? `align_self_${alignSelf}` : ''
|
236
|
+
return css
|
237
|
+
},
|
238
|
+
flexProps: ({ flex }: Flex) => {
|
239
|
+
let css = ''
|
240
|
+
css += flex ? `flex_${flex}` : ''
|
241
|
+
return css
|
242
|
+
},
|
243
|
+
flexGrowProps: ({ flexGrow }: FlexGrow) => {
|
244
|
+
let css = ''
|
245
|
+
css += flexGrow ? `flex_grow_${flexGrow}` : ''
|
246
|
+
return css
|
247
|
+
},
|
248
|
+
flexShrinkProps: ({ flexShrink }: FlexShrink) => {
|
249
|
+
let css = ''
|
250
|
+
css += flexShrink ? `flex_shrink_${flexShrink}` : ''
|
251
|
+
return css
|
252
|
+
},
|
253
|
+
orderProps: ({ order }: Order) => {
|
254
|
+
let css = ''
|
255
|
+
css += order ? `order_${order}` : ''
|
256
|
+
return css
|
138
257
|
}
|
139
258
|
}
|
140
259
|
|
141
|
-
// All Exported as a single function
|
142
260
|
export const globalProps = (props: GlobalProps, defaultProps: {[key: string]: string} | {} = {}): string => {
|
143
261
|
const allProps = { ...props, ...defaultProps }
|
144
262
|
return Object.keys(PROP_CATEGORIES).map((key) => {
|
145
263
|
return PROP_CATEGORIES[key](allProps)
|
146
|
-
}).join("")
|
264
|
+
}).filter((value) => value?.length > 0).join(" ")
|
147
265
|
}
|
148
266
|
|
149
267
|
export const deprecatedProps = (kit: string, props: string[] = []): void => {
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module AlignContent
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :align_content
|
7
|
+
end
|
8
|
+
|
9
|
+
def align_content_props
|
10
|
+
selected_props = align_content_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
align_content_value = send(k)
|
15
|
+
"align_content_#{align_content_value}" if align_content_values.include? align_content_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def align_content_options
|
20
|
+
{
|
21
|
+
align_content: "align_content",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def align_content_values
|
26
|
+
%w[start end center space_between space_around space_evenly]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module AlignItems
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :align_items
|
7
|
+
end
|
8
|
+
|
9
|
+
def align_items_props
|
10
|
+
selected_props = align_items_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
align_items_value = send(k)
|
15
|
+
"align_items_#{align_items_value}" if align_items_values.include? align_items_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def align_items_options
|
20
|
+
{
|
21
|
+
align_items: "align_items",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def align_items_values
|
26
|
+
%w[flex_start flex_end start end center baseline stretch]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module AlignSelf
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :align_self
|
7
|
+
end
|
8
|
+
|
9
|
+
def align_self_props
|
10
|
+
selected_props = align_self_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
align_self_value = send(k)
|
15
|
+
"align_self_#{align_self_value}" if align_self_values.include? align_self_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def align_self_options
|
20
|
+
{
|
21
|
+
align_self: "align_self",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def align_self_values
|
26
|
+
%w[auto start end center stretch baseline]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/playbook/classnames.rb
CHANGED
@@ -20,6 +20,17 @@ module Playbook
|
|
20
20
|
line_height_props,
|
21
21
|
display_props,
|
22
22
|
cursor_props,
|
23
|
+
flex_direction_props,
|
24
|
+
flex_wrap_props,
|
25
|
+
justify_content_props,
|
26
|
+
justify_self_props,
|
27
|
+
align_items_props,
|
28
|
+
align_content_props,
|
29
|
+
align_self_props,
|
30
|
+
flex_props,
|
31
|
+
flex_grow_props,
|
32
|
+
flex_shrink_props,
|
33
|
+
order_props,
|
23
34
|
].compact.join(" ")
|
24
35
|
end
|
25
36
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module Flex
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :flex
|
7
|
+
end
|
8
|
+
|
9
|
+
def flex_props
|
10
|
+
selected_props = flex_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
flex_value = send(k)
|
15
|
+
"flex_#{flex_value}" if flex_values.include? flex_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def flex_options
|
20
|
+
{
|
21
|
+
flex: "flex",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def flex_values
|
26
|
+
%w[auto initial 0 1 2 3 4 5 6 7 8 9 10 11 12 none]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module FlexDirection
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :flex_direction
|
7
|
+
end
|
8
|
+
|
9
|
+
def flex_direction_props
|
10
|
+
selected_props = flex_direction_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
flex_direction_value = send(k)
|
15
|
+
"flex_direction_#{flex_direction_value}" if flex_direction_values.include? flex_direction_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def flex_direction_options
|
20
|
+
{
|
21
|
+
flex_direction: "flex_direction",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def flex_direction_values
|
26
|
+
%w[row column row_reverse column_reverse]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module FlexGrow
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :flex_grow
|
7
|
+
end
|
8
|
+
|
9
|
+
def flex_grow_props
|
10
|
+
selected_props = flex_grow_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
flex_grow_value = send(k)
|
15
|
+
"flex_grow_#{flex_grow_value}" if flex_grow_values.include? flex_grow_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def flex_grow_options
|
20
|
+
{
|
21
|
+
flex_grow: "flex_grow",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def flex_grow_values
|
26
|
+
%w[1 0]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module FlexShrink
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :flex_shrink
|
7
|
+
end
|
8
|
+
|
9
|
+
def flex_shrink_props
|
10
|
+
selected_props = flex_shrink_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
flex_shrink_value = send(k)
|
15
|
+
"flex_shrink_#{flex_shrink_value}" if flex_shrink_values.include? flex_shrink_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def flex_shrink_options
|
20
|
+
{
|
21
|
+
flex_shrink: "flex_shrink",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def flex_shrink_values
|
26
|
+
%w[1 0]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module FlexWrap
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :flex_wrap
|
7
|
+
end
|
8
|
+
|
9
|
+
def flex_wrap_props
|
10
|
+
selected_props = flex_wrap_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
flex_wrap_value = send(k)
|
15
|
+
"flex_wrap_#{flex_wrap_value}" if flex_wrap_values.include? flex_wrap_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def flex_wrap_options
|
20
|
+
{
|
21
|
+
flex_wrap: "flex_wrap",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def flex_wrap_values
|
26
|
+
%w[wrap nowrap wrap_reverse]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module JustifyContent
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :justify_content
|
7
|
+
end
|
8
|
+
|
9
|
+
def justify_content_props
|
10
|
+
selected_props = justify_content_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
justify_content_value = send(k)
|
15
|
+
"justify_content_#{justify_content_value}" if justify_content_values.include? justify_content_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def justify_content_options
|
20
|
+
{
|
21
|
+
justify_content: "justify_content",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def justify_content_values
|
26
|
+
%w[start end center space_between space_around space_evenly]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module JustifySelf
|
5
|
+
def self.included(base)
|
6
|
+
base.prop :justify_self
|
7
|
+
end
|
8
|
+
|
9
|
+
def justify_self_props
|
10
|
+
selected_props = justify_self_options.keys.select { |sk| try(sk) }
|
11
|
+
return nil unless selected_props.present?
|
12
|
+
|
13
|
+
selected_props.map do |k|
|
14
|
+
justify_self_value = send(k)
|
15
|
+
"justify_self_#{justify_self_value}" if justify_self_values.include? justify_self_value
|
16
|
+
end.compact.join(" ")
|
17
|
+
end
|
18
|
+
|
19
|
+
def justify_self_options
|
20
|
+
{
|
21
|
+
justify_self: "justify_self",
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def justify_self_values
|
26
|
+
%w[auto start end center stretch]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/playbook/kit_base.rb
CHANGED
@@ -8,6 +8,17 @@ require "playbook/shadow"
|
|
8
8
|
require "playbook/line_height"
|
9
9
|
require "playbook/display"
|
10
10
|
require "playbook/cursor"
|
11
|
+
require "playbook/flex_direction"
|
12
|
+
require "playbook/flex_wrap"
|
13
|
+
require "playbook/justify_content"
|
14
|
+
require "playbook/justify_self"
|
15
|
+
require "playbook/align_items"
|
16
|
+
require "playbook/align_content"
|
17
|
+
require "playbook/align_self"
|
18
|
+
require "playbook/flex"
|
19
|
+
require "playbook/flex_grow"
|
20
|
+
require "playbook/flex_shrink"
|
21
|
+
require "playbook/order"
|
11
22
|
|
12
23
|
module Playbook
|
13
24
|
class KitBase < ViewComponent::Base
|
@@ -21,6 +32,17 @@ module Playbook
|
|
21
32
|
include Playbook::LineHeight
|
22
33
|
include Playbook::Display
|
23
34
|
include Playbook::Cursor
|
35
|
+
include Playbook::FlexDirection
|
36
|
+
include Playbook::FlexWrap
|
37
|
+
include Playbook::JustifyContent
|
38
|
+
include Playbook::JustifySelf
|
39
|
+
include Playbook::AlignItems
|
40
|
+
include Playbook::AlignContent
|
41
|
+
include Playbook::AlignSelf
|
42
|
+
include Playbook::Flex
|
43
|
+
include Playbook::FlexGrow
|
44
|
+
include Playbook::FlexShrink
|
45
|
+
include Playbook::Order
|
24
46
|
|
25
47
|
prop :id
|
26
48
|
prop :data, type: Playbook::Props::Hash, default: {}
|