playbook_ui 2.9.6 → 2.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/_avatar.html.erb +1 -1
  3. data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
  4. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.html.erb +5 -5
  5. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.html.erb +4 -4
  6. data/app/pb_kits/playbook/pb_button/_button.html.erb +3 -21
  7. data/app/pb_kits/playbook/pb_button/button.rb +47 -124
  8. data/app/pb_kits/playbook/pb_caption/caption.rb +1 -1
  9. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_contact/_contact.jsx +18 -8
  11. data/app/pb_kits/playbook/pb_contact/contact.rb +11 -2
  12. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +4 -1
  13. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +3 -0
  14. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.html.erb +12 -4
  15. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -4
  16. data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +13 -70
  17. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_align.html.erb +6 -6
  18. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_align.jsx +6 -6
  19. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.html.erb +6 -6
  20. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +6 -6
  21. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.html.erb +3 -3
  22. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +12 -33
  23. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +4 -2
  24. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified.html.erb +0 -1
  25. data/app/pb_kits/playbook/pb_layout/_body.html.erb +2 -2
  26. data/app/pb_kits/playbook/pb_layout/_layout.html.erb +2 -2
  27. data/app/pb_kits/playbook/pb_layout/_sidebar.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_layout/body.rb +5 -29
  29. data/app/pb_kits/playbook/pb_layout/layout.rb +31 -76
  30. data/app/pb_kits/playbook/pb_layout/sidebar.rb +5 -29
  31. data/app/pb_kits/playbook/pb_list/_item.html.erb +1 -1
  32. data/app/pb_kits/playbook/pb_list/_list.html.erb +3 -4
  33. data/app/pb_kits/playbook/pb_list/item.rb +5 -29
  34. data/app/pb_kits/playbook/pb_list/list.rb +41 -90
  35. data/app/pb_kits/playbook/pb_message/_message.html.erb +18 -5
  36. data/app/pb_kits/playbook/pb_message/docs/_message_default.html.erb +10 -20
  37. data/app/pb_kits/playbook/pb_message/message.rb +15 -72
  38. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +1 -0
  39. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +2 -1
  40. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.html.erb +4 -1
  41. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.jsx +4 -1
  42. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.html.erb +4 -1
  43. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.jsx +4 -1
  44. data/app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb +2 -2
  45. data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +6 -35
  46. data/app/pb_kits/playbook/pb_star_rating/_star_rating.html.erb +11 -11
  47. data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +5 -5
  48. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +9 -51
  49. data/app/pb_kits/playbook/pb_stat_change/_stat_change.html.erb +5 -2
  50. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +1 -1
  51. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb +3 -3
  52. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx +3 -3
  53. data/app/pb_kits/playbook/pb_stat_change/stat_change.rb +10 -60
  54. data/app/pb_kits/playbook/pb_timestamp/_timestamp.html.erb +2 -2
  55. data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +6 -39
  56. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
  57. data/app/pb_kits/playbook/pb_user/_user.html.erb +13 -4
  58. data/app/pb_kits/playbook/pb_user/docs/_user_default.html.erb +3 -6
  59. data/app/pb_kits/playbook/pb_user/docs/_user_size.html.erb +3 -6
  60. data/app/pb_kits/playbook/pb_user/docs/_user_vertical_size.html.erb +3 -6
  61. data/app/pb_kits/playbook/pb_user/user.rb +23 -95
  62. data/app/pb_kits/playbook/pb_user_badge/_user_badge.html.erb +1 -1
  63. data/app/pb_kits/playbook/pb_user_badge/user_badge.rb +13 -49
  64. data/app/pb_kits/playbook/pb_vertical_nav/_item.html.erb +4 -2
  65. data/app/pb_kits/playbook/pb_vertical_nav/_vertical_nav.html.erb +9 -5
  66. data/app/pb_kits/playbook/pb_vertical_nav/item.rb +10 -49
  67. data/app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb +7 -58
  68. data/app/pb_kits/playbook/props.rb +1 -0
  69. data/app/pb_kits/playbook/props/date.rb +11 -0
  70. data/lib/playbook/version.rb +1 -1
  71. metadata +3 -2
@@ -7,9 +7,11 @@ function ContactDefault() {
7
7
  <Contact
8
8
  contactType="cell"
9
9
  contactValue="349-185-9988"
10
+ contactDetail="John's Cell"
10
11
  />
11
12
  <Contact
12
13
  contactValue="5555555555"
14
+ contactDetail="Home"
13
15
  />
14
16
  <Contact
15
17
  contactType="email"
@@ -18,6 +20,7 @@ function ContactDefault() {
18
20
  <Contact
19
21
  contactType="work"
20
22
  contactValue="3245627482"
23
+ contactDetail="John's Work"
21
24
  />
22
25
  </div>
23
26
  )
@@ -1,8 +1,16 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname(object.kit_class)) do %>
5
- <%= object.stat_label %>
6
- <%= object.stat_value %>
7
- <%= object.stat_change %>
4
+ class: object.classname) do %>
5
+ <% if object.stat_label.present? %>
6
+ <%= pb_rails("body", props: { color: "light", text: object.stat_label } ) %>
7
+ <% end %>
8
+
9
+ <% if object.stat_value.present? %>
10
+ <%= pb_rails("stat_value", props: object.stat_value) %>
11
+ <% end %>
12
+
13
+ <% if object.stat_change.present? %>
14
+ <%= pb_rails("stat_change", props: object.stat_change) %>
15
+ <% end %>
8
16
  <% end %>
@@ -17,9 +17,7 @@ type DashboardValueProps = {
17
17
  change?: String,
18
18
  value?: String | Number
19
19
  },
20
- stat_label?: {
21
- label?: String
22
- },
20
+ stat_label?: String,
23
21
  stat_value?: {
24
22
  unit?: String,
25
23
  value?: String | Number
@@ -49,7 +47,7 @@ const DashboardValue = (props: DashboardValueProps) => {
49
47
  const statLabel = function(stat_label) {
50
48
  if (stat_label) {
51
49
  return (
52
- <Body color="light">{stat_label.label}</Body>
50
+ <Body color="light">{stat_label}</Body>
53
51
  )
54
52
  }
55
53
  }
@@ -2,80 +2,23 @@
2
2
 
3
3
  module Playbook
4
4
  module PbDashboardValue
5
- class DashboardValue < Playbook::PbKit::Base
6
- PROPS = %i[configured_align
7
- configured_classname
8
- configured_data
9
- configured_id
10
- configured_stat_change
11
- configured_stat_label
12
- configured_stat_value].freeze
5
+ class DashboardValue
6
+ include Playbook::Props
13
7
 
14
- def initialize(align: default_configuration,
15
- classname: default_configuration,
16
- data: default_configuration,
17
- id: default_configuration,
18
- stat_change: default_configuration,
19
- stat_label: default_configuration,
20
- stat_value: default_configuration)
8
+ partial "pb_dashboard_value/dashboard_value"
21
9
 
22
- self.configured_align = align
23
- self.configured_classname = classname
24
- self.configured_data = data
25
- self.configured_id = id
26
- self.configured_stat_change = stat_change
27
- self.configured_stat_label = stat_label
28
- self.configured_stat_value = stat_value
29
- end
30
-
31
- def align
32
- align_options = %w[left center right]
33
- one_of_value(configured_align, align_options, "left")
34
- end
35
-
36
- def stat_label
37
- if is_set? configured_stat_label
38
- pb_label = Playbook::PbBody::Body.new(color: "light") do
39
- configured_stat_label[:label]
40
- end
41
- ApplicationController.renderer.render(partial: pb_label, as: :object)
42
- end
43
- end
44
-
45
- def stat_value
46
- if is_set? configured_stat_value
47
- pb_value = Playbook::PbStatValue::StatValue.new(configured_stat_value)
48
- ApplicationController.renderer.render(partial: pb_value, as: :object)
49
- end
50
- end
51
-
52
- def stat_change
53
- if is_set? configured_stat_change
54
- pb_change = Playbook::PbStatChange::StatChange.new(configured_stat_change)
55
- ApplicationController.renderer.render(partial: pb_change, as: :object)
56
- end
57
- end
58
-
59
- def kit_class
60
- kit_options = [
61
- "pb_dashboard_value_kit",
62
- align,
63
- ]
64
- kit_options.join("_")
65
- end
66
-
67
- def to_partial_path
68
- "pb_dashboard_value/dashboard_value"
69
- end
70
-
71
- private
10
+ prop :align, type: Playbook::Props::Enum,
11
+ values: %w[left center right],
12
+ default: "left"
13
+ prop :stat_change, type: Playbook::Props::Hash,
14
+ default: {}
15
+ prop :stat_label
16
+ prop :stat_value, type: Playbook::Props::Hash,
17
+ default: {}
72
18
 
73
- DEFAULT = Object.new
74
- private_constant :DEFAULT
75
- def default_configuration
76
- DEFAULT
19
+ def classname
20
+ generate_classname("pb_dashboard_value_kit", align)
77
21
  end
78
- attr_accessor(*PROPS)
79
22
  end
80
23
  end
81
24
  end
@@ -1,23 +1,23 @@
1
1
  <%= pb_rails("dashboard_value", props: {
2
- stat_label: {label: "Top Title Value"},
2
+ stat_label: "Top Title Value",
3
3
  stat_value: {value: 1428, unit: "appts"},
4
- stat_change: {change: "decrease", value: "26.1%"}
4
+ stat_change: {change: "decrease", value: 26.1}
5
5
  }) %>
6
6
 
7
7
  <br><br>
8
8
 
9
9
  <%= pb_rails("dashboard_value", props: {
10
10
  align: "center",
11
- stat_label: {label: "Top Title Value"},
11
+ stat_label: "Top Title Value",
12
12
  stat_value: {value: 1428, unit: "appts"},
13
- stat_change: {change: "decrease", value: "26.1%"}
13
+ stat_change: {change: "decrease", value: 56 }
14
14
  }) %>
15
15
 
16
16
  <br><br>
17
17
 
18
18
  <%= pb_rails("dashboard_value", props: {
19
19
  align: "right",
20
- stat_label: {label: "Top Title Value"},
20
+ stat_label: "Top Title Value",
21
21
  stat_value: {value: 1428, unit: "appts"},
22
- stat_change: {change: "decrease", value: "26.1%"}
22
+ stat_change: {change: "decrease", value: 86.1 }
23
23
  }) %>
@@ -5,25 +5,25 @@ function DashboardValueAlign() {
5
5
  return (
6
6
  <div>
7
7
  <DashboardValue
8
- stat_label={{label: "Top Title Value"}}
8
+ stat_label="Top Title Value"
9
9
  stat_value={{value: "1,428", unit: "appts"}}
10
- stat_change={{change: "decrease", value: "26.1%"}} />
10
+ stat_change={{change: "decrease", value: "26.1"}} />
11
11
 
12
12
  <br/><br/>
13
13
 
14
14
  <DashboardValue
15
15
  align="center"
16
- stat_label={{label: "Top Title Value"}}
16
+ stat_label="Top Title Value"
17
17
  stat_value={{value: "1,428", unit: "appts"}}
18
- stat_change={{change: "decrease", value: "26.1%"}} />
18
+ stat_change={{change: "decrease", value: 56.1}} />
19
19
 
20
20
  <br/><br/>
21
21
 
22
22
  <DashboardValue
23
23
  align="right"
24
- stat_label={{label: "Top Title Value"}}
24
+ stat_label="Top Title Value"
25
25
  stat_value={{value: "1,428", unit: "appts"}}
26
- stat_change={{change: "decrease", value: "26.1%"}} />
26
+ stat_change={{change: "decrease", value: 86}} />
27
27
  </div>
28
28
  )
29
29
  }
@@ -1,21 +1,21 @@
1
1
  <%= pb_rails("dashboard_value", props: {
2
- stat_label: {label: "Decreased Value"},
2
+ stat_label: "Decreased Value",
3
3
  stat_value: {value: 1428, unit: "appts"},
4
- stat_change: {change: "decrease", value: "26.1%"}
4
+ stat_change: {change: "decrease", value: 26.1}
5
5
  }) %>
6
6
 
7
7
  <br><br>
8
8
 
9
9
  <%= pb_rails("dashboard_value", props: {
10
- stat_label: {label: "Increased Value"},
10
+ stat_label: "Increased Value",
11
11
  stat_value: {value: 938, unit: "homes"},
12
- stat_change: {change: "increase", value: "26.1%"}
12
+ stat_change: {change: "increase", value: 56.1}
13
13
  }) %>
14
14
 
15
15
  <br><br>
16
16
 
17
17
  <%= pb_rails("dashboard_value", props: {
18
- stat_label: {label: "Neutral Value"},
18
+ stat_label: "Neutral Value",
19
19
  stat_value: {value: 261, unit: "windows"},
20
- stat_change: {value: "26.1%"}
20
+ stat_change: {value: 86}
21
21
  }) %>
@@ -5,23 +5,23 @@ function DashboardValueDefault() {
5
5
  return (
6
6
  <div>
7
7
  <DashboardValue
8
- stat_label={{label: "Decreased Value"}}
8
+ stat_label="Decreased Value"
9
9
  stat_value={{value: "1,428", unit: "appts"}}
10
- stat_change={{change: "decrease", value: "26.1%"}} />
10
+ stat_change={{change: "decrease", value: "26.1"}} />
11
11
 
12
12
  <br/><br/>
13
13
 
14
14
  <DashboardValue
15
- stat_label={{label: "Increased Value"}}
15
+ stat_label="Increased Value"
16
16
  stat_value={{value: "938", unit: "homes"}}
17
- stat_change={{change: "increase", value: "26.1%"}} />
17
+ stat_change={{change: "increase", value: 56.1}} />
18
18
 
19
19
  <br/><br/>
20
20
 
21
21
  <DashboardValue
22
- stat_label={{label: "Neutral Value"}}
22
+ stat_label="Neutral Value"
23
23
  stat_value={{value: "261", unit: "windows"}}
24
- stat_change={{value: "26.1%"}} />
24
+ stat_change={{value: 86}} />
25
25
  </div>
26
26
  )
27
27
  }
@@ -1,14 +1,14 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("pb_date_range_inline")) do %>
4
+ class: object.classname) do %>
5
5
 
6
6
  <%= pb_rails("body", props: { tag: "span", color: "light" }) do %>
7
7
  <%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true }) %>
8
8
  <% end %>
9
9
 
10
10
  <%= pb_rails("body", props: { tag: "span"}) do %>
11
- <%= object.start_date %>
11
+ <%= object.start_date_display %>
12
12
  <% end %>
13
13
 
14
14
  <%= pb_rails("body", props: { tag: "span", color: "light" }) do %>
@@ -16,7 +16,7 @@
16
16
  <% end %>
17
17
 
18
18
  <%= pb_rails("body", props: { tag: "span"}) do %>
19
- <%= object.end_date %>
19
+ <%= object.end_date_display %>
20
20
  <% end %>
21
21
 
22
22
  <% end %>
@@ -2,54 +2,33 @@
2
2
 
3
3
  module Playbook
4
4
  module PbDateRangeInline
5
- class DateRangeInline < Playbook::PbKit::Base
5
+ class DateRangeInline
6
6
  include ActionView::Helpers::TagHelper
7
7
  include ActionView::Context
8
+ include Playbook::Props
8
9
 
9
- PROPS = %i[configured_classname
10
- configured_data
11
- configured_end_date
12
- configured_id
13
- configured_start_date].freeze
10
+ partial "pb_date_range_inline/date_range_inline"
14
11
 
15
- def initialize(classname: default_configuration,
16
- data: default_configuration,
17
- end_date: default_configuration,
18
- id: default_configuration,
19
- start_date: default_configuration)
20
- self.configured_classname = classname
21
- self.configured_data = data
22
- self.configured_id = id
23
- self.configured_end_date = end_date
24
- self.configured_start_date = start_date
12
+ prop :end_date, type: Playbook::Props::Date, required: true
13
+ prop :start_date, type: Playbook::Props::Date, required: true
14
+
15
+ def classname
16
+ generate_classname("pb_date_range_inline_kit")
25
17
  end
26
18
 
27
- def end_date
28
- date_time = Playbook::PbKit::PbDateTime.new(default_value(configured_end_date, ""))
19
+ def end_date_display
20
+ date_time = Playbook::PbKit::PbDateTime.new(end_date)
29
21
  content_tag(:time, datetime: date_time.to_iso) do
30
22
  "#{date_time.to_day} #{date_time.to_month_downcase} #{date_time.to_year}"
31
23
  end
32
24
  end
33
25
 
34
- def start_date
35
- date_time = Playbook::PbKit::PbDateTime.new(default_value(configured_start_date, ""))
26
+ def start_date_display
27
+ date_time = Playbook::PbKit::PbDateTime.new(start_date)
36
28
  content_tag(:time, datetime: date_time.to_iso) do
37
29
  "#{date_time.to_day} #{date_time.to_month_downcase} #{date_time.to_year}"
38
30
  end
39
31
  end
40
-
41
- def to_partial_path
42
- "pb_date_range_inline/date_range_inline"
43
- end
44
-
45
- private
46
-
47
- DEFAULT = Object.new
48
- private_constant :DEFAULT
49
- def default_configuration
50
- DEFAULT
51
- end
52
- attr_accessor(*PROPS)
53
32
  end
54
33
  end
55
34
  end
@@ -20,8 +20,10 @@
20
20
  text: object.city_state_zip,
21
21
  } %>
22
22
 
23
- <%= pb_rails "body", props: { classname: "home-hashtag", tag: "span" } do %>
24
- H#<%= object.home_id %>
23
+ <% if object.home_id %>
24
+ <%= pb_rails "body", props: { classname: "home-hashtag", tag: "span" } do %>
25
+ H#<%= object.home_id %>
26
+ <% end %>
25
27
  <% end %>
26
28
 
27
29
  <%= pb_rails "body", props: { color: "light", tag: "span" } do %>
@@ -1,7 +1,6 @@
1
1
  <%= pb_rails("home_address_street", props: {
2
2
  address: "70 Prospect Ave",
3
3
  city: "West Chester",
4
- home_id: 8250263,
5
4
  state: "PA",
6
5
  zipcode: "19382",
7
6
  territory: "PHL",
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("layout_body")) do %>
5
- <%= object.yield(context: self) %>
4
+ class: object.classname) do %>
5
+ <%= capture(&object.children) %>
6
6
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("pb_layout_#{object.size}#{object.position}#{object.dark}#{object.transparent}#{object.full}#{object.collapse}")) do %>
5
- <%= object.yield(context: self) %>
4
+ class: object.classname) do %>
5
+ <%= capture(&object.children) %>
6
6
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("layout_sidebar")) do %>
5
- <%= object.yield(context: self) %>
4
+ class: object.classname) do %>
5
+ <%= capture(&object.children) %>
6
6
  <% end %>
@@ -2,38 +2,14 @@
2
2
 
3
3
  module Playbook
4
4
  module PbLayout
5
- class Body < Playbook::PbKit::Base
6
- PROPS = %i[configured_classname
7
- configured_data
8
- configured_id
9
- block].freeze
5
+ class Body
6
+ include Playbook::Props
10
7
 
11
- def initialize(classname: default_configuration,
12
- data: default_configuration,
13
- id: default_configuration,
14
- &block)
15
- self.configured_classname = classname
16
- self.configured_data = data
17
- self.configured_id = id
18
- self.block = block_given? ? block : nil
19
- end
20
-
21
- def yield(context:)
22
- context.capture(&block)
23
- end
24
-
25
- def to_partial_path
26
- "pb_layout/body"
27
- end
28
-
29
- private
8
+ partial "pb_layout/body"
30
9
 
31
- DEFAULT = Object.new
32
- private_constant :DEFAULT
33
- def default_configuration
34
- DEFAULT
10
+ def classname
11
+ generate_classname("layout_body")
35
12
  end
36
- attr_accessor(*PROPS)
37
13
  end
38
14
  end
39
15
  end