playbook_ui 14.18.0.pre.alpha.dropdownautocomplete7493 → 14.18.0.pre.alpha.play1736highchartslinegraphdefaultrebuild7431
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 +21 -304
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows_react.jsx → _advanced_table_selectable_rows_no_subrows.jsx} +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +2 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -3
- data/app/pb_kits/playbook/pb_advanced_table/index.js +11 -228
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +1 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +1 -9
- data/app/pb_kits/playbook/pb_draggable/index.js +142 -139
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -5
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +16 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +2 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +64 -17
- data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_autocomplete_with_subcomponents.jsx → _dropdown_with_autocomplete_and_custom_display.jsx} +25 -11
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_hook.jsx +79 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -7
- 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 +0 -4
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -45
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +0 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +2 -12
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +1 -3
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -57
- data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +0 -26
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +2 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +4 -4
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +18 -22
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.js +49 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -13
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +0 -19
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_popover/index.ts +1 -13
- data/app/pb_kits/playbook/pb_popover/popover.rb +0 -2
- data/app/pb_kits/playbook/pb_select/docs/_select_error.html.erb +1 -1
- 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 +1 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_error_state.html.erb +1 -8
- data/dist/chunks/{_typeahead-D8CsVBZO.js → _typeahead-0GuhDCLl.js} +2 -2
- data/dist/chunks/_weekday_stacked-DGgA3ilU.js +45 -0
- data/dist/chunks/{lib-BmTAc7Nc.js → lib-C8GLwWXp.js} +1 -1
- data/dist/chunks/{pb_form_validation-BWjy4bFn.js → pb_form_validation-Eul4XODx.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 +16 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +0 -58
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +0 -106
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.html.erb +0 -43
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.html.erb +0 -55
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +0 -28
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +0 -58
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +0 -61
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.md +0 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.md +0 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +0 -110
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +0 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +0 -20
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +0 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +0 -46
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.md +0 -1
- data/dist/chunks/_weekday_stacked-Da8b-KUp.js +0 -45
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_rails.html.erb → _advanced_table_selectable_rows.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows_rails.html.erb → _advanced_table_selectable_rows_no_subrows.html.erb} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_react.md → _draggable_drop_zones.md} +0 -0
- /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_drop_zones_colors_react.md → _draggable_drop_zones_colors.md} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
`autocomplete` prop can also be used in conjunction with the `customDisplay` prop.
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import React, { useRef } from 'react'
|
2
|
+
|
3
|
+
import Dropdown from '../../pb_dropdown/_dropdown'
|
4
|
+
import useDropdown from '../../pb_dropdown/hooks/useDropdown'
|
5
|
+
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
6
|
+
import FlexItem from '../../pb_flex/_flex_item'
|
7
|
+
import Icon from '../../pb_icon/_icon'
|
8
|
+
import Body from '../../pb_body/_body'
|
9
|
+
import Flex from '../../pb_flex/_flex'
|
10
|
+
|
11
|
+
const DropdownWithHook = (props) => {
|
12
|
+
const [isDropDownClosed, setIsDropdownClosed] = useDropdown(true);
|
13
|
+
const buttonRef = useRef(null);
|
14
|
+
|
15
|
+
const options = [
|
16
|
+
{
|
17
|
+
label: "United States",
|
18
|
+
value: "United States",
|
19
|
+
areaCode: "+1",
|
20
|
+
icon: "🇺🇸",
|
21
|
+
id: "United-states"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
label: "Canada",
|
25
|
+
value: "Canada",
|
26
|
+
areaCode: "+1",
|
27
|
+
icon: "🇨🇦",
|
28
|
+
id: "canada"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Pakistan",
|
32
|
+
value: "Pakistan",
|
33
|
+
areaCode: "+92",
|
34
|
+
icon: "🇵🇰",
|
35
|
+
id: "pakistan"
|
36
|
+
}
|
37
|
+
];
|
38
|
+
|
39
|
+
return (
|
40
|
+
<div>
|
41
|
+
<CircleIconButton
|
42
|
+
htmlOptions={{ref: buttonRef}}
|
43
|
+
icon={"flag"}
|
44
|
+
onClick={() => setIsDropdownClosed(!isDropDownClosed)}
|
45
|
+
variant="secondary"
|
46
|
+
/>
|
47
|
+
<Dropdown
|
48
|
+
isClosed={isDropDownClosed}
|
49
|
+
options={options}
|
50
|
+
triggerRef={buttonRef}
|
51
|
+
{...props}
|
52
|
+
>
|
53
|
+
{options.map((option) => (
|
54
|
+
<Dropdown.Option key={option.id}
|
55
|
+
option={option}
|
56
|
+
>
|
57
|
+
<>
|
58
|
+
<FlexItem>
|
59
|
+
<Flex paddingRight='md'>
|
60
|
+
<Icon icon={option.icon}
|
61
|
+
paddingRight="xs"
|
62
|
+
/>
|
63
|
+
<Body text={option.label} />
|
64
|
+
</Flex>
|
65
|
+
</FlexItem>
|
66
|
+
<FlexItem>
|
67
|
+
<Body color="light"
|
68
|
+
text={option.areaCode}
|
69
|
+
/>
|
70
|
+
</FlexItem>
|
71
|
+
</>
|
72
|
+
</Dropdown.Option>
|
73
|
+
))}
|
74
|
+
</Dropdown>
|
75
|
+
</div>
|
76
|
+
)
|
77
|
+
}
|
78
|
+
|
79
|
+
export default DropdownWithHook
|
@@ -1,15 +1,12 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
- dropdown_with_autocomplete: Autocomplete
|
5
4
|
- dropdown_subtle_variant: Subtle Variant
|
6
5
|
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
7
|
-
- dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
|
8
6
|
- dropdown_with_label: With Label
|
9
7
|
- dropdown_with_custom_options_rails: Custom Options
|
10
8
|
- dropdown_with_custom_display_rails: Custom Display
|
11
9
|
- dropdown_with_custom_trigger_rails: Custom Trigger
|
12
|
-
- dropdown_with_search_rails: Custom Trigger Dropdown with Search
|
13
10
|
- dropdown_with_custom_padding: Custom Option Padding
|
14
11
|
- dropdown_error: Dropdown with Error
|
15
12
|
- dropdown_default_value: Default Value
|
@@ -18,20 +15,20 @@ examples:
|
|
18
15
|
|
19
16
|
react:
|
20
17
|
- dropdown_default: Default
|
21
|
-
- dropdown_with_autocomplete: Autocomplete
|
22
18
|
- dropdown_subtle_variant: Subtle Variant
|
23
19
|
- dropdown_subcomponent_structure: Subcomponent Structure
|
24
|
-
- dropdown_with_autocomplete_with_subcomponents: Autocomplete with Subcomponent Structure
|
25
20
|
- dropdown_with_label: With Label
|
26
21
|
- dropdown_with_custom_options: Custom Options
|
27
22
|
- dropdown_with_custom_display: Custom Display
|
28
23
|
- dropdown_with_custom_trigger: Custom Trigger
|
29
|
-
- dropdown_with_search: Custom Trigger Dropdown with Search
|
30
24
|
- dropdown_with_custom_padding: Custom Option Padding
|
31
25
|
- dropdown_error: Dropdown with Error
|
32
26
|
- dropdown_default_value: Default Value
|
33
27
|
- dropdown_blank_selection: Blank Selection
|
34
28
|
- dropdown_clear_selection: Clear Selection
|
35
29
|
- dropdown_separators_hidden: Separators Hidden
|
36
|
-
-
|
30
|
+
# - dropdown_with_autocomplete: Autocomplete
|
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
|
37
34
|
|
@@ -3,10 +3,11 @@ 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 DropdownWithAutocompleteAndCustomDisplay } from './_dropdown_with_autocomplete_and_custom_display.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'
|
10
11
|
export { default as DropdownSubcomponentStructure } from './_dropdown_subcomponent_structure.jsx'
|
11
12
|
export { default as DropdownError } from './_dropdown_error.jsx'
|
12
13
|
export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
|
@@ -14,4 +15,3 @@ export { default as DropdownBlankSelection } from './_dropdown_blank_selection.j
|
|
14
15
|
export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
|
15
16
|
export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
|
16
17
|
export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
|
17
|
-
export {default as DropdownWithSearch} from './_dropdown_with_search.jsx'
|
@@ -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"
|
17
|
+
<%= pb_rails("dropdown/dropdown_trigger") %>
|
18
|
+
<%= pb_rails("dropdown/dropdown_container") 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,10 +18,6 @@ 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
21
|
|
26
22
|
def data
|
27
23
|
Hash(prop(:data)).merge(pb_dropdown: true)
|
@@ -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
|
4
|
+
import { Dropdown, Icon } from 'playbook-ui'
|
5
5
|
|
6
6
|
|
7
7
|
const testId = 'dropdown'
|
@@ -219,48 +219,4 @@ 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()
|
266
222
|
})
|
@@ -1,14 +1,4 @@
|
|
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 %>
|
12
2
|
<%= pb_rails("list", props: {ordered: false, borderless: false}) do %>
|
13
3
|
<% if content.present? %>
|
14
4
|
<%= content.presence %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
align: "center",
|
9
9
|
border_radius:"lg",
|
10
10
|
classname: object.trigger_wrapper_classes,
|
11
|
-
cursor:
|
11
|
+
cursor: "pointer",
|
12
12
|
justify: "between",
|
13
13
|
padding_x:"sm",
|
14
14
|
padding_y:"xs",
|
@@ -24,17 +24,7 @@
|
|
24
24
|
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
25
25
|
<% end %>
|
26
26
|
<% else %>
|
27
|
-
|
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 %>
|
27
|
+
<%= pb_rails("body", props: {text: object.default_display_placeholder, id: "dropdown_trigger_display"}) %>
|
38
28
|
<% end %>
|
39
29
|
<% end %>
|
40
30
|
<% end %>
|
@@ -9,8 +9,6 @@ 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
|
14
12
|
|
15
13
|
def data
|
16
14
|
Hash(prop(:data)).merge(dropdown_trigger: true, dropdown_placeholder: default_display_placeholder)
|
@@ -25,7 +23,7 @@ module Playbook
|
|
25
23
|
end
|
26
24
|
|
27
25
|
def trigger_wrapper_classes
|
28
|
-
generate_classname("dropdown_trigger_wrapper",
|
26
|
+
generate_classname("dropdown_trigger_wrapper", "select_only")
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
@@ -11,8 +11,6 @@ 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]";
|
16
14
|
|
17
15
|
export default class PbDropdown extends PbEnhancedElement {
|
18
16
|
static get selector() {
|
@@ -27,11 +25,9 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
27
25
|
this.keyboardHandler = new PbDropdownKeyboard(this);
|
28
26
|
this.setDefaultValue();
|
29
27
|
this.bindEventListeners();
|
30
|
-
this.bindSearchInput();
|
31
28
|
this.updateArrowDisplay(false);
|
32
29
|
this.handleFormValidation();
|
33
30
|
this.handleFormReset();
|
34
|
-
this.bindSearchBar();
|
35
31
|
}
|
36
32
|
|
37
33
|
bindEventListeners() {
|
@@ -49,53 +45,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
49
45
|
);
|
50
46
|
}
|
51
47
|
|
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
|
-
|
99
48
|
handleOptionClick(event) {
|
100
49
|
const option = event.target.closest(OPTION_SELECTOR);
|
101
50
|
const hiddenInput = this.element.querySelector(DROPDOWN_INPUT);
|
@@ -110,7 +59,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
110
59
|
}
|
111
60
|
|
112
61
|
handleDocumentClick(event) {
|
113
|
-
if (event.target.closest(SEARCH_BAR_SELECTOR)) return;
|
114
62
|
if (this.isClickOutside(event) && this.target.classList.contains("open")) {
|
115
63
|
this.hideElement(this.target);
|
116
64
|
this.updateArrowDisplay(false);
|
@@ -151,11 +99,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
151
99
|
}
|
152
100
|
}
|
153
101
|
|
154
|
-
const autocompleteInput = this.element.querySelector(SEARCH_INPUT_SELECTOR);
|
155
|
-
if (autocompleteInput){
|
156
|
-
autocompleteInput.value = JSON.parse(value).label;
|
157
|
-
}
|
158
|
-
|
159
102
|
const customTrigger = this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);
|
160
103
|
if (customTrigger) {
|
161
104
|
if (this.target.classList.contains("open")) {
|
@@ -1,6 +1,4 @@
|
|
1
1
|
const OPTION_SELECTOR = "[data-dropdown-option-label]";
|
2
|
-
const SEARCH_INPUT_SELECTOR = "[data-dropdown-autocomplete]";
|
3
|
-
|
4
2
|
export class PbDropdownKeyboard {
|
5
3
|
constructor(dropdown) {
|
6
4
|
this.dropdown = dropdown;
|
@@ -9,9 +7,6 @@ export class PbDropdownKeyboard {
|
|
9
7
|
this.dropdownElement.querySelectorAll(OPTION_SELECTOR)
|
10
8
|
);
|
11
9
|
this.focusedOptionIndex = -1;
|
12
|
-
this.searchInput = this.dropdownElement.querySelector(
|
13
|
-
SEARCH_INPUT_SELECTOR
|
14
|
-
);
|
15
10
|
this.init();
|
16
11
|
}
|
17
12
|
|
@@ -20,18 +15,6 @@ export class PbDropdownKeyboard {
|
|
20
15
|
"keydown",
|
21
16
|
this.handleKeyDown.bind(this)
|
22
17
|
);
|
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
|
-
}
|
35
18
|
}
|
36
19
|
|
37
20
|
handleKeyDown(event) {
|
@@ -67,15 +50,6 @@ export class PbDropdownKeyboard {
|
|
67
50
|
this.dropdown.updateArrowDisplay(false);
|
68
51
|
this.resetFocus();
|
69
52
|
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;
|
79
53
|
default:
|
80
54
|
break;
|
81
55
|
}
|
@@ -46,6 +46,7 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
46
46
|
inputRef,
|
47
47
|
isDropDownClosed,
|
48
48
|
setFocusedOptionIndex,
|
49
|
+
triggerRef
|
49
50
|
} = useContext(DropdownContext);
|
50
51
|
|
51
52
|
const ariaProps = buildAriaProps(aria);
|
@@ -66,7 +67,7 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
66
67
|
id={id}
|
67
68
|
onMouseEnter={() => setFocusedOptionIndex(-1)}
|
68
69
|
ref={dropdownContainerRef}
|
69
|
-
style={{ position: "absolute"}}
|
70
|
+
style={triggerRef ? {} : { position: "absolute"}}
|
70
71
|
>
|
71
72
|
{searchbar && (
|
72
73
|
<TextInput dark={dark}
|
@@ -53,6 +53,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
53
53
|
selected,
|
54
54
|
setIsInputFocused,
|
55
55
|
toggleDropdown,
|
56
|
+
triggerRef,
|
56
57
|
} = useContext(DropdownContext);
|
57
58
|
|
58
59
|
const handleKeyDown = useHandleOnKeyDown();
|
@@ -98,6 +99,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
98
99
|
id={id}
|
99
100
|
>
|
100
101
|
{
|
102
|
+
!triggerRef && (
|
101
103
|
children ? (
|
102
104
|
<div
|
103
105
|
onClick={() => toggleDropdown()}
|
@@ -145,10 +147,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
145
147
|
<input
|
146
148
|
className="dropdown_input"
|
147
149
|
onChange={handleChange}
|
148
|
-
onClick={(
|
149
|
-
e.stopPropagation();// keep the wrapper’s handler from firing
|
150
|
-
toggleDropdown();
|
151
|
-
}}
|
150
|
+
onClick={() => toggleDropdown()}
|
152
151
|
onFocus={() => setIsInputFocused(true)}
|
153
152
|
onKeyDown={handleKeyDown}
|
154
153
|
placeholder={
|
@@ -182,6 +181,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
182
181
|
</Flex>
|
183
182
|
</>
|
184
183
|
)
|
184
|
+
)
|
185
185
|
}
|
186
186
|
</div>
|
187
187
|
);
|
@@ -23,39 +23,35 @@
|
|
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
|
-
align-items: flex-start;
|
26
|
+
align-items: flex-start;
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
.pb_select_kit_wrapper {
|
29
|
+
padding-top: $space_md;
|
30
|
+
margin-top: 2px;
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
}
|
32
|
+
.pb_select_kit_caret {
|
33
|
+
padding-top: $space_md;
|
36
34
|
}
|
35
|
+
}
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
.pb_select_kit_wrapper.error {
|
38
|
+
padding-top: $space_md;
|
39
|
+
margin-top: 2px;
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
}
|
41
|
+
.pb_select_kit_caret {
|
42
|
+
padding-top: $space_xl;
|
45
43
|
}
|
46
44
|
}
|
47
45
|
}
|
48
46
|
}
|
49
47
|
|
50
48
|
@mixin error-state-left-side-select-kit {
|
51
|
-
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_text_input_kit.error) {
|
52
|
-
|
53
|
-
align-items: flex-start;
|
49
|
+
&:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_phone_number_input):has(.pb_text_input_kit.error) {
|
50
|
+
align-items: flex-start;
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
52
|
+
.pb_text_input_kit.error {
|
53
|
+
padding-top: $space_md;
|
54
|
+
margin-top: 2px;
|
59
55
|
}
|
60
56
|
}
|
61
|
-
}
|
57
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import colors from '../tokens/exports/_colors.module.scss'
|
2
|
+
import typography from '../tokens/exports/_typography.module.scss'
|
3
|
+
|
4
|
+
const lineGraphTheme = {
|
5
|
+
title: { text: "" },
|
6
|
+
subtitle: { text: "" },
|
7
|
+
chart: {
|
8
|
+
type: "line",
|
9
|
+
},
|
10
|
+
tooltip: {
|
11
|
+
backgroundColor: {
|
12
|
+
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
13
|
+
stops: [
|
14
|
+
[0, colors.bg_dark],
|
15
|
+
[1, colors.bg_dark],
|
16
|
+
],
|
17
|
+
},
|
18
|
+
followPointer: true,
|
19
|
+
shadow: false,
|
20
|
+
borderWidth: 0,
|
21
|
+
borderRadius: 10,
|
22
|
+
style: {
|
23
|
+
fontFamily: typography.font_family_base,
|
24
|
+
color: colors.text_dk_default,
|
25
|
+
fontWeight: typography.regular,
|
26
|
+
fontSize: typography.text_smaller,
|
27
|
+
},
|
28
|
+
},
|
29
|
+
plotOptions: {
|
30
|
+
line: {
|
31
|
+
dataLabels: {
|
32
|
+
enabled: false,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
},
|
36
|
+
credits: { enabled: false },
|
37
|
+
legend: { enabled: false },
|
38
|
+
colors: [
|
39
|
+
colors.data_1,
|
40
|
+
colors.data_2,
|
41
|
+
colors.data_3,
|
42
|
+
colors.data_4,
|
43
|
+
colors.data_5,
|
44
|
+
colors.data_6,
|
45
|
+
colors.data_7,
|
46
|
+
],
|
47
|
+
}
|
48
|
+
|
49
|
+
export default lineGraphTheme;
|
@@ -39,9 +39,6 @@ $flag-min-resolution: 192dpi;
|
|
39
39
|
color: $charcoal;
|
40
40
|
}
|
41
41
|
|
42
|
-
.iti__country-list {
|
43
|
-
min-width: $dropdown-min-width;
|
44
|
-
}
|
45
42
|
// iti-spacer-horizontal's default is 8px, or $space_xs
|
46
43
|
.iti__country-list .iti__flag, .iti__country-name {
|
47
44
|
margin-right: $space_xs;
|
@@ -230,16 +227,6 @@ $flag-min-resolution: 192dpi;
|
|
230
227
|
.iti__dropdown-content {
|
231
228
|
border-radius: $space_xs;
|
232
229
|
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
|
-
}
|
243
230
|
}
|
244
231
|
|
245
232
|
.iti__divider {
|
@@ -37,7 +37,6 @@ type PhoneNumberInputProps = {
|
|
37
37
|
required?: boolean,
|
38
38
|
value?: string,
|
39
39
|
formatAsYouType?: boolean,
|
40
|
-
countrySearch?: boolean,
|
41
40
|
}
|
42
41
|
|
43
42
|
enum ValidationError {
|
@@ -92,7 +91,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
92
91
|
preferredCountries = [],
|
93
92
|
value = "",
|
94
93
|
formatAsYouType = false,
|
95
|
-
countrySearch = false,
|
96
94
|
} = props
|
97
95
|
|
98
96
|
const ariaProps = buildAriaProps(aria)
|
@@ -244,7 +242,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
244
242
|
autoInsertDialCode: false,
|
245
243
|
initialCountry: initialCountry || fallbackCountry,
|
246
244
|
onlyCountries,
|
247
|
-
countrySearch:
|
245
|
+
countrySearch: false,
|
248
246
|
fixDropdownWidth: false,
|
249
247
|
formatAsYouType: formatAsYouType,
|
250
248
|
hiddenInput: hiddenInputs ? () => ({
|