playbook_ui 10.26.0.pre.alpha1 → 10.26.0.pre.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/data/menu.yml +0 -1
  3. data/app/pb_kits/playbook/index.js +1 -2
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_body/_body.tsx +8 -8
  6. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +0 -1
  7. data/app/pb_kits/playbook/pb_caption/{_caption.tsx → _caption.jsx} +8 -7
  8. data/app/pb_kits/playbook/pb_card/_card.jsx +3 -1
  9. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -0
  10. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +0 -37
  11. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +0 -37
  12. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +1 -1
  13. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
  14. data/app/pb_kits/playbook/pb_kit/dateTime.js +2 -1
  15. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  16. data/app/pb_kits/playbook/pb_table/_table.jsx +3 -0
  17. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +83 -0
  18. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +94 -0
  19. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +3 -0
  20. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  21. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  22. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
  23. data/app/pb_kits/playbook/pb_table/styles/_sticky_header.scss +21 -0
  24. data/app/pb_kits/playbook/pb_table/table.rb +7 -1
  25. data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
  26. data/app/pb_kits/playbook/pb_title/{_title.tsx → _title.jsx} +12 -10
  27. data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
  28. data/app/pb_kits/playbook/playbook-doc.js +0 -2
  29. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +0 -2
  30. data/app/pb_kits/playbook/plugins/pb_chart.js +0 -34
  31. data/app/pb_kits/playbook/tokens/_display.scss +13 -0
  32. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +21 -5
  33. data/app/pb_kits/playbook/utilities/_display.scss +58 -1
  34. data/app/pb_kits/playbook/utilities/_flex_direction.scss +15 -28
  35. data/app/pb_kits/playbook/utilities/globalProps.ts +134 -103
  36. data/app/pb_kits/playbook/utilities/text.js +15 -0
  37. data/dist/reset.css +1 -60
  38. data/lib/playbook/display.rb +20 -6
  39. data/lib/playbook/flex_direction.rb +1 -7
  40. data/lib/playbook/version.rb +1 -1
  41. metadata +12 -27
  42. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +0 -79
  43. data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +0 -5
  44. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +0 -37
  45. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +0 -48
  46. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +0 -2
  47. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +0 -37
  48. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +0 -47
  49. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +0 -3
  50. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +0 -79
  51. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +0 -90
  52. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +0 -1
  53. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +0 -54
  54. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +0 -65
  55. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +0 -3
  56. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +0 -37
  57. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +0 -48
  58. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +0 -3
  59. data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +0 -15
  60. data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +0 -5
  61. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +0 -1
  62. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +0 -43
  63. data/app/pb_kits/playbook/utilities/text.ts +0 -22
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
12
12
  )
13
13
 
14
14
  const kit = screen.getByTestId('primary-test')
15
- expect(kit).toHaveClass('pb_title_kit_size_3')
15
+ expect(kit).toHaveClass('pb_title_kit_3')
16
16
  })
17
17
 
18
18
  test('with colors', () => {
@@ -25,5 +25,5 @@ test('with colors', () => {
25
25
  )
26
26
 
27
27
  const kit = screen.getByTestId('primary-test')
28
- expect(kit).toHaveClass('pb_title_kit_size_3_success')
28
+ expect(kit).toHaveClass('pb_title_kit_3_success')
29
29
  })
@@ -91,7 +91,6 @@ import * as Title from 'pb_title/docs'
91
91
  import * as TitleCount from 'pb_title_count/docs'
92
92
  import * as TitleDetail from 'pb_title_detail/docs'
93
93
  import * as Toggle from 'pb_toggle/docs'
94
- import * as TreemapChart from 'pb_treemap_chart/docs'
95
94
  import * as Typeahead from 'pb_typeahead/docs'
96
95
  import * as User from 'pb_user/docs'
97
96
  import * as UserBadge from 'pb_user_badge/docs'
@@ -186,7 +185,6 @@ WebpackerReact.setup({
186
185
  ...TitleCount,
187
186
  ...TitleDetail,
188
187
  ...Toggle,
189
- ...TreemapChart,
190
188
  ...Typeahead,
191
189
  ...User,
192
190
  ...UserBadge,
@@ -13,7 +13,6 @@ import Legend from './pb_legend/_legend'
13
13
  import LineGraph from './pb_line_graph/_line_graph'
14
14
  import Passphrase from './pb_passphrase/_passphrase'
15
15
  import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
16
- import TreemapChart from './pb_treemap_chart/_treemap_chart'
17
16
  import Typeahead from './pb_typeahead/_typeahead'
18
17
 
19
18
  WebpackerReact.registerComponents({
@@ -27,7 +26,6 @@ WebpackerReact.registerComponents({
27
26
  LineGraph,
28
27
  Passphrase,
29
28
  RichTextEditor,
30
- TreemapChart,
31
29
  Typeahead,
32
30
  })
33
31
 
@@ -7,7 +7,6 @@ import colors from '../tokens/exports/_colors.scss'
7
7
  import pie from 'highcharts/modules/variable-pie'
8
8
  import highchartsMore from 'highcharts/highcharts-more'
9
9
  import solidGauge from 'highcharts/modules/solid-gauge'
10
- import treemap from 'highcharts/modules/treemap'
11
10
 
12
11
  pie(Highcharts)
13
12
 
@@ -64,8 +63,6 @@ class pbChart {
64
63
  this.setupPieChart(options)
65
64
  } else if (this.options.type == 'gauge') {
66
65
  this.setupGauge(options)
67
- } else if (this.options.type == 'treemap') {
68
- this.setupTreemap(options)
69
66
  } else {
70
67
  this.setupChart(options)
71
68
  }
@@ -194,37 +191,6 @@ class pbChart {
194
191
  })
195
192
  }
196
193
 
197
- setupTreemap(options) {
198
- treemap(Highcharts)
199
- this.setupTheme()
200
- options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
201
-
202
- Highcharts.chart(this.defaults.id, {
203
- title: {
204
- text: this.defaults.title,
205
- },
206
- chart: {
207
- height: this.defaults.height,
208
- type: this.defaults.type,
209
- },
210
- credits: false,
211
- series: [{
212
- data: this.defaults.chartData,
213
- }],
214
- plotOptions: {
215
- treemap: {
216
- allowTraversingTree: this.defaults.drillable,
217
- colorByPoint: !this.defaults.grouped,
218
- colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
219
- },
220
- },
221
- tooltip: {
222
- pointFormat: this.defaults.tooltipHtml,
223
- useHTML: true,
224
- },
225
- })
226
- }
227
-
228
194
  setupChart(options) {
229
195
  this.setupTheme()
230
196
  const configOptions = {
@@ -0,0 +1,13 @@
1
+ $display_inline: inline;
2
+ $display_block: block;
3
+ $display_inline_block: inline-block;
4
+ $display_flex: flex;
5
+ $display_hidden: hidden;
6
+ $display_inline_flex: inline-flex;
7
+ $displays: (
8
+ display_hidden: $display_hidden,
9
+ display_flex: $display_flex,
10
+ display_inline: $display_inline,
11
+ display_inline_block: $display_inline_block,
12
+ display_block: $display_block
13
+ );
@@ -10,11 +10,11 @@ $screen-xl-min: 1200px;
10
10
  $screen-xl-max: $screen-xl-min - 1;
11
11
 
12
12
  $breakpoints: (
13
- xs: $screen-xs-min,
14
- sm: $screen-sm-min,
15
- md: $screen-md-min,
16
- lg: $screen-lg-min,
17
- xl: $screen-xl-min
13
+ xs: $screen-xs-min, // $screen-xs-min
14
+ sm: $screen-sm-min, // $screen-xs-min + 1 thru $screen-md-min
15
+ md: $screen-md-min, // $screen-md-min + 1 thru $screen-md-lg
16
+ lg: $screen-lg-min, // $screen-lg-min + 1 thru $screen-md-xl
17
+ xl: $screen-xl-min // $screen-xl-min + 1
18
18
  );
19
19
 
20
20
 
@@ -28,3 +28,19 @@ $breakpoints: (
28
28
  @content;
29
29
  }
30
30
  }
31
+
32
+ @mixin break_on($min: null, $max: null) {
33
+ @if not $max {
34
+ @media screen and (min-width: $min) {
35
+ @content;
36
+ }
37
+ } @else if not $min {
38
+ @media screen and (max-width: $max) {
39
+ @content;
40
+ }
41
+ } @else {
42
+ @media screen and (min-width: $min) and (max-width: $max) {
43
+ @content;
44
+ }
45
+ }
46
+ }
@@ -1,3 +1,5 @@
1
+ @import "../tokens/display";
2
+
1
3
  .display_block {
2
4
  display: block;
3
5
  }
@@ -20,4 +22,59 @@
20
22
 
21
23
  .display_hidden {
22
24
  display: none;
23
- }
25
+ }
26
+
27
+ $screen-xs-min: 575px;
28
+ $screen-xs-max: $screen-xs-min - 1;
29
+ $screen-sm-min: 576px;
30
+ $screen-sm-max: $screen-sm-min - 1;
31
+ $screen-md-min: 768px;
32
+ $screen-md-max: $screen-md-min - 1;
33
+ $screen-lg-min: 992px;
34
+ $screen-lg-max: $screen-lg-min - 1;
35
+ $screen-xl-min: 1200px;
36
+ $screen-xl-max: $screen-xl-min - 1;
37
+
38
+ $breakpoints: (
39
+ xs: (
40
+ // min: 0,
41
+ max: $screen-xs-min // 575
42
+ ),
43
+ sm: (
44
+ min: $screen-sm-min, // 576
45
+ max: $screen-md-max // 767
46
+ ),
47
+ md: (
48
+ min: $screen-md-min, // 768
49
+ max: $screen-lg-max // 991
50
+ ),
51
+ lg: (
52
+ min: $screen-lg-min, // 992
53
+ max: $screen-xl-max // 1199
54
+ ),
55
+ xl: (
56
+ min: $screen-xl-min, //1200
57
+ // max: 0
58
+ )
59
+ );
60
+
61
+
62
+ $display_values: (
63
+ hidden: $display_hidden,
64
+ flex: $display_flex,
65
+ inline: $display_inline,
66
+ inline_block: $display_inline_block,
67
+ block: $display_block
68
+ );
69
+
70
+ @each $size, $size_value in $breakpoints {
71
+ @each $display, $display_value in $display_values {
72
+ $min_size: map-get($size_value, "min");
73
+ $max_size: map-get($size_value, "max");
74
+ @include break_on($min_size, $max_size) {
75
+ .display_#{$size}_#{$display} {
76
+ display: #{$display_value} !important;
77
+ }
78
+ }
79
+ }
80
+ }
@@ -1,32 +1,19 @@
1
- $flex_direction_values: (
2
- row: row,
3
- column: column,
4
- row_reverse: row-reverse,
5
- column_reverse: column-reverse
6
- );
7
-
8
- $media-query-breakpoints: (
9
- xs: "xs",
10
- sm: "sm",
11
- md: "md",
12
- lg: "lg",
13
- xl: "xl"
14
- );
1
+ .flex_direction_row {
2
+ display: flex;
3
+ flex-direction: row !important;
4
+ }
15
5
 
16
- @each $flex-direction, $flex-direction-value in $flex_direction_values {
17
- .flex_direction_#{$flex-direction} {
18
- display: flex;
19
- flex-direction: #{$flex-direction-value} !important;
20
- }
6
+ .flex_direction_column {
7
+ display: flex;
8
+ flex-direction: column !important;
21
9
  }
22
10
 
23
- @each $flex-direction, $flex-direction-value in $flex_direction_values {
24
- @each $breakpoint, $breakpoint-value in $media-query-breakpoints {
25
- .flex_direction_#{$breakpoint}_#{$flex-direction} {
26
- display: flex;
27
- @include break_at( breakpoint($breakpoint-value)) {
28
- flex-direction: #{$flex-direction-value} !important;
29
- }
30
- }
31
- }
11
+ .flex_direction_row_reverse {
12
+ display: flex;
13
+ flex-direction: row-reverse !important;
32
14
  }
15
+
16
+ .flex_direction_column_reverse {
17
+ display: flex;
18
+ flex-direction: column-reverse !important;
19
+ }
@@ -1,66 +1,91 @@
1
- // Please keep these in alphabetical order
2
1
  import { omit } from 'lodash'
3
- import { camelToSnakeCase } from './text'
4
2
 
5
- type Alignment = "start" | "end" | "center"
3
+ import {
4
+ Binary,
5
+ Display,
6
+ DisplaySizes,
7
+ None,
8
+ Sizes,
9
+ } from '../types'
6
10
 
7
- type AlignContent = {
8
- alignContent?: Alignment & Space
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,
9
21
  }
10
22
 
11
- type AlignItems = {
12
- alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
23
+ type Padding = {
24
+ paddingRight?: AllSizes,
25
+ paddingLeft?: AllSizes,
26
+ paddingTop?: AllSizes,
27
+ paddingBottom?: AllSizes,
28
+ paddingX?: AllSizes,
29
+ paddingY?: AllSizes,
30
+ padding?: AllSizes,
13
31
  }
14
32
 
15
- type AlignSelf = {
16
- alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
33
+ type Dark = {
34
+ dark?: boolean,
17
35
  }
18
- type AllSizes = None & Sizes
19
36
 
20
- type BorderRadius = {
21
- borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
37
+ type NumberSpacing = {
38
+ numberSpacing?: "tabular",
22
39
  }
23
40
 
24
- type Cursor = {
25
- cursor?: "pointer",
41
+ type MaxWidth = {
42
+ maxWidth?: Sizes,
26
43
  }
27
44
 
28
- type Dark = {
29
- dark?: boolean,
45
+ type ZIndex = {
46
+ zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
47
+ }
48
+
49
+ type Shadow = {
50
+ shadow?: None | "deep" | "deeper" | "deepest",
51
+ }
52
+
53
+ type LineHeight = {
54
+ lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
30
55
  }
31
56
 
32
- type Display = {
33
- display?: "block" | "flex" | "hidden" | "inline_block" | "inline" | "inline_flex",
57
+ type Cursor = {
58
+ cursor?: "pointer",
59
+ }
60
+
61
+ type BorderRadius = {
62
+ borderRadius?: None | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
34
63
  }
35
64
 
36
65
  type Flex = {
37
- flex?: "none" | "initial" | "auto" | 1
66
+ flex?: None | "initial" | "auto" | 1
38
67
  }
39
68
 
40
69
  type FlexDirection = {
41
- flexDirection?: {
42
- xs?: FlexDirectionOptions,
43
- sm?: FlexDirectionOptions,
44
- md?: FlexDirectionOptions,
45
- lg?: FlexDirectionOptions,
46
- xl?: FlexDirectionOptions,
47
- }
70
+ flexDirection?: "row" | "column" | "rowReverse" | "columnReverse"
48
71
  }
49
72
 
50
- type FlexDirectionOptions = "row" | "column" | "row_reverse" | "column_reverse"
51
-
52
73
  type FlexGrow = {
53
- flexGrow?: 0 | 1
74
+ flexGrow?: Binary
54
75
  }
55
76
 
56
77
  type FlexShrink = {
57
- flexShrink?: 0 | 1
78
+ flexShrink?: Binary
58
79
  }
59
80
 
60
81
  type FlexWrap = {
61
- flexWrap?: "wrap" | "nowrap" | "reverse",
82
+ flexWrap?: "wrap" | "nowrap" | "wrapReverse"
62
83
  }
63
84
 
85
+ type Alignment = "start" | "end" | "center"
86
+
87
+ type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
88
+
64
89
  type JustifyContent = {
65
90
  justifyContent?: Alignment & Space
66
91
  }
@@ -69,59 +94,24 @@ type JustifySelf = {
69
94
  justifySelf?: Alignment & ("auto" | "stretch")
70
95
  }
71
96
 
72
- type LineHeight = {
73
- lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
74
- }
75
-
76
- type Margin = {
77
- marginRight?: AllSizes,
78
- marginLeft?: AllSizes,
79
- marginTop?: AllSizes,
80
- marginBottom?: AllSizes,
81
- marginX?: AllSizes,
82
- marginY?: AllSizes,
83
- margin?: AllSizes,
97
+ type AlignContent = {
98
+ alignContent?: Alignment & Space
84
99
  }
85
100
 
86
- type MaxWidth = {
87
- maxWidth?: Sizes,
101
+ type AlignItems = {
102
+ alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
88
103
  }
89
104
 
90
- type None = "none"
91
-
92
- type NumberSpacing = {
93
- numberSpacing?: "tabular",
105
+ type AlignSelf = {
106
+ alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
94
107
  }
95
108
 
96
109
  type Order = {
97
- order?: "none" | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
98
- }
99
-
100
- type Padding = {
101
- paddingRight?: AllSizes,
102
- paddingLeft?: AllSizes,
103
- paddingTop?: AllSizes,
104
- paddingBottom?: AllSizes,
105
- paddingX?: AllSizes,
106
- paddingY?: AllSizes,
107
- padding?: AllSizes,
108
- }
109
-
110
- type Shadow = {
111
- shadow?: "none" | "deep" | "deeper" | "deepest",
112
- }
113
-
114
- type Sizes = "xs" | "sm" | "md" | "lg" | "xl"
115
-
116
- type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
117
-
118
- type ZIndex = {
119
- zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
110
+ order?: None | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
120
111
  }
121
112
 
122
- // keep this as the last type definition
123
113
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
124
- BorderRadius & Cursor & Dark & Display & Flex & FlexDirection &
114
+ BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
125
115
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
126
116
  LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
127
117
  Shadow & ZIndex
@@ -191,9 +181,21 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
191
181
  css += lineHeight ? `line_height_${lineHeight} ` : ''
192
182
  return css
193
183
  },
194
- displayProps: ({ display }: Display) => {
184
+ displayProps: (display: Display ) => {
195
185
  let css = ''
196
- css += display ? `display_${display} ` : ''
186
+ Object.entries(display).forEach((displayEntry) => {
187
+ if (displayEntry[0] == "display") {
188
+ if (typeof displayEntry[1] == "string") {
189
+ css += `display_${displayEntry[1]}`
190
+ } else if (typeof displayEntry[1] == "object") {
191
+ Object.entries(displayEntry[1]).forEach((displayObj) => {
192
+ css += `display_${displayObj[0]}_${displayObj[1]}`
193
+ })
194
+ } else {
195
+ ' '
196
+ }
197
+ }
198
+ })
197
199
  return css
198
200
  },
199
201
  cursorProps: ({ cursor }: Cursor) => {
@@ -201,49 +203,78 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
201
203
  css += cursor ? `cursor_${cursor} ` : ''
202
204
  return css
203
205
  },
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
232
+ },
204
233
  alignItemsProps: ({ alignItems }: AlignItems) => {
205
- return alignItems ? `align_items_${camelToSnakeCase(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
206
239
  },
207
240
  alignContentProps: ({ alignContent }: AlignContent) => {
208
- return alignContent ? `align_content_${camelToSnakeCase(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
209
247
  },
210
248
  alignSelfProps: ({ alignSelf }: AlignSelf) => {
211
- return alignSelf ? `align_self_${alignSelf}` : ''
212
- },
213
- flexDirectionProps: ({ flexDirection }: FlexDirection) => {
214
- if (typeof flexDirection !== 'object') return
215
-
216
- const flexKeys: string[] = Object.keys(flexDirection)
217
-
218
- return flexKeys.map((key: Sizes) => {
219
- const flexDirectionValue: string = flexDirection[key]
220
- return `flex_direction_${key}_${flexDirectionValue}`
221
- }).join(" ")
222
- },
223
- flexWrapProps: ({ flexWrap }: FlexWrap) => {
224
- return flexWrap ? `flex_wrap_${flexWrap} ` : ''
249
+ let css = ''
250
+ css += alignSelf ? `align_self_${alignSelf}` : ''
251
+ return css
225
252
  },
226
253
  flexProps: ({ flex }: Flex) => {
227
- return flex ? `flex_${flex}` : ''
254
+ let css = ''
255
+ css += flex ? `flex_${flex}` : ''
256
+ return css
228
257
  },
229
258
  flexGrowProps: ({ flexGrow }: FlexGrow) => {
230
- return typeof(flexGrow) !== undefined ? `flex_grow_${flexGrow}` : ''
259
+ let css = ''
260
+ css += flexGrow ? `flex_grow_${flexGrow}` : ''
261
+ return css
231
262
  },
232
263
  flexShrinkProps: ({ flexShrink }: FlexShrink) => {
233
- return typeof(flexShrink) !== undefined ? `flex_shrink_${flexShrink}` : ''
234
- },
235
- justifyContentProps: ({ justifyContent }: JustifyContent) => {
236
- return justifyContent ? `justify_content_${camelToSnakeCase(justifyContent)}` : ''
237
- },
238
- justifySelfProps: ({ justifySelf }: JustifySelf) => {
239
- return justifySelf ? `justify_self_${justifySelf}` : ''
264
+ let css = ''
265
+ css += flexShrink ? `flex_shrink_${flexShrink}` : ''
266
+ return css
240
267
  },
241
268
  orderProps: ({ order }: Order) => {
242
- return order ? `order_${order}` : ''
269
+ let css = ''
270
+ css += order ? `order_${order}` : ''
271
+ return css
243
272
  }
244
273
  }
245
274
 
246
- export const globalProps = (props: GlobalProps, defaultProps: {[key: string]: string} | Record<string, never> = {}): string => {
275
+ type DefaultProps = {[key: string]: string} | Record<string, unknown>
276
+
277
+ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {}): string => {
247
278
  const allProps = { ...props, ...defaultProps }
248
279
  return Object.keys(PROP_CATEGORIES).map((key) => {
249
280
  return PROP_CATEGORIES[key](allProps)
@@ -0,0 +1,15 @@
1
+ import { filter, isEmpty } from 'lodash'
2
+
3
+ const titleizedWord = (string) => (
4
+ string.charAt(0).toUpperCase() + string.slice(1).toLowerCase()
5
+ )
6
+
7
+ export const titleize = (sentence) => (
8
+ isEmpty(sentence) ? sentence : sentence.split(' ').map(titleizedWord).join(' ')
9
+ )
10
+
11
+ const notEmpty = (value) => !isEmpty(value)
12
+
13
+ export const joinPresent = (array, separator) => (
14
+ filter(array, notEmpty).join(separator)
15
+ )
data/dist/reset.css CHANGED
@@ -1,61 +1,2 @@
1
- /* CLEAN UP AND REMOVE */
2
- /* Headings */
3
- /* Standard Font Weights */
4
- /* Non_Standard Font Weights */
5
- /*=====================================
6
- Base colors should not be documented.
7
- Only document color use.
8
-
9
- Colors -----------------------------*/
10
- /* Specialty Gradient -----------------*/
11
- /* Interface colors -------------------*/
12
- /* Main colors ------------------------*/
13
- /*=====================================
14
-
15
- Background colors ------------------*/
16
- /* Card colors ------------------*/
17
- /* Active colors ----------------------*/
18
- /* Hover colors -----------------------*/
19
- /* Focus colors -----------------------*/
20
- /* Border colors ----------------------*/
21
- /* Shadow colors ----------------------*/
22
- /* Text colors ------------------------*/
23
- /* Data colors ------------------------*/
24
- /* Status colors ----------------------*/
25
- /* Link colors ------------------------*/
26
- /* Product colors ---------------------*/
27
- /* Category colors ---------------------*/
28
- * {
29
- box-sizing: border-box;
30
- margin: 0;
31
- padding: 0; }
32
- *:before, *:after {
33
- box-sizing: border-box; }
34
-
35
- html {
36
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
37
- height: 100vh;
38
- overflow-x: hidden; }
39
-
40
- body {
41
- font-family: "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans_serif;
42
- font-size: 16px;
43
- line-height: 1.5;
44
- background-color: #F3F7FB;
45
- height: 100%;
46
- letter-spacing: 0;
47
- font-weight: 400;
48
- font-style: normal;
49
- text-rendering: optimizeLegibility;
50
- -moz-font-feature-settings: "liga" on;
51
- color: #242B42;
52
- margin: 0 !important;
53
- padding: 0 !important;
54
- box-sizing: border-box;
55
- min-height: 100vh;
56
- padding: 50px; }
57
-
58
- a {
59
- text-decoration: none;
60
- color: #0056CF; }
1
+ *{box-sizing:border-box;margin:0;padding:0}*:before,*:after{box-sizing:border-box}html{-webkit-tap-highlight-color:rgba(0,0,0,0);height:100vh;overflow-x:hidden}body{font-family:"Proxima Nova","Helvetica Neue",Helvetica,Arial,sans_serif;font-size:16px;line-height:1.5;background-color:#F3F7FB;height:100%;letter-spacing:0;font-weight:400;font-style:normal;text-rendering:optimizeLegibility;-moz-font-feature-settings:"liga" on;color:#242B42;margin:0 !important;padding:0 !important;box-sizing:border-box;min-height:100vh;padding:50px}a{text-decoration:none;color:#0056CF}
61
2