playbook_ui 2.8.6 → 2.8.7

Sign up to get free protection for your applications and to get access to all the features.
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,25 @@
1
+ <%= pb_rails("currency", props: {
2
+ dollar_sign: "$",
3
+ label: "Caption",
4
+ value: "2,000.",
5
+ unit: "00",
6
+ size: "lg"
7
+ }) %>
8
+
9
+ <%= pb_rails("currency", props: {
10
+ align: "center",
11
+ dollar_sign: "$",
12
+ label: "Caption",
13
+ value: "2,000.",
14
+ unit: "00",
15
+ size: "lg"
16
+ }) %>
17
+
18
+ <%= pb_rails("currency", props: {
19
+ align: "right",
20
+ dollar_sign: "$",
21
+ label: "Caption",
22
+ value: "2,000.",
23
+ unit: "00",
24
+ size: "lg"
25
+ }) %>
@@ -0,0 +1,25 @@
1
+ <%= pb_rails("currency", props: {
2
+ dollar_sign: "$",
3
+ label: "Caption",
4
+ value: "2,000.",
5
+ unit: "00",
6
+ size: "sm"
7
+ }) %>
8
+
9
+ <%= pb_rails("currency", props: {
10
+ align: "center",
11
+ dollar_sign: "$",
12
+ label: "Caption",
13
+ value: "2,000.",
14
+ unit: "00",
15
+ size: "sm"
16
+ }) %>
17
+
18
+ <%= pb_rails("currency", props: {
19
+ align: "right",
20
+ dollar_sign: "$",
21
+ label: "Caption",
22
+ value: "2,000.",
23
+ unit: "00",
24
+ size: "sm"
25
+ }) %>
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - currency_small: Small
5
+ - currency_large: Large
6
+
7
+
8
+ react:
9
+ - currency_default: Default
@@ -0,0 +1 @@
1
+ export {default as CurrencyDefault} from './_currency_default.jsx';
@@ -1,6 +1,8 @@
1
1
  import colors from '../tokens/_colors.scss';
2
2
  import typography from '../tokens/_typography.scss';
3
3
 
4
+ import Highcharts from 'highcharts'
5
+
4
6
  const highchartsTheme = {
5
7
  colors: [
6
8
  colors.data_1,
@@ -1,8 +1,7 @@
1
1
  @import "dashboard_value_mixins";
2
- @import "child_kits/stat_value";
3
- @import "../pb_icon/icon";
2
+ @import "../pb_stat_value/stat_value";
3
+ @import "../pb_stat_change/stat_change";
4
4
  @import "../pb_body/body";
5
- @import "../pb_title/title";
6
5
 
7
6
  [class^=pb_dashboard_value_kit]{
8
7
  @each $align_name, $align_value in $pb_dashboard_value_align {
@@ -35,21 +35,23 @@ module Playbook
35
35
 
36
36
  def stat_label
37
37
  if is_set? configured_stat_label
38
- pb_label = Playbook::PbDashboardValue::StatLabel.new(configured_stat_label)
38
+ pb_label = Playbook::PbBody::Body.new(color: "light") do
39
+ configured_stat_label[:label]
40
+ end
39
41
  ApplicationController.renderer.render(partial: pb_label, as: :object)
40
42
  end
41
43
  end
42
44
 
43
45
  def stat_value
44
46
  if is_set? configured_stat_value
45
- pb_value = Playbook::PbDashboardValue::StatValue.new(configured_stat_value)
47
+ pb_value = Playbook::PbStatValue::StatValue.new(configured_stat_value)
46
48
  ApplicationController.renderer.render(partial: pb_value, as: :object)
47
49
  end
48
50
  end
49
51
 
50
52
  def stat_change
51
53
  if is_set? configured_stat_change
52
- pb_change = Playbook::PbDashboardValue::StatChange.new(configured_stat_change)
54
+ pb_change = Playbook::PbStatChange::StatChange.new(configured_stat_change)
53
55
  ApplicationController.renderer.render(partial: pb_change, as: :object)
54
56
  end
55
57
  end
@@ -2,8 +2,6 @@ examples:
2
2
 
3
3
  rails:
4
4
  - dashboard_value_default: Full Example
5
- - dashboard_value_change: Change
6
- - dashboard_value_label: Label
7
5
  - dashboard_value_align: Align
8
6
 
9
7
 
@@ -1,9 +1,2 @@
1
1
  @import "../pb_icon/icon";
2
- @import "../pb_body/body";
3
2
  @import "../pb_title/title";
4
-
5
- [class^=pb_date_kit] {
6
- [class^=pb_body] {
7
- font-weight: $bold !important;
8
- }
9
- }
@@ -3,6 +3,9 @@
3
3
  module Playbook
4
4
  module PbDate
5
5
  class Date < Playbook::PbKit::Base
6
+ include ActionView::Helpers::TagHelper
7
+ include ActionView::Context
8
+
6
9
  PROPS = %i[configured_classname
7
10
  configured_data
8
11
  configured_id
@@ -39,12 +42,12 @@ module Playbook
39
42
  private
40
43
 
41
44
  def timestamp
42
- timestamp = convert_to_timestamp(configured_timestamp)
45
+ convert_to_timestamp(configured_timestamp)
43
46
  end
44
47
 
45
- def convert_to_timestamp(ts)
46
- ts.is_a?(String) ? DateTime.parse(ts) : ts
47
- ts.in_time_zone(timezone_value)
48
+ def convert_to_timestamp(time)
49
+ time.is_a?(String) ? DateTime.parse(time) : time
50
+ time.in_time_zone(timezone_value)
48
51
  end
49
52
 
50
53
  def timezone_value
@@ -74,15 +77,14 @@ module Playbook
74
77
  end
75
78
 
76
79
  def text
77
- "<span>#{day_of_week} &middot; #{month} #{day}</span>".html_safe
80
+ content_tag(:span) do
81
+ "#{day_of_week} &middot; #{month} #{day}".html_safe
82
+ end
78
83
  end
79
84
 
80
85
  def display_value_sm
81
86
  if is_set? configured_timestamp
82
- pb_value = Playbook::PbBody::Body.new(color: "default") do
83
- icon +
84
- text
85
- end
87
+ pb_value = Playbook::PbTitle::Title.new(size: 4, text: icon + text)
86
88
  ApplicationController.renderer.render(partial: pb_value, as: :object)
87
89
  end
88
90
  end
@@ -1,23 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Playbook
2
4
  module PbLabelPill
3
5
  class LabelPill < Playbook::PbKit::Base
4
- PROPS = [:configured_classname,
5
- :configured_data,
6
- :configured_id,
7
- :configured_label,
8
- :configured_pill_value,
9
- :configured_variant].freeze
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_label
10
+ configured_pill_value
11
+ configured_variant].freeze
10
12
 
11
13
  def initialize(classname: default_configuration,
12
- data: default_configuration,
13
- id: default_configuration,
14
- label: default_configuration,
15
- pill_value: default_configuration,
16
- variant: default_configuration
17
- )
14
+ data: default_configuration,
15
+ id: default_configuration,
16
+ label: default_configuration,
17
+ pill_value: default_configuration,
18
+ variant: default_configuration)
18
19
  self.configured_classname = classname
19
- self.configured_data = data
20
- self.configured_id = id
20
+ self.configured_data = data
21
+ self.configured_id = id
21
22
  self.configured_label = label
22
23
  self.configured_pill_value = pill_value
23
24
  self.configured_variant = variant
@@ -26,14 +27,14 @@ module Playbook
26
27
  def label
27
28
  if is_set? configured_label
28
29
  pb_caption = Playbook::PbCaption::Caption.new(text: configured_label, classname: "pb_label_pill_label")
29
- ApplicationController.renderer.render(partial: pb_caption, as: :object)
30
+ ApplicationController.renderer.render(partial: pb_caption, as: :object)
30
31
  end
31
32
  end
32
33
 
33
34
  def pill
34
35
  if is_set? configured_pill_value
35
36
  pb_pill = Playbook::PbPill::Pill.new(text: configured_pill_value, variant: variant, classname: "pb_label_pill_pill")
36
- ApplicationController.renderer.render(partial: pb_pill, as: :object)
37
+ ApplicationController.renderer.render(partial: pb_pill, as: :object)
37
38
  end
38
39
  end
39
40
 
@@ -3,45 +3,45 @@
3
3
  module Playbook
4
4
  module PbOwner
5
5
  class Owner < Playbook::PbKit::Base
6
- PROPS = [:configured_classname,
7
- :configured_data,
8
- :configured_id,
9
- :configured_first_name,
10
- :configured_last_name].freeze
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_first_name
10
+ configured_last_name].freeze
11
11
 
12
- def initialize(classname: default_configuration,
13
- data: default_configuration,
14
- id: default_configuration,
15
- first_name: default_configuration,
16
- last_name: default_configuration)
12
+ def initialize(classname: default_configuration,
13
+ data: default_configuration,
14
+ id: default_configuration,
15
+ first_name: default_configuration,
16
+ last_name: default_configuration)
17
17
  self.configured_classname = classname
18
- self.configured_data = data
19
- self.configured_id = id
18
+ self.configured_data = data
19
+ self.configured_id = id
20
20
  self.configured_first_name = first_name
21
21
  self.configured_last_name = last_name
22
22
  end
23
23
 
24
- def first_name
24
+ def first_name
25
25
  pb_first_name = Playbook::PbBody::Body.new(tag: "span", classname: "pb_owner_first") do
26
26
  default_value(configured_first_name, "")
27
27
  end
28
28
  ApplicationController.renderer.render(partial: pb_first_name, as: :object)
29
29
  end
30
30
 
31
- def last_name
31
+ def last_name
32
32
  if is_set? configured_last_name
33
33
  pb_last_name = Playbook::PbTitle::Title.new(text: configured_last_name, size: 4)
34
34
  ApplicationController.renderer.render(partial: pb_last_name, as: :object)
35
35
  end
36
36
  end
37
37
 
38
- def to_partial_path
38
+ def to_partial_path
39
39
  "pb_owner/owner"
40
40
  end
41
41
 
42
- private
42
+ private
43
43
 
44
- DEFAULT = Object.new
44
+ DEFAULT = Object.new
45
45
  private_constant :DEFAULT
46
46
  def default_configuration
47
47
  DEFAULT
@@ -1,24 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Playbook
2
4
  module PbOwnerPhone
3
5
  class OwnerPhone < Playbook::PbKit::Base
4
- PROPS = [:configured_classname,
5
- :configured_data,
6
- :configured_id,
7
- :configured_first_name,
8
- :configured_last_name,
9
- :configured_number,
10
- :configured_icon].freeze
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_first_name
10
+ configured_last_name
11
+ configured_number
12
+ configured_icon].freeze
11
13
 
12
14
  def initialize(classname: default_configuration,
13
- data: default_configuration,
14
- id: default_configuration,
15
- first_name: default_configuration,
16
- last_name: default_configuration,
17
- number: default_configuration,
18
- icon: default_configuration)
15
+ data: default_configuration,
16
+ id: default_configuration,
17
+ first_name: default_configuration,
18
+ last_name: default_configuration,
19
+ number: default_configuration,
20
+ icon: default_configuration)
19
21
  self.configured_classname = classname
20
- self.configured_data = data
21
- self.configured_id = id
22
+ self.configured_data = data
23
+ self.configured_id = id
22
24
  self.configured_first_name = first_name
23
25
  self.configured_last_name = last_name
24
26
  self.configured_number = number
@@ -26,25 +28,21 @@ module Playbook
26
28
  end
27
29
 
28
30
  def icon
29
- if is_set? configured_icon
30
- configured_icon
31
- end
31
+ configured_icon if is_set? configured_icon
32
32
  end
33
33
 
34
34
  def phone
35
- phone = Playbook::PbPhone::Phone.new({ icon: configured_icon, number: configured_number })
35
+ phone = Playbook::PbPhone::Phone.new(icon: configured_icon, number: configured_number)
36
36
  ApplicationController.renderer.render(partial: phone, as: :object)
37
37
  end
38
38
 
39
39
  def name
40
- owner = Playbook::PbOwner::Owner.new({ first_name: configured_first_name, last_name: configured_last_name })
40
+ owner = Playbook::PbOwner::Owner.new(first_name: configured_first_name, last_name: configured_last_name)
41
41
  ApplicationController.renderer.render(partial: owner, as: :object)
42
42
  end
43
43
 
44
44
  def number
45
- if is_set? configured_number
46
- configured_number
47
- end
45
+ configured_number if is_set? configured_number
48
46
  end
49
47
 
50
48
  def to_partial_path
@@ -1,23 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "action_view"
2
- include ActionView::Helpers::NumberHelper
3
4
 
4
5
  module Playbook
5
6
  module PbPhone
6
7
  class Phone < Playbook::PbKit::Base
7
- PROPS = [:configured_classname,
8
- :configured_data,
9
- :configured_id,
10
- :configured_icon,
11
- :configured_number].freeze
8
+ include ActionView::Helpers::NumberHelper
9
+
10
+ PROPS = %i[configured_classname
11
+ configured_data
12
+ configured_id
13
+ configured_icon
14
+ configured_number].freeze
12
15
 
13
16
  def initialize(classname: default_configuration,
14
- data: default_configuration,
15
- id: default_configuration,
16
- icon: default_configuration,
17
- number: default_configuration)
17
+ data: default_configuration,
18
+ id: default_configuration,
19
+ icon: default_configuration,
20
+ number: default_configuration)
18
21
  self.configured_classname = classname
19
- self.configured_data = data
20
- self.configured_id = id
22
+ self.configured_data = data
23
+ self.configured_id = id
21
24
  self.configured_icon = icon
22
25
  self.configured_number = number
23
26
  end
@@ -25,7 +28,7 @@ module Playbook
25
28
  def icon
26
29
  # TODO: Strict options and automaticlly pass the correct icon name
27
30
  if is_set? configured_icon
28
- icon_props = { icon: configured_icon, fixed_width: true}
31
+ icon_props = { icon: configured_icon, fixed_width: true }
29
32
  pb_icon = Playbook::PbIcon::Icon.new(icon_props)
30
33
  ApplicationController.renderer.render(partial: pb_icon, as: :object)
31
34
  else
@@ -35,9 +38,7 @@ module Playbook
35
38
 
36
39
  def number
37
40
  if is_set? configured_number
38
- if formatted_number
39
- return number_to_phone(formatted_number, area_code: true)
40
- end
41
+ return number_to_phone(formatted_number, area_code: true) if formatted_number
41
42
  end
42
43
  end
43
44
 
@@ -2,5 +2,5 @@
2
2
  id: object.id,
3
3
  data: object.data,
4
4
  class: object.classname(object.kit_class)) do %>
5
- <%= object.display_label %>
5
+ <span><%= object.text %></span>
6
6
  <% end %>
@@ -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 SectionSeparator extends React.Component {
10
+ render() {
11
+ return (
12
+ <div className="pb_section_separator">
13
+ <span>SECTION SEPARATOR CONTENT</span>
14
+ </div>
15
+ )
16
+ }
17
+ }
18
+
19
+ SectionSeparator.propTypes = propTypes;
20
+
21
+ export default SectionSeparator;