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
@@ -13,10 +13,10 @@ class KitGenerator < Rails::Generators::NamedBase
13
13
  @kit_name_underscore = kit_name.parameterize.underscore
14
14
  @kit_name_pascal = kit_name.titleize.gsub(/\s+/, "")
15
15
 
16
- kit_props = options[:props].concat(%w[id:string classname:string data:object])
16
+ kit_props = options[:props].concat(%w[id:string classname:string data:object aria:object])
17
17
  @kit_props = kit_props.map { |hash| [hash.partition(":").first, hash.partition(":").last] }.to_h
18
18
  @kit_props = @kit_props.sort.to_h
19
- @unique_props = @kit_props.symbolize_keys.without(:id, :classname, :data)
19
+ @unique_props = @kit_props.symbolize_keys.without(:id, :classname, :data, :aria)
20
20
 
21
21
  @kit_class_init = []
22
22
  @kit_props.each do |key, _val|
@@ -48,7 +48,7 @@ class KitGenerator < Rails::Generators::NamedBase
48
48
  # Generate SCSS files ==============================
49
49
  template "kit_scss.erb", "#{full_kit_directory}/_#{@kit_name_underscore}.scss"
50
50
  open("app/pb_kits/playbook/_playbook.scss", "a") do |f|
51
- f.puts "@" + "import " + "\'" + "pb_#{@kit_name_underscore}/#{@kit_name_underscore}" + "\';"
51
+ f.puts "\n@" + "import " + "\'" + "pb_#{@kit_name_underscore}/#{@kit_name_underscore}" + "\';"
52
52
  end
53
53
  say_status "complete",
54
54
  "#{@kit_name_capitalize} kit stylesheet successfully created and imported.",
@@ -77,6 +77,9 @@ class KitGenerator < Rails::Generators::NamedBase
77
77
  append_to_file("app/pb_kits/playbook/packs/examples.js") do
78
78
  "import * as #{@kit_name_pascal} from 'pb_#{@kit_name_underscore}/docs'\nWebpackerReact.setup(#{@kit_name_pascal})\n"
79
79
  end
80
+ append_to_file("app/pb_kits/playbook/index.js") do
81
+ "\nexport #{@kit_name_pascal} from 'pb_#{@kit_name_underscore}/_#{@kit_name_underscore}.jsx'"
82
+ end
80
83
 
81
84
  say_status "complete",
82
85
  "#{@kit_name_capitalize} react kit successfully created.",
@@ -1,6 +1,7 @@
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
  <span><%= @kit_name_uppercase %> CONTENT</span>
6
7
  <%% end %>
@@ -10,6 +10,7 @@ props_types = @kit_props.map do |key, val|
10
10
  prop_type = case val
11
11
  when "enum", "one_of" then "'option_1' | 'option_2'"
12
12
  when "boolean", "bool" then "Boolean"
13
+ when "object", "obj" then "object"
13
14
  else "String"
14
15
  end
15
16
 
@@ -17,24 +18,51 @@ props_types = @kit_props.map do |key, val|
17
18
  end
18
19
  puts props_types.inspect
19
20
 
20
- props_names = @kit_props.map { |key,| key == "classname" ? "className" : key.camelize(:lower) }
21
+ props_names = @kit_props.keys.map do |key|
22
+ case key
23
+ when "classname" || "className"
24
+ "className"
25
+ when "aria"
26
+ "aria = {}"
27
+ when "data"
28
+ "data = {}"
29
+ else
30
+ key
31
+ end
32
+ end
33
+
34
+ %>
21
35
 
22
- props_and_values = props_names.map { |prop| "<p>{`#{prop}: ${#{prop}}`}</p>" }
23
- -%>
24
36
  /* @flow */
25
37
 
26
38
  import React from 'react'
39
+ import classnames from 'classnames'
40
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
41
+ import { spacing } from '../utilities/spacing.js'
27
42
 
28
43
  type <%= type_name %> = {
29
44
  <%= break_lines.call(props_types) %>
30
45
  }
31
46
 
32
- const <%= @kit_name_pascal %> = ({
33
- <%= break_lines.call(props_names) %>
34
- }: <%= type_name %>) => (
35
- <div>
36
- <%= break_lines.call(props_and_values, 4, "") %>
37
- </div>
38
- )
47
+ const <%= @kit_name_pascal %> = (props: <%= type_name %>) => {
48
+ const {
49
+ <%= break_lines.call(props_names) %>
50
+ } = props
51
+
52
+ const ariaProps = buildAriaProps(aria)
53
+ const dataProps = buildDataProps(data)
54
+ const classes = classnames(buildCss('pb_<%= @kit_name_underscore %>'), className, spacing(props))
55
+
56
+ return (
57
+ <div
58
+ {...ariaProps}
59
+ {...dataProps}
60
+ className={classes}
61
+ id={id}
62
+ >
63
+ {className}
64
+ </div>
65
+ )
66
+ }
39
67
 
40
68
  export default <%= @kit_name_pascal %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "5.3.0-alpha1"
4
+ VERSION = "5.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0.pre.alpha1
4
+ version: 5.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-17 00:00:00.000000000 Z
12
+ date: 2020-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -574,6 +574,7 @@ files:
574
574
  - app/pb_kits/playbook/pb_checkbox/_checkbox.scss
575
575
  - app/pb_kits/playbook/pb_checkbox/checkbox.rb
576
576
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.html.erb
577
+ - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.jsx
577
578
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.html.erb
578
579
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.jsx
579
580
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.html.erb
@@ -842,27 +843,6 @@ files:
842
843
  - app/pb_kits/playbook/pb_form_pill/docs/example.yml
843
844
  - app/pb_kits/playbook/pb_form_pill/docs/index.js
844
845
  - app/pb_kits/playbook/pb_form_pill/form_pill.rb
845
- - app/pb_kits/playbook/pb_gauge/_gauge.html.erb
846
- - app/pb_kits/playbook/pb_gauge/_gauge.jsx
847
- - app/pb_kits/playbook/pb_gauge/_gauge.scss
848
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb
849
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx
850
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb
851
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx
852
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb
853
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx
854
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
855
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb
856
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx
857
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb
858
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx
859
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb
860
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx
861
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb
862
- - app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx
863
- - app/pb_kits/playbook/pb_gauge/docs/example.yml
864
- - app/pb_kits/playbook/pb_gauge/docs/index.js
865
- - app/pb_kits/playbook/pb_gauge/gauge.rb
866
846
  - app/pb_kits/playbook/pb_hashtag/_hashtag.html.erb
867
847
  - app/pb_kits/playbook/pb_hashtag/_hashtag.jsx
868
848
  - app/pb_kits/playbook/pb_hashtag/_hashtag.scss
@@ -1793,6 +1773,8 @@ files:
1793
1773
  - app/views/playbook/pages/tokens/_pb_doc_spacing.html.slim
1794
1774
  - app/views/playbook/pages/utilities.html.slim
1795
1775
  - app/views/playbook/pages/utilities/_pb_doc_color.html.slim
1776
+ - app/views/playbook/samples/collection_detail/index.html.erb
1777
+ - app/views/playbook/samples/collection_detail/index.jsx
1796
1778
  - app/views/playbook/samples/dashboards/index.html.erb
1797
1779
  - app/views/playbook/samples/dashboards/index.jsx
1798
1780
  - app/views/playbook/samples/filter_table/index.html.erb
@@ -1834,9 +1816,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1834
1816
  version: '0'
1835
1817
  required_rubygems_version: !ruby/object:Gem::Requirement
1836
1818
  requirements:
1837
- - - ">"
1819
+ - - ">="
1838
1820
  - !ruby/object:Gem::Version
1839
- version: 1.3.1
1821
+ version: '0'
1840
1822
  requirements: []
1841
1823
  rubyforge_project:
1842
1824
  rubygems_version: 2.7.3
@@ -1,12 +0,0 @@
1
- <%= content_tag(:div, "",
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname) %>
5
- <% content_for :pb_js do %>
6
- <%= javascript_tag do %>
7
- window.addEventListener('DOMContentLoaded', function() {
8
- new pbChart('.selector', <%= object.chart_options %>)
9
- })
10
- <% end %>
11
- <% end %>
12
-
@@ -1,105 +0,0 @@
1
- /* @flow */
2
-
3
- import React, { useEffect, useRef } from 'react'
4
- import { pbChart } from '../'
5
- import { spacing } from '../utilities/spacing.js'
6
- import classnames from 'classnames'
7
- import Highcharts from 'highcharts'
8
-
9
- import {
10
- buildAriaProps,
11
- buildCss,
12
- buildDataProps,
13
- } from '../utilities/props'
14
-
15
- type GaugeProps = {
16
- aria: Object,
17
- className?: String,
18
- chartData?: Array,
19
- data?: Object,
20
- fullCircle: Boolean,
21
- height: String,
22
- id?: String,
23
- max: Number,
24
- min: Number,
25
- prefix: String,
26
- showLabels: Boolean,
27
- style: String,
28
- suffix: String,
29
- title: String,
30
- tooltipHtml: String,
31
- }
32
-
33
- const Gauge = (props: GaugeProps) => {
34
- const {
35
- aria = {},
36
- className,
37
- chartData = [{ name: 'Name', value: 0 }],
38
- data = {},
39
- fullCircle = false,
40
- height = null,
41
- id,
42
- max = 100,
43
- min = 0,
44
- prefix = '',
45
- showLabels = false,
46
- style = 'solidgauge',
47
- suffix = '',
48
- title = '',
49
- tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + '<b>{point.y}</b>',
50
- } = props
51
-
52
- const ariaProps = buildAriaProps(aria)
53
- const dataProps = buildDataProps(data)
54
-
55
- const css = buildCss({
56
- 'pb_gauge_kit': true,
57
- })
58
- // Runs first time component Renders
59
- useEffect(() => {
60
- chartData.forEach((obj) => {
61
- obj.y = obj.value
62
- delete obj.value
63
- })
64
-
65
- new pbChart('.selector', {
66
- id: id,
67
- chartData: chartData,
68
- circumference: fullCircle ? [0, 360] : [-100, 100],
69
- height: height,
70
- min: min,
71
- max: max,
72
- prefix: prefix,
73
- title: title,
74
- suffix: suffix,
75
- showLabels: showLabels,
76
- style: style,
77
- tooltipHtml: tooltipHtml,
78
- type: 'gauge',
79
- })
80
- }, [])
81
-
82
- const componentDidMount = useRef(false)
83
- // Doesn't run the first time but runs every subsequent render
84
- useEffect(() => {
85
- if (componentDidMount.current) {
86
- Highcharts.charts.forEach((chart) => {
87
- if (chart.renderTo.id === id) {
88
- chart.series[0].setData([chartData[0].value])
89
- }
90
- })
91
- } else {
92
- componentDidMount.current = true
93
- }
94
- })
95
- return (
96
- <div
97
- {...ariaProps}
98
- {...dataProps}
99
- className={classnames(css, className, spacing(props))}
100
- id={id}
101
- />
102
- )
103
- }
104
-
105
- export default Gauge
@@ -1,11 +0,0 @@
1
- [class^=pb_gauge_kit] {
2
-
3
- .suffix {
4
- fill: $text_lt_light;
5
- font: $regular $font_larger $font_family_base;
6
- }
7
- .prefix {
8
- fill: $text_lt_light;
9
- font: $regular $font_base $font_family_base;
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- <% data = [
2
- {
3
- name: 'Name',
4
- value: 45,
5
- }
6
- ]%>
7
-
8
- <%= pb_rails("gauge", props: {
9
- id: "gauge-default",
10
- chart_data: data,
11
- }) %>
@@ -1,17 +0,0 @@
1
- import React from 'react'
2
- import { Gauge } from '../../'
3
-
4
- const data = [
5
- { name: 'Point1', value: 45 },
6
- ]
7
-
8
- const GaugeDefault = () => (
9
- <div>
10
- <Gauge
11
- chartData={data}
12
- id="gauge-default"
13
- />
14
- </div>
15
- )
16
-
17
- export default GaugeDefault
@@ -1,14 +0,0 @@
1
- <% data = [
2
- {
3
- name: 'Capacity',
4
- value: 75,
5
- }
6
- ]%>
7
-
8
- <%= pb_rails("gauge", props: {
9
- id: "full-circle",
10
- chart_data: data,
11
- full_circle: true,
12
- title: "Seating Capacity",
13
- suffix: "%"
14
- }) %>
@@ -1,20 +0,0 @@
1
- import React from 'react'
2
- import { Gauge } from '../../'
3
-
4
- const data = [
5
- { name: 'Capacity', value: 75 },
6
- ]
7
-
8
- const GaugeFullCircle = () => (
9
- <div>
10
- <Gauge
11
- chartData={data}
12
- fullCircle
13
- id="gauge-full-circle"
14
- suffix="%"
15
- title="Seating Capacity"
16
- />
17
- </div>
18
- )
19
-
20
- export default GaugeFullCircle
@@ -1,15 +0,0 @@
1
- <%= pb_rails("gauge", props: {
2
- id: "gauge-height-px",
3
- chart_data: [{ name: "Pixel Height", value: 400 }],
4
- height: '400',
5
- title: "Fixed Height in Pixels",
6
- suffix: "px"
7
- }) %>
8
-
9
- <%= pb_rails("gauge", props: {
10
- id: "gauge-height-percent",
11
- chart_data: [{ name: "Percentage Height", value: 45 }],
12
- height: '45%',
13
- title: "Height as Percentage of Width",
14
- suffix: "%"
15
- }) %>
@@ -1,23 +0,0 @@
1
- import React from 'react'
2
- import { Gauge } from '../../'
3
-
4
- const GaugeHeight = () => (
5
- <div>
6
- <Gauge
7
- chartData={[ { name: 'Name', value: 400 } ]}
8
- height="400"
9
- id="gauge-height-px"
10
- suffix="px"
11
- title="Fixed Height in Pixels"
12
- />
13
- <Gauge
14
- chartData={[ { name: 'Name', value: 45 } ]}
15
- height="45%"
16
- id="gauge-height-percent"
17
- suffix="%"
18
- title="Height as Percentage of Width"
19
- />
20
- </div>
21
- )
22
-
23
- export default GaugeHeight
@@ -1,25 +0,0 @@
1
- import React, { useState } from 'react'
2
- import { Button, Gauge } from '../../'
3
-
4
- const GaugeLiveData = () => {
5
- const [value, setValue] = useState(50)
6
-
7
- const updateState = () => {
8
- setValue(Math.floor(Math.random() * 100))
9
- }
10
-
11
- return (
12
- <div>
13
- <Button
14
- onClick={updateState}
15
- text="Update State"
16
- />
17
- <Gauge
18
- chartData={[{ name: 'Name', value: value }]}
19
- id="gauge-live-data"
20
- />
21
- </div>
22
- )
23
- }
24
-
25
- export default GaugeLiveData