playbook_ui 14.18.0.pre.alpha.play2042addturbosupporttopopoverkit7423 → 14.18.0.pre.alpha.play2149overlaykitdynamicbug7619
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +304 -21
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +3 -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 +6 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -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 +228 -11
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -2
- 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 +64 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +55 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +1 -0
- 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 +4 -1
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +9 -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 +141 -142
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +33 -5
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +5 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -16
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +5 -2
- 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_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 +7 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +4 -0
- 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 +12 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +57 -0
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +26 -0
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +1 -2
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +4 -4
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +22 -18
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +110 -0
- 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_phone_number_input/_phone_number_input.scss +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +20 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +19 -0
- 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/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/docs/_typeahead_error_state.html.erb +8 -1
- data/dist/chunks/_typeahead-Bc1SPP0-.js +22 -0
- data/dist/chunks/_weekday_stacked-DDrCiip0.js +45 -0
- data/dist/chunks/{lib-ClNg0TLS.js → lib-BmTAc7Nc.js} +1 -1
- data/dist/chunks/{pb_form_validation-Btrgnox1.js → pb_form_validation-BWjy4bFn.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +42 -17
- 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/dist/chunks/_typeahead-COZRQUuU.js +0 -22
- data/dist/chunks/_weekday_stacked-BRT0ul9R.js +0 -45
- /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_colors.md → _draggable_drop_zones_colors_react.md} +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_drop_zones.md → _draggable_drop_zones_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_event_listeners.md → _draggable_event_listeners_rails.md} +0 -0
|
@@ -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
|
})
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
<%= pb_content_tag do %>
|
|
2
|
+
<% if object.searchbar %>
|
|
3
|
+
<%= pb_rails("text_input", props: {padding_top:"xs", padding_x:"xs"}) do %>
|
|
4
|
+
<input
|
|
5
|
+
type="text"
|
|
6
|
+
placeholder="Search…"
|
|
7
|
+
data-dropdown-search
|
|
8
|
+
autocomplete="off"
|
|
9
|
+
/>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
2
12
|
<%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
|
|
3
13
|
<% if content.present? %>
|
|
4
14
|
<%= content.presence %>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
align: "center",
|
|
9
9
|
border_radius:"lg",
|
|
10
10
|
classname: object.trigger_wrapper_classes,
|
|
11
|
-
cursor: "pointer",
|
|
11
|
+
cursor: object.autocomplete ? "text" : "pointer",
|
|
12
12
|
justify: "between",
|
|
13
13
|
padding_x:"sm",
|
|
14
14
|
padding_y:"xs",
|
|
@@ -24,7 +24,17 @@
|
|
|
24
24
|
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
|
25
25
|
<% end %>
|
|
26
26
|
<% else %>
|
|
27
|
-
|
|
27
|
+
<% if object.autocomplete %>
|
|
28
|
+
<input
|
|
29
|
+
data-dropdown-autocomplete
|
|
30
|
+
class="dropdown_input"
|
|
31
|
+
type="text"
|
|
32
|
+
placeholder="<%= object.placeholder || 'Select…' %>"
|
|
33
|
+
autocomplete="off"
|
|
34
|
+
/>
|
|
35
|
+
<% else %>
|
|
36
|
+
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
|
37
|
+
<% end %>
|
|
28
38
|
<% end %>
|
|
29
39
|
<% end %>
|
|
30
40
|
<% end %>
|
|
@@ -9,6 +9,8 @@ module Playbook
|
|
|
9
9
|
default: ""
|
|
10
10
|
prop :placeholder, type: Playbook::Props::String
|
|
11
11
|
prop :custom_display
|
|
12
|
+
prop :autocomplete, type: Playbook::Props::Boolean,
|
|
13
|
+
default: false
|
|
12
14
|
|
|
13
15
|
def data
|
|
14
16
|
Hash(prop(:data)).merge(dropdown_trigger: true, dropdown_placeholder: default_display_placeholder)
|
|
@@ -23,7 +25,7 @@ module Playbook
|
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
def trigger_wrapper_classes
|
|
26
|
-
generate_classname("dropdown_trigger_wrapper", "select_only")
|
|
28
|
+
generate_classname("dropdown_trigger_wrapper", ("select_only" unless autocomplete))
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
end
|
|
@@ -11,6 +11,8 @@ const CUSTOM_DISPLAY_SELECTOR = "[data-dropdown-custom-trigger]";
|
|
|
11
11
|
const DROPDOWN_TRIGGER_DISPLAY = "#dropdown_trigger_display";
|
|
12
12
|
const DROPDOWN_PLACEHOLDER = "[data-dropdown-placeholder]";
|
|
13
13
|
const DROPDOWN_INPUT = "#dropdown-selected-option";
|
|
14
|
+
const SEARCH_INPUT_SELECTOR = "[data-dropdown-autocomplete]";
|
|
15
|
+
const SEARCH_BAR_SELECTOR = "[data-dropdown-search]";
|
|
14
16
|
|
|
15
17
|
export default class PbDropdown extends PbEnhancedElement {
|
|
16
18
|
static get selector() {
|
|
@@ -25,9 +27,11 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
25
27
|
this.keyboardHandler = new PbDropdownKeyboard(this);
|
|
26
28
|
this.setDefaultValue();
|
|
27
29
|
this.bindEventListeners();
|
|
30
|
+
this.bindSearchInput();
|
|
28
31
|
this.updateArrowDisplay(false);
|
|
29
32
|
this.handleFormValidation();
|
|
30
33
|
this.handleFormReset();
|
|
34
|
+
this.bindSearchBar();
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
bindEventListeners() {
|
|
@@ -45,6 +49,53 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
45
49
|
);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
bindSearchBar() {
|
|
53
|
+
this.searchBar = this.element.querySelector(SEARCH_BAR_SELECTOR);
|
|
54
|
+
if (!this.searchBar) return;
|
|
55
|
+
|
|
56
|
+
this.searchBar.addEventListener("input", (e) =>
|
|
57
|
+
this.handleSearch(e.target.value)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
bindSearchInput() {
|
|
62
|
+
this.searchInput = this.element.querySelector(SEARCH_INPUT_SELECTOR);
|
|
63
|
+
if (!this.searchInput) return;
|
|
64
|
+
|
|
65
|
+
// Focus the input when anyone clicks the wrapper
|
|
66
|
+
this.element
|
|
67
|
+
.querySelector(TRIGGER_SELECTOR)
|
|
68
|
+
?.addEventListener("click", () => this.searchInput.focus());
|
|
69
|
+
|
|
70
|
+
// Live filter
|
|
71
|
+
this.searchInput.addEventListener("input", (e) =>
|
|
72
|
+
this.handleSearch(e.target.value)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
handleSearch(term = "") {
|
|
77
|
+
const lcTerm = term.toLowerCase();
|
|
78
|
+
this.element.querySelectorAll(OPTION_SELECTOR).forEach((opt) => {
|
|
79
|
+
const label = JSON.parse(opt.dataset.dropdownOptionLabel).label
|
|
80
|
+
.toString()
|
|
81
|
+
.toLowerCase();
|
|
82
|
+
|
|
83
|
+
// hide or show option
|
|
84
|
+
const match = label.includes(lcTerm);
|
|
85
|
+
opt.style.display = match ? "" : "none";
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (this.target.classList.contains("open")) {
|
|
89
|
+
const el = this.target;
|
|
90
|
+
el.style.height = "auto";
|
|
91
|
+
requestAnimationFrame(() => {
|
|
92
|
+
const newHeight = el.scrollHeight + "px";
|
|
93
|
+
el.offsetHeight; // force reflow
|
|
94
|
+
el.style.height = newHeight;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
48
99
|
handleOptionClick(event) {
|
|
49
100
|
const option = event.target.closest(OPTION_SELECTOR);
|
|
50
101
|
const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
|
|
@@ -59,6 +110,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
59
110
|
}
|
|
60
111
|
|
|
61
112
|
handleDocumentClick(event) {
|
|
113
|
+
if (event.target.closest(SEARCH_BAR_SELECTOR)) return;
|
|
62
114
|
if (this.isClickOutside(event) && this.target.classList.contains("open")) {
|
|
63
115
|
this.hideElement(this.target);
|
|
64
116
|
this.updateArrowDisplay(false);
|
|
@@ -99,6 +151,11 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
99
151
|
}
|
|
100
152
|
}
|
|
101
153
|
|
|
154
|
+
const autocompleteInput = this.element.querySelector(SEARCH_INPUT_SELECTOR);
|
|
155
|
+
if (autocompleteInput){
|
|
156
|
+
autocompleteInput.value = JSON.parse(value).label;
|
|
157
|
+
}
|
|
158
|
+
|
|
102
159
|
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
|
103
160
|
if (customTrigger) {
|
|
104
161
|
if (this.target.classList.contains("open")) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const OPTION_SELECTOR = "[data-dropdown-option-label]";
|
|
2
|
+
const SEARCH_INPUT_SELECTOR = "[data-dropdown-autocomplete]";
|
|
3
|
+
|
|
2
4
|
export class PbDropdownKeyboard {
|
|
3
5
|
constructor(dropdown) {
|
|
4
6
|
this.dropdown = dropdown;
|
|
@@ -7,6 +9,9 @@ export class PbDropdownKeyboard {
|
|
|
7
9
|
this.dropdownElement.querySelectorAll(OPTION_SELECTOR)
|
|
8
10
|
);
|
|
9
11
|
this.focusedOptionIndex = -1;
|
|
12
|
+
this.searchInput = this.dropdownElement.querySelector(
|
|
13
|
+
SEARCH_INPUT_SELECTOR
|
|
14
|
+
);
|
|
10
15
|
this.init();
|
|
11
16
|
}
|
|
12
17
|
|
|
@@ -15,6 +20,18 @@ export class PbDropdownKeyboard {
|
|
|
15
20
|
"keydown",
|
|
16
21
|
this.handleKeyDown.bind(this)
|
|
17
22
|
);
|
|
23
|
+
if (this.searchInput) {
|
|
24
|
+
this.searchInput.addEventListener("input", () =>
|
|
25
|
+
this.openDropdownIfClosed()
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
openDropdownIfClosed() {
|
|
31
|
+
if (!this.dropdown.target.classList.contains("open")) {
|
|
32
|
+
this.dropdown.showElement(this.dropdown.target);
|
|
33
|
+
this.dropdown.updateArrowDisplay(true);
|
|
34
|
+
}
|
|
18
35
|
}
|
|
19
36
|
|
|
20
37
|
handleKeyDown(event) {
|
|
@@ -50,6 +67,15 @@ export class PbDropdownKeyboard {
|
|
|
50
67
|
this.dropdown.updateArrowDisplay(false);
|
|
51
68
|
this.resetFocus();
|
|
52
69
|
break;
|
|
70
|
+
case "Backspace":
|
|
71
|
+
if (this.searchInput) {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
if (this.searchInput.value.trim() === "") {
|
|
74
|
+
this.dropdown.resetDropdownValue();
|
|
75
|
+
}
|
|
76
|
+
}, 0);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
53
79
|
default:
|
|
54
80
|
break;
|
|
55
81
|
}
|
|
@@ -46,7 +46,6 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
|
46
46
|
inputRef,
|
|
47
47
|
isDropDownClosed,
|
|
48
48
|
setFocusedOptionIndex,
|
|
49
|
-
triggerRef
|
|
50
49
|
} = useContext(DropdownContext);
|
|
51
50
|
|
|
52
51
|
const ariaProps = buildAriaProps(aria);
|
|
@@ -67,7 +66,7 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
|
67
66
|
id={id}
|
|
68
67
|
onMouseEnter={() => setFocusedOptionIndex(-1)}
|
|
69
68
|
ref={dropdownContainerRef}
|
|
70
|
-
style={
|
|
69
|
+
style={{ position: "absolute"}}
|
|
71
70
|
>
|
|
72
71
|
{searchbar && (
|
|
73
72
|
<TextInput dark={dark}
|
|
@@ -53,7 +53,6 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
53
53
|
selected,
|
|
54
54
|
setIsInputFocused,
|
|
55
55
|
toggleDropdown,
|
|
56
|
-
triggerRef,
|
|
57
56
|
} = useContext(DropdownContext);
|
|
58
57
|
|
|
59
58
|
const handleKeyDown = useHandleOnKeyDown();
|
|
@@ -99,7 +98,6 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
99
98
|
id={id}
|
|
100
99
|
>
|
|
101
100
|
{
|
|
102
|
-
!triggerRef && (
|
|
103
101
|
children ? (
|
|
104
102
|
<div
|
|
105
103
|
onClick={() => toggleDropdown()}
|
|
@@ -147,7 +145,10 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
147
145
|
<input
|
|
148
146
|
className="dropdown_input"
|
|
149
147
|
onChange={handleChange}
|
|
150
|
-
onClick={() =>
|
|
148
|
+
onClick={(e) => {
|
|
149
|
+
e.stopPropagation();// keep the wrapper’s handler from firing
|
|
150
|
+
toggleDropdown();
|
|
151
|
+
}}
|
|
151
152
|
onFocus={() => setIsInputFocused(true)}
|
|
152
153
|
onKeyDown={handleKeyDown}
|
|
153
154
|
placeholder={
|
|
@@ -181,7 +182,6 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
181
182
|
</Flex>
|
|
182
183
|
</>
|
|
183
184
|
)
|
|
184
|
-
)
|
|
185
185
|
}
|
|
186
186
|
</div>
|
|
187
187
|
);
|
|
@@ -23,35 +23,39 @@
|
|
|
23
23
|
@mixin error-state-right-side-select-kit {
|
|
24
24
|
&:has(.pb_text_input_kit:not(.error)):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error),
|
|
25
25
|
&:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.pb_select_kit_wrapper {
|
|
29
|
-
padding-top: $space_md;
|
|
30
|
-
margin-top: 2px;
|
|
26
|
+
&:not(:has(.pb_phone_number_input)) {
|
|
27
|
+
align-items: flex-start;
|
|
31
28
|
|
|
32
|
-
.
|
|
29
|
+
.pb_select_kit_wrapper {
|
|
33
30
|
padding-top: $space_md;
|
|
31
|
+
margin-top: 2px;
|
|
32
|
+
|
|
33
|
+
.pb_select_kit_caret {
|
|
34
|
+
padding-top: $space_md;
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
|
-
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
.pb_select_kit_wrapper.error {
|
|
39
|
+
padding-top: $space_md;
|
|
40
|
+
margin-top: 2px;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
.pb_select_kit_caret {
|
|
43
|
+
padding-top: $space_xl;
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
@mixin error-state-left-side-select-kit {
|
|
49
|
-
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.
|
|
50
|
-
|
|
51
|
+
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_text_input_kit.error) {
|
|
52
|
+
&:not(:has(.pb_phone_number_input)) {
|
|
53
|
+
align-items: flex-start;
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
.pb_text_input_kit.error {
|
|
56
|
+
padding-top: $space_md;
|
|
57
|
+
margin-top: 2px;
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
|
-
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import lineGraphTheme from '../lineGraphTheme'
|
|
3
|
+
import Highcharts from "highcharts"
|
|
4
|
+
import HighchartsReact from "highcharts-react-official"
|
|
5
|
+
|
|
6
|
+
const data = [{
|
|
7
|
+
name: 'Installation',
|
|
8
|
+
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],
|
|
9
|
+
}, {
|
|
10
|
+
name: 'Manufacturing',
|
|
11
|
+
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434],
|
|
12
|
+
}, {
|
|
13
|
+
name: 'Sales & Distribution',
|
|
14
|
+
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387],
|
|
15
|
+
}, {
|
|
16
|
+
name: 'Project Development',
|
|
17
|
+
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227],
|
|
18
|
+
}, {
|
|
19
|
+
name: 'Other',
|
|
20
|
+
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111],
|
|
21
|
+
}]
|
|
22
|
+
|
|
23
|
+
const categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
24
|
+
|
|
25
|
+
const baseOptions = {
|
|
26
|
+
series: data,
|
|
27
|
+
title: { text: "Solar Employment Growth by Sector, 2010-2016" },
|
|
28
|
+
subtitle: { text: "Source: thesolarfoundation.com" },
|
|
29
|
+
xAxis: {
|
|
30
|
+
categories: categories,
|
|
31
|
+
},
|
|
32
|
+
yAxis: {
|
|
33
|
+
title: {
|
|
34
|
+
text: "Number of Employees",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const LineGraphPbStyles = () => {
|
|
40
|
+
const options = Highcharts.merge({}, lineGraphTheme, baseOptions)
|
|
41
|
+
|
|
42
|
+
return(
|
|
43
|
+
<div>
|
|
44
|
+
<HighchartsReact
|
|
45
|
+
highcharts={Highcharts}
|
|
46
|
+
options={options}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default LineGraphPbStyles
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You don't need to use the Line Graph Kit to apply Playbook styles to your Highcharts line graph. Just import lineGraphTheme.ts and merge it with your graph options—Playbook’s styling will apply automatically.
|
|
@@ -4,3 +4,4 @@ export { default as LineGraphLegendPosition } from './_line_graph_legend_positio
|
|
|
4
4
|
export { default as LineGraphLegendNonclickable } from './_line_graph_legend_nonclickable.jsx'
|
|
5
5
|
export { default as LineGraphHeight } from './_line_graph_height.jsx'
|
|
6
6
|
export { default as LineGraphColors } from './_line_graph_colors.jsx'
|
|
7
|
+
export { default as LineGraphPbStyles } from './_line_graph_pb_styles.jsx'
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import colors from '../tokens/exports/_colors.module.scss'
|
|
2
|
+
import typography from '../tokens/exports/_typography.module.scss'
|
|
3
|
+
|
|
4
|
+
const lineGraphTheme = {
|
|
5
|
+
title: {
|
|
6
|
+
text: "",
|
|
7
|
+
style: {
|
|
8
|
+
color: colors.text_lt_default,
|
|
9
|
+
fontFamily: typography.font_family_base,
|
|
10
|
+
fontWeight: typography.bold,
|
|
11
|
+
fontSize: typography.heading_3,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
subtitle: {
|
|
15
|
+
text: "" ,
|
|
16
|
+
style: {
|
|
17
|
+
fontFamily: typography.font_family_base,
|
|
18
|
+
color: colors.text_lt_light,
|
|
19
|
+
fontWeight: typography.regular,
|
|
20
|
+
fontSize: typography.text_base,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
chart: {
|
|
24
|
+
type: "line",
|
|
25
|
+
},
|
|
26
|
+
tooltip: {
|
|
27
|
+
backgroundColor: {
|
|
28
|
+
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
|
29
|
+
stops: [
|
|
30
|
+
[0, colors.bg_dark],
|
|
31
|
+
[1, colors.bg_dark],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
followPointer: true,
|
|
35
|
+
shadow: false,
|
|
36
|
+
borderWidth: 0,
|
|
37
|
+
borderRadius: 10,
|
|
38
|
+
style: {
|
|
39
|
+
fontFamily: typography.font_family_base,
|
|
40
|
+
color: colors.text_dk_default,
|
|
41
|
+
fontWeight: typography.regular,
|
|
42
|
+
fontSize: typography.text_smaller,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
plotOptions: {
|
|
46
|
+
line: {
|
|
47
|
+
dataLabels: {
|
|
48
|
+
enabled: false,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
credits: { enabled: false },
|
|
53
|
+
legend: { enabled: false },
|
|
54
|
+
colors: [
|
|
55
|
+
colors.data_1,
|
|
56
|
+
colors.data_2,
|
|
57
|
+
colors.data_3,
|
|
58
|
+
colors.data_4,
|
|
59
|
+
colors.data_5,
|
|
60
|
+
colors.data_6,
|
|
61
|
+
colors.data_7,
|
|
62
|
+
],
|
|
63
|
+
xAxis: {
|
|
64
|
+
gridLineWidth: 0,
|
|
65
|
+
lineColor: colors.border_light,
|
|
66
|
+
tickColor: colors.border_light,
|
|
67
|
+
labels: {
|
|
68
|
+
style: {
|
|
69
|
+
fontFamily: typography.font_family_base,
|
|
70
|
+
color: colors.text_lt_lighter,
|
|
71
|
+
fontWeight: typography.bold,
|
|
72
|
+
fontSize: typography.text_smaller,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
title: {
|
|
76
|
+
style: {
|
|
77
|
+
color: colors.text_lt_default,
|
|
78
|
+
fontFamily: typography.font_family_base,
|
|
79
|
+
fontWeight: typography.regular,
|
|
80
|
+
fontSize: typography.heading_4,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
yAxis: {
|
|
85
|
+
alternateGridColor: undefined as string | undefined,
|
|
86
|
+
minorTickInterval: null as number | null,
|
|
87
|
+
gridLineColor: colors.border_light,
|
|
88
|
+
minorGridLineColor: colors.border_light,
|
|
89
|
+
lineWidth: 0,
|
|
90
|
+
tickWidth: 0,
|
|
91
|
+
labels: {
|
|
92
|
+
style: {
|
|
93
|
+
fontFamily: typography.font_family_base,
|
|
94
|
+
color: colors.text_lt_lighter,
|
|
95
|
+
fontWeight: typography.bold,
|
|
96
|
+
fontSize: typography.text_smaller,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
title: {
|
|
100
|
+
style: {
|
|
101
|
+
fontFamily: typography.font_family_base,
|
|
102
|
+
color: colors.text_lt_lighter,
|
|
103
|
+
fontWeight: typography.bold,
|
|
104
|
+
fontSize: typography.text_smaller,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default lineGraphTheme;
|
|
@@ -78,7 +78,8 @@ $overlay_colors: (
|
|
|
78
78
|
&.overlay-hide-scrollbar {
|
|
79
79
|
& [class*="overflow_x_auto"],
|
|
80
80
|
& [class*="overflow_y_auto"],
|
|
81
|
-
& [class*="overflow_auto"]
|
|
81
|
+
& [class*="overflow_auto"],
|
|
82
|
+
.overlay_token_container {
|
|
82
83
|
&::-webkit-scrollbar {
|
|
83
84
|
display: none !important;
|
|
84
85
|
}
|
|
@@ -30,7 +30,7 @@ const OverlayToken = (props: OverlayChildrenProps) => {
|
|
|
30
30
|
if (container) {
|
|
31
31
|
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
32
32
|
const atStart = scrollLeft === 0;
|
|
33
|
-
const atEnd = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
33
|
+
const atEnd = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
34
34
|
|
|
35
35
|
setIsAtStart(atStart);
|
|
36
36
|
setIsAtEnd(atEnd);
|
|
@@ -64,16 +64,17 @@ const OverlayToken = (props: OverlayChildrenProps) => {
|
|
|
64
64
|
return (
|
|
65
65
|
<>
|
|
66
66
|
<div className={dynamic ? isAtStart ? '' : previousOverlayClassName : previousOverlayClassName} />
|
|
67
|
-
{dynamic ?
|
|
67
|
+
{dynamic ?
|
|
68
68
|
<div
|
|
69
|
+
className="overlay_token_container"
|
|
69
70
|
ref={scrollContainerRef}
|
|
70
71
|
style={{
|
|
71
|
-
overflowX: 'auto',
|
|
72
|
+
overflowX: 'auto',
|
|
72
73
|
}}
|
|
73
74
|
>
|
|
74
75
|
{children}
|
|
75
76
|
</div>
|
|
76
|
-
:
|
|
77
|
+
:
|
|
77
78
|
children
|
|
78
79
|
}
|
|
79
80
|
{hasSubsequentOverlay &&
|
|
@@ -39,6 +39,9 @@ $flag-min-resolution: 192dpi;
|
|
|
39
39
|
color: $charcoal;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.iti__country-list {
|
|
43
|
+
min-width: $dropdown-min-width;
|
|
44
|
+
}
|
|
42
45
|
// iti-spacer-horizontal's default is 8px, or $space_xs
|
|
43
46
|
.iti__country-list .iti__flag, .iti__country-name {
|
|
44
47
|
margin-right: $space_xs;
|
|
@@ -227,6 +230,16 @@ $flag-min-resolution: 192dpi;
|
|
|
227
230
|
.iti__dropdown-content {
|
|
228
231
|
border-radius: $space_xs;
|
|
229
232
|
border: 1px solid $border_dark !important;
|
|
233
|
+
.iti__search-input {
|
|
234
|
+
background-color: $bg_dark_card;
|
|
235
|
+
&:hover {
|
|
236
|
+
background-color: $bg_dark_card;
|
|
237
|
+
}
|
|
238
|
+
&:active,
|
|
239
|
+
&:focus {
|
|
240
|
+
background-color: $card_dark;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
230
243
|
}
|
|
231
244
|
|
|
232
245
|
.iti__divider {
|
|
@@ -37,6 +37,7 @@ type PhoneNumberInputProps = {
|
|
|
37
37
|
required?: boolean,
|
|
38
38
|
value?: string,
|
|
39
39
|
formatAsYouType?: boolean,
|
|
40
|
+
countrySearch?: boolean,
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
enum ValidationError {
|
|
@@ -91,6 +92,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
|
91
92
|
preferredCountries = [],
|
|
92
93
|
value = "",
|
|
93
94
|
formatAsYouType = false,
|
|
95
|
+
countrySearch = false,
|
|
94
96
|
} = props
|
|
95
97
|
|
|
96
98
|
const ariaProps = buildAriaProps(aria)
|
|
@@ -242,7 +244,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
|
242
244
|
autoInsertDialCode: false,
|
|
243
245
|
initialCountry: initialCountry || fallbackCountry,
|
|
244
246
|
onlyCountries,
|
|
245
|
-
countrySearch:
|
|
247
|
+
countrySearch: countrySearch,
|
|
246
248
|
fixDropdownWidth: false,
|
|
247
249
|
formatAsYouType: formatAsYouType,
|
|
248
250
|
hiddenInput: hiddenInputs ? () => ({
|