playbook_ui 10.26.0.pre.rc1 → 10.26.0
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_background/{_background.jsx → _background.tsx} +20 -13
- data/app/pb_kits/playbook/pb_body/_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_card/{_card.jsx → _card.tsx} +24 -22
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_none.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_radius.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_selected.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/{_flex.jsx → _flex.tsx} +5 -5
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
- data/app/pb_kits/playbook/pb_user/{_user.jsx → _user.tsx} +20 -24
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
- data/app/pb_kits/playbook/utilities/_align_content.scss +10 -29
- data/app/pb_kits/playbook/utilities/_align_items.scss +11 -35
- data/app/pb_kits/playbook/utilities/_align_self.scss +10 -29
- data/app/pb_kits/playbook/utilities/_flex.scss +19 -14
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +7 -18
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +6 -13
- data/app/pb_kits/playbook/utilities/_justify_content.scss +10 -23
- data/app/pb_kits/playbook/utilities/_justify_self.scss +9 -19
- data/app/pb_kits/playbook/utilities/_mixins.scss +26 -0
- data/app/pb_kits/playbook/utilities/_order.scss +17 -55
- data/app/pb_kits/playbook/utilities/globalProps.ts +125 -111
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +36 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +38 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +64 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test-utils.js +2 -0
- data/app/pb_kits/playbook/utilities/text.ts +22 -0
- data/dist/reset.css +1 -60
- data/lib/playbook/align_content.rb +11 -3
- data/lib/playbook/align_items.rb +10 -2
- data/lib/playbook/align_self.rb +9 -1
- data/lib/playbook/display.rb +1 -3
- data/lib/playbook/flex.rb +9 -1
- data/lib/playbook/flex_direction.rb +10 -2
- data/lib/playbook/flex_grow.rb +9 -1
- data/lib/playbook/flex_shrink.rb +9 -1
- data/lib/playbook/flex_wrap.rb +10 -2
- data/lib/playbook/justify_content.rb +10 -2
- data/lib/playbook/justify_self.rb +9 -1
- data/lib/playbook/order.rb +10 -2
- data/lib/playbook/version.rb +1 -1
- metadata +22 -9
- data/app/pb_kits/playbook/utilities/text.js +0 -15
@@ -1,23 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
}
|
1
|
+
$justify_content_values: (
|
2
|
+
start: start,
|
3
|
+
center: center,
|
4
|
+
end: end,
|
5
|
+
space_around: space-around,
|
6
|
+
space_between: space-between,
|
7
|
+
space_evenly: space-evenly,
|
8
|
+
);
|
9
|
+
|
10
|
+
@include global_props_responsive_css($justify_content_values, 'justify_content', 'justify-content');
|
@@ -1,19 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
}
|
1
|
+
$justify_self_values: (
|
2
|
+
auto: auto,
|
3
|
+
start: start,
|
4
|
+
center: center,
|
5
|
+
end: end,
|
6
|
+
stretch: stretch,
|
7
|
+
);
|
8
|
+
|
9
|
+
@include global_props_responsive_css($justify_self_values, 'justify_self', 'justify-self');
|
@@ -0,0 +1,26 @@
|
|
1
|
+
@mixin global_props_css($props, $class_prefix, $css_attribute, $responsive) {
|
2
|
+
@each $propkey, $propvalue in $props {
|
3
|
+
.#{$class_prefix}_#{$propkey} {
|
4
|
+
#{$css_attribute}: #{$propvalue} !important;
|
5
|
+
@content;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
@if $responsive {
|
10
|
+
@each $size, $size_value in $breakpoints_grid {
|
11
|
+
@each $prop_key, $prop_value in $props {
|
12
|
+
$min_size: map-get($size_value, "min");
|
13
|
+
$max_size: map-get($size_value, "max");
|
14
|
+
.#{$class_prefix}_#{$size}_#{$prop_key} {
|
15
|
+
@include break_on($min_size, $max_size) {
|
16
|
+
#{$css_attribute}: #{$prop_value} !important;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@mixin global_props_responsive_css($props, $class_prefix, $css_attribute) {
|
25
|
+
@include global_props_css($props, $class_prefix, $css_attribute, 1)
|
26
|
+
}
|
@@ -1,55 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
}
|
1
|
+
$order_values: (
|
2
|
+
0: 0,
|
3
|
+
1: 1,
|
4
|
+
2: 2,
|
5
|
+
3: 3,
|
6
|
+
4: 4,
|
7
|
+
5: 5,
|
8
|
+
6: 6,
|
9
|
+
7: 7,
|
10
|
+
8: 8,
|
11
|
+
9: 9,
|
12
|
+
10: 10,
|
13
|
+
11: 11,
|
14
|
+
12: 12,
|
15
|
+
);
|
16
|
+
|
17
|
+
@include global_props_responsive_css($order_values, 'flex_order', 'order');
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { omit } from 'lodash'
|
2
|
+
import { camelToSnakeCase } from './text'
|
2
3
|
|
3
4
|
import {
|
4
5
|
Binary,
|
@@ -8,62 +9,35 @@ import {
|
|
8
9
|
Sizes,
|
9
10
|
} from '../types'
|
10
11
|
|
11
|
-
type
|
12
|
-
|
13
|
-
type Margin = {
|
14
|
-
marginRight?: AllSizes,
|
15
|
-
marginLeft?: AllSizes,
|
16
|
-
marginTop?: AllSizes,
|
17
|
-
marginBottom?: AllSizes,
|
18
|
-
marginX?: AllSizes,
|
19
|
-
marginY?: AllSizes,
|
20
|
-
margin?: AllSizes,
|
21
|
-
}
|
22
|
-
|
23
|
-
type Padding = {
|
24
|
-
paddingRight?: AllSizes,
|
25
|
-
paddingLeft?: AllSizes,
|
26
|
-
paddingTop?: AllSizes,
|
27
|
-
paddingBottom?: AllSizes,
|
28
|
-
paddingX?: AllSizes,
|
29
|
-
paddingY?: AllSizes,
|
30
|
-
padding?: AllSizes,
|
31
|
-
}
|
32
|
-
|
33
|
-
type Dark = {
|
34
|
-
dark?: boolean,
|
35
|
-
}
|
36
|
-
|
37
|
-
type NumberSpacing = {
|
38
|
-
numberSpacing?: "tabular",
|
39
|
-
}
|
12
|
+
type Alignment = "start" | "end" | "center"
|
40
13
|
|
41
|
-
type
|
42
|
-
|
14
|
+
type AlignContent = {
|
15
|
+
alignContent?: Alignment & Space
|
43
16
|
}
|
44
17
|
|
45
|
-
type
|
46
|
-
|
18
|
+
type AlignItems = {
|
19
|
+
alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
|
47
20
|
}
|
48
21
|
|
49
|
-
type
|
50
|
-
|
22
|
+
type AlignSelf = {
|
23
|
+
alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
|
51
24
|
}
|
25
|
+
type AllSizes = None & Sizes
|
52
26
|
|
53
|
-
type
|
54
|
-
|
27
|
+
type BorderRadius = {
|
28
|
+
borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
|
55
29
|
}
|
56
30
|
|
57
31
|
type Cursor = {
|
58
32
|
cursor?: "pointer",
|
59
33
|
}
|
60
34
|
|
61
|
-
type
|
62
|
-
|
35
|
+
type Dark = {
|
36
|
+
dark?: boolean,
|
63
37
|
}
|
64
38
|
|
65
39
|
type Flex = {
|
66
|
-
flex?:
|
40
|
+
flex?: "auto" | "initial" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "none",
|
67
41
|
}
|
68
42
|
|
69
43
|
type FlexDirection = {
|
@@ -71,7 +45,7 @@ type FlexDirection = {
|
|
71
45
|
}
|
72
46
|
|
73
47
|
type FlexGrow = {
|
74
|
-
flexGrow?:
|
48
|
+
flexGrow?: 0 | 1
|
75
49
|
}
|
76
50
|
|
77
51
|
type FlexShrink = {
|
@@ -82,10 +56,6 @@ type FlexWrap = {
|
|
82
56
|
flexWrap?: "wrap" | "nowrap" | "wrapReverse"
|
83
57
|
}
|
84
58
|
|
85
|
-
type Alignment = "start" | "end" | "center"
|
86
|
-
|
87
|
-
type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
|
88
|
-
|
89
59
|
type JustifyContent = {
|
90
60
|
justifyContent?: Alignment & Space
|
91
61
|
}
|
@@ -94,28 +64,67 @@ type JustifySelf = {
|
|
94
64
|
justifySelf?: Alignment & ("auto" | "stretch")
|
95
65
|
}
|
96
66
|
|
97
|
-
type
|
98
|
-
|
67
|
+
type LineHeight = {
|
68
|
+
lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
|
99
69
|
}
|
100
70
|
|
101
|
-
type
|
102
|
-
|
71
|
+
type Margin = {
|
72
|
+
marginRight?: AllSizes,
|
73
|
+
marginLeft?: AllSizes,
|
74
|
+
marginTop?: AllSizes,
|
75
|
+
marginBottom?: AllSizes,
|
76
|
+
marginX?: AllSizes,
|
77
|
+
marginY?: AllSizes,
|
78
|
+
margin?: AllSizes,
|
103
79
|
}
|
104
80
|
|
105
|
-
type
|
106
|
-
|
81
|
+
type MaxWidth = {
|
82
|
+
maxWidth?: Sizes,
|
83
|
+
}
|
84
|
+
|
85
|
+
type NumberSpacing = {
|
86
|
+
numberSpacing?: "tabular",
|
107
87
|
}
|
108
88
|
|
109
89
|
type Order = {
|
110
|
-
order?: None | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
90
|
+
order?: None| "first" | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
91
|
+
}
|
92
|
+
|
93
|
+
type Padding = {
|
94
|
+
paddingRight?: AllSizes,
|
95
|
+
paddingLeft?: AllSizes,
|
96
|
+
paddingTop?: AllSizes,
|
97
|
+
paddingBottom?: AllSizes,
|
98
|
+
paddingX?: AllSizes,
|
99
|
+
paddingY?: AllSizes,
|
100
|
+
padding?: AllSizes,
|
101
|
+
}
|
102
|
+
|
103
|
+
type Shadow = {
|
104
|
+
shadow?: "none" | "deep" | "deeper" | "deepest",
|
111
105
|
}
|
112
106
|
|
107
|
+
type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
|
108
|
+
|
109
|
+
type ZIndex = {
|
110
|
+
zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
|
111
|
+
}
|
112
|
+
|
113
|
+
// keep this as the last type definition
|
113
114
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
114
115
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
115
116
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
116
117
|
LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
|
117
118
|
Shadow & ZIndex
|
118
119
|
|
120
|
+
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
121
|
+
const keys: string[] = Object.keys(prop)
|
122
|
+
return keys.map((size: Sizes) => {
|
123
|
+
const propValue: string = typeof(prop[size]) === 'string' ? camelToSnakeCase(prop[size]) : prop[size]
|
124
|
+
return `${classPrefix}_${size}_${propValue}`
|
125
|
+
}).join(" ")
|
126
|
+
}
|
127
|
+
|
119
128
|
// Prop categories
|
120
129
|
const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
|
121
130
|
spacingProps: ({
|
@@ -151,11 +160,7 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
151
160
|
css += padding ? `p_${padding} ` : ''
|
152
161
|
return css
|
153
162
|
},
|
154
|
-
darkProps: ({ dark }: Dark) =>
|
155
|
-
let css = ''
|
156
|
-
css += dark ? 'dark' : ''
|
157
|
-
return css
|
158
|
-
},
|
163
|
+
darkProps: ({ dark }: Dark) => dark ? 'dark' : '',
|
159
164
|
numberSpacingProps: ({ numberSpacing }: NumberSpacing) => {
|
160
165
|
let css = ''
|
161
166
|
css += numberSpacing ? `ns_${numberSpacing} ` : ''
|
@@ -203,72 +208,81 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
203
208
|
css += cursor ? `cursor_${cursor} ` : ''
|
204
209
|
return css
|
205
210
|
},
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
return css
|
212
|
-
},
|
213
|
-
flexWrapProps: ({ flexWrap }: FlexWrap) => {
|
214
|
-
let css = ''
|
215
|
-
css += flexWrap == 'wrapReverse' ? 'flex_wrap_reverse' :
|
216
|
-
flexWrap == 'nowrap' ? 'flex_nowrap' :
|
217
|
-
flexWrap ? `flex_wrap_${flexWrap} ` : ''
|
218
|
-
return css
|
219
|
-
},
|
220
|
-
justifyContentProps: ({ justifyContent }: JustifyContent) => {
|
221
|
-
let css = ''
|
222
|
-
css += justifyContent == 'spaceBetween' ? 'justify_content_space_between' :
|
223
|
-
justifyContent == 'spaceEvenly' ? 'justify_content_space_evenly' :
|
224
|
-
justifyContent == 'spaceAround' ? 'justify_content_space_around' :
|
225
|
-
justifyContent ? `justify_content_${justifyContent}` : ''
|
226
|
-
return css
|
227
|
-
},
|
228
|
-
justifySelfProps: ({ justifySelf }: JustifySelf) => {
|
229
|
-
let css = ''
|
230
|
-
css += justifySelf ? `justify_self_${justifySelf}` : ''
|
231
|
-
return css
|
211
|
+
alignContentProps: ({ alignContent }: AlignContent) => {
|
212
|
+
if (typeof alignContent === 'object') {
|
213
|
+
return getResponsivePropClasses(alignContent, 'align_content')
|
214
|
+
}
|
215
|
+
return alignContent ? `align_content_${camelToSnakeCase(alignContent)}` : ''
|
232
216
|
},
|
233
217
|
alignItemsProps: ({ alignItems }: AlignItems) => {
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
},
|
240
|
-
alignContentProps: ({ alignContent }: AlignContent) => {
|
241
|
-
let css = ''
|
242
|
-
css += alignContent == 'spaceBetween' ? 'align_content_space_between' :
|
243
|
-
alignContent == 'spaceEvenly' ? 'align_content_space_evenly' :
|
244
|
-
alignContent == 'spaceAround' ? 'align_content_space_around' :
|
245
|
-
alignContent ? `align_content_${alignContent}` : ''
|
246
|
-
return css
|
218
|
+
if (typeof alignItems === 'object') {
|
219
|
+
return getResponsivePropClasses(alignItems, 'align_items')
|
220
|
+
} else {
|
221
|
+
return alignItems ? `align_items_${camelToSnakeCase(alignItems)}` : ''
|
222
|
+
}
|
247
223
|
},
|
248
224
|
alignSelfProps: ({ alignSelf }: AlignSelf) => {
|
249
|
-
|
250
|
-
|
251
|
-
|
225
|
+
if (typeof alignSelf === 'object') {
|
226
|
+
return getResponsivePropClasses(alignSelf, 'align_self')
|
227
|
+
} else {
|
228
|
+
return alignSelf ? `align_self_${alignSelf}` : ''
|
229
|
+
}
|
230
|
+
},
|
231
|
+
flexDirectionProps: ({ flexDirection }: FlexDirection) => {
|
232
|
+
if (typeof flexDirection == 'object') {
|
233
|
+
return getResponsivePropClasses(flexDirection, 'flex_direction')
|
234
|
+
} else {
|
235
|
+
return flexDirection ? `flex_direction_${camelToSnakeCase(flexDirection)}` : ''
|
236
|
+
}
|
237
|
+
},
|
238
|
+
flexWrapProps: ({ flexWrap }: FlexWrap) => {
|
239
|
+
if (typeof flexWrap == 'object') {
|
240
|
+
return getResponsivePropClasses(flexWrap, 'flex_wrap')
|
241
|
+
} else {
|
242
|
+
return flexWrap ? `flex_wrap_${camelToSnakeCase(flexWrap)}` : ''
|
243
|
+
}
|
252
244
|
},
|
253
245
|
flexProps: ({ flex }: Flex) => {
|
254
|
-
|
255
|
-
|
256
|
-
|
246
|
+
if (typeof flex === 'object') {
|
247
|
+
return getResponsivePropClasses(flex, 'flex')
|
248
|
+
} else {
|
249
|
+
return flex ? `flex_${flex}` : ''
|
250
|
+
}
|
257
251
|
},
|
258
252
|
flexGrowProps: ({ flexGrow }: FlexGrow) => {
|
259
|
-
|
260
|
-
|
261
|
-
|
253
|
+
if (typeof flexGrow == 'object') {
|
254
|
+
return getResponsivePropClasses(flexGrow, 'flex_grow')
|
255
|
+
} else {
|
256
|
+
return flexGrow ? `flex_grow_${flexGrow}` : ''
|
257
|
+
}
|
262
258
|
},
|
263
259
|
flexShrinkProps: ({ flexShrink }: FlexShrink) => {
|
264
|
-
|
265
|
-
|
266
|
-
|
260
|
+
if (typeof flexShrink == 'object') {
|
261
|
+
return getResponsivePropClasses(flexShrink, 'flex_shrink')
|
262
|
+
} else {
|
263
|
+
return flexShrink ? `flex_shrink_${flexShrink}` : ''
|
264
|
+
}
|
265
|
+
},
|
266
|
+
justifyContentProps: ({ justifyContent }: JustifyContent) => {
|
267
|
+
if (typeof justifyContent === 'object') {
|
268
|
+
return getResponsivePropClasses(justifyContent, 'justify_content')
|
269
|
+
} else {
|
270
|
+
return justifyContent ? `justify_content_${camelToSnakeCase(justifyContent)}` : ''
|
271
|
+
}
|
272
|
+
},
|
273
|
+
justifySelfProps: ({ justifySelf }: JustifySelf) => {
|
274
|
+
if (typeof justifySelf === 'object') {
|
275
|
+
return getResponsivePropClasses(justifySelf, 'justify_self')
|
276
|
+
} else {
|
277
|
+
return justifySelf ? `justify_self_${justifySelf}` : ''
|
278
|
+
}
|
267
279
|
},
|
268
280
|
orderProps: ({ order }: Order) => {
|
269
|
-
|
270
|
-
|
271
|
-
|
281
|
+
if (typeof order === 'object') {
|
282
|
+
return getResponsivePropClasses(order, 'flex_order')
|
283
|
+
} else {
|
284
|
+
return order ? `flex_order_${order}` : ''
|
285
|
+
}
|
272
286
|
}
|
273
287
|
}
|
274
288
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../../test-utils'
|
3
|
+
|
4
|
+
import Body from '../../../pb_body/_body'
|
5
|
+
import { camelToSnakeCase } from '../../../utilities/text'
|
6
|
+
import { SCREEN_SIZES } from '../../test-utils'
|
7
|
+
|
8
|
+
const testSubject = 'body'
|
9
|
+
|
10
|
+
test('Global Props: returns proper class name', () => {
|
11
|
+
const propValues = ["start", "center", "end", "spaceBetween", "spaceAround", "spaceEvenly"]
|
12
|
+
for(let x = 0, y = propValues.length; x < y; ++x) {
|
13
|
+
const testId = `${testSubject}-${propValues[x]}`
|
14
|
+
render(
|
15
|
+
<Body
|
16
|
+
alignContent={`${propValues[x]}`}
|
17
|
+
data={{ testid: testId }}
|
18
|
+
text="Hi"
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
const kit = screen.getByTestId(testId)
|
22
|
+
expect(kit).toHaveClass(`align_content_${camelToSnakeCase(propValues[x])}`)
|
23
|
+
|
24
|
+
SCREEN_SIZES.forEach((size) => {
|
25
|
+
const testId = `${testSubject}-${propValues[x]}-${size}`
|
26
|
+
render(
|
27
|
+
<Body
|
28
|
+
alignContent={{ [size]: propValues[x] }}
|
29
|
+
data={{ testid: testId }}
|
30
|
+
text="Hi"
|
31
|
+
/>
|
32
|
+
)
|
33
|
+
const kit = screen.getByTestId(testId)
|
34
|
+
expect(kit).toHaveClass(`align_content_${size}_${camelToSnakeCase(propValues[x])}`)
|
35
|
+
})
|
36
|
+
}
|
37
|
+
})
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../../test-utils'
|
3
|
+
|
4
|
+
import Body from '../../../pb_body/_body'
|
5
|
+
import { camelToSnakeCase } from '../../../utilities/text'
|
6
|
+
import { SCREEN_SIZES } from '../../test-utils'
|
7
|
+
|
8
|
+
const testSubject = 'body'
|
9
|
+
|
10
|
+
test('Global Props: returns proper class name', () => {
|
11
|
+
const propValues = ["start", "center", "end", "baseline", "stretch", "flexStart", "flexEnd"]
|
12
|
+
for(let x = 0, y = propValues.length; x < y; ++x) {
|
13
|
+
const testId = `${testSubject}-${propValues[x]}`
|
14
|
+
render(
|
15
|
+
<Body
|
16
|
+
alignItems={`${propValues[x]}`}
|
17
|
+
data={{ testid: testId }}
|
18
|
+
text="Hi"
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
const kit = screen.getByTestId(testId)
|
22
|
+
expect(kit).toHaveClass(`align_items_${camelToSnakeCase(propValues[x])}`)
|
23
|
+
SCREEN_SIZES.forEach((size) => {
|
24
|
+
const testId = `${testSubject}-${propValues[x]}-${size}`
|
25
|
+
render(
|
26
|
+
<Body
|
27
|
+
alignItems={{ [size]: propValues[x] }}
|
28
|
+
data={{ testid: testId }}
|
29
|
+
text="Hi"
|
30
|
+
/>
|
31
|
+
)
|
32
|
+
const kit = screen.getByTestId(testId)
|
33
|
+
expect(kit).toHaveClass(`align_items_${size}_${camelToSnakeCase(propValues[x])}`)
|
34
|
+
})
|
35
|
+
}
|
36
|
+
})
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../../test-utils'
|
3
|
+
|
4
|
+
import Body from '../../../pb_body/_body'
|
5
|
+
import { camelToSnakeCase } from '../../../utilities/text'
|
6
|
+
import { SCREEN_SIZES } from '../../test-utils'
|
7
|
+
|
8
|
+
const testSubject = 'body'
|
9
|
+
|
10
|
+
test('Global Props: returns proper class name', () => {
|
11
|
+
const propValues = ["start", "center", "end", "stretch", "baseline", "auto"]
|
12
|
+
for(let x = 0, y = propValues.length; x < y; ++x) {
|
13
|
+
const testId = `${testSubject}-${propValues[x]}`
|
14
|
+
render(
|
15
|
+
<Body
|
16
|
+
alignSelf={`${propValues[x]}`}
|
17
|
+
data={{ testid: testId }}
|
18
|
+
text="Hi"
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
const kit = screen.getByTestId(testId)
|
22
|
+
expect(kit).toHaveClass(`align_self_${camelToSnakeCase(propValues[x])}`)
|
23
|
+
|
24
|
+
SCREEN_SIZES.forEach((size) => {
|
25
|
+
const testId = `${testSubject}-${propValues[x]}-${size}`
|
26
|
+
render(
|
27
|
+
<Body
|
28
|
+
alignSelf={{ [size]: propValues[x] }}
|
29
|
+
data={{ testid: testId }}
|
30
|
+
text="Hi"
|
31
|
+
/>
|
32
|
+
)
|
33
|
+
const kit = screen.getByTestId(testId)
|
34
|
+
expect(kit).toHaveClass(`align_self_${size}_${camelToSnakeCase(propValues[x])}`)
|
35
|
+
})
|
36
|
+
}
|
37
|
+
})
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../../test-utils'
|
3
|
+
|
4
|
+
import Body from '../../../pb_body/_body'
|
5
|
+
import { camelToSnakeCase } from '../../../utilities/text'
|
6
|
+
import { SCREEN_SIZES } from '../../test-utils'
|
7
|
+
|
8
|
+
const testSubject = 'body'
|
9
|
+
|
10
|
+
// %w[block inline_block inline flex inline_flex none]
|
11
|
+
test('Global Props: returns proper class name', () => {
|
12
|
+
const propValues = ["block", "inline", "inline_block", "flex", "inline_flex", "none"]
|
13
|
+
for(let x = 0, y = propValues.length; x < y; ++x) {
|
14
|
+
const testId = `${testSubject}-${propValues[x]}`
|
15
|
+
render(
|
16
|
+
<Body
|
17
|
+
data={{ testid: testId }}
|
18
|
+
display={`${propValues[x]}`}
|
19
|
+
text="Hi"
|
20
|
+
/>
|
21
|
+
)
|
22
|
+
const kit = screen.getByTestId(testId)
|
23
|
+
expect(kit).toHaveClass(`display_${camelToSnakeCase(propValues[x])}`)
|
24
|
+
|
25
|
+
SCREEN_SIZES.forEach((size) => {
|
26
|
+
const testId = `${testSubject}-${propValues[x]}-${size}`
|
27
|
+
render(
|
28
|
+
<Body
|
29
|
+
data={{ testid: testId }}
|
30
|
+
display={{ [size]: propValues[x] }}
|
31
|
+
text="Hi"
|
32
|
+
/>
|
33
|
+
)
|
34
|
+
const kit = screen.getByTestId(testId)
|
35
|
+
expect(kit).toHaveClass(`display_${size}_${camelToSnakeCase(propValues[x])}`)
|
36
|
+
})
|
37
|
+
}
|
38
|
+
})
|