playbook_ui 4.17.0 → 5.0.1.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/helpers/playbook/pb_sample_helper.rb +1 -1
  4. data/app/pb_kits/playbook/_playbook.scss +2 -1
  5. data/app/pb_kits/playbook/data/menu.yml +5 -2
  6. data/app/pb_kits/playbook/index.js +1 -0
  7. data/app/pb_kits/playbook/packs/examples.js +4 -0
  8. data/app/pb_kits/playbook/packs/samples.js +4 -0
  9. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +1 -0
  10. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +3 -0
  11. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -0
  12. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +3 -0
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.html.erb +15 -0
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +24 -0
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +6 -4
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_caption/_caption.jsx +21 -4
  18. data/app/pb_kits/playbook/pb_card/_card.scss +1 -72
  19. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +72 -0
  20. data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx +0 -1
  21. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.jsx +1 -1
  22. data/app/pb_kits/playbook/pb_filter/templates/_default.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_installer/_installer.html.erb +16 -0
  24. data/app/pb_kits/playbook/pb_installer/_installer.jsx +54 -0
  25. data/app/pb_kits/playbook/pb_installer/_installer.scss +7 -0
  26. data/app/pb_kits/playbook/pb_installer/docs/_installer_default.html.erb +8 -0
  27. data/app/pb_kits/playbook/pb_installer/docs/_installer_default.jsx +16 -0
  28. data/app/pb_kits/playbook/pb_installer/docs/example.yml +9 -0
  29. data/app/pb_kits/playbook/pb_installer/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_installer/installer.rb +18 -0
  31. data/app/pb_kits/playbook/pb_label_value/_label_value.html.erb +1 -0
  32. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +22 -3
  33. data/app/pb_kits/playbook/pb_layout/_body.html.erb +1 -1
  34. data/app/pb_kits/playbook/pb_layout/_column.html.erb +7 -0
  35. data/app/pb_kits/playbook/pb_layout/_layout.jsx +35 -15
  36. data/app/pb_kits/playbook/pb_layout/_layout.scss +54 -0
  37. data/app/pb_kits/playbook/pb_layout/body.rb +4 -0
  38. data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban.html.erb +140 -0
  39. data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban.jsx +1234 -0
  40. data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban_responsive.html.erb +57 -0
  41. data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban_responsive.jsx +46 -0
  42. data/app/pb_kits/playbook/pb_layout/docs/example.yml +3 -0
  43. data/app/pb_kits/playbook/pb_layout/docs/index.js +2 -0
  44. data/app/pb_kits/playbook/pb_layout/layout.rb +12 -4
  45. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -0
  46. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.html.erb +16 -0
  47. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +23 -0
  48. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +5 -3
  49. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +3 -0
  51. data/app/pb_kits/playbook/pb_list/_item.html.erb +3 -2
  52. data/app/pb_kits/playbook/pb_list/_list.html.erb +3 -3
  53. data/app/pb_kits/playbook/pb_list/_list.jsx +55 -10
  54. data/app/pb_kits/playbook/pb_list/_list_item.jsx +41 -18
  55. data/app/pb_kits/playbook/pb_list/docs/_list_borderless.jsx +21 -0
  56. data/app/pb_kits/playbook/pb_list/docs/_list_dark.jsx +0 -5
  57. data/app/pb_kits/playbook/pb_list/docs/_list_dark_borderless.jsx +22 -0
  58. data/app/pb_kits/playbook/pb_list/docs/_list_dark_lg.jsx +22 -0
  59. data/app/pb_kits/playbook/pb_list/docs/_list_dark_ordered.jsx +22 -0
  60. data/app/pb_kits/playbook/pb_list/docs/_list_dark_xpadding.jsx +22 -0
  61. data/app/pb_kits/playbook/pb_list/docs/_list_layout_left.jsx +75 -0
  62. data/app/pb_kits/playbook/pb_list/docs/_list_layout_right.jsx +75 -0
  63. data/app/pb_kits/playbook/pb_list/docs/_list_lg.jsx +21 -0
  64. data/app/pb_kits/playbook/pb_list/docs/_list_ordered.jsx +21 -0
  65. data/app/pb_kits/playbook/pb_list/docs/_list_xpadding.jsx +21 -0
  66. data/app/pb_kits/playbook/pb_list/docs/example.yml +12 -1
  67. data/app/pb_kits/playbook/pb_list/docs/index.js +11 -0
  68. data/app/pb_kits/playbook/pb_logistic/_logistic.html.erb +1 -0
  69. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +26 -4
  70. data/app/pb_kits/playbook/pb_message/_message.html.erb +1 -0
  71. data/app/pb_kits/playbook/pb_message/_message.jsx +25 -7
  72. data/app/pb_kits/playbook/pb_message/docs/_message_default.jsx +1 -2
  73. data/app/pb_kits/playbook/pb_message/message.rb +1 -1
  74. data/app/pb_kits/playbook/pb_person/_person.html.erb +9 -2
  75. data/app/pb_kits/playbook/pb_person/_person.jsx +34 -10
  76. data/app/pb_kits/playbook/pb_person/docs/_person_default.html.erb +5 -1
  77. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +1 -0
  78. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +57 -5
  79. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_wrong_numbers.jsx +32 -0
  80. data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +2 -0
  81. data/app/pb_kits/playbook/pb_person_contact/docs/index.js +1 -0
  82. data/app/pb_kits/playbook/pb_popover/_popover.html.erb +4 -4
  83. data/app/pb_kits/playbook/pb_popover/_popover.jsx +41 -8
  84. data/app/pb_kits/playbook/pb_popover/_popover.scss +44 -7
  85. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +42 -0
  86. data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +99 -0
  87. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +19 -7
  88. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.jsx +22 -6
  89. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +11 -10
  90. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +22 -18
  91. data/app/pb_kits/playbook/pb_popover/docs/_popover_list.md +1 -0
  92. data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.html.erb +24 -0
  93. data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +56 -0
  94. data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.html.erb +14 -0
  95. data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +50 -0
  96. data/app/pb_kits/playbook/pb_popover/docs/example.yml +12 -8
  97. data/app/pb_kits/playbook/pb_popover/docs/index.js +3 -3
  98. data/app/pb_kits/playbook/pb_popover/index.js +18 -9
  99. data/app/pb_kits/playbook/pb_popover/popover.rb +26 -2
  100. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.html.erb +1 -0
  101. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +29 -5
  102. data/app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb +1 -0
  103. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +22 -13
  104. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text.jsx +3 -1
  105. data/app/pb_kits/playbook/pb_timeline/_item.html.erb +28 -0
  106. data/app/pb_kits/playbook/pb_timeline/_item.jsx +54 -0
  107. data/app/pb_kits/playbook/pb_timeline/_timeline.html.erb +6 -0
  108. data/app/pb_kits/playbook/pb_timeline/_timeline.jsx +43 -0
  109. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +271 -0
  110. data/app/pb_kits/playbook/pb_timeline/docs/_description.md +3 -0
  111. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.html.erb +43 -0
  112. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.jsx +73 -0
  113. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.html.erb +43 -0
  114. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.jsx +73 -0
  115. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb +44 -0
  116. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx +85 -0
  117. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +13 -0
  118. data/app/pb_kits/playbook/pb_timeline/docs/index.js +3 -0
  119. data/app/pb_kits/playbook/pb_timeline/item.rb +25 -0
  120. data/app/pb_kits/playbook/pb_timeline/timeline.rb +27 -0
  121. data/app/pb_kits/playbook/pb_title/_title.html.erb +1 -0
  122. data/app/pb_kits/playbook/pb_title/_title.jsx +24 -17
  123. data/app/pb_kits/playbook/plugins/pb_chart.js +8 -2
  124. data/app/pb_kits/playbook/props.rb +7 -0
  125. data/app/views/layouts/playbook/application.html.slim +2 -3
  126. data/app/views/layouts/playbook/fullscreen.html.slim +2 -2
  127. data/app/views/layouts/playbook/grid.html.slim +2 -2
  128. data/app/views/layouts/playbook/samples.html.erb +2 -4
  129. data/app/views/playbook/samples/filter_table/index.html.erb +348 -0
  130. data/app/views/playbook/samples/filter_table/index.jsx +433 -0
  131. data/app/views/playbook/samples/registration/index.html.erb +316 -0
  132. data/app/views/playbook/samples/registration/index.jsx +476 -0
  133. data/lib/playbook/version.rb +1 -1
  134. metadata +62 -79
  135. data/app/pb_kits/playbook/packs/kits/pb_avatar.js +0 -1
  136. data/app/pb_kits/playbook/packs/kits/pb_badge.js +0 -1
  137. data/app/pb_kits/playbook/packs/kits/pb_bar_graph.js +0 -1
  138. data/app/pb_kits/playbook/packs/kits/pb_body.js +0 -1
  139. data/app/pb_kits/playbook/packs/kits/pb_button.js +0 -1
  140. data/app/pb_kits/playbook/packs/kits/pb_caption.js +0 -1
  141. data/app/pb_kits/playbook/packs/kits/pb_card.js +0 -1
  142. data/app/pb_kits/playbook/packs/kits/pb_checkbox.js +0 -1
  143. data/app/pb_kits/playbook/packs/kits/pb_circle_icon_button.js +0 -1
  144. data/app/pb_kits/playbook/packs/kits/pb_contact.js +0 -1
  145. data/app/pb_kits/playbook/packs/kits/pb_currency.js +0 -1
  146. data/app/pb_kits/playbook/packs/kits/pb_dashboard_value.js +0 -1
  147. data/app/pb_kits/playbook/packs/kits/pb_date.js +0 -2
  148. data/app/pb_kits/playbook/packs/kits/pb_date_range_inline.js +0 -1
  149. data/app/pb_kits/playbook/packs/kits/pb_date_range_stacked.js +0 -1
  150. data/app/pb_kits/playbook/packs/kits/pb_date_stacked.js +0 -1
  151. data/app/pb_kits/playbook/packs/kits/pb_date_year_stacked.js +0 -2
  152. data/app/pb_kits/playbook/packs/kits/pb_distribution_bar.js +0 -2
  153. data/app/pb_kits/playbook/packs/kits/pb_fixed_confirmation_toast.js +0 -2
  154. data/app/pb_kits/playbook/packs/kits/pb_flex.js +0 -1
  155. data/app/pb_kits/playbook/packs/kits/pb_form_pill.js +0 -1
  156. data/app/pb_kits/playbook/packs/kits/pb_hashtag.js +0 -2
  157. data/app/pb_kits/playbook/packs/kits/pb_highlight.js +0 -2
  158. data/app/pb_kits/playbook/packs/kits/pb_home_address_street.js +0 -2
  159. data/app/pb_kits/playbook/packs/kits/pb_icon.js +0 -2
  160. data/app/pb_kits/playbook/packs/kits/pb_icon_circle.js +0 -2
  161. data/app/pb_kits/playbook/packs/kits/pb_icon_value.js +0 -2
  162. data/app/pb_kits/playbook/packs/kits/pb_image.js +0 -1
  163. data/app/pb_kits/playbook/packs/kits/pb_label_pill.js +0 -2
  164. data/app/pb_kits/playbook/packs/kits/pb_label_value.js +0 -2
  165. data/app/pb_kits/playbook/packs/kits/pb_layout.js +0 -2
  166. data/app/pb_kits/playbook/packs/kits/pb_legend.js +0 -2
  167. data/app/pb_kits/playbook/packs/kits/pb_line_graph.js +0 -1
  168. data/app/pb_kits/playbook/packs/kits/pb_list.js +0 -2
  169. data/app/pb_kits/playbook/packs/kits/pb_loading_inline.js +0 -2
  170. data/app/pb_kits/playbook/packs/kits/pb_message.js +0 -2
  171. data/app/pb_kits/playbook/packs/kits/pb_multiple_users.js +0 -2
  172. data/app/pb_kits/playbook/packs/kits/pb_multiple_users_stacked.js +0 -2
  173. data/app/pb_kits/playbook/packs/kits/pb_nav.js +0 -1
  174. data/app/pb_kits/playbook/packs/kits/pb_online_status.js +0 -2
  175. data/app/pb_kits/playbook/packs/kits/pb_person.js +0 -2
  176. data/app/pb_kits/playbook/packs/kits/pb_person_contact.js +0 -2
  177. data/app/pb_kits/playbook/packs/kits/pb_pill.js +0 -2
  178. data/app/pb_kits/playbook/packs/kits/pb_popover.js +0 -1
  179. data/app/pb_kits/playbook/packs/kits/pb_progress_pills.js +0 -2
  180. data/app/pb_kits/playbook/packs/kits/pb_progress_simple.js +0 -2
  181. data/app/pb_kits/playbook/packs/kits/pb_progress_step.js +0 -2
  182. data/app/pb_kits/playbook/packs/kits/pb_radio.js +0 -2
  183. data/app/pb_kits/playbook/packs/kits/pb_section_separator.js +0 -2
  184. data/app/pb_kits/playbook/packs/kits/pb_select.js +0 -2
  185. data/app/pb_kits/playbook/packs/kits/pb_selectable_card.js +0 -2
  186. data/app/pb_kits/playbook/packs/kits/pb_source.js +0 -2
  187. data/app/pb_kits/playbook/packs/kits/pb_star_rating.js +0 -2
  188. data/app/pb_kits/playbook/packs/kits/pb_stat_change.js +0 -2
  189. data/app/pb_kits/playbook/packs/kits/pb_stat_value.js +0 -2
  190. data/app/pb_kits/playbook/packs/kits/pb_table.js +0 -1
  191. data/app/pb_kits/playbook/packs/kits/pb_text_input.js +0 -1
  192. data/app/pb_kits/playbook/packs/kits/pb_textarea.js +0 -2
  193. data/app/pb_kits/playbook/packs/kits/pb_time.js +0 -2
  194. data/app/pb_kits/playbook/packs/kits/pb_timestamp.js +0 -2
  195. data/app/pb_kits/playbook/packs/kits/pb_title.js +0 -1
  196. data/app/pb_kits/playbook/packs/kits/pb_title_count.js +0 -2
  197. data/app/pb_kits/playbook/packs/kits/pb_title_detail.js +0 -2
  198. data/app/pb_kits/playbook/packs/kits/pb_toggle.js +0 -2
  199. data/app/pb_kits/playbook/packs/kits/pb_user.js +0 -2
  200. data/app/pb_kits/playbook/packs/kits/pb_user_badge.js +0 -2
  201. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_any.html.erb +0 -19
  202. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_any.jsx +0 -40
  203. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_inside.html.erb +0 -14
  204. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_inside.jsx +0 -40
  205. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.html.erb +0 -14
  206. data/app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.jsx +0 -40
  207. data/app/pb_kits/playbook/pb_popover/docs/_popover_with_button.jsx +0 -34
  208. data/app/pb_kits/playbook/pb_popover/docs/_popover_with_circle.html.erb +0 -5
@@ -1,14 +1,18 @@
1
1
  examples:
2
2
  rails:
3
3
  - popover_default: Default
4
- - popover_list: With any children
5
- - popover_click_outside: Close on click outside
6
- - popover_click_inside: Close on click inside
7
- - popover_click_any: Close on click anywhere
4
+ - popover_list: Example as dropdown
5
+ - popover_close: Close Options
6
+ - popover_z_index: Set Z-Index
7
+ - popover_scroll_height: Scroll and Height Settings
8
8
 
9
9
  react:
10
10
  - popover_default: Default
11
- - popover_list: With any children
12
- - popover_click_outside: Close on click outside
13
- - popover_click_inside: Close on click inside
14
- - popover_click_any: Close on click anywhere
11
+ - popover_list: Dropdown example
12
+ - popover_close: Close Options
13
+ - popover_z_index: Set Z-Index
14
+ - popover_scroll_height: Scroll and Height Settings
15
+
16
+
17
+
18
+
@@ -1,5 +1,5 @@
1
1
  export { default as PopoverDefault } from './_popover_default.jsx'
2
2
  export { default as PopoverList } from './_popover_list.jsx'
3
- export { default as PopoverClickOutside } from './_popover_click_outside.jsx'
4
- export { default as PopoverClickInside } from './_popover_click_inside.jsx'
5
- export { default as PopoverClickAny } from './_popover_click_any.jsx'
3
+ export { default as PopoverClose } from './_popover_close.jsx'
4
+ export { default as PopoverZIndex } from './_popover_z_index.jsx'
5
+ export { default as PopoverScrollHeight } from './_popover_scroll_height.jsx'
@@ -1,21 +1,30 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
- import Popper from 'popper.js'
2
+ import { createPopper } from '@popperjs/core'
3
3
 
4
- const POPOVER_OFFSET_Y = '0,8'
4
+ const POPOVER_OFFSET_Y = [0, 20]
5
5
 
6
6
  export default class PbPopover extends PbEnhancedElement {
7
7
  static get selector() {
8
8
  return '[data-pb-popover-kit]'
9
9
  }
10
10
 
11
+ moveTooltip() {
12
+ document.querySelector('body').appendChild(this.tooltip)
13
+ }
14
+
11
15
  connect() {
12
- this.popper = new Popper(this.triggerElement, this.tooltip, {
16
+ this.moveTooltip()
17
+ this.popper = createPopper(this.triggerElement, this.tooltip, {
13
18
  placement: this.position,
14
- modifiers: {
15
- offset: {
16
- offset: this.offset,
19
+ strategy: 'fixed',
20
+ modifiers: [
21
+ {
22
+ name: 'offset',
23
+ options: {
24
+ offset: this.offset,
25
+ },
17
26
  },
18
- },
27
+ ],
19
28
  })
20
29
 
21
30
  this.triggerElement.addEventListener('click', (event) => {
@@ -27,7 +36,7 @@ export default class PbPopover extends PbEnhancedElement {
27
36
  }
28
37
 
29
38
  setTimeout(() => {
30
- this.popper.scheduleUpdate()
39
+ // this.popper.scheduleUpdate()
31
40
  this.tooltip.classList.toggle('show')
32
41
  }, 0)
33
42
  })
@@ -89,7 +98,7 @@ export default class PbPopover extends PbEnhancedElement {
89
98
  }
90
99
 
91
100
  get offset() {
92
- return this.element.dataset.pbPopoverOffset === 'true' ? POPOVER_OFFSET_Y : '0,0'
101
+ return this.element.dataset.pbPopoverOffset === 'true' ? POPOVER_OFFSET_Y : [0, 0]
93
102
  }
94
103
 
95
104
  get closeOnClick() {
@@ -6,16 +6,40 @@ module Playbook
6
6
  include Playbook::Props
7
7
  partial "pb_popover/popover"
8
8
 
9
- prop :position
9
+ prop :position, type: Playbook::Props::Enum,
10
+ values: %w[top bottom left right],
11
+ default: "left"
10
12
  prop :trigger_element_id
11
13
  prop :tooltip_id
14
+ prop :max_height
15
+ prop :max_width
16
+ prop :min_width
17
+ prop :min_height
18
+ prop :z_index, type: Playbook::Props::String
12
19
  prop :offset, type: Playbook::Props::Boolean, default: false
13
20
  prop :close_on_click, type: Playbook::Props::Enum,
14
21
  values: %w[none outside inside any],
15
22
  default: "none"
16
23
 
17
24
  def classname
18
- generate_classname("pb_popover_kit")
25
+ generate_classname_without_spacing("pb_popover_kit")
26
+ end
27
+
28
+ def popover_spacing_helper
29
+ generate_classname(spacing_props.nil? ? "p_sm" : spacing_props)
30
+ end
31
+
32
+ def z_index_helper
33
+ z_index.present? ? "z-index: #{z_index}" : ""
34
+ end
35
+
36
+ def width_height_helper
37
+ out = ""
38
+ out += "max-height: #{max_height}; " if max_height.present?
39
+ out += "max-width: #{max_width}; " if max_width.present?
40
+ out += "min-height: #{min_height}; " if min_height.present?
41
+ out += "min-width: #{min_width};" if min_width.present?
42
+ out
19
43
  end
20
44
 
21
45
  def data
@@ -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 %>
@@ -3,10 +3,21 @@
3
3
  import React from 'react'
4
4
  import { Body, Title } from '../'
5
5
  import classnames from 'classnames'
6
+
7
+ import {
8
+ buildAriaProps,
9
+ buildCss,
10
+ buildDataProps,
11
+ } from '../utilities/props'
12
+
6
13
  import { spacing } from '../utilities/spacing.js'
7
14
 
8
15
  type ProgressPillsProps = {
9
16
  active?: Number,
17
+ aria?: object,
18
+ className?: String,
19
+ data?: object,
20
+ id?: String,
10
21
  steps?: Number,
11
22
  title?: String,
12
23
  value?: String,
@@ -26,7 +37,7 @@ const showSteps = (steps, active, dark) => {
26
37
  const ProgressPill = ({ active, dark, step }: ProgressPillProps) => (
27
38
  <div
28
39
  className={`pb_progress_pill${step <= active ? '_active' : '_inactive'}${
29
- dark ? '_dark' : null
40
+ dark ? '_dark' : ''
30
41
  }`}
31
42
  key={step}
32
43
  />
@@ -35,15 +46,29 @@ const ProgressPill = ({ active, dark, step }: ProgressPillProps) => (
35
46
  const ProgressPills = (props: ProgressPillsProps) => {
36
47
  const {
37
48
  active = 0,
49
+ aria = {},
50
+ className,
51
+ data = {},
52
+ id,
38
53
  steps = 3,
39
- title = null,
40
- value = null,
54
+ title,
55
+ value,
41
56
  dark = false,
42
57
  } = props
43
58
  const darkClass = dark ? '_dark' : ''
44
59
 
60
+ const ariaProps = buildAriaProps(aria)
61
+ const dataProps = buildDataProps(data)
62
+ const classes = classnames(buildCss('pb_progress_pills_kit', darkClass), className, spacing(props))
63
+
45
64
  return (
46
- <div className={classnames(`pb_progress_pills_kit${darkClass}`, spacing(props))}>
65
+ <div
66
+ {...ariaProps}
67
+ {...dataProps}
68
+ className={classes}
69
+ id={id}
70
+ >
71
+
47
72
  <If condition={title}>
48
73
  <div className="progress_pills_status">
49
74
  <Title
@@ -59,7 +84,6 @@ const ProgressPills = (props: ProgressPillsProps) => {
59
84
  />
60
85
  </div>
61
86
  </If>
62
-
63
87
  <div className="progress_pills">{showSteps(steps, active, dark)}</div>
64
88
  </div>
65
89
  )
@@ -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,36 +1,45 @@
1
1
  /* @flow */
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
- import Caption from '../pb_caption/_caption.jsx'
4
+ import { Caption } from '../'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
6
  import { spacing } from '../utilities/spacing.js'
6
7
 
7
8
  type SectionSeparatorProps = {
9
+ aria: object,
8
10
  className: String,
9
- text: String,
11
+ dark?: Boolean,
12
+ data: object,
13
+ id: String,
10
14
  orientation?: "horizontal" | "vertical",
15
+ text: String,
11
16
  variant?: "card" | "background",
12
- dark?: Boolean,
13
17
  }
14
18
 
15
19
  const SectionSeparator = (props: SectionSeparatorProps) => {
16
20
  const {
21
+ aria = {},
17
22
  className,
18
- text,
23
+ dark = false,
24
+ data = {},
25
+ id,
19
26
  orientation = 'horizontal',
27
+ text,
20
28
  variant = 'card',
21
- dark = false,
22
29
  } = props
23
30
  const themeStyle = dark === true ? '_dark' : ''
24
- const css = classnames(
25
- [
26
- `pb_section_separator_kit_${variant}_${orientation}` + themeStyle,
27
- className,
28
- ],
29
- spacing(props)
30
- )
31
+ const ariaProps = buildAriaProps(aria)
32
+ const dataProps = buildDataProps(data)
33
+ const classes = classnames(buildCss('pb_section_separator_kit', variant, orientation, themeStyle), className, spacing(props))
31
34
 
32
35
  return (
33
- <div className={css}>
36
+
37
+ <div
38
+ {...ariaProps}
39
+ {...dataProps}
40
+ className={classes}
41
+ id={id}
42
+ >
34
43
  <span>
35
44
  <Caption text={text} />
36
45
  </span>
@@ -3,7 +3,9 @@ import { SectionSeparator } from '../../'
3
3
 
4
4
  const SectionSeparatorText = () => {
5
5
  return (
6
- <SectionSeparator text="Title Separator" />
6
+ <SectionSeparator
7
+ text="Title Separator"
8
+ />
7
9
  )
8
10
  }
9
11
 
@@ -0,0 +1,28 @@
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname) do %>
5
+
6
+ <div class="pb_timeline_item_left_block">
7
+ <% if object.date.present? %>
8
+ <%= pb_rails("date_stacked", props: {
9
+ date: object.date,
10
+ size: "sm",
11
+ align: "center"
12
+ }) %>
13
+ <% end %>
14
+ </div>
15
+
16
+ <div class="pb_timeline_item_step">
17
+ <%= pb_rails("icon_circle", props: {
18
+ icon: object.icon,
19
+ variant: object.icon_color,
20
+ size: "xs"
21
+ }) %>
22
+ <div class="pb_timeline_item_connector"></div>
23
+ </div>
24
+ <div class="pb_timeline_item_right_block">
25
+ <%= capture(&object.children) %>
26
+ </div>
27
+
28
+ <% end %>
@@ -0,0 +1,54 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+ import { buildCss } from '../utilities/props'
6
+ import { DateStacked, IconCircle } from '..'
7
+
8
+ type ItemProps = {
9
+ className?: string,
10
+ children?: Array<React.Node>,
11
+ date?: Date,
12
+ icon?: string,
13
+ iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
14
+ lineStyle?: 'solid' | 'dotted',
15
+ }
16
+
17
+ const TimelineItem = ({
18
+ className,
19
+ children,
20
+ date,
21
+ icon = 'user',
22
+ iconColor = 'default',
23
+ lineStyle = 'solid',
24
+
25
+ }: ItemProps) => {
26
+ const timelineItemCss = buildCss('pb_timeline_item_kit', lineStyle)
27
+
28
+ return (
29
+ <div className={classnames(timelineItemCss, className)}>
30
+ <div className="pb_timeline_item_left_block">
31
+ <If condition={date}>
32
+ <DateStacked
33
+ align="center"
34
+ date={date}
35
+ size="sm"
36
+ />
37
+ </If>
38
+ </div>
39
+ <div className="pb_timeline_item_step">
40
+ <IconCircle
41
+ icon={icon}
42
+ size="xs"
43
+ variant={iconColor}
44
+ />
45
+ <div className="pb_timeline_item_connector" />
46
+ </div>
47
+ <div className="pb_timeline_item_right_block">
48
+ {children}
49
+ </div>
50
+ </div>
51
+ )
52
+ }
53
+
54
+ export default TimelineItem
@@ -0,0 +1,6 @@
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname) do %>
5
+ <%= capture(&object.children) %>
6
+ <% end %>
@@ -0,0 +1,43 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+ import TimelineItem from './_item.jsx'
6
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
+
8
+ type TimelineProps = {
9
+ aria?: object,
10
+ children?: Array<React.ReactChild>,
11
+ className?: String,
12
+ data?: String,
13
+ id?: String,
14
+ orientation?: String,
15
+ showDate?: Boolean,
16
+ }
17
+
18
+ const Timeline = ({
19
+ aria = {},
20
+ className,
21
+ children,
22
+ data = {},
23
+ orientation = 'horizontal',
24
+ showDate = false,
25
+ }: TimelineProps) => {
26
+ const ariaProps = buildAriaProps(aria)
27
+ const dataProps = buildDataProps(data)
28
+ const dateStyle = showDate === true ? '_with_date' : ''
29
+ const timelineCss = buildCss('pb_timeline_kit', `_${orientation}`, dateStyle)
30
+ return (
31
+ <div
32
+ {...ariaProps}
33
+ {...dataProps}
34
+ className={classnames(timelineCss, className)}
35
+ >
36
+ {children}
37
+ </div>
38
+ )
39
+ }
40
+
41
+ Timeline.Item = TimelineItem
42
+
43
+ export default Timeline
@@ -0,0 +1,271 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/spacing";
3
+ @import "../tokens/opacity";
4
+ @import "../tokens/typography";
5
+
6
+ $connector_width: 2px;
7
+ $icon_margin: $space_xs/2;
8
+ $icon_height: 28px;
9
+ $height_from_top: $icon_height/2 - $connector_width/2;
10
+
11
+ @mixin pb_timeline_line_solid($width, $height, $margin) {
12
+ width: $width;
13
+ height: $height;
14
+ background-color: $border_light;
15
+ margin: $margin;
16
+ flex-grow: 1;
17
+ }
18
+
19
+ @mixin pb_timeline_line_dotted_horizontal($width, $height, $margin) {
20
+ width: $width;
21
+ height: $height;
22
+ background: repeating-linear-gradient(to right, $border_light 0px ,$border_light 2px, transparent 3px, transparent 10px);
23
+ margin: $margin;
24
+ flex-grow: 1;
25
+ }
26
+
27
+ @mixin pb_timeline_line_dotted_vertical($width, $height, $margin) {
28
+ width: $width;
29
+ height: $height;
30
+ background: repeating-linear-gradient(0deg, $border_light 0px ,$border_light 2px, transparent 3px, transparent 10px);
31
+ margin: $margin;
32
+ flex-grow: 1;
33
+ }
34
+
35
+ @mixin flex_wrapper($flex_direction) {
36
+ display: flex;
37
+ flex-direction: $flex_direction;
38
+ }
39
+
40
+ [class^=pb_timeline_kit] {
41
+ &[class*=_horizontal] {
42
+ @include flex_wrapper(row);
43
+ width: 100%;
44
+ >div {
45
+ &:last-child {
46
+ flex-basis: auto !important;
47
+ [class=pb_timeline_item_step] {
48
+ [class=pb_timeline_item_connector] {
49
+ opacity: 0;
50
+ }
51
+ }
52
+ [class=pb_timeline_item_right_block] {
53
+ display: block;
54
+ width: 100%;
55
+ overflow: hidden;
56
+ white-space: nowrap;
57
+ }
58
+ }
59
+ }
60
+ [class*=pb_timeline_item_kit] {
61
+ &[class*=_solid] {
62
+ flex-basis: 100%;
63
+ [class=pb_timeline_item_left_block] {
64
+ height: 0px;
65
+ }
66
+ [class=pb_timeline_item_step] {
67
+ @include flex_wrapper(row);
68
+ margin-top: $space_xs;
69
+ margin-bottom: $space_xs;
70
+ [class=pb_timeline_item_connector] {
71
+ @include pb_timeline_line_solid($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
72
+ }
73
+ }
74
+ }
75
+ &[class*=_dotted] {
76
+ flex-basis: 100%;
77
+ [class=pb_timeline_item_left_block] {
78
+ height: 0;
79
+ }
80
+ [class=pb_timeline_item_step] {
81
+ @include flex_wrapper(row);
82
+ margin-top: $space_xs;
83
+ margin-bottom: $space_xs;
84
+ [class=pb_timeline_item_connector] {
85
+ @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
86
+ }
87
+ }
88
+ }
89
+ }
90
+ &[class*=_with_date] {
91
+ @include flex_wrapper(row);
92
+ width: 100%;
93
+ >div {
94
+ &:last-child {
95
+ flex-basis: auto !important;
96
+ [class=pb_timeline_item_step] {
97
+ [class=pb_timeline_item_connector] {
98
+ opacity: 0;
99
+ }
100
+ }
101
+ [class=pb_timeline_item_right_block] {
102
+ display: block;
103
+ width: 100%;
104
+ overflow: hidden;
105
+ white-space: nowrap;
106
+ }
107
+ }
108
+ }
109
+ [class*=pb_timeline_item_kit] {
110
+ &[class*=_solid] {
111
+ flex-basis: 100%;
112
+ [class=pb_timeline_item_left_block] {
113
+ @include flex_wrapper(column);
114
+ height: 55px;
115
+ justify-content: flex-end;
116
+ [class=pb_date_stacked_kit_center_sm] {
117
+ [class=pb_date_stacked_day_month] {
118
+ [class=pb_caption_kit_md] {
119
+ text-align: left;
120
+ }
121
+ [class=pb_title_kit_4] {
122
+ text-align: left;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ [class=pb_timeline_item_step] {
128
+ @include flex_wrapper(row);
129
+ margin-top: $space_xs;
130
+ margin-bottom: $space_xs;
131
+ [class=pb_timeline_item_connector] {
132
+ @include pb_timeline_line_solid($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
133
+ }
134
+ }
135
+ }
136
+ &[class*=_dotted] {
137
+ flex-basis: 100%;
138
+ [class=pb_timeline_item_left_block] {
139
+ height: 55px;
140
+ [class=pb_date_stacked_kit_center_sm] {
141
+ [class=pb_date_stacked_day_month] {
142
+ [class=pb_caption_kit_md] {
143
+ text-align: left;
144
+ }
145
+ [class=pb_title_kit_4] {
146
+ text-align: left;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ [class=pb_timeline_item_step] {
152
+ @include flex_wrapper(row);
153
+ margin-top: $space_xs;
154
+ margin-bottom: $space_xs;
155
+ [class=pb_timeline_item_connector] {
156
+ @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ &[class*=_vertical] {
164
+ @include flex_wrapper(column);
165
+ align-items: flex-start;
166
+ align-self: auto;
167
+ >div:last-child {
168
+ [class=pb_timeline_item_step] {
169
+ [class=pb_timeline_item_connector] {
170
+ opacity: 0;
171
+ }
172
+ }
173
+ }
174
+ [class*=pb_timeline_item_kit] {
175
+ @include flex_wrapper(row);
176
+ &[class*=_solid] {
177
+ flex-basis: 100%;
178
+ [class=pb_timeline_item_step] {
179
+ @include flex_wrapper(column);
180
+ align-content: flex-start;
181
+ margin-right: $space_sm;
182
+ margin-left: $space_sm;
183
+ [class=pb_timeline_item_connector] {
184
+ @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
185
+ }
186
+ }
187
+ [class=pb_timeline_item_left_block] {
188
+ margin-bottom: $space_lg;
189
+ width: 0px;
190
+ }
191
+ [class=pb_timeline_item_right_block] {
192
+ @include flex_wrapper(column);
193
+ margin-bottom: $space_lg;
194
+ }
195
+ }
196
+ &[class*=_dotted] {
197
+ flex-basis: 100%;
198
+ [class=pb_timeline_item_step] {
199
+ @include flex_wrapper(column);
200
+ margin-right: $space_sm;
201
+ margin-left: $space_sm;
202
+ [class=pb_timeline_item_connector] {
203
+ @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
204
+ }
205
+ }
206
+ [class=pb_timeline_item_left_block] {
207
+ margin-bottom: $space_lg;
208
+ width: 0px;
209
+ }
210
+ [class=pb_timeline_item_right_block] {
211
+ @include flex_wrapper(column);
212
+ margin-bottom: $space_lg;
213
+ }
214
+ }
215
+ }
216
+ &[class*=_with_date] {
217
+ @include flex_wrapper(column);
218
+ align-items: flex-start;
219
+ align-self: auto;
220
+ >div:last-child {
221
+ [class=pb_timeline_item_step] {
222
+ [class=pb_timeline_item_connector] {
223
+ opacity: 0;
224
+ }
225
+ }
226
+ }
227
+ [class*=pb_timeline_item_kit] {
228
+ @include flex_wrapper(row);
229
+ &[class*=_solid] {
230
+ flex-basis: 100%;
231
+ [class=pb_timeline_item_step] {
232
+ @include flex_wrapper(column);
233
+ align-content: flex-start;
234
+ margin-right: $space_sm;
235
+ margin-left: $space_sm;
236
+ [class=pb_timeline_item_connector] {
237
+ @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
238
+ }
239
+ }
240
+ [class=pb_timeline_item_left_block] {
241
+ margin-bottom: $space_lg;
242
+ width: $space_lg;
243
+ }
244
+ [class=pb_timeline_item_right_block] {
245
+ @include flex_wrapper(column);
246
+ margin-bottom: $space_lg;
247
+ }
248
+ }
249
+ &[class*=_dotted] {
250
+ flex-basis: 100%;
251
+ [class=pb_timeline_item_step] {
252
+ @include flex_wrapper(column);
253
+ margin-right: $space_sm;
254
+ margin-left: $space_sm;
255
+ [class=pb_timeline_item_connector] {
256
+ @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
257
+ }
258
+ }
259
+ [class=pb_timeline_item_left_block] {
260
+ margin-bottom: $space_lg;
261
+ width: $space_lg;
262
+ }
263
+ [class=pb_timeline_item_right_block] {
264
+ @include flex_wrapper(column);
265
+ margin-bottom: $space_lg;
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }