playbook_ui 10.20.0 → 10.21.0.pre.alpha.lightbox.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +1 -0
  4. data/app/pb_kits/playbook/index.js +2 -1
  5. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +1 -1
  6. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  7. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  8. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  9. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +4 -0
  10. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
  11. data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
  12. data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
  13. data/app/pb_kits/playbook/pb_button/button.rb +11 -3
  14. data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
  15. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
  16. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
  17. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
  18. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  19. data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
  20. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  21. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
  22. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
  23. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
  24. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
  25. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
  26. data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
  27. data/app/pb_kits/playbook/pb_image/_image.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  29. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  30. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  31. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.jsx +53 -0
  32. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.jsx +53 -0
  33. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.jsx +38 -0
  34. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.jsx +78 -0
  35. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.jsx +58 -0
  36. data/app/pb_kits/playbook/pb_lightbox/Carousel/useSlides.js +66 -0
  37. data/app/pb_kits/playbook/pb_lightbox/_lightbox.jsx +112 -0
  38. data/app/pb_kits/playbook/pb_lightbox/_lightbox_context.jsx +3 -0
  39. data/app/pb_kits/playbook/pb_lightbox/_lightbox_header.jsx +71 -0
  40. data/app/pb_kits/playbook/pb_lightbox/_lightbox_header_icon.jsx +26 -0
  41. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_compound_component.jsx +95 -0
  42. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.jsx +64 -0
  43. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_default.md +1 -0
  44. data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_multiple.jsx +64 -0
  45. data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +7 -0
  46. data/app/pb_kits/playbook/pb_lightbox/docs/index.js +3 -0
  47. data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +21 -0
  48. data/app/pb_kits/playbook/pb_lightbox/hooks/useWindowSize.js +25 -0
  49. data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +202 -0
  50. data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +30 -0
  51. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +4 -0
  52. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
  53. data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -4
  54. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  55. data/app/pb_kits/playbook/pb_popover/index.js +4 -9
  56. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  57. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +4 -0
  58. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +2 -2
  59. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
  60. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  61. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
  62. data/lib/playbook/version.rb +1 -1
  63. metadata +29 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58801952abf6ff0d0a76aa1af436b9baa6e360c543051398d43e972f2fdf3268
4
- data.tar.gz: f693eaafecd9f29945efbdf72eccd26e762c40a1887e8744e62e895bfae300ca
3
+ metadata.gz: d8de309283f70eb32584fd45cd9c8c1d86eb4379dd3268b32c04961a3c1eb78c
4
+ data.tar.gz: 5d658516cec5f8eae57b9a5c04375524b9f03bb091171941a30776390130418c
5
5
  SHA512:
6
- metadata.gz: f29aa234d6d47e8cd9c851eab5c17b06fe11349c23c09eef7fa6e0e21aad7a97e7e5fafc44b1baeed7ae679a57ae6c88d5049a70dcdec4c1dd3a336c4a31e87f
7
- data.tar.gz: 30bd72269287a8da66a40d0181000ce5d679675a28af2897f739d0b147b7089333e64da5e55035e88d1b8b1b25974ad966f8d9f00853dd6e82bb6160141ec050
6
+ metadata.gz: 4ed16f1d8e6ab09e07dfc3f397700e4f41e90716ad91b61dbc33cc31615325a399affdcfb39448b7f5550784c4706ebeac6dfe1b0e4679a8bdd7207d956effaa
7
+ data.tar.gz: 634bc7cdb80465bb4c226a3b8f8f938380d57c44be6d94e0605c3ba3b357724d251c6a014e766b2173d35c2a22cac965637f953a5864f63ecd73eb466b6614b2
@@ -47,6 +47,7 @@
47
47
  @import 'pb_label_value/label_value';
48
48
  @import 'pb_layout/layout';
49
49
  @import 'pb_legend/legend';
50
+ @import 'pb_lightbox/lightbox';
50
51
  @import 'pb_line_graph/line_graph';
51
52
  @import 'pb_list/list';
52
53
  @import 'pb_loading_inline/loading_inline';
@@ -51,6 +51,7 @@ kits:
51
51
  - layouts:
52
52
  - flex
53
53
  - layout
54
+ - lightbox
54
55
  - list
55
56
  - loading_inline
56
57
  - nav
@@ -4,7 +4,6 @@ import 'lazysizes/plugins/attrchange/ls.attrchange'
4
4
  import 'lazysizes'
5
5
 
6
6
  // vvv React Component JSX Imports from the React Kits vvv
7
- export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
8
7
  export { default as Avatar } from './pb_avatar/_avatar'
9
8
  export { default as AvatarActionButton } from './pb_avatar_action_button/_avatar_action_button'
10
9
  export { default as Background } from './pb_background/_background'
@@ -55,6 +54,7 @@ export { default as Layout } from './pb_layout/_layout'
55
54
  export { default as Legend } from './pb_legend/_legend'
56
55
  export { default as LineGraph } from './pb_line_graph/_line_graph'
57
56
  export { default as List } from './pb_list/_list'
57
+ export { default as Lightbox } from './pb_lightbox/_lightbox'
58
58
  export { default as ListItem } from './pb_list/_list_item'
59
59
  export { default as LoadingInline } from './pb_loading_inline/_loading_inline'
60
60
  export { default as Message } from './pb_message/_message'
@@ -101,6 +101,7 @@ export { default as Toggle } from './pb_toggle/_toggle'
101
101
  export { default as Typeahead } from './pb_typeahead/_typeahead'
102
102
  export { default as User } from './pb_user/_user'
103
103
  export { default as UserBadge } from './pb_user_badge/_user_badge'
104
+ export { default as Walkthrough } from './pb_walkthrough/_walkthrough'
104
105
  export { default as WeekdayStacked } from './pb_weekday_stacked/_weekday_stacked'
105
106
  // ^^^ React Component JSX Imports from the React Kits ^^^
106
107
 
@@ -44,7 +44,7 @@ const Avatar = (props: AvatarProps) => {
44
44
  const dataProps = buildDataProps(data)
45
45
  const ariaProps = buildAriaProps(aria)
46
46
  const classes = classnames(
47
- buildCss('pb_avatar_kit', size),
47
+ buildCss('pb_avatar_kit', `size_${size}`),
48
48
  globalProps(props),
49
49
  className
50
50
  )
@@ -16,8 +16,8 @@ $avatar-sizes: (
16
16
  position: relative;
17
17
 
18
18
  @each $name, $size in $avatar-sizes {
19
- &[class*=_#{$name}],
20
- &[class*=_#{$name}_thumb] {
19
+ &[class*=_size_#{$name}],
20
+ &[class*=_size_#{$name}_thumb] {
21
21
  width: $size;
22
22
  height: $size;
23
23
  object-fit: cover;
@@ -18,7 +18,7 @@ module Playbook
18
18
  end
19
19
 
20
20
  def classname
21
- generate_classname("pb_avatar_kit", size)
21
+ generate_classname("pb_avatar_kit", "size_#{size}")
22
22
  end
23
23
 
24
24
  def online_status_props
@@ -22,7 +22,7 @@ test('loads the given image url and name', () => {
22
22
  const image = screen.getByAltText(imageAlt)
23
23
  const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1)
24
24
 
25
- expect(kit).toHaveClass('pb_avatar_kit_md')
25
+ expect(kit).toHaveClass('pb_avatar_kit_size_md')
26
26
  expect(kit).toHaveAttribute('data-initials', initials)
27
27
  expect(image).toHaveAttribute('data-src', imageUrl)
28
28
  expect(image).toHaveAttribute('src', imageUrl)
@@ -8,6 +8,7 @@ import pbChart from '../plugins/pb_chart'
8
8
 
9
9
  type BarGraphProps = {
10
10
  axisTitle: string,
11
+ dark?: Boolean,
11
12
  xAxisCategories: array,
12
13
  yAxisMin: number,
13
14
  yAxisMax: number,
@@ -30,6 +31,7 @@ type BarGraphProps = {
30
31
  export default class BarGraph extends React.Component<BarGraphProps> {
31
32
  static defaultProps = {
32
33
  className: 'pb_bar_graph',
34
+ dark: false,
33
35
  type: 'column',
34
36
  legend: false,
35
37
  toggleLegendClick: true,
@@ -38,6 +40,7 @@ export default class BarGraph extends React.Component<BarGraphProps> {
38
40
  componentDidMount() {
39
41
  const {
40
42
  axisTitle,
43
+ dark,
41
44
  xAxisCategories,
42
45
  yAxisMin,
43
46
  yAxisMax,
@@ -56,6 +59,7 @@ export default class BarGraph extends React.Component<BarGraphProps> {
56
59
 
57
60
  new pbChart(`.${className}`, {
58
61
  axisTitle: axisTitle,
62
+ dark,
59
63
  chartData: chartData,
60
64
  colors: colors,
61
65
  id: id,
@@ -33,6 +33,7 @@ module Playbook
33
33
  id: id,
34
34
  className: classname,
35
35
  chartData: chart_data,
36
+ dark: dark ? "dark" : "",
36
37
  type: chart_type,
37
38
  title: title,
38
39
  subtitle: subtitle,
@@ -22,7 +22,7 @@ type ButtonPropTypes = {
22
22
  loading?: boolean,
23
23
  newWindow?: boolean,
24
24
  onClick?: EventHandler,
25
- size: 'large' | 'medium' | 'small',
25
+ size?: 'sm' | 'md' | 'lg',
26
26
  text?: string,
27
27
  type: 'inline' | null,
28
28
  htmlType: string | 'button',
@@ -36,19 +36,19 @@ const buttonClassName = (props: ButtonPropTypes) => {
36
36
  disabled = false,
37
37
  fullWidth = false,
38
38
  loading = false,
39
- size = null,
40
39
  type = 'inline',
41
40
  variant = 'primary',
41
+ size = null,
42
42
  } = props
43
43
 
44
44
  let className = 'pb_button_kit'
45
45
 
46
46
  className += `${variant !== null ? `_${variant}` : ''}`
47
47
  className += `${type !== null ? `_${type}` : ''}`
48
- className += `${size !== null ? `_${size}` : ''}`
49
48
  className += `${fullWidth ? '_block' : ''}`
50
49
  className += disabled ? '_disabled' : '_enabled'
51
50
  className += loading ? '_loading' : ''
51
+ className += `${size !== null ? ` size_${size}` : ''}`
52
52
 
53
53
  return className
54
54
  }
@@ -1,7 +1,24 @@
1
1
  @import "./button_mixins";
2
2
 
3
- [class^=pb_button_kit]{
3
+ $pb_button_sizes: (
4
+ "sm": 0.75rem,
5
+ "md": 0.875rem,
6
+ "lg": 1.125rem,
7
+ );
8
+
9
+ [class*=pb_button_kit]{
4
10
  @include pb_button;
11
+ // Size =================
12
+ @each $name, $size in $pb_button_sizes {
13
+ &[class*=size_#{$name}] {
14
+ font-size: $size;
15
+ padding: calc(#{$size} / 2) calc(#{$size} * 2.42) !important;
16
+ }
17
+ @if $name == "sm" {
18
+ min-height: 0;
19
+ }
20
+ }
21
+
5
22
  // Variants =================
6
23
  &[class*=_primary] {
7
24
  @include pb_button_primary;
@@ -18,6 +18,9 @@ module Playbook
18
18
  prop :text
19
19
  prop :type
20
20
  prop :value
21
+ prop :size, type: Playbook::Props::Enum,
22
+ values: ["sm", "md", "lg", nil],
23
+ default: nil
21
24
 
22
25
  def options
23
26
  {
@@ -44,12 +47,13 @@ module Playbook
44
47
  link ? "a" : "button"
45
48
  end
46
49
 
47
- private
48
-
49
50
  def classname
50
- generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
51
+ button_class = generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
52
+ button_class + size_class
51
53
  end
52
54
 
55
+ private
56
+
53
57
  def disabled_class
54
58
  disabled ? "disabled" : "enabled"
55
59
  end
@@ -61,6 +65,10 @@ module Playbook
61
65
  def loading_class
62
66
  loading ? "loading" : nil
63
67
  end
68
+
69
+ def size_class
70
+ size ? " size_#{size}" : ""
71
+ end
64
72
  end
65
73
  end
66
74
  end
@@ -89,3 +89,16 @@ test('click event', async () => {
89
89
 
90
90
  expect(screen.getByText('clicked button!')).toBeInTheDocument()
91
91
  })
92
+
93
+ test('size prop', () => {
94
+ render(
95
+ <Button
96
+ data={{ testid: 'size-test' }}
97
+ size="sm"
98
+ />
99
+ )
100
+
101
+ const kit = screen.getByTestId('size-test')
102
+
103
+ expect(kit).toHaveClass('pb_button_kit_primary_inline_enabled size_sm')
104
+ })
@@ -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,7 @@ 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
10
11
  react:
11
12
  - button_default: Button Variants
12
13
  - button_full_width: Button Full Width
@@ -15,3 +16,4 @@ examples:
15
16
  - button_block_content: Button Block Content
16
17
  - button_accessibility: Button Accessibility Options
17
18
  - button_options: Button Additional Options (onClick)
19
+ - button_size: Button Size
@@ -5,3 +5,4 @@ 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'
@@ -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,
@@ -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 }
@@ -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
+ })