playbook_ui 10.21.0.pre.alpha.na1 → 10.21.1.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +12 -13
  4. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
  5. data/app/pb_kits/playbook/pb_background/_background.jsx +8 -3
  6. data/app/pb_kits/playbook/pb_background/_background.scss +24 -8
  7. data/app/pb_kits/playbook/pb_background/background.rb +6 -6
  8. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
  9. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
  10. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
  11. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
  12. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
  13. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +1 -1
  14. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
  15. data/app/pb_kits/playbook/pb_button/_button.jsx +5 -4
  16. data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
  17. data/app/pb_kits/playbook/pb_button/button.rb +11 -3
  18. data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
  19. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
  20. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
  21. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
  22. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
  24. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
  25. data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
  26. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
  27. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  28. data/app/pb_kits/playbook/pb_card/card.rb +88 -0
  29. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  30. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
  31. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  32. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
  33. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
  34. data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
  35. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
  36. data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
  37. data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
  38. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  39. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
  40. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
  41. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  43. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  44. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
  45. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
  46. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
  49. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
  52. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
  53. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
  54. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  55. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  56. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  57. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
  58. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
  60. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  61. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
  62. data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
  63. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  64. data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
  65. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  66. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
  67. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  68. data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
  69. data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
  70. data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
  71. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  72. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  73. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
  74. data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
  75. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
  76. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
  77. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
  78. data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
  79. data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
  80. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
  81. data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
  82. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -1
  83. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  84. data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
  85. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  86. data/app/pb_kits/playbook/pb_popover/index.js +4 -9
  87. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  88. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
  89. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  90. data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
  91. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
  92. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  93. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
  94. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  95. data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
  96. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +4 -1
  97. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  98. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
  99. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
  100. data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
  101. data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
  102. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  103. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  104. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  105. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
  106. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
  107. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
  108. data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
  109. data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
  110. data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
  111. data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
  112. data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
  113. data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
  114. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
  115. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
  116. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
  117. data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
  118. data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
  119. data/app/pb_kits/playbook/utilities/_order.scss +55 -0
  120. data/app/pb_kits/playbook/utilities/globalProps.ts +274 -0
  121. data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
  122. data/lib/playbook/align_content.rb +29 -0
  123. data/lib/playbook/align_items.rb +29 -0
  124. data/lib/playbook/align_self.rb +29 -0
  125. data/lib/playbook/classnames.rb +11 -0
  126. data/lib/playbook/flex.rb +29 -0
  127. data/lib/playbook/flex_direction.rb +29 -0
  128. data/lib/playbook/flex_grow.rb +29 -0
  129. data/lib/playbook/flex_shrink.rb +29 -0
  130. data/lib/playbook/flex_wrap.rb +29 -0
  131. data/lib/playbook/justify_content.rb +29 -0
  132. data/lib/playbook/justify_self.rb +29 -0
  133. data/lib/playbook/kit_base.rb +22 -0
  134. data/lib/playbook/order.rb +29 -0
  135. data/lib/playbook/version.rb +2 -2
  136. metadata +40 -9
  137. data/app/pb_kits/playbook/types.js +0 -4
  138. data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import { get } from 'lodash'
5
5
  import classnames from 'classnames'
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps.js'
7
+ import { globalProps } from '../utilities/globalProps'
8
8
 
9
9
  type CardPropTypes = {
10
10
  aria?: object,
@@ -4,7 +4,7 @@
4
4
  class: object.classname,
5
5
  aria: object.aria,
6
6
  dark: object.dark) do %>
7
- <%= pb_rails("card/card_body", props: { padding: object.body_padding }) do %>
7
+ <%= pb_rails("card/card_body", props: { padding: object.body_padding, flex_direction: object.body_flex_direction, flex_wrap: object.body_flex_wrap, justify_content: object.body_justify_content, justify_self: object.body_justify_self, align_items: object.body_align_items, align_content: object.body_align_content, align_self: object.body_align_self, flex: object.body_flex, flex_grow: object.body_flex_grow, flex_shrink: object.body_flex_shrink, order: object.body_order }) do %>
8
8
  <%= content %>
9
9
  <% end if content.present? %>
10
10
  <% end %>
@@ -36,6 +36,94 @@ module Playbook
36
36
  end
37
37
  end
38
38
 
39
+ def body_flex_direction
40
+ if flex_direction.present?
41
+ "flex_direction_#{flex_direction}"
42
+ else
43
+ ""
44
+ end
45
+ end
46
+
47
+ def body_flex_wrap
48
+ if flex_wrap.present?
49
+ "flex_wrap_#{flex_wrap}"
50
+ else
51
+ ""
52
+ end
53
+ end
54
+
55
+ def body_justify_content
56
+ if justify_content.present?
57
+ "justify_content_#{justify_content}"
58
+ else
59
+ ""
60
+ end
61
+ end
62
+
63
+ def body_justify_self
64
+ if justify_self.present?
65
+ "justify_self_#{justify_self}"
66
+ else
67
+ ""
68
+ end
69
+ end
70
+
71
+ def body_align_items
72
+ if align_items.present?
73
+ "align_items_#{align_items}"
74
+ else
75
+ ""
76
+ end
77
+ end
78
+
79
+ def body_align_content
80
+ if align_content.present?
81
+ "align_content_#{align_content}"
82
+ else
83
+ ""
84
+ end
85
+ end
86
+
87
+ def body_align_self
88
+ if align_self.present?
89
+ "align_self_#{align_self}"
90
+ else
91
+ ""
92
+ end
93
+ end
94
+
95
+ def body_flex
96
+ if flex.present?
97
+ "flex_#{flex}"
98
+ else
99
+ ""
100
+ end
101
+ end
102
+
103
+ def body_flex_grow
104
+ if flex_grow.present?
105
+ "flex_grow_#{flex_grow}"
106
+ else
107
+ ""
108
+ end
109
+ end
110
+
111
+ def body_flex_shrink
112
+ if flex_shrink.present?
113
+ "flex_shrink_#{flex_shrink}"
114
+ else
115
+ ""
116
+ end
117
+ end
118
+
119
+ def body_order
120
+ if order.present?
121
+ "order_#{order}"
122
+ else
123
+ ""
124
+ end
125
+ end
126
+
39
127
  private
40
128
 
41
129
  def selected_class
@@ -4,7 +4,7 @@ module Playbook
4
4
  module PbCard
5
5
  class CardBody < Playbook::KitBase
6
6
  def classname
7
- generate_classname("pb_card_body_kit", padding, separator: " ")
7
+ generate_classname("pb_card_body_kit", padding, flex_direction, justify_content, flex_wrap, justify_self, align_items, align_content, align_self, flex, flex_grow, flex_shrink, order, separator: " ")
8
8
  end
9
9
  end
10
10
  end
@@ -5,7 +5,7 @@ import Body from '../pb_body/_body.jsx'
5
5
  import Icon from '../pb_icon/_icon.jsx'
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
7
  import classnames from 'classnames'
8
- import { globalProps } from '../utilities/globalProps.js'
8
+ import { globalProps } from '../utilities/globalProps'
9
9
 
10
10
  type CheckboxProps = {
11
11
  aria?: object,
@@ -14,6 +14,7 @@ type CircleChartProps = {
14
14
  children: Node,
15
15
  className?: string,
16
16
  colors: array,
17
+ dark?: Boolean,
17
18
  data?: Object,
18
19
  dataLabelHtml: string,
19
20
  dataLabels: boolean,
@@ -40,6 +41,7 @@ const CircleChart = (props: CircleChartProps) => {
40
41
  children,
41
42
  className,
42
43
  colors = [],
44
+ dark = false,
43
45
  data = {},
44
46
  dataLabelHtml = '<div>{point.name}</div>',
45
47
  dataLabels = false,
@@ -81,6 +83,7 @@ const CircleChart = (props: CircleChartProps) => {
81
83
  borderColor: roundedBorderColor,
82
84
  borderWidth: roundedBorderWidth,
83
85
  chartData: formattedChartData,
86
+ dark,
84
87
  title,
85
88
  type: style,
86
89
  showInLegend: legend,
@@ -69,6 +69,7 @@ module Playbook
69
69
  borderColor: rounded_border_color,
70
70
  borderWidth: rounded_border_width,
71
71
  chartData: chart_data_formatted,
72
+ dark: dark ? "dark" : "",
72
73
  title: title,
73
74
  height: height,
74
75
  type: chart_type,
@@ -7,7 +7,7 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
7
  import type { Callback } from '../types'
8
8
 
9
9
  import { noop } from '../utilities/props'
10
- import { globalProps } from '../utilities/globalProps.js'
10
+ import { globalProps } from '../utilities/globalProps'
11
11
 
12
12
  import Button from '../pb_button/_button'
13
13
  import Icon from '../pb_icon/_icon'
@@ -4,7 +4,7 @@ import React, { useState } from 'react'
4
4
 
5
5
  import classnames from 'classnames'
6
6
 
7
- import { globalProps } from '../utilities/globalProps.js'
7
+ import { globalProps } from '../utilities/globalProps'
8
8
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
9
9
 
10
10
  import CollapsibleContent from './child_kits/CollapsibleContent'
@@ -4,7 +4,7 @@ import classnames from 'classnames'
4
4
  import React, { useContext } from 'react'
5
5
  import AnimateHeight from 'react-animate-height'
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 CollapsibleContext from '../context'
10
10
 
@@ -3,7 +3,7 @@
3
3
  import React 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
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
8
 
9
9
  import Body from '../pb_body/_body'
@@ -11,6 +11,7 @@ import Caption from '../pb_caption/_caption'
11
11
  import Title from '../pb_title/_title'
12
12
 
13
13
  type CurrencyProps = {
14
+ abbreviate?: boolean,
14
15
  align?: 'center' | 'left' | 'right',
15
16
  amount: string,
16
17
  aria?: object,
@@ -34,6 +35,7 @@ const sizes = {
34
35
 
35
36
  const Currency = (props: CurrencyProps) => {
36
37
  const {
38
+ abbreviate = false,
37
39
  align = 'left',
38
40
  aria = {},
39
41
  amount,
@@ -69,6 +71,24 @@ const Currency = (props: CurrencyProps) => {
69
71
  className
70
72
  )
71
73
 
74
+ const getFormattedNumber = (input) => new Intl.NumberFormat('en-US', {
75
+ notation: 'compact',
76
+ maximumFractionDigits: 1,
77
+ }).format(input)
78
+
79
+ type AbbrType = 'amount' | 'unit'
80
+
81
+ const getAbbreviatedValue = (abbrType: AbbrType) => {
82
+ const num = `${getFormattedNumber(whole.split(',').join(''))}`,
83
+ isAmount = abbrType === 'amount',
84
+ isUnit = abbrType === 'unit'
85
+ return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
86
+ }
87
+
88
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : whole,
89
+ getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
90
+ getDecimalValue = abbreviate ? '' : `.${decimal}`
91
+
72
92
  return (
73
93
  <div
74
94
  {...ariaProps}
@@ -92,7 +112,7 @@ const Currency = (props: CurrencyProps) => {
92
112
  dark={dark}
93
113
  size={sizes[size]}
94
114
  >
95
- {`${whole}`}
115
+ {getAmount}
96
116
  </Title>
97
117
 
98
118
  <Body
@@ -100,10 +120,11 @@ const Currency = (props: CurrencyProps) => {
100
120
  color="light"
101
121
  dark={dark}
102
122
  >
123
+ {getAbbreviation}
103
124
  <If condition={unit}>
104
125
  {unit}
105
126
  <Else />
106
- {`.${decimal}`}
127
+ {getDecimalValue}
107
128
  </If>
108
129
  </Body>
109
130
  </div>
@@ -33,6 +33,9 @@ module Playbook
33
33
  prop :dark, type: Playbook::Props::Boolean,
34
34
  default: false
35
35
 
36
+ prop :abbreviate, type: Playbook::Props::Boolean,
37
+ default: false
38
+
36
39
  def classname
37
40
  generate_classname("pb_currency_kit", align, size, dark_class)
38
41
  end
@@ -48,7 +51,7 @@ module Playbook
48
51
  def title_props
49
52
  {
50
53
  size: size_value,
51
- text: whole_value,
54
+ text: abbreviate ? abbreviated_value : whole_value,
52
55
  classname: "pb_currency_value",
53
56
  dark: dark,
54
57
  }
@@ -84,12 +87,18 @@ module Playbook
84
87
  amount.split(".").first.to_s
85
88
  end
86
89
 
90
+ def abbreviated_value(index = 0..-2)
91
+ value = amount.split(".").first.split(",").join("")
92
+ abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
93
+ abbreviated_num[index]
94
+ end
95
+
87
96
  def units_element
88
97
  _, decimal_part = amount.split(".")
89
- if unit.nil?
98
+ if unit.nil? && abbreviate == false
90
99
  decimal_part.nil? ? ".00" : ".#{decimal_part}"
91
100
  else
92
- unit
101
+ abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
93
102
  end
94
103
  end
95
104
 
@@ -0,0 +1,35 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+ import Currency from './_currency'
4
+
5
+ test('abbreviate prop returns proper abbreviated amount', () => {
6
+ render(
7
+ <>
8
+ <Currency
9
+ abbreviate
10
+ amount="3200"
11
+ data={{ testid: 'test-thousands' }}
12
+ />
13
+ <Currency
14
+ abbreviate
15
+ amount="3,200,000"
16
+ data={{ testid: 'test-millions' }}
17
+ />
18
+ <Currency
19
+ abbreviate
20
+ amount="3200000000"
21
+ data={{ testid: 'test-billions' }}
22
+ />
23
+ <Currency
24
+ abbreviate
25
+ amount="3,200,000,000,000"
26
+ data={{ testid: 'test-trillions' }}
27
+ />
28
+ </>
29
+ )
30
+
31
+ expect(screen.getByTestId('test-thousands')).toHaveTextContent('$3.2K')
32
+ expect(screen.getByTestId('test-millions')).toHaveTextContent('$3.2M')
33
+ expect(screen.getByTestId('test-billions')).toHaveTextContent('$3.2B')
34
+ expect(screen.getByTestId('test-trillions')).toHaveTextContent('$3.2T')
35
+ })
@@ -0,0 +1,27 @@
1
+ <%= pb_rails("currency", props: {
2
+ abbreviate: true,
3
+ amount: "2,200.50",
4
+ label: "Thousands (with Unit)",
5
+ margin_bottom: "md",
6
+ unit: "/mo",
7
+ }) %>
8
+
9
+ <%= pb_rails("currency", props: {
10
+ abbreviate: true,
11
+ amount: "3424123",
12
+ label: "Millions",
13
+ margin_bottom: "md",
14
+ }) %>
15
+
16
+ <%= pb_rails("currency", props: {
17
+ abbreviate: true,
18
+ amount: "45,300,000,000",
19
+ label: "Billions",
20
+ margin_bottom: "md",
21
+ }) %>
22
+
23
+ <%= pb_rails("currency", props: {
24
+ abbreviate: true,
25
+ amount: "983,200,000,000,000",
26
+ label: "Trillions",
27
+ }) %>
@@ -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'
@@ -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'
@@ -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) => {