playbook_ui 14.16.0.pre.rc.6 → 14.17.0.pre.alpha.PBNTR920emojipickerpoc7130
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/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- 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 +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +115 -5
- data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +6 -4
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +91 -24
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +35 -28
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +184 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +97 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +11 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +65 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +8 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +4 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +13 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +23 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +28 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +97 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +71 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +105 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +10 -0
- data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_emoji_picker.jsx +371 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
- data/app/pb_kits/playbook/pb_user/_user.tsx +78 -13
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +28 -12
- data/app/pb_kits/playbook/pb_user/user.rb +17 -1
- data/app/pb_kits/playbook/pb_user/user.test.js +182 -1
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/tokens/_colors.scss +1 -4
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +287 -1
- data/app/pb_kits/playbook/utilities/object.ts +171 -3
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-7W5Ha5Td.js +22 -0
- data/dist/chunks/_weekday_stacked-DSKatW3m.js +45 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-BvDxpfs-.js → pb_form_validation-BvNy9Bd6.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/forms/builder/multi_level_select_field.rb +2 -0
- data/lib/playbook/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +40 -9
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-CRAPc8k-.js +0 -22
- data/dist/chunks/_weekday_stacked-T0kFfioG.js +0 -45
- data/dist/chunks/lib-BeKPJYlk.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Business Affairs",
|
24
|
+
value: "Business Affairs",
|
25
|
+
id: "business1",
|
26
|
+
children: [
|
27
|
+
{
|
28
|
+
label: "Initiatives",
|
29
|
+
value: "Initiatives",
|
30
|
+
id: "initiative1",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: "Learning & Development",
|
34
|
+
value: "Learning & Development",
|
35
|
+
id: "development1",
|
36
|
+
},
|
37
|
+
],
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: "People Experience",
|
41
|
+
value: "People Experience",
|
42
|
+
id: "experience1",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
label: "Contact Center",
|
48
|
+
value: "Contact Center",
|
49
|
+
id: "contact1",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
label: "Appointment Management",
|
53
|
+
value: "Appointment Management",
|
54
|
+
id: "appointment1",
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: "Customer Service",
|
58
|
+
value: "Customer Service",
|
59
|
+
id: "customer1",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: "Energy",
|
63
|
+
value: "Energy",
|
64
|
+
id: "energy1",
|
65
|
+
},
|
66
|
+
],
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
];
|
71
|
+
|
72
|
+
const MultiLevelSelectError = (props) => {
|
73
|
+
const [selectedItems, setSelectedItems] = useState([]);
|
74
|
+
const [errorState, setErrorState] = useState("Please make a valid selection");
|
75
|
+
|
76
|
+
useEffect(() => {
|
77
|
+
if (selectedItems.length === 0) {
|
78
|
+
setErrorState("Please make a valid selection");
|
79
|
+
} else {
|
80
|
+
setErrorState(null);
|
81
|
+
}
|
82
|
+
}, [selectedItems]);
|
83
|
+
|
84
|
+
return (
|
85
|
+
<div>
|
86
|
+
<MultiLevelSelect
|
87
|
+
error={errorState}
|
88
|
+
id="multiselect-error"
|
89
|
+
onSelect={(selectedNodes) => setSelectedItems(selectedNodes)}
|
90
|
+
treeData={treeData}
|
91
|
+
{...props}
|
92
|
+
/>
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
};
|
96
|
+
|
97
|
+
export default MultiLevelSelectError;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "100",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "101",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "102",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "103",
|
22
|
+
children: [
|
23
|
+
{
|
24
|
+
label: "Initiatives",
|
25
|
+
value: "Initiatives",
|
26
|
+
id: "104",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
label: "Learning & Development",
|
30
|
+
value: "Learning & Development",
|
31
|
+
id: "105",
|
32
|
+
},
|
33
|
+
],
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: "People Experience",
|
37
|
+
value: "People Experience",
|
38
|
+
id: "106",
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
{
|
43
|
+
label: "Contact Center",
|
44
|
+
value: "Contact Center",
|
45
|
+
id: "107",
|
46
|
+
children: [
|
47
|
+
{
|
48
|
+
label: "Appointment Management",
|
49
|
+
value: "Appointment Management",
|
50
|
+
id: "108",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
label: "Customer Service",
|
54
|
+
value: "Customer Service",
|
55
|
+
id: "109",
|
56
|
+
},
|
57
|
+
{
|
58
|
+
label: "Energy",
|
59
|
+
value: "Energy",
|
60
|
+
id: "110",
|
61
|
+
},
|
62
|
+
],
|
63
|
+
},
|
64
|
+
],
|
65
|
+
}] %>
|
66
|
+
|
67
|
+
<%= pb_rails("multi_level_select", props: {
|
68
|
+
id: "multi-level-select-label-rails",
|
69
|
+
label: "Select a department",
|
70
|
+
tree_data: treeData
|
71
|
+
}) %>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Business Affairs",
|
24
|
+
value: "Business Affairs",
|
25
|
+
id: "business1",
|
26
|
+
children: [
|
27
|
+
{
|
28
|
+
label: "Initiatives",
|
29
|
+
value: "Initiatives",
|
30
|
+
id: "initiative1",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: "Learning & Development",
|
34
|
+
value: "Learning & Development",
|
35
|
+
id: "development1",
|
36
|
+
},
|
37
|
+
],
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: "People Experience",
|
41
|
+
value: "People Experience",
|
42
|
+
id: "experience1",
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
{
|
47
|
+
label: "Contact Center",
|
48
|
+
value: "Contact Center",
|
49
|
+
id: "contact1",
|
50
|
+
children: [
|
51
|
+
{
|
52
|
+
label: "Appointment Management",
|
53
|
+
value: "Appointment Management",
|
54
|
+
id: "appointment1",
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: "Customer Service",
|
58
|
+
value: "Customer Service",
|
59
|
+
id: "customer1",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
label: "Energy",
|
63
|
+
value: "Energy",
|
64
|
+
id: "energy1",
|
65
|
+
},
|
66
|
+
],
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
];
|
71
|
+
|
72
|
+
const MultiLevelSelectDefault = (props) => {
|
73
|
+
return (
|
74
|
+
<div>
|
75
|
+
<MultiLevelSelect
|
76
|
+
id='multiselect-label'
|
77
|
+
label="Select a Department"
|
78
|
+
onSelect={(selectedNodes) =>
|
79
|
+
console.log(
|
80
|
+
"Selected Items",
|
81
|
+
selectedNodes
|
82
|
+
)
|
83
|
+
}
|
84
|
+
treeData={treeData}
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</div>
|
88
|
+
)
|
89
|
+
};
|
90
|
+
|
91
|
+
export default MultiLevelSelectDefault;
|
@@ -8,6 +8,8 @@ examples:
|
|
8
8
|
- multi_level_select_with_form: With Form
|
9
9
|
- multi_level_select_color: With Pills (Custom Color)
|
10
10
|
- multi_level_select_reset: Reset Selection
|
11
|
+
- multi_level_select_label: With Label
|
12
|
+
- multi_level_select_error: Error
|
11
13
|
- multi_level_select_disabled: Disabled Input
|
12
14
|
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
13
15
|
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
@@ -24,6 +26,8 @@ examples:
|
|
24
26
|
- multi_level_select_color: With Pills (Custom Color)
|
25
27
|
- multi_level_select_with_children: Checkboxes With Children
|
26
28
|
- multi_level_select_with_children_with_radios: Single Select With Children
|
29
|
+
- multi_level_select_label: With Label
|
30
|
+
- multi_level_select_error: Error
|
27
31
|
- multi_level_select_disabled: Disabled Input
|
28
32
|
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
29
33
|
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
@@ -8,7 +8,9 @@ export { default as MultiLevelSelectWithChildren } from './_multi_level_select_w
|
|
8
8
|
export { default as MultiLevelSelectWithChildrenWithRadios } from './_multi_level_select_with_children_with_radios.jsx'
|
9
9
|
export { default as MultiLevelSelectDisabled } from './_multi_level_select_disabled.jsx'
|
10
10
|
export { default as MultiLevelSelectReactHook } from './_multi_level_select_react_hook.jsx'
|
11
|
+
export { default as MultiLevelSelectError } from './_multi_level_select_error.jsx'
|
11
12
|
export { default as MultiLevelSelectDisabledOptions } from './_multi_level_select_disabled_options.jsx'
|
12
13
|
export { default as MultiLevelSelectDisabledOptionsParent } from './_multi_level_select_disabled_options_parent.jsx'
|
13
14
|
export { default as MultiLevelSelectDisabledOptionsParentDefault } from './_multi_level_select_disabled_options_parent_default.jsx'
|
14
|
-
export { default as MultiLevelSelectDisabledOptionsDefault } from './_multi_level_select_disabled_options_default.jsx'
|
15
|
+
export { default as MultiLevelSelectDisabledOptionsDefault } from './_multi_level_select_disabled_options_default.jsx'
|
16
|
+
export { default as MultiLevelSelectLabel } from './_multi_level_select_label.jsx'
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
+
|
3
|
+
const MULTI_LEVEL_SELECT_SELECTOR = "[data-multi_level_select_form]";
|
4
|
+
|
5
|
+
export default class PbMultiLevelSelect extends PbEnhancedElement {
|
6
|
+
static get selector() {
|
7
|
+
return MULTI_LEVEL_SELECT_SELECTOR;
|
8
|
+
}
|
9
|
+
|
10
|
+
get target() {
|
11
|
+
return this.element.querySelector(".pb_body_kit_negative");
|
12
|
+
}
|
13
|
+
|
14
|
+
connect() {
|
15
|
+
this.addEventListeners();
|
16
|
+
this.observeHiddenInputs();
|
17
|
+
this.observeRogueErrorInsideInnerContainer();
|
18
|
+
}
|
19
|
+
|
20
|
+
addEventListeners() {
|
21
|
+
const inputElement = this.element.querySelector("input");
|
22
|
+
|
23
|
+
inputElement.addEventListener("invalid", () => {
|
24
|
+
this.handleErrorLabel(300);
|
25
|
+
});
|
26
|
+
inputElement.addEventListener("blur", () => {
|
27
|
+
this.justBlurred = true;
|
28
|
+
|
29
|
+
setTimeout(() => {
|
30
|
+
this.justBlurred = false;
|
31
|
+
}, 300);
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
handleErrorLabel(delay) {
|
36
|
+
setTimeout(() => {
|
37
|
+
const errorLabelElement = this.target;
|
38
|
+
const wrapper = this.element.querySelector(".wrapper");
|
39
|
+
|
40
|
+
if (errorLabelElement) {
|
41
|
+
errorLabelElement.remove();
|
42
|
+
if (wrapper) {
|
43
|
+
if (wrapper.querySelector(".pb_body_kit_negative")) {
|
44
|
+
wrapper.querySelector(".pb_body_kit_negative").remove();
|
45
|
+
}
|
46
|
+
wrapper.appendChild(errorLabelElement);
|
47
|
+
}
|
48
|
+
this.element.classList.add("error");
|
49
|
+
} else {
|
50
|
+
this.handleErrorLabel(100);
|
51
|
+
}
|
52
|
+
}, delay);
|
53
|
+
}
|
54
|
+
|
55
|
+
observeHiddenInputs() {
|
56
|
+
const container = this.element.querySelector(".input_inner_container");
|
57
|
+
if (!container) return;
|
58
|
+
|
59
|
+
this.mutationObserver = new MutationObserver(() => {
|
60
|
+
const hiddenInputs = container.querySelectorAll('input[type="hidden"]');
|
61
|
+
if (hiddenInputs.length > 0) {
|
62
|
+
// At least one hidden input exists, so clear the error
|
63
|
+
this.clearError();
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
this.mutationObserver.observe(container, {
|
68
|
+
childList: true,
|
69
|
+
});
|
70
|
+
}
|
71
|
+
|
72
|
+
observeRogueErrorInsideInnerContainer() {
|
73
|
+
const container = this.element.querySelector(".input_inner_container");
|
74
|
+
|
75
|
+
this.rogueErrorObserver = new MutationObserver((mutations) => {
|
76
|
+
for (const mutation of mutations) {
|
77
|
+
for (const node of mutation.addedNodes) {
|
78
|
+
if (
|
79
|
+
node.nodeType === Node.ELEMENT_NODE &&
|
80
|
+
node.classList.contains("pb_body_kit_negative")
|
81
|
+
) {
|
82
|
+
if (this.justBlurred) {
|
83
|
+
node.remove();
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
});
|
89
|
+
|
90
|
+
this.rogueErrorObserver.observe(container, {
|
91
|
+
childList: true,
|
92
|
+
subtree: true,
|
93
|
+
});
|
94
|
+
}
|
95
|
+
|
96
|
+
clearError(e) {
|
97
|
+
const errorLabelElement = this.target;
|
98
|
+
|
99
|
+
if (errorLabelElement) {
|
100
|
+
errorLabelElement.remove();
|
101
|
+
this.element.classList.remove("error");
|
102
|
+
this.element.querySelector("input").value = e.detail.value;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
@@ -26,6 +26,12 @@ module Playbook
|
|
26
26
|
default: false
|
27
27
|
prop :disabled, type: Playbook::Props::Boolean,
|
28
28
|
default: false
|
29
|
+
prop :required, type: Playbook::Props::Boolean,
|
30
|
+
default: false
|
31
|
+
prop :error, type: Playbook::Props::String,
|
32
|
+
default: ""
|
33
|
+
prop :label, type: Playbook::Props::String,
|
34
|
+
default: ""
|
29
35
|
|
30
36
|
def classname
|
31
37
|
generate_classname("pb_multi_level_select")
|
@@ -33,11 +39,15 @@ module Playbook
|
|
33
39
|
|
34
40
|
def multi_level_select_options
|
35
41
|
{
|
42
|
+
data: data,
|
36
43
|
disabled: disabled,
|
44
|
+
error: error,
|
37
45
|
id: id,
|
38
46
|
inputDisplay: input_display,
|
39
47
|
name: name,
|
48
|
+
label: label,
|
40
49
|
treeData: tree_data,
|
50
|
+
required: required,
|
41
51
|
returnAllSelected: return_all_selected,
|
42
52
|
selectedIds: selected_ids,
|
43
53
|
inputName: input_name,
|
@@ -95,11 +95,13 @@ test('should not have a left border', () => {
|
|
95
95
|
test('should have a right icon', () => {
|
96
96
|
render(<NavDefault iconRight="angle-down" />)
|
97
97
|
const kit = screen.getByTestId(itemTestId)
|
98
|
-
|
98
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_right")
|
99
|
+
expect(icon).toBeInTheDocument()
|
99
100
|
})
|
100
101
|
|
101
102
|
test('should have a left icon', () => {
|
102
|
-
render(<NavDefault iconLeft="
|
103
|
+
render(<NavDefault iconLeft="angle-up" />)
|
103
104
|
const kit = screen.getByTestId(itemTestId)
|
104
|
-
|
105
|
+
const icon = kit.querySelector(".pb_custom_icon.pb_nav_list_item_icon_left")
|
106
|
+
expect(icon).toBeInTheDocument()
|
105
107
|
})
|
@@ -32,11 +32,12 @@ type RichTextEditorProps = {
|
|
32
32
|
advancedEditor?: any,
|
33
33
|
advancedEditorToolbar?: boolean,
|
34
34
|
toolbarBottom?: boolean,
|
35
|
-
children?: React.ReactNode | React.ReactNode[]
|
35
|
+
children?: React.ReactNode | React.ReactNode[],
|
36
36
|
className?: string,
|
37
37
|
data?: { [key: string]: string },
|
38
38
|
focus?: boolean,
|
39
|
-
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
39
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
40
|
+
inputOptions?: { [key: string]: string | number | boolean | (() => void) },
|
40
41
|
id?: string,
|
41
42
|
inline?: boolean,
|
42
43
|
extensions?: { [key: string]: string }[],
|
@@ -61,6 +62,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
61
62
|
data = {},
|
62
63
|
focus = false,
|
63
64
|
htmlOptions = {},
|
65
|
+
inputOptions = {},
|
64
66
|
inline = false,
|
65
67
|
extensions,
|
66
68
|
name,
|
@@ -70,7 +72,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
70
72
|
sticky = false,
|
71
73
|
template = '',
|
72
74
|
value = '',
|
73
|
-
maxWidth="md"
|
75
|
+
maxWidth = "md"
|
74
76
|
} = props
|
75
77
|
|
76
78
|
const ariaProps = buildAriaProps(aria),
|
@@ -79,12 +81,28 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
79
81
|
|
80
82
|
const htmlProps = buildHtmlProps(htmlOptions)
|
81
83
|
|
82
|
-
const handleOnEditorReady = (editorInstance: Editor) =>
|
83
|
-
|
84
|
+
const handleOnEditorReady = (editorInstance: Editor) => {
|
85
|
+
setEditor(editorInstance)
|
86
|
+
setTimeout(() => {
|
87
|
+
const oldId = editorInstance.element.getAttribute('input')
|
88
|
+
if (oldId) {
|
89
|
+
const hiddenInput = document.getElementById(oldId)
|
90
|
+
if (hiddenInput) {
|
91
|
+
const newId = (inputOptions.id as string) || oldId
|
92
|
+
hiddenInput.id = newId
|
93
|
+
editorInstance.element.setAttribute('input', newId)
|
94
|
+
|
95
|
+
if (inputOptions.name) {
|
96
|
+
hiddenInput.setAttribute('name', inputOptions.name as string)
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
})
|
101
|
+
}
|
84
102
|
|
85
103
|
// DOM manipulation must wait for editor to be ready
|
86
|
-
if (editor) {
|
87
|
-
const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
104
|
+
if (editor && editor.element) {
|
105
|
+
const toolbarElement = editor.element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
88
106
|
blockCodeButton = toolbarElement.querySelector('[data-trix-attribute=code]') as HTMLElement
|
89
107
|
|
90
108
|
// replace default trix "block code" button with "inline code" button
|
@@ -118,8 +136,8 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
118
136
|
}, [editor, template])
|
119
137
|
|
120
138
|
useEffect(() => {
|
121
|
-
if (!element) return
|
122
|
-
element.addEventListener('click', ({ target }: Event) => {
|
139
|
+
if (!editor?.element) return
|
140
|
+
editor.element.addEventListener('click', ({ target }: Event) => {
|
123
141
|
const trixEditorContainer = (target as Element).closest('.pb_rich_text_editor_kit')
|
124
142
|
if (!trixEditorContainer) return
|
125
143
|
|
@@ -128,7 +146,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
128
146
|
|
129
147
|
if (anchorElement.hasAttribute('href')) window.open(anchorElement.href)
|
130
148
|
})
|
131
|
-
}, [
|
149
|
+
}, [editor])
|
132
150
|
|
133
151
|
const richTextEditorClass = 'pb_rich_text_editor_kit',
|
134
152
|
simpleClass = simple ? 'simple' : '',
|
@@ -137,7 +155,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
137
155
|
inlineClass = inline ? 'inline' : '',
|
138
156
|
toolbarBottomClass = toolbarBottom ? 'toolbar-bottom' : ''
|
139
157
|
|
140
|
-
let css = classnames(globalProps(props, {maxWidth}), className)
|
158
|
+
let css = classnames(globalProps(props, { maxWidth }), className)
|
141
159
|
css = classnames(
|
142
160
|
richTextEditorClass,
|
143
161
|
simpleClass,
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("rich_text_editor", props: {id: "
|
1
|
+
<%= pb_rails("rich_text_editor", props: {input_options: { id: 'hidden_input_id', name: "hidden_input_name" }, value: "Add your text here. You can format your text, add links, quotes, and bullets."}) %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= react_component('RichTextEditor',
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
) %>
|
2
|
+
object.rich_text_options,
|
3
|
+
aria: object.aria,
|
4
|
+
data: object.data
|
5
|
+
) %>
|
@@ -20,6 +20,7 @@ module Playbook
|
|
20
20
|
prop :value
|
21
21
|
prop :template
|
22
22
|
prop :placeholder
|
23
|
+
prop :input_options
|
23
24
|
|
24
25
|
def classname
|
25
26
|
generate_classname("pb_rich_text_editor_kit", simple_class, focus_class, sticky_class, separator: " ")
|
@@ -49,6 +50,7 @@ module Playbook
|
|
49
50
|
value: value,
|
50
51
|
template: template,
|
51
52
|
placeholder: placeholder,
|
53
|
+
inputOptions: input_options,
|
52
54
|
}
|
53
55
|
end
|
54
56
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
To guarantee the vertical section separator displays properly, please add the `vertical: "stretch"`/`vertical="stretch"` property to the parent container (which is commonly a Flex container). This will stretch the container’s child elements vertically and ensure the section separator appears as expected.
|
@@ -19,23 +19,27 @@ test('it renders preset icon', () => {
|
|
19
19
|
render(
|
20
20
|
<StatChange
|
21
21
|
change="increase"
|
22
|
+
id="preset-icon"
|
22
23
|
value="28.4"
|
23
24
|
/>
|
24
25
|
)
|
25
26
|
|
26
|
-
const kit =
|
27
|
-
|
27
|
+
const kit = document.querySelector('#preset-icon')
|
28
|
+
const icon = kit.querySelector(".pb_custom_icon")
|
29
|
+
expect(icon).toBeInTheDocument()
|
28
30
|
})
|
29
31
|
|
30
32
|
test('it renders custom icon', () => {
|
31
33
|
render(
|
32
34
|
<StatChange
|
33
35
|
icon="chart-line-down"
|
36
|
+
id="custom-icon"
|
34
37
|
value={6.1}
|
35
38
|
/>
|
36
39
|
|
37
40
|
)
|
38
41
|
|
39
|
-
const kit =
|
40
|
-
|
42
|
+
const kit = document.querySelector('#custom-icon')
|
43
|
+
const icon = kit.querySelector(".pb_custom_icon")
|
44
|
+
expect(icon).toBeInTheDocument()
|
41
45
|
})
|
@@ -21,6 +21,7 @@ type TableProps = {
|
|
21
21
|
data?: { [key: string]: string },
|
22
22
|
dataTable: boolean,
|
23
23
|
disableHover?: boolean,
|
24
|
+
headerStyle?: "default" | "borderless" | "floating"
|
24
25
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
25
26
|
id?: string,
|
26
27
|
outerPadding?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
@@ -46,6 +47,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
46
47
|
data = {},
|
47
48
|
dataTable = false,
|
48
49
|
disableHover = false,
|
50
|
+
headerStyle = "default",
|
49
51
|
htmlOptions = {},
|
50
52
|
id,
|
51
53
|
outerPadding = '',
|
@@ -85,6 +87,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
85
87
|
'sticky-left-column': stickyLeftColumn,
|
86
88
|
'sticky-right-column': stickyRightColumn,
|
87
89
|
'striped': striped,
|
90
|
+
'header-borderless': headerStyle === 'borderless',
|
91
|
+
'header-floating': headerStyle === 'floating',
|
88
92
|
[outerPaddingCss]: outerPadding !== '',
|
89
93
|
},
|
90
94
|
globalProps(props),
|