playbook_ui 10.23.0.pre.cachetest → 10.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/index.js +0 -3
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  5. data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +13 -14
  6. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  7. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_background/_background.jsx +18 -4
  10. data/app/pb_kits/playbook/pb_background/_background.scss +23 -7
  11. data/app/pb_kits/playbook/pb_background/background.html.erb +5 -2
  12. data/app/pb_kits/playbook/pb_background/background.rb +33 -6
  13. data/app/pb_kits/playbook/pb_background/background.test.js +17 -0
  14. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
  15. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
  16. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
  17. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_background/docs/_background_size.html.erb +5 -0
  19. data/app/pb_kits/playbook/pb_background/docs/_background_size.jsx +36 -0
  20. data/app/pb_kits/playbook/pb_background/docs/_background_size.md +3 -0
  21. data/app/pb_kits/playbook/pb_background/docs/_description.md +3 -1
  22. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  24. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
  25. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
  26. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +2 -2
  27. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_button/_button.jsx +8 -4
  29. data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
  30. data/app/pb_kits/playbook/pb_button/button.rb +13 -3
  31. data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
  32. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  33. data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
  34. data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
  35. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
  36. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
  37. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
  38. data/app/pb_kits/playbook/pb_button/docs/example.yml +4 -0
  39. data/app/pb_kits/playbook/pb_button/docs/index.js +2 -0
  40. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
  41. data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
  42. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
  43. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  44. data/app/pb_kits/playbook/pb_card/card.rb +88 -0
  45. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  46. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  48. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
  49. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
  53. data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
  54. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  55. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
  56. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
  57. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  58. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  59. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  60. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
  61. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
  62. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +13 -1
  63. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.html.erb +13 -6
  64. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +9 -0
  65. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +3 -3
  67. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
  68. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
  69. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
  70. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md +2 -2
  71. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
  73. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
  74. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
  75. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  76. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  78. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
  79. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
  80. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
  81. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  82. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
  83. data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
  84. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  85. data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
  86. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  87. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
  88. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  89. data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
  90. data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
  91. data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
  92. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  93. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  94. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
  95. data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
  96. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
  97. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
  98. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
  99. data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
  100. data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
  101. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
  102. data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
  103. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -2
  104. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  105. data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
  106. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  107. data/app/pb_kits/playbook/pb_popover/index.js +4 -9
  108. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  109. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
  110. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  111. data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
  112. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
  113. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  114. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
  115. data/app/pb_kits/playbook/pb_select/_select.jsx +2 -2
  116. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb +2 -0
  117. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +1 -1
  118. data/app/pb_kits/playbook/pb_stat_value/stat_value.rb +2 -2
  119. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  120. data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
  121. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +24 -19
  122. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  123. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
  124. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
  125. data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
  126. data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
  127. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  128. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  129. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  130. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
  131. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
  132. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
  133. data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
  134. data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
  135. data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
  136. data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
  137. data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
  138. data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
  139. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
  140. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
  141. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
  142. data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
  143. data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
  144. data/app/pb_kits/playbook/utilities/_order.scss +55 -0
  145. data/app/pb_kits/playbook/utilities/globalProps.ts +297 -0
  146. data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
  147. data/lib/playbook/align_content.rb +29 -0
  148. data/lib/playbook/align_items.rb +29 -0
  149. data/lib/playbook/align_self.rb +29 -0
  150. data/lib/playbook/classnames.rb +11 -0
  151. data/lib/playbook/flex.rb +29 -0
  152. data/lib/playbook/flex_direction.rb +29 -0
  153. data/lib/playbook/flex_grow.rb +29 -0
  154. data/lib/playbook/flex_shrink.rb +29 -0
  155. data/lib/playbook/flex_wrap.rb +29 -0
  156. data/lib/playbook/justify_content.rb +29 -0
  157. data/lib/playbook/justify_self.rb +29 -0
  158. data/lib/playbook/kit_base.rb +22 -0
  159. data/lib/playbook/order.rb +29 -0
  160. data/lib/playbook/version.rb +2 -2
  161. metadata +47 -11
  162. data/app/pb_kits/playbook/types.js +0 -4
  163. data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
@@ -0,0 +1,29 @@
1
+ .align_self_start {
2
+ display: flex;
3
+ align-self: start !important;
4
+ }
5
+
6
+ .align_self_end {
7
+ display: flex;
8
+ align-self: end !important;
9
+ }
10
+
11
+ .align_self_auto {
12
+ display: flex;
13
+ align-self: auto !important;
14
+ }
15
+
16
+ .align_self_center {
17
+ display: flex;
18
+ align-self: center !important;
19
+ }
20
+
21
+ .align_self_stretch {
22
+ display: flex;
23
+ align-self: stretch !important;
24
+ }
25
+
26
+ .align_self_baseline {
27
+ display: flex;
28
+ align-self: baseline !important;
29
+ }
@@ -0,0 +1,15 @@
1
+ .flex_auto {
2
+ flex: auto !important;
3
+ }
4
+
5
+ .flex_initial {
6
+ flex: initial !important;
7
+ }
8
+
9
+ .flex_none {
10
+ flex: none !important;
11
+ }
12
+
13
+ .flex_1 {
14
+ flex: 1 !important;
15
+ }
@@ -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,9 @@
1
+ .flex_grow_1 {
2
+ display: flex;
3
+ flex-grow: 1 !important;
4
+ }
5
+
6
+ .flex_grow_0 {
7
+ display: flex;
8
+ flex-grow: 0 !important;
9
+ }
@@ -0,0 +1,9 @@
1
+ .flex_shrink_1 {
2
+ display: flex;
3
+ flex-shrink: 1 !important;
4
+ }
5
+
6
+ .flex_shrink_0 {
7
+ display: flex;
8
+ flex-shrink: 0 !important;
9
+ }
@@ -0,0 +1,14 @@
1
+ .flex_wrap_wrap {
2
+ display: flex;
3
+ flex-wrap: wrap !important;
4
+ }
5
+
6
+ .flex_wrap_nowrap {
7
+ display: flex;
8
+ flex-wrap: nowrap !important;
9
+ }
10
+
11
+ .flex_wrap_wrap_reverse {
12
+ display: flex;
13
+ flex-wrap: wrap-reverse !important;
14
+ }
@@ -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
+ }
@@ -0,0 +1,297 @@
1
+ import { omit } from 'lodash'
2
+
3
+ type Sizes = "xs" | "sm" | "md" | "lg" | "xl"
4
+ type None = "none"
5
+
6
+ type AllSizes = None & Sizes
7
+
8
+ type Margin = {
9
+ marginRight?: AllSizes,
10
+ marginLeft?: AllSizes,
11
+ marginTop?: AllSizes,
12
+ marginBottom?: AllSizes,
13
+ marginX?: AllSizes,
14
+ marginY?: AllSizes,
15
+ margin?: AllSizes,
16
+ }
17
+
18
+ type Padding = {
19
+ paddingRight?: AllSizes,
20
+ paddingLeft?: AllSizes,
21
+ paddingTop?: AllSizes,
22
+ paddingBottom?: AllSizes,
23
+ paddingX?: AllSizes,
24
+ paddingY?: AllSizes,
25
+ padding?: AllSizes,
26
+ }
27
+
28
+ type Dark = {
29
+ dark?: boolean,
30
+ }
31
+
32
+ type NumberSpacing = {
33
+ numberSpacing?: "tabular",
34
+ }
35
+
36
+ type MaxWidth = {
37
+ maxWidth?: Sizes,
38
+ }
39
+
40
+ type ZIndex = {
41
+ zIndex?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
42
+ }
43
+
44
+ type Shadow = {
45
+ shadow?: "none" | "deep" | "deeper" | "deepest",
46
+ }
47
+
48
+ type LineHeight = {
49
+ lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
50
+ }
51
+
52
+ type Display = {
53
+ display?: "block" | "flex" | "hidden" | "inline_block" | "inline" | "inline_flex",
54
+ }
55
+
56
+ type Cursor = {
57
+ cursor?: "pointer",
58
+ }
59
+
60
+ type BorderRadius = {
61
+ borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
62
+ }
63
+
64
+ type Flex = {
65
+ flex?: "none" | "initial" | "auto" | 1
66
+ }
67
+
68
+ type FlexDirection = {
69
+ flexDirection?: "row" | "column" | "rowReverse" | "columnReverse"
70
+ }
71
+
72
+ type FlexGrow = {
73
+ flexGrow?: 0 | 1
74
+ }
75
+
76
+ type FlexShrink = {
77
+ flexShrink?: 0 | 1
78
+ }
79
+
80
+ type FlexWrap = {
81
+ flexWrap?: "wrap" | "nowrap" | "wrapReverse"
82
+ }
83
+
84
+ type Alignment = "start" | "end" | "center"
85
+
86
+ type Space = "spaceBetween" | "spaceAround" | "spaceEvenly"
87
+
88
+ type JustifyContent = {
89
+ justifyContent?: Alignment & Space
90
+ }
91
+
92
+ type JustifySelf = {
93
+ justifySelf?: Alignment & ("auto" | "stretch")
94
+ }
95
+
96
+ type AlignContent = {
97
+ alignContent?: Alignment & Space
98
+ }
99
+
100
+ type AlignItems = {
101
+ alignItems?: Alignment & ("flexStart" | "flexEnd" | "stretch" | "baseline")
102
+ }
103
+
104
+ type AlignSelf = {
105
+ alignSelf?: Alignment & ("auto" | "stretch" | "baseline")
106
+ }
107
+
108
+ type Order = {
109
+ order?: "none" | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
110
+ }
111
+
112
+ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
113
+ BorderRadius & Cursor & Dark & Display & Flex & FlexDirection &
114
+ FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
115
+ LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
116
+ Shadow & ZIndex
117
+
118
+ // Prop categories
119
+ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
120
+ spacingProps: ({
121
+ marginRight,
122
+ marginLeft,
123
+ marginTop,
124
+ marginBottom,
125
+ marginX,
126
+ marginY,
127
+ margin,
128
+ paddingRight,
129
+ paddingLeft,
130
+ paddingTop,
131
+ paddingBottom,
132
+ paddingX,
133
+ paddingY,
134
+ padding,
135
+ }: Margin & Padding) => {
136
+ let css = ''
137
+ css += marginRight ? `mr_${marginRight} ` : ''
138
+ css += marginLeft ? `ml_${marginLeft} ` : ''
139
+ css += marginTop ? `mt_${marginTop} ` : ''
140
+ css += marginBottom ? `mb_${marginBottom} ` : ''
141
+ css += marginX ? `mx_${marginX} ` : ''
142
+ css += marginY ? `my_${marginY} ` : ''
143
+ css += margin ? `m_${margin} ` : ''
144
+ css += paddingRight ? `pr_${paddingRight} ` : ''
145
+ css += paddingLeft ? `pl_${paddingLeft} ` : ''
146
+ css += paddingTop ? `pt_${paddingTop} ` : ''
147
+ css += paddingBottom ? `pb_${paddingBottom} ` : ''
148
+ css += paddingX ? `px_${paddingX} ` : ''
149
+ css += paddingY ? `py_${paddingY} ` : ''
150
+ css += padding ? `p_${padding} ` : ''
151
+ return css
152
+ },
153
+ darkProps: ({ dark }: Dark) => {
154
+ let css = ''
155
+ css += dark ? 'dark' : ''
156
+ return css
157
+ },
158
+ numberSpacingProps: ({ numberSpacing }: NumberSpacing) => {
159
+ let css = ''
160
+ css += numberSpacing ? `ns_${numberSpacing} ` : ''
161
+ return css
162
+ },
163
+ maxWidthProps: ({ maxWidth }: MaxWidth) => {
164
+ let css = ''
165
+ css += maxWidth ? `max_width_${maxWidth } ` : ''
166
+ return css
167
+ },
168
+ zIndexProps: ({ zIndex }: ZIndex) => {
169
+ let css = ''
170
+ css += zIndex ? `z_index_${zIndex } ` : ''
171
+ return css
172
+ },
173
+ shadowProps: ({ shadow }: Shadow) => {
174
+ let css = ''
175
+ css += shadow ? `shadow_${shadow} ` : ''
176
+ return css
177
+ },
178
+ lineHeightProps: ({ lineHeight }: LineHeight) => {
179
+ let css = ''
180
+ css += lineHeight ? `line_height_${lineHeight} ` : ''
181
+ return css
182
+ },
183
+ displayProps: ({ display }: Display) => {
184
+ let css = ''
185
+ css += display ? `display_${display} ` : ''
186
+ return css
187
+ },
188
+ cursorProps: ({ cursor }: Cursor) => {
189
+ let css = ''
190
+ css += cursor ? `cursor_${cursor} ` : ''
191
+ return css
192
+ },
193
+ flexDirectionProps: ({ flexDirection }: FlexDirection) => {
194
+ let css = ''
195
+ css += flexDirection == 'columnReverse' ? 'flex_direction_column_reverse' :
196
+ flexDirection == 'rowReverse' ? 'flex_direction_row_reverse' :
197
+ flexDirection ? `flex_direction_${flexDirection} ` : ''
198
+ return css
199
+ },
200
+ flexWrapProps: ({ flexWrap }: FlexWrap) => {
201
+ let css = ''
202
+ css += flexWrap == 'wrapReverse' ? 'flex_wrap_reverse' :
203
+ flexWrap == 'nowrap' ? 'flex_nowrap' :
204
+ flexWrap ? `flex_wrap_${flexWrap} ` : ''
205
+ return css
206
+ },
207
+ justifyContentProps: ({ justifyContent }: JustifyContent) => {
208
+ let css = ''
209
+ css += justifyContent == 'spaceBetween' ? 'justify_content_space_between' :
210
+ justifyContent == 'spaceEvenly' ? 'justify_content_space_evenly' :
211
+ justifyContent == 'spaceAround' ? 'justify_content_space_around' :
212
+ justifyContent ? `justify_content_${justifyContent}` : ''
213
+ return css
214
+ },
215
+ justifySelfProps: ({ justifySelf }: JustifySelf) => {
216
+ let css = ''
217
+ css += justifySelf ? `justify_self_${justifySelf}` : ''
218
+ return css
219
+ },
220
+ alignItemsProps: ({ alignItems }: AlignItems) => {
221
+ let css = ''
222
+ css += alignItems == 'flexStart' ? 'align_items_flex_start' :
223
+ alignItems == 'flexEnd' ? 'align_items_flex_end' :
224
+ alignItems ? `align_items_${alignItems}` : ''
225
+ return css
226
+ },
227
+ alignContentProps: ({ alignContent }: AlignContent) => {
228
+ let css = ''
229
+ css += alignContent == 'spaceBetween' ? 'align_content_space_between' :
230
+ alignContent == 'spaceEvenly' ? 'align_content_space_evenly' :
231
+ alignContent == 'spaceAround' ? 'align_content_space_around' :
232
+ alignContent ? `align_content_${alignContent}` : ''
233
+ return css
234
+ },
235
+ alignSelfProps: ({ alignSelf }: AlignSelf) => {
236
+ let css = ''
237
+ css += alignSelf ? `align_self_${alignSelf}` : ''
238
+ return css
239
+ },
240
+ flexProps: ({ flex }: Flex) => {
241
+ let css = ''
242
+ css += flex ? `flex_${flex}` : ''
243
+ return css
244
+ },
245
+ flexGrowProps: ({ flexGrow }: FlexGrow) => {
246
+ let css = ''
247
+ css += flexGrow ? `flex_grow_${flexGrow}` : ''
248
+ return css
249
+ },
250
+ flexShrinkProps: ({ flexShrink }: FlexShrink) => {
251
+ let css = ''
252
+ css += flexShrink ? `flex_shrink_${flexShrink}` : ''
253
+ return css
254
+ },
255
+ orderProps: ({ order }: Order) => {
256
+ let css = ''
257
+ css += order ? `order_${order}` : ''
258
+ return css
259
+ }
260
+ }
261
+
262
+ export const globalProps = (props: GlobalProps, defaultProps: {[key: string]: string} | {} = {}): string => {
263
+ const allProps = { ...props, ...defaultProps }
264
+ return Object.keys(PROP_CATEGORIES).map((key) => {
265
+ return PROP_CATEGORIES[key](allProps)
266
+ }).filter((value) => value?.length > 0).join(" ")
267
+ }
268
+
269
+ export const deprecatedProps = (kit: string, props: string[] = []): void => {
270
+ if (process.env.NODE_ENV === 'development') {
271
+ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */
272
+ props.forEach((prop) => {
273
+ console.warn(`${kit} Kit: The prop '${prop}' is deprecated and will be removed in a future release!`)
274
+ })
275
+ }
276
+ }
277
+
278
+ export const domSafeProps = (props: {[key: string]: string}): {[key: string]: string} => {
279
+ const notSafeProps = [
280
+ 'marginRight',
281
+ 'marginLeft',
282
+ 'marginTop',
283
+ 'marginBottom',
284
+ 'marginX',
285
+ 'marginY',
286
+ 'margin',
287
+ 'paddingRight',
288
+ 'paddingLeft',
289
+ 'paddingTop',
290
+ 'paddingBottom',
291
+ 'paddingX',
292
+ 'paddingY',
293
+ 'padding',
294
+ 'dark',
295
+ ]
296
+ return omit(props, notSafeProps)
297
+ }
@@ -10,10 +10,11 @@ import classnames from 'classnames'
10
10
  * @param {Object} data the object containing the data to derive the props from.
11
11
  * @returns {Object} an object whose keys have the prefix added to them.
12
12
  */
13
- const buildPrefixedProps = (prefix, data) => Object.keys(data).reduce((props, key) => {
14
- props[`${prefix}-${key}`] = data[key]
15
- return props
16
- }, {})
13
+ const buildPrefixedProps = (prefix: string, data: {[key: string]: any}) =>
14
+ Object.keys(data).reduce((props: {[key: string]: any}, key: string) => {
15
+ props[`${prefix}-${key}`] = data[key]
16
+ return props
17
+ }, {})
17
18
 
18
19
  /**
19
20
  * Represent a "No-Operation" function that can be used as a sensible
@@ -29,7 +30,8 @@ export const noop = () => {}
29
30
  * @param {Object} aria the object containing the aria prop values.
30
31
  * @returns {Object} an object holding the HTML valid aria props and their values.
31
32
  */
32
- export const buildAriaProps = (aria) => buildPrefixedProps('aria', aria)
33
+ export const buildAriaProps = (aria: {[key: string]: string}): {[key: string]: string} =>
34
+ buildPrefixedProps('aria', aria)
33
35
 
34
36
  /**
35
37
  * Maps a given data object into HTML valid data attribtues and their values.
@@ -37,7 +39,7 @@ export const buildAriaProps = (aria) => buildPrefixedProps('aria', aria)
37
39
  * @param {Object} data the object containing the data prop values.
38
40
  * @returns {Object} an object holding the HTML valid data props and their values.
39
41
  */
40
- export const buildDataProps = (data) => buildPrefixedProps('data', data)
42
+ export const buildDataProps = (data: {[key: string]: any}) => buildPrefixedProps('data', data)
41
43
 
42
44
  /**
43
45
  * Builds a Playbook valid root className off of the incoming css rules.
@@ -45,5 +47,5 @@ export const buildDataProps = (data) => buildPrefixedProps('data', data)
45
47
  * @param {Object} rules a 'classnames' compliant rules object, used to derive the root className.
46
48
  * @returns {String} the derived root className value.
47
49
  */
48
- export const buildCss = (...rules) => classnames(rules).replace(/\s/g, '_')
50
+ export const buildCss = (...rules: string[]) => classnames(rules).replace(/\s/g, '_')
49
51
 
@@ -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
@@ -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