playbook_ui 6.0.1.pre.alpha5 → 6.0.1.pre.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -1
  3. data/app/pb_kits/playbook/data/menu.yml +3 -2
  4. data/app/pb_kits/playbook/index.js +1 -0
  5. data/app/pb_kits/playbook/packs/examples.js +2 -0
  6. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +2 -2
  7. data/app/pb_kits/playbook/pb_badge/_badge.jsx +2 -5
  8. data/app/pb_kits/playbook/pb_badge/_badge.scss +1 -1
  9. data/app/pb_kits/playbook/pb_badge/badge.rb +1 -6
  10. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +2 -2
  11. data/app/pb_kits/playbook/pb_body/_body.jsx +3 -6
  12. data/app/pb_kits/playbook/pb_body/_body.scss +6 -0
  13. data/app/pb_kits/playbook/pb_body/body.rb +2 -8
  14. data/app/pb_kits/playbook/pb_button/_button.jsx +2 -5
  15. data/app/pb_kits/playbook/pb_button/_button.scss +1 -1
  16. data/app/pb_kits/playbook/pb_button/button.rb +1 -7
  17. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +2 -0
  18. data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -2
  19. data/app/pb_kits/playbook/pb_card/_card.jsx +17 -14
  20. data/app/pb_kits/playbook/pb_card/_card.scss +4 -1
  21. data/app/pb_kits/playbook/pb_card/card.rb +2 -9
  22. data/app/pb_kits/playbook/pb_card/docs/_card_dark.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +2 -2
  24. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -8
  25. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +2 -2
  26. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
  27. data/app/pb_kits/playbook/pb_contact/_contact.jsx +2 -2
  28. data/app/pb_kits/playbook/pb_currency/_currency.jsx +2 -2
  29. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +26 -0
  30. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -2
  31. data/app/pb_kits/playbook/pb_date/_date.jsx +4 -4
  32. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +2 -2
  33. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +2 -2
  34. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +2 -2
  35. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +2 -2
  36. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +2 -2
  37. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +2 -2
  38. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +2 -2
  39. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +2 -2
  40. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +2 -2
  41. data/app/pb_kits/playbook/pb_flex/_flex.jsx +2 -2
  42. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +2 -2
  43. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  44. data/app/pb_kits/playbook/pb_gauge/_gauge.html.erb +12 -0
  45. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +110 -0
  46. data/app/pb_kits/playbook/pb_gauge/_gauge.scss +11 -0
  47. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb +11 -0
  48. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +17 -0
  49. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.html.erb +12 -0
  50. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +18 -0
  51. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb +14 -0
  52. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +20 -0
  53. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb +15 -0
  54. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +23 -0
  55. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +40 -0
  56. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb +15 -0
  57. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +21 -0
  58. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.md +1 -0
  59. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb +26 -0
  60. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +37 -0
  61. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.md +1 -0
  62. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb +14 -0
  63. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +20 -0
  64. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb +29 -0
  65. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +29 -0
  66. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +24 -0
  67. data/app/pb_kits/playbook/pb_gauge/docs/index.js +9 -0
  68. data/app/pb_kits/playbook/pb_gauge/gauge.rb +57 -0
  69. data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +2 -2
  70. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +2 -2
  71. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +2 -2
  72. data/app/pb_kits/playbook/pb_icon/_icon.jsx +2 -2
  73. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +2 -2
  74. data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +2 -2
  75. data/app/pb_kits/playbook/pb_image/_image.jsx +2 -2
  76. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +2 -2
  77. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +2 -2
  78. data/app/pb_kits/playbook/pb_layout/_layout.jsx +6 -6
  79. data/app/pb_kits/playbook/pb_legend/_legend.jsx +2 -2
  80. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +2 -2
  81. data/app/pb_kits/playbook/pb_list/_list.jsx +2 -2
  82. data/app/pb_kits/playbook/pb_list/_list_item.jsx +2 -2
  83. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +2 -2
  84. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +111 -0
  85. data/app/pb_kits/playbook/pb_message/_message.jsx +2 -2
  86. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +2 -2
  87. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.jsx +2 -2
  88. data/app/pb_kits/playbook/pb_nav/_nav.jsx +2 -2
  89. data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +2 -2
  90. data/app/pb_kits/playbook/pb_person/_person.jsx +2 -2
  91. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +2 -2
  92. data/app/pb_kits/playbook/pb_pill/_pill.jsx +2 -2
  93. data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -2
  94. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +2 -2
  95. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +2 -2
  96. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +2 -2
  97. data/app/pb_kits/playbook/pb_radio/_radio.jsx +2 -2
  98. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +2 -2
  99. data/app/pb_kits/playbook/pb_select/_select.jsx +2 -2
  100. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx +2 -2
  101. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +2 -2
  102. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +2 -2
  103. data/app/pb_kits/playbook/pb_table/_table.jsx +2 -2
  104. data/app/pb_kits/playbook/pb_table/_table_row.jsx +2 -2
  105. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +2 -2
  106. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +2 -2
  107. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +2 -2
  108. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +2 -2
  109. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +2 -2
  110. data/app/pb_kits/playbook/pb_title/_title.jsx +2 -2
  111. data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +2 -2
  112. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +2 -2
  113. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +2 -2
  114. data/app/pb_kits/playbook/pb_user/_user.jsx +2 -2
  115. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +2 -2
  116. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +2 -2
  117. data/app/pb_kits/playbook/plugins/pb_chart.js +74 -0
  118. data/app/pb_kits/playbook/props.rb +6 -0
  119. data/app/pb_kits/playbook/utilities/{spacing.js → globalProps.js} +14 -1
  120. data/app/pb_kits/playbook/utilities/props.js +1 -0
  121. data/lib/generators/kit/templates/kit_jsx.erb.tt +2 -2
  122. data/lib/playbook/version.rb +1 -1
  123. metadata +28 -2
@@ -5,7 +5,7 @@ import classnames from 'classnames'
5
5
 
6
6
  import { buildCss } from '../utilities/props'
7
7
  import { Body, Icon } from '../'
8
- import { spacing } from '../utilities/spacing.js'
8
+ import { globalProps } from '../utilities/globalProps.js'
9
9
 
10
10
  const statusMap = {
11
11
  increase: 'positive',
@@ -35,7 +35,7 @@ const StatChange = (props: StatChangeProps) => {
35
35
  className={classnames(
36
36
  className,
37
37
  buildCss('pb_stat_change_kit', status),
38
- spacing(props)
38
+ globalProps(props)
39
39
  )}
40
40
  id={id}
41
41
  >
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Title } from '../'
6
- import { spacing } from '../utilities/spacing.js'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type StatValueProps = {
9
9
  className?: String,
@@ -44,7 +44,7 @@ const StatValue = (props: StatValueProps) => {
44
44
 
45
45
  return (
46
46
  <div
47
- className={classnames('pb_stat_value_kit', className, spacing(props))}
47
+ className={classnames('pb_stat_value_kit', className, globalProps(props))}
48
48
  id={id}
49
49
  >
50
50
  <div className="pb_stat_value_wrapper">
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { type Node } from 'react'
4
4
  import classnames from 'classnames'
5
- import { spacing } from '../utilities/spacing.js'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  type TableProps = {
8
8
  children: Array<Node> | Node,
@@ -43,7 +43,7 @@ const Table = (props: TableProps) => {
43
43
  'single-line': singleLine,
44
44
  'no-hover': disableHover,
45
45
  },
46
- spacing(props)
46
+ globalProps(props)
47
47
  )}
48
48
  >
49
49
  {children}
@@ -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 { spacing } from '../utilities/spacing.js'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  type TableRowPropTypes = {
8
8
  children: Array<React.ReactNode> | React.ReactNode,
@@ -17,7 +17,7 @@ const TableRow = (props: TableRowPropTypes) => {
17
17
  const tableRowCss = buildCss('pb_table_row_kit', sideHighlightClass)
18
18
 
19
19
  return (
20
- <tr className={classnames(tableRowCss, className, spacing(props))}>
20
+ <tr className={classnames(tableRowCss, className, globalProps(props))}>
21
21
  {children}
22
22
  </tr>
23
23
  )
@@ -2,7 +2,7 @@
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
4
  import { Body, Caption } from '../'
5
- import { spacing } from '../utilities/spacing.js'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  import {
8
8
  buildAriaProps,
@@ -60,7 +60,7 @@ const TextInput = ({
60
60
  dark={dark}
61
61
  text={label}
62
62
  />
63
- <div className={classnames('text_input_wrapper', spacing(props))}>
63
+ <div className={classnames('text_input_wrapper', globalProps(props))}>
64
64
  <If condition={children}>
65
65
  {children}
66
66
  <Else />
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Body, Caption } from '../'
6
6
  import type { InputCallback } from '../types.js'
7
- import { spacing } from '../utilities/spacing.js'
7
+ import { globalProps } from '../utilities/globalProps.js'
8
8
 
9
9
  type TextareaProps = {
10
10
  className?: String,
@@ -43,7 +43,7 @@ const Textarea = ({
43
43
  const resizeClass = ` resize_${resize}`
44
44
 
45
45
  return (
46
- <div className={classnames(textareaClass, className, errorClass, resizeClass, spacing(props))}>
46
+ <div className={classnames(textareaClass, className, errorClass, resizeClass, globalProps(props))}>
47
47
  <Caption
48
48
  dark={dark}
49
49
  text={label}
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Body, Caption, Icon } from '../'
6
6
  import DateTime from '../pb_kit/dateTime.js'
7
- import { spacing } from '../utilities/spacing.js'
7
+ import { globalProps } from '../utilities/globalProps.js'
8
8
 
9
9
  type TimeRangeInlineProps = {
10
10
  className?: String,
@@ -78,7 +78,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
78
78
 
79
79
  return (
80
80
  <div
81
- className={classnames('pb_time_range_inline_kit_' + alignment, className, spacing(props))}
81
+ className={classnames('pb_time_range_inline_kit_' + alignment, className, globalProps(props))}
82
82
  >
83
83
  <div className="pb_time_range_inline_wrapper">
84
84
  <If condition={size == 'xs'}>
@@ -6,7 +6,7 @@ import classnames from 'classnames'
6
6
  import DateTime from '../pb_kit/dateTime.js'
7
7
  import { buildCss } from '../utilities/props'
8
8
  import { Body, Caption } from '../'
9
- import { spacing } from '../utilities/spacing.js'
9
+ import { globalProps } from '../utilities/globalProps.js'
10
10
 
11
11
  const Components = {
12
12
  body: Body,
@@ -30,7 +30,7 @@ const TimeStacked = (props: TimeStackedProps) => {
30
30
  buildCss('pb_time_stacked_kit', {
31
31
  dark: dark,
32
32
  }),
33
- spacing(props)
33
+ globalProps(props)
34
34
  )
35
35
 
36
36
  const tagClasses = classnames(buildCss('pb_time_stacked_kit', tag))
@@ -7,7 +7,7 @@ import { Caption } from '../'
7
7
 
8
8
  import { buildCss, buildDataProps } from '../utilities/props'
9
9
 
10
- import { spacing } from '../utilities/spacing.js'
10
+ import { globalProps } from '../utilities/globalProps.js'
11
11
 
12
12
  type TimestampProps = {
13
13
  id?: String,
@@ -24,7 +24,7 @@ const Timestamp = (props: TimestampProps) => {
24
24
  return (
25
25
  <div
26
26
  {...dataProps}
27
- className={classnames(className, pbCss, spacing(props))}
27
+ className={classnames(className, pbCss, globalProps(props))}
28
28
  id={id}
29
29
  >
30
30
  <Caption
@@ -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 { spacing } from '../utilities/spacing.js'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type TitleProps = {
9
9
  aria?: object,
@@ -35,7 +35,7 @@ const Title = (props: TitleProps) => {
35
35
  const themeStyle = dark === true ? 'dark' : ''
36
36
  const ariaProps = buildAriaProps(aria)
37
37
  const dataProps = buildDataProps(data)
38
- const classes = classnames(buildCss('pb_title_kit', size, themeStyle, variant), className, spacing(props))
38
+ const classes = classnames(buildCss('pb_title_kit', size, themeStyle, variant), className, globalProps(props))
39
39
  const Tag = `${tag}`
40
40
 
41
41
  return (
@@ -6,7 +6,7 @@ import classnames from 'classnames'
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
7
 
8
8
  import { Body, Title } from '../'
9
- import { spacing } from '../utilities/spacing.js'
9
+ import { globalProps } from '../utilities/globalProps.js'
10
10
 
11
11
  type TitleCountProps = {
12
12
  align: "center" | "left" | "right",
@@ -32,7 +32,7 @@ const TitleCount = (props: TitleCountProps) => {
32
32
  const ariaProps = buildAriaProps(aria)
33
33
  const dataProps = buildDataProps(data)
34
34
 
35
- const css = classnames(buildCss('pb_title_count_kit', align, size), className, spacing(props))
35
+ const css = classnames(buildCss('pb_title_count_kit', align, size), className, globalProps(props))
36
36
 
37
37
  const formatCount = count.toLocaleString()
38
38
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { spacing } from '../utilities/spacing.js'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
 
7
7
  import { Body, Title } from '../'
8
8
 
@@ -25,7 +25,7 @@ const TitleDetail = (props: TitleDetailProps) => {
25
25
  return (
26
26
  <div
27
27
  {...dataProps}
28
- className={classnames(className, pbCss, spacing(props))}
28
+ className={classnames(className, pbCss, globalProps(props))}
29
29
  id={id}
30
30
  >
31
31
  <Title
@@ -11,7 +11,7 @@ import {
11
11
  noop,
12
12
  } from '../utilities/props'
13
13
 
14
- import { spacing } from '../utilities/spacing.js'
14
+ import { globalProps } from '../utilities/globalProps.js'
15
15
 
16
16
  type Props = {
17
17
  aria: object,
@@ -51,7 +51,7 @@ const Toggle = ({
51
51
  <div
52
52
  {...ariaProps}
53
53
  {...dataProps}
54
- className={classnames(css, spacing(props))}
54
+ className={classnames(css, globalProps(props))}
55
55
  >
56
56
  <label className="pb_toggle_wrapper">
57
57
  <input
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Avatar, Body, Title } from '../'
6
- import { spacing } from '../utilities/spacing.js'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type UserProps = {
9
9
  className?: String,
@@ -30,7 +30,7 @@ const User = (props: UserProps) => {
30
30
  avatarUrl,
31
31
  } = props
32
32
  return (
33
- <div className={classnames(`pb_user_kit_${align}_${orientation}_${size}`, spacing(props))}>
33
+ <div className={classnames(`pb_user_kit_${align}_${orientation}_${size}`, globalProps(props))}>
34
34
  <If condition={avatar || avatarUrl}>
35
35
  <Avatar
36
36
  imageUrl={avatarUrl}
@@ -1,7 +1,7 @@
1
1
  /* @flow */
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
- import { spacing } from '../utilities/spacing.js'
4
+ import { globalProps } from '../utilities/globalProps.js'
5
5
 
6
6
  type UserBadgeProps = {
7
7
  className?: String,
@@ -15,7 +15,7 @@ const UserBadge = (props: UserBadgeProps) => {
15
15
  const image = require(`./badges/_${badge}.svg`)
16
16
 
17
17
  return (
18
- <div className={classnames(`pb_user_badge_kit_${size}`, spacing(props))}>
18
+ <div className={classnames(`pb_user_badge_kit_${size}`, globalProps(props))}>
19
19
  <div className="pb_user_badge_wrapper">
20
20
  <img src={image} />
21
21
  </div>
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { spacing } from '../utilities/spacing.js'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
6
  import { buildCss } from '../utilities/props'
7
7
 
8
8
  import { Caption, Title } from '../'
@@ -52,7 +52,7 @@ const WeekdayStacked = (props: WeekdayStackedProps) => {
52
52
  className={classnames(
53
53
  buildCss('pb_weekday_stacked_kit', align),
54
54
  className,
55
- spacing(props)
55
+ globalProps(props)
56
56
  )}
57
57
  >
58
58
  <Caption dark={dark}>{getDayOfWeek(date, compact)}</Caption>
@@ -4,6 +4,8 @@ import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme.js'
4
4
  import colors from '../tokens/_colors.scss'
5
5
 
6
6
  require('highcharts/modules/variable-pie')(Highcharts)
7
+ import highchartsMore from 'highcharts/highcharts-more.js'
8
+ import solidGauge from 'highcharts/modules/solid-gauge.js'
7
9
 
8
10
  // Map Data Color String Props to our SCSS Variables
9
11
  const mapColors = (array) => {
@@ -67,11 +69,83 @@ class pbChart {
67
69
 
68
70
  if (this.options.type == 'variablepie' || this.options.type == 'pie'){
69
71
  this.setupPieChart(options)
72
+ } else if (this.options.type == 'gauge') {
73
+ this.setupGauge()
70
74
  } else {
71
75
  this.setupChart()
72
76
  }
73
77
  }
74
78
 
79
+ setupGauge() {
80
+ highchartsMore(Highcharts)
81
+ solidGauge(Highcharts)
82
+ Highcharts.setOptions(highchartsTheme)
83
+
84
+ Highcharts.chart(this.defaults.id, {
85
+ chart: {
86
+ type: this.defaults.style,
87
+ height: this.defaults.height,
88
+ },
89
+ title: {
90
+ text: this.defaults.title,
91
+ },
92
+ yAxis: {
93
+ min: this.defaults.min,
94
+ max: this.defaults.max,
95
+ lineWidth: 0,
96
+ tickWidth: 0,
97
+ minorTickInterval: null,
98
+ tickAmount: 2,
99
+ tickPositions: [this.defaults.min, this.defaults.max],
100
+ labels: {
101
+ y: 26,
102
+ enabled: this.defaults.showLabels,
103
+ },
104
+ },
105
+ credits: false,
106
+ series: [
107
+ {
108
+ data: this.defaults.chartData,
109
+ },
110
+ ],
111
+ pane: {
112
+ center: ['50%', '50%'],
113
+ size: '90%',
114
+ startAngle: this.defaults.circumference[0],
115
+ endAngle: this.defaults.circumference[1],
116
+ background: {
117
+ borderWidth: 20,
118
+ innerRadius: '90%',
119
+ outerRadius: '90%',
120
+ shape: 'arc',
121
+ className: 'gauge-pane',
122
+ },
123
+ },
124
+ tooltip: {
125
+ headerFormat: '',
126
+ pointFormat: this.defaults.tooltipHtml,
127
+ followPointer: true,
128
+ },
129
+ plotOptions: {
130
+ series: {
131
+ animation: !this.defaults.disableAnimation,
132
+ },
133
+ solidgauge: {
134
+ dataLabels: {
135
+ format: `<span class="prefix">${this.defaults.prefix}</span>` +
136
+ '<span class="fix">{y:,f}</span>' +
137
+ `<span class="suffix">${this.defaults.suffix}</span>`,
138
+ },
139
+ },
140
+ },
141
+ })
142
+ document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
143
+ if (document.querySelector('.prefix')) {
144
+ document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
145
+ document.querySelectorAll('.fix').forEach((fix) => fix.setAttribute('y', '38'))
146
+ }
147
+ }
148
+
75
149
  setupPieChart(options) {
76
150
  Highcharts.setOptions(highchartsTheme)
77
151
  Highcharts.chart(this.defaults.id, {
@@ -43,11 +43,16 @@ module Playbook
43
43
  end.compact.join(" ")
44
44
  end
45
45
 
46
+ def dark_props
47
+ dark ? "dark" : nil
48
+ end
49
+
46
50
  def generate_classname(*name_parts, separator: "_")
47
51
  [
48
52
  name_parts.compact.join(separator),
49
53
  prop(:classname),
50
54
  spacing_props,
55
+ dark_props
51
56
  ].compact.join(" ")
52
57
  end
53
58
 
@@ -81,6 +86,7 @@ module Playbook
81
86
  prop :padding_top
82
87
  prop :padding_x
83
88
  prop :padding_y
89
+ prop :dark, type: Playbook::Props::Boolean, default: false
84
90
  end
85
91
 
86
92
  def spacing_options
@@ -1,4 +1,5 @@
1
- export const spacing = ({
1
+ // Prop categories
2
+ const spacingProps = ({
2
3
  marginRight,
3
4
  marginLeft,
4
5
  marginTop,
@@ -31,3 +32,15 @@ export const spacing = ({
31
32
  css += padding ? `p_${padding} ` : ''
32
33
  return css
33
34
  }
35
+
36
+ const darkProps = ({ dark }) => {
37
+ let css = ''
38
+ css += dark ? 'dark' : ''
39
+ return css
40
+ }
41
+
42
+ // All Exported as a single function
43
+ export const globalProps = (props, defaultProps = {}) => {
44
+ const allProps = { ...props, ...defaultProps }
45
+ return spacingProps(allProps) + darkProps(allProps)
46
+ }
@@ -46,3 +46,4 @@ export const buildDataProps = (data) => buildPrefixedProps('data', data)
46
46
  * @returns {String} the derived root className value.
47
47
  */
48
48
  export const buildCss = (...rules) => classnames(rules).replace(/\s/g, '_')
49
+
@@ -38,7 +38,7 @@ props_names = @kit_props.keys.map do |key|
38
38
  import React from 'react'
39
39
  import classnames from 'classnames'
40
40
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
41
- import { spacing } from '../utilities/spacing.js'
41
+ import { globalProps } from '../utilities/globalProps.js'
42
42
 
43
43
  type <%= type_name %> = {
44
44
  <%= break_lines.call(props_types) %>
@@ -51,7 +51,7 @@ const <%= @kit_name_pascal %> = (props: <%= type_name %>) => {
51
51
 
52
52
  const ariaProps = buildAriaProps(aria)
53
53
  const dataProps = buildDataProps(data)
54
- const classes = classnames(buildCss('pb_<%= @kit_name_underscore %>'), className, spacing(props))
54
+ const classes = classnames(buildCss('pb_<%= @kit_name_underscore %>'), className, globalProps(props))
55
55
 
56
56
  return (
57
57
  <div