playbook_ui 14.19.0 → 14.20.0.pre.alpha.play2168firstcolumnborderbug7950
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/RegularTableView.tsx +11 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +175 -16
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +56 -25
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +23 -13
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/VisibilityTree.ts +47 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +14 -10
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +16 -8
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +9 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.jsx +62 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.jsx +82 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +155 -12
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +23 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.rb +19 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +77 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +31 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +56 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +57 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +50 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +105 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +22 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +67 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +11 -0
- 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 +33 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +16 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +34 -13
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/index.js +336 -30
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +39 -12
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +2 -2
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +16 -12
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +79 -13
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +58 -0
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +13 -0
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +11 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.html.erb +1 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.jsx +41 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -0
- data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +7 -1
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +18 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
- 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 +19 -12
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +13 -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 +2 -0
- 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 +3 -1
- 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 +12 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +9 -9
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +2 -2
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +4 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +73 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/dist/chunks/_typeahead-BmOWdDtp.js +22 -0
- data/dist/chunks/_weekday_stacked-CvcuQyr9.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-D5R1BjUn.js +29 -0
- data/dist/chunks/{pb_form_validation-BioH7DWv.js → pb_form_validation-BZ2AVAi_.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/kit_base.rb +3 -3
- data/lib/playbook/version.rb +2 -2
- metadata +47 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
- data/dist/chunks/_typeahead-D62OcwsT.js +0 -22
- data/dist/chunks/_weekday_stacked-Ceh9N0ow.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-CeKZrPmu.js +0 -29
@@ -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: "powerHomeRemodeling",
|
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: "talentAcquisition",
|
22
22
|
id: "talent1",
|
23
23
|
},
|
24
24
|
{
|
25
25
|
label: "Business Affairs",
|
26
|
-
value: "
|
26
|
+
value: "businessAffairs",
|
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: "learningAndDevelopment",
|
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: "peopleExperience",
|
48
48
|
id: "experience1",
|
49
49
|
},
|
50
50
|
],
|
51
51
|
},
|
52
52
|
{
|
53
53
|
label: "Contact Center",
|
54
|
-
value: "
|
54
|
+
value: "contactCenter",
|
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: "appointmentManagement",
|
62
62
|
id: "appointment1",
|
63
63
|
},
|
64
64
|
{
|
65
65
|
label: "Customer Service",
|
66
|
-
value: "
|
66
|
+
value: "customerService",
|
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: "powerHomeRemodeling",
|
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: "talentAcquisition",
|
17
17
|
id: "talent1",
|
18
18
|
},
|
19
19
|
{
|
20
20
|
label: "Business Affairs",
|
21
|
-
value: "
|
21
|
+
value: "businessAffairs",
|
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: "learningAndDevelopment",
|
32
32
|
id: "development1",
|
33
33
|
},
|
34
34
|
],
|
35
35
|
},
|
36
36
|
{
|
37
37
|
label: "People Experience",
|
38
|
-
value: "
|
38
|
+
value: "peopleExperience",
|
39
39
|
id: "experience1",
|
40
40
|
},
|
41
41
|
],
|
42
42
|
},
|
43
43
|
{
|
44
44
|
label: "Contact Center",
|
45
|
-
value: "
|
45
|
+
value: "contactCenter",
|
46
46
|
id: "contact1",
|
47
47
|
children: [
|
48
48
|
{
|
49
49
|
label: "Appointment Management",
|
50
|
-
value: "
|
50
|
+
value: "appointmentManagement",
|
51
51
|
id: "appointment1",
|
52
52
|
},
|
53
53
|
{
|
54
54
|
label: "Customer Service",
|
55
|
-
value: "
|
55
|
+
value: "customerService",
|
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,6 +41,16 @@ 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
|
+
|
44
54
|
return (
|
45
55
|
<div
|
46
56
|
{...ariaProps}
|
@@ -53,13 +63,13 @@ const Person = (props: PersonProps): React.ReactElement => {
|
|
53
63
|
className="pb_person_first"
|
54
64
|
tag="span"
|
55
65
|
>
|
56
|
-
{firstName}
|
66
|
+
{firstName ?? ''}
|
57
67
|
</Body>
|
58
68
|
{lastName &&
|
59
69
|
<Title
|
60
70
|
className="pb_person_first"
|
61
71
|
size={4}
|
62
|
-
text={` ${lastName}`}
|
72
|
+
text={lastName ? ` ${lastName}` : ''}
|
63
73
|
/>
|
64
74
|
}
|
65
75
|
</div>
|
@@ -42,7 +42,7 @@ $flag-min-resolution: 192dpi;
|
|
42
42
|
.iti__country-list {
|
43
43
|
min-width: $dropdown-min-width;
|
44
44
|
}
|
45
|
-
// iti-spacer-horizontal's default is 8px, or $space_xs
|
45
|
+
// iti-spacer-horizontal's default is 8px, or $space_xs
|
46
46
|
.iti__country-list .iti__flag, .iti__country-name {
|
47
47
|
margin-right: $space_xs;
|
48
48
|
}
|
@@ -60,7 +60,7 @@ $flag-min-resolution: 192dpi;
|
|
60
60
|
color: $focus_input_light;
|
61
61
|
}
|
62
62
|
|
63
|
-
.dropdown_open {
|
63
|
+
.dropdown_open:not(.error) {
|
64
64
|
.text_input {
|
65
65
|
border-color: $primary !important;
|
66
66
|
}
|
@@ -76,7 +76,7 @@ $flag-min-resolution: 192dpi;
|
|
76
76
|
}
|
77
77
|
|
78
78
|
.iti__divider {
|
79
|
-
border-bottom: 1px solid $border_light !important;
|
79
|
+
border-bottom: 1px solid $border_light !important;
|
80
80
|
}
|
81
81
|
|
82
82
|
.iti__selected-country-primary {
|
@@ -96,7 +96,7 @@ $flag-min-resolution: 192dpi;
|
|
96
96
|
justify-content: center;
|
97
97
|
align-items: center;
|
98
98
|
border-width: 0;
|
99
|
-
border-radius: $space_xxs;
|
99
|
+
border-radius: $space_xxs;
|
100
100
|
|
101
101
|
&[aria-expanded="true"] {
|
102
102
|
color: $primary_action;
|
@@ -199,7 +199,7 @@ $flag-min-resolution: 192dpi;
|
|
199
199
|
}
|
200
200
|
|
201
201
|
.iti__dropdown-content {
|
202
|
-
border-radius: $space_xs;
|
202
|
+
border-radius: $space_xs;
|
203
203
|
border: 1px solid $border_light !important;
|
204
204
|
position: absolute;
|
205
205
|
top: 100%;
|
@@ -228,13 +228,13 @@ $flag-min-resolution: 192dpi;
|
|
228
228
|
}
|
229
229
|
|
230
230
|
.iti__dropdown-content {
|
231
|
-
border-radius: $space_xs;
|
231
|
+
border-radius: $space_xs;
|
232
232
|
border: 1px solid $border_dark !important;
|
233
233
|
.iti__search-input {
|
234
234
|
background-color: $bg_dark_card;
|
235
235
|
&:hover {
|
236
236
|
background-color: $bg_dark_card;
|
237
|
-
}
|
237
|
+
}
|
238
238
|
&:active,
|
239
239
|
&:focus {
|
240
240
|
background-color: $card_dark;
|
@@ -243,7 +243,7 @@ $flag-min-resolution: 192dpi;
|
|
243
243
|
}
|
244
244
|
|
245
245
|
.iti__divider {
|
246
|
-
border-bottom: 1px solid $border_dark !important;
|
246
|
+
border-bottom: 1px solid $border_dark !important;
|
247
247
|
}
|
248
248
|
|
249
249
|
.iti__country-list {
|
@@ -278,7 +278,7 @@ $flag-min-resolution: 192dpi;
|
|
278
278
|
color: $white;
|
279
279
|
}
|
280
280
|
}
|
281
|
-
|
281
|
+
|
282
282
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
|
283
283
|
.iti__flag {
|
284
284
|
background-image: url("https://unpkg.com/intl-tel-input@24.6.0/build/img/flags@2x.png");
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
|
-
import { globalProps, globalInlineProps } from '../utilities/globalProps'
|
5
|
+
import { globalProps, globalInlineProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import Caption from '../pb_caption/_caption'
|
8
8
|
|
@@ -19,7 +19,7 @@ type SectionSeparatorProps = {
|
|
19
19
|
orientation?: "horizontal" | "vertical",
|
20
20
|
text?: string,
|
21
21
|
variant?: "card" | "background",
|
22
|
-
}
|
22
|
+
} & GlobalProps
|
23
23
|
|
24
24
|
const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
|
25
25
|
const {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= pb_rails("select", props: { label: "Favorite Animal" }) do %>
|
2
|
+
<select name="animal" id="animal">
|
3
|
+
<optgroup label="Mammal">
|
4
|
+
<option value="1">Cat</option>
|
5
|
+
<option value="2">Dog</option>
|
6
|
+
</optgroup>
|
7
|
+
<optgroup label="Amphibian">
|
8
|
+
<option value="3">Frog</option>
|
9
|
+
<option value="4">Salamander</option>
|
10
|
+
</optgroup>
|
11
|
+
</select>
|
12
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Select from '../_select'
|
4
|
+
|
5
|
+
const SelectCustomSelectSubheaders = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<Select
|
9
|
+
label="Favorite Animal"
|
10
|
+
{...props}
|
11
|
+
>
|
12
|
+
<select
|
13
|
+
id="animal"
|
14
|
+
name="animal"
|
15
|
+
{...props}
|
16
|
+
>
|
17
|
+
<optgroup label="Mammal">
|
18
|
+
<option value="1">{'Cat'}</option>
|
19
|
+
<option value="2">{'Dog'}</option>
|
20
|
+
</optgroup>
|
21
|
+
<optgroup label="Amphibian">
|
22
|
+
<option value="3">{'Frog'}</option>
|
23
|
+
<option value="4">{'Salamander'}</option>
|
24
|
+
</optgroup>
|
25
|
+
</select>
|
26
|
+
</Select>
|
27
|
+
</div>
|
28
|
+
)
|
29
|
+
}
|
30
|
+
|
31
|
+
export default SelectCustomSelectSubheaders
|
@@ -0,0 +1 @@
|
|
1
|
+
To create a select with non-selectable subheaders, use a Custom Select component to render a native `<select>` containing `<optgroup>` elements. The [optgroup HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/optgroup) groups related options under a non-selectable label in the dropdown.
|
@@ -8,6 +8,7 @@ examples:
|
|
8
8
|
- select_required: Required Select Field
|
9
9
|
- select_value_text_same: Equal option value and value text
|
10
10
|
- select_custom_select: Custom Select
|
11
|
+
- select_custom_select_subheaders: Custom Select Subheaders
|
11
12
|
- select_error: Select w/ Error
|
12
13
|
- select_inline: Select Inline
|
13
14
|
- select_inline_show_arrow: Select Inline (Always Show Arrow)
|
@@ -25,6 +26,7 @@ examples:
|
|
25
26
|
- select_required: Required Select Field
|
26
27
|
- select_value_text_same: Equal option value and value text
|
27
28
|
- select_custom_select: Custom Select
|
29
|
+
- select_custom_select_subheaders: Custom Select Subheaders
|
28
30
|
- select_error: Select w/ Error
|
29
31
|
- select_inline: Select Inline
|
30
32
|
- select_inline_show_arrow: Select Inline (Always Show Arrow)
|
@@ -11,3 +11,4 @@ export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.js
|
|
11
11
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
13
13
|
export { default as SelectReactHook } from './_select_react_hook.jsx'
|
14
|
+
export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
|
@@ -71,7 +71,8 @@
|
|
71
71
|
}
|
72
72
|
&.error {
|
73
73
|
.text_input_wrapper {
|
74
|
-
input
|
74
|
+
// The `:not` here prevents error styling from affecting the country search input in the Phone Number Input Kit.
|
75
|
+
input:not(.iti__search-input),
|
75
76
|
.text_input {
|
76
77
|
border-color: $error_dark;
|
77
78
|
}
|
@@ -102,7 +103,8 @@
|
|
102
103
|
[class*="pb_body_kit"] {
|
103
104
|
margin-top: $space_xs / 2;
|
104
105
|
}
|
105
|
-
input
|
106
|
+
// The `:not` here prevents error styling from affecting the country search input in the Phone Number Input Kit.
|
107
|
+
input:not(.iti__search-input),
|
106
108
|
.text_input {
|
107
109
|
border-color: $error;
|
108
110
|
}
|
@@ -29,6 +29,7 @@ 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
|
32
33
|
*/
|
33
34
|
|
34
35
|
type TypeaheadProps = {
|
@@ -54,6 +55,7 @@ type TypeaheadProps = {
|
|
54
55
|
optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
|
55
56
|
searchContextSelector?: string,
|
56
57
|
clearOnContextChange?: boolean,
|
58
|
+
preserveSearchInput?: boolean,
|
57
59
|
} & GlobalProps
|
58
60
|
|
59
61
|
export type SelectValueType = {
|
@@ -93,8 +95,44 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
93
95
|
optionsByContext = {},
|
94
96
|
searchContextSelector,
|
95
97
|
clearOnContextChange = false,
|
98
|
+
preserveSearchInput = false, // Default to false to maintain backward compatibility
|
96
99
|
...props
|
97
100
|
}: 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
|
+
|
98
136
|
const selectProps = {
|
99
137
|
cacheOptions: true,
|
100
138
|
components: {
|
@@ -124,11 +162,29 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
124
162
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
125
163
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
126
164
|
pillColor: pillColor,
|
165
|
+
...(preserveSearchInput ? { inputValue } : {}),
|
166
|
+
onInputChange: handleInputChange,
|
167
|
+
onBlur: handleBlur,
|
127
168
|
...props,
|
128
169
|
}
|
129
170
|
|
130
171
|
const [contextValue, setContextValue] = useState("")
|
131
172
|
|
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
|
+
|
132
188
|
useEffect(() => {
|
133
189
|
if (searchContextSelector) {
|
134
190
|
const searchContextElement = document.getElementById(searchContextSelector)
|
@@ -137,7 +193,12 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
137
193
|
const handleContextChange = (e: Event) => {
|
138
194
|
const target = e.target as HTMLInputElement;
|
139
195
|
setContextValue(target.value);
|
140
|
-
if (clearOnContextChange)
|
196
|
+
if (clearOnContextChange) {
|
197
|
+
document.dispatchEvent(new CustomEvent(`pb-typeahead-kit-${selectProps.id}:clear`))
|
198
|
+
if (preserveSearchInput) {
|
199
|
+
setInputValue('')
|
200
|
+
}
|
201
|
+
}
|
141
202
|
}
|
142
203
|
|
143
204
|
if (searchContextElement) searchContextElement.addEventListener('change', handleContextChange)
|
@@ -146,7 +207,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
146
207
|
if (searchContextElement) searchContextElement.removeEventListener('change', handleContextChange)
|
147
208
|
}
|
148
209
|
}
|
149
|
-
}, [searchContextSelector])
|
210
|
+
}, [searchContextSelector, clearOnContextChange, selectProps.id, preserveSearchInput])
|
150
211
|
|
151
212
|
const contextArray = optionsByContext[contextValue]
|
152
213
|
if (Array.isArray(contextArray) && contextArray.length > 0) {
|
@@ -168,7 +229,12 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
168
229
|
onChange(_data)
|
169
230
|
}
|
170
231
|
}
|
171
|
-
|
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
|
+
|
172
238
|
if (action === 'select-option') {
|
173
239
|
if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
|
174
240
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
|
@@ -181,6 +247,10 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
181
247
|
if (action === 'clear') {
|
182
248
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-clear`)
|
183
249
|
document.dispatchEvent(multiValueClearEvent)
|
250
|
+
// If preserving input on blur, also clear input on explicit clear
|
251
|
+
if (preserveSearchInput) {
|
252
|
+
setInputValue('')
|
253
|
+
}
|
184
254
|
}
|
185
255
|
}
|
186
256
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Typeahead from '../_typeahead'
|
4
|
+
|
5
|
+
const options = [
|
6
|
+
{ label: 'Orange', value: '#FFA500' },
|
7
|
+
{ label: 'Red', value: '#FF0000' },
|
8
|
+
{ label: 'Green', value: '#00FF00' },
|
9
|
+
{ label: 'Blue', value: '#0000FF' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const TypeaheadPreserveInput = (props) => {
|
13
|
+
return (
|
14
|
+
<Typeahead
|
15
|
+
label="Colors"
|
16
|
+
options={options}
|
17
|
+
preserveSearchInput
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
export default TypeaheadPreserveInput
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserveSearchInput` prop in order to prevent text from being cleared when the field loses focus
|
@@ -15,3 +15,4 @@ 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'
|