playbook_ui 6.7.0 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +1 -0
  3. data/app/pb_kits/playbook/packs/examples.js +2 -0
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +5 -1
  5. data/app/pb_kits/playbook/pb_badge/_badge.jsx +4 -2
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +1 -1
  7. data/app/pb_kits/playbook/pb_button/_button.jsx +5 -1
  8. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +5 -1
  9. data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -2
  10. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +5 -2
  11. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +3 -1
  12. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_options.html.erb +10 -0
  13. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
  14. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +130 -0
  16. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss +1 -1
  17. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +39 -0
  18. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -0
  19. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +28 -0
  20. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +117 -0
  21. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +53 -0
  22. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -0
  23. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +45 -0
  24. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +30 -0
  25. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +45 -0
  26. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +11 -0
  27. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +9 -0
  28. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +5 -1
  29. data/app/pb_kits/playbook/pb_contact/_contact.jsx +5 -1
  30. data/app/pb_kits/playbook/pb_currency/_currency.jsx +5 -1
  31. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +5 -1
  32. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +2 -2
  33. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +4 -0
  34. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.jsx +34 -0
  35. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.md +3 -0
  36. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -0
  37. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
  38. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +5 -1
  39. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +2 -2
  40. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +5 -1
  41. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +2 -2
  42. data/app/pb_kits/playbook/pb_flex/_flex.jsx +2 -2
  43. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  44. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +6 -1
  45. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +3 -2
  46. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +2 -2
  49. data/app/pb_kits/playbook/pb_icon/_icon.jsx +2 -2
  50. data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +5 -1
  51. data/app/pb_kits/playbook/pb_image/_image.jsx +5 -1
  52. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +5 -1
  53. data/app/pb_kits/playbook/pb_layout/_layout.jsx +4 -4
  54. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +1 -1
  55. data/app/pb_kits/playbook/pb_list/_list.jsx +3 -2
  56. data/app/pb_kits/playbook/pb_list/_list_item.jsx +3 -2
  57. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +5 -1
  58. data/app/pb_kits/playbook/pb_message/_message.jsx +5 -1
  59. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +5 -2
  60. data/app/pb_kits/playbook/pb_nav/_nav.jsx +2 -2
  61. data/app/pb_kits/playbook/pb_person/_person.jsx +5 -1
  62. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +5 -1
  63. data/app/pb_kits/playbook/pb_popover/_popover.jsx +5 -1
  64. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +4 -4
  65. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_radio/_radio.html.erb +1 -1
  67. data/app/pb_kits/playbook/pb_radio/docs/_radio_options.html.erb +9 -0
  68. data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -0
  69. data/app/pb_kits/playbook/pb_radio/radio.rb +2 -4
  70. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +1 -1
  71. data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
  72. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +2 -2
  73. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +3 -3
  74. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +6 -1
  75. data/app/pb_kits/playbook/pb_table/_table.jsx +2 -2
  76. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -1
  78. data/app/pb_kits/playbook/pb_time/_time.jsx +2 -2
  79. data/app/pb_kits/playbook/pb_time/docs/_time_timezone.html.erb +2 -1
  80. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +1 -1
  81. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +3 -3
  82. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +1 -1
  83. data/app/pb_kits/playbook/pb_title/_title.jsx +5 -1
  84. data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +5 -1
  85. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +1 -1
  86. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +3 -3
  87. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +41 -43
  88. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -2
  89. data/app/pb_kits/playbook/pb_toggle/docs/index.js +0 -1
  90. data/app/pb_kits/playbook/pb_toggle/toggle.rb +2 -2
  91. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +5 -2
  92. data/app/pb_kits/playbook/plugins/pb_chart.js +1 -1
  93. data/lib/generators/kit/templates/kit_jsx.erb.tt +1 -1
  94. data/lib/playbook/version.rb +1 -1
  95. metadata +19 -5
  96. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_size.html.erb +0 -11
  97. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_size.jsx +0 -44
@@ -0,0 +1,53 @@
1
+ import React, { useState } from 'react'
2
+ import { Button, CircleChart } from '../../'
3
+
4
+ const CircleChartLiveData = () => {
5
+ const [data, setData] = useState([
6
+ {
7
+ name: 'Waiting for Calls',
8
+ value: 41,
9
+ },
10
+ {
11
+ name: 'On Call',
12
+ value: 49,
13
+ },
14
+ {
15
+ name: 'After call',
16
+ value: 10,
17
+ },
18
+ ])
19
+
20
+ const data2 = [
21
+ {
22
+ name: 'Waiting for Calls',
23
+ value: 48,
24
+ },
25
+ {
26
+ name: 'On Call',
27
+ value: 12,
28
+ },
29
+ {
30
+ name: 'After call',
31
+ value: 140,
32
+ },
33
+ ]
34
+
35
+ const updateValue = () => {
36
+ setData(data2)
37
+ }
38
+
39
+ return (
40
+ <div>
41
+ <Button
42
+ onClick={updateValue}
43
+ text="Update Value"
44
+ />
45
+ <CircleChart
46
+ chartData={data}
47
+ id="circle-chart-live-data"
48
+ />
49
+ </div>
50
+ )
51
+ }
52
+
53
+ export default CircleChartLiveData
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataRounded = [
5
+ {
6
+ name: 'Waiting for Calls',
7
+ value: 41,
8
+ },
9
+ {
10
+ name: 'On Call',
11
+ value: 49,
12
+ },
13
+ {
14
+ name: 'After call',
15
+ value: 10,
16
+ },
17
+ ]
18
+
19
+ const CircleChartRounded = () => (
20
+ <div>
21
+ <CircleChart
22
+ chartData={dataRounded}
23
+ id="default-test-rounded"
24
+ innerSize="lg"
25
+ rounded
26
+ />
27
+ </div>
28
+ )
29
+
30
+ export default CircleChartRounded
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithLabels = [
5
+ {
6
+ name: 'Facebook',
7
+ value: 2498,
8
+ },
9
+ {
10
+ name: 'YouTube',
11
+ value: 2000,
12
+ },
13
+ {
14
+ name: 'WhatsApp',
15
+ value: 2000,
16
+ },
17
+ {
18
+ name: 'Facebook Messenger',
19
+ value: 1300,
20
+ },
21
+ {
22
+ name: 'WeChat',
23
+ value: 1165,
24
+ },
25
+ {
26
+ name: 'Instagram',
27
+ value: 1000,
28
+ },
29
+ {
30
+ name: 'Tik Tok',
31
+ value: 800,
32
+ },
33
+ ]
34
+
35
+ const CircleChartWithLabels = () => (
36
+ <div>
37
+ <CircleChart
38
+ chartData={dataWithLabels}
39
+ dataLabels
40
+ id="with-labels-example"
41
+ />
42
+ </div>
43
+ )
44
+
45
+ export default CircleChartWithLabels
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithLegend = [{
5
+ name: 'Bugs',
6
+ value: 8,
7
+
8
+ },
9
+ {
10
+ name: 'Chores',
11
+ value: 1,
12
+
13
+ },
14
+ {
15
+ name: 'Stories',
16
+ value: 12,
17
+ },
18
+ ]
19
+
20
+ const CircleChartWithLegendKit = () => (
21
+ <div>
22
+ <CircleChart
23
+ chartData={dataWithLegend}
24
+ id="with-legend-example"
25
+ legend
26
+ />
27
+ </div>
28
+ )
29
+
30
+ export default CircleChartWithLegendKit
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { CircleChart } from '../../'
3
+
4
+ const dataWithTitle = [
5
+ {
6
+ name: 'Facebook',
7
+ value: 2498,
8
+ },
9
+ {
10
+ name: 'YouTube',
11
+ value: 2000,
12
+ },
13
+ {
14
+ name: 'WhatsApp',
15
+ value: 2000,
16
+ },
17
+ {
18
+ name: 'Facebook Messenger',
19
+ value: 1300,
20
+ },
21
+ {
22
+ name: 'WeChat',
23
+ value: 1165,
24
+ },
25
+ {
26
+ name: 'Instagram',
27
+ value: 1000,
28
+ },
29
+ {
30
+ name: 'Tik Tok',
31
+ value: 800,
32
+ },
33
+ ]
34
+
35
+ const CircleChartWithLegendKit = () => (
36
+ <div>
37
+ <CircleChart
38
+ chartData={dataWithTitle}
39
+ id="with-title-example"
40
+ title="Active Users on Social Media"
41
+ />
42
+ </div>
43
+ )
44
+
45
+ export default CircleChartWithLegendKit
@@ -10,4 +10,15 @@ examples:
10
10
  - circle_chart_with_title: Title
11
11
  - circle_chart_inner_sizes: Inner Circle Size Options
12
12
 
13
+ react:
14
+ - circle_chart_default: Default Style
15
+ - circle_chart_live_data: Live Data
16
+ - circle_chart_rounded: Rounded Corners
17
+ - circle_chart_block: Accepts Any Block
18
+ - circle_chart_colors: Color Overrides
19
+ - circle_chart_with_labels: Data Labels
20
+ - circle_chart_with_legend_kit: Legend
21
+ - circle_chart_with_title: Title
22
+ - circle_chart_inner_sizes: Inner Circle Size Options
23
+
13
24
 
@@ -0,0 +1,9 @@
1
+ export { default as CircleChartDefault } from './_circle_chart_default.jsx'
2
+ export { default as CircleChartLiveData } from './_circle_chart_live_data.jsx'
3
+ export { default as CircleChartRounded } from './_circle_chart_rounded.jsx'
4
+ export { default as CircleChartBlock } from './_circle_chart_block.jsx'
5
+ export { default as CircleChartColors } from './_circle_chart_colors.jsx'
6
+ export { default as CircleChartWithLabels } from './_circle_chart_with_labels.jsx'
7
+ export { default as CircleChartWithLegendKit } from './_circle_chart_with_legend_kit.jsx'
8
+ export { default as CircleChartWithTitle } from './_circle_chart_with_title.jsx'
9
+ export { default as CircleChartInnerSizes } from './_circle_chart_inner_sizes.jsx'
@@ -46,7 +46,11 @@ const CircleIconButton = (props: CircleIconButtonProps) => {
46
46
 
47
47
  const ariaProps = buildAriaProps(aria)
48
48
  const dataProps = buildDataProps(data)
49
- const classes = classnames(buildCss('pb_circle_icon_button_kit'), className, globalProps(props))
49
+ const classes = classnames(
50
+ buildCss('pb_circle_icon_button_kit'),
51
+ globalProps(props),
52
+ className
53
+ )
50
54
 
51
55
  return (
52
56
  <div
@@ -58,7 +58,11 @@ const Contact = (props: ContactProps) => {
58
58
  id } = props
59
59
  const ariaProps = buildAriaProps(aria)
60
60
  const dataProps = buildDataProps(data)
61
- const classes = classnames(buildCss('pb_contact_kit'), className, globalProps(props))
61
+ const classes = classnames(
62
+ buildCss('pb_contact_kit'),
63
+ globalProps(props),
64
+ className
65
+ )
62
66
 
63
67
  return (
64
68
  <div
@@ -45,7 +45,11 @@ const Currency = (props: CurrencyProps) => {
45
45
  const [whole, decimal = '00'] = amount.split('.')
46
46
  const ariaProps = buildAriaProps(aria)
47
47
  const dataProps = buildDataProps(data)
48
- const classes = classnames(buildCss('pb_currency_kit', align, size, { dark: dark }), className, globalProps(props))
48
+ const classes = classnames(
49
+ buildCss('pb_currency_kit', align, size, { dark }),
50
+ globalProps(props),
51
+ className
52
+ )
49
53
 
50
54
  return (
51
55
  <div
@@ -41,7 +41,11 @@ const DashboardValue = (props: DashboardValueProps) => {
41
41
 
42
42
  const ariaProps = buildAriaProps(aria)
43
43
  const dataProps = buildDataProps(data)
44
- const classes = classnames(buildCss('pb_dashboard_value_kit', align), className, globalProps(props))
44
+ const classes = classnames(
45
+ buildCss('pb_dashboard_value_kit', align),
46
+ globalProps(props),
47
+ className
48
+ )
45
49
 
46
50
  return (
47
51
  <div
@@ -71,9 +71,9 @@ const DatePicker = (props: DatePickerProps) => {
71
71
  const dataProps = buildDataProps(data)
72
72
  const classes = classnames(
73
73
  buildCss('pb_date_picker_kit'),
74
- className,
75
74
  globalProps(props),
76
75
  error ? 'error' : null,
76
+ className
77
77
  )
78
78
 
79
79
  useEffect(() => {
@@ -88,6 +88,7 @@ const DatePicker = (props: DatePickerProps) => {
88
88
  maxDate: maxDate,
89
89
  minDate: minDate,
90
90
  mode: mode,
91
+ onChange: onChange,
91
92
  pickerId: pickerId,
92
93
  yearRange: yearRange,
93
94
  })
@@ -126,7 +127,6 @@ const DatePicker = (props: DatePickerProps) => {
126
127
  id={pickerId}
127
128
  label={hideLabel ? null : label}
128
129
  name={name}
129
- onChange={onChange}
130
130
  placeholder={placeholder}
131
131
  type={type}
132
132
  />
@@ -11,6 +11,7 @@ const datePickerHelper = (config) => {
11
11
  maxDate,
12
12
  minDate,
13
13
  mode,
14
+ onChange,
14
15
  pickerId,
15
16
  yearRange,
16
17
  } = config
@@ -99,6 +100,9 @@ const datePickerHelper = (config) => {
99
100
  onClose: [() => {
100
101
  window.removeEventListener('resize', calendarResizer)
101
102
  }],
103
+ onChange: [(selectedDates, dateStr) => {
104
+ onChange(dateStr, selectedDates)
105
+ }],
102
106
  onYearChange: [],
103
107
  prevArrow: '<i class="far fa-angle-left"></i>',
104
108
  static: true,
@@ -0,0 +1,34 @@
1
+ import React, { useState } from 'react'
2
+ import { DatePicker, LabelValue } from '../..'
3
+
4
+ const DatePickerOnChange = () => {
5
+ const today = new Date()
6
+ const [dateString, setDateString] = useState(today.toLocaleDateString())
7
+ const [dateObj, setDateObj] = useState([today])
8
+
9
+ const changeHandler = (dateStr, selectedDates) => {
10
+ setDateString(dateStr)
11
+ setDateObj(selectedDates)
12
+ }
13
+
14
+ return (
15
+ <div>
16
+ <DatePicker
17
+ defaultDate={dateString}
18
+ marginBottom="lg"
19
+ onChange={changeHandler}
20
+ pickerId="date-picker-onchange"
21
+ />
22
+ <LabelValue
23
+ label="Date Object"
24
+ marginBottom="lg"
25
+ value={dateObj[0] ? dateObj[0].toString() : ''}
26
+ />
27
+ <LabelValue
28
+ label="Date String"
29
+ value={dateString}
30
+ />
31
+ </div>
32
+ )
33
+ }
34
+ export default DatePickerOnChange
@@ -0,0 +1,3 @@
1
+ Your change handler function has access to two arguments: `dateStr` and `selectedDates`.
2
+
3
+ The first, `dateStr`, is a string of the chosen date. The second, `selectedDates`, is an array of selected date objects. In many use cases `selectedDates` will have only one value but you'll still need to access it from index 0.
@@ -23,6 +23,7 @@ examples:
23
23
  - date_picker_default_date: Default Date
24
24
  - date_picker_input: Input Field
25
25
  - date_picker_label: Label
26
+ - date_picker_on_change: onChange
26
27
  - date_picker_range: Range
27
28
  - date_picker_format: Format
28
29
  - date_picker_disabled: Disabled Dates
@@ -3,6 +3,7 @@ export { default as DatePickerHideIcon } from './_date_picker_hide_icon.jsx'
3
3
  export { default as DatePickerInput } from './_date_picker_input.jsx'
4
4
  export { default as DatePickerDefaultDate } from './_date_picker_default_date.jsx'
5
5
  export { default as DatePickerLabel } from './_date_picker_label.jsx'
6
+ export { default as DatePickerOnChange } from './_date_picker_on_change.jsx'
6
7
  export { default as DatePickerRange } from './_date_picker_range.jsx'
7
8
  export { default as DatePickerFormat } from './_date_picker_format.jsx'
8
9
  export { default as DatePickerDisabled } from './_date_picker_disabled.jsx'
@@ -18,7 +18,11 @@ type DateRangeStackedProps = {
18
18
 
19
19
  const DateRangeStacked = (props: DateRangeStackedProps) => {
20
20
  const { className, dark = false, endDate, startDate } = props
21
- const css = classnames(className, buildCss('pb_date_range_stacked'), globalProps(props))
21
+ const css = classnames(
22
+ buildCss('pb_date_range_stacked'),
23
+ globalProps(props),
24
+ className
25
+ )
22
26
 
23
27
  return (
24
28
  <div className={css}>
@@ -33,12 +33,12 @@ const DateStacked = (props: DateStackedProps) => {
33
33
  size = 'sm',
34
34
  } = props
35
35
  const classes = classnames(
36
- className,
37
36
  buildCss('pb_date_stacked_kit', align, size, {
38
37
  dark: dark,
39
38
  reverse: reverse,
40
39
  }),
41
- globalProps(props)
40
+ globalProps(props),
41
+ className
42
42
  )
43
43
 
44
44
  const currentYear = new Date().getFullYear().toString()
@@ -20,7 +20,11 @@ type DateYearStackedProps = {
20
20
  const DateYearStacked = (props: DateYearStackedProps) => {
21
21
  const { align = 'left', className, dark = false, date } = props
22
22
  const dateTimestamp = new DateTime({ value: date })
23
- const css = classnames(className, buildCss('pb_date_year_stacked', align), globalProps(props))
23
+ const css = classnames(
24
+ buildCss('pb_date_year_stacked', align),
25
+ globalProps(props),
26
+ className
27
+ )
24
28
 
25
29
  return (
26
30
  <div className={css}>
@@ -23,9 +23,9 @@ type FixedConfirmationToastProps = {
23
23
  const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
24
24
  const { className, status = 'neutral', text } = props
25
25
  const css = classnames(
26
- className,
27
26
  `pb_fixed_confirmation_toast_kit_${status}`,
28
- globalProps(props)
27
+ globalProps(props),
28
+ className
29
29
  )
30
30
  const icon = iconMap[status]
31
31