playbook_ui 2.9.7 → 2.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/app/assets/images/pb.logo.svg +14 -14
  4. data/app/pb_kits/playbook/_playbook.scss +6 -6
  5. data/app/pb_kits/playbook/index.js +11 -10
  6. data/app/pb_kits/playbook/kits/pb_nav.js +4 -0
  7. data/app/pb_kits/playbook/kits/pb_text_input.js +4 -0
  8. data/app/pb_kits/playbook/packs/examples.js +4 -4
  9. data/app/pb_kits/playbook/packs/kits.js +2 -2
  10. data/app/pb_kits/playbook/packs/site_styles/docs/_color_utilities.scss +0 -1
  11. data/app/pb_kits/playbook/packs/site_styles/docs/_kit_doc.scss +1 -1
  12. data/app/pb_kits/playbook/pb_badge/_badge.jsx +5 -2
  13. data/app/pb_kits/playbook/pb_badge/_badge.scss +19 -7
  14. data/app/pb_kits/playbook/pb_badge/badge.rb +6 -1
  15. data/app/pb_kits/playbook/pb_badge/docs/_badge_dark.html.erb +124 -0
  16. data/app/pb_kits/playbook/pb_badge/docs/_badge_dark.jsx +82 -0
  17. data/app/pb_kits/playbook/pb_badge/docs/example.yml +2 -0
  18. data/app/pb_kits/playbook/pb_badge/docs/index.js +1 -0
  19. data/app/pb_kits/playbook/pb_button/_button.scss +15 -0
  20. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +37 -3
  21. data/app/pb_kits/playbook/pb_button/button.rb +7 -1
  22. data/app/pb_kits/playbook/pb_button/docs/_button_default_dark.html.erb +22 -4
  23. data/app/pb_kits/playbook/pb_button/docs/_button_default_dark.jsx +6 -1
  24. data/app/pb_kits/playbook/pb_caption/_caption.jsx +13 -9
  25. data/app/pb_kits/playbook/pb_caption/_caption.scss +4 -0
  26. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +11 -7
  27. data/app/pb_kits/playbook/pb_caption/caption.rb +4 -5
  28. data/app/pb_kits/playbook/pb_caption/docs/_caption_dark.html.erb +2 -1
  29. data/app/pb_kits/playbook/pb_caption/docs/_caption_dark.jsx +2 -1
  30. data/app/pb_kits/playbook/pb_caption/docs/_caption_light.html.erb +2 -1
  31. data/app/pb_kits/playbook/pb_caption/docs/_caption_light.jsx +2 -1
  32. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +3 -3
  33. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +2 -1
  34. data/app/pb_kits/playbook/pb_contact/_contact.jsx +10 -4
  35. data/app/pb_kits/playbook/pb_contact/contact.rb +4 -9
  36. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +1 -4
  37. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +0 -3
  38. data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.html.erb +16 -0
  39. data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail.jsx +25 -0
  40. data/app/pb_kits/playbook/pb_contact/docs/example.yml +2 -0
  41. data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
  42. data/app/pb_kits/playbook/pb_date/_date.html.erb +10 -2
  43. data/app/pb_kits/playbook/pb_date/date.rb +18 -90
  44. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.html.erb +3 -3
  45. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.rb +15 -54
  46. data/app/pb_kits/playbook/pb_hashtag/_hashtag.html.erb +2 -2
  47. data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +13 -11
  48. data/app/pb_kits/playbook/pb_hashtag/_hashtag.scss +3 -1
  49. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_dark.html.erb +9 -0
  50. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_dark.jsx +31 -0
  51. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_default.jsx +2 -2
  52. data/app/pb_kits/playbook/pb_hashtag/docs/example.yml +2 -1
  53. data/app/pb_kits/playbook/pb_hashtag/docs/index.js +1 -0
  54. data/app/pb_kits/playbook/pb_hashtag/hashtag.rb +6 -1
  55. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +12 -6
  56. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +10 -5
  57. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.scss +0 -20
  58. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.jsx +1 -1
  60. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified.jsx +1 -0
  61. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +3 -3
  62. data/app/pb_kits/playbook/pb_label_pill/docs/_label_pill_default.html.erb +9 -3
  63. data/app/pb_kits/playbook/pb_label_pill/label_pill.rb +1 -1
  64. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +67 -0
  65. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/_item.html.erb +2 -2
  66. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/_item.jsx +7 -7
  67. data/app/pb_kits/playbook/{pb_vertical_nav/_vertical_nav.html.erb → pb_nav/_nav.html.erb} +2 -2
  68. data/app/pb_kits/playbook/{pb_vertical_nav/_vertical_nav.jsx → pb_nav/_nav.jsx} +7 -7
  69. data/app/pb_kits/playbook/pb_nav/_nav.scss +6 -0
  70. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/_vertical_nav.scss +38 -35
  71. data/app/pb_kits/playbook/pb_nav/docs/_block_nav.html.erb +5 -0
  72. data/app/pb_kits/playbook/pb_nav/docs/_block_no_title.html.erb +5 -0
  73. data/app/pb_kits/playbook/pb_nav/docs/_default_nav.html.erb +5 -0
  74. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/docs/_default_nav.jsx +2 -2
  75. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav.html.erb +5 -0
  76. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/docs/example.yml +1 -0
  77. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/docs/index.js +0 -0
  78. data/app/pb_kits/playbook/{pb_vertical_nav → pb_nav}/item.rb +3 -3
  79. data/app/pb_kits/playbook/pb_nav/nav.rb +27 -0
  80. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +13 -6
  81. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +8 -14
  82. data/app/pb_kits/playbook/pb_person_contact/_person_contact.scss +1 -0
  83. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.html.erb +5 -20
  84. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.jsx +2 -17
  85. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_multiple.html.erb +27 -0
  86. data/app/pb_kits/playbook/pb_person_contact/docs/{_person_contact_single_person.jsx → _person_contact_multiple.jsx} +13 -11
  87. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_detail.html.erb +19 -0
  88. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_detail.jsx +30 -0
  89. data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +5 -4
  90. data/app/pb_kits/playbook/pb_person_contact/docs/index.js +2 -2
  91. data/app/pb_kits/playbook/pb_person_contact/person_contact.rb +10 -1
  92. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.html.erb +7 -0
  93. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +4 -0
  94. data/app/pb_kits/playbook/pb_pill/pill.rb +1 -1
  95. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +3 -4
  96. data/app/pb_kits/playbook/{pb_input/_input.html.erb → pb_text_input/_text_input.html.erb} +2 -2
  97. data/app/pb_kits/playbook/{pb_input/_input.jsx → pb_text_input/_text_input.jsx} +7 -7
  98. data/app/pb_kits/playbook/{pb_input/_input.scss → pb_text_input/_text_input.scss} +3 -3
  99. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +5 -0
  100. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +16 -0
  101. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +5 -0
  102. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  103. data/app/pb_kits/playbook/{pb_input/input.rb → pb_text_input/text_input.rb} +4 -4
  104. data/app/pb_kits/playbook/pb_time/_time.html.erb +32 -2
  105. data/app/pb_kits/playbook/pb_time/time.rb +15 -116
  106. data/app/pb_kits/playbook/pb_timestamp/_timestamp-mixins.scss +0 -2
  107. data/app/pb_kits/playbook/pb_timestamp/_timestamp.html.erb +1 -1
  108. data/app/pb_kits/playbook/tokens/_colors.scss +18 -22
  109. data/app/pb_kits/playbook/utilities/_colors.scss +12 -0
  110. data/app/pb_kits/playbook/utilities/text.js +16 -0
  111. data/app/views/layouts/playbook/_sidebar.html.slim +10 -11
  112. data/lib/playbook/version.rb +1 -1
  113. metadata +39 -29
  114. data/app/pb_kits/playbook/kits/pb_input.js +0 -4
  115. data/app/pb_kits/playbook/kits/pb_vertical_nav.js +0 -4
  116. data/app/pb_kits/playbook/pb_input/docs/_input_default.html.erb +0 -5
  117. data/app/pb_kits/playbook/pb_input/docs/_input_default.jsx +0 -16
  118. data/app/pb_kits/playbook/pb_input/docs/example.yml +0 -5
  119. data/app/pb_kits/playbook/pb_input/docs/index.js +0 -1
  120. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_single_person.html.erb +0 -24
  121. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_three_people.html.erb +0 -16
  122. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_three_people.jsx +0 -33
  123. data/app/pb_kits/playbook/pb_vertical_nav/docs/_block_nav.html.erb +0 -5
  124. data/app/pb_kits/playbook/pb_vertical_nav/docs/_block_no_title.html.erb +0 -5
  125. data/app/pb_kits/playbook/pb_vertical_nav/docs/_default_nav.html.erb +0 -5
  126. data/app/pb_kits/playbook/pb_vertical_nav/vertical_nav.rb +0 -19
@@ -1,3 +1,4 @@
1
1
  export {default as BadgeDefault} from './_badge_default.jsx';
2
2
  export {default as BadgeRounded} from './_badge_rounded.jsx';
3
3
  export {default as BadgeColors} from './_badge_colors.jsx';
4
+ export {default as BadgeDark} from './_badge_dark.jsx';
@@ -27,4 +27,19 @@
27
27
  &[class*=_loading] {
28
28
  @include pb_button_loading(true);
29
29
  }
30
+ // Dark Variants =============
31
+ &[class*=_dark] {
32
+ &[class*=_primary] {
33
+ @include pb_button_primary_dark;
34
+ }
35
+ &[class*=_secondary] {
36
+ @include pb_button_secondary_dark;
37
+ }
38
+ &[class*=_link] {
39
+ @include pb_button_link_dark;
40
+ }
41
+ &[class*=_disabled] {
42
+ @include pb_button_disabled_dark;
43
+ }
44
+ }
30
45
  }
@@ -73,16 +73,16 @@ $pb_button_border_width: 1px;
73
73
 
74
74
  // Secondary ====================
75
75
  @mixin pb_button_secondary {
76
- @include pb_button($white, $primary_action, $primary_action);
76
+ @include pb_button(rgba($primary_action, 0.05), $primary_action);
77
77
 
78
78
  &:hover {
79
- @include pb_button_hover(rgba($secondary_action, $opacity_3));
79
+ @include pb_button_hover(rgba($primary_action, $opacity_3));
80
80
  }
81
81
  }
82
82
 
83
83
  // Link =========================
84
84
  @mixin pb_button_link {
85
- @include pb_button($transparent, $secondary_action);
85
+ @include pb_button($transparent, $primary_action);
86
86
 
87
87
  &:hover {
88
88
  @include pb_button_hover($transparent);
@@ -114,3 +114,37 @@ $pb_button_border_width: 1px;
114
114
  }
115
115
  }
116
116
  }
117
+
118
+ // Dark Primary =================
119
+ @mixin pb_button_primary_dark{
120
+ @include pb_button($primary_action);
121
+
122
+ &:hover {
123
+ @include pb_button_hover($bg: darken($primary_action, $pb_button_hover_darken));
124
+ }
125
+ }
126
+
127
+ // Dark Secondary ==============
128
+ @mixin pb_button_secondary_dark{
129
+ @include pb_button(rgba($white, 0.2), $white);
130
+
131
+ &:hover {
132
+ @include pb_button_hover(rgba($primary_action, $opacity_2));
133
+ }
134
+ }
135
+
136
+ // Dark Link =============
137
+ @mixin pb_button_link_dark {
138
+ @include pb_button($transparent, $primary_action);
139
+
140
+ &:hover {
141
+ @include pb_button_hover($transparent);
142
+ }
143
+ }
144
+
145
+ // Dark Disabled ====================
146
+ @mixin pb_button_disabled_dark {
147
+ $disabled_color: rgba($white, $opacity_5);
148
+ @include pb_button(rgba($slate, $opacity_5), $disabled_color);
149
+ pointer-events: none;
150
+ }
@@ -7,6 +7,8 @@ module Playbook
7
7
 
8
8
  partial "pb_button/button"
9
9
 
10
+ prop :dark, type: Playbook::Props::Boolean,
11
+ default: false
10
12
  prop :disabled, type: Playbook::Props::Boolean,
11
13
  default: false
12
14
  prop :full_width, type: Playbook::Props::Boolean,
@@ -49,7 +51,11 @@ module Playbook
49
51
  private
50
52
 
51
53
  def classname
52
- generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
54
+ generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class, dark_class)
55
+ end
56
+
57
+ def dark_class
58
+ dark ? "dark" : nil
53
59
  end
54
60
 
55
61
  def disabled_class
@@ -1,4 +1,22 @@
1
- <%= pb_rails("button", props: { text: "Button Primary" }) %>
2
- <%= pb_rails("button", props: { text: "Button Secondary", variant: "secondary" }) %>
3
- <%= pb_rails("button", props: { text: "Button Link", variant: "link" }) %>
4
- <%= pb_rails("button", props: { text: "Button Disabled", disabled: true }) %>
1
+ <%= pb_rails("button", props: {
2
+ text: "Button Primary",
3
+ dark: true
4
+ }) %>
5
+
6
+ <%= pb_rails("button", props: {
7
+ text: "Button Secondary",
8
+ variant: "secondary",
9
+ dark: true
10
+ }) %>
11
+
12
+ <%= pb_rails("button", props: {
13
+ text: "Button Link",
14
+ variant: "link",
15
+ dark: true
16
+ }) %>
17
+
18
+ <%= pb_rails("button", props: {
19
+ text: "Button Disabled",
20
+ disabled: true,
21
+ dark: true
22
+ }) %>
@@ -3,18 +3,23 @@ import {Button} from '../../'
3
3
 
4
4
  const ButtonDefaultDark = () => (
5
5
  <div>
6
- <Button text="Button Primary" />
6
+ <Button text="Button Primary"
7
+ dark
8
+ />
7
9
  <Button
8
10
  text="Button Secondary"
9
11
  variant="secondary"
12
+ dark
10
13
  />
11
14
  <Button
12
15
  text="Button Link"
13
16
  variant="link"
17
+ dark
14
18
  />
15
19
  <Button
16
20
  text="Button Disabled"
17
21
  disabled
22
+ dark
18
23
  />
19
24
  </div>
20
25
  )
@@ -1,33 +1,37 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+ import classnames from 'classnames'
4
5
 
5
6
  type CaptionProps = {
7
+ className?: String,
6
8
  children: Array<React.ReactNode> | React.ReactNode,
7
9
  dark?: Boolean,
8
- large?: Boolean,
10
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl',
9
11
  tag: String,
10
12
  text: String,
11
13
  }
12
14
 
13
15
  const Caption = ({
16
+ className,
14
17
  children,
15
18
  dark=false,
16
- large=false,
19
+ size='md',
17
20
  tag='div',
18
21
  text,
19
22
  }: CaptionProps) => {
20
23
 
21
24
  const Tag = `${tag}`
22
25
 
26
+ const css = classnames([
27
+ `pb_caption_kit` +
28
+ `_${size}` +
29
+ (dark === true ? '_dark' : ''),
30
+ className,
31
+ ])
32
+
23
33
  return (
24
- <Tag
25
- className={
26
- `pb_caption_kit` +
27
- (large === true ? '_lg' : '') +
28
- (dark === true ? '_dark' : '')
29
- }
30
- >
34
+ <Tag className={css} >
31
35
  {text || children}
32
36
  </Tag>
33
37
  )
@@ -7,6 +7,10 @@
7
7
  @include caption_lg;
8
8
  }
9
9
 
10
+ &[class*=_xs] {
11
+ @include caption_xs;
12
+ }
13
+
10
14
  &[class*=_dark] {
11
15
  @include caption_dark;
12
16
  }
@@ -2,19 +2,23 @@
2
2
  @import "../tokens/typography";
3
3
 
4
4
  @mixin caption($font_size: $font_smaller, $font_weight: $bold) {
5
- & {
6
- font-weight: $font_weight;
7
- color: $text_lt_lighter;
8
- text-transform: uppercase;
9
- font-size: $font_size;
10
- letter-spacing: $lspace_looser;
11
- }
5
+ font-weight: $font_weight;
6
+ color: $text_lt_lighter;
7
+ text-transform: uppercase;
8
+ font-size: $font_size;
9
+ letter-spacing: $lspace_looser;
12
10
  }
13
11
 
14
12
  @mixin caption_lg {
15
13
  @include caption($font_large, $regular);
16
14
  }
17
15
 
16
+ @mixin caption_xs {
17
+ @include caption($font_smaller, $regular);
18
+ text-transform: none;
19
+ letter-spacing: unset;
20
+ }
21
+
18
22
  @mixin caption_dark {
19
23
  color: $text_dk_light;
20
24
  }
@@ -8,21 +8,20 @@ module Playbook
8
8
  partial "pb_caption/caption"
9
9
 
10
10
  prop :dark, type: Playbook::Props::Boolean, default: false
11
- prop :large, type: Playbook::Props::Boolean, default: false
11
+ prop :size, type: Playbook::Props::Enum,
12
+ values: %w[xs sm md base lg xl],
13
+ default: "md"
12
14
  prop :tag, type: Playbook::Props::Enum,
13
15
  values: %w[h1 h2 h3 h4 h5 h6 p span div],
14
16
  default: "div"
15
17
  prop :text
16
18
 
17
19
  def classname
18
- generate_classname("pb_caption_kit", large_class, dark_class)
20
+ generate_classname("pb_caption_kit", size, dark_class)
19
21
  end
20
22
 
21
23
  private
22
24
 
23
- def large_class
24
- large ? "lg" : nil
25
- end
26
25
 
27
26
  def dark_class
28
27
  dark ? "dark" : nil
@@ -1,2 +1,3 @@
1
1
  <%= pb_rails("caption", props: { text: "Caption", dark: true }) %>
2
- <%= pb_rails("caption", props: { text: "Caption Large", large: true, dark: true }) %>
2
+ <%= pb_rails("caption", props: { text: "Caption Large", size: 'lg', dark: true }) %>
3
+ <%= pb_rails("caption", props: { text: "Subcaption", size: 'xs', dark: true }) %>
@@ -5,7 +5,8 @@ function CaptionDark() {
5
5
  return (
6
6
  <div>
7
7
  <Caption dark text="Caption" />
8
- <Caption dark large text="Caption Large" />
8
+ <Caption dark size="lg" text="Caption Large" />
9
+ <Caption dark size="xs" text="Subcaption" />
9
10
  </div>
10
11
  )
11
12
  }
@@ -1,2 +1,3 @@
1
1
  <%= pb_rails("caption", props: { text: "Caption" }) %>
2
- <%= pb_rails("caption", props: { text: "Caption Large", large: true }) %>
2
+ <%= pb_rails("caption", props: { text: "Caption Large", size: 'lg' }) %>
3
+ <%= pb_rails("caption", props: { text: "Subcaption", size: 'xs' }) %>
@@ -5,7 +5,8 @@ function CaptionLight() {
5
5
  return (
6
6
  <div>
7
7
  <Caption text="Caption" />
8
- <Caption large text="Caption Large" />
8
+ <Caption size="lg" text="Caption Large" />
9
+ <Caption size="xs" text="Subcaption" />
9
10
  </div>
10
11
  )
11
12
  }
@@ -54,12 +54,12 @@ $transition: $transition_cubic;
54
54
 
55
55
  &[class*=_dark] {
56
56
  input:checked ~ .pb_checkbox_checkmark {
57
- background-color: $primary_action_dk;
58
- border-color: $primary_action_dk;
57
+ background-color: $primary_action;
58
+ border-color: $primary_action;
59
59
  }
60
60
 
61
61
  &:hover .pb_checkbox_checkmark {
62
- border-color: $primary_action_dk;
62
+ border-color: $primary_action;
63
63
  }
64
64
  }
65
65
  }
@@ -4,6 +4,7 @@
4
4
  class: object.classname) do %>
5
5
  <%= pb_rails("body", props: { tag: "span", classname: "pb_contact_kit", color: "light" }) do %>
6
6
  <%= pb_rails("icon", props: { icon: object.contact_icon, fixed_width: true }) %>
7
- <%= object.formatted_contact_info if object.contact_value%>
7
+ <%= object.formatted_contact_value if object.contact_value %>
8
+ <%= pb_rails("caption", props: { text: object.contact_detail, tag: 'span', size: 'xs' }) if object.contact_detail %>
8
9
  <% end %>
9
10
  <% end %>
@@ -6,11 +6,12 @@ import classnames from 'classnames'
6
6
 
7
7
  import {
8
8
  Body,
9
+ Caption,
9
10
  Icon,
10
11
  } from '../'
11
12
 
12
13
  type ContactProps = {
13
- contactType?: 'cell' | 'home' | 'work' | 'email',
14
+ contactType?: 'cell' | 'home' | 'work' | 'email' | 'wrong number',
14
15
  className?: String | Array<String>,
15
16
  dark?: Boolean,
16
17
  contactValue: String,
@@ -32,7 +33,9 @@ const Contact = ({
32
33
 
33
34
  const formatDetail = (contactDetail) => {
34
35
  if (contactDetail !== undefined) {
35
- return `\u00b7 ${contactDetail}`
36
+ return (
37
+ <Caption size="xs" text={contactDetail} tag="span" />
38
+ );
36
39
  } else {
37
40
  return contactDetail
38
41
  }
@@ -64,16 +67,19 @@ const Contact = ({
64
67
  return 'phone-office';
65
68
  case 'email':
66
69
  return 'envelope';
70
+ case 'wrong number' :
71
+ return 'slash-phone';
67
72
  default:
68
73
  return 'phone';
69
74
  }
70
75
  })(contactType)
71
76
 
77
+
72
78
  return (
73
79
  <div className={css}>
74
- <Body dark={dark} color="light" >
80
+ <Body dark={dark} color="light" tag="span" className="pb_contact_kit" >
75
81
  <Icon icon={contactTypeIcon} fixedWidth="true" />
76
- {` ${formatContact(contactValue, contactType)} ${formatDetail(contactDetail)}`}
82
+ {` ${formatContact(contactValue, contactType)} `}{formatDetail(contactDetail)}
77
83
  </Body>
78
84
  </div>
79
85
  )
@@ -28,17 +28,13 @@ module Playbook
28
28
  "phone-office"
29
29
  when "email"
30
30
  "envelope"
31
+ when "wrong number"
32
+ "phone-slash"
31
33
  else # "unknown" || "other"
32
34
  "phone"
33
35
  end
34
36
  end
35
37
 
36
- def formatted_contact_info
37
- "#{formatted_contact_value} #{separator} #{contact_detail}"
38
- end
39
-
40
- private
41
-
42
38
  def formatted_contact_value
43
39
  if contact_type == "email"
44
40
  contact_value
@@ -47,13 +43,12 @@ module Playbook
47
43
  end
48
44
  end
49
45
 
46
+ private
47
+
50
48
  def formatted_value
51
49
  contact_value.to_s.gsub(/\D/, "")
52
50
  end
53
51
 
54
- def separator
55
- contact_detail ? "\u00b7" : ""
56
- end
57
52
  end
58
53
  end
59
54
  end
@@ -1,12 +1,10 @@
1
1
  <%= pb_rails("contact", props: {
2
2
  contact_type: "cell",
3
3
  contact_value: "349-185-9988",
4
- contact_detail: "John's Cell",
5
4
  }) %>
6
5
 
7
6
  <%= pb_rails("contact", props: {
8
7
  contact_value: 5555555555,
9
- contact_detail: "Home",
10
8
  }) %>
11
9
 
12
10
  <%= pb_rails("contact", props: {
@@ -15,7 +13,6 @@
15
13
  }) %>
16
14
 
17
15
  <%= pb_rails("contact", props: {
18
- contact_type: "work",
16
+ contact_type: "wrong number",
19
17
  contact_value: "3245627482",
20
- contact_detail: "John's Work",
21
18
  }) %>
@@ -7,11 +7,9 @@ function ContactDefault() {
7
7
  <Contact
8
8
  contactType="cell"
9
9
  contactValue="349-185-9988"
10
- contactDetail="John's Cell"
11
10
  />
12
11
  <Contact
13
12
  contactValue="5555555555"
14
- contactDetail="Home"
15
13
  />
16
14
  <Contact
17
15
  contactType="email"
@@ -20,7 +18,6 @@ function ContactDefault() {
20
18
  <Contact
21
19
  contactType="work"
22
20
  contactValue="3245627482"
23
- contactDetail="John's Work"
24
21
  />
25
22
  </div>
26
23
  )
@@ -0,0 +1,16 @@
1
+ <%= pb_rails("contact", props: {
2
+ contact_type: "cell",
3
+ contact_value: "349-185-9988",
4
+ contact_detail: "Cell",
5
+ }) %>
6
+
7
+ <%= pb_rails("contact", props: {
8
+ contact_value: 5555555555,
9
+ contact_detail: "Home",
10
+ }) %>
11
+
12
+ <%= pb_rails("contact", props: {
13
+ contact_type: "work",
14
+ contact_value: "3245627482",
15
+ contact_detail: "Work",
16
+ }) %>
@@ -0,0 +1,25 @@
1
+ import React from "react"
2
+ import {Contact} from "../../"
3
+
4
+ function ContactDefault() {
5
+ return (
6
+ <div>
7
+ <Contact
8
+ contactType="cell"
9
+ contactValue="349-185-9988"
10
+ contactDetail="Cell"
11
+ />
12
+ <Contact
13
+ contactValue="5555555555"
14
+ contactDetail="Home"
15
+ />
16
+ <Contact
17
+ contactType="work"
18
+ contactValue="3245627482"
19
+ contactDetail="Work"
20
+ />
21
+ </div>
22
+ )
23
+ }
24
+
25
+ export default ContactDefault
@@ -2,7 +2,9 @@ examples:
2
2
 
3
3
  rails:
4
4
  - contact_default: Default
5
+ - contact_with_detail: Detail Indicator
5
6
 
6
7
 
7
8
  react:
8
9
  - contact_default: Default
10
+ - contact_with_detail: Detail Indicator
@@ -1 +1,2 @@
1
1
  export {default as ContactDefault} from './_contact_default.jsx';
2
+ export {default as ContactWithDetail} from './_contact_with_detail.jsx';
@@ -1,6 +1,14 @@
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
+ <% if object.size == "lg" %>
6
+ <%= pb_rails("title", props: { text: object.lg_date, size: 3 }) %>
7
+ <% elsif object.size == "sm" %>
8
+ <%= pb_rails("icon", props: { icon: "calendar", fixed_width: true }) %>
9
+ <%= pb_rails("title", props: { tag: "span", text: object.sm_date, size: 4 }) %>
10
+ <% else %>
11
+ <%= pb_rails("title", props: { text: object.xs_date, size: 4 }) %>
12
+ <% end %>
6
13
  <% end %>
14
+
@@ -2,111 +2,39 @@
2
2
 
3
3
  module Playbook
4
4
  module PbDate
5
- class Date < Playbook::PbKit::Base
5
+ class Date
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_date
12
- configured_id
13
- configured_size
14
- configured_timestamp
15
- configured_timezone].freeze
10
+ partial "pb_date/date"
16
11
 
17
- def initialize(classname: default_configuration,
18
- data: default_configuration,
19
- date: default_configuration,
20
- id: default_configuration,
21
- size: default_configuration,
22
- timestamp: default_configuration,
23
- timezone: default_configuration)
24
- self.configured_classname = classname
25
- self.configured_data = data
26
- self.configured_date = date
27
- self.configured_id = id
28
- self.configured_size = size
29
- self.configured_timestamp = timestamp
30
- self.configured_timezone = timezone
31
- end
32
-
33
- def display_value
34
- case size
35
- when "lg"
36
- display_value_lg
37
- when "sm"
38
- display_value_sm
39
- else
40
- display_value_xs
41
- end
42
- end
43
-
44
- def kit_class
45
- "pb_date_kit"
46
- end
47
-
48
- def to_partial_path
49
- "pb_date/date"
50
- end
51
-
52
- private
12
+ prop :date, required: true
13
+ prop :size, type: Playbook::Props::Enum,
14
+ values: %w[lg sm xs],
15
+ default: "sm"
53
16
 
54
- def timestamp
55
- if is_set? configured_date
56
- date = configured_date
57
- else
58
- date = configured_timestamp
59
- end
60
- Playbook::PbKit::PbDateTime.new(date, timezone_value)
17
+ def classname
18
+ generate_classname("pb_date_kit")
61
19
  end
62
20
 
63
- def timezone_value
64
- default_value(configured_timezone, "America/New_York")
21
+ def xs_date
22
+ "#{pb_date_time.to_day_of_week.upcase} &middot; #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
65
23
  end
66
24
 
67
- def size
68
- size_options = %w[lg sm xs]
69
- one_of_value(configured_size, size_options, "sm")
25
+ def lg_date
26
+ "#{pb_date_time.to_month.upcase} #{pb_date_time.to_day}"
70
27
  end
71
28
 
72
- def icon
73
- pb_icon = Playbook::PbIcon::Icon.new(icon: "calendar", fixed_width: true)
74
- ApplicationController.renderer.render(partial: pb_icon, as: :object)
29
+ def sm_date
30
+ "#{pb_date_time.to_day_of_week.upcase} &middot; #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
75
31
  end
76
32
 
77
- def text
78
- content_tag(:span) do
79
- "#{timestamp.to_day_of_week.upcase} &middot; #{timestamp.to_month.upcase} #{timestamp.to_day}".html_safe
80
- end
81
- end
82
-
83
- def display_value_xs
84
- if is_set?(configured_timestamp) || is_set?(configured_date)
85
- pb_value = Playbook::PbTitle::Title.new(size: 4, text: text)
86
- ApplicationController.renderer.render(partial: pb_value, as: :object)
87
- end
88
- end
89
-
90
- def display_value_sm
91
- if is_set?(configured_timestamp) || is_set?(configured_date)
92
- pb_value = Playbook::PbTitle::Title.new(size: 4, text: icon + text)
93
- ApplicationController.renderer.render(partial: pb_value, as: :object)
94
- end
95
- end
96
-
97
- def display_value_lg
98
- if is_set?(configured_timestamp) || is_set?(configured_date)
99
- pb_value_lg = Playbook::PbTitle::Title.new(size: 3, text: "#{timestamp.to_month.upcase} #{timestamp.to_day}")
100
- ApplicationController.renderer.render(partial: pb_value_lg, as: :object)
101
- end
102
- end
33
+ private
103
34
 
104
- DEFAULT = Object.new
105
- private_constant :DEFAULT
106
- def default_configuration
107
- DEFAULT
35
+ def pb_date_time
36
+ pb_date_time ||= Playbook::PbKit::PbDateTime.new(date)
108
37
  end
109
- attr_accessor(*PROPS)
110
38
  end
111
39
  end
112
40
  end