playbook_ui 10.21.0.pre.alpha.rg1 → 10.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -11
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  4. data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +13 -14
  5. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  6. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  7. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
  8. data/app/pb_kits/playbook/pb_background/_background.jsx +8 -3
  9. data/app/pb_kits/playbook/pb_background/_background.scss +24 -8
  10. data/app/pb_kits/playbook/pb_background/background.rb +6 -6
  11. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
  12. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
  13. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
  14. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
  15. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
  16. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +1 -1
  17. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
  18. data/app/pb_kits/playbook/pb_button/_button.jsx +8 -4
  19. data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
  20. data/app/pb_kits/playbook/pb_button/button.rb +13 -3
  21. data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
  22. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
  24. data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
  25. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
  26. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
  27. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
  28. data/app/pb_kits/playbook/pb_button/docs/example.yml +4 -0
  29. data/app/pb_kits/playbook/pb_button/docs/index.js +2 -0
  30. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
  31. data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
  32. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
  34. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  35. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
  36. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
  37. data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
  38. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
  39. data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
  40. data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
  41. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  42. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
  43. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
  44. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  45. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  46. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  47. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
  48. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
  49. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
  53. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
  54. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
  55. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
  56. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
  57. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  58. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
  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_stat_value/_icon_stat_value.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  67. data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
  68. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  69. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  70. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
  71. data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
  73. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
  74. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
  75. data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
  76. data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
  78. data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
  79. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -1
  80. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  81. data/app/pb_kits/playbook/pb_popover/_popover.jsx +1 -1
  82. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
  83. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  84. data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
  85. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +5 -0
  86. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  87. data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
  88. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +4 -1
  89. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  90. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
  91. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
  92. data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
  93. data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
  94. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  95. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  96. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  97. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
  98. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
  99. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
  100. data/app/pb_kits/playbook/utilities/_align_content.scss +6 -6
  101. data/app/pb_kits/playbook/utilities/_align_items.scss +16 -5
  102. data/app/pb_kits/playbook/utilities/_align_self.scss +6 -6
  103. data/app/pb_kits/playbook/utilities/_flex.scss +4 -4
  104. data/app/pb_kits/playbook/utilities/_flex_direction.scss +4 -4
  105. data/app/pb_kits/playbook/utilities/_flex_grow.scss +2 -2
  106. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +2 -2
  107. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +3 -3
  108. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
  109. data/app/pb_kits/playbook/utilities/_justify_content.scss +6 -6
  110. data/app/pb_kits/playbook/utilities/_justify_self.scss +5 -5
  111. data/app/pb_kits/playbook/utilities/_order.scss +14 -14
  112. data/app/pb_kits/playbook/utilities/globalProps.ts +156 -0
  113. data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
  114. data/lib/playbook/align_items.rb +1 -1
  115. data/lib/playbook/version.rb +2 -2
  116. metadata +21 -9
  117. data/app/pb_kits/playbook/types.js +0 -4
@@ -0,0 +1 @@
1
+ <%= pb_rails("button", props: { text: "Button with Form Attribute", form: "form-id"}) %>
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import { Button } from '../../'
3
+
4
+ const ButtonForm = (props) => (
5
+ <div>
6
+ <Button
7
+ form="form-id"
8
+ text="Button with Form Attribute"
9
+ {...props}
10
+ />
11
+ </div>
12
+ )
13
+
14
+ export default ButtonForm
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("button", props: { text: "Button sm size", size: "sm" }) %>
2
+ <%= pb_rails("button", props: { text: "Button md size", size: "md" }) %>
3
+ <%= pb_rails("button", props: { text: "Button lg size", size: "lg" }) %>
@@ -0,0 +1,26 @@
1
+ import React from 'react'
2
+ import { Button } from '../../'
3
+
4
+ const ButtonSize = (props) => (
5
+ <div>
6
+ <Button
7
+ size="sm"
8
+ text="Button sm size"
9
+ {...props}
10
+ />
11
+ {' '}
12
+ <Button
13
+ size="md"
14
+ text="Button md size"
15
+ {...props}
16
+ />
17
+ {' '}
18
+ <Button
19
+ size="lg"
20
+ text="Button lg size"
21
+ {...props}
22
+ />
23
+ </div>
24
+ )
25
+
26
+ export default ButtonSize
@@ -0,0 +1 @@
1
+ By default button has the `md` size style, even if you don't explicitly pass a size prop.
@@ -7,6 +7,8 @@ examples:
7
7
  - button_block_content: Button Block Content
8
8
  - button_accessibility: Button Accessibility Options
9
9
  - button_options: Button Additional Options
10
+ - button_size: Button Size
11
+ - button_form: Button Form Attribute
10
12
  react:
11
13
  - button_default: Button Variants
12
14
  - button_full_width: Button Full Width
@@ -15,3 +17,5 @@ examples:
15
17
  - button_block_content: Button Block Content
16
18
  - button_accessibility: Button Accessibility Options
17
19
  - button_options: Button Additional Options (onClick)
20
+ - button_size: Button Size
21
+ - button_form: Button Form Attribute
@@ -5,3 +5,5 @@ export { default as ButtonLoading } from './_button_loading.jsx'
5
5
  export { default as ButtonBlockContent } from './_button_block_content.jsx'
6
6
  export { default as ButtonAccessibility } from './_button_accessibility.jsx'
7
7
  export { default as ButtonOptions } from './_button_options.jsx'
8
+ export { default as ButtonSize } from './_button_size.jsx'
9
+ export { default as ButtonForm } from './_button_form.jsx'
@@ -5,7 +5,7 @@ import classnames from 'classnames'
5
5
 
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
7
 
8
- import { globalProps } from '../utilities/globalProps.js'
8
+ import { globalProps } from '../utilities/globalProps'
9
9
 
10
10
  type ButtonToolbarProps = {
11
11
  aria?: object,
@@ -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 { deprecatedProps, globalProps } from '../utilities/globalProps.js'
6
+ import { deprecatedProps, globalProps } from '../utilities/globalProps'
7
7
 
8
8
  type CaptionProps = {
9
9
  aria?: object,
@@ -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,
@@ -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) => {