playbook_ui 2.9.6 → 2.9.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 (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
@@ -2,88 +2,31 @@
2
2
 
3
3
  module Playbook
4
4
  module PbMessage
5
- class Message < Playbook::PbKit::Base
6
- PROPS = %i[configured_avatar
7
- configured_classname
8
- configured_data
9
- configured_id
10
- configured_label
11
- configured_message
12
- configured_timestamp].freeze
5
+ class Message
6
+ include Playbook::Props
13
7
 
14
- def initialize(avatar: default_configuration,
15
- classname: default_configuration,
16
- data: default_configuration,
17
- id: default_configuration,
18
- label: default_configuration,
19
- message: default_configuration,
20
- timestamp: default_configuration)
21
- self.configured_avatar = avatar
22
- self.configured_classname = classname
23
- self.configured_data = data
24
- self.configured_id = id
25
- self.configured_label = label
26
- self.configured_message = message
27
- self.configured_timestamp = timestamp
28
- end
29
-
30
- def avatar
31
- if is_set? configured_avatar
32
- configured_avatar[:size] = "sm"
33
- pb_avatar = Playbook::PbAvatar::Avatar.new(configured_avatar)
34
- ApplicationController.renderer.render(partial: pb_avatar, as: :object)
35
- end
36
- end
37
-
38
- def avatar_class
39
- "avatar" if is_set? configured_avatar
40
- end
8
+ partial "pb_message/message"
41
9
 
42
- def label
43
- if is_set? configured_label
44
- caption_props = { text: configured_label }
45
- pb_label = Playbook::PbCaption::Caption.new(caption_props)
46
- ApplicationController.renderer.render(partial: pb_label, as: :object)
47
- end
48
- end
49
-
50
- def message
51
- if is_set? configured_message
52
- pb_message = Playbook::PbBody::Body.new(classname: "message_text") do
53
- configured_message
54
- end
55
- ApplicationController.renderer.render(partial: pb_message, as: :object)
56
- end
57
- end
10
+ prop :avatar_name
11
+ prop :avatar_status
12
+ prop :avatar_url
13
+ prop :label
14
+ prop :message
15
+ prop :timestamp
58
16
 
59
- def timestamp
60
- if is_set? configured_timestamp
61
- timestamp_props = { text: configured_timestamp }
62
- pb_timestamp = Playbook::PbTimestamp::Timestamp.new(timestamp_props)
63
- ApplicationController.renderer.render(partial: pb_timestamp, as: :object)
64
- end
17
+ def classname
18
+ generate_classname("pb_message_kit", avatar_class)
65
19
  end
66
20
 
67
- def kit_class
68
- kit_options = [
69
- "pb_message_kit",
70
- avatar_class,
71
- ]
72
- kit_options.compact.join("_")
73
- end
74
-
75
- def to_partial_path
76
- "pb_message/message"
21
+ def valid?
22
+ avatar_url.present? || avatar_name
77
23
  end
78
24
 
79
25
  private
80
26
 
81
- DEFAULT = Object.new
82
- private_constant :DEFAULT
83
- def default_configuration
84
- DEFAULT
27
+ def avatar_class
28
+ avatar_name ? "avatar" : nil
85
29
  end
86
- attr_accessor(*PROPS)
87
30
  end
88
31
  end
89
32
  end
@@ -12,6 +12,7 @@
12
12
  <%= pb_rails("contact", props: {
13
13
  contact_type: contact[:contact_type],
14
14
  contact_value: contact[:contact_value],
15
+ contact_detail: contact[:contact_detail],
15
16
  }) %>
16
17
  <% end %>
17
18
  <% end %>
@@ -13,7 +13,7 @@ type PersonContactProps = {
13
13
  className?: String | Array<String>,
14
14
  dark?: Boolean,
15
15
  people?: Array<{firstName: String, lastName: String}>,
16
- contacts?: Array<{contactType: String, contactValue: String}>,
16
+ contacts?: Array<{contactType: String, contactValue: String, contactDetail: String}>,
17
17
  }
18
18
 
19
19
  const contactsArray = ({contacts=[]}: PersonContactProps) => {
@@ -22,6 +22,7 @@ const contactsArray = ({contacts=[]}: PersonContactProps) => {
22
22
  <Contact
23
23
  contactType={contactObject.contactType}
24
24
  contactValue={contactObject.contactValue}
25
+ contactDetail={contactObject.contactDetail}
25
26
  />
26
27
  );
27
28
  })
@@ -12,10 +12,12 @@
12
12
  contacts: [
13
13
  {
14
14
  contact_type: "email",
15
- contact_value: "email@example.com"
15
+ contact_value: "email@example.com",
16
+ contact_detail: "Pauline's Email"
16
17
  },
17
18
  {
18
19
  contact_value: 5555555555,
20
+ contact_detail: "Home"
19
21
  },
20
22
  {
21
23
  contact_type: "email",
@@ -24,6 +26,7 @@
24
26
  {
25
27
  contact_type: "work",
26
28
  contact_value: "3245627482",
29
+ contact_detail: "Harvey's Work"
27
30
  }
28
31
  ]
29
32
  }) %>
@@ -18,10 +18,12 @@ function PersonContactDefault() {
18
18
  contacts={[
19
19
  {
20
20
  contactType: "email",
21
- contactValue: "email@example.com"
21
+ contactValue: "email@example.com",
22
+ contactDetail: "Pauline's Email",
22
23
  },
23
24
  {
24
25
  contactValue: "5555555555",
26
+ contactDetail: "Home",
25
27
  },
26
28
  {
27
29
  contactType: "email",
@@ -30,6 +32,7 @@ function PersonContactDefault() {
30
32
  {
31
33
  contactType: "work",
32
34
  contactValue: "3245627482",
35
+ contactDetail: "Harvey's Work"
33
36
  }
34
37
  ]}
35
38
  />
@@ -8,14 +8,17 @@
8
8
  contacts: [
9
9
  {
10
10
  contact_type: "email",
11
- contact_value: "email@example.com"
11
+ contact_value: "email@example.com",
12
+ contact_detail: "Harvey's Email"
12
13
  },
13
14
  {
14
15
  contact_value: 5555555555,
16
+ contact_detail: "Home",
15
17
  },
16
18
  {
17
19
  contact_type: "work",
18
20
  contact_value: "3245627482",
21
+ contact_detail: "Harvey's Work"
19
22
  }
20
23
  ]
21
24
  }) %>
@@ -14,14 +14,17 @@ function PersonContactSinglePerson() {
14
14
  contacts={[
15
15
  {
16
16
  contactType: "email",
17
- contactValue: "email@example.com"
17
+ contactValue: "email@example.com",
18
+ contactDetail: "Harvey's Email",
18
19
  },
19
20
  {
20
21
  contactValue: "5555555555",
22
+ contactDetail: "Home",
21
23
  },
22
24
  {
23
25
  contactType: "work",
24
26
  contactValue: "3245627482",
27
+ contactDetail: "Harvey's Work",
25
28
  }
26
29
  ]}
27
30
  />
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname(object.kit_class)) do %>
5
- <span><%= object.text %></span>
4
+ class: object.classname) do %>
5
+ <span><%= pb_rails("caption", props: { text: object.text }) %></span>
6
6
  <% end %>
@@ -2,45 +2,16 @@
2
2
 
3
3
  module Playbook
4
4
  module PbSectionSeparator
5
- class SectionSeparator < Playbook::PbKit::Base
6
- PROPS = %i[configured_classname
7
- configured_data
8
- configured_id
9
- configured_text].freeze
5
+ class SectionSeparator
6
+ include Playbook::Props
10
7
 
11
- def initialize(classname: default_configuration,
12
- data: default_configuration,
13
- id: default_configuration,
14
- text: default_configuration)
15
- self.configured_classname = classname
16
- self.configured_data = data
17
- self.configured_id = id
18
- self.configured_text = text
19
- end
20
-
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)
25
- end
26
- end
27
-
28
- def kit_class
29
- "pb_section_separator_kit"
30
- end
31
-
32
- def to_partial_path
33
- "pb_section_separator/section_separator"
34
- end
8
+ partial "pb_section_separator/section_separator"
35
9
 
36
- private
10
+ prop :text
37
11
 
38
- DEFAULT = Object.new
39
- private_constant :DEFAULT
40
- def default_configuration
41
- DEFAULT
12
+ def classname
13
+ generate_classname("pb_section_separator_kit")
42
14
  end
43
- attr_accessor(*PROPS)
44
15
  end
45
16
  end
46
17
  end
@@ -1,23 +1,23 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname(object.kit_class)) do %>
4
+ class: object.classname) do %>
5
5
  <%# Rating value %>
6
- <%= content_tag(:div, object.rating, class: "pb__star_rating_number") %>
6
+ <%= content_tag(:div, object.rating, class: "pb_star_rating_number") %>
7
7
 
8
- <%= content_tag(:div, class: "pb__star_rating_wrapper") do %>
8
+ <%= content_tag(:div, class: "pb_star_rating_wrapper") do %>
9
9
  <%# Gold stars generated by rating value %>
10
- <%= content_tag(:div, class: "pb__star_rating_highlight") do %>
11
- <% object.star_count.each do %>
12
- <%= pb_rails("icon", props: { icon: "star", fixed_width: true }) %>
13
- <% end %>
14
- <% unless object.star_full %>
15
- <%= pb_rails("icon", props: { icon: "star-half", fixed_width: true }) %>
16
- <% end %>
10
+ <%= content_tag(:div, class: "pb_star_rating_highlight") do %>
11
+ <% object.star_count.each do %>
12
+ <%= pb_rails("icon", props: { icon: "star", fixed_width: true }) %>
13
+ <% end %>
14
+ <% unless object.star_full %>
15
+ <%= pb_rails("icon", props: { icon: "star-half", fixed_width: true }) %>
16
+ <% end %>
17
17
  <% end %>
18
18
 
19
19
  <%# Grey background stars as base %>
20
- <%= content_tag(:div, class: "pb__star_rating_base") do %>
20
+ <%= content_tag(:div, class: "pb_star_rating_base") do %>
21
21
  <%= pb_rails("icon", props: { icon: "star", fixed_width: true }) %>
22
22
  <%= pb_rails("icon", props: { icon: "star", fixed_width: true }) %>
23
23
  <%= pb_rails("icon", props: { icon: "star", fixed_width: true }) %>
@@ -12,7 +12,7 @@ $pb_star_rating_height: 26px;
12
12
  justify-content: flex-start;
13
13
  align-items: flex-start;
14
14
 
15
- .pb__star_rating_number {
15
+ .pb_star_rating_number {
16
16
  flex-shrink: 0;
17
17
  flex-grow: 0;
18
18
  flex-basis: $pb_star_rating_number_width;
@@ -26,7 +26,7 @@ $pb_star_rating_height: 26px;
26
26
  align-items: center;
27
27
  }
28
28
 
29
- .pb__star_rating_wrapper {
29
+ .pb_star_rating_wrapper {
30
30
  position: relative;
31
31
  width: $pb_star_rating_wrapper_width;
32
32
  flex-basis: $pb_star_rating_wrapper_width;
@@ -34,7 +34,7 @@ $pb_star_rating_height: 26px;
34
34
  flex-grow: 1;
35
35
  min-height: $pb_star_rating_height;
36
36
 
37
- .pb__star_rating_highlight {
37
+ .pb_star_rating_highlight {
38
38
  position: absolute;
39
39
  top: 0;
40
40
  left: 0;
@@ -42,7 +42,7 @@ $pb_star_rating_height: 26px;
42
42
  color: $yellow;
43
43
  line-height: $pb_star_rating_height;
44
44
  }
45
- .pb__star_rating_base {
45
+ .pb_star_rating_base {
46
46
  position: absolute;
47
47
  top: 0;
48
48
  left: 0;
@@ -53,7 +53,7 @@ $pb_star_rating_height: 26px;
53
53
  }
54
54
 
55
55
  &[class*=_hide_rating] {
56
- .pb__star_rating_number {
56
+ .pb_star_rating_number {
57
57
  display: none;
58
58
  }
59
59
  }
@@ -2,36 +2,15 @@
2
2
 
3
3
  module Playbook
4
4
  module PbStarRating
5
- class StarRating < Playbook::PbKit::Base
6
- PROPS = %i[configured_classname
7
- configured_data
8
- configured_hide_rating
9
- configured_id
10
- configured_rating].freeze
5
+ class StarRating
6
+ include Playbook::Props
11
7
 
12
- def initialize(classname: default_configuration,
13
- data: default_configuration,
14
- hide_rating: default_configuration,
15
- id: default_configuration,
16
- rating: default_configuration)
17
- self.configured_classname = classname
18
- self.configured_data = data
19
- self.configured_hide_rating = hide_rating
20
- self.configured_id = id
21
- self.configured_rating = rating
22
- end
23
-
24
- def hide_rating
25
- true_value(configured_hide_rating, "hide_rating", nil)
26
- end
8
+ partial "pb_star_rating/star_rating"
27
9
 
28
- def rating
29
- rating_options = []
30
- (0..5).step(0.5) do |number|
31
- rating_options.push strip_trailing_zero(number)
32
- end
33
- one_of_value(configured_rating.to_s, rating_options, "0")
34
- end
10
+ prop :hide_rating, type: Playbook::Props::Boolean,
11
+ default: false
12
+ prop :rating, type: Playbook::Props::Numeric,
13
+ default: 0
35
14
 
36
15
  def star_count
37
16
  [*1..rating.to_f]
@@ -41,30 +20,9 @@ module Playbook
41
20
  (rating.to_f % 1).zero?
42
21
  end
43
22
 
44
- def kit_class
45
- kit_options = [
46
- "pb_star_rating_kit",
47
- hide_rating,
48
- ]
49
- kit_options.compact.join("_")
50
- end
51
-
52
- def to_partial_path
53
- "pb_star_rating/star_rating"
54
- end
55
-
56
- private
57
-
58
- def strip_trailing_zero(number)
59
- number.to_s.sub(/\.?0+$/, "")
60
- end
61
-
62
- DEFAULT = Object.new
63
- private_constant :DEFAULT
64
- def default_configuration
65
- DEFAULT
23
+ def classname
24
+ generate_classname("pb_star_rating_kit")
66
25
  end
67
- attr_accessor(*PROPS)
68
26
  end
69
27
  end
70
28
  end
@@ -1,6 +1,9 @@
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.display_value %>
4
+ class: object.classname) do %>
5
+ <%= pb_rails("body", props: { status: object.status }) do %>
6
+ <%= pb_rails("icon", props: { fixed_width: true, icon: object.icon }) if object.icon %>
7
+ <%= "#{object.value}%" if object.value %>
8
+ <% end %>
6
9
  <% end %>
@@ -68,7 +68,7 @@ const StatChange = (props: StatChangeProps) => {
68
68
  return (
69
69
  <Body status={status}>
70
70
  {displayIcon(icon)}
71
- {value}
71
+ {value}%
72
72
  </Body>
73
73
  )
74
74
  }