playbook_ui 4.17.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/helpers/playbook/pb_sample_helper.rb +1 -1
- data/app/pb_kits/playbook/_playbook.scss +2 -1
- data/app/pb_kits/playbook/data/menu.yml +5 -2
- data/app/pb_kits/playbook/index.js +1 -0
- data/app/pb_kits/playbook/packs/examples.js +4 -0
- data/app/pb_kits/playbook/packs/samples.js +4 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +1 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.html.erb +15 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +24 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +6 -4
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +21 -4
- data/app/pb_kits/playbook/pb_card/_card.scss +1 -72
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +72 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx +0 -1
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.jsx +1 -1
- data/app/pb_kits/playbook/pb_filter/templates/_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_installer/_installer.html.erb +16 -0
- data/app/pb_kits/playbook/pb_installer/_installer.jsx +54 -0
- data/app/pb_kits/playbook/pb_installer/_installer.scss +7 -0
- data/app/pb_kits/playbook/pb_installer/docs/_installer_default.html.erb +8 -0
- data/app/pb_kits/playbook/pb_installer/docs/_installer_default.jsx +16 -0
- data/app/pb_kits/playbook/pb_installer/docs/example.yml +9 -0
- data/app/pb_kits/playbook/pb_installer/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_installer/installer.rb +18 -0
- data/app/pb_kits/playbook/pb_label_value/_label_value.html.erb +1 -0
- data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +22 -3
- data/app/pb_kits/playbook/pb_layout/_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_layout/_column.html.erb +7 -0
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +35 -15
- data/app/pb_kits/playbook/pb_layout/_layout.scss +54 -0
- data/app/pb_kits/playbook/pb_layout/body.rb +4 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban.html.erb +140 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban.jsx +1234 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban_responsive.html.erb +57 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_kanban_responsive.jsx +46 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_layout/layout.rb +12 -4
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.html.erb +16 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +23 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +3 -0
- data/app/pb_kits/playbook/pb_list/_item.html.erb +3 -2
- data/app/pb_kits/playbook/pb_list/_list.html.erb +3 -3
- data/app/pb_kits/playbook/pb_list/_list.jsx +55 -10
- data/app/pb_kits/playbook/pb_list/_list_item.jsx +41 -18
- data/app/pb_kits/playbook/pb_list/docs/_list_borderless.jsx +21 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_dark.jsx +0 -5
- data/app/pb_kits/playbook/pb_list/docs/_list_dark_borderless.jsx +22 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_dark_lg.jsx +22 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_dark_ordered.jsx +22 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_dark_xpadding.jsx +22 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_layout_left.jsx +75 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_layout_right.jsx +75 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_lg.jsx +21 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_ordered.jsx +21 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_xpadding.jsx +21 -0
- data/app/pb_kits/playbook/pb_list/docs/example.yml +12 -1
- data/app/pb_kits/playbook/pb_list/docs/index.js +11 -0
- data/app/pb_kits/playbook/pb_logistic/_logistic.html.erb +1 -0
- data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +26 -4
- data/app/pb_kits/playbook/pb_message/_message.html.erb +1 -0
- data/app/pb_kits/playbook/pb_message/_message.jsx +25 -7
- data/app/pb_kits/playbook/pb_message/docs/_message_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_message/message.rb +1 -1
- data/app/pb_kits/playbook/pb_person/_person.html.erb +9 -2
- data/app/pb_kits/playbook/pb_person/_person.jsx +34 -10
- data/app/pb_kits/playbook/pb_person/docs/_person_default.html.erb +5 -1
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +1 -0
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +57 -5
- data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_with_wrong_numbers.jsx +32 -0
- data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_person_contact/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_popover/_popover.html.erb +4 -4
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +41 -8
- data/app/pb_kits/playbook/pb_popover/_popover.scss +41 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +42 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +99 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +19 -7
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.jsx +22 -6
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +11 -10
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +22 -18
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.md +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.html.erb +24 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_scroll_height.jsx +56 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.html.erb +14 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx +50 -0
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +12 -8
- data/app/pb_kits/playbook/pb_popover/docs/index.js +3 -3
- data/app/pb_kits/playbook/pb_popover/index.js +13 -9
- data/app/pb_kits/playbook/pb_popover/popover.rb +26 -2
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.html.erb +1 -0
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +29 -5
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb +1 -0
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +22 -13
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text.jsx +3 -1
- data/app/pb_kits/playbook/pb_timeline/_item.html.erb +28 -0
- data/app/pb_kits/playbook/pb_timeline/_item.jsx +54 -0
- data/app/pb_kits/playbook/pb_timeline/_timeline.html.erb +6 -0
- data/app/pb_kits/playbook/pb_timeline/_timeline.jsx +43 -0
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +271 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.html.erb +43 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_default.jsx +73 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.html.erb +43 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.jsx +73 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb +44 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx +85 -0
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +13 -0
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +3 -0
- data/app/pb_kits/playbook/pb_timeline/item.rb +25 -0
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +27 -0
- data/app/pb_kits/playbook/pb_title/_title.html.erb +1 -0
- data/app/pb_kits/playbook/pb_title/_title.jsx +24 -17
- data/app/pb_kits/playbook/plugins/pb_chart.js +8 -2
- data/app/pb_kits/playbook/props.rb +7 -0
- data/app/views/layouts/playbook/application.html.slim +2 -3
- data/app/views/layouts/playbook/fullscreen.html.slim +2 -2
- data/app/views/layouts/playbook/grid.html.slim +2 -2
- data/app/views/layouts/playbook/samples.html.erb +2 -4
- data/app/views/playbook/samples/filter_table/index.html.erb +348 -0
- data/app/views/playbook/samples/filter_table/index.jsx +433 -0
- data/app/views/playbook/samples/registration/index.html.erb +316 -0
- data/app/views/playbook/samples/registration/index.jsx +476 -0
- data/lib/playbook/version.rb +1 -1
- metadata +60 -77
- data/app/pb_kits/playbook/packs/kits/pb_avatar.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_badge.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_bar_graph.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_body.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_button.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_caption.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_card.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_checkbox.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_circle_icon_button.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_contact.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_currency.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_dashboard_value.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_date.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_date_range_inline.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_date_range_stacked.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_date_stacked.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_date_year_stacked.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_distribution_bar.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_fixed_confirmation_toast.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_flex.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_form_pill.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_hashtag.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_highlight.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_home_address_street.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_icon.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_icon_circle.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_icon_value.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_image.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_label_pill.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_label_value.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_layout.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_legend.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_line_graph.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_list.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_loading_inline.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_message.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_multiple_users.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_multiple_users_stacked.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_nav.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_online_status.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_person.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_person_contact.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_pill.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_popover.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_progress_pills.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_progress_simple.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_progress_step.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_radio.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_section_separator.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_select.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_selectable_card.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_source.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_star_rating.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_stat_change.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_stat_value.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_table.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_text_input.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_textarea.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_time.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_timestamp.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_title.js +0 -1
- data/app/pb_kits/playbook/packs/kits/pb_title_count.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_title_detail.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_toggle.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_user.js +0 -2
- data/app/pb_kits/playbook/packs/kits/pb_user_badge.js +0 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_any.html.erb +0 -19
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_any.jsx +0 -40
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_inside.html.erb +0 -14
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_inside.jsx +0 -40
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.html.erb +0 -14
- data/app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.jsx +0 -40
- data/app/pb_kits/playbook/pb_popover/docs/_popover_with_button.jsx +0 -34
- data/app/pb_kits/playbook/pb_popover/docs/_popover_with_circle.html.erb +0 -5
@@ -3,12 +3,17 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import { Avatar, Body, Caption } from '../'
|
5
5
|
import classnames from 'classnames'
|
6
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
7
|
import { spacing } from '../utilities/spacing.js'
|
7
8
|
|
8
9
|
type MessageProps = {
|
10
|
+
aria: object,
|
9
11
|
avatarName?: String,
|
10
12
|
avatarStatus?: String,
|
11
13
|
avatarUrl?: String,
|
14
|
+
className?: String,
|
15
|
+
data?: object,
|
16
|
+
id?: String,
|
12
17
|
label?: String,
|
13
18
|
message: String,
|
14
19
|
timestamp?: String,
|
@@ -16,20 +21,33 @@ type MessageProps = {
|
|
16
21
|
|
17
22
|
const Message = (props: MessageProps) => {
|
18
23
|
const {
|
19
|
-
|
20
|
-
|
21
|
-
label = '',
|
22
|
-
message = '',
|
23
|
-
timestamp = '',
|
24
|
+
aria = {},
|
25
|
+
avatarName,
|
24
26
|
avatarStatus = null,
|
27
|
+
avatarUrl,
|
28
|
+
className,
|
29
|
+
data = {},
|
30
|
+
id,
|
31
|
+
label,
|
32
|
+
message,
|
33
|
+
timestamp,
|
25
34
|
} = props
|
35
|
+
const ariaProps = buildAriaProps(aria)
|
36
|
+
const dataProps = buildDataProps(data)
|
26
37
|
const shouldDisplayAvatar = avatarUrl || avatarName
|
27
|
-
const
|
38
|
+
const baseClassName = shouldDisplayAvatar
|
28
39
|
? 'pb_message_kit_avatar'
|
29
40
|
: 'pb_message_kit'
|
30
41
|
|
42
|
+
const classes = classnames(buildCss(baseClassName), className, spacing(props))
|
43
|
+
|
31
44
|
return (
|
32
|
-
<div
|
45
|
+
<div
|
46
|
+
{...ariaProps}
|
47
|
+
{...dataProps}
|
48
|
+
className={classes}
|
49
|
+
id={id}
|
50
|
+
>
|
33
51
|
<If condition={shouldDisplayAvatar}>
|
34
52
|
<Avatar
|
35
53
|
imageUrl={avatarUrl}
|
@@ -4,7 +4,6 @@ import { Message } from '../../'
|
|
4
4
|
const MessageDefault = () => {
|
5
5
|
return (
|
6
6
|
<div>
|
7
|
-
|
8
7
|
<Message
|
9
8
|
avatarName="Mike Bishop"
|
10
9
|
avatarStatus="online"
|
@@ -31,7 +30,7 @@ const MessageDefault = () => {
|
|
31
30
|
<Message
|
32
31
|
avatarName="Lisa Thompson"
|
33
32
|
avatarUrl="https://randomuser.me/api/portraits/women/39.jpg"
|
34
|
-
message="To
|
33
|
+
message="To process your order, I will need your full name."
|
35
34
|
timestamp="4 hours ago"
|
36
35
|
/>
|
37
36
|
|
@@ -1,7 +1,14 @@
|
|
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: {
|
6
|
-
|
6
|
+
<%= pb_rails("body", props: {
|
7
|
+
tag: "span",
|
8
|
+
classname: "pb_person_first",
|
9
|
+
children: -> { object.first_name
|
10
|
+
} }) %>
|
11
|
+
<%= pb_rails("title", props: {
|
12
|
+
text: object.last_name,
|
13
|
+
size: 4 }) if object.last_name %>
|
7
14
|
<% end %>
|
@@ -4,32 +4,56 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { spacing } from '../utilities/spacing.js'
|
6
6
|
|
7
|
+
import {
|
8
|
+
buildAriaProps,
|
9
|
+
buildCss,
|
10
|
+
buildDataProps,
|
11
|
+
} from '../utilities/props'
|
12
|
+
|
7
13
|
import { Body, Title } from '../'
|
8
14
|
|
9
15
|
type PersonProps = {
|
16
|
+
aria?: object,
|
10
17
|
className?: String | Array<String>,
|
11
|
-
|
18
|
+
data?: object,
|
12
19
|
firstName: String,
|
20
|
+
id?: String,
|
13
21
|
lastName: String,
|
14
22
|
}
|
15
23
|
|
16
24
|
const Person = (props: PersonProps) => {
|
17
|
-
const {
|
25
|
+
const {
|
26
|
+
aria = {},
|
27
|
+
className,
|
28
|
+
data = {},
|
29
|
+
firstName,
|
30
|
+
id,
|
31
|
+
lastName } = props
|
32
|
+
|
33
|
+
const ariaProps = buildAriaProps(aria)
|
34
|
+
const dataProps = buildDataProps(data)
|
35
|
+
const classes = classnames(buildCss('pb_person_kit'), className, spacing(props))
|
36
|
+
|
18
37
|
return (
|
19
|
-
<div
|
38
|
+
<div
|
39
|
+
{...ariaProps}
|
40
|
+
{...dataProps}
|
41
|
+
className={classes}
|
42
|
+
id={id}
|
43
|
+
>
|
20
44
|
<Body
|
21
45
|
className="pb_person_first"
|
22
|
-
dark={dark}
|
23
46
|
tag="span"
|
24
47
|
>
|
25
48
|
{firstName}
|
26
49
|
</Body>
|
27
|
-
<
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
50
|
+
<If condition={lastName}>
|
51
|
+
<Title
|
52
|
+
className="pb_person_first"
|
53
|
+
size={4}
|
54
|
+
text={` ${lastName}`}
|
55
|
+
/>
|
56
|
+
</If>
|
33
57
|
</div>
|
34
58
|
)
|
35
59
|
}
|
@@ -2,9 +2,16 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
+
|
6
|
+
import {
|
7
|
+
buildAriaProps,
|
8
|
+
buildCss,
|
9
|
+
buildDataProps,
|
10
|
+
} from '../utilities/props'
|
11
|
+
|
5
12
|
import { spacing } from '../utilities/spacing.js'
|
6
13
|
|
7
|
-
import { Contact, Person } from '../'
|
14
|
+
import { Caption, Contact, Person } from '../'
|
8
15
|
|
9
16
|
type ContactItem = {
|
10
17
|
contactType: String,
|
@@ -13,30 +20,75 @@ type ContactItem = {
|
|
13
20
|
}
|
14
21
|
|
15
22
|
type PersonContactProps = {
|
23
|
+
aria?: object,
|
16
24
|
className?: String | Array<String>,
|
17
25
|
dark?: Boolean,
|
26
|
+
data?: object,
|
18
27
|
firstName: String,
|
28
|
+
id?: String,
|
19
29
|
lastName: String,
|
20
30
|
contacts?: Array<ContactItem>,
|
21
31
|
}
|
22
32
|
|
23
33
|
const PersonContact = (props: PersonContactProps) => {
|
24
|
-
const {
|
34
|
+
const {
|
35
|
+
aria = {},
|
36
|
+
className,
|
37
|
+
contacts = [],
|
38
|
+
data = {},
|
39
|
+
firstName,
|
40
|
+
id,
|
41
|
+
lastName,
|
42
|
+
} = props
|
43
|
+
|
44
|
+
const ariaProps = buildAriaProps(aria)
|
45
|
+
const dataProps = buildDataProps(data)
|
46
|
+
const classes = classnames(buildCss('pb_person_contact_kit'), className, spacing(props))
|
47
|
+
|
48
|
+
const wrongContacts = () => (
|
49
|
+
contacts.filter((contactObject) => (
|
50
|
+
contactObject.contactType === 'wrong-phone'
|
51
|
+
))
|
52
|
+
)
|
53
|
+
|
54
|
+
const validContacts = () => (
|
55
|
+
contacts.filter((contactObject) => (
|
56
|
+
contactObject.contactType !== 'wrong-phone'
|
57
|
+
))
|
58
|
+
)
|
25
59
|
|
26
60
|
return (
|
27
|
-
<div
|
61
|
+
<div
|
62
|
+
{...ariaProps}
|
63
|
+
{...dataProps}
|
64
|
+
className={classes}
|
65
|
+
id={id}
|
66
|
+
>
|
28
67
|
<Person
|
29
68
|
firstName={firstName}
|
30
69
|
lastName={lastName}
|
31
70
|
/>
|
32
|
-
{
|
71
|
+
{validContacts().map((contactObject, index) => (
|
33
72
|
<Contact
|
34
73
|
contactDetail={contactObject.contactDetail}
|
35
74
|
contactType={contactObject.contactType}
|
36
75
|
contactValue={contactObject.contactValue}
|
37
76
|
key={index}
|
38
77
|
/>
|
39
|
-
|
78
|
+
))}
|
79
|
+
{wrongContacts().map((contactObject, index) => (
|
80
|
+
<>
|
81
|
+
<Caption
|
82
|
+
className="wrong_numbers"
|
83
|
+
text="wrong number"
|
84
|
+
/>
|
85
|
+
<Contact
|
86
|
+
contactType={contactObject.contactType}
|
87
|
+
contactValue={contactObject.contactValue}
|
88
|
+
key={index}
|
89
|
+
/>
|
90
|
+
</>
|
91
|
+
))}
|
40
92
|
</div>
|
41
93
|
)
|
42
94
|
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { PersonContact } from '../../'
|
3
|
+
|
4
|
+
const PersonContactWithWrongNumbers = () => {
|
5
|
+
return (
|
6
|
+
<>
|
7
|
+
<PersonContact
|
8
|
+
contacts={[
|
9
|
+
{
|
10
|
+
contactType: 'email',
|
11
|
+
contactValue: 'email@example.com',
|
12
|
+
},
|
13
|
+
{
|
14
|
+
contactValue: '5555555555',
|
15
|
+
},
|
16
|
+
{
|
17
|
+
contactType: 'wrong-phone',
|
18
|
+
contactValue: '3245627482',
|
19
|
+
},
|
20
|
+
{
|
21
|
+
contactType: 'phone',
|
22
|
+
contactValue: '3048615385',
|
23
|
+
},
|
24
|
+
]}
|
25
|
+
firstName="Pauline"
|
26
|
+
lastName="Smith"
|
27
|
+
/>
|
28
|
+
</>
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
export default PersonContactWithWrongNumbers
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export { default as PersonContactDefault } from './_person_contact_default.jsx'
|
2
2
|
export { default as PersonContactMultiple } from './_person_contact_multiple.jsx'
|
3
3
|
export { default as PersonContactWithDetail } from './_person_contact_with_detail.jsx'
|
4
|
+
export { default as PersonContactWithWrongNumbers } from './_person_contact_with_wrong_numbers.jsx'
|
@@ -2,9 +2,9 @@
|
|
2
2
|
id: object.id,
|
3
3
|
data: object.data,
|
4
4
|
class: object.classname) do %>
|
5
|
-
<div class="popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip">
|
6
|
-
|
5
|
+
<div class="popover_tooltip" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
6
|
+
<div class="popover_body <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
7
7
|
<%= capture(&object.children) %>
|
8
|
-
|
8
|
+
</div>
|
9
9
|
</div>
|
10
|
-
<% end %>
|
10
|
+
<% end %>
|
@@ -15,8 +15,6 @@ import { buildCss, noop } from '../utilities/props'
|
|
15
15
|
import classnames from 'classnames'
|
16
16
|
import { spacing } from '../utilities/spacing.js'
|
17
17
|
|
18
|
-
import { Card } from '../'
|
19
|
-
|
20
18
|
type PbPopoverProps = {
|
21
19
|
className?: String,
|
22
20
|
closeOnClick?: "outside" | "inside",
|
@@ -35,7 +33,7 @@ const POPOVER_MODIFIERS = {
|
|
35
33
|
enabled: true,
|
36
34
|
name: 'offset',
|
37
35
|
options: {
|
38
|
-
offset: [0,
|
36
|
+
offset: [0, 20],
|
39
37
|
},
|
40
38
|
phase: 'main',
|
41
39
|
},
|
@@ -53,7 +51,25 @@ const Popover = (props: PbPopoverProps) => {
|
|
53
51
|
offset,
|
54
52
|
placement,
|
55
53
|
referenceElement,
|
54
|
+
zIndex,
|
55
|
+
maxHeight,
|
56
|
+
maxWidth,
|
57
|
+
minHeight,
|
58
|
+
minWidth,
|
56
59
|
} = props
|
60
|
+
|
61
|
+
const popoverSpacing = spacing(props) ? spacing(props) : 'p_sm'
|
62
|
+
const zIndexStyle = zIndex ? { zIndex: zIndex } : {}
|
63
|
+
const widthHeightStyles = () => {
|
64
|
+
return Object.assign(
|
65
|
+
{},
|
66
|
+
maxHeight ? { maxHeight: maxHeight } : {},
|
67
|
+
maxWidth ? { maxWidth: maxWidth } : {},
|
68
|
+
minHeight ? { minHeight: minHeight } : {},
|
69
|
+
minWidth ? { minWidth: minWidth } : {}
|
70
|
+
)
|
71
|
+
}
|
72
|
+
|
57
73
|
return (
|
58
74
|
<Popper
|
59
75
|
modifiers={popoverModifiers({ modifiers, offset })}
|
@@ -66,19 +82,26 @@ const Popover = (props: PbPopoverProps) => {
|
|
66
82
|
className={`${buildCss('pb_popover_kit')} ${className}`}
|
67
83
|
data-placement={placement}
|
68
84
|
ref={ref}
|
69
|
-
style={
|
85
|
+
style={Object.assign(
|
86
|
+
{},
|
87
|
+
style,
|
88
|
+
zIndexStyle
|
89
|
+
)}
|
70
90
|
>
|
71
91
|
<div
|
72
92
|
className={classnames(
|
73
93
|
`${buildCss('popover_tooltip')} show`
|
74
94
|
)}
|
75
95
|
>
|
76
|
-
<
|
77
|
-
className={
|
78
|
-
|
96
|
+
<div
|
97
|
+
className={classnames(
|
98
|
+
'popover_body',
|
99
|
+
popoverSpacing
|
100
|
+
)}
|
101
|
+
style={widthHeightStyles()}
|
79
102
|
>
|
80
103
|
{children}
|
81
|
-
</
|
104
|
+
</div>
|
82
105
|
</div>
|
83
106
|
</div>
|
84
107
|
)
|
@@ -143,16 +166,26 @@ export default class PbReactPopover extends React.Component
|
|
143
166
|
referenceElement,
|
144
167
|
show,
|
145
168
|
usePortal,
|
169
|
+
zIndex,
|
170
|
+
maxHeight,
|
171
|
+
maxWidth,
|
172
|
+
minHeight,
|
173
|
+
minWidth,
|
146
174
|
} = this.props
|
147
175
|
|
148
176
|
const popoverComponent = (
|
149
177
|
<Popover
|
150
178
|
{...this.props}
|
151
179
|
className={className}
|
180
|
+
maxHeight={maxHeight}
|
181
|
+
maxWidth={maxWidth}
|
182
|
+
minHeight={minHeight}
|
183
|
+
minWidth={minWidth}
|
152
184
|
modifiers={modifiers}
|
153
185
|
offset={offset}
|
154
186
|
placement={placement}
|
155
187
|
referenceElement={referenceElement}
|
188
|
+
zIndex={zIndex}
|
156
189
|
>
|
157
190
|
{children}
|
158
191
|
</Popover>
|
@@ -1,15 +1,54 @@
|
|
1
1
|
@import "../tokens/positioning";
|
2
|
+
@import "../pb_card/card_mixin";
|
3
|
+
@import "../tokens/shadows";
|
4
|
+
|
5
|
+
@keyframes fadeIn {
|
6
|
+
from {
|
7
|
+
opacity: 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
to {
|
11
|
+
opacity: 1;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
@keyframes fadeOut {
|
15
|
+
from {
|
16
|
+
opacity: 1;
|
17
|
+
}
|
18
|
+
|
19
|
+
to {
|
20
|
+
opacity: 0;
|
21
|
+
}
|
22
|
+
}
|
2
23
|
|
3
24
|
[class^="pb_popover_kit"] {
|
4
25
|
.popover_tooltip {
|
5
|
-
|
26
|
+
opacity: 0;
|
27
|
+
animation-name: fadeOut;
|
28
|
+
animation-duration: 150ms;
|
29
|
+
animation-timing-function: linear;
|
30
|
+
animation-fill-mode: forwards;
|
31
|
+
visibility: hidden;
|
32
|
+
pointer-events: none;
|
6
33
|
&.show {
|
7
|
-
|
34
|
+
animation-name: fadeIn;
|
35
|
+
animation-duration: 150ms;
|
36
|
+
animation-timing-function: linear;
|
37
|
+
animation-fill-mode: forwards;
|
38
|
+
visibility: visible;
|
39
|
+
pointer-events: initial;
|
8
40
|
z-index: $z_9;
|
9
41
|
}
|
10
42
|
}
|
43
|
+
.popover_body {
|
44
|
+
@include pb_card;
|
45
|
+
border: 0;
|
46
|
+
box-shadow: $shadow_deeper;
|
47
|
+
overflow: auto;
|
48
|
+
}
|
11
49
|
}
|
12
50
|
|
51
|
+
|
13
52
|
.pb_popover_reference_wrapper {
|
14
53
|
display: inline-block;
|
15
54
|
}
|