playbook_ui 5.3.0.pre.alpha1 → 5.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -2
  3. data/app/pb_kits/playbook/data/menu.yml +3 -3
  4. data/app/pb_kits/playbook/index.js +0 -1
  5. data/app/pb_kits/playbook/packs/examples.js +0 -2
  6. data/app/pb_kits/playbook/packs/samples.js +2 -0
  7. data/app/pb_kits/playbook/pb_body/_body.html.erb +1 -0
  8. data/app/pb_kits/playbook/pb_body/_body.jsx +33 -24
  9. data/app/pb_kits/playbook/pb_body/docs/_body_dark.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_body/docs/_body_dark.jsx +0 -2
  11. data/app/pb_kits/playbook/pb_body/docs/_body_light.html.erb +1 -0
  12. data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +3 -7
  13. data/app/pb_kits/playbook/pb_caption/_caption.scss +2 -2
  14. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +2 -1
  15. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +18 -5
  16. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.jsx +17 -0
  17. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -0
  18. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  19. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.html.erb +1 -0
  20. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +17 -1
  21. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +0 -26
  22. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.html.erb +3 -2
  23. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +15 -12
  24. data/app/pb_kits/playbook/pb_highlight/docs/_highlight_default.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_image/_image.jsx +1 -1
  26. data/app/pb_kits/playbook/pb_layout/_layout.scss +16 -0
  27. data/app/pb_kits/playbook/pb_legend/_legend.html.erb +1 -0
  28. data/app/pb_kits/playbook/pb_legend/_legend.jsx +25 -4
  29. data/app/pb_kits/playbook/pb_nav/_item.jsx +20 -10
  30. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +3 -0
  31. data/app/pb_kits/playbook/pb_popover/_popover.html.erb +1 -1
  32. data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -1
  33. data/app/pb_kits/playbook/pb_popover/_popover.scss +4 -0
  34. data/app/pb_kits/playbook/pb_popover/popover.rb +4 -0
  35. data/app/pb_kits/playbook/pb_title/_title.jsx +7 -4
  36. data/app/pb_kits/playbook/pb_title/_title.scss +7 -0
  37. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +2 -0
  38. data/app/pb_kits/playbook/pb_title/title.rb +4 -1
  39. data/app/pb_kits/playbook/plugins/pb_chart.js +0 -71
  40. data/app/views/layouts/playbook/samples.html.erb +1 -0
  41. data/app/views/playbook/samples/collection_detail/index.html.erb +169 -0
  42. data/app/views/playbook/samples/collection_detail/index.jsx +372 -0
  43. data/lib/generators/kit/kit_generator.rb +6 -3
  44. data/lib/generators/kit/templates/kit_html.erb.tt +3 -2
  45. data/lib/generators/kit/templates/kit_jsx.erb.tt +38 -10
  46. data/lib/playbook/version.rb +1 -1
  47. metadata +7 -25
  48. data/app/pb_kits/playbook/pb_gauge/_gauge.html.erb +0 -12
  49. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +0 -105
  50. data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -11
  51. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb +0 -11
  52. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +0 -17
  53. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb +0 -14
  54. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +0 -20
  55. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb +0 -15
  56. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +0 -23
  57. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +0 -25
  58. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb +0 -21
  59. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +0 -26
  60. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb +0 -33
  61. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +0 -42
  62. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb +0 -14
  63. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +0 -20
  64. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb +0 -29
  65. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +0 -29
  66. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -22
  67. data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -8
  68. data/app/pb_kits/playbook/pb_gauge/gauge.rb +0 -55
@@ -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
  }
@@ -36,3 +36,5 @@
36
36
  @mixin pb_title_dark {
37
37
  color: $text_dk_default;
38
38
  }
39
+
40
+
@@ -16,9 +16,12 @@ module Playbook
16
16
  values: %w[h1 h2 h3 h4 h5 h6 p div span],
17
17
  default: "h3"
18
18
  prop :text
19
+ prop :variant, type: Playbook::Props::Enum,
20
+ values: [nil, "primary"],
21
+ default: nil
19
22
 
20
23
  def classname
21
- generate_classname("pb_title_kit", size, dark_class)
24
+ generate_classname("pb_title_kit", size, dark_class, variant)
22
25
  end
23
26
 
24
27
  private
@@ -3,8 +3,6 @@ import Highcharts from 'highcharts'
3
3
  import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme.js'
4
4
 
5
5
  require('highcharts/modules/variable-pie')(Highcharts)
6
- import highchartsMore from 'highcharts/highcharts-more.js'
7
- import solidGauge from 'highcharts/modules/solid-gauge.js'
8
6
 
9
7
  class pbChart {
10
8
  defaults = {
@@ -33,80 +31,11 @@ class pbChart {
33
31
 
34
32
  if (this.options.type == 'variablepie' || this.options.type == 'pie'){
35
33
  this.setupPieChart()
36
- } else if (this.options.type == 'gauge') {
37
- this.setupGauge()
38
34
  } else {
39
35
  this.setupChart()
40
36
  }
41
37
  }
42
38
 
43
- setupGauge() {
44
- highchartsMore(Highcharts)
45
- solidGauge(Highcharts)
46
- Highcharts.setOptions(highchartsTheme)
47
-
48
- Highcharts.chart(this.defaults.id, {
49
- chart: {
50
- type: this.defaults.style,
51
- height: this.defaults.height,
52
- },
53
- title: {
54
- text: this.defaults.title,
55
- },
56
- yAxis: {
57
- min: this.defaults.min,
58
- max: this.defaults.max,
59
- lineWidth: 0,
60
- tickWidth: 0,
61
- minorTickInterval: null,
62
- tickAmount: 2,
63
- tickPositions: [this.defaults.min, this.defaults.max],
64
- labels: {
65
- y: 26,
66
- enabled: this.defaults.showLabels,
67
- },
68
- },
69
- credits: false,
70
- series: [
71
- {
72
- data: this.defaults.chartData,
73
- },
74
- ],
75
- pane: {
76
- center: ['50%', '50%'],
77
- size: '90%',
78
- startAngle: this.defaults.circumference[0],
79
- endAngle: this.defaults.circumference[1],
80
- background: {
81
- borderWidth: 20,
82
- innerRadius: '90%',
83
- outerRadius: '90%',
84
- shape: 'arc',
85
- className: 'gauge-pane',
86
- },
87
- },
88
- tooltip: {
89
- headerFormat: '',
90
- pointFormat: this.defaults.tooltipHtml,
91
- followPointer: true,
92
- },
93
- plotOptions: {
94
- solidgauge: {
95
- dataLabels: {
96
- format: `<span class="prefix">${this.defaults.prefix}</span>` +
97
- '<span class="fix">{y:,f}</span>' +
98
- `<span class="suffix">${this.defaults.suffix}</span>`,
99
- },
100
- },
101
- },
102
- })
103
- document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
104
- if (document.querySelector('.prefix')) {
105
- document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
106
- document.querySelectorAll('.fix').forEach((fix) => fix.setAttribute('y', '38'))
107
- }
108
- }
109
-
110
39
  setupPieChart() {
111
40
  Highcharts.setOptions(highchartsTheme)
112
41