playbook_ui 10.23.0.pre.cachetest → 10.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/index.js +0 -3
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
  5. data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +13 -14
  6. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  7. data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
  9. data/app/pb_kits/playbook/pb_background/_background.jsx +18 -4
  10. data/app/pb_kits/playbook/pb_background/_background.scss +23 -7
  11. data/app/pb_kits/playbook/pb_background/background.html.erb +5 -2
  12. data/app/pb_kits/playbook/pb_background/background.rb +33 -6
  13. data/app/pb_kits/playbook/pb_background/background.test.js +17 -0
  14. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
  15. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
  16. data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
  17. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_background/docs/_background_size.html.erb +5 -0
  19. data/app/pb_kits/playbook/pb_background/docs/_background_size.jsx +36 -0
  20. data/app/pb_kits/playbook/pb_background/docs/_background_size.md +3 -0
  21. data/app/pb_kits/playbook/pb_background/docs/_description.md +3 -1
  22. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  24. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
  25. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
  26. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +2 -2
  27. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_button/_button.jsx +8 -4
  29. data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
  30. data/app/pb_kits/playbook/pb_button/button.rb +13 -3
  31. data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
  32. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
  33. data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
  34. data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
  35. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
  36. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
  37. data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
  38. data/app/pb_kits/playbook/pb_button/docs/example.yml +4 -0
  39. data/app/pb_kits/playbook/pb_button/docs/index.js +2 -0
  40. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
  41. data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
  42. data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
  43. data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
  44. data/app/pb_kits/playbook/pb_card/card.rb +88 -0
  45. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
  46. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
  47. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
  48. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
  49. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
  53. data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
  54. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  55. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
  56. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
  57. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  58. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  59. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  60. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
  61. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
  62. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +13 -1
  63. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.html.erb +13 -6
  64. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +9 -0
  65. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +3 -3
  67. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
  68. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
  69. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
  70. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md +2 -2
  71. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
  72. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
  73. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
  74. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
  75. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  76. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
  78. data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
  79. data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
  80. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
  81. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
  82. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
  83. data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
  84. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
  85. data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
  86. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  87. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
  88. data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
  89. data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
  90. data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
  91. data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
  92. data/app/pb_kits/playbook/pb_image/image.rb +1 -1
  93. data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
  94. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
  95. data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
  96. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
  97. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
  98. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
  99. data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
  100. data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
  101. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
  102. data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
  103. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -2
  104. data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
  105. data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
  106. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
  107. data/app/pb_kits/playbook/pb_popover/index.js +4 -9
  108. data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
  109. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
  110. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
  111. data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
  112. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
  113. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  114. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
  115. data/app/pb_kits/playbook/pb_select/_select.jsx +2 -2
  116. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb +2 -0
  117. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +1 -1
  118. data/app/pb_kits/playbook/pb_stat_value/stat_value.rb +2 -2
  119. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  120. data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
  121. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +24 -19
  122. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  123. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
  124. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
  125. data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
  126. data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
  127. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  128. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  129. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
  130. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
  131. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
  132. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
  133. data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
  134. data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
  135. data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
  136. data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
  137. data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
  138. data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
  139. data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
  140. data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
  141. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
  142. data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
  143. data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
  144. data/app/pb_kits/playbook/utilities/_order.scss +55 -0
  145. data/app/pb_kits/playbook/utilities/globalProps.ts +297 -0
  146. data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
  147. data/lib/playbook/align_content.rb +29 -0
  148. data/lib/playbook/align_items.rb +29 -0
  149. data/lib/playbook/align_self.rb +29 -0
  150. data/lib/playbook/classnames.rb +11 -0
  151. data/lib/playbook/flex.rb +29 -0
  152. data/lib/playbook/flex_direction.rb +29 -0
  153. data/lib/playbook/flex_grow.rb +29 -0
  154. data/lib/playbook/flex_shrink.rb +29 -0
  155. data/lib/playbook/flex_wrap.rb +29 -0
  156. data/lib/playbook/justify_content.rb +29 -0
  157. data/lib/playbook/justify_self.rb +29 -0
  158. data/lib/playbook/kit_base.rb +22 -0
  159. data/lib/playbook/order.rb +29 -0
  160. data/lib/playbook/version.rb +2 -2
  161. metadata +47 -11
  162. data/app/pb_kits/playbook/types.js +0 -4
  163. data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d85218c29eb499b6f71d42d3b99307a6f5563671d4af53e4e3ac380779049bd
4
- data.tar.gz: a8e220e1252b1b21fa92adbf601532c483164950169f7d6ce79e8d6e1f0e8b1e
3
+ metadata.gz: 813bd55479e3f61b872582fd3555ef0810a2e1b2e8c37a3b214664721cccb715
4
+ data.tar.gz: 4a5f12fddfeeefb71326570f2c93e86eb484c114acd0e81f831bfc80b5566d13
5
5
  SHA512:
6
- metadata.gz: 986b7423cafa276bb7931cec9e32fcb57867f7a303b810babcc9524c0591314da7fcdc52f73c89726115c1543e553eec856b3c2ed73b0af9c53b3cc88ffa0c77
7
- data.tar.gz: 0f245ee82c1ba4b42c6daa7a9444d7106f022a1510f6f2b7473430a2cddf6c6981d9a48f17bebc902990dca4829e84ebb5c1389d0436229ca1c7332418d1a370
6
+ metadata.gz: 4bc3c1d358cc2c4c9e71ae6926827cf25a9895fd62de2db3841f7b1ef58a8c6c1e896991f0c0420cd44828f3812c4e3675539ca4ed318d39b70fefef22d089ab
7
+ data.tar.gz: b9680edc3f28085f3eae5edcbdb2c3fbc3a8a22b8ad8ec1bb5d9744fcc16b39133abbcfaeafd582f00d4b9505bee699b6941a5514c6b11147c1ede51a4bfa021
@@ -100,3 +100,4 @@
100
100
  @import './utilities/shadow';
101
101
  @import './utilities/line_height';
102
102
  @import './utilities/display';
103
+ @import './utilities/flexbox';
@@ -118,6 +118,3 @@ export { default as PbTable } from './pb_table'
118
118
  export { default as PbTextarea } from './pb_textarea'
119
119
  export { default as PbTooltip } from './pb_tooltip'
120
120
  export { default as PbTypeahead } from './pb_typeahead'
121
-
122
- // eslint-disable-next-line no-console
123
- console.log('CACHE BUSTED')
@@ -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;
@@ -1,8 +1,5 @@
1
- /* @flow */
2
-
3
1
  import React, { useState } from 'react'
4
2
  import classnames from 'classnames'
5
- import { map } from 'lodash'
6
3
 
7
4
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
5
  import { globalProps } from '../utilities/globalProps'
@@ -11,9 +8,9 @@ import Image from '../pb_image/_image'
11
8
  import OnlineStatus from '../pb_online_status/_online_status'
12
9
 
13
10
  type AvatarProps = {
14
- aria?: object,
11
+ aria?: {[key: string]: string},
15
12
  className?: string,
16
- data?: object,
13
+ data?: {[key: string]: string},
17
14
  dark?: boolean,
18
15
  id?: string,
19
16
  imageAlt?: string,
@@ -23,8 +20,8 @@ type AvatarProps = {
23
20
  status: "away" | "offline" | "online",
24
21
  }
25
22
 
26
- const firstTwoInitials = (name) =>
27
- map(name.split(/\s/), (name) => name[0])
23
+ const firstTwoInitials = (name: string) =>
24
+ name.split(/\s/).map((name) => name[0])
28
25
  .join('')
29
26
  .substring(0, 2)
30
27
 
@@ -41,10 +38,10 @@ const Avatar = (props: AvatarProps) => {
41
38
  status = null,
42
39
  dark = false,
43
40
  } = props
44
- const dataProps = buildDataProps(data)
45
- const ariaProps = buildAriaProps(aria)
41
+ const dataProps: {[key: string]: any} = buildDataProps(data)
42
+ const ariaProps: {[key: string]: any} = buildAriaProps(aria)
46
43
  const classes = classnames(
47
- buildCss('pb_avatar_kit', size),
44
+ buildCss('pb_avatar_kit', `size_${size}`),
48
45
  globalProps(props),
49
46
  className
50
47
  )
@@ -55,6 +52,8 @@ const Avatar = (props: AvatarProps) => {
55
52
  const [error, setError] = useState(false)
56
53
  const handleError = () => setError(true)
57
54
 
55
+ const canShowImage = imageUrl && !error
56
+
58
57
  return (
59
58
  <div
60
59
  {...ariaProps}
@@ -66,21 +65,21 @@ const Avatar = (props: AvatarProps) => {
66
65
  className="avatar_wrapper"
67
66
  data-initials={initials}
68
67
  >
69
- <If condition={imageUrl && !error}>
68
+ { canShowImage && (
70
69
  <Image
71
70
  alt={imageAlt}
72
71
  onError={handleError}
73
72
  url={imageUrl}
74
73
  />
75
- </If>
74
+ )}
76
75
  </div>
77
- <If condition={status}>
76
+ {status && (
78
77
  <OnlineStatus
79
78
  className={`size_${size}`}
80
79
  dark={dark}
81
80
  status={status}
82
81
  />
83
- </If>
82
+ )}
84
83
  </div>
85
84
  )
86
85
  }
@@ -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,7 +8,7 @@ import {
8
8
  buildCss,
9
9
  buildDataProps,
10
10
  } from '../utilities/props'
11
- import { globalProps } from '../utilities/globalProps.js'
11
+ import { globalProps } from '../utilities/globalProps'
12
12
 
13
13
  import Avatar from '../pb_avatar/_avatar'
14
14
  import Icon from '../pb_icon/_icon'
@@ -3,46 +3,59 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps.js'
6
+ import { globalProps } from '../utilities/globalProps'
7
7
 
8
8
  type BackgroundProps = {
9
+ alt?: string,
9
10
  aria?: object,
10
11
  backgroundColor?: 'gradient' | 'dark' | 'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'category_1' | 'category_2' | 'category_3' | 'category_4' | 'category_5' | 'category_6' | 'category_7' | 'category_8' | 'category_9' | 'category_10' | 'category_11' | 'category_12' | 'category_13' | 'category_14' | 'category_15' | 'category_16' | 'category_17' | 'category_18' | 'category_19' | 'category_20' | 'category_21',
12
+ backgroundRepeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | 'initial' | 'inherit',
13
+ backgroundSize?: 'auto' | 'cover' | 'contain',
11
14
  children?: array<React.ReactNode> | React.ReactNode,
12
15
  className?: string,
16
+ customColor?: string,
13
17
  data?: object,
14
18
  id?: string,
15
19
  imageUrl?: string,
16
20
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
17
21
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
22
+ transition?: 'fade' | 'blur' | 'scale',
18
23
  }
19
24
 
20
25
  const Background = (props: BackgroundProps) => {
21
26
  const {
27
+ alt = '',
22
28
  aria = {},
23
29
  backgroundColor = 'light',
30
+ backgroundRepeat = 'initial',
31
+ backgroundSize = 'cover',
24
32
  children,
25
33
  className,
34
+ customColor,
26
35
  data = {},
27
36
  id,
28
37
  imageUrl = '',
29
38
  tag = 'div',
39
+ transition = '',
30
40
  } = props
31
41
 
32
42
  const ariaProps = buildAriaProps(aria)
33
43
  const dataProps = buildDataProps(data)
34
44
 
35
- const classes = classnames(buildCss('pb_background_kit'), globalProps(props), `pb_background_color_${backgroundColor}`, className)
36
- const Tag = `${tag}`
37
45
  const backgroundStyle = {
38
46
  backgroundImage: `url(${imageUrl})`,
39
- backgroundSize: 'cover',
47
+ backgroundRepeat: `${backgroundRepeat}`,
48
+ backgroundSize: `${backgroundSize}`,
40
49
  }
50
+ const getBackgroundColor = customColor ? 'pb_background_custom_color' : `pb_background_color_${backgroundColor}`
51
+ const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), getBackgroundColor, className)
52
+ const Tag = `${tag}`
41
53
 
42
54
  return (
43
55
  <>
44
56
  <If condition={imageUrl}>
45
57
  <Tag
58
+ alt={alt}
46
59
  style={backgroundStyle}
47
60
  {...ariaProps}
48
61
  {...dataProps}
@@ -57,6 +70,7 @@ const Background = (props: BackgroundProps) => {
57
70
  {...dataProps}
58
71
  className={classes}
59
72
  id={id}
73
+ style={customColor ? { backgroundColor: customColor } : null}
60
74
  >
61
75
  { children }
62
76
  </Tag>
@@ -22,14 +22,30 @@ $background_colors: map-merge($additional_colors, $merge_kits2);
22
22
  }
23
23
  };
24
24
 
25
- .blur_up {
26
- -webkit-filter: blur(6px);
27
- filter: blur(6px);
28
- transition: filter 550ms, -webkit-filter 550ms;
25
+ &.fade {
26
+ opacity: 0;
27
+ &.lazyloaded {
28
+ opacity: 1;
29
+ transition: opacity 400ms ease-in;
30
+ }
29
31
  }
30
32
 
31
- .blur_up.lazyloaded {
32
- -webkit-filter: blur(0);
33
- filter: blur(0);
33
+ &.blur {
34
+ filter: blur(5px);
35
+ &.lazyloaded {
36
+ -webkit-filter: blur(0);
37
+ filter: blur(0);
38
+ transition: filter 400ms ease-in;
39
+ }
40
+ }
41
+
42
+ &.scale {
43
+ opacity: 0;
44
+ transform: scale(0.9);
45
+ &.lazyloaded {
46
+ opacity: 1;
47
+ transform: scale(1);
48
+ transition: 700ms ease-in;
49
+ }
34
50
  }
35
51
  }
@@ -4,7 +4,9 @@
4
4
  data: object.data,
5
5
  id: object.id,
6
6
  class: object.classname,
7
- style: "background-image: url('#{object.image_url}');"
7
+ style: "background-image: url('#{object.image_url}');
8
+ background-repeat: #{object.background_repeat};
9
+ background-size: #{object.background_size};"
8
10
  ) do %>
9
11
  <%= content.presence %>
10
12
  <% end %>
@@ -13,7 +15,8 @@
13
15
  aria: object.aria,
14
16
  data: object.data,
15
17
  id: object.id,
16
- class: object.classname
18
+ class: object.classname,
19
+ style: object.custom_background_color
17
20
  ) do %>
18
21
  <%= content.presence %>
19
22
  <% end %>
@@ -6,24 +6,51 @@ module Playbook
6
6
  prop :background_color, type: Playbook::Props::Enum,
7
7
  values: %w[gradient dark light white success warning error info neutral primary category_1 category_2 category_3 category_4 category_5 category_6 category_7 category_8 category_9 category_10 category_11 category_12 category_13 category_14 category_15 category_16 category_17 category_18 category_19 category_20 category_21],
8
8
  default: "light"
9
+
10
+ prop :background_repeat, type: Playbook::Props::Enum,
11
+ values: %w[
12
+ repeat
13
+ repeat-x
14
+ repeat-y
15
+ no-repeat
16
+ space
17
+ round
18
+ initial
19
+ inherit
20
+ ],
21
+ default: "initial"
22
+
23
+ prop :background_size, type: Playbook::Props::Enum,
24
+ values: %w[contain cover auto],
25
+ default: "cover"
26
+
9
27
  prop :image_url
10
28
 
11
29
  prop :tag, type: Playbook::Props::Enum,
12
30
  values: %w[h1 h2 h3 h4 h5 h6 p div span],
13
31
  default: "div"
14
32
 
33
+ prop :transition, type: Playbook::Props::Enum,
34
+ values: ["blur", "fade", "scale", nil],
35
+ default: nil
36
+
37
+ prop :custom_color, type: Playbook::Props::String,
38
+ default: nil
39
+
15
40
  def classname
16
- generate_classname("pb_background_kit", image_classname, background_color_classname, separator: " ")
41
+ generate_classname("pb_background_kit", image_classname, separator: " ")
42
+ end
43
+
44
+ def custom_background_color
45
+ "background-color: #{custom_color};"
17
46
  end
18
47
 
19
48
  private
20
49
 
21
50
  def image_classname
22
- image_url.present? ? "lazyload blur_up" : ""
23
- end
24
-
25
- def background_color_classname
26
- !image_url.present? ? "pb_background_color_#{background_color}" : ""
51
+ background_class = custom_color.present? ? "pb_background_custom_color" : "pb_background_color_#{background_color}"
52
+ background_class_lazy = image_url.present? ? " lazyload #{transition}" : ""
53
+ "#{background_class}#{background_class_lazy}"
27
54
  end
28
55
  end
29
56
  end
@@ -20,3 +20,20 @@ test('backgroundColor = category_1', () => {
20
20
  const kit = renderKit(Background, props, { backgroundColor: 'category_1' })
21
21
  expect(kit).toHaveClass('pb_background_kit pb_background_color_category_1')
22
22
  })
23
+
24
+ test('customColor prop styles background color with a hex value', () => {
25
+ const kit = renderKit(Background, props, { customColor: '#1d99a8' })
26
+
27
+ expect(kit).toHaveClass('pb_background_kit pb_background_custom_color')
28
+ expect(kit).toHaveStyle(`background-color: #1d99a8;`)
29
+ })
30
+
31
+ test('backgroundRepeat = repeat', () => {
32
+ const kit = renderKit(Background, props, { classname: "background-image", imageUrl: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", backgroundRepeat: 'repeat' })
33
+ expect(kit).toHaveStyle('background-repeat: repeat')
34
+ })
35
+
36
+ test('backgroundSize = auto', () => {
37
+ const kit = renderKit(Background, props, { classname: "background-image", imageUrl: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", backgroundSize: 'auto' })
38
+ expect(kit).toHaveStyle('background-size: auto')
39
+ })
@@ -1,5 +1,5 @@
1
- <%= pb_rails("background", props: { image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
2
- <%= pb_rails("flex", props: { horizontal: "center", orientation: "column" }) do %>
1
+ <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
2
+ <%= pb_rails("flex", props: { horizontal: "center", orientation: "column", margin_bottom: "xl" }) do %>
3
3
  <%= pb_rails("flex/flex_item") do %>
4
4
  <%= pb_rails("title", props: { dark: true, size: 1, text: "Background Kit Image" })%>
5
5
  <% end %>
@@ -11,3 +11,51 @@
11
11
  <% end %>
12
12
  <% end %>
13
13
  <% end %>
14
+
15
+
16
+ <%= pb_rails("flex", props: { margin_top: "lg" }) do %>
17
+ <%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %>
18
+ <%= pb_rails("select", props: {
19
+ id: "transition-dropdown",
20
+ label: "",
21
+ blank_selection: "Select a Transition...",
22
+ options: [
23
+ {
24
+ value: 'fade',
25
+ },
26
+ {
27
+ value: 'blur',
28
+ },
29
+ {
30
+ value: 'scale',
31
+ },
32
+ ]
33
+ }) %>
34
+ <% end %>
35
+ <% end %>
36
+
37
+ <script>
38
+ window.addEventListener('DOMContentLoaded', () => {
39
+ const transitionDropdown = document.querySelector("#transition-dropdown")
40
+ var option = ''
41
+
42
+ transitionDropdown.addEventListener('change', function() {
43
+ if (this.value === '') {
44
+ (transitionDropdown).className = (transitionDropdown).className + ' _disabled'
45
+ } else {
46
+ (transitionDropdown).removeAttribute("disabled");
47
+ (transitionDropdown).className = (transitionDropdown)
48
+ option = this.value
49
+ }
50
+ });
51
+
52
+ const updateTransition = (transition) => {
53
+ const imageTransition = document.querySelector('.background-image')
54
+ imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded")
55
+ imageTransition.classList.add(transition, "lazyload")
56
+ }
57
+ (transitionDropdown).addEventListener('change', function() {
58
+ updateTransition(option)
59
+ })
60
+ });
61
+ </script>
@@ -1,36 +1,79 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { Background } from '../..'
3
- import { Card, Flex, FlexItem, Title } from '../..'
3
+ import { Card, Flex, FlexItem, Select, Title } from '../..'
4
4
 
5
- const BackgroundImage = (props) => (
6
- <Background imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80">
7
- <Flex
8
- orientation="column"
9
- vertical="center"
10
- {...props}
11
- >
12
- <FlexItem>
13
- <Title
14
- dark
15
- padding="lg"
16
- size={1}
17
- text="Background Kit Image"
18
- {...props}
19
- />
20
- </FlexItem>
21
- <FlexItem
22
- padding="lg"
5
+ const BackgroundImage = (props) => {
6
+ const [transition, setTransition] = useState('')
7
+
8
+ const handleTransition = ({ target }) => {
9
+ setTransition(target.value)
10
+ }
11
+
12
+ const options = [
13
+ {
14
+ value: 'fade',
15
+ },
16
+ {
17
+ value: 'blur',
18
+ },
19
+ {
20
+ value: 'scale',
21
+ },
22
+ ]
23
+
24
+ return (
25
+ <>
26
+ <Background
27
+ alt="colorful background"
28
+ className="background lazyload"
29
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
30
+ transition={transition}
23
31
  {...props}
24
32
  >
25
- <Card
26
- shadow="deepest"
33
+ <Flex
34
+ orientation="column"
35
+ vertical="center"
27
36
  {...props}
28
37
  >
29
- {'We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. - Cesar Chavez'}
30
- </Card>
31
- </FlexItem>
32
- </Flex>
33
- </Background>
34
- )
38
+ <FlexItem>
39
+ <Title
40
+ dark
41
+ padding="lg"
42
+ size={1}
43
+ text="Background Kit Image"
44
+ {...props}
45
+ />
46
+ </FlexItem>
47
+ <FlexItem
48
+ padding="lg"
49
+ {...props}
50
+ >
51
+ <Card
52
+ shadow="deepest"
53
+ {...props}
54
+ >
55
+ {
56
+ 'We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. - Cesar Chavez'
57
+ }
58
+ </Card>
59
+ </FlexItem>
60
+ </Flex>
61
+ </Background>
62
+ <Flex marginTop="xl">
63
+ <FlexItem fixedSize="250px">
64
+ <Select
65
+ blankSelection="Select a Transition..."
66
+ label=""
67
+ name="dropdown"
68
+ onChange={handleTransition}
69
+ options={options}
70
+ transition={transition}
71
+ {...props}
72
+ />
73
+ </FlexItem>
74
+ </Flex>
75
+ </>
76
+ )
77
+ }
35
78
 
36
79
  export default BackgroundImage
@@ -0,0 +1 @@
1
+ To add a lazyload on the background image simply use the `transition` prop and one of the three string options `"fade"`, `"blur"`, or `"scale"`.
@@ -1,3 +1,3 @@
1
1
  <%= pb_rails("background", props: { background_color: "light", padding: "xl" }) do %>
2
2
 
3
- <% end %>
3
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "auto", padding: "xl" }) %>
2
+ <br/>
3
+ <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_size: "cover", padding: "xl" }) %>
4
+ <br/>
5
+ <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", background_repeat: "no-repeat", background_size: "contain", padding: "xl" }) %>
@@ -0,0 +1,36 @@
1
+ import React, { Fragment as F } from 'react'
2
+ import { Background } from '../..'
3
+
4
+ const BackgroundSize = (props) => (
5
+ <F>
6
+ <Background
7
+ alt="colorful background"
8
+ backgroundSize="auto"
9
+ className="background lazyload"
10
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
11
+ padding="xl"
12
+ {...props}
13
+ />
14
+ <br/>
15
+ <Background
16
+ alt="colorful background"
17
+ backgroundSize="cover"
18
+ className="background lazyload"
19
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
20
+ padding="xl"
21
+ {...props}
22
+ />
23
+ <br/>
24
+ <Background
25
+ alt="colorful background"
26
+ backgroundRepeat="no-repeat"
27
+ backgroundSize="contain"
28
+ className="background lazyload"
29
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
30
+ padding="xl"
31
+ {...props}
32
+ />
33
+ </F>
34
+ )
35
+
36
+ export default BackgroundSize
@@ -0,0 +1,3 @@
1
+ Background size can be passed into the background kit. Values `auto`, `cover`, and `contain` are accepted.
2
+
3
+ 💡 *Note:* When using `contain` you might not want to have a repeating background as this will not always look pleasant. To prevent this, you may pass `no-repeat` to the `backgroundRepeat` prop.
@@ -1 +1,3 @@
1
- The background kit is used for adding a background to a page or to any container. Instead of adding a custom class to give something a background, you can now wrap the elements in the background kit and use the `background_color` prop to assign its color. The colors that you can choose from for the `background_color` prop are: gradient, dark, light, white, status colors, product colors, and category colors.
1
+ The background kit is used for adding a background to a page or to any container. Instead of adding a custom class to give something a background, you can now wrap the elements in the background kit and use the `background_color` prop to assign its color. The colors that you can choose from for the `background_color` prop are: gradient, dark, light, white, status colors, product colors, and category colors.
2
+
3
+ The `custom_color` prop allows you to pass a hex value (ex. "#e43718") in place of `background_color`. It is not case sensitive, but needs to start with `#`. This prop exists primarily for use in microsites and very specific situations. Avoid using unless absolutely necessary to maintain continuity.
@@ -7,6 +7,7 @@ examples:
7
7
  - background_image: Image
8
8
  - background_status: Status
9
9
  - background_category: Category
10
+ - background_size: Size
10
11
 
11
12
  react:
12
13
  - background_light: Light
@@ -15,3 +16,4 @@ examples:
15
16
  - background_image: Image
16
17
  - background_status: Status
17
18
  - background_category: Category
19
+ - background_size: Size
@@ -4,3 +4,4 @@ export { default as BackgroundGradient } from './_background_gradient.jsx'
4
4
  export { default as BackgroundImage } from './_background_image.jsx'
5
5
  export { default as BackgroundStatus } from './_background_status.jsx'
6
6
  export { default as BackgroundCategory } from './_background_category.jsx'
7
+ export { default as BackgroundSize } from './_background_size.jsx'
@@ -3,11 +3,12 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import { globalProps } from '../utilities/globalProps.js'
6
+ import { globalProps } from '../utilities/globalProps'
7
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,