playbook_ui 4.17.0.pre.alpha1 → 4.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -6
  3. data/app/pb_kits/playbook/_playbook.scss +3 -0
  4. data/app/pb_kits/playbook/data/menu.yml +1 -0
  5. data/app/pb_kits/playbook/index.js +1 -4
  6. data/app/pb_kits/playbook/packs/examples.js +2 -0
  7. data/app/pb_kits/playbook/packs/site_styles/docs/_markdown.scss +1 -1
  8. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +24 -15
  9. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.jsx +45 -0
  10. data/app/pb_kits/playbook/pb_avatar/docs/example.yml +6 -5
  11. data/app/pb_kits/playbook/pb_avatar/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +32 -0
  13. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +78 -0
  14. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +63 -0
  15. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +44 -0
  16. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +15 -0
  17. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +19 -0
  18. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +8 -0
  19. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +13 -0
  20. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +15 -0
  21. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +14 -0
  22. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +27 -0
  23. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +29 -0
  24. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +11 -0
  25. data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +16 -0
  26. data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
  27. data/app/pb_kits/playbook/pb_badge/_badge.jsx +20 -14
  28. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -2
  29. data/app/pb_kits/playbook/pb_body/_body.jsx +2 -1
  30. data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +4 -0
  31. data/app/pb_kits/playbook/pb_button/_button.jsx +2 -1
  32. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +6 -0
  33. data/app/pb_kits/playbook/pb_caption/_caption.jsx +19 -17
  34. data/app/pb_kits/playbook/pb_card/_card.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_card/_card.jsx +35 -38
  36. data/app/pb_kits/playbook/pb_card/_card.scss +0 -10
  37. data/app/pb_kits/playbook/pb_card/card.rb +9 -3
  38. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -5
  39. data/app/pb_kits/playbook/pb_card/card_header.rb +0 -3
  40. data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +2 -1
  41. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +17 -18
  42. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +4 -1
  43. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +16 -3
  44. data/app/pb_kits/playbook/pb_contact/_contact.jsx +58 -34
  45. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +1 -0
  47. data/app/pb_kits/playbook/pb_currency/_currency.html.erb +1 -0
  48. data/app/pb_kits/playbook/pb_currency/_currency.jsx +37 -21
  49. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.html.erb +3 -3
  50. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.jsx +2 -3
  51. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +2 -3
  52. data/app/pb_kits/playbook/pb_currency/docs/_currency_medium.jsx +2 -2
  53. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +1 -1
  54. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.jsx +5 -2
  55. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -2
  56. data/app/pb_kits/playbook/pb_date/_date.jsx +39 -15
  57. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +3 -1
  58. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +43 -37
  59. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +2 -2
  60. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +6 -16
  61. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +21 -18
  62. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +30 -33
  63. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +10 -15
  64. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +8 -8
  65. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +13 -23
  66. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +16 -14
  67. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +13 -12
  68. data/app/pb_kits/playbook/pb_flex/_flex.jsx +35 -20
  69. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -9
  70. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +14 -19
  71. data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +26 -22
  72. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +13 -12
  73. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +85 -80
  74. data/app/pb_kits/playbook/pb_icon/_icon.jsx +54 -33
  75. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +13 -9
  76. data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +16 -20
  77. data/app/pb_kits/playbook/pb_image/_image.jsx +12 -10
  78. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +15 -25
  79. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +10 -17
  80. data/app/pb_kits/playbook/pb_layout/_layout.jsx +49 -45
  81. data/app/pb_kits/playbook/pb_layout/_layout.scss +76 -57
  82. data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.html.erb +54 -0
  83. data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.jsx +27 -0
  84. data/app/pb_kits/playbook/pb_layout/docs/example.yml +2 -0
  85. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  86. data/app/pb_kits/playbook/pb_layout/layout.rb +10 -2
  87. data/app/pb_kits/playbook/pb_legend/_legend.jsx +17 -15
  88. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +3 -2
  89. data/app/pb_kits/playbook/pb_list/_list.jsx +24 -21
  90. data/app/pb_kits/playbook/pb_list/docs/_description.md +7 -1
  91. data/app/pb_kits/playbook/pb_list/docs/_list_layout_left.html.erb +8 -0
  92. data/app/pb_kits/playbook/pb_list/docs/_list_layout_right.html.erb +8 -0
  93. data/app/pb_kits/playbook/pb_list/docs/example.yml +2 -0
  94. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +21 -19
  95. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +4 -11
  96. data/app/pb_kits/playbook/pb_message/_message.jsx +15 -11
  97. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +10 -10
  98. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.jsx +7 -19
  99. data/app/pb_kits/playbook/pb_nav/_nav.jsx +17 -14
  100. data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +5 -13
  101. data/app/pb_kits/playbook/pb_person/_person.jsx +5 -11
  102. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +20 -20
  103. data/app/pb_kits/playbook/pb_pill/_pill.jsx +5 -10
  104. data/app/pb_kits/playbook/pb_popover/_popover.jsx +52 -41
  105. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +16 -12
  106. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +15 -12
  107. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +17 -10
  108. data/app/pb_kits/playbook/pb_radio/_radio.jsx +3 -1
  109. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +19 -13
  110. data/app/pb_kits/playbook/pb_select/_select.jsx +4 -2
  111. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx +12 -7
  112. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +14 -13
  113. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +2 -1
  114. data/app/pb_kits/playbook/pb_table/_table.jsx +29 -28
  115. data/app/pb_kits/playbook/pb_table/_table.scss +1 -1
  116. data/app/pb_kits/playbook/pb_table/_table_row.jsx +6 -7
  117. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.html.erb +52 -8
  118. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +52 -8
  119. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +3 -1
  120. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +3 -5
  121. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  122. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +2 -1
  123. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +38 -18
  124. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +12 -11
  125. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +7 -14
  126. data/app/pb_kits/playbook/pb_title/_title.jsx +12 -13
  127. data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +1 -1
  128. data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +49 -28
  129. data/app/pb_kits/playbook/pb_title_count/docs/_title_count_align.jsx +31 -0
  130. data/app/pb_kits/playbook/pb_title_count/docs/_title_count_default.jsx +13 -2
  131. data/app/pb_kits/playbook/pb_title_count/docs/example.yml +4 -5
  132. data/app/pb_kits/playbook/pb_title_count/docs/index.js +1 -0
  133. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +7 -18
  134. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +9 -11
  135. data/app/pb_kits/playbook/pb_user/_user.jsx +37 -37
  136. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +7 -7
  137. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +32 -30
  138. data/app/pb_kits/playbook/props.rb +48 -0
  139. data/app/pb_kits/playbook/tokens/_spacing.scss +1 -0
  140. data/app/pb_kits/playbook/utilities/_spacing.scss +42 -0
  141. data/app/pb_kits/playbook/utilities/spacing.js +33 -0
  142. data/app/views/playbook/samples/dashboards/index.html.erb +3 -1
  143. data/lib/playbook/version.rb +1 -1
  144. data/lib/tasks/pb_release.rake +0 -2
  145. metadata +28 -6
@@ -99,11 +99,6 @@ $pb_card_padding:(
99
99
  @include pb_card_header_color($color_value);
100
100
  }
101
101
  }
102
- @each $padding_name, $padding_value in $pb_card_padding {
103
- &[class*=_#{$padding_name}] {
104
- padding: $padding_value;
105
- }
106
- }
107
102
  }
108
103
 
109
104
  [class^=pb_card_body_kit] {
@@ -112,11 +107,6 @@ $pb_card_padding:(
112
107
  flex-basis: auto;
113
108
  min-height: 1px;
114
109
  border: 0;
115
- @each $name, $padding_size in $pb_card_padding {
116
- &[class*=_#{$name}] {
117
- padding: $padding_size;
118
- }
119
- }
120
110
  }
121
111
 
122
112
  @each $name, $shadow in $box_shadows {
@@ -8,9 +8,6 @@ module Playbook
8
8
  partial "pb_card/card"
9
9
 
10
10
  prop :selected, type: Playbook::Props::Boolean, default: false
11
- prop :padding, type: Playbook::Props::Enum,
12
- values: %w[none xs sm md lg xl],
13
- default: "md"
14
11
  prop :shadow, type: Playbook::Props::Enum,
15
12
  values: %w[none deep deeper deepest],
16
13
  default: "none"
@@ -28,8 +25,17 @@ module Playbook
28
25
  dark_class)
29
26
  end
30
27
 
28
+ def body_padding
29
+ if padding.present?
30
+ ""
31
+ else
32
+ "p_md"
33
+ end
34
+ end
35
+
31
36
  private
32
37
 
38
+
33
39
  def selected_class
34
40
  selected ? "selected" : "deselected"
35
41
  end
@@ -7,12 +7,8 @@ module Playbook
7
7
 
8
8
  partial "pb_card/child_kits/card_body"
9
9
 
10
- prop :padding, type: Playbook::Props::Enum,
11
- values: %w[none xs sm md lg xl],
12
- default: "md"
13
-
14
10
  def classname
15
- generate_classname("pb_card_body_kit", padding)
11
+ generate_classname("pb_card_body_kit", padding, separator: " ")
16
12
  end
17
13
  end
18
14
  end
@@ -7,9 +7,6 @@ module Playbook
7
7
 
8
8
  partial "pb_card/child_kits/card_header"
9
9
 
10
- prop :padding, type: Playbook::Props::Enum,
11
- values: %w[none xs sm md lg xl],
12
- default: "none"
13
10
  prop :category_color, type: Playbook::Props::Numeric,
14
11
  default: 1
15
12
 
@@ -1,3 +1,4 @@
1
- <%= pb_rails("card") do %>
1
+ <%= pb_rails("card", props: {
2
+ }) do %>
2
3
  Card content
3
4
  <% end %>
@@ -3,6 +3,8 @@
3
3
  import React from 'react'
4
4
  import Body from '../pb_body/_body.jsx'
5
5
  import Icon from '../pb_icon/_icon.jsx'
6
+ import classnames from 'classnames'
7
+ import { spacing } from '../utilities/spacing.js'
6
8
 
7
9
  type CheckboxProps = {
8
10
  checked?: Boolean,
@@ -15,27 +17,24 @@ type CheckboxProps = {
15
17
  onChange: (Boolean) => void,
16
18
  }
17
19
 
18
- const Checkbox = ({
19
- checked = false,
20
- dark = false,
21
- error = false,
22
- name = '',
23
- text = '',
24
- value = '',
25
- children = null,
26
- onChange = () => {},
27
-
28
- }: CheckboxProps) => {
29
- const bodyClassName = {
30
- 'pb_checkbox_label': true,
31
- }
20
+ const Checkbox = (props: CheckboxProps) => {
21
+ const {
22
+ checked = false,
23
+ dark = false,
24
+ error = false,
25
+ name = '',
26
+ text = '',
27
+ value = '',
28
+ children = null,
29
+ onChange = () => {},
30
+ } = props
32
31
 
33
32
  return (
34
33
  <label
35
- className={
36
- 'pb_checkbox_kit' +
34
+ className={classnames('pb_checkbox_kit' +
37
35
  (dark === true ? '_dark' : '') +
38
- (error === true ? ' error' : '')
36
+ (error === true ? ' error' : ''), spacing(props))
37
+
39
38
  }
40
39
  >
41
40
  <If condition={children}>
@@ -58,7 +57,7 @@ const Checkbox = ({
58
57
  />
59
58
  </span>
60
59
  <Body
61
- className={bodyClassName}
60
+ className="pb_checkbox_label"
62
61
  dark={dark}
63
62
  status={error ? 'negative' : null}
64
63
  >
@@ -1,6 +1,7 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+ import classnames from 'classnames'
4
5
  import { Button, Icon } from '../'
5
6
 
6
7
  import type { Callback } from '../types'
@@ -9,6 +10,8 @@ import {
9
10
  noop,
10
11
  } from '../utilities/props'
11
12
 
13
+ import { spacing } from '../utilities/spacing.js'
14
+
12
15
  type CircleIconButtonProps = {
13
16
  className?: String,
14
17
  dark?: Boolean,
@@ -35,7 +38,7 @@ const CircleIconButton = (props: CircleIconButtonProps) => {
35
38
  } = props
36
39
 
37
40
  return (
38
- <div className="pb_circle_icon_button_kit">
41
+ <div className={classnames('pb_circle_icon_button_kit', spacing(props))}>
39
42
  <Button
40
43
  dark={dark}
41
44
  disabled={disabled}
@@ -1,10 +1,23 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  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 }) %>
6
+ <%= pb_rails("body", props: {
7
+ tag: "span",
8
+ classname: "pb_contact_kit",
9
+ color: "light"
10
+ }) do %>
11
+ <%= pb_rails("icon", props: {
12
+ icon: object.contact_icon,
13
+ fixed_width: true
14
+ }) %>
7
15
  <%= 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 %>
16
+
17
+ <%= pb_rails("caption", props: {
18
+ text: object.contact_detail,
19
+ tag: 'span',
20
+ size: 'xs'
21
+ }) if object.contact_detail %>
9
22
  <% end %>
10
23
  <% end %>
@@ -2,16 +2,18 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
-
5
+ import { spacing } from '../utilities/spacing.js'
6
6
  import { Body, Caption, Icon } from '../'
7
7
 
8
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
9
+
8
10
  const contactTypeMap = {
9
11
  'cell': 'mobile',
12
+ 'email': 'envelope',
10
13
  'home': 'phone',
11
14
  'work': 'phone-office',
12
15
  'work-cell': 'phone-laptop',
13
- 'email': 'envelope',
14
- 'wrong number': 'slash-phone',
16
+ 'wrong-phone': 'phone-slash',
15
17
  }
16
18
 
17
19
  const formatContact = (contactString, contactType) => {
@@ -22,47 +24,69 @@ const formatContact = (contactString, contactType) => {
22
24
  const phoneNumber = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/)
23
25
  if (phoneNumber) {
24
26
  const intlCode = phoneNumber[1] ? '+1 ' : ''
25
- return [intlCode, '(', phoneNumber[2], ') ', phoneNumber[3], '-', phoneNumber[4]].join('')
27
+ return [
28
+ intlCode,
29
+ '(',
30
+ phoneNumber[2],
31
+ ') ',
32
+ phoneNumber[3],
33
+ '-',
34
+ phoneNumber[4],
35
+ ].join('')
26
36
  }
27
37
  return null
28
38
  }
29
39
 
30
40
  type ContactProps = {
31
- contactType?: 'cell' | 'home' | 'work' | 'email' | 'wrong number',
41
+ aria?: object,
32
42
  className?: String | Array<String>,
33
- dark?: Boolean,
34
- contactValue: String,
35
43
  contactDetail?: String,
44
+ contactType?: String,
45
+ contactValue: String,
46
+ data?: object,
47
+ id?: String,
36
48
  }
37
49
 
38
- const Contact = ({
39
- contactType,
40
- className,
41
- dark = false,
42
- contactValue,
43
- contactDetail = '',
44
- }: ContactProps) => (
45
- <div className={classnames('pb_contact_kit', className)}>
46
- <Body
47
- className="pb_contact_kit"
48
- color="light"
49
- dark={dark}
50
- tag="span"
50
+ const Contact = (props: ContactProps) => {
51
+ const {
52
+ aria = {},
53
+ className,
54
+ contactDetail,
55
+ contactType,
56
+ contactValue,
57
+ data = {},
58
+ id } = props
59
+ const ariaProps = buildAriaProps(aria)
60
+ const dataProps = buildDataProps(data)
61
+ const classes = classnames(buildCss('pb_contact_kit'), className, spacing(props))
62
+
63
+ return (
64
+ <div
65
+ {...ariaProps}
66
+ {...dataProps}
67
+ className={classes}
68
+ id={id}
51
69
  >
52
- <Icon
53
- fixedWidth
54
- icon={contactTypeMap[contactType] || 'phone'}
55
- />
56
- {` ${formatContact(contactValue, contactType)} `}
57
- <If condition={contactDetail}>
58
- <Caption
59
- size="xs"
60
- tag="span"
61
- text={contactDetail}
70
+ <Body
71
+ className="pb_contact_kit"
72
+ color="light"
73
+ tag="span"
74
+ >
75
+ <Icon
76
+ fixedWidth
77
+ icon={contactTypeMap[contactType] || 'phone'}
62
78
  />
63
- </If>
64
- </Body>
65
- </div>
66
- )
79
+ {` ${formatContact(contactValue, contactType)} `}
80
+ <If condition={contactDetail}>
81
+ <Caption
82
+ size="xs"
83
+ tag="span"
84
+ text={contactDetail}
85
+ />
86
+ </If>
87
+ </Body>
88
+ </div>
89
+ )
90
+ }
67
91
 
68
92
  export default Contact
@@ -9,7 +9,7 @@
9
9
 
10
10
  <%= pb_rails("contact", props: {
11
11
  contact_type: "email",
12
- contact_value: "email@example.com"
12
+ contact_value: "email@example.com",
13
13
  }) %>
14
14
 
15
15
  <%= pb_rails("contact", props: {
@@ -18,6 +18,7 @@ const ContactDefault = () => {
18
18
  <Contact
19
19
  contactType="work"
20
20
  contactValue="3245627482"
21
+
21
22
  />
22
23
  <Contact
23
24
  contactType="work-cell"
@@ -1,4 +1,5 @@
1
1
  <%= content_tag(:div,
2
+ aria: object.aria,
2
3
  id: object.id,
3
4
  data: object.data,
4
5
  class: object.classname) do %>
@@ -1,19 +1,24 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+ import classnames from 'classnames'
4
5
 
6
+ import { spacing } from '../utilities/spacing.js'
5
7
  import { Body, Caption, Title } from '../'
6
- import { buildCss } from '../utilities/props'
8
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
9
 
8
10
  type CurrencyProps = {
9
- align?: 'left' | 'center' | 'right',
10
- amount: string,
11
- unit: string,
12
- className?: string,
13
- label?: string,
11
+ align?: 'center' | 'left' | 'right',
12
+ amount: String,
13
+ aria?: object,
14
+ className?: String,
15
+ dark?: Boolean,
16
+ data?: object,
17
+ id?: String,
18
+ label?: String,
14
19
  size?: 'sm' | 'md' | 'lg',
15
- symbol?: string,
16
- dark?: boolean,
20
+ symbol?: String,
21
+ unit?: String,
17
22
  }
18
23
 
19
24
  const sizes = {
@@ -22,20 +27,33 @@ const sizes = {
22
27
  sm: 4,
23
28
  }
24
29
 
25
- const Currency = ({
26
- align = 'left',
27
- amount,
28
- unit,
29
- className,
30
- label = '',
31
- size = 'sm',
32
- symbol = '$',
33
- dark = false,
34
- }: CurrencyProps) => {
30
+ const Currency = (props: CurrencyProps) => {
31
+ const {
32
+ align = 'left',
33
+ aria = {},
34
+ amount,
35
+ data = {},
36
+ id,
37
+ unit,
38
+ className,
39
+ label = '',
40
+ size = 'sm',
41
+ symbol = '$',
42
+ dark = false,
43
+ } = props
44
+
35
45
  const [whole, decimal = '00'] = amount.split('.')
46
+ const ariaProps = buildAriaProps(aria)
47
+ const dataProps = buildDataProps(data)
48
+ const classes = classnames(buildCss('pb_currency_kit', align, size, { dark: dark }), className, spacing(props))
36
49
 
37
50
  return (
38
- <div className={buildCss('pb_currency_kit', align, className, { dark: dark }, size)}>
51
+ <div
52
+ {...ariaProps}
53
+ {...dataProps}
54
+ className={classes}
55
+ id={id}
56
+ >
39
57
  <Caption>{label}</Caption>
40
58
 
41
59
  <div className="pb_currency_wrapper">
@@ -43,7 +61,6 @@ const Currency = ({
43
61
  className="dollar_sign"
44
62
  color="light"
45
63
  dark={dark}
46
-
47
64
  >
48
65
  {symbol}
49
66
  </Body>
@@ -60,7 +77,6 @@ const Currency = ({
60
77
  className="unit"
61
78
  color="light"
62
79
  dark={dark}
63
-
64
80
  >
65
81
  <If condition={unit}>
66
82
  {unit}
@@ -1,7 +1,7 @@
1
1
  <%= pb_rails("currency", props: {
2
2
  amount: "2,000.50",
3
3
  size: "lg",
4
- dark: true
4
+ dark: true,
5
5
  }) %>
6
6
 
7
7
  <%= pb_rails("currency", props: {
@@ -10,7 +10,7 @@
10
10
  label: "Caption",
11
11
  size: "md",
12
12
  symbol: "€",
13
- dark: true
13
+ dark: true,
14
14
  }) %>
15
15
 
16
16
  <%= pb_rails("currency", props: {
@@ -19,5 +19,5 @@
19
19
  label: "Caption",
20
20
  unit: "/mo",
21
21
  size: "sm",
22
- dark: true
22
+ dark: true,
23
23
  }) %>