playbook_ui 2.9.3 → 2.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/playbook/pb_doc_helper.rb +1 -1
  3. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.html.erb +3 -4
  4. data/app/pb_kits/playbook/pb_bar_graph/barGraphSettings.js +4 -3
  5. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +17 -71
  6. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +6 -0
  7. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.html.erb +2 -1
  8. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -0
  9. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +10 -1
  10. data/app/pb_kits/playbook/pb_label_pill/label_pill.rb +1 -1
  11. data/app/pb_kits/playbook/pb_line_graph/lineGraphSettings.js +1 -0
  12. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.html.erb +5 -2
  13. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +9 -56
  14. data/app/pb_kits/playbook/pb_online_status/_online_status.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_online_status/online_status.rb +8 -37
  16. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +9 -4
  17. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +15 -5
  18. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.html.erb +10 -2
  19. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.jsx +10 -4
  20. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.html.erb +21 -0
  21. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.jsx +32 -0
  22. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_three_people.html.erb +16 -0
  23. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_three_people.jsx +33 -0
  24. data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +4 -0
  25. data/app/pb_kits/playbook/pb_person_contact/docs/index.js +2 -0
  26. data/app/pb_kits/playbook/pb_person_contact/person_contact.rb +7 -44
  27. data/app/pb_kits/playbook/pb_pill/_pill.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_pill/pill.rb +11 -47
  29. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.html.erb +5 -5
  30. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +1 -1
  31. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +65 -67
  32. data/app/pb_kits/playbook/pb_title/_title.html.erb +1 -1
  33. data/app/pb_kits/playbook/pb_title/title.rb +16 -63
  34. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +65 -18
  35. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_accessibility.jsx +12 -0
  36. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_data.jsx +15 -0
  37. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx +39 -6
  38. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_toggle/docs/index.js +3 -1
  40. data/app/pb_kits/playbook/props.rb +8 -2
  41. data/app/pb_kits/playbook/props/array.rb +11 -0
  42. data/app/pb_kits/playbook/props/hash_array.rb +13 -0
  43. data/app/pb_kits/playbook/props/number_array.rb +1 -1
  44. data/app/pb_kits/playbook/props/percentage.rb +19 -0
  45. data/app/pb_kits/playbook/types.js +4 -0
  46. data/app/pb_kits/playbook/utilities/props.js +48 -0
  47. data/app/views/playbook/pages/kit_show.html.slim +1 -1
  48. data/app/views/playbook/pages/kits.html.slim +1 -1
  49. data/app/views/playbook/pages/tokens.html.slim +2 -2
  50. data/app/views/playbook/pages/tokens/_pb_doc_spacing.html.slim +1 -1
  51. data/app/views/playbook/pages/utilities.html.slim +2 -2
  52. data/app/views/playbook/pages/utilities/_pb_doc_color.html.slim +1 -1
  53. data/lib/generators/kit/kit_generator.rb +3 -2
  54. data/lib/generators/kit/templates/kit_html.erb.tt +1 -1
  55. data/lib/generators/kit/templates/kit_ruby.erb.tt +3 -26
  56. data/lib/generators/kit/templates/kit_ruby_spec.erb.tt +12 -0
  57. data/lib/playbook.rb +3 -0
  58. data/lib/playbook/version.rb +1 -1
  59. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83bfef20c888012751cbe3ff287d6850546328ff1f8916c1d3fb66afb80e7575
4
- data.tar.gz: e7fdc38479036276b05a245ac437f6de3261189d563371741b8171eb0da18947
3
+ metadata.gz: 6f2367598c1e7a4884d82b241d1892dcffd0e4be6a6bb42c3df38106c736982b
4
+ data.tar.gz: 13342e3858e46a139374bbad7d352445d67b8084ce9cd7757ba21cd6b0418200
5
5
  SHA512:
6
- metadata.gz: 98f925395f71c5f1528940d90726ed404b9651838ee20f21150653d7c62b3d19f354048b194a969116e294c89efd89b340c92d7406fb2646ff805066d1d5065a
7
- data.tar.gz: b3971889b97ffdb28929751dd5b17ce64f6b15dd35dfec1bc98bc07c32d019bd019f28c6ae6bbf42c0a46c4ce9412c3222fefdf82c38ff3249d9da762a2a307b
6
+ metadata.gz: cc7eacf6aacf17bd97b421e765f96c4210a9131b85036c606ec81d7fb8633a9b70a87c1735e4cd2b545372bf7db9b059feb39a061ae0f7ec10496ea042d3a25e
7
+ data.tar.gz: 88525a0ef851f0f5f99b226aa047b3d6738c91296e6e22c355d291d0196e1cbf96198fe315e1d8cfa25e12f48f52a2e99f2cc843bfa86f434bb39feda36c1507
@@ -65,7 +65,7 @@ module Playbook
65
65
  def render_clickable_title(kit)
66
66
  render inline: "<a href='#{kit_show_path(kit)}'>
67
67
  #{pb_rails(:title, props: { text: pb_kit_title(kit),
68
- tag: 'h3', size: '2' })}</a>"
68
+ tag: 'h3', size: 2 })}</a>"
69
69
  end
70
70
  end
71
71
  end
@@ -2,14 +2,13 @@
2
2
  aria: object.aria,
3
3
  id: object.id,
4
4
  data: object.data,
5
- class: object.classname("pb_bar_graph")
6
- ) %>
5
+ class: object.classname) %>
7
6
  <% content_for :pb_js do %>
8
7
  <%= javascript_tag do %>
9
8
  window.addEventListener('DOMContentLoaded', function() {
10
9
  new pbChart('.selector', {
11
10
  id: "<%= object.id %>",
12
- chartData: <%= object.chart_data %>,
11
+ chartData: <%= object.sanitized_chart_data %>,
13
12
  type: "<%= object.chart_type %>",
14
13
  title: "<%= object.title %>",
15
14
  subtitle: "<%= object.subtitle %>",
@@ -18,4 +17,4 @@
18
17
  })
19
18
  })
20
19
  <% end %>
21
- <% end %>
20
+ <% end %>
@@ -7,12 +7,12 @@ const sizeColumns = function(highchart) {
7
7
 
8
8
  column.borderRadius = 0;
9
9
  column.pointPadding = 0.3;
10
- column.groupPadding = 0.2;
10
+ column.groupPadding = 0;
11
11
 
12
12
  series.borderWidth = 0;
13
13
  series.shadow = false;
14
- series.pointPadding = 0.3;
15
- series.groupPadding = 0.2;
14
+ series.pointPadding = 0.25;
15
+ series.groupPadding = 0;
16
16
  };
17
17
 
18
18
  const styleDataLabels = highchart => {
@@ -20,6 +20,7 @@ const styleDataLabels = highchart => {
20
20
 
21
21
  series.dataLabels.style.fontFamily = typography.font_family_base;
22
22
  series.dataLabels.style.fontSize = typography.text_small;
23
+ series.dataLabels.style.fontWeight = typography.bold;
23
24
  };
24
25
 
25
26
  const barGraphSettings = function(highchart) {
@@ -2,85 +2,31 @@
2
2
 
3
3
  module Playbook
4
4
  module PbBarGraph
5
- class BarGraph < Playbook::PbKit::Base
6
- PROPS = %i[
7
- configured_aria
8
- configured_axis_title
9
- configured_chart_data
10
- configured_classname
11
- configured_data
12
- configured_id
13
- configured_orientation
14
- configured_point_start
15
- configured_subtitle
16
- configured_title
17
- ].freeze
18
-
19
- def initialize(
20
- aria: default_configuration,
21
- axis_title: default_configuration,
22
- chart_data: default_configuration,
23
- classname: default_configuration,
24
- data: default_configuration,
25
- id: default_configuration,
26
- orientation: default_configuration,
27
- point_start: default_configuration,
28
- subtitle: default_configuration,
29
- title: default_configuration
30
- )
31
- self.configured_aria = aria
32
- self.configured_axis_title = axis_title
33
- self.configured_chart_data = chart_data
34
- self.configured_classname = classname
35
- self.configured_data = data
36
- self.configured_id = id
37
- self.configured_orientation = orientation
38
- self.configured_point_start = point_start
39
- self.configured_subtitle = subtitle
40
- self.configured_title = title
41
- end
42
-
43
- def orientation
44
- orientation_options = %w[vertical horizontal]
45
- one_of_value(configured_orientation, orientation_options, "vertical")
46
- end
5
+ class BarGraph
6
+ include Playbook::Props
7
+ partial "pb_bar_graph/bar_graph"
8
+
9
+ prop :axis_title
10
+ prop :chart_data, type: Playbook::Props::Array,
11
+ default: []
12
+ prop :orientation, type: Playbook::Props::Enum,
13
+ values: %w[vertical horizontal],
14
+ default: "vertical"
15
+ prop :point_start
16
+ prop :subtitle
17
+ prop :title
47
18
 
48
19
  def chart_type
49
20
  orientation == "horizontal" ? "bar" : "column"
50
21
  end
51
22
 
52
- def title
53
- default_value(configured_title, "")
54
- end
55
-
56
- def subtitle
57
- default_value(configured_subtitle, "")
58
- end
59
-
60
- def axis_title
61
- default_value(configured_axis_title, "")
23
+ def classname
24
+ generate_classname("pb_bar_graph")
62
25
  end
63
26
 
64
- def to_partial_path
65
- "pb_bar_graph/bar_graph"
66
- end
67
-
68
- def point_start
69
- default_value(configured_point_start, "")
70
- end
71
-
72
- def chart_data
73
- adjusted_value(configured_chart_data, configured_chart_data.to_json.html_safe, {})
74
- end
75
-
76
- private
77
-
78
- DEFAULT = Object.new
79
- private_constant :DEFAULT
80
- def default_configuration
81
- DEFAULT
27
+ def sanitized_chart_data
28
+ chart_data.to_json.html_safe
82
29
  end
83
- attr_accessor(*PROPS)
84
30
  end
85
31
  end
86
32
  end
@@ -9,6 +9,12 @@
9
9
  text: object.address_house_style
10
10
  } %>
11
11
 
12
+ <%= pb_rails "title", props: {
13
+ classname: "pb_home_address_street_address",
14
+ size: 4,
15
+ text: object.address_house_style2
16
+ } %>
17
+
12
18
  <%= pb_rails "body", props: {
13
19
  color: "light",
14
20
  text: object.city_state,
@@ -1,8 +1,9 @@
1
1
  <%= pb_rails("home_address_street", props: {
2
2
  address: "70 Prospect Ave",
3
+ address2: "Apt M18",
3
4
  city: "North Arlington",
4
5
  home_id: 8250263,
5
- house_style: "Colonial",
6
+ house_style: nil,
6
7
  state: "NJ",
7
8
  zipcode: "07031",
8
9
  dark: true,
@@ -1,5 +1,6 @@
1
1
  <%= pb_rails("home_address_street", props: {
2
2
  address: "70 Prospect Ave",
3
+ address2: nil,
3
4
  city: "North Arlington",
4
5
  home_id: 8250263,
5
6
  house_style: "Colonial",
@@ -8,6 +8,7 @@ module Playbook
8
8
  partial "pb_home_address_street/home_address_street"
9
9
 
10
10
  prop :address
11
+ prop :address2
11
12
  prop :city
12
13
  prop :home_id, type: Playbook::Props::Number
13
14
  prop :house_style
@@ -24,7 +25,15 @@ module Playbook
24
25
  end
25
26
 
26
27
  def address_house_style
27
- "#{address} \u00b7 #{house_style}"
28
+ "#{address} #{separator} #{house_style}"
29
+ end
30
+
31
+ def address_house_style2
32
+ address2
33
+ end
34
+
35
+ def separator
36
+ house_style ? "\u00b7" : ""
28
37
  end
29
38
 
30
39
  private
@@ -39,7 +39,7 @@ module Playbook
39
39
  end
40
40
 
41
41
  def variant
42
- default_value(configured_variant, "")
42
+ default_value(configured_variant, "neutral")
43
43
  end
44
44
 
45
45
  def to_partial_path
@@ -17,6 +17,7 @@ const styleDataLabels = highchart => {
17
17
 
18
18
  series.dataLabels.style.fontFamily = typography.font_family_base;
19
19
  series.dataLabels.style.fontSize = typography.text_small;
20
+ series.dataLabels.style.fontWeight = typography.bold;
20
21
  };
21
22
 
22
23
  const pbLineGraph = highchart => {
@@ -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.value %>
4
+ class: object.classname) do %>
5
+
6
+ <%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
7
+ <%= pb_rails("icon", props: { fixed_width: true, icon: "spinner", pulse: true }) %> Loading
8
+ <% end %>
6
9
  <% end %>
@@ -2,66 +2,19 @@
2
2
 
3
3
  module Playbook
4
4
  module PbLoadingInline
5
- class LoadingInline < Playbook::PbKit::Base
6
- PROPS = %i[configured_align
7
- configured_classname
8
- configured_dark
9
- configured_data
10
- configured_id].freeze
5
+ class LoadingInline
6
+ include Playbook::Props
11
7
 
12
- def initialize(align: default_configuration,
13
- classname: default_configuration,
14
- dark: default_configuration,
15
- data: default_configuration,
16
- id: default_configuration)
17
- self.configured_align = align
18
- self.configured_classname = classname
19
- self.configured_dark = dark
20
- self.configured_data = data
21
- self.configured_id = id
22
- end
23
-
24
- def align
25
- align_options = %w[left center right]
26
- one_of_value(configured_align, align_options, "left")
27
- end
28
-
29
- def dark
30
- is_true? configured_dark
31
- end
32
-
33
- def icon
34
- pb_icon = Playbook::PbIcon::Icon.new(fixed_width: true, icon: "spinner", pulse: true)
35
- ApplicationController.renderer.render(partial: pb_icon, as: :object)
36
- end
37
-
38
- def value
39
- pb_icon_value = Playbook::PbBody::Body.new(color: "light", dark: dark) do
40
- icon + "Loading"
41
- end
42
- ApplicationController.renderer.render(partial: pb_icon_value, as: :object)
43
- end
44
-
45
- def to_partial_path
46
- "pb_loading_inline/loading_inline"
47
- end
48
-
49
- def kit_class
50
- loading_inline_options = [
51
- "pb_loading_inline_kit",
52
- align,
53
- ]
54
- loading_inline_options.join("_")
55
- end
8
+ partial "pb_loading_inline/loading_inline"
56
9
 
57
- private
10
+ prop :align, type: Playbook::Props::Enum,
11
+ values: %w[left center right],
12
+ default: "left"
13
+ prop :dark, type: Playbook::Props::Boolean, default: false
58
14
 
59
- DEFAULT = Object.new
60
- private_constant :DEFAULT
61
- def default_configuration
62
- DEFAULT
15
+ def classname
16
+ generate_classname("pb_loading_inline_kit", align)
63
17
  end
64
- attr_accessor(*PROPS)
65
18
  end
66
19
  end
67
20
  end
@@ -1,5 +1,5 @@
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
  <% end %>
@@ -2,47 +2,18 @@
2
2
 
3
3
  module Playbook
4
4
  module PbOnlineStatus
5
- class OnlineStatus < Playbook::PbKit::Base
6
- PROPS = %i[configured_classname
7
- configured_data
8
- configured_id
9
- configured_status].freeze
5
+ class OnlineStatus
6
+ include Playbook::Props
10
7
 
11
- def initialize(classname: default_configuration,
12
- data: default_configuration,
13
- id: default_configuration,
14
- status: default_configuration)
15
- self.configured_classname = classname
16
- self.configured_data = data
17
- self.configured_id = id
18
- self.configured_status = status
19
- end
20
-
21
- def status
22
- status_options = %w[online offline away]
23
- one_of_value(configured_status, status_options, "offline")
24
- end
25
-
26
- def kit_class
27
- kit_options = [
28
- "pb_online_status_kit",
29
- status,
30
- ]
31
- kit_options.join("_")
32
- end
33
-
34
- def to_partial_path
35
- "pb_online_status/online_status"
36
- end
8
+ partial "pb_online_status/online_status"
37
9
 
38
- private
10
+ prop :status, type: Playbook::Props::Enum,
11
+ values: %w[online offline away],
12
+ default: "offline"
39
13
 
40
- DEFAULT = Object.new
41
- private_constant :DEFAULT
42
- def default_configuration
43
- DEFAULT
14
+ def classname
15
+ generate_classname("pb_online_status_kit", status)
44
16
  end
45
- attr_accessor(*PROPS)
46
17
  end
47
18
  end
48
19
  end
@@ -1,12 +1,17 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("pb_person_contact_kit")) do %>
5
- <%= object.name %>
4
+ class: object.classname) do %>
5
+ <% object.people.each do |person| %>
6
+ <%= pb_rails("person", props: {
7
+ first_name: person[:first_name],
8
+ last_name: person[:last_name],
9
+ }) %>
10
+ <% end %>
6
11
  <% object.contacts.each do |contact| %>
7
12
  <%= pb_rails("contact", props: {
8
- contact_type: contact[:contact_type],
9
- contact_value: contact[:contact_value],
13
+ contact_type: contact[:contact_type],
14
+ contact_value: contact[:contact_value],
10
15
  }) %>
11
16
  <% end %>
12
17
  <% end %>
@@ -12,8 +12,7 @@ import {
12
12
  type PersonContactProps = {
13
13
  className?: String | Array<String>,
14
14
  dark?: Boolean,
15
- firstName: String,
16
- lastName: String,
15
+ people?: Array<{firstName: String, lastName: String}>,
17
16
  contacts?: Array<{contactType: String, contactValue: String}>,
18
17
  }
19
18
 
@@ -28,19 +27,30 @@ const contactsArray = ({contacts=[]}: PersonContactProps) => {
28
27
  })
29
28
  }
30
29
 
30
+ const peopleArray = ({people=[]}: PersonContactProps) => {
31
+ return people.map((personObject, index) => {
32
+ return (
33
+ <Person
34
+ firstName={personObject.firstName}
35
+ lastName={personObject.lastName}
36
+ />
37
+ );
38
+ })
39
+ }
40
+
31
41
  const PersonContact = ({
32
42
  className,
33
43
  dark=false,
34
- firstName,
35
- lastName,
44
+ people,
36
45
  contacts,
37
46
  }: PersonContactProps) => {
38
47
 
39
48
  const contactKits = contactsArray({contacts})
49
+ const personKits = peopleArray({people})
40
50
 
41
51
  return (
42
52
  <div className={classnames('pb_person_contact_kit', className)}>
43
- <Person firstName={firstName} lastName={lastName} />
53
+ {personKits}
44
54
  {contactKits}
45
55
  </div>
46
56
  )