playbook_ui 2.9.4 → 2.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_body/_body.html.erb +2 -2
  3. data/app/pb_kits/playbook/pb_body/body.rb +20 -80
  4. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +4 -2
  5. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +18 -14
  6. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +5 -6
  7. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +0 -1
  8. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.html.erb +0 -1
  9. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.html.erb +0 -1
  10. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.html.erb +0 -1
  12. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.jsx +1 -1
  13. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +5 -2
  14. data/app/pb_kits/playbook/pb_contact/contact.rb +22 -50
  15. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.html.erb +3 -3
  16. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +11 -49
  17. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +2 -2
  18. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +20 -3
  19. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.html.erb +6 -5
  20. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.jsx +5 -4
  21. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +5 -4
  22. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.jsx +5 -3
  23. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified.html.erb +8 -0
  24. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified.jsx +17 -0
  25. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
  26. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  27. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +5 -4
  28. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.html.erb +2 -2
  29. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +12 -56
  30. data/app/pb_kits/playbook/pb_icon_value/_icon_value.html.erb +7 -4
  31. data/app/pb_kits/playbook/pb_icon_value/icon_value.rb +10 -67
  32. data/app/pb_kits/playbook/pb_image/_image.html.erb +2 -2
  33. data/app/pb_kits/playbook/pb_image/image.rb +7 -48
  34. data/app/pb_kits/playbook/pb_person/_person.html.erb +3 -3
  35. data/app/pb_kits/playbook/pb_person/person.rb +7 -45
  36. data/app/pb_kits/playbook/pb_source/_source.html.erb +10 -7
  37. data/app/pb_kits/playbook/pb_source/source.rb +22 -67
  38. data/app/pb_kits/playbook/pb_table/_table.html.erb +2 -2
  39. data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
  40. data/app/pb_kits/playbook/pb_table/docs/_table_container.html.erb +1 -1
  41. data/app/pb_kits/playbook/pb_table/docs/_table_container.jsx +1 -1
  42. data/app/pb_kits/playbook/pb_table/docs/_table_container_dark.html.erb +1 -1
  43. data/app/pb_kits/playbook/pb_table/docs/_table_container_dark.jsx +1 -1
  44. data/app/pb_kits/playbook/pb_table/docs/_table_dark.html.erb +1 -1
  45. data/app/pb_kits/playbook/pb_table/docs/_table_dark.jsx +1 -1
  46. data/app/pb_kits/playbook/pb_table/docs/_table_disable_hover.html.erb +1 -1
  47. data/app/pb_kits/playbook/pb_table/docs/_table_disable_hover.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_table/docs/_table_lg.html.erb +1 -1
  49. data/app/pb_kits/playbook/pb_table/docs/_table_lg.jsx +1 -1
  50. data/app/pb_kits/playbook/pb_table/docs/_table_md.html.erb +1 -1
  51. data/app/pb_kits/playbook/pb_table/docs/_table_md.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_table/docs/_table_multiline.html.erb +1 -1
  53. data/app/pb_kits/playbook/pb_table/docs/_table_multiline.jsx +1 -1
  54. data/app/pb_kits/playbook/pb_table/docs/_table_single_line.html.erb +1 -1
  55. data/app/pb_kits/playbook/pb_table/docs/_table_single_line.jsx +1 -1
  56. data/app/pb_kits/playbook/pb_table/docs/_table_sm.html.erb +1 -1
  57. data/app/pb_kits/playbook/pb_table/docs/_table_sm.jsx +1 -1
  58. data/app/pb_kits/playbook/pb_table/table.rb +30 -76
  59. data/app/pb_kits/playbook/pb_toggle/_toggle.html.erb +6 -3
  60. data/app/pb_kits/playbook/pb_toggle/toggle.rb +12 -68
  61. data/app/pb_kits/playbook/props.rb +1 -1
  62. data/app/pb_kits/playbook/props/base.rb +1 -1
  63. data/lib/playbook/version.rb +1 -1
  64. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f2367598c1e7a4884d82b241d1892dcffd0e4be6a6bb42c3df38106c736982b
4
- data.tar.gz: 13342e3858e46a139374bbad7d352445d67b8084ce9cd7757ba21cd6b0418200
3
+ metadata.gz: 538626b25c8cfe2a426a8cb708a5bc832dc50e5cac5fc73d1c2c6f5eb7a9bafc
4
+ data.tar.gz: 02ec4a247e32c0e92372b0da5fd4a2060daa333b86a6dc410b9047e3749b3526
5
5
  SHA512:
6
- metadata.gz: cc7eacf6aacf17bd97b421e765f96c4210a9131b85036c606ec81d7fb8633a9b70a87c1735e4cd2b545372bf7db9b059feb39a061ae0f7ec10496ea042d3a25e
7
- data.tar.gz: 88525a0ef851f0f5f99b226aa047b3d6738c91296e6e22c355d291d0196e1cbf96198fe315e1d8cfa25e12f48f52a2e99f2cc843bfa86f434bb39feda36c1507
6
+ metadata.gz: c7a4624ab3daffb11381327e70a0bee6e9ec820a831b0989b3637b872f07da29dc763f51218ae2f512c65e61f906adb8385bb9dbeed8f1846d5d8c75b792d19b
7
+ data.tar.gz: 02d4a3bf6b766d826e2cba344bcee3c918657e62e393ded122617144f7e8bd12844e96d06ee80f716fe76396d528d10f62de7186f92ab0a767586cb91694ea62
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(object.tag,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname(object.kit_class)) do %>
5
- <%= object.yield(context: self) %>
4
+ class: object.classname) do %>
5
+ <%= !object.children.nil? ? capture(&object.children) : object.text %>
6
6
  <% end %>
@@ -2,101 +2,41 @@
2
2
 
3
3
  module Playbook
4
4
  module PbBody
5
- class Body < Playbook::PbKit::Base
6
- PROPS = %i[configured_aria
7
- configured_classname
8
- configured_color
9
- configured_dark
10
- configured_data
11
- configured_id
12
- configured_tag
13
- configured_text
14
- configured_status
15
- block].freeze
5
+ class Body
6
+ include Playbook::Props
16
7
 
17
- def initialize(aria: default_configuration,
18
- classname: default_configuration,
19
- color: default_configuration,
20
- dark: default_configuration,
21
- data: default_configuration,
22
- id: default_configuration,
23
- status: default_configuration,
24
- tag: default_configuration,
25
- text: default_configuration,
26
- &block)
8
+ partial "pb_body/body"
27
9
 
28
- self.configured_aria = aria
29
- self.configured_classname = classname
30
- self.configured_color = color
31
- self.configured_dark = dark
32
- self.configured_data = data
33
- self.configured_id = id
34
- self.configured_status = status
35
- self.configured_tag = tag
36
- self.configured_text = text
37
- self.block = block_given? ? block : nil
38
- end
10
+ prop :color, type: Playbook::Props::Enum,
11
+ values: %w[default light lighter dark light_dark lighter_dark],
12
+ default: "default"
13
+ prop :dark, type: Playbook::Props::Boolean,
14
+ default: false
15
+ prop :status, type: Playbook::Props::Enum,
16
+ values: %w[neutral negative positive],
17
+ default: "neutral"
18
+ prop :tag, type: Playbook::Props::Enum,
19
+ values: %w[h1 h2 h3 h4 h5 h6 p span div],
20
+ default: "div"
21
+ prop :text
39
22
 
40
- def color
41
- color_options = %w[default light lighter dark light_dark lighter_dark]
42
- one_of_value(configured_color, color_options, "default")
23
+ def classname
24
+ generate_classname("pb_body_kit", color_class, dark_class, status_class)
43
25
  end
44
26
 
27
+ private
28
+
45
29
  def color_class
46
30
  color != "default" ? color : nil
47
31
  end
48
32
 
49
- def dark
50
- is_true? configured_dark
51
- end
52
-
53
33
  def dark_class
54
- true_value(configured_dark, "dark", nil)
55
- end
56
-
57
- def status
58
- status_options = %w[neutral negative positive]
59
- one_of_value(configured_status, status_options, "neutral")
34
+ dark ? "dark" : nil
60
35
  end
61
36
 
62
37
  def status_class
63
38
  status != "neutral" ? status : nil
64
39
  end
65
-
66
- def tag
67
- default_value(configured_tag, "div")
68
- end
69
-
70
- def text
71
- default_value(configured_text, "Body text")
72
- end
73
-
74
- def yield(context:)
75
- !block.nil? ? context.capture(&block) : text
76
- end
77
-
78
- def kit_class
79
- body_options = [
80
- "pb_body_kit",
81
- color_class,
82
- dark_class,
83
- status_class,
84
- ]
85
- body_options.compact.join("_")
86
- end
87
-
88
- def to_partial_path
89
- "pb_body/body"
90
- end
91
-
92
- private
93
-
94
- DEFAULT = Object.new
95
- private_constant :DEFAULT
96
- def default_configuration
97
- DEFAULT
98
- end
99
- attr_accessor(*PROPS)
100
40
  end
101
41
  end
102
42
  end
@@ -3,7 +3,9 @@
3
3
  class: object.classname) do %>
4
4
  <input type="checkbox" value="<%=object.value%>" name="<%=object.name%>" <%= object.checked_html %>>
5
5
  <span class="pb_checkbox_checkmark">
6
- <%= pb_rails("icon", props: { icon: "check", id: "check_icon", classname: "check_icon", fixed_width: true}) if object.icon %>
6
+ <%= pb_rails("icon", props: { icon: "check", id: "check_icon", classname: "check_icon", fixed_width: true}) %>
7
+ </span>
8
+ <span class="pb_checkbox_label">
9
+ <%= pb_rails("body", props: { text: object.text, dark: object.dark }) %>
7
10
  </span>
8
- <span class="pb_checkbox_label"><%= object.text %></span>
9
11
  <% end %>
@@ -1,41 +1,45 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+ import Body from '../pb_body/_body.jsx'
5
+ import Icon from '../pb_icon/_icon.jsx'
4
6
 
5
7
  type CheckboxProps = {
8
+ checked?: Boolean,
6
9
  dark?: Boolean,
7
- tag: String,
8
- label: String,
9
10
  name:String,
11
+ text: String,
10
12
  value:String,
11
- checked?: Boolean,
13
+
12
14
  }
13
15
 
14
16
  const Checkbox = ({
17
+ checked=false,
15
18
  dark=false,
16
- tag='label',
17
- label,
18
19
  name='',
20
+ text='',
19
21
  value='',
20
- checked=false,
21
- }: CheckboxProps) => {
22
22
 
23
- const Tag = `${tag}`
23
+
24
+ }: CheckboxProps) => {
25
+
26
+ const bodyClassName = {
27
+ 'pb_checkbox_label': true,
28
+ '_dark': dark,
29
+ }
24
30
 
25
31
  return (
26
- <Tag
32
+ <label
27
33
  className={
28
34
  `pb_checkbox_kit` +
29
35
  (dark === true ? '_dark' : '')
30
36
  }
31
37
  > <input type="checkbox" name={name} value={value} defaultChecked={checked}/>
32
38
  <span className="pb_checkbox_checkmark">
33
- <i className="far fa-check check_icon"></i>
34
- </span>
35
- <span className="pb_checkbox_label">
36
- {label}
39
+ <Icon className="check_icon" icon="check" fixedWidth />
37
40
  </span>
38
- </Tag>
41
+ <Body className={bodyClassName}>{text}</Body>
42
+ </label>
39
43
  )
40
44
  }
41
45
 
@@ -2,16 +2,15 @@
2
2
  $transition: $transition_cubic;
3
3
 
4
4
  [class^=pb_checkbox_kit] {
5
+ display: inline-flex;
5
6
  .pb_checkbox_label {
6
- display: block;
7
- position: relative;
8
- padding-left: $space_lg;
7
+ padding-left: $space_xs;
9
8
  cursor: pointer;
10
9
  font-size: $text_lt_default;
11
10
  user-select: none;
12
11
  }
13
12
  .pb_checkbox_checkmark {
14
- position: absolute;
13
+ position: relative;
15
14
  height: 22px;
16
15
  width: 22px;
17
16
  border: solid $border_light 2px;
@@ -33,7 +32,7 @@ $transition: $transition_cubic;
33
32
  }
34
33
 
35
34
  input {
36
- position: absolute;
35
+ position: relative;
37
36
  opacity: 0;
38
37
  cursor: pointer;
39
38
  height: 0;
@@ -44,7 +43,7 @@ $transition: $transition_cubic;
44
43
  border-color: $primary_action;
45
44
  }
46
45
  &:checked ~ .pb_checkbox_checkmark {
47
- display: block;
46
+ display: inline-block;
48
47
  .check_icon{
49
48
  opacity: $opacity_10;
50
49
  }
@@ -9,7 +9,6 @@ module Playbook
9
9
 
10
10
  prop :dark, type: Playbook::Props::Boolean, default: false
11
11
  prop :checked, type: Playbook::Props::Boolean, default: false
12
- prop :icon, type: Playbook::Props::Boolean, default: false
13
12
  prop :text
14
13
  prop :value
15
14
  prop :name
@@ -2,6 +2,5 @@
2
2
  text: "Checked Checkbox",
3
3
  value: "checkbox-value",
4
4
  checked: true,
5
- icon: true,
6
5
  name: "checkbox-name"
7
6
  }) %>
@@ -1,5 +1,4 @@
1
1
  <%= pb_rails("checkbox", props: {
2
2
  text: "Checkbox Label" ,
3
- icon: true,
4
3
  dark: true
5
4
  }) %>
@@ -6,8 +6,8 @@ function CheckboxDark() {
6
6
  <div>
7
7
  <Checkbox
8
8
  dark
9
- label='Checkbox label'
10
9
  name='default name'
10
+ text='Checkbox label'
11
11
  value='default value'
12
12
  />
13
13
  </div>
@@ -1,6 +1,5 @@
1
1
  <%= pb_rails("checkbox" , props: {
2
2
  text: "Checkbox Label",
3
3
  value: "checkbox-value",
4
- icon: true,
5
4
  name: "checkbox-name"
6
5
  }) %>
@@ -5,8 +5,8 @@ function CheckboxDefault() {
5
5
  return (
6
6
  <div>
7
7
  <Checkbox
8
- label='Checkbox label'
9
8
  name='default name'
9
+ text='Checkbox label'
10
10
  value='default value'
11
11
  />
12
12
  </div>
@@ -1,6 +1,9 @@
1
1
  <%= content_tag(:div,
2
2
  id: object.id,
3
3
  data: object.data,
4
- class: object.classname("pb_contact_kit")) do %>
5
- <span><%= object.contact_value %></span>
4
+ class: object.classname) do %>
5
+ <%= pb_rails("body", props: { tag: "span", classname: "pb_contact_kit", color: "light" }) do %>
6
+ <%= pb_rails("icon", props: { icon: object.contact_icon, fixed_width: true }) %>
7
+ <%= object.formatted_contact_value if object.contact_value%>
8
+ <% end %>
6
9
  <% end %>
@@ -4,75 +4,47 @@ require "action_view"
4
4
 
5
5
  module Playbook
6
6
  module PbContact
7
- class Contact < Playbook::PbKit::Base
7
+ class Contact
8
8
  include ActionView::Helpers::NumberHelper
9
+ include Playbook::Props
9
10
 
10
- PROPS = %i[configured_classname
11
- configured_data
12
- configured_id
13
- configured_contact_type
14
- configured_contact_value].freeze
11
+ partial "pb_contact/contact"
15
12
 
16
- def initialize(classname: default_configuration,
17
- data: default_configuration,
18
- id: default_configuration,
19
- contact_type: default_configuration,
20
- contact_value: default_configuration)
21
- self.configured_classname = classname
22
- self.configured_data = data
23
- self.configured_id = id
24
- self.configured_contact_type = contact_type
25
- self.configured_contact_value = contact_value
13
+ prop :contact_type
14
+ prop :contact_value
15
+
16
+ def classname
17
+ generate_classname("pb_contact_kit")
26
18
  end
27
19
 
28
- def contact_type
29
- case configured_contact_type
20
+ def contact_icon
21
+ case contact_type
30
22
  when "cell"
31
- icon = "mobile"
23
+ "mobile"
32
24
  when "home"
33
- icon = "phone"
25
+ "phone"
34
26
  when "work"
35
- icon = "phone-office"
27
+ "phone-office"
36
28
  when "email"
37
- icon = "envelope"
29
+ "envelope"
38
30
  else # "unknown" || "other"
39
- icon = "phone"
31
+ "phone"
40
32
  end
41
- contact_type_props = { icon: icon, fixed_width: true }
42
- pb_contact_type = Playbook::PbIcon::Icon.new(contact_type_props)
43
- ApplicationController.renderer.render(partial: pb_contact_type, as: :object)
44
33
  end
45
34
 
46
- def contact_value
47
- if is_set? configured_contact_value
48
- unless configured_contact_type == "email"
49
- new_value = number_to_phone(formatted_value, area_code: true) if formatted_value
50
- else
51
- new_value = configured_contact_value
52
- end
53
- pb_body = Playbook::PbBody::Body.new(color: "light") do
54
- contact_type + new_value
55
- end
56
- ApplicationController.renderer.render(partial: pb_body, as: :object)
35
+ def formatted_contact_value
36
+ if contact_type == "email"
37
+ contact_value
38
+ else
39
+ number_to_phone(formatted_value, area_code: true)
57
40
  end
58
41
  end
59
42
 
60
- def formatted_value
61
- configured_contact_value.to_s.gsub(/\D/, "")
62
- end
63
-
64
- def to_partial_path
65
- "pb_contact/contact"
66
- end
67
-
68
43
  private
69
44
 
70
- DEFAULT = Object.new
71
- private_constant :DEFAULT
72
- def default_configuration
73
- DEFAULT
45
+ def formatted_value
46
+ contact_value.to_s.gsub(/\D/, "")
74
47
  end
75
- attr_accessor(*PROPS)
76
48
  end
77
49
  end
78
50
  end
@@ -1,7 +1,7 @@
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.icon %>
6
- <%= object.text %>
4
+ class: object.classname) do %>
5
+ <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon" }) %>
6
+ <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_fixed_confirmation_toast_text" }) if object.show_text?%>
7
7
  <% end %>
@@ -2,48 +2,19 @@
2
2
 
3
3
  module Playbook
4
4
  module PbFixedConfirmationToast
5
- class FixedConfirmationToast < Playbook::PbKit::Base
6
- PROPS = %i[configured_classname
7
- configured_data
8
- configured_id
9
- configured_status
10
- configured_text].freeze
5
+ class FixedConfirmationToast
6
+ include Playbook::Props
11
7
 
12
- def initialize(classname: default_configuration,
13
- data: default_configuration,
14
- id: default_configuration,
15
- status: default_configuration,
16
- text: default_configuration)
17
- self.configured_classname = classname
18
- self.configured_data = data
19
- self.configured_id = id
20
- self.configured_status = status
21
- self.configured_text = text
22
- end
8
+ partial "pb_fixed_confirmation_toast/fixed_confirmation_toast"
23
9
 
24
- def text
25
- if is_set? configured_text
26
- pb_text = Playbook::PbTitle::Title.new(size: 4, text: configured_text, classname: "pb_fixed_confirmation_toast_text")
27
- ApplicationController.renderer.render(partial: pb_text, as: :object)
28
- end
29
- end
10
+ prop :status, type: Playbook::Props::Enum,
11
+ values: %w[success error neutral],
12
+ default: "neutral"
13
+ prop :text, type: Playbook::Props::String
30
14
 
31
- def kit_class
32
- kit_options = [
33
- "pb_fixed_confirmation_toast_kit",
34
- status,
35
- ]
36
- kit_options.join("_")
37
- end
38
15
 
39
- def status
40
- status_options = %w[success error neutral]
41
- one_of_value(configured_status, status_options, "neutral")
42
- end
43
-
44
- def icon
45
- pb_icon = Playbook::PbIcon::Icon.new(icon: icon_value, classname: "pb_icon")
46
- ApplicationController.renderer.render(partial: pb_icon, as: :object)
16
+ def show_text?
17
+ text.present?
47
18
  end
48
19
 
49
20
  def icon_value
@@ -57,18 +28,9 @@ module Playbook
57
28
  end
58
29
  end
59
30
 
60
- def to_partial_path
61
- "pb_fixed_confirmation_toast/fixed_confirmation_toast"
62
- end
63
-
64
- private
65
-
66
- DEFAULT = Object.new
67
- private_constant :DEFAULT
68
- def default_configuration
69
- DEFAULT
31
+ def classname
32
+ generate_classname("pb_fixed_confirmation_toast_kit", status)
70
33
  end
71
- attr_accessor(*PROPS)
72
34
  end
73
35
  end
74
36
  end