playbook_ui 4.7.1 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +9 -0
  3. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +8 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +7 -6
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +7 -6
  6. data/app/pb_kits/playbook/pb_currency/_currency.html.erb +2 -1
  7. data/app/pb_kits/playbook/pb_currency/_currency.jsx +11 -3
  8. data/app/pb_kits/playbook/pb_currency/_currency.scss +26 -12
  9. data/app/pb_kits/playbook/pb_currency/currency.rb +22 -6
  10. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.html.erb +23 -0
  11. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.jsx +33 -0
  12. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +2 -2
  13. data/app/pb_kits/playbook/pb_currency/docs/_currency_medium.html.erb +21 -0
  14. data/app/pb_kits/playbook/pb_currency/docs/_currency_medium.jsx +30 -0
  15. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +1 -1
  16. data/app/pb_kits/playbook/pb_currency/docs/{_currency_default.jsx → _currency_small.jsx} +2 -2
  17. data/app/pb_kits/playbook/pb_currency/docs/example.yml +5 -1
  18. data/app/pb_kits/playbook/pb_currency/docs/index.js +3 -1
  19. data/app/pb_kits/playbook/pb_filter/_filter.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +1 -1
  21. data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +88 -0
  22. data/app/pb_kits/playbook/pb_filter/docs/_filter_single.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
  24. data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
  25. data/app/pb_kits/playbook/pb_filter/templates/_core.html.erb +45 -0
  26. data/app/pb_kits/playbook/pb_filter/templates/_default.html.erb +13 -37
  27. data/app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb +1 -0
  28. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +9 -0
  29. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.html.erb +9 -1
  30. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +3 -2
  31. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +8 -2
  32. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +55 -13
  33. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_align.jsx +28 -0
  34. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_default.jsx +4 -1
  35. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_muted.jsx +15 -0
  36. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_value.jsx +20 -0
  37. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_width.jsx +15 -0
  38. data/app/pb_kits/playbook/pb_progress_simple/docs/example.yml +6 -0
  39. data/app/pb_kits/playbook/pb_progress_simple/docs/index.js +4 -0
  40. data/app/pb_kits/playbook/pb_select/_select.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_select/_select.scss +5 -1
  42. data/app/pb_kits/playbook/pb_table/styles/_reset.scss +1 -1
  43. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +4 -1
  44. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +4 -1
  45. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +15 -0
  46. data/app/pb_kits/playbook/pb_textarea/_textarea_mixin.scss +4 -4
  47. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_resize.html.erb +13 -0
  48. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_resize.jsx +33 -0
  49. data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -5
  50. data/app/pb_kits/playbook/pb_textarea/docs/index.js +1 -0
  51. data/app/pb_kits/playbook/pb_textarea/textarea.rb +9 -1
  52. data/app/pb_kits/playbook/plugins/pb_chart.js +5 -0
  53. data/lib/playbook/version.rb +1 -1
  54. metadata +15 -4
  55. data/app/pb_kits/playbook/pb_filter/templates/_single.html.erb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c975f53e3323fae0b26b29d3dc05ecb4fad31ab18dd96962b78155d6a8858650
4
- data.tar.gz: ca9a7e6d1100eb07446f449e5655b676429ccde07e69aea1082cca2ceb73ce8f
3
+ metadata.gz: 297a7d38b579cfb332aef7728a85f5e4e7351c0e281eec399ae42c37fcdd4f7c
4
+ data.tar.gz: aae66abcf5cd0b2bb9c58584ffc0772e05cff4ad7eedb3fbea6a7ac49190b8dd
5
5
  SHA512:
6
- metadata.gz: 9469bc2ebd6a816e0168588759e660cb7fdfba4d57419ba6075a501d51777eb4f243e5d910eb2cb0dfd5b834534abce87028a9492ba643bb4a4be4cc8c932c5b
7
- data.tar.gz: f5244bac194b78ac3a1c09e2e53adc1c7cf4ab2b346c5cae5ac763e8e39f6f75addc128f76d94f49ba91bc68ed6f8c0edcc4ae0e731f54810a5d7b842a415e72
6
+ metadata.gz: b472c19ce31bf2570e6742e8b2c41273eb12ee3dfe56335c8fc8890f444f099a1531717f1dc0d026fb9ba8dc3b2911b5248b7d48ff4025034393160010f51fa2
7
+ data.tar.gz: 98c226e6ae243cdca648d844b13ab401c4b82c2702fe0e63b5d27e9e4b7be2821dd869a773f6808d4d3ba89bcf8085f6670529b36eaa75ae7b38979376000692
@@ -6,6 +6,9 @@ import { pbChart } from '../'
6
6
 
7
7
  type BarGraphProps = {
8
8
  axisTitle: String,
9
+ xAxisCategories: Array,
10
+ yAxisMin: Number,
11
+ yAxisMax: Number,
9
12
  chartData: Array<{
10
13
  name: String,
11
14
  data: Array<Number>,
@@ -27,6 +30,9 @@ export default class BarGraph extends React.Component<BarGraphProps> {
27
30
  componentDidMount() {
28
31
  const {
29
32
  axisTitle,
33
+ xAxisCategories,
34
+ yAxisMin,
35
+ yAxisMax,
30
36
  className,
31
37
  chartData,
32
38
  id,
@@ -44,6 +50,9 @@ export default class BarGraph extends React.Component<BarGraphProps> {
44
50
  subtitle: subTitle,
45
51
  type,
46
52
  title: title,
53
+ xAxisCategories: xAxisCategories,
54
+ yAxisMin: yAxisMin,
55
+ yAxisMax: yAxisMax,
47
56
  })
48
57
  }
49
58
 
@@ -15,6 +15,11 @@ module Playbook
15
15
  prop :point_start, type: Playbook::Props::Numeric
16
16
  prop :subtitle
17
17
  prop :title
18
+ prop :x_axis_categories, type: Playbook::Props::Array,
19
+ default:[]
20
+ prop :y_axis_min, type: Playbook::Props::Numeric
21
+ prop :y_axis_max, type: Playbook::Props::Numeric
22
+
18
23
 
19
24
  def chart_type
20
25
  orientation == "horizontal" ? "bar" : "column"
@@ -29,6 +34,9 @@ module Playbook
29
34
  subtitle: subtitle,
30
35
  axisTitle: axis_title,
31
36
  pointStart: point_start,
37
+ xAxisCategories: x_axis_categories,
38
+ yAxisMin: y_axis_min,
39
+ yAxisMax: y_axis_max,
32
40
  }.to_json.html_safe
33
41
  end
34
42
 
@@ -1,25 +1,26 @@
1
1
  <% data = [{
2
2
  name: 'Installation',
3
- data: [154175]
3
+ data: [1475,200,3000,654,656]
4
4
  }, {
5
5
  name: 'Manufacturing',
6
- data: [40434]
6
+ data: [4434,524,2320,440,500]
7
7
  }, {
8
8
  name: 'Sales & Distribution',
9
- data: [39387]
9
+ data: [3387,743,1344,434,440,]
10
10
  }, {
11
11
  name: 'Project Development',
12
- data: [34227]
12
+ data: [3227,878,999,780,1000]
13
13
  }, {
14
14
  name: 'Other',
15
- data: [18111]
15
+ data: [1111,677,3245,500,200]
16
16
  }] %>
17
17
 
18
18
  <%= pb_rails("bar_graph", props: {
19
19
  axis_title: 'Number of Employees',
20
20
  chart_data: data,
21
21
  id: "bar-test",
22
- point_start: 2012,
22
+ y_axis_min: 0,
23
+ x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
23
24
  subtitle: 'Source: thesolarfoundation.com',
24
25
  title: 'Solar Employment Growth by Sector, 2010-2016'
25
26
  }) %>
@@ -3,19 +3,19 @@ import { BarGraph } from '../../'
3
3
 
4
4
  const chartData = [{
5
5
  name: 'Installation',
6
- data: [154175],
6
+ data: [1475, 200, 3000, 654, 656],
7
7
  }, {
8
8
  name: 'Manufacturing',
9
- data: [40434],
9
+ data: [4434, 524, 2320, 440, 500],
10
10
  }, {
11
11
  name: 'Sales & Distribution',
12
- data: [39387],
12
+ data: [3387, 743, 1344, 434, 440],
13
13
  }, {
14
14
  name: 'Project Development',
15
- data: [34227],
15
+ data: [3227, 878, 999, 780, 1000],
16
16
  }, {
17
17
  name: 'Other',
18
- data: [18111],
18
+ data: [1111, 677, 3245, 500, 200],
19
19
  }]
20
20
 
21
21
  const BarGraphDefault = () => (
@@ -24,9 +24,10 @@ const BarGraphDefault = () => (
24
24
  axisTitle="Number of Employees"
25
25
  chartData={chartData}
26
26
  id="bar-test"
27
- pointStart={2012}
28
27
  subTitle="Source: thesolarfoundation.com"
29
28
  title="Solar Employment Growth by Sector, 2010-2016"
29
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
30
+ yAxisMin={0}
30
31
  />
31
32
  </div>
32
33
  )
@@ -11,7 +11,8 @@
11
11
  <%= pb_rails("body", props: {
12
12
  text: object.units_element,
13
13
  color: "light",
14
- classname: "unit"
14
+ classname: "unit",
15
+ dark: object.dark
15
16
  }) %>
16
17
  </div>
17
18
  <% end %>
@@ -11,13 +11,15 @@ type CurrencyProps = {
11
11
  unit: string,
12
12
  className?: string,
13
13
  label?: string,
14
- size?: 'sm' | 'lg',
14
+ size?: 'sm' | 'md' | 'lg',
15
15
  symbol?: string,
16
+ dark?: boolean,
16
17
  }
17
18
 
18
19
  const sizes = {
19
20
  lg: 1,
20
- sm: 2,
21
+ md: 3,
22
+ sm: 4,
21
23
  }
22
24
 
23
25
  const Currency = ({
@@ -28,23 +30,27 @@ const Currency = ({
28
30
  label = '',
29
31
  size = 'sm',
30
32
  symbol = '$',
33
+ dark = false,
31
34
  }: CurrencyProps) => {
32
35
  const [whole, decimal = '00'] = amount.split('.')
33
36
 
34
37
  return (
35
- <div className={buildCss('pb_currency_kit', align, className)}>
38
+ <div className={buildCss('pb_currency_kit', align, className, { dark: dark }, size)}>
36
39
  <Caption>{label}</Caption>
37
40
 
38
41
  <div className="pb_currency_wrapper">
39
42
  <Body
40
43
  className="dollar_sign"
41
44
  color="light"
45
+ dark={dark}
46
+
42
47
  >
43
48
  {symbol}
44
49
  </Body>
45
50
 
46
51
  <Title
47
52
  className="pb_currency_value"
53
+ dark={dark}
48
54
  size={sizes[size]}
49
55
  >
50
56
  {`${whole}`}
@@ -53,6 +59,8 @@ const Currency = ({
53
59
  <Body
54
60
  className="unit"
55
61
  color="light"
62
+ dark={dark}
63
+
56
64
  >
57
65
  <If condition={unit}>
58
66
  {unit}
@@ -11,7 +11,7 @@
11
11
  }
12
12
  }
13
13
 
14
- &[class*=_right] {
14
+ &[class*=_right] {
15
15
  & > [class^=pb_caption],
16
16
  & > [class^=pb_title],
17
17
  & > [class^=pb_body] {
@@ -21,20 +21,34 @@
21
21
  justify-content: flex-end;
22
22
  }
23
23
  }
24
- }
24
+ [class^=pb_currency_wrapper] {
25
+ display: flex;
25
26
 
26
- [class^=pb_currency_wrapper] {
27
- display: flex;
27
+ & > [class*=dollar_sign] {
28
+ display: flex;
29
+ align-items: flex-start;
30
+ }
31
+ & > [class*=unit] {
32
+ display: flex;
33
+ align-items: flex-end;
34
+ }
35
+ }
28
36
 
29
- & > [class*=dollar_sign] {
30
- display: flex;
31
- align-items: flex-start;
37
+ &[class*=_lg] [class^=pb_currency_wrapper] [class*=pb_currency_value] {
38
+ line-height: .9;
39
+ padding-left: $space_xs - 7px;
40
+ padding-right: $space_xs - 7px;
32
41
  }
33
- & > [class*=unit] {
34
- display: flex;
35
- align-items: flex-end;
42
+
43
+ &[class*=_md] [class^=pb_currency_wrapper] [class*=pb_currency_value] {
44
+ line-height: 1.2;
45
+ padding-left: $space_xs - 7px;
46
+ padding-right: $space_xs - 7px;
36
47
  }
37
- & > [class*=pb_currency_value] {
38
- line-height: .9;
48
+
49
+ &[class*=_sm] [class^=pb_currency_wrapper] [class*=pb_currency_value] {
50
+ line-height: 1.4;
51
+ padding-left: $space_xs - 7px;
52
+ padding-right: $space_xs - 7px;
39
53
  }
40
54
  }
@@ -13,8 +13,8 @@ module Playbook
13
13
  default: "left"
14
14
 
15
15
  prop :size, type: Playbook::Props::Enum,
16
- values: %w[lg sm],
17
- default: "sm"
16
+ values: %w[lg md sm],
17
+ default: "md"
18
18
 
19
19
  prop :label, type: Playbook::Props::String,
20
20
  default: ""
@@ -28,14 +28,18 @@ module Playbook
28
28
  prop :unit, type: Playbook::Props::String,
29
29
  required: false
30
30
 
31
+ prop :dark, type: Playbook::Props::Boolean,
32
+ default: false
33
+
31
34
  def classname
32
- generate_classname("pb_currency_kit", align)
35
+ generate_classname("pb_currency_kit", align, size, dark_class)
33
36
  end
34
37
 
35
38
  def currency_symbol_element
36
39
  pb_dollar_sign = Playbook::PbBody::Body.new(
37
40
  classname: "dollar_sign",
38
- color: "light"
41
+ color: "light",
42
+ dark: dark
39
43
  ) { symbol }
40
44
 
41
45
  ApplicationController.renderer.render(
@@ -58,7 +62,8 @@ module Playbook
58
62
  pb_title = Playbook::PbTitle::Title.new(
59
63
  size: size_value,
60
64
  text: whole_part.first.to_s,
61
- classname: "pb_currency_value"
65
+ classname: "pb_currency_value",
66
+ dark: dark
62
67
  )
63
68
 
64
69
  ApplicationController.renderer.render(
@@ -79,7 +84,18 @@ module Playbook
79
84
  private
80
85
 
81
86
  def size_value
82
- size == "lg" ? 1 : 2
87
+ case size
88
+ when "lg"
89
+ 1
90
+ when "md"
91
+ 3
92
+ else
93
+ 4
94
+ end
95
+ end
96
+
97
+ def dark_class
98
+ dark ? "dark" : nil
83
99
  end
84
100
  end
85
101
  end
@@ -0,0 +1,23 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: "2,000.50",
3
+ size: "lg",
4
+ dark: true
5
+ }) %>
6
+
7
+ <%= pb_rails("currency", props: {
8
+ align: "center",
9
+ amount: "342",
10
+ label: "Caption",
11
+ size: "md",
12
+ symbol: "€",
13
+ dark: true
14
+ }) %>
15
+
16
+ <%= pb_rails("currency", props: {
17
+ align: "right",
18
+ amount: "45",
19
+ label: "Caption",
20
+ unit: "/mo",
21
+ size: "sm",
22
+ dark: true
23
+ }) %>
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import { Currency } from '../../'
3
+
4
+ const CurrencyDark = () => {
5
+ return (
6
+ <div>
7
+ <Currency
8
+ amount="2,000.50"
9
+ dark
10
+ label="Caption"
11
+ size="lg"
12
+ />
13
+ <Currency
14
+ align="center"
15
+ amount="342"
16
+ dark
17
+ label="Caption"
18
+ size="md"
19
+ symbol="€"
20
+ />
21
+ <Currency
22
+ align="right"
23
+ amount="45"
24
+ dark
25
+ label="Caption"
26
+ size="sm"
27
+ unit="/mo"
28
+ />
29
+ </div>
30
+ )
31
+ }
32
+
33
+ export default CurrencyDark
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { Currency } from '../../'
3
3
 
4
- const CurrencyDefault = () => {
4
+ const CurrencyLarge = () => {
5
5
  return (
6
6
  <div>
7
7
  <Currency
@@ -27,4 +27,4 @@ const CurrencyDefault = () => {
27
27
  )
28
28
  }
29
29
 
30
- export default CurrencyDefault
30
+ export default CurrencyLarge
@@ -0,0 +1,21 @@
1
+ <%= pb_rails("currency", props: {
2
+ label: "Caption",
3
+ amount: "2,000.50",
4
+ size: "md",
5
+ }) %>
6
+
7
+ <%= pb_rails("currency", props: {
8
+ align: "center",
9
+ amount: "342",
10
+ label: "Caption",
11
+ size: "md",
12
+ symbol: "€",
13
+ }) %>
14
+
15
+ <%= pb_rails("currency", props: {
16
+ align: "right",
17
+ amount: "45",
18
+ label: "Caption",
19
+ unit: "/mo",
20
+ size: "md",
21
+ }) %>
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { Currency } from '../../'
3
+
4
+ const CurrencyMedium = () => {
5
+ return (
6
+ <div>
7
+ <Currency
8
+ amount="2,000.50"
9
+ label="Caption"
10
+ size="md"
11
+ />
12
+ <Currency
13
+ align="center"
14
+ amount="342"
15
+ label="Caption"
16
+ size="md"
17
+ symbol="€"
18
+ />
19
+ <Currency
20
+ align="right"
21
+ amount="45"
22
+ label="Caption"
23
+ size="md"
24
+ unit="/mo"
25
+ />
26
+ </div>
27
+ )
28
+ }
29
+
30
+ export default CurrencyMedium