playbook_ui 14.16.0.pre.rc.6 → 14.16.0
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_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +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 +35 -9
- 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/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_filter/Filter/SortMenu.tsx +2 -1
- 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_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_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_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_line_graph/_line_graph.tsx +1 -1
- 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 +26 -0
- 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_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/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- 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 +27 -6
- 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/tokens/_colors.scss +1 -4
- data/app/pb_kits/playbook/utilities/object.test.js +139 -1
- data/app/pb_kits/playbook/utilities/object.ts +86 -0
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-BuTZG1Jn.js +22 -0
- data/dist/chunks/_weekday_stacked-oT22q75-.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/{lib-BeKPJYlk.js → lib-Co5y3V4K.js} +2 -2
- data/dist/chunks/{pb_form_validation-BvDxpfs-.js → pb_form_validation-DMajaRt3.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/version.rb +1 -1
- metadata +23 -7
- data/dist/chunks/_typeahead-CRAPc8k-.js +0 -22
- data/dist/chunks/_weekday_stacked-T0kFfioG.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
@@ -0,0 +1,72 @@
|
|
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
|
+
error: "Please make a valid selection",
|
69
|
+
id: "multi-level-select-error-rails",
|
70
|
+
name: "my_array",
|
71
|
+
tree_data: treeData
|
72
|
+
}) %>
|
@@ -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,
|
@@ -10,7 +10,7 @@ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
|
10
10
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
11
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
12
|
import treemap from 'highcharts/modules/treemap'
|
13
|
-
import { merge } from '
|
13
|
+
import { merge } from '../utilities/object'
|
14
14
|
|
15
15
|
type TreemapChartProps = {
|
16
16
|
chartData: {
|
@@ -126,6 +126,9 @@
|
|
126
126
|
color: $text_lt_default;
|
127
127
|
}
|
128
128
|
&__control {
|
129
|
+
&--is-disabled {
|
130
|
+
background-color: shade($white, 5%);
|
131
|
+
}
|
129
132
|
&--is-focused {
|
130
133
|
@include pb_textarea_focus;
|
131
134
|
@include transition_default;
|
@@ -252,6 +255,7 @@
|
|
252
255
|
color: $text_dk_default;
|
253
256
|
}
|
254
257
|
&__control {
|
258
|
+
|
255
259
|
&--is-focused {
|
256
260
|
@include pb_textarea_focus;
|
257
261
|
@include transition_default;
|
@@ -38,6 +38,7 @@ type TypeaheadProps = {
|
|
38
38
|
createable?: boolean,
|
39
39
|
dark?: boolean,
|
40
40
|
data?: { [key: string]: string },
|
41
|
+
disabled?: boolean,
|
41
42
|
error?: string,
|
42
43
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
43
44
|
id?: string,
|
@@ -79,6 +80,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
79
80
|
createable,
|
80
81
|
error = "",
|
81
82
|
data = {},
|
83
|
+
disabled = false,
|
82
84
|
getOptionLabel,
|
83
85
|
getOptionValue,
|
84
86
|
htmlOptions = {},
|
@@ -205,6 +207,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
205
207
|
<Tag
|
206
208
|
classNamePrefix="typeahead-kit-select"
|
207
209
|
error={error}
|
210
|
+
isDisabled={disabled}
|
208
211
|
onChange={handleOnChange}
|
209
212
|
{...selectProps}
|
210
213
|
/>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{ label: 'Orange', value: '#FFA500' },
|
4
|
+
{ label: 'Red', value: '#FF0000' },
|
5
|
+
{ label: 'Green', value: '#00FF00' },
|
6
|
+
{ label: 'Blue', value: '#0000FF' },
|
7
|
+
]
|
8
|
+
%>
|
9
|
+
|
10
|
+
<%= pb_rails("typeahead", props: {
|
11
|
+
id: "typeahead-disabled",
|
12
|
+
disabled: true,
|
13
|
+
placeholder: "All Colors",
|
14
|
+
options: options,
|
15
|
+
label: "Colors",
|
16
|
+
name: :foo,
|
17
|
+
is_multi: false
|
18
|
+
})
|
19
|
+
%>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import Typeahead from '../_typeahead'
|
4
|
+
|
5
|
+
const options = [
|
6
|
+
{ label: 'Orange', value: '#FFA500' },
|
7
|
+
{ label: 'Red', value: '#FF0000' },
|
8
|
+
{ label: 'Green', value: '#00FF00' },
|
9
|
+
{ label: 'Blue', value: '#0000FF' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const TypeaheadDisabled = (props) => {
|
13
|
+
return (
|
14
|
+
<Typeahead
|
15
|
+
disabled
|
16
|
+
label="Colors"
|
17
|
+
options={options}
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
export default TypeaheadDisabled
|
@@ -14,6 +14,7 @@ examples:
|
|
14
14
|
- typeahead_truncated_text: Truncated Text
|
15
15
|
- typeahead_dynamic_options: Dynamic Options
|
16
16
|
- typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
|
17
|
+
- typeahead_disabled: Disabled
|
17
18
|
|
18
19
|
react:
|
19
20
|
- typeahead_default: Default
|
@@ -32,3 +33,4 @@ examples:
|
|
32
33
|
- typeahead_margin_bottom: Margin Bottom
|
33
34
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
34
35
|
- typeahead_truncated_text: Truncated Text
|
36
|
+
- typeahead_disabled: Disabled
|
@@ -14,3 +14,4 @@ export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx
|
|
14
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
15
15
|
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|
16
16
|
export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
17
|
+
export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
|
@@ -52,6 +52,8 @@ module Playbook
|
|
52
52
|
default: {}
|
53
53
|
prop :search_context_selector, type: Playbook::Props::String,
|
54
54
|
default: nil
|
55
|
+
prop :disabled, type: Playbook::Props::Boolean,
|
56
|
+
default: false
|
55
57
|
|
56
58
|
def classname
|
57
59
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -100,6 +102,7 @@ module Playbook
|
|
100
102
|
searchContextSelector: search_context_selector,
|
101
103
|
optionsByContext: options_by_context,
|
102
104
|
clearOnContextChange: clear_on_context_change,
|
105
|
+
disabled: disabled,
|
103
106
|
}
|
104
107
|
|
105
108
|
base_options[:getOptionLabel] = get_option_label if get_option_label.present?
|