playbook_ui 14.3.2 → 14.4.0.pre.alpha.PLAY1529removefaeasy3876
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +23 -4
- data/app/pb_kits/playbook/pb_button/_button.tsx +6 -2
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +17 -5
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +14 -6
- data/app/pb_kits/playbook/pb_contact/contact.rb +4 -0
- data/app/pb_kits/playbook/pb_contact/contact.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +6 -3
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +2 -3
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +6 -2
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +2 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +10 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_height.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_max_width.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_sort.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_only.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.html.erb +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_single.html.erb +5 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +245 -23
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +117 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +227 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_map/_map_controls.tsx +7 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +20 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +4 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +97 -21
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +166 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +45 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.html.erb +73 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.jsx +86 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +21 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +12 -1
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +3 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +10 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.html.erb +14 -13
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +4 -4
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +92 -33
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.html.erb +48 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +59 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.md +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_radio/index.js +17 -0
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +35 -13
- data/app/pb_kits/playbook/pb_radio/radio.rb +3 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +12 -5
- data/app/pb_kits/playbook/pb_select/_select.tsx +5 -2
- data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
- data/app/pb_kits/playbook/pb_select/select.rb +4 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +17 -13
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +7 -0
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +6 -5
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -18
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.html.erb +88 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_margin_bottom.jsx +60 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +31 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +26 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +10 -1
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -0
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +136 -13
- data/app/pb_kits/playbook/utilities/icons/angle-down.svg +3 -0
- data/app/pb_kits/playbook/utilities/icons/envelope.svg +3 -0
- data/dist/chunks/_typeahead-DnWoIeq6.js +22 -0
- data/dist/chunks/_weekday_stacked-C5Ls9JLc.js +45 -0
- data/dist/chunks/lib-CEpcaI8y.js +29 -0
- data/dist/chunks/{pb_form_validation-u2wnZ3oe.js → pb_form_validation-D9zkwt2b.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/pagination_renderer.rb +10 -2
- data/lib/playbook/version.rb +2 -2
- metadata +30 -9
- data/dist/chunks/_typeahead-DbAz2Okr.js +0 -22
- data/dist/chunks/_weekday_stacked-CZ5S17_d.js +0 -45
- data/dist/chunks/lib-D9uVVKnh.js +0 -16
@@ -15,6 +15,7 @@ type MultipleUsersStackedProps = {
|
|
15
15
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
16
16
|
id?: string,
|
17
17
|
users: Array<{ [key: string]: string }>,
|
18
|
+
variant: "default" | "bubble",
|
18
19
|
}
|
19
20
|
|
20
21
|
const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
|
@@ -26,10 +27,14 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
|
|
26
27
|
htmlOptions = {},
|
27
28
|
id,
|
28
29
|
users,
|
30
|
+
variant = "default",
|
29
31
|
} = props
|
30
32
|
|
31
33
|
const moreThanTwo = users.length > 2
|
32
34
|
const onlyOne = users.length == 1
|
35
|
+
const isBubble = variant === "bubble"
|
36
|
+
const tripleBubble = isBubble && users.length === 3
|
37
|
+
const quadrupleBubble = isBubble && users.length > 3
|
33
38
|
const displayCount = () => {
|
34
39
|
return moreThanTwo ? 1 : users.length
|
35
40
|
}
|
@@ -38,29 +43,61 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
|
|
38
43
|
const htmlProps = buildHtmlProps(htmlOptions)
|
39
44
|
const classes = classnames(buildCss(
|
40
45
|
'pb_multiple_users_stacked_kit',
|
41
|
-
{ single: onlyOne }), globalProps(props), className)
|
46
|
+
{ single: onlyOne, bubble: isBubble }), globalProps(props), className)
|
42
47
|
|
43
48
|
const firstUser = () => {
|
44
49
|
return users.slice(0, 1).map((userObject, index) => {
|
45
50
|
return (
|
46
51
|
<Avatar
|
47
52
|
{...userObject}
|
48
|
-
className=
|
53
|
+
className={`pb_multiple_users_stacked_item first_item${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
|
49
54
|
dark={dark}
|
50
55
|
key={index}
|
51
|
-
size="xs"
|
56
|
+
size={isBubble ? "sm" : "xs"}
|
52
57
|
/>
|
53
58
|
)
|
54
59
|
})
|
55
60
|
}
|
56
61
|
|
57
62
|
const secondUser = () => {
|
58
|
-
if (moreThanTwo
|
63
|
+
if (!moreThanTwo || (isBubble && users.length > 1)) {
|
59
64
|
return users.slice(1, 2).map((userObject, index) => {
|
60
65
|
return (
|
61
66
|
<Avatar
|
62
67
|
{...userObject}
|
63
|
-
className=
|
68
|
+
className={`pb_multiple_users_stacked_item second_item${tripleBubble ? " triple_bubble" : ""}${quadrupleBubble ? " quadruple_bubble" : ""}`}
|
69
|
+
dark={dark}
|
70
|
+
key={index}
|
71
|
+
size="xs"
|
72
|
+
/>
|
73
|
+
)
|
74
|
+
})
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
const thirdUser = () => {
|
79
|
+
if (isBubble && users.length > 2) {
|
80
|
+
return users.slice(2, 3).map((userObject, index) => {
|
81
|
+
return (
|
82
|
+
<Avatar
|
83
|
+
{...userObject}
|
84
|
+
className={`pb_multiple_users_stacked_item third_item${quadrupleBubble ? " quadruple_bubble" : ""}`}
|
85
|
+
dark={dark}
|
86
|
+
key={index}
|
87
|
+
size="xs"
|
88
|
+
/>
|
89
|
+
)
|
90
|
+
})
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
const fourthUser = () => {
|
95
|
+
if (isBubble && users.length > 3) {
|
96
|
+
return users.slice(3, 4).map((userObject, index) => {
|
97
|
+
return (
|
98
|
+
<Avatar
|
99
|
+
{...userObject}
|
100
|
+
className="pb_multiple_users_stacked_item fourth_item"
|
64
101
|
dark={dark}
|
65
102
|
key={index}
|
66
103
|
size="xs"
|
@@ -71,7 +108,7 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
|
|
71
108
|
}
|
72
109
|
|
73
110
|
const plusUsers = () => {
|
74
|
-
if (moreThanTwo
|
111
|
+
if (moreThanTwo && !isBubble) {
|
75
112
|
return (
|
76
113
|
<Badge
|
77
114
|
className="pb_multiple_users_stacked_item second_item"
|
@@ -94,6 +131,8 @@ const MultipleUsersStacked = (props: MultipleUsersStackedProps) => {
|
|
94
131
|
>
|
95
132
|
{firstUser()}
|
96
133
|
{secondUser()}
|
134
|
+
{thirdUser()}
|
135
|
+
{fourthUser()}
|
97
136
|
{plusUsers()}
|
98
137
|
</div>
|
99
138
|
)
|
data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_bubble.html.erb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
<%= pb_rails("multiple_users_stacked", props: {
|
2
|
+
variant: "bubble",
|
3
|
+
users: [
|
4
|
+
{
|
5
|
+
name: "Patrick Welch",
|
6
|
+
image_url: "https://randomuser.me/api/portraits/men/9.jpg",
|
7
|
+
}
|
8
|
+
]
|
9
|
+
}) %>
|
10
|
+
|
11
|
+
<br/><br/>
|
12
|
+
|
13
|
+
<%= pb_rails("multiple_users_stacked", props: {
|
14
|
+
variant: "bubble",
|
15
|
+
users: [
|
16
|
+
{
|
17
|
+
name: "Patrick Welch",
|
18
|
+
image_url: "https://randomuser.me/api/portraits/men/9.jpg",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
name: "Lucille Sanchez",
|
22
|
+
image_url: "https://randomuser.me/api/portraits/women/6.jpg",
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}) %>
|
26
|
+
|
27
|
+
<br/><br/>
|
28
|
+
|
29
|
+
<%= pb_rails("multiple_users_stacked", props: {
|
30
|
+
variant: "bubble",
|
31
|
+
users: [
|
32
|
+
{
|
33
|
+
name: "Patrick Welch",
|
34
|
+
image_url: "https://randomuser.me/api/portraits/men/9.jpg",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: "Lucille Sanchez",
|
38
|
+
image_url: "https://randomuser.me/api/portraits/women/6.jpg",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: "Beverly Reyes",
|
42
|
+
image_url: "https://randomuser.me/api/portraits/women/74.jpg",
|
43
|
+
},
|
44
|
+
]
|
45
|
+
}) %>
|
46
|
+
|
47
|
+
<br/><br/>
|
48
|
+
|
49
|
+
<%= pb_rails("multiple_users_stacked", props: {
|
50
|
+
variant: "bubble",
|
51
|
+
users: [
|
52
|
+
{
|
53
|
+
name: "Patrick Welch",
|
54
|
+
image_url: "https://randomuser.me/api/portraits/men/9.jpg",
|
55
|
+
},
|
56
|
+
{
|
57
|
+
name: "Lucille Sanchez",
|
58
|
+
image_url: "https://randomuser.me/api/portraits/women/6.jpg",
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: "Beverly Reyes",
|
62
|
+
image_url: "https://randomuser.me/api/portraits/women/74.jpg",
|
63
|
+
},
|
64
|
+
{
|
65
|
+
name: "Keith Craig",
|
66
|
+
image_url: "https://randomuser.me/api/portraits/men/40.jpg",
|
67
|
+
},
|
68
|
+
{
|
69
|
+
name: "Alicia Cooper",
|
70
|
+
image_url: "https://randomuser.me/api/portraits/women/46.jpg",
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}) %>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import MultipleUsersStacked from '../_multiple_users_stacked'
|
4
|
+
|
5
|
+
const MultipleUsersStackedBubble = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<MultipleUsersStacked
|
9
|
+
users={[
|
10
|
+
{
|
11
|
+
name: 'Patrick Welch',
|
12
|
+
imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
|
13
|
+
},
|
14
|
+
]}
|
15
|
+
variant="bubble"
|
16
|
+
{...props}
|
17
|
+
/>
|
18
|
+
<br />
|
19
|
+
<br />
|
20
|
+
<MultipleUsersStacked
|
21
|
+
users={[
|
22
|
+
{
|
23
|
+
name: 'Patrick Welch',
|
24
|
+
imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
|
25
|
+
},
|
26
|
+
{
|
27
|
+
name: 'Lucille Sanchez',
|
28
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
|
29
|
+
},
|
30
|
+
]}
|
31
|
+
variant="bubble"
|
32
|
+
{...props}
|
33
|
+
/>
|
34
|
+
<br />
|
35
|
+
<br />
|
36
|
+
<MultipleUsersStacked
|
37
|
+
users={[
|
38
|
+
{
|
39
|
+
name: 'Patrick Welch',
|
40
|
+
imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
|
41
|
+
},
|
42
|
+
{
|
43
|
+
name: 'Lucille Sanchez',
|
44
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
|
45
|
+
},
|
46
|
+
{
|
47
|
+
name: 'Beverly Reyes',
|
48
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
|
49
|
+
},
|
50
|
+
]}
|
51
|
+
variant="bubble"
|
52
|
+
{...props}
|
53
|
+
/>
|
54
|
+
<br />
|
55
|
+
<br />
|
56
|
+
<MultipleUsersStacked
|
57
|
+
users={[
|
58
|
+
{
|
59
|
+
name: 'Patrick Welch',
|
60
|
+
imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
|
61
|
+
},
|
62
|
+
{
|
63
|
+
name: 'Lucille Sanchez',
|
64
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
|
65
|
+
},
|
66
|
+
{
|
67
|
+
name: 'Beverly Reyes',
|
68
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
|
69
|
+
},
|
70
|
+
{
|
71
|
+
name: 'Keith Craig',
|
72
|
+
imageUrl: 'https://randomuser.me/api/portraits/men/40.jpg',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
name: 'Alicia Cooper',
|
76
|
+
imageUrl: 'https://randomuser.me/api/portraits/women/46.jpg',
|
77
|
+
},
|
78
|
+
]}
|
79
|
+
variant="bubble"
|
80
|
+
{...props}
|
81
|
+
/>
|
82
|
+
</div>
|
83
|
+
)
|
84
|
+
}
|
85
|
+
|
86
|
+
export default MultipleUsersStackedBubble
|
@@ -2,10 +2,12 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- multiple_users_stacked_default: Default
|
5
|
+
- multiple_users_stacked_bubble: Bubble
|
5
6
|
|
6
7
|
|
7
8
|
react:
|
8
9
|
- multiple_users_stacked_default: Default
|
10
|
+
- multiple_users_stacked_bubble: Bubble
|
9
11
|
|
10
12
|
swift:
|
11
13
|
- multiple_users_stacked_default_swift: Default
|
@@ -1,14 +1,18 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("avatar", props: object.users[0].merge({size: "xs", classname: "pb_multiple_users_stacked_item", dark: object.dark}) ) %>
|
2
|
+
<%= pb_rails("avatar", props: object.users[0].merge({size: object.bubble ? "sm" : "xs", classname: "pb_multiple_users_stacked_item first_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}", dark: object.dark}) ) %>
|
3
3
|
|
4
4
|
<% unless object.only_one %>
|
5
|
-
<% if object.more_than_two %>
|
5
|
+
<% if object.more_than_two && !object.bubble %>
|
6
6
|
<%= pb_rails("badge", props: {
|
7
7
|
dark: object.dark,
|
8
8
|
text: "+#{object.users.count - object.display_count}",
|
9
9
|
variant: "primary",
|
10
10
|
rounded: true,
|
11
11
|
classname: "pb_multiple_users_stacked_item second_item" }) %>
|
12
|
+
<% elsif object.bubble %>
|
13
|
+
<% object.users.slice(1,3).each_with_index do |item, idx| %>
|
14
|
+
<%= pb_rails("avatar", props: item.merge({size: "xs", classname: "pb_multiple_users_stacked_item #{idx == 0 ? "second_item#{object.triple_bubble ? " triple_bubble" : ""}#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : idx == 1 ? "third_item#{object.quadruple_bubble ? " quadruple_bubble" : ""}" : "fourth_item"}", dark: object.dark}) ) %>
|
15
|
+
<% end %>
|
12
16
|
<% else %>
|
13
17
|
<%= pb_rails("avatar", props: object.users[1].merge({size: "xs", classname: "pb_multiple_users_stacked_item second_item", dark: object.dark}) ) %>
|
14
18
|
<% end %>
|
@@ -5,6 +5,10 @@ module Playbook
|
|
5
5
|
class MultipleUsersStacked < Playbook::KitBase
|
6
6
|
prop :users, type: Playbook::Props::HashArray, required: true
|
7
7
|
|
8
|
+
prop :variant, type: Playbook::Props::Enum,
|
9
|
+
values: %w[default bubble],
|
10
|
+
default: "default"
|
11
|
+
|
8
12
|
def more_than_two
|
9
13
|
users.count > 2
|
10
14
|
end
|
@@ -17,8 +21,20 @@ module Playbook
|
|
17
21
|
more_than_two ? 1 : users.count
|
18
22
|
end
|
19
23
|
|
24
|
+
def bubble
|
25
|
+
variant == "bubble"
|
26
|
+
end
|
27
|
+
|
28
|
+
def triple_bubble
|
29
|
+
bubble && users.count === 3
|
30
|
+
end
|
31
|
+
|
32
|
+
def quadruple_bubble
|
33
|
+
bubble && users.count > 3
|
34
|
+
end
|
35
|
+
|
20
36
|
def classname
|
21
|
-
generate_classname("pb_multiple_users_stacked_kit", single_class)
|
37
|
+
generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class)
|
22
38
|
end
|
23
39
|
|
24
40
|
private
|
@@ -26,6 +42,10 @@ module Playbook
|
|
26
42
|
def single_class
|
27
43
|
only_one ? "single" : nil
|
28
44
|
end
|
45
|
+
|
46
|
+
def bubble_class
|
47
|
+
bubble ? "bubble" : nil
|
48
|
+
end
|
29
49
|
end
|
30
50
|
end
|
31
51
|
end
|
@@ -22,6 +22,16 @@ const PaginationPageChange = (props) => {
|
|
22
22
|
|
23
23
|
return (
|
24
24
|
<div className="App">
|
25
|
+
<Pagination
|
26
|
+
current={activePage}
|
27
|
+
key={`pagination-top-${activePage}`}
|
28
|
+
marginBottom="xs"
|
29
|
+
onChange={onPageChange}
|
30
|
+
range={5}
|
31
|
+
total={totalPages}
|
32
|
+
{...props}
|
33
|
+
/>
|
34
|
+
|
25
35
|
<Table
|
26
36
|
marginBottom="xs"
|
27
37
|
responsive="none"
|
@@ -49,7 +59,8 @@ const PaginationPageChange = (props) => {
|
|
49
59
|
</Table>
|
50
60
|
|
51
61
|
<Pagination
|
52
|
-
current={
|
62
|
+
current={activePage}
|
63
|
+
key={`pagination-bottom-${activePage}`}
|
53
64
|
onChange={onPageChange}
|
54
65
|
range={5}
|
55
66
|
total={totalPages}
|
@@ -1 +1,3 @@
|
|
1
|
-
You can use the `onChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
1
|
+
You can use the `onChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
2
|
+
|
3
|
+
To ensure synchronization between multiple pagination components on a single page, use unique, dynamic keys for each pagination instance. Each Pagination component should have its own dynamic key that reflects the current active page: this example uses `pagination-top-${activePage}` and `pagination-bottom-${activePage}`.
|
@@ -12,6 +12,7 @@ import Icon from '../pb_icon/_icon'
|
|
12
12
|
import PbReactPopover from '../pb_popover/_popover'
|
13
13
|
import TextInput from '../pb_text_input/_text_input'
|
14
14
|
import { GenericObject } from "../types"
|
15
|
+
import { getAllIcons } from "../utilities/icons/allicons"
|
15
16
|
|
16
17
|
type PassphraseProps = {
|
17
18
|
aria?: { [key: string]: string },
|
@@ -96,6 +97,9 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
96
97
|
/>
|
97
98
|
)
|
98
99
|
|
100
|
+
const shieldIcon = getAllIcons()["shieldCheck"]
|
101
|
+
const eyeIcon = getAllIcons()["eye"]
|
102
|
+
|
99
103
|
return (
|
100
104
|
<div
|
101
105
|
{...ariaProps}
|
@@ -135,7 +139,8 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
135
139
|
size="xs"
|
136
140
|
>
|
137
141
|
<Icon
|
138
|
-
|
142
|
+
className="svg-inline--fa"
|
143
|
+
customIcon={shieldIcon.icon as unknown as { [key: string]: SVGElement }}
|
139
144
|
marginRight="xs"
|
140
145
|
/>
|
141
146
|
{tip}
|
@@ -173,7 +178,10 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
|
|
173
178
|
color="light"
|
174
179
|
dark={dark}
|
175
180
|
>
|
176
|
-
|
181
|
+
<Icon
|
182
|
+
className="svg-inline--fa"
|
183
|
+
customIcon={eyeIcon.icon as unknown as { [key: string]: SVGElement }}
|
184
|
+
/>
|
177
185
|
</Body>
|
178
186
|
</span>
|
179
187
|
</div>
|
@@ -1,8 +1,10 @@
|
|
1
1
|
<%= pb_rails("button", props: { variant: "secondary", id: 'list' }) do %>
|
2
2
|
<%= pb_rails("flex", props: {align: "center"}) do %>
|
3
|
-
Filter By
|
3
|
+
Filter By
|
4
4
|
<%= pb_rails("flex/flex_item", props: {margin_left: "xxs"}) do %>
|
5
|
-
|
5
|
+
<div id="arrow-icon" style="display: flex">
|
6
|
+
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true }) %>
|
7
|
+
</div>
|
6
8
|
<% end %>
|
7
9
|
<% end %>
|
8
10
|
<% end %>
|
@@ -18,18 +20,17 @@
|
|
18
20
|
|
19
21
|
|
20
22
|
<script type="text/javascript">
|
21
|
-
const
|
22
|
-
let buttonClicked = false
|
23
|
+
const popoverButton = document.querySelector("#list")
|
24
|
+
let buttonClicked = false
|
23
25
|
|
24
|
-
const arrowDiv = document.querySelector("#arrow-icon")
|
25
|
-
arrowDiv.innerHTML = '<i class="far fa-angle-down"></i>'
|
26
|
+
const arrowDiv = document.querySelector("#arrow-icon")
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
popoverButton.onclick = () => {
|
29
|
+
buttonClicked = !buttonClicked
|
30
|
+
if (buttonClicked) {
|
31
|
+
arrowDiv.innerHTML = '<i class="far fa-angle-up"></i>'
|
32
|
+
} else {
|
33
|
+
arrowDiv.innerHTML = '<i class="far fa-angle-down"></i>'
|
34
|
+
}
|
33
35
|
}
|
34
|
-
}
|
35
36
|
</script>
|
@@ -26,10 +26,10 @@ const PopoverWithButton = (props) => {
|
|
26
26
|
className={showPopover ? "fa-flip-vertical" : ""}
|
27
27
|
display="inline_flex"
|
28
28
|
>
|
29
|
-
<Icon
|
30
|
-
fixedWidth
|
31
|
-
icon="angle-down"
|
32
|
-
margin-left="xxs"
|
29
|
+
<Icon
|
30
|
+
fixedWidth
|
31
|
+
icon="angle-down"
|
32
|
+
margin-left="xxs"
|
33
33
|
/>
|
34
34
|
</Flex>
|
35
35
|
</Flex>
|
@@ -1,28 +1,30 @@
|
|
1
|
-
/*eslint-disable react/no-multi-comp
|
1
|
+
/*eslint-disable react/no-multi-comp */
|
2
2
|
|
3
|
-
import React, { forwardRef } from 'react'
|
3
|
+
import React, { forwardRef, useRef } from 'react'
|
4
4
|
import Body from '../pb_body/_body'
|
5
|
+
import Flex from '../pb_flex/_flex'
|
5
6
|
import classnames from 'classnames'
|
6
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
7
8
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
8
9
|
|
9
10
|
type RadioProps = {
|
10
|
-
aria?: {[key: string]: string},
|
11
|
+
aria?: { [key: string]: string },
|
11
12
|
alignment?: string,
|
12
13
|
checked?: boolean,
|
13
14
|
children?: React.ReactChild[] | React.ReactChild,
|
15
|
+
customChildren?: boolean,
|
14
16
|
className?: string,
|
15
17
|
dark?: boolean,
|
16
|
-
data?: {[key: string]: string},
|
18
|
+
data?: { [key: string]: string },
|
17
19
|
disabled?: boolean,
|
18
20
|
error?: boolean,
|
19
|
-
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
21
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
20
22
|
id?: string,
|
21
23
|
label: string,
|
22
24
|
name?: string,
|
23
25
|
value?: string,
|
24
26
|
text?: string,
|
25
|
-
onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
|
27
|
+
onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
|
26
28
|
} & GlobalProps
|
27
29
|
|
28
30
|
const Radio = ({
|
@@ -30,10 +32,11 @@ const Radio = ({
|
|
30
32
|
alignment,
|
31
33
|
children,
|
32
34
|
className,
|
35
|
+
customChildren = false,
|
33
36
|
dark = false,
|
34
|
-
data = {},
|
35
37
|
disabled = false,
|
36
38
|
error = false,
|
39
|
+
data = {},
|
37
40
|
htmlOptions = {},
|
38
41
|
id,
|
39
42
|
label,
|
@@ -43,17 +46,28 @@ const Radio = ({
|
|
43
46
|
onChange = () => { void 0 },
|
44
47
|
...props
|
45
48
|
}: RadioProps, ref: any) => {
|
46
|
-
const
|
47
|
-
|
48
|
-
const
|
49
|
+
const radioRef = useRef(null);
|
50
|
+
|
51
|
+
const ariaProps = buildAriaProps(aria);
|
52
|
+
const dataProps = buildDataProps(data);
|
53
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
49
54
|
const classes = classnames(
|
50
|
-
buildCss('pb_radio_kit', alignment
|
51
|
-
dark ? 'dark'
|
55
|
+
buildCss('pb_radio_kit', alignment),
|
56
|
+
dark ? 'dark' : null,
|
57
|
+
error ? 'error' : null,
|
52
58
|
globalProps(props),
|
53
|
-
className
|
59
|
+
className
|
60
|
+
);
|
61
|
+
|
62
|
+
const classesCustom = classnames(
|
63
|
+
dark ? 'dark' : null,
|
64
|
+
error ? 'error' : null,
|
65
|
+
globalProps(props),
|
66
|
+
className
|
67
|
+
);
|
54
68
|
|
55
69
|
const displayRadio = (props: RadioProps & any) => {
|
56
|
-
if (children)
|
70
|
+
if (children && customChildren == false)
|
57
71
|
return (children)
|
58
72
|
else
|
59
73
|
return (
|
@@ -70,24 +84,69 @@ const Radio = ({
|
|
70
84
|
/>
|
71
85
|
)}
|
72
86
|
|
87
|
+
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
88
|
+
if (event) {
|
89
|
+
const target = event.target as HTMLElement;
|
90
|
+
if (
|
91
|
+
target.id === 'pb-radio-children-wrapper' ||
|
92
|
+
target.closest('#pb-radio-children-wrapper')
|
93
|
+
) {
|
94
|
+
radioRef.current?.click();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
73
99
|
return (
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
100
|
+
customChildren ? (
|
101
|
+
<Flex
|
102
|
+
{...ariaProps}
|
103
|
+
{...dataProps}
|
104
|
+
{...htmlProps}
|
105
|
+
align='center'
|
106
|
+
className={classesCustom}
|
107
|
+
cursor='pointer'
|
108
|
+
htmlFor={id}
|
109
|
+
htmlOptions={{
|
110
|
+
onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
111
|
+
handleContainerClick(event);
|
112
|
+
}) as unknown as () => void
|
113
|
+
}}
|
114
|
+
id="radio-container"
|
115
|
+
>
|
116
|
+
<label className={buildCss('pb_radio_kit', alignment)}>
|
117
|
+
<input
|
118
|
+
disabled={disabled}
|
119
|
+
id={id}
|
120
|
+
name={name}
|
121
|
+
onChange={onChange}
|
122
|
+
ref={radioRef}
|
123
|
+
type="radio"
|
124
|
+
value={value}
|
125
|
+
{...props}
|
126
|
+
/>
|
127
|
+
<span className="pb_radio_button" />
|
128
|
+
</label>
|
129
|
+
<div id="pb-radio-children-wrapper"> {children} </div>
|
130
|
+
</Flex>
|
131
|
+
) : (
|
132
|
+
<label
|
133
|
+
{...ariaProps}
|
134
|
+
{...dataProps}
|
135
|
+
{...htmlProps}
|
136
|
+
className={classes}
|
137
|
+
htmlFor={id}
|
138
|
+
>
|
139
|
+
<>{displayRadio(props)}</>
|
140
|
+
<span className="pb_radio_button" />
|
141
|
+
<Body
|
142
|
+
dark={dark}
|
143
|
+
status={error ? 'negative' : null}
|
144
|
+
text={label}
|
145
|
+
variant={null}
|
146
|
+
/>
|
147
|
+
</label>
|
148
|
+
)
|
149
|
+
);
|
150
|
+
};
|
92
151
|
|
93
|
-
export default forwardRef(Radio)
|
152
|
+
export default forwardRef(Radio);
|