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,44 @@
1
+ import React from 'react'
2
+
3
+ import Currency from '../_currency'
4
+
5
+ const CurrencyAbbreviated = (props) => {
6
+ return (
7
+ <>
8
+ <Currency
9
+ abbreviate
10
+ amount="2,500"
11
+ label="Thousands (with Unit)"
12
+ marginBottom="md"
13
+ size="md"
14
+ unit="/mo"
15
+ {...props}
16
+ />
17
+ <Currency
18
+ abbreviate
19
+ amount="45300000"
20
+ label="Millions"
21
+ marginBottom="md"
22
+ size="md"
23
+ {...props}
24
+ />
25
+ <Currency
26
+ abbreviate
27
+ amount="6,700,000,000"
28
+ label="Billions"
29
+ marginBottom="md"
30
+ size="md"
31
+ {...props}
32
+ />
33
+ <Currency
34
+ abbreviate
35
+ amount="9,900,000,000,000"
36
+ label="Trillions"
37
+ size="md"
38
+ {...props}
39
+ />
40
+ </>
41
+ )
42
+ }
43
+
44
+ export default CurrencyAbbreviated
@@ -18,7 +18,7 @@
18
18
  <%= pb_rails("currency", props: {
19
19
  amount: "45",
20
20
  label: "Bold",
21
- size: "sm",
21
+ size: "lg",
22
22
  unit: "/mo",
23
23
  variant: "bold",
24
24
  }) %>
@@ -5,9 +5,11 @@ examples:
5
5
  - currency_size: Size
6
6
  - currency_alignment: Alignment
7
7
  - currency_no_symbol: No Symbol
8
+ - currency_abbreviated: Abbreviate Larger Amounts
8
9
 
9
10
  react:
10
11
  - currency_variants: Variants
11
12
  - currency_size: Size
12
13
  - currency_alignment: Alignment
13
14
  - currency_no_symbol: No Symbol
15
+ - currency_abbreviated: Abbreviate Larger Amounts
@@ -2,3 +2,4 @@ export { default as CurrencyVariants } from './_currency_variants.jsx'
2
2
  export { default as CurrencySize } from './_currency_size.jsx'
3
3
  export { default as CurrencyAlignment } from './_currency_alignment.jsx'
4
4
  export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
5
+ export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
@@ -0,0 +1,215 @@
1
+ import colors from '../tokens/exports/_colors.scss'
2
+ import typography from '../tokens/exports/_typography.scss'
3
+
4
+ import Highcharts from 'highcharts'
5
+
6
+ const highchartsDarkTheme = {
7
+ lang: {
8
+ thousandsSep: ',',
9
+ },
10
+ colors: [
11
+ colors.data_1,
12
+ colors.data_2,
13
+ colors.data_3,
14
+ colors.data_4,
15
+ colors.data_5,
16
+ colors.data_6,
17
+ colors.data_7,
18
+ ],
19
+ chart: {
20
+ borderWidth: 0,
21
+ borderRadius: 0,
22
+ plotBackgroundColor: null,
23
+ plotShadow: false,
24
+ plotBorderWidth: 0,
25
+ },
26
+ title: {
27
+ style: {
28
+ color: colors.text_dk_default,
29
+ fontFamily: typography.font_family_base,
30
+ fontWeight: typography.regular,
31
+ fontSize: typography.heading_3,
32
+ },
33
+ },
34
+ subtitle: {
35
+ style: {
36
+ fontFamily: typography.font_family_base,
37
+ color: colors.text_dk_light,
38
+ fontWeight: typography.regular,
39
+ fontSize: typography.text_base,
40
+ },
41
+ },
42
+ xAxis: {
43
+ gridLineWidth: 0,
44
+ lineColor: colors.border_dark,
45
+ tickColor: colors.border_dark,
46
+ labels: {
47
+ style: {
48
+ fontFamily: typography.font_family_base,
49
+ color: colors.text_dk_lighter,
50
+ fontWeight: typography.bold,
51
+ fontSize: typography.text_smaller,
52
+ },
53
+ },
54
+ title: {
55
+ style: {
56
+ color: colors.text_dk_default,
57
+ fontFamily: typography.font_family_base,
58
+ fontWeight: typography.regular,
59
+ fontSize: typography.heading_4,
60
+ },
61
+ },
62
+ },
63
+ yAxis: {
64
+ alternateGridColor: null,
65
+ minorTickInterval: null,
66
+ gridLineColor: colors.border_dark,
67
+ minorGridLineColor: colors.border_dark,
68
+ lineWidth: 0,
69
+ tickWidth: 0,
70
+ labels: {
71
+ style: {
72
+ fontFamily: typography.font_family_base,
73
+ color: colors.text_dk_lighter,
74
+ fontWeight: typography.bold,
75
+ fontSize: typography.text_smaller,
76
+ },
77
+ },
78
+ title: {
79
+ style: {
80
+ fontFamily: typography.font_family_base,
81
+ color: colors.text_dk_lighter,
82
+ fontWeight: typography.bold,
83
+ fontSize: typography.text_smaller,
84
+ },
85
+ },
86
+ },
87
+ legend: {
88
+ layout: 'horizontal',
89
+ align: 'center',
90
+ verticalAlign: 'bottom',
91
+ itemStyle: {
92
+ fontFamily: typography.font_family_base,
93
+ color: colors.text_dk_light,
94
+ fontWeight: typography.regular,
95
+ fontSize: typography.text_smaller,
96
+ },
97
+ itemHoverStyle: {
98
+ color: colors.text_dk_default,
99
+ },
100
+ itemHiddenStyle: {
101
+ color: colors.text_dk_lighter,
102
+ },
103
+ },
104
+ labels: {
105
+ style: {
106
+ color: colors.primary,
107
+ },
108
+ },
109
+ tooltip: {
110
+ backgroundColor: {
111
+ linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
112
+ stops: [
113
+ [0, colors.card_light],
114
+ [1, colors.card_light],
115
+ ],
116
+ },
117
+ shadow: false,
118
+ borderWidth: 0,
119
+ borderRadius: 10,
120
+ style: {
121
+ fontFamily: typography.font_family_base,
122
+ color: colors.text_lt_default,
123
+ fontWeight: typography.regular,
124
+ fontSize: typography.text_smaller,
125
+ },
126
+ },
127
+ // specific to gauge
128
+ // unfilled gauge color
129
+ pane: {
130
+ background: {
131
+ borderColor: colors.border_dark,
132
+ },
133
+ },
134
+
135
+ plotOptions: {
136
+ series: {
137
+ type: 'area',
138
+ nullColor: colors.text_dk_lighter,
139
+ fillColor: {
140
+ linearGradient: {
141
+ x1: 0,
142
+ y1: 0,
143
+ x2: 0,
144
+ y2: 1,
145
+ },
146
+ stops: [
147
+ [0, Highcharts.getOptions().colors[0]],
148
+ [1, 'white'],
149
+ ],
150
+ },
151
+ threshold: null,
152
+ },
153
+
154
+ // GAUGE STYLES
155
+ solidgauge: {
156
+ borderColor: colors.primary,
157
+ borderWidth: 20,
158
+ radius: 90,
159
+ innerRadius: '90%',
160
+ dataLabels: {
161
+ borderWidth: 0,
162
+ color: colors.text_dk_default,
163
+ enabled: true,
164
+ style: {
165
+ fontFamily: typography.font_family_base,
166
+ fontWeight: typography.regular,
167
+ fontSize: typography.heading_2,
168
+ },
169
+ y: -26,
170
+ },
171
+ },
172
+
173
+ // PIE STYLES
174
+ pie: {
175
+ colors: [
176
+ colors.data_1,
177
+ colors.data_2,
178
+ colors.data_3,
179
+ colors.data_4,
180
+ colors.data_5,
181
+ colors.data_6,
182
+ colors.data_7,
183
+ ],
184
+ dataLabels: {
185
+ style: {
186
+ fontFamily: typography.font_family_base,
187
+ fontSize: typography.text_smaller,
188
+ color: colors.text_dk_light,
189
+ fontWeight: typography.regular,
190
+ },
191
+ },
192
+ },
193
+
194
+ // LINE CHART STYLES
195
+ line: {
196
+ dataLabels: {
197
+ color: colors.text_dk_light,
198
+ },
199
+ marker: {
200
+ lineColor: colors.border_dark,
201
+ },
202
+ area: {
203
+ shadow: false,
204
+ states: {
205
+ hover: {
206
+ lineWidth: 1,
207
+ },
208
+ },
209
+ threshold: null,
210
+ },
211
+ },
212
+ },
213
+ }
214
+
215
+ export { highchartsDarkTheme }
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps.js'
6
+ import { globalProps } from '../utilities/globalProps'
7
7
 
8
8
  import Body from '../pb_body/_body'
9
9
  import StatChange from '../pb_stat_change/_stat_change'
@@ -13,12 +13,24 @@ module Playbook
13
13
  default: {}
14
14
 
15
15
  def formatted_stat_value
16
- { **stat_value, value: stat_value[:value].to_i }
16
+ { **stat_value, value: sanitized_stat_value }
17
17
  end
18
18
 
19
19
  def classname
20
20
  generate_classname("pb_dashboard_value_kit", align)
21
21
  end
22
+
23
+ # rubocop:disable Lint/FloatComparison
24
+ # Comparing the value coerced to a float versus an integer is the point of this methodd
25
+ def sanitized_stat_value
26
+ value = stat_value[:value]
27
+ if value.is_a?(::String)
28
+ value.to_f == value.to_i ? value.to_i : value.to_f
29
+ else
30
+ value
31
+ end
32
+ end
33
+ # rubocop:enable Lint/FloatComparison
22
34
  end
23
35
  end
24
36
  end
@@ -1,21 +1,28 @@
1
1
  <%= pb_rails("dashboard_value", props: {
2
2
  stat_label: "Decreased Value",
3
- stat_value: {value: 1428, unit: "appts"},
4
- stat_change: {change: "decrease", value: 26.1}
3
+ stat_value: { value: 1428, unit: "appts" },
4
+ stat_change: { change: "decrease", value: 26.1 }
5
5
  }) %>
6
6
 
7
7
  <br><br>
8
8
 
9
9
  <%= pb_rails("dashboard_value", props: {
10
10
  stat_label: "Increased Value",
11
- stat_value: {value: 938, unit: "homes"},
12
- stat_change: {change: "increase", value: 56.1}
11
+ stat_value: { value: 938, unit: "homes" },
12
+ stat_change: { change: "increase", value: 56.1 }
13
13
  }) %>
14
14
 
15
15
  <br><br>
16
16
 
17
17
  <%= pb_rails("dashboard_value", props: {
18
18
  stat_label: "Neutral Value",
19
- stat_value: {value: 261, unit: "windows"},
20
- stat_change: {value: 86}
19
+ stat_value: { value: 261, unit: "windows" },
20
+ stat_change: { value: 86 }
21
+ }) %>
22
+
23
+ <br><br>
24
+
25
+ <%= pb_rails("dashboard_value", props: {
26
+ stat_label: "Pitch Rate",
27
+ stat_value: { value: 90.9, unit: "%" }
21
28
  }) %>
@@ -31,6 +31,15 @@ const DashboardValueDefault = (props) => {
31
31
  statValue={{ value: '261', unit: 'windows' }}
32
32
  {...props}
33
33
  />
34
+
35
+ <br />
36
+ <br />
37
+
38
+ <DashboardValue
39
+ statLabel="Pitch Rate"
40
+ statValue={{ value: '90.9', unit: '%' }}
41
+ {...props}
42
+ />
34
43
  </div>
35
44
  )
36
45
  }
@@ -5,7 +5,7 @@ import classnames from 'classnames'
5
5
  import Modal from 'react-modal'
6
6
 
7
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps.js'
8
+ import { globalProps } from '../utilities/globalProps'
9
9
 
10
10
  import Button from '../pb_button/_button'
11
11
  import DialogHeader from './child_kits/_dialog_header'
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- // Dialog Animations
11
+ // Dialog Animations
12
12
 
13
13
  @keyframes modalFadeIn {
14
14
  from {
@@ -72,7 +72,7 @@
72
72
  border: 0;
73
73
  max-height: calc(100vh - #{$gutter * 2});
74
74
  max-width: calc(100vw - #{$gutter * 2});
75
- overflow: scroll;
75
+ overflow: auto;
76
76
  animation-name: modalFadeIn;
77
77
  animation-duration: $animation-duration;
78
78
  outline: none;
@@ -131,4 +131,4 @@
131
131
  opacity: $opacity_hidden;
132
132
  }
133
133
  }
134
- }
134
+ }
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildCss } from '../../utilities/props'
6
- import { globalProps } from '../../utilities/globalProps.js'
6
+ import { globalProps } from '../../utilities/globalProps'
7
7
 
8
8
  // Body component
9
9
  const DialogBody = (props: DialogBodyProps) => {
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
6
  import { buildCss } from '../../utilities/props'
7
- import { globalProps } from '../../utilities/globalProps.js'
7
+ import { globalProps } from '../../utilities/globalProps'
8
8
 
9
9
  import Flex from '../../pb_flex/_flex'
10
10
  import SectionSeparator from '../../pb_section_separator/_section_separator'
@@ -3,7 +3,7 @@
3
3
  import React, { useContext } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
6
- import { globalProps } from '../../utilities/globalProps.js'
6
+ import { globalProps } from '../../utilities/globalProps'
7
7
 
8
8
  import { CloseIcon } from '../_close_icon'
9
9
  import { DialogContext } from '../_dialog_context'
@@ -1,2 +1,2 @@
1
- When shouldCloseOnOverlayClick is explicitly set to `false`, click events on the overlay will not close the modal.
2
- By default, shouldCloseOnOverlayClick is set to true.
1
+ When `shouldCloseOnOverlayClick` is explicitly set to `false`, click events on the overlay will not close the modal.
2
+ By default, `shouldCloseOnOverlayClick` is set to true.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { globalProps } from '../utilities/globalProps.js'
5
+ import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  type DistributionBarProps = {
8
8
  className?: string,
@@ -4,7 +4,7 @@ import React, { useCallback } from 'react'
4
4
  import { useDropzone } from 'react-dropzone'
5
5
  import classnames from 'classnames'
6
6
 
7
- import { buildCss, noop } from '../utilities/props'
7
+ import { buildCss, buildDataProps, noop } from '../utilities/props'
8
8
  import { globalProps } from '../utilities/globalProps'
9
9
  import type { Callback } from '../types'
10
10
 
@@ -14,15 +14,17 @@ import Card from '../pb_card/_card'
14
14
  type FileUploadProps = {
15
15
  accept?: array<string>,
16
16
  className?: string,
17
+ data?: object,
17
18
  acceptedFilesDescription?: string,
18
19
  onFilesAccepted: Callback,
19
20
  }
20
21
 
21
22
  const FileUpload = (props: FileUploadProps) => {
22
23
  const {
23
- accept = ['*'],
24
+ accept = null,
24
25
  acceptedFilesDescription = '',
25
26
  className,
27
+ data = {},
26
28
  onFilesAccepted = noop,
27
29
  } = props
28
30
  const onDrop = useCallback((files) => {
@@ -34,17 +36,22 @@ const FileUpload = (props: FileUploadProps) => {
34
36
  onDrop,
35
37
  })
36
38
 
37
- const acceptedFileTypes = accept.map((fileType) => {
38
- if (fileType.startsWith('image/')) {
39
- return fileType.replace('image/', ' ')
40
- } else {
41
- return fileType
42
- }
43
- })
39
+ const acceptedFileTypes = () => {
40
+ return accept.map((fileType) => {
41
+ if (fileType.startsWith('image/')) {
42
+ return fileType.replace('image/', ' ')
43
+ } else {
44
+ return fileType
45
+ }
46
+ })
47
+ }
48
+
49
+ const dataProps = buildDataProps(data)
44
50
 
45
51
  return (
46
52
  <div
47
53
  className={classnames(buildCss('pb_file_upload_kit'), globalProps(props), className)}
54
+ {...dataProps}
48
55
  {...getRootProps()}
49
56
  >
50
57
  <Card>
@@ -53,7 +60,7 @@ const FileUpload = (props: FileUploadProps) => {
53
60
  <If condition={isDragActive}>
54
61
  <p>{'Drop the files here ...'}</p>
55
62
  <Else />
56
- <p>{`Choose a file or drag it here. The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes}`}</p>
63
+ <p>{accept === null ? 'Choose a file or drag it here' : `Choose a file or drag it here. The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}`}</p>
57
64
  </If>
58
65
  </Body>
59
66
  </Card>
@@ -0,0 +1,40 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import FileUpload from './_file_upload'
5
+
6
+ const testid = 'fileupload-test'
7
+
8
+ test('returns namespaced class name', () => {
9
+ render(
10
+ <FileUpload
11
+ data={{ testid: testid }}
12
+ />
13
+ )
14
+
15
+ const kit = screen.getByTestId(testid)
16
+ expect(kit).toHaveClass('pb_file_upload_kit')
17
+ })
18
+
19
+ test('shows default drag text', () => {
20
+ render(
21
+ <FileUpload
22
+ data={{ testid: testid }}
23
+ />
24
+ )
25
+
26
+ const kit = screen.getByTestId(testid)
27
+ expect(kit).toHaveTextContent('Choose a file or drag it here')
28
+ })
29
+
30
+ test('shows type-specific drag text', () => {
31
+ render(
32
+ <FileUpload
33
+ accept={['image/svg+xml']}
34
+ data={{ testid: testid }}
35
+ />
36
+ )
37
+
38
+ const kit = screen.getByTestId(testid)
39
+ expect(kit).toHaveTextContent('Choose a file or drag it here. The accepted file types are: svg+xml')
40
+ })
@@ -3,7 +3,7 @@
3
3
  import React, { Node } from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import { globalProps } from '../../utilities/globalProps.js'
6
+ import { globalProps } from '../../utilities/globalProps'
7
7
 
8
8
  import Card from '../../pb_card/_card'
9
9
 
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps.js'
6
+ import { globalProps } from '../utilities/globalProps'
7
7
  type FlexProps = {
8
8
  children: array<React.ReactNode> | React.ReactNode,
9
9
  className?: string,
@@ -2,7 +2,7 @@
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
4
  import { buildCss } from '../utilities/props'
5
- import { globalProps } from '../utilities/globalProps.js'
5
+ import { globalProps } from '../utilities/globalProps'
6
6
  type FlexItemPropTypes = {
7
7
  children: array<React.ReactNode> | React.ReactNode,
8
8
  fixedSize: string,
@@ -7,7 +7,7 @@ const FlexAlign = (props) => {
7
7
 
8
8
  <Title
9
9
  size={4}
10
- text="Row"
10
+ text="row"
11
11
  {...props}
12
12
  />
13
13
  <br />
@@ -8,17 +8,11 @@ module Playbook
8
8
  default: false
9
9
  prop :shrink, type: Playbook::Props::Boolean,
10
10
  default: false
11
- prop :flex, type: Playbook::Props::Enum,
12
- values: %w[0 1 2 3 4 5 6 7 8 9 10 11 12 none],
13
- default: "none"
11
+
14
12
  prop :overflow, type: Playbook::Props::Enum,
15
13
  values: %w[auto hidden inherit initial scroll visible] + [nil],
16
14
  default: nil
17
15
 
18
- prop :order, type: Playbook::Props::Enum,
19
- values: %w[1 2 3 4 5 6 7 8 9 10 11 12 first none],
20
- default: "none"
21
-
22
16
  prop :align_self, type: Playbook::Props::Enum,
23
17
  values: %w[start center end stretch] + [nil],
24
18
  default: nil
@@ -27,7 +21,7 @@ module Playbook
27
21
  default: false
28
22
 
29
23
  def classname
30
- generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, flex_class, display_flex_class) + overflow_class + order_class + align_self_class
24
+ generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + overflow_class + align_self_class
31
25
  end
32
26
 
33
27
  def style_value
@@ -59,22 +53,6 @@ module Playbook
59
53
  def shrink_class
60
54
  shrink ? "shrink" : nil
61
55
  end
62
-
63
- def flex_class
64
- if flex == "none"
65
- nil
66
- else
67
- "flex_#{flex}"
68
- end
69
- end
70
-
71
- def order_class
72
- if order == "none"
73
- ""
74
- else
75
- "order_#{order}"
76
- end
77
- end
78
56
  end
79
57
  end
80
58
  end
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps.js'
6
+ import { globalProps } from '../utilities/globalProps'
7
7
 
8
8
  type FormGroupProps = {
9
9
  aria?: object,
@@ -41,6 +41,7 @@
41
41
  border-bottom-right-radius: 0;
42
42
  border-top-right-radius: 0;
43
43
  min-height: 45px;
44
+ margin-bottom: 16px;
44
45
  }
45
46
 
46
47
  & > [class^=pb_button_kit]:not(:first-child) {
@@ -48,6 +49,7 @@
48
49
  border-top-left-radius: 0;
49
50
  border-left-width: 0;
50
51
  min-height: 45px;
52
+ margin-bottom: 16px;
51
53
  }
52
54
 
53
55
  & > [class^=pb_date_picker_kit]:not(:last-child) {