playbook_ui 2.8.6 → 2.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/packs/application.js +1 -3
  3. data/app/pb_kits/playbook/packs/examples.js +12 -0
  4. data/app/pb_kits/playbook/packs/kits.js +4 -0
  5. data/app/pb_kits/playbook/packs/pb_currency.js +4 -0
  6. data/app/pb_kits/playbook/packs/pb_image.js +0 -1
  7. data/app/pb_kits/playbook/packs/pb_section_separator.js +4 -0
  8. data/app/pb_kits/playbook/packs/pb_stat_change.js +4 -0
  9. data/app/pb_kits/playbook/packs/pb_stat_value.js +4 -0
  10. data/app/pb_kits/playbook/packs/site_styles/_kit_style_index.scss +4 -0
  11. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +43 -26
  12. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +34 -5
  13. data/app/pb_kits/playbook/pb_card/card.rb +1 -1
  14. data/app/pb_kits/playbook/pb_currency/_currency.html.erb +13 -0
  15. data/app/pb_kits/playbook/pb_currency/_currency.jsx +21 -0
  16. data/app/pb_kits/playbook/pb_currency/_currency.scss +40 -0
  17. data/app/pb_kits/playbook/pb_currency/currency.rb +100 -0
  18. data/app/pb_kits/playbook/pb_currency/docs/_currency_default.jsx +12 -0
  19. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.html.erb +25 -0
  20. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +25 -0
  21. data/app/pb_kits/playbook/pb_currency/docs/example.yml +9 -0
  22. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  23. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +2 -0
  24. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.scss +2 -3
  25. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +5 -3
  26. data/app/pb_kits/playbook/pb_dashboard_value/docs/example.yml +0 -2
  27. data/app/pb_kits/playbook/pb_date/_date.scss +0 -7
  28. data/app/pb_kits/playbook/pb_date/date.rb +11 -9
  29. data/app/pb_kits/playbook/pb_label_pill/label_pill.rb +17 -16
  30. data/app/pb_kits/playbook/pb_owner/owner.rb +17 -17
  31. data/app/pb_kits/playbook/pb_owner_phone/owner_phone.rb +21 -23
  32. data/app/pb_kits/playbook/pb_phone/phone.rb +17 -16
  33. data/app/pb_kits/playbook/{pb_dashboard_value/child_kits/_stat_label.html.erb → pb_section_separator/_section_separator.html.erb} +1 -1
  34. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +21 -0
  35. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +29 -0
  36. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_default.jsx +12 -0
  37. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line.html.erb +1 -0
  38. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text.html.erb +1 -0
  39. data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +9 -0
  40. data/app/pb_kits/playbook/pb_section_separator/docs/index.js +1 -0
  41. data/app/pb_kits/playbook/{pb_dashboard_value/stat_label.rb → pb_section_separator/section_separator.rb} +11 -18
  42. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +4 -4
  43. data/app/pb_kits/playbook/{pb_dashboard_value/child_kits → pb_stat_change}/_stat_change.html.erb +0 -0
  44. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +21 -0
  45. data/app/pb_kits/playbook/pb_stat_change/_stat_change.scss +2 -0
  46. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb +18 -0
  47. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx +12 -0
  48. data/app/pb_kits/playbook/pb_stat_change/docs/example.yml +9 -0
  49. data/app/pb_kits/playbook/pb_stat_change/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/{pb_dashboard_value → pb_stat_change}/stat_change.rb +2 -3
  51. data/app/pb_kits/playbook/{pb_dashboard_value/child_kits → pb_stat_value}/_stat_value.html.erb +0 -0
  52. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +21 -0
  53. data/app/pb_kits/playbook/{pb_dashboard_value/child_kits → pb_stat_value}/_stat_value.scss +3 -1
  54. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb +1 -0
  55. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +12 -0
  56. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_unit.html.erb +1 -0
  57. data/app/pb_kits/playbook/pb_stat_value/docs/example.yml +9 -0
  58. data/app/pb_kits/playbook/pb_stat_value/docs/index.js +1 -0
  59. data/app/pb_kits/playbook/{pb_dashboard_value → pb_stat_value}/stat_value.rb +2 -3
  60. data/app/pb_kits/playbook/pb_table/styles/_structure.scss +1 -1
  61. data/app/pb_kits/playbook/pb_time/time.rb +7 -7
  62. data/app/pb_kits/playbook/pb_title_count/title_count.rb +8 -4
  63. data/app/pb_kits/playbook/pb_toggle/toggle.rb +14 -13
  64. data/app/pb_kits/playbook/pb_user_badge/user_badge.rb +2 -2
  65. data/app/pb_kits/playbook/pb_vertical_nav/_vertical_nav.html.erb +1 -5
  66. data/app/pb_kits/playbook/pb_vertical_nav/docs/_block_no_title.html.erb +5 -0
  67. data/app/pb_kits/playbook/pb_vertical_nav/docs/example.yml +1 -0
  68. data/app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb +15 -9
  69. data/app/pb_kits/playbook/plugins/pb_chart_plugin.js +2 -0
  70. data/app/pb_kits/playbook/vendor.js +6 -0
  71. data/app/views/layouts/playbook/application.html.slim +0 -1
  72. data/lib/generators/kit/templates/kit_jsx.erb.tt +30 -12
  73. data/lib/playbook/engine.rb +1 -1
  74. data/lib/playbook/version.rb +1 -1
  75. metadata +43 -11
  76. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_change.html.erb +0 -15
  77. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_label.html.erb +0 -19
@@ -0,0 +1,29 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/spacing";
3
+ @import "../pb_caption/caption";
4
+
5
+ [class^=pb_section_separator_kit] {
6
+ display: flex;
7
+ justify-content: center;
8
+ align-items: center;
9
+ position: relative;
10
+
11
+ span {
12
+ display: inline-block;
13
+ padding: 0 $space_xs;
14
+ background: $bg_light;
15
+ position: relative;
16
+ z-index: 1;
17
+ }
18
+
19
+ &::after {
20
+ content: "";
21
+ height: 1px;
22
+ width: 100%;
23
+ background: $border_light;
24
+ position: absolute;
25
+ top: 50%;
26
+ left: 0;
27
+ z-index: 0;
28
+ }
29
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react"
2
+ import SectionSeparator from "../_section_separator.jsx"
3
+
4
+ function SectionSeparatorDefault() {
5
+ return (
6
+ <div>
7
+ <SectionSeparator />
8
+ </div>
9
+ )
10
+ }
11
+
12
+ export default SectionSeparatorDefault;
@@ -0,0 +1 @@
1
+ <%= pb_rails("section_separator") %>
@@ -0,0 +1 @@
1
+ <%= pb_rails("section_separator", props: { text: "Title Separator" }) %>
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - section_separator_text: Text Separator
5
+ - section_separator_line: Line Separator
6
+
7
+
8
+ react:
9
+ - section_separator_default: Default
@@ -0,0 +1 @@
1
+ export {default as SectionSeparatorDefault} from './_section_separator_default.jsx';
@@ -1,43 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- module PbDashboardValue
5
- class StatLabel < Playbook::PbKit::Base
4
+ module PbSectionSeparator
5
+ class SectionSeparator < Playbook::PbKit::Base
6
6
  PROPS = %i[configured_classname
7
7
  configured_data
8
8
  configured_id
9
- configured_label].freeze
9
+ configured_text].freeze
10
10
 
11
11
  def initialize(classname: default_configuration,
12
12
  data: default_configuration,
13
13
  id: default_configuration,
14
- label: default_configuration)
15
-
14
+ text: default_configuration)
16
15
  self.configured_classname = classname
17
16
  self.configured_data = data
18
17
  self.configured_id = id
19
- self.configured_label = label
20
- end
21
-
22
- def label
23
- default_value(configured_label, nil)
18
+ self.configured_text = text
24
19
  end
25
20
 
26
- def display_label
27
- unless label.nil?
28
- pb_label = Playbook::PbBody::Body.new(color: "light") do
29
- label
30
- end
31
- ApplicationController.renderer.render(partial: pb_label, as: :object)
21
+ def text
22
+ if is_set? configured_text
23
+ pb_text = Playbook::PbCaption::Caption.new(text: configured_text)
24
+ ApplicationController.renderer.render(partial: pb_text, as: :object)
32
25
  end
33
26
  end
34
27
 
35
28
  def kit_class
36
- "pb_stat_label_kit"
29
+ "pb_section_separator_kit"
37
30
  end
38
31
 
39
32
  def to_partial_path
40
- "pb_dashboard_value/child_kits/stat_label"
33
+ "pb_section_separator/section_separator"
41
34
  end
42
35
 
43
36
  private
@@ -27,8 +27,8 @@ module Playbook
27
27
 
28
28
  def rating
29
29
  rating_options = []
30
- (0..5).step(0.5) do |n|
31
- rating_options.push strip_trailing_zero(n)
30
+ (0..5).step(0.5) do |number|
31
+ rating_options.push strip_trailing_zero(number)
32
32
  end
33
33
  one_of_value(configured_rating.to_s, rating_options, "0")
34
34
  end
@@ -55,8 +55,8 @@ module Playbook
55
55
 
56
56
  private
57
57
 
58
- def strip_trailing_zero(n)
59
- n.to_s.sub(/\.?0+$/, "")
58
+ def strip_trailing_zero(number)
59
+ number.to_s.sub(/\.?0+$/, "")
60
60
  end
61
61
 
62
62
  DEFAULT = Object.new
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import PropTypes from "prop-types";
3
+
4
+ const propTypes = {
5
+ className: PropTypes.string,
6
+ id: PropTypes.string
7
+ };
8
+
9
+ class StatChange extends React.Component {
10
+ render() {
11
+ return (
12
+ <div className="pb_stat_change">
13
+ <span>STAT CHANGE CONTENT</span>
14
+ </div>
15
+ )
16
+ }
17
+ }
18
+
19
+ StatChange.propTypes = propTypes;
20
+
21
+ export default StatChange;
@@ -0,0 +1,2 @@
1
+ @import "../pb_icon/icon";
2
+ @import "../pb_body/body";
@@ -0,0 +1,18 @@
1
+ <%= pb_rails("stat_change", props: {
2
+ change: "increase",
3
+ value: "28.4%"
4
+ }) %>
5
+
6
+ <br>
7
+
8
+ <%= pb_rails("stat_change", props: {
9
+ change: "decrease",
10
+ value: "6.1%"
11
+ }) %>
12
+
13
+ <br>
14
+
15
+ <%= pb_rails("stat_change", props: {
16
+ change: "neutral",
17
+ value: "98%"
18
+ }) %>
@@ -0,0 +1,12 @@
1
+ import React from "react"
2
+ import StatChange from "../_stat_change.jsx"
3
+
4
+ function StatChangeDefault() {
5
+ return (
6
+ <div>
7
+ <StatChange />
8
+ </div>
9
+ )
10
+ }
11
+
12
+ export default StatChangeDefault;
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - stat_change_default: Default
5
+
6
+
7
+ react:
8
+ - stat_change_default: Default
9
+
@@ -0,0 +1 @@
1
+ export {default as StatChangeDefault} from './_stat_change_default.jsx';
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- module PbDashboardValue
4
+ module PbStatChange
5
5
  class StatChange < Playbook::PbKit::Base
6
6
  PROPS = %i[configured_change
7
7
  configured_classname
@@ -14,7 +14,6 @@ module Playbook
14
14
  data: default_configuration,
15
15
  id: default_configuration,
16
16
  value: default_configuration)
17
-
18
17
  self.configured_change = change
19
18
  self.configured_classname = classname
20
19
  self.configured_data = data
@@ -77,7 +76,7 @@ module Playbook
77
76
  end
78
77
 
79
78
  def to_partial_path
80
- "pb_dashboard_value/child_kits/stat_change"
79
+ "pb_stat_change/stat_change"
81
80
  end
82
81
 
83
82
  private
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import PropTypes from "prop-types";
3
+
4
+ const propTypes = {
5
+ className: PropTypes.string,
6
+ id: PropTypes.string
7
+ };
8
+
9
+ class StatValue extends React.Component {
10
+ render() {
11
+ return (
12
+ <div className="pb_stat_value">
13
+ <span>STAT VALUE CONTENT</span>
14
+ </div>
15
+ )
16
+ }
17
+ }
18
+
19
+ StatValue.propTypes = propTypes;
20
+
21
+ export default StatValue;
@@ -1,5 +1,7 @@
1
+ @import "../pb_title/title";
2
+
1
3
  [class^=pb_stat_value_kit]{
2
- &[class*=_wrapper] {
4
+ [class^=pb_stat_value_wrapper] {
3
5
  display: flex;
4
6
  justify-content: flex-start;
5
7
  align-items: baseline;
@@ -0,0 +1 @@
1
+ <%= pb_rails("stat_value", props: { value: 1048 }) %>
@@ -0,0 +1,12 @@
1
+ import React from "react"
2
+ import StatValue from "../_stat_value.jsx"
3
+
4
+ function StatValueDefault() {
5
+ return (
6
+ <div>
7
+ <StatValue />
8
+ </div>
9
+ )
10
+ }
11
+
12
+ export default StatValueDefault;
@@ -0,0 +1 @@
1
+ <%= pb_rails("stat_value", props: { value: "5,294", unit: "appt" }) %>
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - stat_value_default: Default
5
+ - stat_value_unit: Unit Value
6
+
7
+
8
+ react:
9
+ - stat_value_default: Default
@@ -0,0 +1 @@
1
+ export {default as StatValueDefault} from './_stat_value_default.jsx';
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- module PbDashboardValue
4
+ module PbStatValue
5
5
  class StatValue < Playbook::PbKit::Base
6
6
  PROPS = %i[configured_classname
7
7
  configured_data
@@ -14,7 +14,6 @@ module Playbook
14
14
  id: default_configuration,
15
15
  unit: default_configuration,
16
16
  value: default_configuration)
17
-
18
17
  self.configured_classname = classname
19
18
  self.configured_data = data
20
19
  self.configured_id = id
@@ -47,7 +46,7 @@ module Playbook
47
46
  end
48
47
 
49
48
  def to_partial_path
50
- "pb_dashboard_value/child_kits/stat_value"
49
+ "pb_stat_value/stat_value"
51
50
  end
52
51
 
53
52
  private
@@ -8,7 +8,7 @@
8
8
  thead {
9
9
  tr {
10
10
  th {
11
- padding: $value $cell-gutter;
11
+ padding: $cell-pad-md $cell-gutter;
12
12
 
13
13
  &:first-child {
14
14
  padding-left: $cell-pad-endcap;
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- include ActionView::Helpers::TagHelper
4
- include ActionView::Context
5
-
6
3
  module Playbook
7
4
  module PbTime
8
5
  class Time < Playbook::PbKit::Base
6
+ include ActionView::Helpers::TagHelper
7
+ include ActionView::Context
8
+
9
9
  PROPS = %i[configured_classname
10
10
  configured_data
11
11
  configured_id
@@ -49,13 +49,13 @@ module Playbook
49
49
  convert_to_timestamp(configured_timestamp)
50
50
  end
51
51
 
52
- def convert_to_timestamp(ts)
53
- ts.is_a?(String) ? DateTime.parse(ts) : ts
54
- ts.in_time_zone(timezone_value)
52
+ def convert_to_timestamp(time)
53
+ time.is_a?(String) ? DateTime.parse(time) : time
54
+ time.in_time_zone(timezone_value)
55
55
  end
56
56
 
57
57
  def format_time_string
58
- format_time = "#{hour}:#{minutes}#{meridian}" if is_set? configured_timestamp
58
+ "#{hour}:#{minutes}#{meridian}" if is_set? configured_timestamp
59
59
  end
60
60
 
61
61
  def hour
@@ -50,8 +50,12 @@ module Playbook
50
50
 
51
51
  def count
52
52
  if is_set? configured_count
53
- value = configured_count.is_a?(Integer) || configured_count.is_a?(Float) ?
54
- format_number(configured_count) : configured_count
53
+ value = if configured_count.is_a?(Integer) || configured_count.is_a?(Float)
54
+ format_number(configured_count)
55
+ else
56
+ configured_count
57
+ end
58
+
55
59
  pb_count = Playbook::PbBody::Body.new(color: "light") do
56
60
  value.to_s
57
61
  end
@@ -59,8 +63,8 @@ module Playbook
59
63
  end
60
64
  end
61
65
 
62
- def format_number(n)
63
- n.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/, '\1,\2')
66
+ def format_number(number)
67
+ number.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/, '\1,\2')
64
68
  end
65
69
 
66
70
  def kit_class
@@ -1,21 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Playbook
2
4
  module PbToggle
3
5
  class Toggle < Playbook::PbKit::Base
4
- PROPS = [:configured_classname,
5
- :configured_data,
6
- :configured_id,
7
- :configured_size,
8
- :configured_checked
9
- ].freeze
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_size
10
+ configured_checked].freeze
10
11
 
11
12
  def initialize(classname: default_configuration,
12
- data: default_configuration,
13
- id: default_configuration,
14
- size: default_configuration,
15
- checked: default_configuration)
13
+ data: default_configuration,
14
+ id: default_configuration,
15
+ size: default_configuration,
16
+ checked: default_configuration)
16
17
  self.configured_classname = classname
17
- self.configured_data = data
18
- self.configured_id = id
18
+ self.configured_data = data
19
+ self.configured_id = id
19
20
  self.configured_size = size
20
21
  self.configured_checked = checked
21
22
  end
@@ -37,7 +38,7 @@ module Playbook
37
38
  toggle_options = [
38
39
  "pb_toggle_kit",
39
40
  size,
40
- checked_class
41
+ checked_class,
41
42
  ]
42
43
  toggle_options.join("_")
43
44
  end