playbook_ui 10.26.0.pre.alpha3 → 10.26.0.pre.alpha5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +1 -0
  4. data/app/pb_kits/playbook/index.js +2 -1
  5. data/app/pb_kits/playbook/pb_background/{_background.jsx → _background.tsx} +20 -13
  6. data/app/pb_kits/playbook/pb_badge/{_badge.jsx → _badge.tsx} +14 -15
  7. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +1 -1
  8. data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +1 -1
  10. data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -3
  11. data/app/pb_kits/playbook/pb_body/_body.tsx +1 -1
  12. data/app/pb_kits/playbook/pb_button/{_button.jsx → _button.tsx} +65 -46
  13. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +1 -0
  14. data/app/pb_kits/playbook/pb_button/docs/_button_options.jsx +1 -1
  15. data/app/pb_kits/playbook/pb_caption/{_caption.jsx → _caption.tsx} +7 -8
  16. data/app/pb_kits/playbook/pb_card/{_card.jsx → _card.tsx} +23 -23
  17. data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -1
  18. data/app/pb_kits/playbook/pb_card/docs/_card_border_none.jsx +1 -1
  19. data/app/pb_kits/playbook/pb_card/docs/_card_border_radius.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +17 -2
  21. data/app/pb_kits/playbook/pb_card/docs/_card_selected.jsx +1 -1
  22. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +4 -2
  23. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
  24. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +37 -0
  25. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +37 -0
  26. data/app/pb_kits/playbook/pb_flex/{_flex.jsx → _flex.tsx} +5 -5
  27. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  28. data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
  29. data/app/pb_kits/playbook/pb_icon/{_icon.jsx → _icon.tsx} +40 -30
  30. data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +6 -8
  31. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +1 -1
  32. data/app/pb_kits/playbook/pb_pill/docs/_pill_variants.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +7 -0
  34. data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +6 -4
  35. data/app/pb_kits/playbook/pb_title/{_title.jsx → _title.tsx} +10 -12
  36. data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
  37. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
  38. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
  39. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
  40. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
  41. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
  42. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
  43. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
  44. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
  45. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
  46. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
  47. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
  48. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
  49. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
  50. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
  51. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
  52. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
  53. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
  54. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
  55. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
  56. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
  57. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +43 -0
  58. data/app/pb_kits/playbook/pb_user/{_user.jsx → _user.tsx} +20 -24
  59. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  60. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
  61. data/app/pb_kits/playbook/plugins/pb_chart.js +34 -0
  62. data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
  63. data/app/pb_kits/playbook/tokens/_display.scss +3 -3
  64. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +25 -5
  65. data/app/pb_kits/playbook/utilities/_align_content.scss +10 -29
  66. data/app/pb_kits/playbook/utilities/_align_items.scss +11 -35
  67. data/app/pb_kits/playbook/utilities/_align_self.scss +10 -29
  68. data/app/pb_kits/playbook/utilities/_display.scss +9 -42
  69. data/app/pb_kits/playbook/utilities/_flex.scss +19 -14
  70. data/app/pb_kits/playbook/utilities/_flex_direction.scss +7 -18
  71. data/app/pb_kits/playbook/utilities/_flex_grow.scss +5 -8
  72. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +5 -8
  73. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +6 -13
  74. data/app/pb_kits/playbook/utilities/_justify_content.scss +10 -23
  75. data/app/pb_kits/playbook/utilities/_justify_self.scss +9 -19
  76. data/app/pb_kits/playbook/utilities/_mixins.scss +26 -0
  77. data/app/pb_kits/playbook/utilities/_order.scss +17 -55
  78. data/app/pb_kits/playbook/utilities/globalProps.ts +127 -113
  79. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +37 -0
  80. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +36 -0
  81. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +37 -0
  82. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +38 -0
  83. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +64 -0
  84. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +37 -0
  85. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +35 -0
  86. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +35 -0
  87. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +37 -0
  88. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +37 -0
  89. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +37 -0
  90. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +35 -0
  91. data/app/pb_kits/playbook/utilities/test-utils.js +2 -0
  92. data/app/pb_kits/playbook/utilities/text.ts +22 -0
  93. data/dist/reset.css +60 -1
  94. data/lib/playbook/align_content.rb +11 -3
  95. data/lib/playbook/align_items.rb +10 -2
  96. data/lib/playbook/align_self.rb +9 -1
  97. data/lib/playbook/display.rb +2 -4
  98. data/lib/playbook/flex.rb +9 -1
  99. data/lib/playbook/flex_direction.rb +10 -2
  100. data/lib/playbook/flex_grow.rb +9 -1
  101. data/lib/playbook/flex_shrink.rb +9 -1
  102. data/lib/playbook/flex_wrap.rb +10 -2
  103. data/lib/playbook/justify_content.rb +10 -2
  104. data/lib/playbook/justify_self.rb +9 -1
  105. data/lib/playbook/order.rb +10 -2
  106. data/lib/playbook/version.rb +2 -2
  107. metadata +47 -13
  108. data/app/pb_kits/playbook/utilities/text.js +0 -15
@@ -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 AllSizes = None & Sizes
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 MaxWidth = {
42
- maxWidth?: Sizes,
14
+ type AlignContent = {
15
+ alignContent?: Alignment & Space
43
16
  }
44
17
 
45
- type ZIndex = {
46
- zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
18
+ type AlignItems = {
19
+ alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
47
20
  }
48
21
 
49
- type Shadow = {
50
- shadow?: None | "deep" | "deeper" | "deepest",
22
+ type AlignSelf = {
23
+ alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
51
24
  }
25
+ type AllSizes = None & Sizes
52
26
 
53
- type LineHeight = {
54
- lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
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 BorderRadius = {
62
- borderRadius?: None | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
35
+ type Dark = {
36
+ dark?: boolean,
63
37
  }
64
38
 
65
39
  type Flex = {
66
- flex?: None | "initial" | "auto" | 1
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?: Binary
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 AlignContent = {
98
- alignContent?: Alignment & Space
67
+ type LineHeight = {
68
+ lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
99
69
  }
100
70
 
101
- type AlignItems = {
102
- alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
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 AlignSelf = {
106
- alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
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} ` : ''
@@ -186,10 +191,10 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
186
191
  Object.entries(display).forEach((displayEntry) => {
187
192
  if (displayEntry[0] == "display") {
188
193
  if (typeof displayEntry[1] == "string") {
189
- css += `display_${displayEntry[1]}`
194
+ css += `display_${displayEntry[1]} `
190
195
  } else if (typeof displayEntry[1] == "object") {
191
196
  Object.entries(displayEntry[1]).forEach((displayObj) => {
192
- css += `display_${displayObj[0]}_${displayObj[1]}`
197
+ css += `display_${displayObj[0]}_${displayObj[1]} `
193
198
  })
194
199
  } else {
195
200
  ' '
@@ -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
- flexDirectionProps: ({ flexDirection }: FlexDirection) => {
207
- let css = ''
208
- css += flexDirection == 'columnReverse' ? 'flex_direction_column_reverse' :
209
- flexDirection == 'rowReverse' ? 'flex_direction_row_reverse' :
210
- flexDirection ? `flex_direction_${flexDirection} ` : ''
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
- let css = ''
235
- css += alignItems == 'flexStart' ? 'align_items_flex_start' :
236
- alignItems == 'flexEnd' ? 'align_items_flex_end' :
237
- alignItems ? `align_items_${alignItems}` : ''
238
- return css
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
- let css = ''
250
- css += alignSelf ? `align_self_${alignSelf}` : ''
251
- return css
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
- let css = ''
255
- css += flex ? `flex_${flex}` : ''
256
- return css
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
- let css = ''
260
- css += flexGrow ? `flex_grow_${flexGrow}` : ''
261
- return css
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
- let css = ''
265
- css += flexShrink ? `flex_shrink_${flexShrink}` : ''
266
- return css
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
- let css = ''
270
- css += order ? `order_${order}` : ''
271
- return css
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
+ })
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../../test-utils'
3
+
4
+ import Body from '../../../pb_body/_body'
5
+ import { SCREEN_SIZES } from '../../test-utils'
6
+
7
+ const testSubject = 'body'
8
+
9
+ test('Global Props: Returns ordinal suffixed class name', () => {
10
+ for(let x = 0, y = 13; x < y; ++x) {
11
+ const testId = `${testSubject}-${x}`
12
+ render(
13
+ <Body
14
+ data={{ testid: testId }}
15
+ flex={`${x}`}
16
+ text="Hi"
17
+ />
18
+ )
19
+ const kit = screen.getByTestId(testId)
20
+ expect(kit).toHaveClass(`flex_${x}`)
21
+
22
+ SCREEN_SIZES.forEach((size) => {
23
+ const testId = `${testSubject}-${x}-${size}`
24
+ render(
25
+ <Body
26
+ data={{ testid: testId }}
27
+ flex={{ [size]: x }}
28
+ text="Hi"
29
+ />
30
+ )
31
+ const kit = screen.getByTestId(testId)
32
+ expect(kit).toHaveClass(`flex_${size}_${x}`)
33
+ })
34
+ }
35
+ })
36
+
37
+ test('Global Props: returns proper class name', () => {
38
+ const propValues = ["auto", "initial", "none"]
39
+ for(let x = 0, y = propValues.length; x < y; ++x) {
40
+ const testId = `${testSubject}-${propValues[x]}`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ flex={`${propValues[x]}`}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ expect(kit).toHaveClass(`flex_${propValues[x]}`)
50
+
51
+ SCREEN_SIZES.forEach((size) => {
52
+ const testId = `${testSubject}-${propValues[x]}-${size}`
53
+ render(
54
+ <Body
55
+ data={{ testid: testId }}
56
+ flex={{ [size]: propValues[x] }}
57
+ text="Hi"
58
+ />
59
+ )
60
+ const kit = screen.getByTestId(testId)
61
+ expect(kit).toHaveClass(`flex_${size}_${propValues[x]}`)
62
+ })
63
+ }
64
+ })
@@ -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 = ["row", "column", "columnReverse"]
12
+ for(let x = 0, y = propValues.length; x < y; ++x) {
13
+ const testId = `${testSubject}-${propValues[x]}`
14
+ render(
15
+ <Body
16
+ data={{ testid: testId }}
17
+ flexDirection={`${propValues[x]}`}
18
+ text="Hi"
19
+ />
20
+ )
21
+ const kit = screen.getByTestId(testId)
22
+ expect(kit).toHaveClass(`flex_direction_${camelToSnakeCase(propValues[x])}`)
23
+
24
+ SCREEN_SIZES.forEach((size) => {
25
+ const testId = `${testSubject}-${propValues[x]}-${size}`
26
+ render(
27
+ <Body
28
+ data={{ testid: testId }}
29
+ flexDirection={{ [size]: propValues[x] }}
30
+ text="Hi"
31
+ />
32
+ )
33
+ const kit = screen.getByTestId(testId)
34
+ expect(kit).toHaveClass(`flex_direction_${size}_${camelToSnakeCase(propValues[x])}`)
35
+ })
36
+ }
37
+ })
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../../test-utils'
3
+
4
+ import Body from '../../../pb_body/_body'
5
+ import { SCREEN_SIZES } from '../../test-utils'
6
+
7
+ const testSubject = 'body'
8
+
9
+ test('Global Props: Returns ordinal suffixed class name', () => {
10
+ for(let x = 0, y = 2; x < y; ++x) {
11
+ const testId = `${testSubject}-${x}`
12
+ render(
13
+ <Body
14
+ data={{ testid: testId }}
15
+ flexGrow={`${x}`}
16
+ text="Hi"
17
+ />
18
+ )
19
+ const kit = screen.getByTestId(testId)
20
+ expect(kit).toHaveClass(`flex_grow_${x}`)
21
+
22
+ SCREEN_SIZES.forEach((size) => {
23
+ const testId = `${testSubject}-${x}-${size}`
24
+ render(
25
+ <Body
26
+ data={{ testid: testId }}
27
+ flexGrow={{ [size]: x }}
28
+ text="Hi"
29
+ />
30
+ )
31
+ const kit = screen.getByTestId(testId)
32
+ expect(kit).toHaveClass(`flex_grow_${size}_${x}`)
33
+ })
34
+ }
35
+ })
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../../test-utils'
3
+
4
+ import Body from '../../../pb_body/_body'
5
+ import { SCREEN_SIZES } from '../../test-utils'
6
+
7
+ const testSubject = 'body'
8
+
9
+ test('Global Props: Returns ordinal suffixed class name', () => {
10
+ for(let x = 0, y = 2; x < y; ++x) {
11
+ const testId = `${testSubject}-${x}`
12
+ render(
13
+ <Body
14
+ data={{ testid: testId }}
15
+ flexShrink={`${x}`}
16
+ text="Hi"
17
+ />
18
+ )
19
+ const kit = screen.getByTestId(testId)
20
+ expect(kit).toHaveClass(`flex_shrink_${x}`)
21
+
22
+ SCREEN_SIZES.forEach((size) => {
23
+ const testId = `${testSubject}-${x}-${size}`
24
+ render(
25
+ <Body
26
+ data={{ testid: testId }}
27
+ flexShrink={{ [size]: x }}
28
+ text="Hi"
29
+ />
30
+ )
31
+ const kit = screen.getByTestId(testId)
32
+ expect(kit).toHaveClass(`flex_shrink_${size}_${x}`)
33
+ })
34
+ }
35
+ })