playbook_ui 14.3.2 → 14.4.0.pre.alpha.PLAY1529removefaeasy3876
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -12,7 +12,7 @@ module Playbook
|
|
12
12
|
values: %w[none lowercase],
|
13
13
|
default: "none"
|
14
14
|
prop :color, type: Playbook::Props::Enum,
|
15
|
-
values: %w[primary neutral],
|
15
|
+
values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
|
16
16
|
default: "primary"
|
17
17
|
prop :tabindex
|
18
18
|
prop :icon
|
@@ -9,7 +9,7 @@ module Playbook
|
|
9
9
|
prop :border, type: Playbook::Props::Boolean,
|
10
10
|
default: false
|
11
11
|
prop :fixed_width, type: Playbook::Props::Boolean,
|
12
|
-
default:
|
12
|
+
default: true
|
13
13
|
prop :flip, type: Playbook::Props::Enum,
|
14
14
|
values: ["horizontal", "vertical", "both", nil],
|
15
15
|
default: nil
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
2
2
|
import Button from "../pb_button/_button";
|
3
3
|
import Icon from "../pb_icon/_icon";
|
4
4
|
import Flex from "../pb_flex/_flex";
|
5
|
+
import { getAllIcons } from "../utilities/icons/allicons"
|
5
6
|
|
6
7
|
type MapControlTypes = {
|
7
8
|
zoomBtns?: boolean,
|
@@ -12,6 +13,8 @@ type MapControlTypes = {
|
|
12
13
|
children?: React.ReactNode | React.ReactNode[]
|
13
14
|
}
|
14
15
|
|
16
|
+
const eyeIcon = getAllIcons()["eye"]
|
17
|
+
|
15
18
|
const MapControls = ({
|
16
19
|
zoomBtns,
|
17
20
|
zoomInClick,
|
@@ -42,7 +45,10 @@ const MapControls = ({
|
|
42
45
|
<Button className="map-flyto-button"
|
43
46
|
onClick={flyToClick}
|
44
47
|
>
|
45
|
-
<Icon
|
48
|
+
<Icon
|
49
|
+
className="svg-inline--fa"
|
50
|
+
customIcon={eyeIcon.icon as unknown as { [key: string]: SVGElement }}
|
51
|
+
/>
|
46
52
|
</Button>
|
47
53
|
) : null}
|
48
54
|
</>
|
@@ -34,6 +34,7 @@ type MultiLevelSelectProps = {
|
|
34
34
|
onSelect?: (prop: { [key: string]: any }) => void
|
35
35
|
selectedIds?: string[]
|
36
36
|
variant?: "multi" | "single"
|
37
|
+
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
37
38
|
} & GlobalProps
|
38
39
|
|
39
40
|
const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
@@ -50,7 +51,8 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
50
51
|
treeData,
|
51
52
|
onSelect = () => null,
|
52
53
|
selectedIds,
|
53
|
-
variant = "multi"
|
54
|
+
variant = "multi",
|
55
|
+
pillColor = "primary"
|
54
56
|
} = props
|
55
57
|
|
56
58
|
const ariaProps = buildAriaProps(aria)
|
@@ -86,6 +88,9 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
86
88
|
item: []
|
87
89
|
})
|
88
90
|
|
91
|
+
const arrowDownElementId = `arrow_down_${id}`
|
92
|
+
const arrowUpElementId = `arrow_up_${id}`
|
93
|
+
|
89
94
|
const modifyRecursive = (tree: { [key: string]: any }[], check: boolean) => {
|
90
95
|
if (!Array.isArray(tree)) {
|
91
96
|
return
|
@@ -171,7 +176,12 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
171
176
|
useEffect(() => {
|
172
177
|
// Function to handle clicks outside the dropdown
|
173
178
|
const handleClickOutside = (event: any) => {
|
174
|
-
if (
|
179
|
+
if (
|
180
|
+
dropdownRef.current &&
|
181
|
+
!dropdownRef.current.contains(event.target) &&
|
182
|
+
event.target.id !== arrowDownElementId &&
|
183
|
+
event.target.id !== arrowUpElementId
|
184
|
+
) {
|
175
185
|
setIsDropdownClosed(true)
|
176
186
|
}
|
177
187
|
}
|
@@ -258,7 +268,6 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
258
268
|
|
259
269
|
// Handle click on input wrapper(entire div with pills, typeahead, etc) so it doesn't close when input or form pill is clicked
|
260
270
|
const handleInputWrapperClick = (e: any) => {
|
261
|
-
e.stopPropagation()
|
262
271
|
if (
|
263
272
|
e.target.id === "multiselect_input" ||
|
264
273
|
e.target.classList.contains("pb_form_pill_tag")
|
@@ -467,6 +476,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
467
476
|
inputDisplay === "pills"
|
468
477
|
? returnedArray.map((item, index) => (
|
469
478
|
<FormPill
|
479
|
+
color={pillColor}
|
470
480
|
key={index}
|
471
481
|
onClick={(event: any) => handlePillClose(event, item)}
|
472
482
|
text={item.label}
|
@@ -479,6 +489,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
479
489
|
inputDisplay === "pills"
|
480
490
|
? defaultReturn.map((item, index) => (
|
481
491
|
<FormPill
|
492
|
+
color={pillColor}
|
482
493
|
key={index}
|
483
494
|
onClick={(event: any) => handlePillClose(event, item)}
|
484
495
|
text={item.label}
|
@@ -514,16 +525,20 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
514
525
|
</div>
|
515
526
|
|
516
527
|
{isDropdownClosed ? (
|
517
|
-
<div
|
528
|
+
<div id={arrowDownElementId}
|
529
|
+
key="chevron-down">
|
518
530
|
<Icon
|
519
531
|
icon="chevron-down"
|
532
|
+
id={arrowDownElementId}
|
520
533
|
size="xs"
|
521
534
|
/>
|
522
535
|
</div>
|
523
536
|
) : (
|
524
|
-
<div
|
537
|
+
<div id={arrowUpElementId}
|
538
|
+
key="chevron-up">
|
525
539
|
<Icon
|
526
540
|
icon="chevron-up"
|
541
|
+
id={arrowUpElementId}
|
527
542
|
size="xs"
|
528
543
|
/>
|
529
544
|
</div>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "100",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "101",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "102",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "103",
|
22
|
+
children: [
|
23
|
+
{
|
24
|
+
label: "Initiatives",
|
25
|
+
value: "Initiatives",
|
26
|
+
id: "104",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: "Learning & Development",
|
30
|
+
value: "Learning & Development",
|
31
|
+
id: "105",
|
32
|
+
},
|
33
|
+
],
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: "People Experience",
|
37
|
+
value: "People Experience",
|
38
|
+
id: "106",
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
{
|
43
|
+
label: "Contact Center",
|
44
|
+
value: "Contact Center",
|
45
|
+
id: "107",
|
46
|
+
children: [
|
47
|
+
{
|
48
|
+
label: "Appointment Management",
|
49
|
+
value: "Appointment Management",
|
50
|
+
id: "108",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
label: "Customer Service",
|
54
|
+
value: "Customer Service",
|
55
|
+
id: "109",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
label: "Energy",
|
59
|
+
value: "Energy",
|
60
|
+
id: "110",
|
61
|
+
},
|
62
|
+
],
|
63
|
+
},
|
64
|
+
],
|
65
|
+
}] %>
|
66
|
+
|
67
|
+
<%= pb_rails("multi_level_select", props: {
|
68
|
+
id: "multi-level-select-default-rails",
|
69
|
+
name: "my_array",
|
70
|
+
tree_data: treeData,
|
71
|
+
pill_color: "neutral"
|
72
|
+
}) %>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Business Affairs",
|
24
|
+
value: "Business Affairs",
|
25
|
+
id: "business1",
|
26
|
+
children: [
|
27
|
+
{
|
28
|
+
label: "Initiatives",
|
29
|
+
value: "Initiatives",
|
30
|
+
id: "initiative1",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: "Learning & Development",
|
34
|
+
value: "Learning & Development",
|
35
|
+
id: "development1",
|
36
|
+
},
|
37
|
+
],
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: "People Experience",
|
41
|
+
value: "People Experience",
|
42
|
+
id: "experience1",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
label: "Contact Center",
|
48
|
+
value: "Contact Center",
|
49
|
+
id: "contact1",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
label: "Appointment Management",
|
53
|
+
value: "Appointment Management",
|
54
|
+
id: "appointment1",
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: "Customer Service",
|
58
|
+
value: "Customer Service",
|
59
|
+
id: "customer1",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: "Energy",
|
63
|
+
value: "Energy",
|
64
|
+
id: "energy1",
|
65
|
+
},
|
66
|
+
],
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
];
|
71
|
+
|
72
|
+
const MultiLevelSelectColor = (props) => {
|
73
|
+
return (
|
74
|
+
<div>
|
75
|
+
<MultiLevelSelect
|
76
|
+
id='multiselect-color'
|
77
|
+
onSelect={(selectedNodes) =>
|
78
|
+
console.log(
|
79
|
+
"Selected Items",
|
80
|
+
selectedNodes
|
81
|
+
)
|
82
|
+
}
|
83
|
+
pillColor="neutral"
|
84
|
+
treeData={treeData}
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</div>
|
88
|
+
)
|
89
|
+
};
|
90
|
+
|
91
|
+
export default MultiLevelSelectColor;
|
@@ -0,0 +1 @@
|
|
1
|
+
Change the form pill color by passing the optional `pill_color` prop. Product, Data, and Status colors are available options. Check them out <a href="https://playbook.powerapp.cloud/kits/form_pill#form-pill-colors" target="_blank">here</a> in the Form Pill colors example.
|
@@ -0,0 +1 @@
|
|
1
|
+
Change the form pill color by passing the optional `pillColor` prop. Product, Data, and Status colors are available options. Check them out <a href="https://playbook.powerapp.cloud/kits/form_pill/react#form-pill-colors" target="_blank">here</a> in the Form Pill colors example.
|
@@ -6,6 +6,7 @@ examples:
|
|
6
6
|
- multi_level_select_return_all_selected: Return All Selected
|
7
7
|
- multi_level_select_selected_ids: Selected Ids
|
8
8
|
- multi_level_select_with_form: With Form
|
9
|
+
- multi_level_select_color: With Pills (Custom Color)
|
9
10
|
|
10
11
|
react:
|
11
12
|
- multi_level_select_default: Default
|
@@ -13,3 +14,4 @@ examples:
|
|
13
14
|
- multi_level_select_single_children_only: Single Select w/ Hidden Radios
|
14
15
|
- multi_level_select_return_all_selected: Return All Selected
|
15
16
|
- multi_level_select_selected_ids_react: Selected Ids
|
17
|
+
- multi_level_select_color: With Pills (Custom Color)
|
@@ -3,3 +3,4 @@ export { default as MultiLevelSelectSingle } from './_multi_level_select_single.
|
|
3
3
|
export { default as MultiLevelSelectSingleChildrenOnly } from './_multi_level_select_single_children_only.jsx'
|
4
4
|
export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
|
5
5
|
export { default as MultiLevelSelectSelectedIdsReact } from "./_multi_level_select_selected_ids_react.jsx"
|
6
|
+
export { default as MultiLevelSelectColor } from './_multi_level_select_color.jsx'
|
@@ -19,6 +19,9 @@ module Playbook
|
|
19
19
|
prop :variant, type: Playbook::Props::Enum,
|
20
20
|
values: %w[multi single],
|
21
21
|
default: "multi"
|
22
|
+
prop :pill_color, type: Playbook::Props::Enum,
|
23
|
+
values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
|
24
|
+
default: "primary"
|
22
25
|
|
23
26
|
def classname
|
24
27
|
generate_classname("pb_multi_level_select")
|
@@ -34,6 +37,7 @@ module Playbook
|
|
34
37
|
selectedIds: selected_ids,
|
35
38
|
input_name: input_name,
|
36
39
|
variant: variant,
|
40
|
+
pillColor: pill_color,
|
37
41
|
}
|
38
42
|
end
|
39
43
|
end
|
@@ -3,8 +3,25 @@
|
|
3
3
|
@import "../tokens/opacity";
|
4
4
|
@import "../pb_avatar/avatar";
|
5
5
|
|
6
|
+
@mixin avatar-size($size) {
|
7
|
+
height: $size;
|
8
|
+
width: $size;
|
9
|
+
.avatar_wrapper {
|
10
|
+
width: $size;
|
11
|
+
height: $size;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
@mixin position($position) {
|
16
|
+
position: absolute;
|
17
|
+
@each $pos, $val in $position {
|
18
|
+
#{$pos}: $val;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
6
22
|
[class^=pb_multiple_users_stacked_kit] {
|
7
23
|
$container_size: map-get($avatar-sizes, "xs");
|
24
|
+
$bubble_container_size: map-get($avatar-sizes, "sm");
|
8
25
|
$overlap: -15px;
|
9
26
|
$border_size: 1px;
|
10
27
|
$stacked_size: 18px;
|
@@ -17,34 +34,24 @@
|
|
17
34
|
flex-shrink: 0;
|
18
35
|
flex-grow: 0;
|
19
36
|
[class^=pb_avatar_kit].pb_multiple_users_stacked_item {
|
20
|
-
|
21
|
-
|
22
|
-
&.dark {
|
23
|
-
.avatar_wrapper {
|
24
|
-
border: $pb_multiple_users_border_size solid $bg_dark;
|
25
|
-
}
|
26
|
-
}
|
37
|
+
@include avatar-size($stacked_size);
|
38
|
+
&.dark {
|
27
39
|
.avatar_wrapper {
|
28
|
-
border: $border_size solid $
|
29
|
-
height: $stacked_size;
|
30
|
-
width: $stacked_size;
|
31
|
-
img {
|
32
|
-
z-index: 0;
|
33
|
-
}
|
40
|
+
border: $border_size solid $bg_dark;
|
34
41
|
}
|
35
42
|
}
|
36
|
-
&[class*=_single] .pb_multiple_users_stacked_item {
|
37
|
-
width: $container_size;
|
38
|
-
height: $container_size;
|
39
43
|
.avatar_wrapper {
|
40
|
-
|
41
|
-
|
44
|
+
border: $border_size solid $white;
|
45
|
+
img {
|
46
|
+
z-index: 0;
|
47
|
+
}
|
42
48
|
}
|
43
49
|
}
|
50
|
+
&[class*=_single] .pb_multiple_users_stacked_item {
|
51
|
+
@include avatar-size($container_size);
|
52
|
+
}
|
44
53
|
[class^=pb_avatar_kit].second_item, [class^=pb_badge_kit].second_item {
|
45
|
-
position:
|
46
|
-
bottom: 0;
|
47
|
-
right: 0;
|
54
|
+
@include position((bottom: 0, right: 0));
|
48
55
|
z-index: 2;
|
49
56
|
background: tint($primary, 90%);
|
50
57
|
border-radius: $border_rad_mega;
|
@@ -63,4 +70,73 @@
|
|
63
70
|
font-size: 0;
|
64
71
|
color: transparent;
|
65
72
|
}
|
73
|
+
|
74
|
+
&[class*=_bubble] {
|
75
|
+
@include avatar-size($bubble_container_size);
|
76
|
+
background-color: $bg_light;
|
77
|
+
border-radius: 50%;
|
78
|
+
|
79
|
+
&.dark {
|
80
|
+
background-color: $card_dark;
|
81
|
+
}
|
82
|
+
|
83
|
+
[class^=pb_avatar_kit].pb_multiple_users_stacked_item {
|
84
|
+
&.dark {
|
85
|
+
.avatar_wrapper {
|
86
|
+
border: $border_size solid $border_dark;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
[class^=pb_avatar_kit] {
|
92
|
+
&.first_item {
|
93
|
+
@include position((top: 4px, left: 3px));
|
94
|
+
@include avatar-size(20px);
|
95
|
+
|
96
|
+
&.triple_bubble {
|
97
|
+
@include position((top: 4px, left: 4px));
|
98
|
+
@include avatar-size(16px);
|
99
|
+
}
|
100
|
+
|
101
|
+
&.quadruple_bubble {
|
102
|
+
@include position((top: 5px, left: 3px));
|
103
|
+
@include avatar-size(16px);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
&.second_item {
|
108
|
+
@include position((bottom: 5px, right: 4px));
|
109
|
+
@include avatar-size(12px);
|
110
|
+
|
111
|
+
&.triple_bubble {
|
112
|
+
@include position((top: 13px, right: 2px));
|
113
|
+
}
|
114
|
+
|
115
|
+
&.quadruple_bubble {
|
116
|
+
@include position((bottom: 9px, right: 4px));
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
&.third_item {
|
121
|
+
@include position((bottom: 3px, left: 11px));
|
122
|
+
@include avatar-size(10px);
|
123
|
+
|
124
|
+
&.quadruple_bubble {
|
125
|
+
@include position((bottom: 3px, left: 9px));
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
&.fourth_item {
|
130
|
+
@include position((top: 5px, right: 6px));
|
131
|
+
@include avatar-size(8px);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
&[class*=_single_bubble] {
|
137
|
+
[class^=pb_avatar_kit].first_item {
|
138
|
+
@include position((top: 0, left: 0));
|
139
|
+
@include avatar-size($bubble_container_size);
|
140
|
+
}
|
141
|
+
}
|
66
142
|
}
|
@@ -58,4 +58,170 @@ test('should pass aria prop', () => {
|
|
58
58
|
render(<MultipleUsersStackedDefault />)
|
59
59
|
const kit = screen.getByTestId(testId)
|
60
60
|
expect(kit).toHaveAttribute('aria-label', testId)
|
61
|
+
})
|
62
|
+
|
63
|
+
const MultipleUsersStackedSingleBubble = () => {
|
64
|
+
return (
|
65
|
+
<MultipleUsersStacked
|
66
|
+
aria={{ label: testId }}
|
67
|
+
className={className}
|
68
|
+
data={{ testid: testId }}
|
69
|
+
users={[
|
70
|
+
{
|
71
|
+
name: "user1",
|
72
|
+
imageUrl: "imageUser1",
|
73
|
+
imageAlt: "nameUser1",
|
74
|
+
}
|
75
|
+
]}
|
76
|
+
variant="bubble"
|
77
|
+
/>
|
78
|
+
)
|
79
|
+
}
|
80
|
+
|
81
|
+
test('should have a single bubble', () => {
|
82
|
+
render(<MultipleUsersStackedSingleBubble />)
|
83
|
+
const kit = screen.getByTestId(testId)
|
84
|
+
expect(kit).toHaveClass("pb_multiple_users_stacked_kit_single_bubble")
|
85
|
+
|
86
|
+
const firstItem = kit.querySelector('.first_item');
|
87
|
+
expect(firstItem).toBeInTheDocument();
|
88
|
+
})
|
89
|
+
|
90
|
+
const MultipleUsersStackedDoubleBubble = () => {
|
91
|
+
return (
|
92
|
+
<MultipleUsersStacked
|
93
|
+
aria={{ label: testId }}
|
94
|
+
className={className}
|
95
|
+
data={{ testid: testId }}
|
96
|
+
users={[
|
97
|
+
{
|
98
|
+
name: "user1",
|
99
|
+
imageUrl: "imageUser1",
|
100
|
+
imageAlt: "nameUser1",
|
101
|
+
},
|
102
|
+
{
|
103
|
+
name: "user2",
|
104
|
+
imageUrl: "imageUser2",
|
105
|
+
imageAlt: "nameUser2",
|
106
|
+
},
|
107
|
+
]}
|
108
|
+
variant="bubble"
|
109
|
+
/>
|
110
|
+
)
|
111
|
+
}
|
112
|
+
|
113
|
+
test('should have a double bubble', () => {
|
114
|
+
render(<MultipleUsersStackedDoubleBubble />)
|
115
|
+
const kit = screen.getByTestId(testId)
|
116
|
+
expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
|
117
|
+
|
118
|
+
const firstItem = kit.querySelector('.first_item');
|
119
|
+
expect(firstItem).toBeInTheDocument();
|
120
|
+
|
121
|
+
const secondItem = kit.querySelector('.second_item');
|
122
|
+
expect(secondItem).toBeInTheDocument();
|
123
|
+
})
|
124
|
+
|
125
|
+
const MultipleUsersStackedTripleBubble = () => {
|
126
|
+
return (
|
127
|
+
<MultipleUsersStacked
|
128
|
+
aria={{ label: testId }}
|
129
|
+
className={className}
|
130
|
+
data={{ testid: testId }}
|
131
|
+
users={[
|
132
|
+
{
|
133
|
+
name: "user1",
|
134
|
+
imageUrl: "imageUser1",
|
135
|
+
imageAlt: "nameUser1",
|
136
|
+
},
|
137
|
+
{
|
138
|
+
name: "user2",
|
139
|
+
imageUrl: "imageUser2",
|
140
|
+
imageAlt: "nameUser2",
|
141
|
+
},
|
142
|
+
{
|
143
|
+
name: "user3",
|
144
|
+
imageUrl: "imageUser3",
|
145
|
+
imageAlt: "nameUser3",
|
146
|
+
},
|
147
|
+
]}
|
148
|
+
variant="bubble"
|
149
|
+
/>
|
150
|
+
)
|
151
|
+
}
|
152
|
+
|
153
|
+
test('should have a triple bubble', () => {
|
154
|
+
render(<MultipleUsersStackedTripleBubble />)
|
155
|
+
const kit = screen.getByTestId(testId)
|
156
|
+
expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
|
157
|
+
|
158
|
+
const firstItem = kit.querySelector('.first_item');
|
159
|
+
expect(firstItem).toBeInTheDocument();
|
160
|
+
expect(firstItem).toHaveClass("triple_bubble")
|
161
|
+
|
162
|
+
const secondItem = kit.querySelector('.second_item');
|
163
|
+
expect(secondItem).toBeInTheDocument();
|
164
|
+
expect(secondItem).toHaveClass("triple_bubble")
|
165
|
+
|
166
|
+
const thirdItem = kit.querySelector('.third_item');
|
167
|
+
expect(thirdItem).toBeInTheDocument();
|
168
|
+
})
|
169
|
+
|
170
|
+
const MultipleUsersStackedQuadrupleBubble = () => {
|
171
|
+
return (
|
172
|
+
<MultipleUsersStacked
|
173
|
+
aria={{ label: testId }}
|
174
|
+
className={className}
|
175
|
+
data={{ testid: testId }}
|
176
|
+
users={[
|
177
|
+
{
|
178
|
+
name: "user1",
|
179
|
+
imageUrl: "imageUser1",
|
180
|
+
imageAlt: "nameUser1",
|
181
|
+
},
|
182
|
+
{
|
183
|
+
name: "user2",
|
184
|
+
imageUrl: "imageUser2",
|
185
|
+
imageAlt: "nameUser2",
|
186
|
+
},
|
187
|
+
{
|
188
|
+
name: "user3",
|
189
|
+
imageUrl: "imageUser3",
|
190
|
+
imageAlt: "nameUser3",
|
191
|
+
},
|
192
|
+
{
|
193
|
+
name: "user4",
|
194
|
+
imageUrl: "imageUser4",
|
195
|
+
imageAlt: "nameUser4",
|
196
|
+
},
|
197
|
+
{
|
198
|
+
name: "user5",
|
199
|
+
imageUrl: "imageUser5",
|
200
|
+
imageAlt: "nameUser5",
|
201
|
+
},
|
202
|
+
]}
|
203
|
+
variant="bubble"
|
204
|
+
/>
|
205
|
+
)
|
206
|
+
}
|
207
|
+
|
208
|
+
test('should have a quadruple bubble', () => {
|
209
|
+
render(<MultipleUsersStackedQuadrupleBubble />)
|
210
|
+
const kit = screen.getByTestId(testId)
|
211
|
+
expect(kit).toHaveClass("pb_multiple_users_stacked_kit_bubble")
|
212
|
+
|
213
|
+
const firstItem = kit.querySelector('.first_item');
|
214
|
+
expect(firstItem).toBeInTheDocument();
|
215
|
+
expect(firstItem).toHaveClass("quadruple_bubble")
|
216
|
+
|
217
|
+
const secondItem = kit.querySelector('.second_item');
|
218
|
+
expect(secondItem).toBeInTheDocument();
|
219
|
+
expect(secondItem).toHaveClass("quadruple_bubble")
|
220
|
+
|
221
|
+
const thirdItem = kit.querySelector('.third_item');
|
222
|
+
expect(thirdItem).toBeInTheDocument();
|
223
|
+
expect(thirdItem).toHaveClass("quadruple_bubble")
|
224
|
+
|
225
|
+
const fourthItem = kit.querySelector('.fourth_item');
|
226
|
+
expect(fourthItem).toBeInTheDocument();
|
61
227
|
})
|