playbook_ui 14.19.0.pre.alpha.PLAY2171advancedtable7832 → 14.19.0.pre.alpha.PLAY2172homeaddressstreetundefinedstatebug7716
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/TableActionBar.tsx +35 -61
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +22 -36
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +19 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +1 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +19 -77
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +0 -11
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +2 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +1 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +1 -11
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -16
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +13 -34
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +1 -3
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +6 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +30 -336
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +12 -39
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +12 -16
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +13 -79
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +2 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +12 -19
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +3 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.md +0 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.md +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +22 -22
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +22 -22
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.html.erb +22 -22
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx +22 -22
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +11 -11
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_form.html.erb +11 -11
- data/app/pb_kits/playbook/pb_person/_person.tsx +2 -12
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -73
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/dist/chunks/_typeahead-BPSIWtFT.js +22 -0
- data/dist/chunks/_weekday_stacked-rph2mGIB.js +45 -0
- data/dist/chunks/lib-B20MXZcW.js +29 -0
- data/dist/chunks/{pb_form_validation-BZ2AVAi_.js → pb_form_validation-WWvUXPKD.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- 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/version.rb +1 -1
- metadata +7 -26
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +0 -31
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +0 -56
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +0 -58
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +0 -20
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +0 -20
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +0 -57
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +0 -50
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +0 -105
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +0 -22
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +0 -67
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +0 -58
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +0 -23
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +0 -1
- data/dist/chunks/_typeahead-BmOWdDtp.js +0 -22
- data/dist/chunks/_weekday_stacked-CvcuQyr9.js +0 -45
- data/dist/chunks/lib-D5R1BjUn.js +0 -29
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx
CHANGED
@@ -4,80 +4,80 @@ import MultiLevelSelect from "../_multi_level_select";
|
|
4
4
|
const treeData = [
|
5
5
|
{
|
6
6
|
label: "HQ",
|
7
|
-
value: "
|
7
|
+
value: "HQ",
|
8
8
|
id: "hq1",
|
9
9
|
},
|
10
10
|
{
|
11
11
|
label: "Philadelphia",
|
12
|
-
value: "
|
12
|
+
value: "Philadelphia",
|
13
13
|
id: "phl1",
|
14
14
|
hideRadio: true,
|
15
15
|
children: [
|
16
16
|
{
|
17
17
|
label: "Marketing & Sales PHL",
|
18
|
-
value: "
|
18
|
+
value: "Marketing & Sales PHL",
|
19
19
|
id: "marketingPHL1",
|
20
20
|
},
|
21
21
|
{
|
22
22
|
label: "Installation Office PHL",
|
23
|
-
value: "
|
23
|
+
value: "Installation Office PHL",
|
24
24
|
id: "installationPHL1",
|
25
25
|
},
|
26
26
|
{
|
27
27
|
label: "Warehouse PHL",
|
28
|
-
value: "
|
28
|
+
value: "Warehouse PHL",
|
29
29
|
id: "warehousePHL1",
|
30
30
|
},
|
31
31
|
]
|
32
32
|
},
|
33
33
|
{
|
34
34
|
label: "New Jersey",
|
35
|
-
value: "
|
35
|
+
value: "New Jersey",
|
36
36
|
id: "nj2",
|
37
37
|
hideRadio: true,
|
38
38
|
children: [
|
39
39
|
{
|
40
40
|
label: "New Jersey",
|
41
|
-
value: "
|
41
|
+
value: "New Jersey",
|
42
42
|
id: "nj3",
|
43
43
|
hideRadio: true,
|
44
44
|
children: [
|
45
45
|
{
|
46
46
|
label: "Marketing & Sales NJ",
|
47
|
-
value: "
|
47
|
+
value: "Marketing & Sales NJ",
|
48
48
|
id: "marketingNJ1",
|
49
49
|
},
|
50
50
|
{
|
51
51
|
label: "Installation Office NJ",
|
52
|
-
value: "
|
52
|
+
value: "Installation Office NJ",
|
53
53
|
id: "installationNJ1",
|
54
54
|
},
|
55
55
|
{
|
56
56
|
label: "Warehouse NJ",
|
57
|
-
value: "
|
57
|
+
value: "Warehouse NJ",
|
58
58
|
id: "warehouseNJ1",
|
59
59
|
},
|
60
60
|
],
|
61
61
|
},
|
62
62
|
{
|
63
63
|
label: "Princeton",
|
64
|
-
value: "
|
64
|
+
value: "Princeton",
|
65
65
|
id: "princeton1",
|
66
66
|
hideRadio: true,
|
67
67
|
children: [
|
68
68
|
{
|
69
69
|
label: "Marketing & Sales Princeton",
|
70
|
-
value: "
|
70
|
+
value: "Marketing & Sales Princeton",
|
71
71
|
id: "marketingPR1",
|
72
72
|
},
|
73
73
|
{
|
74
74
|
label: "Installation Office Princeton",
|
75
|
-
value: "
|
75
|
+
value: "Installation Office Princeton",
|
76
76
|
id: "installationPR1",
|
77
77
|
},
|
78
78
|
{
|
79
79
|
label: "Warehouse Princeton",
|
80
|
-
value: "
|
80
|
+
value: "Warehouse Princeton",
|
81
81
|
id: "warehousePR1",
|
82
82
|
},
|
83
83
|
]
|
@@ -86,46 +86,46 @@ const treeData = [
|
|
86
86
|
},
|
87
87
|
{
|
88
88
|
label: "Maryland",
|
89
|
-
value: "
|
89
|
+
value: "Maryland",
|
90
90
|
id: "MD1",
|
91
91
|
hideRadio: true,
|
92
92
|
children: [
|
93
93
|
{
|
94
94
|
label: "Marketing & Sales MD",
|
95
|
-
value: "
|
95
|
+
value: "Marketing & Sales MD",
|
96
96
|
id: "marketingMD1",
|
97
97
|
},
|
98
98
|
{
|
99
99
|
label: "Installation Office MD",
|
100
|
-
value: "
|
100
|
+
value: "Installation Office MD",
|
101
101
|
id: "installationMD1",
|
102
102
|
},
|
103
103
|
{
|
104
104
|
label: "Warehouse MD",
|
105
|
-
value: "
|
105
|
+
value: "Warehouse MD",
|
106
106
|
id: "warehouseMD1",
|
107
107
|
},
|
108
108
|
]
|
109
109
|
},
|
110
110
|
{
|
111
111
|
label: "Connecticut",
|
112
|
-
value: "
|
112
|
+
value: "Connecticut",
|
113
113
|
id: "CT1",
|
114
114
|
hideRadio: true,
|
115
115
|
children: [
|
116
116
|
{
|
117
117
|
label: "Marketing & Sales CT",
|
118
|
-
value: "
|
118
|
+
value: "Marketing & Sales CT",
|
119
119
|
id: "marketingCT1",
|
120
120
|
},
|
121
121
|
{
|
122
122
|
label: "Installation Office CT",
|
123
|
-
value: "
|
123
|
+
value: "Installation Office CT",
|
124
124
|
id: "installationCT1",
|
125
125
|
},
|
126
126
|
{
|
127
127
|
label: "Warehouse CT",
|
128
|
-
value: "
|
128
|
+
value: "Warehouse CT",
|
129
129
|
id: "warehouseCT1",
|
130
130
|
},
|
131
131
|
]
|
@@ -5,25 +5,25 @@ import Badge from "../../pb_badge/_badge";
|
|
5
5
|
const treeData = [
|
6
6
|
{
|
7
7
|
label: "Power Home Remodeling",
|
8
|
-
value: "
|
8
|
+
value: "Power Home Remodeling",
|
9
9
|
id: "powerhome1",
|
10
10
|
expanded: true,
|
11
11
|
children: [
|
12
12
|
{
|
13
13
|
label: "People",
|
14
|
-
value: "
|
14
|
+
value: "People",
|
15
15
|
id: "people1",
|
16
16
|
expanded: true,
|
17
17
|
status: "active",
|
18
18
|
children: [
|
19
19
|
{
|
20
20
|
label: "Talent Acquisition",
|
21
|
-
value: "
|
21
|
+
value: "Talent Acquisition",
|
22
22
|
id: "talent1",
|
23
23
|
},
|
24
24
|
{
|
25
25
|
label: "Business Affairs",
|
26
|
-
value: "
|
26
|
+
value: "Business Affairs",
|
27
27
|
id: "business1",
|
28
28
|
status: "active",
|
29
29
|
variant: "primary",
|
@@ -31,12 +31,12 @@ const treeData = [
|
|
31
31
|
children: [
|
32
32
|
{
|
33
33
|
label: "Initiatives",
|
34
|
-
value: "
|
34
|
+
value: "Initiatives",
|
35
35
|
id: "initiative1",
|
36
36
|
},
|
37
37
|
{
|
38
38
|
label: "Learning & Development",
|
39
|
-
value: "
|
39
|
+
value: "Learning & Development",
|
40
40
|
id: "development1",
|
41
41
|
status: "Inactive",
|
42
42
|
},
|
@@ -44,31 +44,31 @@ const treeData = [
|
|
44
44
|
},
|
45
45
|
{
|
46
46
|
label: "People Experience",
|
47
|
-
value: "
|
47
|
+
value: "People Experience",
|
48
48
|
id: "experience1",
|
49
49
|
},
|
50
50
|
],
|
51
51
|
},
|
52
52
|
{
|
53
53
|
label: "Contact Center",
|
54
|
-
value: "
|
54
|
+
value: "Contact Center",
|
55
55
|
id: "contact1",
|
56
56
|
status: "Inactive",
|
57
57
|
variant: "error",
|
58
58
|
children: [
|
59
59
|
{
|
60
60
|
label: "Appointment Management",
|
61
|
-
value: "
|
61
|
+
value: "Appointment Management",
|
62
62
|
id: "appointment1",
|
63
63
|
},
|
64
64
|
{
|
65
65
|
label: "Customer Service",
|
66
|
-
value: "
|
66
|
+
value: "Customer Service",
|
67
67
|
id: "customer1",
|
68
68
|
},
|
69
69
|
{
|
70
70
|
label: "Energy",
|
71
|
-
value: "
|
71
|
+
value: "Energy",
|
72
72
|
id: "energy1",
|
73
73
|
},
|
74
74
|
],
|
@@ -5,25 +5,25 @@ import Badge from "../../pb_badge/_badge";
|
|
5
5
|
const treeData = [
|
6
6
|
{
|
7
7
|
label: "Power Home Remodeling",
|
8
|
-
value: "
|
8
|
+
value: "Power Home Remodeling",
|
9
9
|
id: "powerhome1",
|
10
10
|
expanded: true,
|
11
11
|
children: [
|
12
12
|
{
|
13
13
|
label: "People",
|
14
|
-
value: "
|
14
|
+
value: "People",
|
15
15
|
id: "people1",
|
16
16
|
expanded: true,
|
17
17
|
status: "active",
|
18
18
|
children: [
|
19
19
|
{
|
20
20
|
label: "Talent Acquisition",
|
21
|
-
value: "
|
21
|
+
value: "Talent Acquisition",
|
22
22
|
id: "talent1",
|
23
23
|
},
|
24
24
|
{
|
25
25
|
label: "Business Affairs",
|
26
|
-
value: "
|
26
|
+
value: "Business Affairs",
|
27
27
|
id: "business1",
|
28
28
|
status: "active",
|
29
29
|
variant: "primary",
|
@@ -31,12 +31,12 @@ const treeData = [
|
|
31
31
|
children: [
|
32
32
|
{
|
33
33
|
label: "Initiatives",
|
34
|
-
value: "
|
34
|
+
value: "Initiatives",
|
35
35
|
id: "initiative1",
|
36
36
|
},
|
37
37
|
{
|
38
38
|
label: "Learning & Development",
|
39
|
-
value: "
|
39
|
+
value: "Learning & Development",
|
40
40
|
id: "development1",
|
41
41
|
status: "Inactive",
|
42
42
|
},
|
@@ -44,31 +44,31 @@ const treeData = [
|
|
44
44
|
},
|
45
45
|
{
|
46
46
|
label: "People Experience",
|
47
|
-
value: "
|
47
|
+
value: "People Experience",
|
48
48
|
id: "experience1",
|
49
49
|
},
|
50
50
|
],
|
51
51
|
},
|
52
52
|
{
|
53
53
|
label: "Contact Center",
|
54
|
-
value: "
|
54
|
+
value: "Contact Center",
|
55
55
|
id: "contact1",
|
56
56
|
status: "Inactive",
|
57
57
|
variant: "error",
|
58
58
|
children: [
|
59
59
|
{
|
60
60
|
label: "Appointment Management",
|
61
|
-
value: "
|
61
|
+
value: "Appointment Management",
|
62
62
|
id: "appointment1",
|
63
63
|
},
|
64
64
|
{
|
65
65
|
label: "Customer Service",
|
66
|
-
value: "
|
66
|
+
value: "Customer Service",
|
67
67
|
id: "customer1",
|
68
68
|
},
|
69
69
|
{
|
70
70
|
label: "Energy",
|
71
|
-
value: "
|
71
|
+
value: "Energy",
|
72
72
|
id: "energy1",
|
73
73
|
},
|
74
74
|
],
|
@@ -2,62 +2,62 @@
|
|
2
2
|
|
3
3
|
<% treeData = [{
|
4
4
|
label: "Power Home Remodeling",
|
5
|
-
value: "
|
5
|
+
value: "Power Home Remodeling",
|
6
6
|
id: "powerhome1",
|
7
7
|
expanded: true,
|
8
8
|
children: [
|
9
9
|
{
|
10
10
|
label: "People",
|
11
|
-
value: "
|
11
|
+
value: "People",
|
12
12
|
id: "people1",
|
13
13
|
children: [
|
14
14
|
{
|
15
15
|
label: "Talent Acquisition",
|
16
|
-
value: "
|
16
|
+
value: "Talent Acquisition",
|
17
17
|
id: "talent1",
|
18
18
|
},
|
19
19
|
{
|
20
20
|
label: "Business Affairs",
|
21
|
-
value: "
|
21
|
+
value: "Business Affairs",
|
22
22
|
id: "business1",
|
23
23
|
children: [
|
24
24
|
{
|
25
25
|
label: "Initiatives",
|
26
|
-
value: "
|
26
|
+
value: "Initiatives",
|
27
27
|
id: "initiative1",
|
28
28
|
},
|
29
29
|
{
|
30
30
|
label: "Learning & Development",
|
31
|
-
value: "
|
31
|
+
value: "Learning & Development",
|
32
32
|
id: "development1",
|
33
33
|
},
|
34
34
|
],
|
35
35
|
},
|
36
36
|
{
|
37
37
|
label: "People Experience",
|
38
|
-
value: "
|
38
|
+
value: "People Experience",
|
39
39
|
id: "experience1",
|
40
40
|
},
|
41
41
|
],
|
42
42
|
},
|
43
43
|
{
|
44
44
|
label: "Contact Center",
|
45
|
-
value: "
|
45
|
+
value: "Contact Center",
|
46
46
|
id: "contact1",
|
47
47
|
children: [
|
48
48
|
{
|
49
49
|
label: "Appointment Management",
|
50
|
-
value: "
|
50
|
+
value: "Appointment Management",
|
51
51
|
id: "appointment1",
|
52
52
|
},
|
53
53
|
{
|
54
54
|
label: "Customer Service",
|
55
|
-
value: "
|
55
|
+
value: "Customer Service",
|
56
56
|
id: "customer1",
|
57
57
|
},
|
58
58
|
{
|
59
59
|
label: "Energy",
|
60
|
-
value: "
|
60
|
+
value: "Energy",
|
61
61
|
id: "energy1",
|
62
62
|
},
|
63
63
|
],
|
@@ -41,16 +41,6 @@ const Person = (props: PersonProps): React.ReactElement => {
|
|
41
41
|
className
|
42
42
|
)
|
43
43
|
|
44
|
-
const hasAllEmptyProps = [firstName, lastName].every(field => field === undefined || field === null || field === '')
|
45
|
-
|
46
|
-
if (hasAllEmptyProps) {
|
47
|
-
return (
|
48
|
-
<>
|
49
|
-
—
|
50
|
-
</>
|
51
|
-
)
|
52
|
-
}
|
53
|
-
|
54
44
|
return (
|
55
45
|
<div
|
56
46
|
{...ariaProps}
|
@@ -63,13 +53,13 @@ const Person = (props: PersonProps): React.ReactElement => {
|
|
63
53
|
className="pb_person_first"
|
64
54
|
tag="span"
|
65
55
|
>
|
66
|
-
{firstName
|
56
|
+
{firstName}
|
67
57
|
</Body>
|
68
58
|
{lastName &&
|
69
59
|
<Title
|
70
60
|
className="pb_person_first"
|
71
61
|
size={4}
|
72
|
-
text={
|
62
|
+
text={` ${lastName}`}
|
73
63
|
/>
|
74
64
|
}
|
75
65
|
</div>
|
@@ -29,7 +29,6 @@ import { GenericObject, Noop } from '../types'
|
|
29
29
|
* @prop {boolean} async - whether Typeahead should fetch data from
|
30
30
|
* a remote location to populate the options
|
31
31
|
* @prop {string} label - the text for the optional typeahead input label
|
32
|
-
* @prop {boolean} preserveSearchInput - whether to preserve the input value when the field loses focus
|
33
32
|
*/
|
34
33
|
|
35
34
|
type TypeaheadProps = {
|
@@ -55,7 +54,6 @@ type TypeaheadProps = {
|
|
55
54
|
optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
|
56
55
|
searchContextSelector?: string,
|
57
56
|
clearOnContextChange?: boolean,
|
58
|
-
preserveSearchInput?: boolean,
|
59
57
|
} & GlobalProps
|
60
58
|
|
61
59
|
export type SelectValueType = {
|
@@ -95,44 +93,8 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
95
93
|
optionsByContext = {},
|
96
94
|
searchContextSelector,
|
97
95
|
clearOnContextChange = false,
|
98
|
-
preserveSearchInput = false, // Default to false to maintain backward compatibility
|
99
96
|
...props
|
100
97
|
}: TypeaheadProps) => {
|
101
|
-
// State to manage the input value when preserveSearchInput is true
|
102
|
-
const [inputValue, setInputValue] = useState("")
|
103
|
-
|
104
|
-
// If preserveSearchInput is true, we need to control the input value
|
105
|
-
const handleInputChange = preserveSearchInput
|
106
|
-
? (newValue: string, actionMeta: {action: string}) => {
|
107
|
-
// Only update the input value for certain actions
|
108
|
-
if (actionMeta.action === 'input-change') {
|
109
|
-
setInputValue(newValue)
|
110
|
-
} else if (actionMeta.action === 'menu-close' && !props.value) {
|
111
|
-
// Don't clear the input when the menu closes without a selection
|
112
|
-
// unless the component is controlled and has a value
|
113
|
-
} else if (actionMeta.action === 'set-value') {
|
114
|
-
// When an option is selected, clear the input
|
115
|
-
setInputValue('')
|
116
|
-
}
|
117
|
-
|
118
|
-
// If the original onInputChange was provided, call it too
|
119
|
-
if (props.onInputChange) {
|
120
|
-
return props.onInputChange(newValue, actionMeta)
|
121
|
-
}
|
122
|
-
return newValue
|
123
|
-
}
|
124
|
-
: props.onInputChange
|
125
|
-
|
126
|
-
// Handle blur events if we're preserving input
|
127
|
-
const handleBlur = preserveSearchInput
|
128
|
-
? (event: React.FocusEvent<HTMLInputElement>) => {
|
129
|
-
// Do not clear input on blur - the value is preserved in our state
|
130
|
-
if (props.onBlur) {
|
131
|
-
props.onBlur(event)
|
132
|
-
}
|
133
|
-
}
|
134
|
-
: props.onBlur
|
135
|
-
|
136
98
|
const selectProps = {
|
137
99
|
cacheOptions: true,
|
138
100
|
components: {
|
@@ -162,29 +124,11 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
162
124
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
163
125
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
164
126
|
pillColor: pillColor,
|
165
|
-
...(preserveSearchInput ? { inputValue } : {}),
|
166
|
-
onInputChange: handleInputChange,
|
167
|
-
onBlur: handleBlur,
|
168
127
|
...props,
|
169
128
|
}
|
170
129
|
|
171
130
|
const [contextValue, setContextValue] = useState("")
|
172
131
|
|
173
|
-
// Add listener for clearing
|
174
|
-
useEffect(() => {
|
175
|
-
const handleClear = () => {
|
176
|
-
if (preserveSearchInput) {
|
177
|
-
setInputValue('')
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, handleClear)
|
182
|
-
|
183
|
-
return () => {
|
184
|
-
document.removeEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, handleClear)
|
185
|
-
}
|
186
|
-
}, [selectProps.id, preserveSearchInput])
|
187
|
-
|
188
132
|
useEffect(() => {
|
189
133
|
if (searchContextSelector) {
|
190
134
|
const searchContextElement = document.getElementById(searchContextSelector)
|
@@ -193,12 +137,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
193
137
|
const handleContextChange = (e: Event) => {
|
194
138
|
const target = e.target as HTMLInputElement;
|
195
139
|
setContextValue(target.value);
|
196
|
-
if (clearOnContextChange) {
|
197
|
-
document.dispatchEvent(new CustomEvent(`pb-typeahead-kit-${selectProps.id}:clear`))
|
198
|
-
if (preserveSearchInput) {
|
199
|
-
setInputValue('')
|
200
|
-
}
|
201
|
-
}
|
140
|
+
if (clearOnContextChange) document.dispatchEvent(new CustomEvent(`pb-typeahead-kit-${selectProps.id}:clear`))
|
202
141
|
}
|
203
142
|
|
204
143
|
if (searchContextElement) searchContextElement.addEventListener('change', handleContextChange)
|
@@ -207,7 +146,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
207
146
|
if (searchContextElement) searchContextElement.removeEventListener('change', handleContextChange)
|
208
147
|
}
|
209
148
|
}
|
210
|
-
}, [searchContextSelector
|
149
|
+
}, [searchContextSelector])
|
211
150
|
|
212
151
|
const contextArray = optionsByContext[contextValue]
|
213
152
|
if (Array.isArray(contextArray) && contextArray.length > 0) {
|
@@ -229,12 +168,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
229
168
|
onChange(_data)
|
230
169
|
}
|
231
170
|
}
|
232
|
-
|
233
|
-
// If a value is selected and we're preserving input on blur, clear the input
|
234
|
-
if (action === 'select-option' && preserveSearchInput) {
|
235
|
-
setInputValue('')
|
236
|
-
}
|
237
|
-
|
171
|
+
|
238
172
|
if (action === 'select-option') {
|
239
173
|
if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
|
240
174
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
|
@@ -247,10 +181,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
247
181
|
if (action === 'clear') {
|
248
182
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-clear`)
|
249
183
|
document.dispatchEvent(multiValueClearEvent)
|
250
|
-
// If preserving input on blur, also clear input on explicit clear
|
251
|
-
if (preserveSearchInput) {
|
252
|
-
setInputValue('')
|
253
|
-
}
|
254
184
|
}
|
255
185
|
}
|
256
186
|
|
@@ -15,4 +15,3 @@ export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_colo
|
|
15
15
|
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|
16
16
|
export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
17
17
|
export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
|
18
|
-
export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
|