playbook_ui 10.15.1 → 10.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +3 -0
  3. data/app/pb_kits/playbook/pb_background/background.test.js +22 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -0
  5. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +3 -0
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.html.erb +26 -0
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +37 -0
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.md +2 -0
  9. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_button/_button.jsx +3 -3
  12. data/app/pb_kits/playbook/pb_button/_button.scss +17 -0
  13. data/app/pb_kits/playbook/pb_button/button.rb +6 -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_caption/_caption.jsx +17 -4
  21. data/app/pb_kits/playbook/pb_caption/_caption.scss +25 -8
  22. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +17 -0
  23. data/app/pb_kits/playbook/pb_caption/caption.rb +5 -1
  24. data/app/pb_kits/playbook/pb_caption/docs/_caption_example.html.erb +3 -0
  25. data/app/pb_kits/playbook/pb_caption/docs/_caption_example.jsx +27 -0
  26. data/app/pb_kits/playbook/pb_caption/docs/_caption_example.md +1 -0
  27. data/app/pb_kits/playbook/pb_caption/docs/example.yml +7 -4
  28. data/app/pb_kits/playbook/pb_caption/docs/index.js +1 -0
  29. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -3
  30. data/app/pb_kits/playbook/pb_card/_card.scss +0 -6
  31. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -8
  32. data/app/pb_kits/playbook/pb_card/card.html.erb +2 -0
  33. data/app/pb_kits/playbook/pb_card/card.rb +0 -8
  34. data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_card/docs/_card_content.html.erb +3 -1
  36. data/app/pb_kits/playbook/pb_card/docs/_card_content.jsx +9 -2
  37. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  38. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +6 -0
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.md +2 -0
  40. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +3 -1
  41. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +13 -4
  42. data/app/pb_kits/playbook/pb_docs/kit_example.rb +4 -0
  43. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +4 -0
  44. data/app/pb_kits/playbook/pb_flex/_flex.jsx +4 -0
  45. data/app/pb_kits/playbook/pb_flex/_flex.scss +17 -1
  46. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -2
  47. data/app/pb_kits/playbook/pb_flex/_flex_item.scss +22 -0
  48. data/app/pb_kits/playbook/pb_flex/docs/_flex_item.html.erb +12 -1
  49. data/app/pb_kits/playbook/pb_flex/docs/_flex_item.md +2 -0
  50. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.html.erb +89 -0
  51. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.jsx +210 -0
  52. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_align_self.md +5 -0
  53. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +27 -0
  54. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.md +2 -0
  55. data/app/pb_kits/playbook/pb_flex/docs/example.yml +2 -0
  56. data/app/pb_kits/playbook/pb_flex/docs/index.js +1 -0
  57. data/app/pb_kits/playbook/pb_flex/flex.rb +14 -1
  58. data/app/pb_kits/playbook/pb_flex/flex_item.rb +16 -1
  59. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
  60. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.html.erb +12 -0
  61. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +19 -0
  62. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.md +2 -0
  63. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +2 -0
  64. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  65. data/app/pb_kits/playbook/pb_gauge/gauge.rb +2 -0
  66. data/app/pb_kits/playbook/pb_icon/icon.rb +4 -0
  67. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +2 -2
  68. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.html.erb +1 -1
  69. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.jsx +1 -1
  70. data/app/pb_kits/playbook/pb_icon_circle/docs/_icon_circle_color.md +1 -0
  71. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
  72. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -0
  73. data/app/pb_kits/playbook/pb_image/_image.jsx +4 -1
  74. data/app/pb_kits/playbook/pb_image/_image.scss +24 -8
  75. data/app/pb_kits/playbook/pb_image/docs/_transition_image.html.erb +54 -0
  76. data/app/pb_kits/playbook/pb_image/docs/_transition_image.jsx +77 -0
  77. data/app/pb_kits/playbook/pb_image/docs/_transition_image.md +1 -0
  78. data/app/pb_kits/playbook/pb_image/docs/example.yml +2 -0
  79. data/app/pb_kits/playbook/pb_image/docs/index.js +1 -0
  80. data/app/pb_kits/playbook/pb_image/image.html.erb +1 -1
  81. data/app/pb_kits/playbook/pb_image/image.rb +8 -1
  82. data/app/pb_kits/playbook/pb_image/image.test.js +9 -4
  83. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +4 -1
  84. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.html.erb +26 -0
  85. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +37 -0
  86. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.md +2 -0
  87. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +2 -0
  88. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
  89. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +3 -0
  90. data/app/pb_kits/playbook/pb_list/list.rb +2 -0
  91. data/app/pb_kits/playbook/pb_select/select.rb +3 -0
  92. data/app/pb_kits/playbook/pb_source/source.rb +3 -0
  93. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -0
  94. data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +4 -1
  95. data/app/pb_kits/playbook/pb_title/title.html.erb +4 -2
  96. data/app/pb_kits/playbook/plugins/pb_chart.js +17 -25
  97. data/app/pb_kits/playbook/tokens/_colors.scss +3 -1
  98. data/app/pb_kits/playbook/utilities/_cursor.scss +3 -0
  99. data/app/pb_kits/playbook/utilities/_display.scss +23 -0
  100. data/app/pb_kits/playbook/utilities/_shadow.scss +11 -0
  101. data/app/pb_kits/playbook/utilities/globalProps.js +19 -1
  102. data/lib/playbook/classnames.rb +3 -0
  103. data/lib/playbook/cursor.rb +29 -0
  104. data/lib/playbook/display.rb +29 -0
  105. data/lib/playbook/engine.rb +0 -1
  106. data/lib/playbook/kit_base.rb +6 -0
  107. data/lib/playbook/markdown/helper.rb +2 -2
  108. data/lib/playbook/pb_doc_helper.rb +4 -0
  109. data/lib/playbook/props/base.rb +2 -2
  110. data/lib/playbook/shadow.rb +29 -0
  111. data/lib/playbook/version.rb +2 -2
  112. data/lib/playbook.rb +3 -0
  113. metadata +45 -15
@@ -48,6 +48,10 @@ module Playbook
48
48
  values: %w[start center end stretch baseline none],
49
49
  default: "none"
50
50
 
51
+ prop :align_self, type: Playbook::Props::Enum,
52
+ values: %w[start end center stretch none],
53
+ default: "none"
54
+
51
55
  prop :wrap, type: Playbook::Props::Boolean,
52
56
  default: false
53
57
 
@@ -62,7 +66,8 @@ module Playbook
62
66
  spacing_class,
63
67
  gap_class,
64
68
  row_gap_class,
65
- column_gap_class)
69
+ column_gap_class,
70
+ align_self_class)
66
71
  end
67
72
 
68
73
  private
@@ -115,6 +120,14 @@ module Playbook
115
120
  end
116
121
  end
117
122
 
123
+ def align_self_class
124
+ if align_self == "none"
125
+ nil
126
+ else
127
+ "align_self_#{align_self}"
128
+ end
129
+ end
130
+
118
131
  def wrap_class
119
132
  wrap ? "wrap" : nil
120
133
  end
@@ -19,8 +19,15 @@ module Playbook
19
19
  values: %w[1 2 3 4 5 6 7 8 9 10 11 12 first none],
20
20
  default: "none"
21
21
 
22
+ prop :align_self, type: Playbook::Props::Enum,
23
+ values: %w[start center end stretch] + [nil],
24
+ default: nil
25
+
26
+ prop :display_flex, type: Playbook::Props::Boolean,
27
+ default: false
28
+
22
29
  def classname
23
- generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, flex_class) + overflow_class + order_class
30
+ generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, flex_class, display_flex_class) + overflow_class + order_class + align_self_class
24
31
  end
25
32
 
26
33
  def style_value
@@ -29,6 +36,14 @@ module Playbook
29
36
 
30
37
  private
31
38
 
39
+ def align_self_class
40
+ align_self ? "align_self_#{align_self}" : ""
41
+ end
42
+
43
+ def display_flex_class
44
+ display_flex ? "display_flex" : nil
45
+ end
46
+
32
47
  def fixed_size_class
33
48
  fixed_size.present? ? "fixed_size" : nil
34
49
  end
@@ -25,6 +25,7 @@ type GaugeProps = {
25
25
  suffix: string,
26
26
  title: string,
27
27
  tooltipHtml: string,
28
+ colors: array,
28
29
  }
29
30
 
30
31
  const Gauge = (props: GaugeProps) => {
@@ -45,6 +46,7 @@ const Gauge = (props: GaugeProps) => {
45
46
  suffix = '',
46
47
  title = '',
47
48
  tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + '<b>{point.y}</b>',
49
+ colors = [],
48
50
  } = props
49
51
 
50
52
  const ariaProps = buildAriaProps(aria)
@@ -76,6 +78,7 @@ const Gauge = (props: GaugeProps) => {
76
78
  style: style,
77
79
  tooltipHtml: tooltipHtml,
78
80
  type: 'gauge',
81
+ colors: colors,
79
82
  })
80
83
  }, [])
81
84
 
@@ -0,0 +1,12 @@
1
+ <% data = [
2
+ {
3
+ name: 'Name',
4
+ value: 67,
5
+ }
6
+ ]%>
7
+
8
+ <%= pb_rails("gauge", props: {
9
+ id: "gauge-colors",
10
+ chart_data: data,
11
+ colors: ['data-7']
12
+ }) %>
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import { Gauge } from '../../'
3
+
4
+ const data = [
5
+ { name: 'Name', value: 67 },
6
+ ]
7
+
8
+ const GaugeColors = (props) => (
9
+ <div>
10
+ <Gauge
11
+ chartData={data}
12
+ id="gauge-colors"
13
+ {...props}
14
+ colors={['data-7']}
15
+ />
16
+ </div>
17
+ )
18
+
19
+ export default GaugeColors
@@ -0,0 +1,2 @@
1
+ Custom data colors allow for color customization to match the needs of business requirements.
2
+ Pass the prop `colors` and use **ONE** desired value `data-1 | data-2 | data-3 | data-4 | data-5 | data-6 | data-7 | data-8` in an array. Hex colors are also available `eg: #CA0095`
@@ -9,6 +9,7 @@ examples:
9
9
  - gauge_min_max: Min Max Labels
10
10
  - gauge_sizing: Sizing
11
11
  - gauge_height: Height
12
+ - gauge_colors: Color Overrides
12
13
 
13
14
 
14
15
  react:
@@ -21,3 +22,4 @@ examples:
21
22
  - gauge_sizing: Sizing
22
23
  - gauge_height: Height
23
24
  - gauge_live_data: Live Data
25
+ - gauge_colors: Color Overrides
@@ -7,3 +7,4 @@ export { default as GaugeSizing } from './_gauge_sizing.jsx'
7
7
  export { default as GaugeTitle } from './_gauge_title.jsx'
8
8
  export { default as GaugeUnits } from './_gauge_units.jsx'
9
9
  export { default as GaugeLiveData } from './_gauge_live_data.jsx'
10
+ export { default as GaugeColors } from './_gauge_colors.jsx'
@@ -20,6 +20,7 @@ module Playbook
20
20
  prop :disable_animation, type: Playbook::Props::Boolean, default: false
21
21
  prop :min, type: Playbook::Props::Numeric, default: 0
22
22
  prop :max, type: Playbook::Props::Numeric, default: 100
23
+ prop :colors, type: Playbook::Props::Array, default: []
23
24
 
24
25
  def chart_data_formatted
25
26
  chart_data.map { |hash| hash[:y] = hash.delete :value }
@@ -42,6 +43,7 @@ module Playbook
42
43
  style: style,
43
44
  tooltipHtml: tooltip_html,
44
45
  type: "gauge",
46
+ colors: colors,
45
47
  }.to_json.html_safe
46
48
  end
47
49
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Style/StringConcatenation, Style/HashLikeCase
4
+
3
5
  require "open-uri"
4
6
 
5
7
  module Playbook
@@ -135,3 +137,5 @@ module Playbook
135
137
  end
136
138
  end
137
139
  end
140
+
141
+ # rubocop:enable Style/StringConcatenation, Style/HashLikeCase
@@ -52,9 +52,9 @@ $pb_icon_circle_sizes: (
52
52
  @each $color_name, $color_value in $colors {
53
53
  &[class*=_#{$color_name}] {
54
54
  color: $color_value;
55
- background: rgba(mix($bg_dark, $color_value, 10%), $opacity_2);
55
+ background: rgba(mix($bg_dark, $color_value, 10%), $opacity_1);
56
56
  &.dark {
57
- background: rgba(mix($bg_dark, $color_value, 10%), $opacity_5);
57
+ background: rgba(mix($bg_dark, $color_value, 10%), $opacity_2);
58
58
  }
59
59
  }
60
60
  }
@@ -5,7 +5,7 @@
5
5
  }) %>
6
6
  <%= pb_rails("icon_circle", props: {
7
7
  icon: "archive",
8
- variant: "blue",
8
+ variant: "orange",
9
9
  size: "sm"
10
10
  }) %>
11
11
  <%= pb_rails("icon_circle", props: {
@@ -15,7 +15,7 @@ const IconCircleColor = (props) => {
15
15
  <IconCircle
16
16
  icon="rocket"
17
17
  size="sm"
18
- variant="blue"
18
+ variant="orange"
19
19
  {...props}
20
20
  />
21
21
  <br />
@@ -0,0 +1 @@
1
+ Customize your icon circle by passing one of our seven base colors to the `variant` prop: `royal` `blue` `orange` `purple` `teal` `red` `yellow` `green`
@@ -8,7 +8,7 @@ module Playbook
8
8
  values: %w[xs sm md base lg xl],
9
9
  default: "md"
10
10
  prop :variant, type: Playbook::Props::Enum,
11
- values: %w[default royal blue purple teal red yellow green],
11
+ values: %w[default royal blue orange purple teal red yellow green],
12
12
  default: "default"
13
13
 
14
14
  def classname
@@ -33,6 +33,7 @@ module Playbook
33
33
  end
34
34
 
35
35
  def title_size
36
+ # rubocop:disable Style/CaseLikeIf
36
37
  if size == "lg"
37
38
  1
38
39
  elsif size == "md"
@@ -40,6 +41,7 @@ module Playbook
40
41
  else
41
42
  3
42
43
  end
44
+ # rubocop:enable Style/CaseLikeIf
43
45
  end
44
46
  end
45
47
  end
@@ -14,6 +14,7 @@ type ImageProps = {
14
14
  onError?: () => {},
15
15
  size: "xs" | "sm" | "md" | "lg" | "xl",
16
16
  rounded?: boolean,
17
+ transition: "blur" | "fade" | "scale",
17
18
  url: string,
18
19
  }
19
20
 
@@ -27,6 +28,7 @@ const Image = (props: ImageProps) => {
27
28
  onError = null,
28
29
  rounded = false,
29
30
  size = '',
31
+ transition = 'fade',
30
32
  url = '',
31
33
  } = props
32
34
 
@@ -34,7 +36,7 @@ const Image = (props: ImageProps) => {
34
36
  const classes = classnames(
35
37
  buildCss('pb_image_kit', size),
36
38
  'lazyload',
37
- 'blur_up',
39
+ transition,
38
40
  { rounded },
39
41
  globalProps(props),
40
42
  className
@@ -53,6 +55,7 @@ const Image = (props: ImageProps) => {
53
55
  onError={onError}
54
56
  rounded={+rounded}
55
57
  src={url}
58
+ transition={transition}
56
59
  />
57
60
  </div>
58
61
  )
@@ -28,15 +28,31 @@ $image-sizes: (
28
28
  border-radius: $border-rad-heaviest;
29
29
  }
30
30
 
31
- .blur_up {
32
- -webkit-filter: blur(6px);
33
- filter: blur(6px);
34
- transition: filter 550ms, -webkit-filter 550ms;
31
+ &.fade {
32
+ opacity: 0;
33
+ &.lazyloaded {
34
+ opacity: 1;
35
+ transition: opacity 300ms ease-in;
36
+ }
35
37
  }
36
-
37
- .blur_up.lazyloaded {
38
- -webkit-filter: blur(0);
39
- filter: blur(0);
38
+
39
+ &.blur {
40
+ filter: blur(5px);
41
+ &.lazyloaded {
42
+ -webkit-filter: blur(0);
43
+ filter: blur(0);
44
+ transition: filter 300ms ease-in;
45
+ }
46
+ }
47
+
48
+ &.scale {
49
+ opacity: 0;
50
+ transform: scale(0.9);
51
+ &.lazyloaded {
52
+ opacity: 1;
53
+ transform: scale(1);
54
+ transition: 700ms ease-in;
55
+ }
40
56
  }
41
57
  }
42
58
  }
@@ -0,0 +1,54 @@
1
+ <%= pb_rails("flex") do %>
2
+ <%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %>
3
+ <%= pb_rails("select", props: {
4
+ id: "transition-dropdown",
5
+ label: "",
6
+ blank_selection: "Select a Transition...",
7
+ options: [
8
+ {
9
+ value: 'fade',
10
+ },
11
+ {
12
+ value: 'blur',
13
+ },
14
+ {
15
+ value: 'scale',
16
+ },
17
+ ]
18
+ }) %>
19
+ <% end %>
20
+ <%= pb_rails("flex/flex_item") do %>
21
+ <%= pb_rails("button", props: {classname: "button", text: "Load Image", margin_left: "sm", margin_top: "xs", disabled: true }) %>
22
+ <% end %>
23
+ <% end %>
24
+ <%= pb_rails("image", props: { classname: "transition-image", alt: "picture of a misty forest", url: "", on_error: "this.style.display = 'none'" }) %>
25
+
26
+ <script>
27
+ window.addEventListener('DOMContentLoaded', () => {
28
+ const button = document.querySelector(".button")
29
+ const transitionDropdown = document.querySelector("#transition-dropdown")
30
+ var option = ''
31
+
32
+ transitionDropdown.addEventListener('change', function() {
33
+ if (this.value === '') {
34
+ button.className = button.className + ' _disabled'
35
+ } else {
36
+ button.removeAttribute("disabled");
37
+ button.className = button.className.replace(/\_disabled/gi, '')
38
+ option = this.value
39
+ }
40
+ });
41
+
42
+ const updateTransition = (transition) => {
43
+ const imageTransition = document.querySelector('.transition-image')
44
+ imageTransition.removeAttribute("style")
45
+ imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded")
46
+ imageTransition.classList.add(transition, "lazyload")
47
+ imageTransition.src = "https://unsplash.it/500/400/?image=634"
48
+ }
49
+
50
+ button.addEventListener('click', function() {
51
+ updateTransition(option)
52
+ })
53
+ });
54
+ </script>
@@ -0,0 +1,77 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Image from '../_image'
4
+ import Select from '../../pb_select/_select'
5
+ import FlexItem from '../../pb_flex/_flex_item'
6
+ import Flex from '../../pb_flex/_flex'
7
+ import Button from '../../pb_button/_button'
8
+
9
+ const TransitionImage = (props) => {
10
+ const [transition, setTransition] = useState('')
11
+ const [apply, setApply] = useState({
12
+ url: '',
13
+ transition: '',
14
+ })
15
+
16
+ const loadImage = () => {
17
+ document.querySelector('.image').classList.remove(transition, 'lazyloaded')
18
+ setApply({
19
+ url: 'https://unsplash.it/500/400/?image=634',
20
+ transition: transition,
21
+ },
22
+ document.querySelector('.image').classList.add(transition, 'lazyload')
23
+ )
24
+ }
25
+
26
+ const handleTransition = ({ target }) => {
27
+ setTransition(target.value)
28
+ }
29
+
30
+ const options = [
31
+ {
32
+ value: 'fade',
33
+ },
34
+ {
35
+ value: 'blur',
36
+ },
37
+ {
38
+ value: 'scale',
39
+ },
40
+ ]
41
+
42
+ return (
43
+ <>
44
+ <Flex>
45
+ <FlexItem fixedSize="250px">
46
+ <Select
47
+ blankSelection="Select a Transition..."
48
+ label=""
49
+ onChange={handleTransition}
50
+ options={options}
51
+ {...props}
52
+ />
53
+ </FlexItem>
54
+ <FlexItem>
55
+ <Button
56
+ disabled={transition === '' ? true : false}
57
+ marginLeft="sm"
58
+ onClick={loadImage}
59
+ text="Load Image"
60
+ {...props}
61
+ />
62
+ </FlexItem>
63
+ </Flex>
64
+ <div style={{ display: apply.url === '' ? 'none' : 'block' }}>
65
+ <Image
66
+ alt="picture of a misty forest"
67
+ className="image"
68
+ transition={apply.transition}
69
+ url={apply.url}
70
+ {...props}
71
+ />
72
+ </div>
73
+ </>
74
+ )
75
+ }
76
+
77
+ export default TransitionImage
@@ -0,0 +1 @@
1
+ To add a transition, simply use the `transition` prop and one of the three string options `"fade"`, `"blur"`, or `"scale"`.
@@ -3,7 +3,9 @@ examples:
3
3
  - default_image: Default
4
4
  - rounded_image: Rounded
5
5
  - custom_error_image: Error Handling
6
+ - transition_image: Transition
6
7
  react:
7
8
  - default_image: Default
8
9
  - rounded_image: Rounded
9
10
  - custom_error_image: Error Handling
11
+ - transition_image: Transition
@@ -1,3 +1,4 @@
1
1
  export { default as DefaultImage } from './_default_image.jsx'
2
2
  export { default as RoundedImage } from './_rounded_image.jsx'
3
3
  export { default as CustomErrorImage } from './_custom_error_image.jsx'
4
+ export { default as TransitionImage } from './_transition_image.jsx'
@@ -7,4 +7,4 @@
7
7
  alt: object.alt,
8
8
  onerror: object.on_error,
9
9
  )
10
- %>
10
+ %>
@@ -11,10 +11,13 @@ module Playbook
11
11
  prop :size, type: Playbook::Props::Enum,
12
12
  values: %w[xs sm md lg xl none],
13
13
  default: "none"
14
+ prop :transition, type: Playbook::Props::Enum,
15
+ values: %w[blur fade scale none],
16
+ default: "fade"
14
17
  prop :url
15
18
 
16
19
  def classname
17
- generate_classname("pb_image_kit#{size_class} lazyload blur_up") + rounded_class
20
+ generate_classname("pb_image_kit#{size_class} #{transition_class} lazyload") + rounded_class
18
21
  end
19
22
 
20
23
  private
@@ -26,6 +29,10 @@ module Playbook
26
29
  def size_class
27
30
  size == "none" ? nil : "_#{size}"
28
31
  end
32
+
33
+ def transition_class
34
+ transition == "none" ? nil : transition
35
+ end
29
36
  end
30
37
  end
31
38
  end
@@ -7,6 +7,7 @@ const props = {
7
7
  data: { testid: 'avatar' },
8
8
  size: null,
9
9
  url: 'https://unsplash.it/500/400/?image=634',
10
+ transition: 'blur',
10
11
  }
11
12
 
12
13
  it('Should be accessible', async () => {
@@ -20,16 +21,20 @@ test('alt attribute', () => {
20
21
 
21
22
  test('default classname', () => {
22
23
  const kit = renderKit(Image, props)
23
- expect(kit).toHaveClass('pb_image_kit lazyload blur_up')
24
+ expect(kit).toHaveClass('pb_image_kit lazyload')
24
25
  })
25
26
 
26
27
  test('size = xs', () => {
27
28
  const kit = renderKit(Image, props, { size: 'xs' })
28
- expect(kit).toHaveClass('pb_image_kit_xs lazyload blur_up')
29
+ expect(kit).toHaveClass('pb_image_kit_xs lazyload')
30
+ })
31
+
32
+ test('transition = blur', () => {
33
+ const kit = renderKit(Image, props, { transition: 'blur' })
34
+ expect(kit).toHaveClass('pb_image_kit lazyload blur')
29
35
  })
30
36
 
31
37
  test('rounded = true', () => {
32
38
  const kit = renderKit(Image, props, { rounded: true })
33
- expect(kit).toHaveClass('pb_image_kit lazyload blur_up rounded')
39
+ expect(kit).toHaveClass('pb_image_kit lazyload rounded')
34
40
  })
35
-
@@ -25,7 +25,8 @@ type LineGraphProps = {
25
25
  legend?: boolean,
26
26
  toggleLegendClick?: boolean,
27
27
  height?: string,
28
- }
28
+ colors: array,
29
+ }
29
30
 
30
31
  export default class LineGraph extends React.Component<LineGraphProps> {
31
32
  static defaultProps = {
@@ -52,11 +53,13 @@ export default class LineGraph extends React.Component<LineGraphProps> {
52
53
  legend,
53
54
  toggleLegendClick,
54
55
  height,
56
+ colors = [],
55
57
  } = this.props
56
58
 
57
59
  new pbChart(`.${className}`, {
58
60
  axisTitle: axisTitle,
59
61
  chartData: chartData,
62
+ colors: colors,
60
63
  id: id,
61
64
  pointStart: pointStart,
62
65
  subtitle: subTitle,
@@ -0,0 +1,26 @@
1
+ <% data = [{
2
+ name: 'Installation',
3
+ data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
4
+ }, {
5
+ name: 'Manufacturing',
6
+ data: [24916, 28064, 29742, 40851, 50590, 65282, 70121, 85434]
7
+ }, {
8
+ name: 'Sales & Distribution',
9
+ data: [11744, 17722, 16005, 19771, 25185, 28377, 36147, 43387]
10
+ }, {
11
+ name: 'Project Development',
12
+ data: [5332, 6344, 7988, 12169, 15112, 14452, 22400, 30227]
13
+ }, {
14
+ name: 'Other',
15
+ data: [nil, nil, nil, 3112, 4989, 5816, 15274, 18111]
16
+ }] %>
17
+
18
+ <%= pb_rails("line_graph", props: {
19
+ id: "line-colors",
20
+ gradient: false,
21
+ chart_data: data,
22
+ x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
23
+ title: 'Line Graph with Custom Data Colors',
24
+ axis_title: 'Number of Employees',
25
+ colors: ['data-4', 'data-5', 'data-6', 'data-7', 'data-8']
26
+ }) %>
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+
3
+ import LineGraph from '../_line_graph'
4
+
5
+ const data = [{
6
+ name: 'Installation',
7
+ data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],
8
+ }, {
9
+ name: 'Manufacturing',
10
+ data: [24916, 28064, 29742, 40851, 50590, 65282, 70121, 85434],
11
+ }, {
12
+ name: 'Sales & Distribution',
13
+ data: [11744, 17722, 16005, 19771, 25185, 28377, 36147, 43387],
14
+ }, {
15
+ name: 'Project Development',
16
+ data: [5332, 6344, 7988, 12169, 15112, 14452, 22400, 30227],
17
+ }, {
18
+ name: 'Other',
19
+ data: [null, null, null, 3112, 4989, 5816, 15274, 18111],
20
+ }]
21
+
22
+ const LineGraphColors = (props) => (
23
+ <div>
24
+ <LineGraph
25
+ axisTitle="Number of Employees"
26
+ chartData={data}
27
+ colors={['data-4', 'data-5', 'data-6', 'data-7', 'data-8']}
28
+ id="line-colors"
29
+ title="Line Graph with Custom Data Colors"
30
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
31
+ yAxisMin={0}
32
+ {...props}
33
+ />
34
+ </div>
35
+ )
36
+
37
+ export default LineGraphColors
@@ -0,0 +1,2 @@
1
+ Custom data colors allow for color customization to match the needs of business requirements.
2
+ Pass the prop `colors` and use desired values `data-1 | data-2 | data-3 | data-4 | data-5 | data-6 | data-7 | data-8` in an array. Hex colors are also available `eg: #CA0095`
@@ -5,6 +5,7 @@ examples:
5
5
  - line_graph_legend: Legend
6
6
  - line_graph_legend_nonclickable: Legend Nonclickable
7
7
  - line_graph_height: Height
8
+ - line_graph_colors: Color Overrides
8
9
 
9
10
 
10
11
  react:
@@ -12,3 +13,4 @@ examples:
12
13
  - line_graph_legend: Legend
13
14
  - line_graph_legend_nonclickable: Legend Nonclickable
14
15
  - line_graph_height: Height
16
+ - line_graph_colors: Color Overrides
@@ -2,3 +2,4 @@ export { default as LineGraphDefault } from './_line_graph_default.jsx'
2
2
  export { default as LineGraphLegend } from './_line_graph_legend.jsx'
3
3
  export { default as LineGraphLegendNonclickable } from './_line_graph_legend_nonclickable.jsx'
4
4
  export { default as LineGraphHeight } from './_line_graph_height.jsx'
5
+ export { default as LineGraphColors } from './_line_graph_colors.jsx'
@@ -20,6 +20,8 @@ module Playbook
20
20
  prop :toggle_legend_click, type: Playbook::Props::Boolean,
21
21
  default: true
22
22
  prop :height
23
+ prop :colors, type: Playbook::Props::Array,
24
+ default: []
23
25
 
24
26
  def chart_type
25
27
  gradient ? "area" : "line"
@@ -41,6 +43,7 @@ module Playbook
41
43
  legend: legend,
42
44
  toggleLegendClick: toggle_legend_click,
43
45
  height: height,
46
+ colors: colors,
44
47
  }
45
48
  end
46
49