playbook_ui 5.2.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -1
  3. data/app/pb_kits/playbook/data/menu.yml +1 -0
  4. data/app/pb_kits/playbook/packs/samples.js +2 -0
  5. data/app/pb_kits/playbook/packs/site_styles/docs/_all.scss +1 -0
  6. data/app/pb_kits/playbook/packs/site_styles/docs/_bg_light_doc_example.scss +7 -0
  7. data/app/pb_kits/playbook/pb_badge/_badge.html.erb +1 -0
  8. data/app/pb_kits/playbook/pb_badge/_badge.jsx +17 -4
  9. data/app/pb_kits/playbook/pb_body/_body.html.erb +1 -0
  10. data/app/pb_kits/playbook/pb_body/_body.jsx +33 -24
  11. data/app/pb_kits/playbook/pb_body/docs/_body_dark.html.erb +1 -1
  12. data/app/pb_kits/playbook/pb_body/docs/_body_dark.jsx +0 -2
  13. data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +1 -0
  14. data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +3 -7
  15. data/app/pb_kits/playbook/pb_caption/_caption.scss +2 -2
  16. data/app/pb_kits/playbook/pb_card/_card.jsx +4 -1
  17. data/app/pb_kits/playbook/pb_card/_card.scss +4 -0
  18. data/app/pb_kits/playbook/pb_card/card.rb +8 -1
  19. data/app/pb_kits/playbook/pb_card/docs/_card_border_none.html.erb +7 -0
  20. data/app/pb_kits/playbook/pb_card/docs/_card_border_none.jsx +14 -0
  21. data/app/pb_kits/playbook/pb_card/docs/_card_border_none.md +1 -0
  22. data/app/pb_kits/playbook/pb_card/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_card/docs/index.js +1 -0
  24. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +2 -1
  25. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +18 -5
  26. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.jsx +17 -0
  27. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
  28. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  29. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.html.erb +1 -0
  30. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +17 -1
  31. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.html.erb +3 -2
  32. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +15 -12
  33. data/app/pb_kits/playbook/pb_highlight/docs/_highlight_default.html.erb +1 -1
  34. data/app/pb_kits/playbook/pb_image/_image.jsx +1 -1
  35. data/app/pb_kits/playbook/pb_layout/_layout.scss +16 -0
  36. data/app/pb_kits/playbook/pb_legend/_legend.html.erb +1 -0
  37. data/app/pb_kits/playbook/pb_legend/_legend.jsx +25 -4
  38. data/app/pb_kits/playbook/pb_nav/_item.jsx +20 -10
  39. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +3 -0
  40. data/app/pb_kits/playbook/pb_popover/_popover.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -1
  42. data/app/pb_kits/playbook/pb_popover/_popover.scss +4 -0
  43. data/app/pb_kits/playbook/pb_popover/popover.rb +4 -0
  44. data/app/pb_kits/playbook/pb_title/_title.jsx +7 -4
  45. data/app/pb_kits/playbook/pb_title/_title.scss +7 -0
  46. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +2 -0
  47. data/app/pb_kits/playbook/pb_title/title.rb +4 -1
  48. data/app/views/layouts/playbook/samples.html.erb +1 -0
  49. data/app/views/playbook/samples/collection_detail/index.html.erb +169 -0
  50. data/app/views/playbook/samples/collection_detail/index.jsx +372 -0
  51. data/lib/generators/kit/kit_generator.rb +6 -3
  52. data/lib/generators/kit/templates/kit_html.erb.tt +3 -2
  53. data/lib/generators/kit/templates/kit_jsx.erb.tt +38 -10
  54. data/lib/playbook/version.rb +1 -1
  55. metadata +11 -3
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import { Checkbox } from '../../'
3
+
4
+ const CheckboxChecked = () => {
5
+ return (
6
+ <div>
7
+ <Checkbox
8
+ checked
9
+ name="checkbox-name"
10
+ text="Checked Checkbox"
11
+ value="check-box value"
12
+ />
13
+ </div>
14
+ )
15
+ }
16
+
17
+ export default CheckboxChecked
@@ -9,6 +9,7 @@ examples:
9
9
 
10
10
  react:
11
11
  - checkbox_default: Default
12
+ - checkbox_checked: Load as checked
12
13
  - checkbox_dark: Dark
13
14
  - checkbox_custom: Custom Checkbox
14
15
  - checkbox_error: Default w/ Error
@@ -3,3 +3,4 @@ export { default as CheckboxDark } from './_checkbox_dark.jsx'
3
3
  export { default as CheckboxCustom } from './_checkbox_custom.jsx'
4
4
  export { default as CheckboxError } from './_checkbox_error.jsx'
5
5
  export { default as CheckboxDarkError } from './_checkbox_dark_error.jsx'
6
+ export { default as CheckboxChecked } from './_checkbox_checked.jsx'
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -2,6 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
6
  import { Button, Icon } from '../'
6
7
 
7
8
  import type { Callback } from '../types'
@@ -13,8 +14,10 @@ import {
13
14
  import { spacing } from '../utilities/spacing.js'
14
15
 
15
16
  type CircleIconButtonProps = {
17
+ aria?: object,
16
18
  className?: String,
17
19
  dark?: Boolean,
20
+ data?: object,
18
21
  disabled?: Boolean,
19
22
  icon: String,
20
23
  id?: String,
@@ -27,9 +30,13 @@ type CircleIconButtonProps = {
27
30
 
28
31
  const CircleIconButton = (props: CircleIconButtonProps) => {
29
32
  const {
33
+ aria = {},
34
+ className,
30
35
  dark,
36
+ data = {},
31
37
  disabled,
32
38
  icon,
39
+ id,
33
40
  onClick = noop,
34
41
  type,
35
42
  link,
@@ -37,8 +44,17 @@ const CircleIconButton = (props: CircleIconButtonProps) => {
37
44
  variant,
38
45
  } = props
39
46
 
47
+ const ariaProps = buildAriaProps(aria)
48
+ const dataProps = buildDataProps(data)
49
+ const classes = classnames(buildCss('pb_circle_icon_button_kit'), className, spacing(props))
50
+
40
51
  return (
41
- <div className={classnames('pb_circle_icon_button_kit', spacing(props))}>
52
+ <div
53
+ {...ariaProps}
54
+ {...dataProps}
55
+ className={classes}
56
+ id={id}
57
+ >
42
58
  <Button
43
59
  dark={dark}
44
60
  disabled={disabled}
@@ -1,7 +1,8 @@
1
1
  <%= content_tag(:div,
2
- id: object.id,
2
+ aria: object.aria,
3
+ class: object.classname,
3
4
  data: object.data,
4
- class: object.classname) do %>
5
+ id: object.id) do %>
5
6
  <% if object.stat_label.present? %>
6
7
  <%= pb_rails("body", props: { color: "light", text: object.stat_label } ) %>
7
8
  <% end %>
@@ -2,6 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
6
  import { spacing } from '../utilities/spacing.js'
6
7
  import {
7
8
  Body,
@@ -11,7 +12,9 @@ import {
11
12
 
12
13
  type DashboardValueProps = {
13
14
  align?: 'left' | 'center' | 'right',
15
+ aria?: object,
14
16
  className?: String,
17
+ data?: object,
15
18
  id?: String,
16
19
  statChange?: {
17
20
  change?: String,
@@ -24,27 +27,27 @@ type DashboardValueProps = {
24
27
  }
25
28
  }
26
29
 
27
- const dashboardValueCSS = ({
28
- align = 'left',
29
-
30
- }: DashboardValueProps) => {
31
- const alignStyle = align !== '' ? `_${align}` : ''
32
-
33
- return 'pb_dashboard_value_kit' + alignStyle
34
- }
35
-
36
30
  const DashboardValue = (props: DashboardValueProps) => {
37
31
  const {
32
+ align = 'left',
33
+ aria = {},
38
34
  className,
35
+ data = {},
39
36
  id,
40
- statChange,
37
+ statChange = {},
41
38
  statLabel,
42
- statValue,
39
+ statValue = {},
43
40
  } = props
44
41
 
42
+ const ariaProps = buildAriaProps(aria)
43
+ const dataProps = buildDataProps(data)
44
+ const classes = classnames(buildCss('pb_dashboard_value_kit', align), className, spacing(props))
45
+
45
46
  return (
46
47
  <div
47
- className={classnames(dashboardValueCSS(props), className, spacing(props))}
48
+ {...ariaProps}
49
+ {...dataProps}
50
+ className={classes}
48
51
  id={id}
49
52
  >
50
53
  <If condition={statLabel}>
@@ -10,7 +10,7 @@ This an example<%= pb_rails("highlight") do%>Highlight Example<% end %>around.
10
10
  <br>
11
11
  <br>
12
12
  <%= pb_rails("title", props: {text: "Search",size: 4})%>
13
- </br>
13
+ <br>
14
14
  <%= pb_rails("body", props: {text: "hello helpers are great even highlighting this", highlighting: true, highlighted_text: ["hello","great"]})%>
15
15
 
16
16
  <br>
@@ -14,7 +14,7 @@ const Image = (props: ImageProps) => {
14
14
  return (
15
15
  <img
16
16
  alt={alt}
17
- className={classnames('pb_image lazyload blur_up', spacing(props))}
17
+ className={classnames('pb_image_kit lazyload blur_up', spacing(props))}
18
18
  data-src={url}
19
19
  />
20
20
  )
@@ -35,10 +35,25 @@ $card-border-radius: $border_rad_lightest;
35
35
  display: grid;
36
36
  width: 100%;
37
37
  height: 100%;
38
+ padding: $space_lg;
38
39
  grid-template-areas:
39
40
  "side-bar collection";
40
41
  grid-template-columns: .25fr 1fr;
41
42
  grid-column-gap: $space_sm;
43
+ div.layout_body{
44
+ @media screen and (min-width: $screen-md-min) {
45
+ margin-left: $space_md;
46
+ }
47
+ @media screen and (max-width: $screen-lg-min) {
48
+ grid-template-columns: repeat(3, 1fr);
49
+ }
50
+ @media screen and (max-width: $screen-md-min) {
51
+ grid-template-columns: repeat(2, 1fr) !important;
52
+ }
53
+ @media screen and (max-width: $screen-xs-min) {
54
+ grid-template-columns: repeat(1, 1fr) !important;
55
+ }
56
+ }
42
57
 
43
58
  @media screen and (max-width: $screen-md-min) {
44
59
  grid-template-areas: "side-bar"
@@ -46,6 +61,7 @@ $card-border-radius: $border_rad_lightest;
46
61
  grid-template-columns: 1fr;
47
62
  grid-row-gap: $space_sm;
48
63
  }
64
+
49
65
  }
50
66
 
51
67
  &[class*=_kanban]{
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div, object.text,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -2,12 +2,14 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { buildCss } from '../utilities/props'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
6
  import { spacing } from '../utilities/spacing.js'
7
7
 
8
8
  import { Body, Title } from '../'
9
9
 
10
10
  type LegendProps = {
11
+ aria?: object,
12
+ className?: String,
11
13
  color?: | "data_1"
12
14
  | "data_2"
13
15
  | "data_3"
@@ -16,20 +18,39 @@ type LegendProps = {
16
18
  | "data_6"
17
19
  | "data_7",
18
20
  dark?: Boolean,
21
+ data?: object,
22
+ id?: String,
19
23
  prefixText?: String,
20
24
  text: String,
21
25
  }
22
26
 
23
27
  const Legend = (props: LegendProps) => {
24
- const { color = 'data_1', dark = false, prefixText, text } = props
28
+ const {
29
+ aria = {},
30
+ className,
31
+ color = 'data_1',
32
+ dark = false,
33
+ data = {},
34
+ id,
35
+ prefixText,
36
+ text,
37
+ } = props
38
+
39
+ const ariaProps = buildAriaProps(aria)
40
+ const dataProps = buildDataProps(data)
25
41
  const darkClass = dark ? 'dark' : 'light'
26
42
  const bodyCSS = classnames(
27
- buildCss('pb_legend_kit', color, darkClass),
43
+ buildCss('pb_legend_kit', color, darkClass), className,
28
44
  spacing(props)
29
45
  )
30
46
 
31
47
  return (
32
- <div className={bodyCSS}>
48
+ <div
49
+ {...ariaProps}
50
+ {...dataProps}
51
+ className={bodyCSS}
52
+ id={id}
53
+ >
33
54
  <Body color={dark ? 'lighter' : 'light'}>
34
55
  <span className="pb_legend_indicator_circle" />
35
56
  <If condition={prefixText}>
@@ -32,21 +32,31 @@ const NavItem = ({
32
32
  onClick={onClick}
33
33
  >
34
34
  <If condition={iconLeft}>
35
- <Icon
36
- className="pb_nav_list_item_icon_left"
37
- fixedWidth
38
- icon={iconLeft}
39
- />
35
+ <div
36
+ className="pb_nav_list_item_icon_section"
37
+ key={iconLeft}
38
+ >
39
+ <Icon
40
+ className="pb_nav_list_item_icon_left"
41
+ fixedWidth
42
+ icon={iconLeft}
43
+ />
44
+ </div>
40
45
  </If>
41
46
  <span className="pb_nav_list_item_text">
42
47
  {text || children}
43
48
  </span>
44
49
  <If condition={iconRight}>
45
- <Icon
46
- className="pb_nav_list_item_icon_right"
47
- fixedWidth
48
- icon={iconRight}
49
- />
50
+ <div
51
+ className="pb_nav_list_item_icon_section"
52
+ key={iconRight}
53
+ >
54
+ <Icon
55
+ className="pb_nav_list_item_icon_right"
56
+ fixedWidth
57
+ icon={iconRight}
58
+ />
59
+ </div>
50
60
  </If>
51
61
  </Tag>
52
62
  </li>
@@ -32,6 +32,7 @@ $selector: ".pb_nav_list";
32
32
  }
33
33
  [class*=_item_text] {
34
34
  color: $primary;
35
+ font-weight: $bold;
35
36
  }
36
37
  }
37
38
  }
@@ -90,6 +91,7 @@ $selector: ".pb_nav_list";
90
91
  text-decoration: none;
91
92
  display: flex;
92
93
  align-items: center;
94
+ border: none;
93
95
  padding: $space_xs ($space_sm - 2px);
94
96
  transition-property: color, background-color;
95
97
  transition-duration: 0.15s;
@@ -106,6 +108,7 @@ $selector: ".pb_nav_list";
106
108
  }
107
109
  [class*=_text] {
108
110
  flex: 1;
111
+ font-weight: $regular;
109
112
  }
110
113
  &:hover {
111
114
  background-color: rgba($primary, 0.03);
@@ -3,7 +3,7 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
  <div class="pb_popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
6
- <div class="pb_popover_body <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
6
+ <div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
7
7
  <%= capture(&object.children) %>
8
8
  </div>
9
9
  </div>
@@ -59,6 +59,7 @@ const Popover = (props: PbPopoverProps) => {
59
59
  } = props
60
60
 
61
61
  const popoverSpacing = spacing(props) ? spacing(props) : 'p_sm'
62
+ const overflowHandling = maxHeight || maxWidth ? 'overflow_handling' : ''
62
63
  const zIndexStyle = zIndex ? { zIndex: zIndex } : {}
63
64
  const widthHeightStyles = () => {
64
65
  return Object.assign(
@@ -96,7 +97,8 @@ const Popover = (props: PbPopoverProps) => {
96
97
  <div
97
98
  className={classnames(
98
99
  'pb_popover_body',
99
- popoverSpacing
100
+ popoverSpacing,
101
+ overflowHandling
100
102
  )}
101
103
  style={widthHeightStyles()}
102
104
  >
@@ -23,6 +23,8 @@
23
23
  @include pb_card;
24
24
  border: 0;
25
25
  box-shadow: $shadow_deeper;
26
+ }
27
+ .overflow_handling {
26
28
  overflow: auto;
27
29
  }
28
30
  }
@@ -49,6 +51,8 @@
49
51
  @include pb_card;
50
52
  border: 0;
51
53
  box-shadow: $shadow_deeper;
54
+ }
55
+ .overflow_handling {
52
56
  overflow: auto;
53
57
  }
54
58
 
@@ -42,6 +42,10 @@ module Playbook
42
42
  out
43
43
  end
44
44
 
45
+ def width_height_class_helper
46
+ "overflow_handling" if max_height || max_width
47
+ end
48
+
45
49
  def data
46
50
  Hash(values[:data]).merge(
47
51
  pb_popover_kit: true,
@@ -7,14 +7,15 @@ import { spacing } from '../utilities/spacing.js'
7
7
 
8
8
  type TitleProps = {
9
9
  aria?: object,
10
- className?: String,
11
10
  children?: Array<React.ReactNode> | React.ReactNode,
11
+ className?: String,
12
12
  dark?: Boolean,
13
13
  data?: object,
14
14
  id?: String,
15
15
  size?: 1 | 2 | 3 | 4,
16
16
  tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div",
17
17
  text?: String,
18
+ variant?: null | "primary",
18
19
  }
19
20
 
20
21
  const Title = (props: TitleProps) => {
@@ -27,12 +28,14 @@ const Title = (props: TitleProps) => {
27
28
  id,
28
29
  size = 3,
29
30
  tag = 'h3',
30
- text } = props
31
+ text,
32
+ variant = null,
33
+ } = props
31
34
 
32
- const themeStyle = dark === true ? '_dark' : ''
35
+ const themeStyle = dark === true ? 'dark' : ''
33
36
  const ariaProps = buildAriaProps(aria)
34
37
  const dataProps = buildDataProps(data)
35
- const classes = classnames(buildCss('pb_title_kit', size, themeStyle), className, spacing(props))
38
+ const classes = classnames(buildCss('pb_title_kit', size, themeStyle, variant), className, spacing(props))
36
39
  const Tag = `${tag}`
37
40
 
38
41
  return (
@@ -1,4 +1,5 @@
1
1
  @import "title_mixin";
2
+ @import "../tokens/colors";
2
3
 
3
4
  [class^=pb_title_kit]{
4
5
  &[class*=_1] {
@@ -20,4 +21,10 @@
20
21
  &[class*=_dark] {
21
22
  @include pb_title_dark;
22
23
  }
24
+
25
+ @each $color_name, $color_value in $status_colors {
26
+ &[class*=_#{$color_name}] {
27
+ color: map-get($status_color_text, $color_name);
28
+ }
29
+ }
23
30
  }