playbook_ui 13.26.0 → 13.27.0.pre.alpha.PLAY1122fixMultipleUserspaddingoverflow2844
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 +44 -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 +41 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.html.erb +71 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +77 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.html.erb +71 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +77 -0
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_default.jsx +20 -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.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.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.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +7 -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_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.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_dropdown/_dropdown.scss +1 -1
- 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 +25 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +19 -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 +152 -0
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +77 -0
- 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.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.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.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/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 +34 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_description.md +0 -1
@@ -0,0 +1,152 @@
|
|
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
|
+
if (option) {
|
41
|
+
const value = option.dataset.dropdownOptionLabel;
|
42
|
+
this.onOptionSelected(value, option);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
handleDocumentClick(event) {
|
47
|
+
if (this.isClickOutside(event) && this.target.classList.contains("open")) {
|
48
|
+
this.hideElement(this.target);
|
49
|
+
this.updateArrowDisplay(false);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
isClickOutside(event) {
|
54
|
+
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
55
|
+
if (customTrigger) {
|
56
|
+
return !customTrigger.contains(event.target);
|
57
|
+
} else {
|
58
|
+
const triggerElement = this.element.querySelector(TRIGGER_SELECTOR);
|
59
|
+
const containerElement =
|
60
|
+
this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
61
|
+
|
62
|
+
const isOutsideTrigger = triggerElement
|
63
|
+
? !triggerElement.contains(event.target)
|
64
|
+
: true;
|
65
|
+
const isOutsideContainer = containerElement
|
66
|
+
? !containerElement.contains(event.target)
|
67
|
+
: true;
|
68
|
+
|
69
|
+
return isOutsideTrigger && isOutsideContainer;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
onOptionSelected(value, selectedOption) {
|
74
|
+
const triggerElement = this.element.querySelector(
|
75
|
+
"#dropdown_trigger_display"
|
76
|
+
);
|
77
|
+
const customDisplayElement = this.element.querySelector(
|
78
|
+
"#dropdown_trigger_custom_display"
|
79
|
+
);
|
80
|
+
if (triggerElement) {
|
81
|
+
const selectedLabel = JSON.parse(value).label;
|
82
|
+
triggerElement.textContent = selectedLabel;
|
83
|
+
if (customDisplayElement) {
|
84
|
+
customDisplayElement.style.display = "block";
|
85
|
+
customDisplayElement.style.paddingRight = "8px";
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
90
|
+
if (customTrigger) {
|
91
|
+
if (this.target.classList.contains("open")) {
|
92
|
+
this.hideElement(this.target);
|
93
|
+
this.updateArrowDisplay(false);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
98
|
+
options.forEach((option) => {
|
99
|
+
option.classList.remove("pb_dropdown_option_selected");
|
100
|
+
});
|
101
|
+
selectedOption.classList.add("pb_dropdown_option_selected");
|
102
|
+
console.log(`Selected value: ${value}`);
|
103
|
+
}
|
104
|
+
|
105
|
+
get target() {
|
106
|
+
return this.element.parentNode.querySelector(CONTAINER_SELECTOR);
|
107
|
+
}
|
108
|
+
|
109
|
+
showElement(elem) {
|
110
|
+
elem.classList.remove("close");
|
111
|
+
elem.classList.add("open");
|
112
|
+
elem.style.height = elem.scrollHeight + "px";
|
113
|
+
}
|
114
|
+
|
115
|
+
hideElement(elem) {
|
116
|
+
elem.style.height = elem.scrollHeight + "px";
|
117
|
+
window.setTimeout(() => {
|
118
|
+
elem.classList.add("close");
|
119
|
+
elem.classList.remove("open");
|
120
|
+
this.resetFocus();
|
121
|
+
}, 0);
|
122
|
+
}
|
123
|
+
|
124
|
+
resetFocus() {
|
125
|
+
if (this.keyboardHandler) {
|
126
|
+
this.keyboardHandler.focusedOptionIndex = -1;
|
127
|
+
const options = this.element.querySelectorAll(OPTION_SELECTOR);
|
128
|
+
options.forEach((option) =>
|
129
|
+
option.classList.remove("pb_dropdown_option_focused")
|
130
|
+
);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
toggleElement(elem) {
|
135
|
+
if (elem.classList.contains("open")) {
|
136
|
+
this.hideElement(elem);
|
137
|
+
this.updateArrowDisplay(false);
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
this.showElement(elem);
|
141
|
+
this.updateArrowDisplay(true);
|
142
|
+
}
|
143
|
+
|
144
|
+
updateArrowDisplay(isOpen) {
|
145
|
+
const downArrow = this.element.querySelector(DOWN_ARROW_SELECTOR);
|
146
|
+
const upArrow = this.element.querySelector(UP_ARROW_SELECTOR);
|
147
|
+
if (downArrow && upArrow) {
|
148
|
+
downArrow.style.display = isOpen ? "none" : "inline-block";
|
149
|
+
upArrow.style.display = isOpen ? "inline-block" : "none";
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
@@ -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
|
+
}
|
@@ -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 %>
|
@@ -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
|
)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import LoadingInline from '../_loading_inline'
|
4
|
+
|
5
|
+
const LoadingInlineCustom = (props) => {
|
6
|
+
return (
|
7
|
+
<div>
|
8
|
+
<LoadingInline
|
9
|
+
text=' Saving'
|
10
|
+
{...props}
|
11
|
+
/>
|
12
|
+
<LoadingInline
|
13
|
+
align="center"
|
14
|
+
text=' Saving'
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
<LoadingInline
|
18
|
+
align="right"
|
19
|
+
text=' Saving'
|
20
|
+
{...props}
|
21
|
+
/>
|
22
|
+
</div>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export default LoadingInlineCustom
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
2
2
|
|
3
3
|
import LoadingInline from '../_loading_inline'
|
4
4
|
|
5
|
-
const
|
5
|
+
const LoadingInlineDefault = (props) => {
|
6
6
|
return (
|
7
7
|
<div>
|
8
8
|
<LoadingInline
|
@@ -20,4 +20,4 @@ const LoadingInlineLight = (props) => {
|
|
20
20
|
)
|
21
21
|
}
|
22
22
|
|
23
|
-
export default
|
23
|
+
export default LoadingInlineDefault
|
@@ -1 +1,2 @@
|
|
1
|
-
export { default as
|
1
|
+
export { default as LoadingInlineDefault } from './_loading_inline_default.jsx'
|
2
|
+
export { default as LoadingInlineCustom } from './_loading_inline_custom.jsx'
|
@@ -1,5 +1,10 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
6
|
+
|
2
7
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
3
|
-
<%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: "spinner", pulse: true }) %>
|
8
|
+
<%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: "spinner", pulse: true }) %> <%= object.text %>
|
4
9
|
<% end %>
|
5
10
|
<% end %>
|
@@ -39,3 +39,17 @@ test('should render aria-label', () => {
|
|
39
39
|
const kit = screen.getByTestId(testId)
|
40
40
|
expect(kit).toHaveAttribute('aria-label', testId)
|
41
41
|
})
|
42
|
+
|
43
|
+
|
44
|
+
test('displays custom text content', () => {
|
45
|
+
render(
|
46
|
+
<LoadingInline
|
47
|
+
aria={{ label: testId }}
|
48
|
+
data={{ testid: testId }}
|
49
|
+
text=' Saving'
|
50
|
+
/>
|
51
|
+
)
|
52
|
+
|
53
|
+
const kit = screen.getByTestId(testId)
|
54
|
+
expect(kit).toHaveTextContent('Saving')
|
55
|
+
})
|