playbook_ui 13.26.0 → 13.27.0.pre.alpha.PBNTR294paginationstylingfix2899
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +14 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +14 -10
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +24 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/index.js +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +9 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +6 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +9 -4
- data/app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx +60 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +16 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +86 -21
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +26 -3
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +45 -0
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +47 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +51 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +56 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +51 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +58 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.md +3 -0
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_avatar/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_background/background.html.erb +11 -2
- data/app/pb_kits/playbook/pb_badge/badge.html.erb +6 -1
- data/app/pb_kits/playbook/pb_body/_body.scss +3 -0
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +7 -2
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +3 -3
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.html.erb +7 -2
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +5 -0
- data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
- data/app/pb_kits/playbook/pb_card/card.rb +1 -1
- data/app/pb_kits/playbook/pb_card/card_body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/card_header.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.html.erb +20 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +41 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_content.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +7 -1
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -2
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +7 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_detail/_detail_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +7 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -2
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +3 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +4 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.html.erb +17 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.html.erb +60 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.html.erb +45 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +17 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.html.erb +47 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +9 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +26 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +21 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +19 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +27 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +22 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +43 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +30 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +153 -0
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +77 -0
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +4 -2
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +6 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +5 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +6 -1
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -2
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +15 -0
- data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +6 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +7 -2
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_pill/label_pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.html.erb +6 -1
- data/app/pb_kits/playbook/pb_layout/body.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/footer.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/layout.html.erb +5 -1
- data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +5 -1
- data/app/pb_kits/playbook/pb_list/item.html.erb +8 -2
- data/app/pb_kits/playbook/pb_list/list.html.erb +8 -2
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +3 -1
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_custom.html.erb +13 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_custom.jsx +26 -0
- data/app/pb_kits/playbook/pb_loading_inline/docs/{_loading_inline_light.html.erb → _loading_inline_default.html.erb} +2 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/{_loading_inline_light.jsx → _loading_inline_default.jsx} +2 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +4 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +7 -2
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +1 -0
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.test.js +14 -0
- data/app/pb_kits/playbook/pb_message/message.html.erb +6 -1
- data/app/pb_kits/playbook/pb_message/message_mention.html.erb +6 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +8 -0
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +6 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +14 -3
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +6 -1
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -2
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +1 -1
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +6 -1
- data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -1
- data/app/pb_kits/playbook/pb_person/person.html.erb +12 -7
- data/app/pb_kits/playbook/pb_person_contact/person_contact.html.erb +6 -1
- data/app/pb_kits/playbook/pb_pill/pill.html.erb +6 -1
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +6 -2
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +6 -3
- data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +8 -2
- data/app/pb_kits/playbook/pb_section_separator/section_separator.html.erb +6 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +5 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +5 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +4 -1
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +5 -1
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +6 -1
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +6 -1
- data/app/pb_kits/playbook/pb_source/source.html.erb +5 -1
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +5 -1
- data/app/pb_kits/playbook/pb_stat_value/stat_value.html.erb +5 -1
- data/app/pb_kits/playbook/pb_table/table.html.erb +12 -2
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +16 -6
- data/app/pb_kits/playbook/pb_table/table_cell.html.erb +16 -6
- data/app/pb_kits/playbook/pb_table/table_head.html.erb +16 -6
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +13 -4
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +16 -6
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time/time.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +7 -3
- data/app/pb_kits/playbook/pb_timeline/timeline.html.erb +5 -1
- data/app/pb_kits/playbook/pb_timestamp/timestamp.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -1
- data/app/pb_kits/playbook/pb_title/title.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title_count/title_count.html.erb +6 -1
- data/app/pb_kits/playbook/pb_title_detail/title_detail.html.erb +5 -1
- data/app/pb_kits/playbook/pb_toggle/toggle.html.erb +6 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +5 -1
- data/app/pb_kits/playbook/pb_user/user.html.erb +6 -1
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +6 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/weekday_stacked.html.erb +6 -1
- data/app/pb_kits/playbook/playbook-rails.js +6 -0
- data/app/pb_kits/playbook/tokens/_titles.scss +5 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/kit_base.rb +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +36 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_description.md +0 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbDropdown
|
5
|
+
class DropdownOption < Playbook::KitBase
|
6
|
+
prop :option, type: Playbook::Props::String
|
7
|
+
prop :id, type: Playbook::Props::String
|
8
|
+
|
9
|
+
def data
|
10
|
+
Hash(prop(:data)).merge("dropdown_option_label": option)
|
11
|
+
end
|
12
|
+
|
13
|
+
def padding_helper
|
14
|
+
" p_xs"
|
15
|
+
end
|
16
|
+
|
17
|
+
def classname
|
18
|
+
generate_classname("pb_dropdown_option", "list") + padding_helper
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
7
|
+
<% if content.present? %>
|
8
|
+
<div style="display: inline-block" tabindex="0" data-dropdown-custom-trigger>
|
9
|
+
<%= content.presence %>
|
10
|
+
</div>
|
11
|
+
<% else %>
|
12
|
+
<%= pb_rails("flex", props: {
|
13
|
+
align: "center",
|
14
|
+
border_radius:"lg",
|
15
|
+
classname: object.trigger_wrapper_classes,
|
16
|
+
cursor: "pointer",
|
17
|
+
justify: "between",
|
18
|
+
padding_x:"sm",
|
19
|
+
padding_y:"xs",
|
20
|
+
html_options: {tabindex:"0"}
|
21
|
+
}) do %>
|
22
|
+
<%= pb_rails("flex/flex_item") do %>
|
23
|
+
<%= pb_rails("flex", props: {align: "center"}) do %>
|
24
|
+
<% if object.custom_display.present? %>
|
25
|
+
<%= pb_rails("flex", props: {align: "center"}) do %>
|
26
|
+
<div id="dropdown_trigger_custom_display" style="display: none;">
|
27
|
+
<%= object.custom_display %>
|
28
|
+
</div>
|
29
|
+
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
30
|
+
<% end %>
|
31
|
+
<% else %>
|
32
|
+
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<%= pb_rails("body", props: {display: "flex"}) do %>
|
37
|
+
<%= pb_rails("icon", props: {icon: "chevron-down", cursor: "pointer", size:"sm", id: "dropdown_open_icon"}) %>
|
38
|
+
<%= pb_rails("icon", props: {icon: "chevron-up", cursor: "pointer", size:"sm", id: "dropdown_close_icon"}) %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbDropdown
|
5
|
+
class DropdownTrigger < Playbook::KitBase
|
6
|
+
prop :options, type: Playbook::Props::Array,
|
7
|
+
default: []
|
8
|
+
prop :id, type: Playbook::Props::String,
|
9
|
+
default: ""
|
10
|
+
prop :placeholder, type: Playbook::Props::String
|
11
|
+
prop :custom_display
|
12
|
+
|
13
|
+
def data
|
14
|
+
Hash(prop(:data)).merge(dropdown_trigger: true)
|
15
|
+
end
|
16
|
+
|
17
|
+
def classname
|
18
|
+
generate_classname("pb_dropdown_trigger")
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_display_placeholder
|
22
|
+
placeholder || "Select..."
|
23
|
+
end
|
24
|
+
|
25
|
+
def trigger_wrapper_classes
|
26
|
+
generate_classname("dropdown_trigger_wrapper", "select_only")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
+
import { PbDropdownKeyboard } from "./keyboard_accessibility";
|
3
|
+
|
4
|
+
const DROPDOWN_SELECTOR = "[data-pb-dropdown]";
|
5
|
+
const TRIGGER_SELECTOR = "[data-dropdown-trigger]";
|
6
|
+
const CONTAINER_SELECTOR = "[data-dropdown-container]";
|
7
|
+
const DOWN_ARROW_SELECTOR = "#dropdown_open_icon";
|
8
|
+
const UP_ARROW_SELECTOR = "#dropdown_close_icon";
|
9
|
+
const OPTION_SELECTOR = "[data-dropdown-option-label]";
|
10
|
+
const CUSTOM_DISPLAY_SELECTOR = "[data-dropdown-custom-trigger]";
|
11
|
+
|
12
|
+
export default class PbDropdown extends PbEnhancedElement {
|
13
|
+
static get selector() {
|
14
|
+
return DROPDOWN_SELECTOR;
|
15
|
+
}
|
16
|
+
|
17
|
+
connect() {
|
18
|
+
this.keyboardHandler = new PbDropdownKeyboard(this);
|
19
|
+
this.bindEventListeners();
|
20
|
+
this.updateArrowDisplay(false);
|
21
|
+
}
|
22
|
+
|
23
|
+
bindEventListeners() {
|
24
|
+
const customTrigger =
|
25
|
+
this.element.querySelector(CUSTOM_DISPLAY_SELECTOR) || this.element;
|
26
|
+
customTrigger.addEventListener("click", () =>
|
27
|
+
this.toggleElement(this.target)
|
28
|
+
);
|
29
|
+
|
30
|
+
this.target.addEventListener("click", this.handleOptionClick.bind(this));
|
31
|
+
document.addEventListener(
|
32
|
+
"click",
|
33
|
+
this.handleDocumentClick.bind(this),
|
34
|
+
true
|
35
|
+
);
|
36
|
+
}
|
37
|
+
|
38
|
+
handleOptionClick(event) {
|
39
|
+
const option = event.target.closest(OPTION_SELECTOR);
|
40
|
+
const hiddenInput = this.element.querySelector("#dropdown-selected-option");
|
41
|
+
if (option) {
|
42
|
+
const value = option.dataset.dropdownOptionLabel;
|
43
|
+
hiddenInput.value = JSON.parse(value).id;
|
44
|
+
this.onOptionSelected(value, option);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
handleDocumentClick(event) {
|
49
|
+
if (this.isClickOutside(event) && this.target.classList.contains("open")) {
|
50
|
+
this.hideElement(this.target);
|
51
|
+
this.updateArrowDisplay(false);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
isClickOutside(event) {
|
56
|
+
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
57
|
+
if (customTrigger) {
|
58
|
+
return !customTrigger.contains(event.target);
|
59
|
+
} else {
|
60
|
+
const triggerElement = this.element.querySelector(TRIGGER_SELECTOR);
|
61
|
+
const containerElement =
|
62
|
+
this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
63
|
+
|
64
|
+
const isOutsideTrigger = triggerElement
|
65
|
+
? !triggerElement.contains(event.target)
|
66
|
+
: true;
|
67
|
+
const isOutsideContainer = containerElement
|
68
|
+
? !containerElement.contains(event.target)
|
69
|
+
: true;
|
70
|
+
|
71
|
+
return isOutsideTrigger && isOutsideContainer;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
onOptionSelected(value, selectedOption) {
|
76
|
+
const triggerElement = this.element.querySelector(
|
77
|
+
"#dropdown_trigger_display"
|
78
|
+
);
|
79
|
+
const customDisplayElement = this.element.querySelector(
|
80
|
+
"#dropdown_trigger_custom_display"
|
81
|
+
);
|
82
|
+
if (triggerElement) {
|
83
|
+
const selectedLabel = JSON.parse(value).label;
|
84
|
+
triggerElement.textContent = selectedLabel;
|
85
|
+
if (customDisplayElement) {
|
86
|
+
customDisplayElement.style.display = "block";
|
87
|
+
customDisplayElement.style.paddingRight = "8px";
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
92
|
+
if (customTrigger) {
|
93
|
+
if (this.target.classList.contains("open")) {
|
94
|
+
this.hideElement(this.target);
|
95
|
+
this.updateArrowDisplay(false);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
100
|
+
options.forEach((option) => {
|
101
|
+
option.classList.remove("pb_dropdown_option_selected");
|
102
|
+
});
|
103
|
+
selectedOption.classList.add("pb_dropdown_option_selected");
|
104
|
+
}
|
105
|
+
|
106
|
+
get target() {
|
107
|
+
return this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
108
|
+
}
|
109
|
+
|
110
|
+
showElement(elem) {
|
111
|
+
elem.classList.remove("close");
|
112
|
+
elem.classList.add("open");
|
113
|
+
elem.style.height = elem.scrollHeight + "px";
|
114
|
+
}
|
115
|
+
|
116
|
+
hideElement(elem) {
|
117
|
+
elem.style.height = elem.scrollHeight + "px";
|
118
|
+
window.setTimeout(() => {
|
119
|
+
elem.classList.add("close");
|
120
|
+
elem.classList.remove("open");
|
121
|
+
this.resetFocus();
|
122
|
+
}, 0);
|
123
|
+
}
|
124
|
+
|
125
|
+
resetFocus() {
|
126
|
+
if (this.keyboardHandler) {
|
127
|
+
this.keyboardHandler.focusedOptionIndex = -1;
|
128
|
+
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
129
|
+
options.forEach((option) =>
|
130
|
+
option.classList.remove("pb_dropdown_option_focused")
|
131
|
+
);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
toggleElement(elem) {
|
136
|
+
if (elem.classList.contains("open")) {
|
137
|
+
this.hideElement(elem);
|
138
|
+
this.updateArrowDisplay(false);
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
this.showElement(elem);
|
142
|
+
this.updateArrowDisplay(true);
|
143
|
+
}
|
144
|
+
|
145
|
+
updateArrowDisplay(isOpen) {
|
146
|
+
const downArrow = this.element.querySelector(DOWN_ARROW_SELECTOR);
|
147
|
+
const upArrow = this.element.querySelector(UP_ARROW_SELECTOR);
|
148
|
+
if (downArrow && upArrow) {
|
149
|
+
downArrow.style.display = isOpen ? "none" : "inline-block";
|
150
|
+
upArrow.style.display = isOpen ? "inline-block" : "none";
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
const OPTION_SELECTOR = "[data-dropdown-option-label]";
|
2
|
+
export class PbDropdownKeyboard {
|
3
|
+
constructor(dropdown) {
|
4
|
+
this.dropdown = dropdown;
|
5
|
+
this.dropdownElement = dropdown.element;
|
6
|
+
this.options = Array.from(
|
7
|
+
this.dropdownElement.querySelectorAll(OPTION_SELECTOR)
|
8
|
+
);
|
9
|
+
this.focusedOptionIndex = -1;
|
10
|
+
this.init();
|
11
|
+
}
|
12
|
+
|
13
|
+
init() {
|
14
|
+
this.dropdownElement.addEventListener(
|
15
|
+
"keydown",
|
16
|
+
this.handleKeyDown.bind(this)
|
17
|
+
);
|
18
|
+
}
|
19
|
+
|
20
|
+
handleKeyDown(event) {
|
21
|
+
switch (event.key) {
|
22
|
+
case "ArrowDown":
|
23
|
+
event.preventDefault();
|
24
|
+
if (!this.dropdown.target.classList.contains("open")) {
|
25
|
+
this.dropdown.showElement(this.dropdown.target);
|
26
|
+
this.dropdown.updateArrowDisplay(true);
|
27
|
+
}
|
28
|
+
this.moveFocus(1);
|
29
|
+
break;
|
30
|
+
case "ArrowUp":
|
31
|
+
event.preventDefault();
|
32
|
+
this.moveFocus(-1);
|
33
|
+
break;
|
34
|
+
case "Enter":
|
35
|
+
event.preventDefault();
|
36
|
+
if (this.focusedOptionIndex !== -1) {
|
37
|
+
this.selectOption();
|
38
|
+
} else {
|
39
|
+
if (!this.dropdown.target.classList.contains("open")) {
|
40
|
+
this.dropdown.showElement(this.dropdown.target);
|
41
|
+
this.dropdown.updateArrowDisplay(true);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
break;
|
45
|
+
case "Escape":
|
46
|
+
this.dropdown.hideElement(this.dropdown.target);
|
47
|
+
break;
|
48
|
+
case "Tab":
|
49
|
+
this.dropdown.hideElement(this.dropdown.target);
|
50
|
+
this.dropdown.updateArrowDisplay(false);
|
51
|
+
this.resetFocus();
|
52
|
+
break;
|
53
|
+
default:
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
moveFocus(direction) {
|
59
|
+
if (this.focusedOptionIndex !== -1) {
|
60
|
+
this.options[this.focusedOptionIndex].classList.remove(
|
61
|
+
"pb_dropdown_option_focused"
|
62
|
+
);
|
63
|
+
}
|
64
|
+
this.focusedOptionIndex =
|
65
|
+
(this.focusedOptionIndex + direction + this.options.length) %
|
66
|
+
this.options.length;
|
67
|
+
this.options[this.focusedOptionIndex].classList.add(
|
68
|
+
"pb_dropdown_option_focused"
|
69
|
+
);
|
70
|
+
}
|
71
|
+
|
72
|
+
selectOption() {
|
73
|
+
const option = this.options[this.focusedOptionIndex];
|
74
|
+
this.dropdown.onOptionSelected(option.dataset.dropdownOptionLabel, option);
|
75
|
+
this.dropdown.hideElement(this.dropdown.target);
|
76
|
+
}
|
77
|
+
}
|
@@ -50,8 +50,10 @@ const DropdownOption = (props: DropdownOptionProps) => {
|
|
50
50
|
selected,
|
51
51
|
} = useContext(DropdownContext);
|
52
52
|
|
53
|
-
const isItemMatchingFilter = (option: GenericObject) =>
|
54
|
-
option
|
53
|
+
const isItemMatchingFilter = (option: GenericObject) => {
|
54
|
+
const label = typeof option.label === 'string' ? option.label.toLowerCase() : option.label;
|
55
|
+
return String(label).toLowerCase().includes(filterItem.toLowerCase());
|
56
|
+
}
|
55
57
|
|
56
58
|
if (!isItemMatchingFilter(option)) {
|
57
59
|
return null;
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag("div",
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("form_group", props: {cursor: "pointer", full_width: object.full_width}) do %>
|
3
8
|
<label for="upload-<%= object.id %>" class="pb_button_kit_secondary_inline_enabled"><%= "#{object.label}" %></label>
|
4
9
|
<%= pb_rails("text_input", props: {
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
<%= object.wrapper do %>
|
3
7
|
<%= pb_rails("flex", props: { orientation: "row", padding_right: "lg", vertical: "center" }) do %>
|
4
8
|
<% if (object.template != "sort_only") %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
3
8
|
|
4
9
|
<% if content %>
|
@@ -33,6 +33,17 @@
|
|
33
33
|
outline-offset: -1px;
|
34
34
|
}
|
35
35
|
}
|
36
|
+
.text_input_wrapper_add_on .add-on-right [class^=pb_card_kit] {
|
37
|
+
border-bottom-right-radius: 0;
|
38
|
+
border-top-right-radius: 0;
|
39
|
+
border-right-width: 0;
|
40
|
+
}
|
41
|
+
.text_input_wrapper_add_on .add-on-right.border_left_on .card-right-aligned {
|
42
|
+
border-left: 1px $border_light solid;
|
43
|
+
&.dark {
|
44
|
+
border-left: 1px rgba($white, 0.15) solid;
|
45
|
+
}
|
46
|
+
}
|
36
47
|
}
|
37
48
|
|
38
49
|
& > [class^=pb_text_input_kit]:not(:first-child) {
|
@@ -40,6 +51,10 @@
|
|
40
51
|
border-bottom-left-radius: 0;
|
41
52
|
border-top-left-radius: 0;
|
42
53
|
}
|
54
|
+
.text_input_wrapper_add_on .add-on-left [class^=pb_card_kit] {
|
55
|
+
border-bottom-left-radius: 0;
|
56
|
+
border-top-left-radius: 0;
|
57
|
+
}
|
43
58
|
}
|
44
59
|
|
45
60
|
& > [class^=pb_button_kit]:not(:last-child) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, **combined_html_options) do %>
|
2
2
|
<% if object.name.present? %>
|
3
3
|
<%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
|
4
4
|
<%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:span,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= link_to object.url, target: object.link_option do %>
|
3
8
|
<%= pb_rails("badge", props: { dark: object.dark, variant: "primary", text: object.hashtag_text }) %>
|
4
9
|
<% end %>
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
<%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %>
|
3
7
|
<% end %>
|
4
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
-
<%=
|
2
|
-
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
7
|
+
<%= pb_rails("icon", props: { dark: object.dark, icon: object.icon, fixed_width: true }) %>
|
3
8
|
<% end %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
3
8
|
<%= pb_rails("icon", props: { icon: object.icon, fixed_width: true }) %>
|
4
9
|
<%= object.text %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("caption", props: { text: object.label, classname: "pb_label_pill_label"}) %>
|
3
8
|
<%= pb_rails("pill", props: { text: object.pill_value, variant: object.variant, classname: "pb_label_pill_pill" }) %>
|
4
9
|
<% end %>
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
|
3
8
|
<% if object.variant == "details" %>
|
4
9
|
<%= pb_rails("flex", props: {inline: true, vertical: "center"}) do %>
|
@@ -1,4 +1,10 @@
|
|
1
|
-
<%=
|
2
|
-
|
1
|
+
<%= content_tag(:li,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
tabindex: object.tabindex,
|
7
|
+
**combined_html_options
|
8
|
+
) do %>
|
3
9
|
<%= content.presence %>
|
4
10
|
<% end %>
|
@@ -1,7 +1,13 @@
|
|
1
1
|
<%= content_tag(:div, class: object.list_classname) do %>
|
2
|
-
<%=
|
2
|
+
<%= content_tag(:"#{object.ordered_class}",
|
3
|
+
aria: object.aria,
|
4
|
+
class: object.classname,
|
5
|
+
data: object.data,
|
6
|
+
id: object.id,
|
3
7
|
role: object.role,
|
4
|
-
tabindex: object.tabindex
|
8
|
+
tabindex: object.tabindex,
|
9
|
+
**combined_html_options
|
10
|
+
) do %>
|
5
11
|
<%= content.presence %>
|
6
12
|
<% end %>
|
7
13
|
<% end %>
|
@@ -14,6 +14,7 @@ type LoadingInlineProps = {
|
|
14
14
|
data?: { [key: string]: string },
|
15
15
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
16
16
|
id?: string,
|
17
|
+
text?: string,
|
17
18
|
}
|
18
19
|
|
19
20
|
const LoadingInline = (props: LoadingInlineProps) => {
|
@@ -24,6 +25,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
24
25
|
data = {},
|
25
26
|
htmlOptions = {},
|
26
27
|
id,
|
28
|
+
text = ' Loading',
|
27
29
|
} = props
|
28
30
|
|
29
31
|
const ariaProps = buildAriaProps(aria)
|
@@ -50,7 +52,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
50
52
|
icon="spinner"
|
51
53
|
pulse
|
52
54
|
/>
|
53
|
-
{
|
55
|
+
{text}
|
54
56
|
</Body>
|
55
57
|
</div>
|
56
58
|
)
|