playbook_ui 14.19.0.pre.rc.2 → 14.20.0.pre.alpha.PLAY21817891
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/_playbook.scss +0 -1
- 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 +6 -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 +5 -7
- 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_selectable_rows_no_subrows_rails.md +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.jsx → _advanced_table_selectable_rows_no_subrows_react.jsx} +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +9 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +106 -0
- data/app/pb_kits/playbook/pb_advanced_table/index.js +370 -10
- 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_body.rb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -2
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +4 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +3 -0
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +3 -3
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +2 -0
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +18 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_grayscale.html.erb +5 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_grayscale.jsx +16 -0
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_avatar/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +12 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +22 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.html.erb +55 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line_rails.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_rails.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners.jsx +59 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_event_listeners_react.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +11 -1
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +11 -1
- data/app/pb_kits/playbook/pb_draggable/index.js +4 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +33 -5
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +6 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +82 -35
- 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_error.html.erb +5 -2
- 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_autocomplete.html.erb +28 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +17 -64
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +58 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_autocomplete_and_custom_display.jsx → _dropdown_with_autocomplete_with_subcomponents.jsx} +11 -25
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.md +1 -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/_dropdown_with_external_control.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +61 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.md +2 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +52 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.md +2 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +18 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +7 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +20 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +45 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +3 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +37 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +5 -1
- data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/index.js +380 -17
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +64 -11
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +3 -4
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +16 -12
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +83 -17
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +58 -0
- data/app/pb_kits/playbook/pb_empty_state/_empty_state.scss +8 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.html.erb +27 -0
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.html.erb +7 -0
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.html.erb +12 -0
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.html.erb +23 -0
- data/app/pb_kits/playbook/pb_empty_state/docs/example.yml +5 -1
- data/app/pb_kits/playbook/pb_empty_state/empty_state.html.erb +19 -0
- data/app/pb_kits/playbook/pb_empty_state/empty_state.rb +123 -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_message/_message.tsx +3 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_grayscale.html.erb +9 -0
- data/app/pb_kits/playbook/pb_message/docs/_message_grayscale.jsx +21 -0
- data/app/pb_kits/playbook/pb_message/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_message/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_message/message.html.erb +2 -1
- data/app/pb_kits/playbook/pb_message/message.rb +1 -0
- 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_overlay/_overlay.scss +2 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx +1 -1
- data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +5 -4
- 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/_select.scss +10 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_error.html.erb +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +7 -7
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -5
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +4 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.html.erb +1 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.html.erb +5 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +73 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.html.erb +8 -1
- 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/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_grayscale.html.erb +6 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_grayscale.jsx +16 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +2 -1
- data/app/pb_kits/playbook/pb_user/user.rb +1 -0
- data/dist/chunks/_typeahead-BmOWdDtp.js +22 -0
- data/dist/chunks/_weekday_stacked-CvcuQyr9.js +45 -0
- data/dist/chunks/lib-D5R1BjUn.js +29 -0
- data/dist/chunks/{pb_form_validation-BWjy4bFn.js → pb_form_validation-BZ2AVAi_.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +6 -14
- 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 +76 -22
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_hook.jsx +0 -79
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.scss +0 -3
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +0 -72
- data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +0 -53
- data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gantt_chart/gantt_chart.test.jsx +0 -19
- data/dist/chunks/_typeahead-D8CsVBZO.js +0 -22
- data/dist/chunks/_weekday_stacked-D3oLTSkH.js +0 -45
- data/dist/chunks/lib-BmTAc7Nc.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_react.md → _advanced_table_selectable_rows.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.html.erb → _advanced_table_selectable_rows_no_subrows_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.html.erb → _advanced_table_selectable_rows_rails.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_line.md → _draggable_drop_zones_line_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_event_listeners.md → _draggable_event_listeners_rails.md} +0 -0
@@ -1,86 +1,39 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
|
3
3
|
import Dropdown from '../../pb_dropdown/_dropdown'
|
4
|
-
import Badge from '../../pb_badge/_badge'
|
5
|
-
import FlexItem from '../../pb_flex/_flex_item'
|
6
|
-
import User from '../../pb_user/_user'
|
7
4
|
|
8
5
|
const DropdownWithAutocomplete = (props) => {
|
9
6
|
|
10
7
|
const options = [
|
11
8
|
{
|
12
|
-
label: "
|
13
|
-
value: "
|
14
|
-
|
15
|
-
|
16
|
-
id: "
|
17
|
-
status: "Offline"
|
9
|
+
label: "United States",
|
10
|
+
value: "United States",
|
11
|
+
areaCode: "+1",
|
12
|
+
icon: "🇺🇸",
|
13
|
+
id: "us"
|
18
14
|
},
|
19
15
|
{
|
20
|
-
label: "
|
21
|
-
value: "
|
22
|
-
|
23
|
-
|
24
|
-
id: "
|
25
|
-
status: "Away"
|
16
|
+
label: "United Kingdom",
|
17
|
+
value: "United Kingdom",
|
18
|
+
areaCode: "+44",
|
19
|
+
icon: "🇬🇧",
|
20
|
+
id: "gb"
|
26
21
|
},
|
27
22
|
{
|
28
|
-
label: "
|
29
|
-
value: "
|
30
|
-
|
31
|
-
|
32
|
-
id: "
|
33
|
-
status: "Online"
|
34
|
-
},
|
35
|
-
{
|
36
|
-
label: "Courtney Long",
|
37
|
-
value: "Courtney Long",
|
38
|
-
territory: "PHL",
|
39
|
-
title: "Lead UX Designer",
|
40
|
-
id: "courtney-long",
|
41
|
-
status: "Online"
|
23
|
+
label: "Pakistan",
|
24
|
+
value: "Pakistan",
|
25
|
+
areaCode: "+92",
|
26
|
+
icon: "🇵🇰",
|
27
|
+
id: "pk"
|
42
28
|
}
|
43
|
-
]
|
44
|
-
|
29
|
+
]
|
45
30
|
|
46
31
|
return (
|
47
32
|
<div>
|
48
33
|
<Dropdown autocomplete
|
49
34
|
options={options}
|
50
35
|
{...props}
|
51
|
-
|
52
|
-
{options.map((option) => (
|
53
|
-
<Dropdown.Option key={option.id}
|
54
|
-
option={option}
|
55
|
-
>
|
56
|
-
<>
|
57
|
-
<FlexItem>
|
58
|
-
<User
|
59
|
-
align="left"
|
60
|
-
avatar
|
61
|
-
name={option.label}
|
62
|
-
orientation="horizontal"
|
63
|
-
territory={option.territory}
|
64
|
-
title={option.title}
|
65
|
-
/>
|
66
|
-
</FlexItem>
|
67
|
-
<FlexItem>
|
68
|
-
<Badge
|
69
|
-
rounded
|
70
|
-
text={option.status}
|
71
|
-
variant={`${
|
72
|
-
option.status === "Offline"
|
73
|
-
? "neutral"
|
74
|
-
: option.status === "Online"
|
75
|
-
? "success"
|
76
|
-
: "warning"
|
77
|
-
}`}
|
78
|
-
/>
|
79
|
-
</FlexItem>
|
80
|
-
</>
|
81
|
-
</Dropdown.Option>
|
82
|
-
))}
|
83
|
-
</Dropdown>
|
36
|
+
/>
|
84
37
|
</div>
|
85
38
|
)
|
86
39
|
}
|
data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{
|
4
|
+
label: "Jasper Furniss",
|
5
|
+
value: "Jasper Furniss",
|
6
|
+
territory: "PHL",
|
7
|
+
title: "Lead UX Engineer",
|
8
|
+
id: "jasper-furniss",
|
9
|
+
status: "Offline"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
label: "Ramon Ruiz",
|
13
|
+
value: "Ramon Ruiz",
|
14
|
+
territory: "PHL",
|
15
|
+
title: "Senior UX Designer",
|
16
|
+
id: "ramon-ruiz",
|
17
|
+
status: "Away"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
label: "Carlos Lima",
|
21
|
+
value: "Carlos Lima",
|
22
|
+
territory: "PHL",
|
23
|
+
title: "Nitro Developer",
|
24
|
+
id: "carlos-lima",
|
25
|
+
status: "Online"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
label: "Courtney Long",
|
29
|
+
value: "Courtney Long",
|
30
|
+
territory: "PHL",
|
31
|
+
title: "Lead UX Designer",
|
32
|
+
id: "courtney-long",
|
33
|
+
status: "Online"
|
34
|
+
}
|
35
|
+
];
|
36
|
+
|
37
|
+
%>
|
38
|
+
|
39
|
+
<%= pb_rails("dropdown", props: {options: options}) do %>
|
40
|
+
<%= pb_rails("dropdown/dropdown_trigger", props: {placeholder: "Search...", autocomplete: true}) %>
|
41
|
+
<%= pb_rails("dropdown/dropdown_container") do %>
|
42
|
+
<% options.each do |option| %>
|
43
|
+
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
44
|
+
<%= pb_rails("flex", props: {
|
45
|
+
align: "center",
|
46
|
+
justify: "between",
|
47
|
+
}) do %>
|
48
|
+
<%= pb_rails("flex/flex_item") do %>
|
49
|
+
<%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
|
50
|
+
<% end %>
|
51
|
+
<%= pb_rails("flex/flex_item") do %>
|
52
|
+
<%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
@@ -1,15 +1,13 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
|
3
|
-
import Dropdown from '
|
3
|
+
import Dropdown from '../_dropdown'
|
4
4
|
import Badge from '../../pb_badge/_badge'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
5
6
|
import FlexItem from '../../pb_flex/_flex_item'
|
6
|
-
import Avatar from '../../pb_avatar/_avatar'
|
7
7
|
import User from '../../pb_user/_user'
|
8
8
|
|
9
9
|
|
10
|
-
const
|
11
|
-
const [selectedOption, setSelectedOption] = useState();
|
12
|
-
|
10
|
+
const DropdownWithAutocompleteWithSubcomponents = (props) => {
|
13
11
|
const options = [
|
14
12
|
{
|
15
13
|
label: "Jasper Furniss",
|
@@ -45,34 +43,21 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
45
43
|
}
|
46
44
|
];
|
47
45
|
|
48
|
-
const CustomDisplay = () => {
|
49
|
-
return (
|
50
|
-
<>
|
51
|
-
{
|
52
|
-
selectedOption && (
|
53
|
-
<Avatar
|
54
|
-
name={selectedOption.label}
|
55
|
-
size="xs"
|
56
|
-
/>
|
57
|
-
)
|
58
|
-
}
|
59
|
-
</>
|
60
|
-
)
|
61
|
-
};
|
62
46
|
|
63
47
|
return (
|
64
48
|
<div>
|
65
49
|
<Dropdown autocomplete
|
66
|
-
onSelect={(selectedItem) => setSelectedOption(selectedItem)}
|
67
50
|
options={options}
|
68
51
|
{...props}
|
69
52
|
>
|
70
|
-
<Dropdown.Trigger customDisplay={<CustomDisplay/>} />
|
71
53
|
{options.map((option) => (
|
72
54
|
<Dropdown.Option key={option.id}
|
73
55
|
option={option}
|
74
56
|
>
|
75
|
-
|
57
|
+
<Flex
|
58
|
+
align="center"
|
59
|
+
justify="between"
|
60
|
+
>
|
76
61
|
<FlexItem>
|
77
62
|
<User
|
78
63
|
align="left"
|
@@ -85,6 +70,7 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
85
70
|
</FlexItem>
|
86
71
|
<FlexItem>
|
87
72
|
<Badge
|
73
|
+
dark
|
88
74
|
rounded
|
89
75
|
text={option.status}
|
90
76
|
variant={`${
|
@@ -96,7 +82,7 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
96
82
|
}`}
|
97
83
|
/>
|
98
84
|
</FlexItem>
|
99
|
-
|
85
|
+
</Flex>
|
100
86
|
</Dropdown.Option>
|
101
87
|
))}
|
102
88
|
</Dropdown>
|
@@ -104,4 +90,4 @@ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
|
|
104
90
|
)
|
105
91
|
}
|
106
92
|
|
107
|
-
export default
|
93
|
+
export default DropdownWithAutocompleteWithSubcomponents
|
@@ -0,0 +1 @@
|
|
1
|
+
`autocomplete` prop can also be used in conjunction with the subcomponent structure.
|
@@ -6,6 +6,7 @@ import Flex from '../../pb_flex/_flex'
|
|
6
6
|
import FlexItem from '../../pb_flex/_flex_item'
|
7
7
|
import Avatar from '../../pb_avatar/_avatar'
|
8
8
|
import User from '../../pb_user/_user'
|
9
|
+
import Body from '../../pb_body/_body'
|
9
10
|
|
10
11
|
const DropdownWithCustomDisplay = (props) => {
|
11
12
|
const [selectedOption, setSelectedOption] = useState();
|
@@ -50,10 +51,20 @@ const DropdownWithCustomDisplay = (props) => {
|
|
50
51
|
<>
|
51
52
|
{
|
52
53
|
selectedOption && (
|
54
|
+
<Flex align="center">
|
53
55
|
<Avatar
|
54
56
|
name={selectedOption.label}
|
55
57
|
size="xs"
|
56
58
|
/>
|
59
|
+
<Body
|
60
|
+
marginX="xs"
|
61
|
+
text={selectedOption.label}
|
62
|
+
/>
|
63
|
+
<Badge
|
64
|
+
text={selectedOption.status}
|
65
|
+
variant={selectedOption.status == "Offline" ? "neutral" : selectedOption.status == "Online" ? "success" : "warning"}
|
66
|
+
/>
|
67
|
+
</Flex>
|
57
68
|
)
|
58
69
|
}
|
59
70
|
</>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected.
|
1
|
+
Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `customDisplay` will display as the selected option.
|
2
2
|
|
3
3
|
The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
|
4
4
|
|
@@ -38,7 +38,11 @@
|
|
38
38
|
|
39
39
|
<%
|
40
40
|
custom_display = capture do
|
41
|
-
pb_rails("
|
41
|
+
pb_rails("flex", props: { align: "center" }) do
|
42
|
+
concat(pb_rails("avatar", props: { name: "", size: "xs", id: "dropdown-avatar" }))
|
43
|
+
concat(pb_rails("body", props: { text: "", size: "xs", margin_x: "xs", id: "dropdown-avatar-name" }))
|
44
|
+
concat(pb_rails("badge", props: { text: "", id: "dropdown-avatar-status" }))
|
45
|
+
end
|
42
46
|
end
|
43
47
|
%>
|
44
48
|
|
@@ -62,4 +66,31 @@
|
|
62
66
|
<% end %>
|
63
67
|
<% end %>
|
64
68
|
<% end %>
|
65
|
-
<% end %>
|
69
|
+
<% end %>
|
70
|
+
|
71
|
+
|
72
|
+
<script>
|
73
|
+
document.addEventListener("pb:dropdown:selected", (e) => {
|
74
|
+
const option = e.detail;
|
75
|
+
const dropdown = e.target;
|
76
|
+
|
77
|
+
const display = dropdown.querySelector("#dropdown_trigger_custom_display");
|
78
|
+
if (!display) return;
|
79
|
+
|
80
|
+
const nameEl = display.querySelector("#dropdown-avatar-name");
|
81
|
+
if (nameEl) nameEl.textContent = option.label;
|
82
|
+
|
83
|
+
const avatarEl = display.querySelector("#dropdown-avatar").querySelector(".avatar_wrapper");
|
84
|
+
const initials = (option.label[0] + option.label.split(" ").pop()[0]).toUpperCase();
|
85
|
+
if (avatarEl) {
|
86
|
+
avatarEl.dataset.name = option.label;
|
87
|
+
avatarEl.setAttribute("data-initials", initials);
|
88
|
+
}
|
89
|
+
const badgeEl = display.querySelector("#dropdown-avatar-status");
|
90
|
+
const variant = option.status === "Online" ? "success" : option.status === "Offline" ? "neutral" : "warning";
|
91
|
+
if (badgeEl) {
|
92
|
+
badgeEl.querySelector("span").textContent = option.status;
|
93
|
+
badgeEl.className = 'pb_badge_kit_' + variant;
|
94
|
+
}
|
95
|
+
});
|
96
|
+
</script>
|
@@ -1,4 +1,6 @@
|
|
1
|
-
Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected.
|
1
|
+
Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. Pass in any combination of kits to create a custom display. When a user clicks on an option, the kits passed into `custom_display` will display as the selected option.
|
2
|
+
|
3
|
+
Make use of a script to help set the custom_display with the correct value. By using the pb:dropdown:selected event listener, you can target the kits with a querySelector and update them dynamically with the values needed to match the selected option. Make sure to add an ID to the kits being passed in.
|
2
4
|
|
3
5
|
The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
|
4
6
|
|
@@ -0,0 +1 @@
|
|
1
|
+
The `useDropdown` hook can also be used to toggle the dropdown open and closed using an external control. To do so, you must manage state with the custom hook, pass the `dropdown:'pb-dropdown-trigger'` data attribute to the external control and use the `isClosed` prop as shown.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import Dropdown from '../../pb_dropdown/_dropdown'
|
3
|
+
import IconCircle from '../../pb_icon_circle/_icon_circle';
|
4
|
+
|
5
|
+
const DropdownWithSearch = (props) => {
|
6
|
+
const [selectedOption, setSelectedOption] = useState();
|
7
|
+
|
8
|
+
const options = [
|
9
|
+
{
|
10
|
+
label: "United States",
|
11
|
+
value: "United States",
|
12
|
+
icon: "🇺🇸",
|
13
|
+
id: "United-states"
|
14
|
+
|
15
|
+
},
|
16
|
+
{
|
17
|
+
label: "United Kingdom",
|
18
|
+
value: "United Kingdom",
|
19
|
+
icon: "🇬🇧",
|
20
|
+
id: "united-kingdom"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Pakistan",
|
24
|
+
value: "Pakistan",
|
25
|
+
icon: "🇵🇰",
|
26
|
+
id: "pakistan"
|
27
|
+
}
|
28
|
+
];
|
29
|
+
|
30
|
+
|
31
|
+
return (
|
32
|
+
<div>
|
33
|
+
<Dropdown
|
34
|
+
onSelect={(selectedItem) => setSelectedOption(selectedItem)}
|
35
|
+
options={options}
|
36
|
+
{...props}
|
37
|
+
>
|
38
|
+
<Dropdown.Trigger>
|
39
|
+
<div key={selectedOption ? selectedOption.icon : "flag"}>
|
40
|
+
<IconCircle
|
41
|
+
cursor="pointer"
|
42
|
+
icon={selectedOption ? selectedOption.icon : "flag"}
|
43
|
+
variant="royal"
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
</Dropdown.Trigger>
|
47
|
+
<Dropdown.Container maxWidth="xs"
|
48
|
+
searchbar
|
49
|
+
>
|
50
|
+
{options.map((option) => (
|
51
|
+
<Dropdown.Option key={option.id}
|
52
|
+
option={option}
|
53
|
+
/>
|
54
|
+
))}
|
55
|
+
</Dropdown.Container>
|
56
|
+
</Dropdown>
|
57
|
+
</div>
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
export default DropdownWithSearch
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{
|
4
|
+
label: "United States",
|
5
|
+
value: "United States",
|
6
|
+
areaCode: "+1",
|
7
|
+
icon: "🇺🇸",
|
8
|
+
id: "us"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
label: "United Kingdom",
|
12
|
+
value: "United Kingdom",
|
13
|
+
areaCode: "+44",
|
14
|
+
icon: "🇬🇧",
|
15
|
+
id: "gb"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
label: "Pakistan",
|
19
|
+
value: "Pakistan",
|
20
|
+
areaCode: "+92",
|
21
|
+
icon: "🇵🇰",
|
22
|
+
id: "pk"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
|
26
|
+
%>
|
27
|
+
|
28
|
+
<%= pb_rails("dropdown", props: {options: options}) do %>
|
29
|
+
<%= pb_rails("dropdown/dropdown_trigger") do %>
|
30
|
+
<%= pb_rails("icon_circle", props: {icon:"flag", cursor: "pointer", variant:"royal"}) %>
|
31
|
+
<% end %>
|
32
|
+
<%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs", searchbar: true}) do %>
|
33
|
+
<% options.each do |option| %>
|
34
|
+
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
|
35
|
+
<%= pb_rails("flex", props: {
|
36
|
+
align: "center",
|
37
|
+
justify: "between",
|
38
|
+
}) do %>
|
39
|
+
<%= pb_rails("flex/flex_item") do %>
|
40
|
+
<%= pb_rails("flex") do %>
|
41
|
+
<%= pb_rails("icon", props: {icon: option[:icon]}) %>
|
42
|
+
<%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<%= pb_rails("flex/flex_item") do %>
|
46
|
+
<%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
<% end %>
|
50
|
+
<% end %>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
@@ -1,34 +1,47 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
|
-
-
|
3
|
+
- dropdown_default_rails: Default
|
4
|
+
- dropdown_with_autocomplete: Autocomplete
|
5
|
+
- dropdown_multi_select_rails: Multi Select
|
6
|
+
- dropdown_multi_select_with_autocomplete: Multi Select with Autocomplete
|
7
|
+
- dropdown_multi_select_display_rails: Multi Select with Form Pill Props
|
4
8
|
- dropdown_subtle_variant: Subtle Variant
|
5
9
|
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
10
|
+
- dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
|
6
11
|
- dropdown_with_label: With Label
|
7
12
|
- dropdown_with_custom_options_rails: Custom Options
|
13
|
+
- dropdown_multi_select_with_custom_options: Multi Select with Custom Options
|
8
14
|
- dropdown_with_custom_display_rails: Custom Display
|
9
15
|
- dropdown_with_custom_trigger_rails: Custom Trigger
|
16
|
+
- dropdown_with_search_rails: Custom Trigger Dropdown with Search
|
10
17
|
- dropdown_with_custom_padding: Custom Option Padding
|
11
18
|
- dropdown_error: Dropdown with Error
|
12
19
|
- dropdown_default_value: Default Value
|
20
|
+
- dropdown_multi_select_with_default: Multi Select Default Value
|
13
21
|
- dropdown_blank_selection: Blank Selection
|
14
22
|
- dropdown_separators_hidden: Separators Hidden
|
15
23
|
|
16
24
|
react:
|
17
25
|
- dropdown_default: Default
|
26
|
+
- dropdown_with_autocomplete: Autocomplete
|
27
|
+
- dropdown_multi_select: Multi Select
|
28
|
+
- dropdown_multi_select_with_autocomplete: Multi Select with Autocomplete
|
29
|
+
- dropdown_multi_select_display: Multi Select with Form Pill Props
|
18
30
|
- dropdown_subtle_variant: Subtle Variant
|
19
31
|
- dropdown_subcomponent_structure: Subcomponent Structure
|
32
|
+
- dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
|
20
33
|
- dropdown_with_label: With Label
|
21
34
|
- dropdown_with_custom_options: Custom Options
|
35
|
+
- dropdown_multi_select_with_custom_options: Multi Select with Custom Options
|
22
36
|
- dropdown_with_custom_display: Custom Display
|
23
37
|
- dropdown_with_custom_trigger: Custom Trigger
|
38
|
+
- dropdown_with_search: Custom Trigger Dropdown with Search
|
24
39
|
- dropdown_with_custom_padding: Custom Option Padding
|
25
40
|
- dropdown_error: Dropdown with Error
|
26
41
|
- dropdown_default_value: Default Value
|
42
|
+
- dropdown_multi_select_with_default: Multi Select Default Value
|
27
43
|
- dropdown_blank_selection: Blank Selection
|
28
44
|
- dropdown_clear_selection: Clear Selection
|
29
45
|
- dropdown_separators_hidden: Separators Hidden
|
30
|
-
|
31
|
-
# - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
|
32
|
-
# - dropdown_with_external_control: useDropdown Hook
|
33
|
-
# - dropdown_with_hook: useDropdown Hook with Any Trigger
|
46
|
+
- dropdown_with_external_control: useDropdown Hook
|
34
47
|
|
@@ -3,11 +3,10 @@ export { default as DropdownWithCustomDisplay } from './_dropdown_with_custom_di
|
|
3
3
|
export { default as DropdownWithCustomOptions } from './_dropdown_with_custom_options.jsx'
|
4
4
|
export { default as DropdownWithCustomTrigger } from './_dropdown_with_custom_trigger.jsx'
|
5
5
|
export { default as DropdownWithAutocomplete } from './_dropdown_with_autocomplete.jsx'
|
6
|
-
export { default as
|
6
|
+
export { default as DropdownWithAutocompleteWithSubcomponents } from './_dropdown_with_autocomplete_with_subcomponents.jsx'
|
7
7
|
export { default as DropdownWithCustomPadding } from './_dropdown_with_custom_padding.jsx'
|
8
8
|
export { default as DropdownWithLabel } from './_dropdown_with_label.jsx'
|
9
9
|
export { default as DropdownWithExternalControl } from './_dropdown_with_external_control.jsx'
|
10
|
-
export { default as DropdownWithHook } from './_dropdown_with_hook.jsx'
|
11
10
|
export { default as DropdownSubcomponentStructure } from './_dropdown_subcomponent_structure.jsx'
|
12
11
|
export { default as DropdownError } from './_dropdown_error.jsx'
|
13
12
|
export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
|
@@ -15,3 +14,9 @@ export { default as DropdownBlankSelection } from './_dropdown_blank_selection.j
|
|
15
14
|
export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
|
16
15
|
export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
|
17
16
|
export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
|
17
|
+
export {default as DropdownWithSearch} from './_dropdown_with_search.jsx'
|
18
|
+
export { default as DropdownMultiSelect } from './_dropdown_multi_select.jsx'
|
19
|
+
export { default as DropdownMultiSelectDisplay } from './_dropdown_multi_select_display.jsx'
|
20
|
+
export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_multi_select_with_autocomplete.jsx'
|
21
|
+
export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
|
22
|
+
export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<input
|
7
7
|
data-default-value="<%= input_default_value %>"
|
8
8
|
id="dropdown-selected-option"
|
9
|
-
name="<%= object.name %>"
|
9
|
+
name="<%= object.name %><%= '[]' if object.multi_select %>"
|
10
10
|
style="display: none"
|
11
11
|
<%= object.required ? "required" : ""%>
|
12
12
|
/>
|
@@ -14,8 +14,8 @@
|
|
14
14
|
<%= content.presence %>
|
15
15
|
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
16
16
|
<% else %>
|
17
|
-
<%= pb_rails("dropdown/dropdown_trigger") %>
|
18
|
-
<%= pb_rails("dropdown/dropdown_container") do %>
|
17
|
+
<%= pb_rails("dropdown/dropdown_trigger", props:{ autocomplete: object.autocomplete, multi_select:object.multi_select }) %>
|
18
|
+
<%= pb_rails("dropdown/dropdown_container", props: { searchbar: object.searchbar }) do %>
|
19
19
|
<% if options_with_blank.present? %>
|
20
20
|
<% options_with_blank.each do |option| %>
|
21
21
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) %>
|
@@ -18,9 +18,21 @@ module Playbook
|
|
18
18
|
default: "default"
|
19
19
|
prop :separators, type: Playbook::Props::Boolean,
|
20
20
|
default: true
|
21
|
+
prop :autocomplete, type: Playbook::Props::Boolean,
|
22
|
+
default: false
|
23
|
+
prop :searchbar, type: Playbook::Props::Boolean,
|
24
|
+
default: false
|
25
|
+
prop :multi_select, type: Playbook::Props::Boolean,
|
26
|
+
default: false
|
27
|
+
prop :form_pill_props, type: Playbook::Props::HashProp,
|
28
|
+
default: {}
|
21
29
|
|
22
30
|
def data
|
23
|
-
Hash(prop(:data)).merge(
|
31
|
+
Hash(prop(:data)).merge(
|
32
|
+
pb_dropdown: true,
|
33
|
+
pb_dropdown_multi_select: multi_select,
|
34
|
+
form_pill_props: form_pill_props.to_json
|
35
|
+
)
|
24
36
|
end
|
25
37
|
|
26
38
|
def classname
|
@@ -34,7 +46,13 @@ module Playbook
|
|
34
46
|
end
|
35
47
|
|
36
48
|
def input_default_value
|
37
|
-
|
49
|
+
return "" unless default_value.present?
|
50
|
+
|
51
|
+
if multi_select
|
52
|
+
default_value.map { |v| v.transform_keys(&:to_s)["id"] }.join(",")
|
53
|
+
else
|
54
|
+
default_value.transform_keys(&:to_s)["id"]
|
55
|
+
end
|
38
56
|
end
|
39
57
|
|
40
58
|
def separators_class
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react"
|
2
2
|
import { render, screen } from "../utilities/test-utils"
|
3
3
|
|
4
|
-
import { Dropdown, Icon } from 'playbook-ui'
|
4
|
+
import { Dropdown, Icon, IconCircle } from 'playbook-ui'
|
5
5
|
|
6
6
|
|
7
7
|
const testId = 'dropdown'
|
@@ -219,4 +219,48 @@ test('show error message', () => {
|
|
219
219
|
|
220
220
|
const kit = screen.getByTestId(testId)
|
221
221
|
expect(kit).toHaveTextContent(errorMessage)
|
222
|
+
})
|
223
|
+
|
224
|
+
test("autocomplete prop to render input", () => {
|
225
|
+
render (
|
226
|
+
<Dropdown
|
227
|
+
autocomplete
|
228
|
+
data={{ testid: testId }}
|
229
|
+
options={options}
|
230
|
+
/>
|
231
|
+
)
|
232
|
+
|
233
|
+
const kit = screen.getByTestId(testId)
|
234
|
+
const input = kit.querySelector('.dropdown_input')
|
235
|
+
expect(input).toBeInTheDocument()
|
236
|
+
})
|
237
|
+
|
238
|
+
test("searchbar prop to render TextInput in container", () => {
|
239
|
+
render (
|
240
|
+
<Dropdown
|
241
|
+
data={{ testid: testId }}
|
242
|
+
options={options}
|
243
|
+
>
|
244
|
+
<Dropdown.Trigger>
|
245
|
+
<IconCircle
|
246
|
+
cursor="pointer"
|
247
|
+
icon="flag"
|
248
|
+
variant="royal"
|
249
|
+
/>
|
250
|
+
</Dropdown.Trigger>
|
251
|
+
<Dropdown.Container maxWidth="xs"
|
252
|
+
searchbar
|
253
|
+
>
|
254
|
+
{options.map((option) => (
|
255
|
+
<Dropdown.Option key={option.id}
|
256
|
+
option={option}
|
257
|
+
/>
|
258
|
+
))}
|
259
|
+
</Dropdown.Container>
|
260
|
+
</Dropdown>
|
261
|
+
)
|
262
|
+
|
263
|
+
const kit = screen.getByTestId(testId)
|
264
|
+
const searchbar = kit.querySelector('.pb_text_input_kit')
|
265
|
+
expect(searchbar).toBeInTheDocument()
|
222
266
|
})
|