playbook_ui 14.15.0.pre.alpha.play1949lodashremoval3of36758 → 14.15.0.pre.alpha.play1952fixhorizontalnavcursorstyle6795
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_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/CurrentFilters.tsx +4 -3
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +3 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +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_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +5 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +15 -6
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +76 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +94 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +75 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +93 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +75 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +93 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +74 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +92 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +10 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +1 -0
- data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
- 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/index.ts +2 -2
- 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/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +1 -149
- data/app/pb_kits/playbook/utilities/object.ts +42 -124
- data/dist/chunks/_typeahead-CVryXNui.js +22 -0
- data/dist/chunks/_weekday_stacked-BGcc0MlV.js +45 -0
- data/dist/chunks/{lib-DpO_YjaF.js → lib-Co5y3V4K.js} +3 -3
- data/dist/chunks/{pb_form_validation-C3rQtNR-.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/version.rb +1 -1
- metadata +24 -6
- data/dist/chunks/_typeahead-tLz4QFO8.js +0 -22
- data/dist/chunks/_weekday_stacked-DLFmBReC.js +0 -45
@@ -0,0 +1,75 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "powerhome1",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "people1",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "talent1",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "business1",
|
22
|
+
expanded: true,
|
23
|
+
disabled: true,
|
24
|
+
children: [
|
25
|
+
{
|
26
|
+
label: "Initiatives",
|
27
|
+
value: "Initiatives",
|
28
|
+
id: "initiative1",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Learning & Development",
|
32
|
+
value: "Learning & Development",
|
33
|
+
id: "development1",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "People Experience",
|
39
|
+
value: "People Experience",
|
40
|
+
id: "experience1",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
label: "Contact Center",
|
46
|
+
value: "Contact Center",
|
47
|
+
id: "contact1",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
label: "Appointment Management",
|
51
|
+
value: "Appointment Management",
|
52
|
+
id: "appointment1",
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: "Customer Service",
|
56
|
+
value: "Customer Service",
|
57
|
+
id: "customer1",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
label: "Energy",
|
61
|
+
value: "Energy",
|
62
|
+
id: "energy1",
|
63
|
+
},
|
64
|
+
],
|
65
|
+
},
|
66
|
+
],
|
67
|
+
}] %>
|
68
|
+
|
69
|
+
|
70
|
+
<%= pb_rails("multi_level_select", props: {
|
71
|
+
id: "mls-disabled-options-parent-rails",
|
72
|
+
name: "disabled_options_parent",
|
73
|
+
return_all_selected: true,
|
74
|
+
tree_data: treeData
|
75
|
+
}) %>
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx
ADDED
@@ -0,0 +1,93 @@
|
|
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
|
+
expanded: true,
|
27
|
+
disabled: true,
|
28
|
+
children: [
|
29
|
+
{
|
30
|
+
label: "Initiatives",
|
31
|
+
value: "Initiatives",
|
32
|
+
id: "initiative1",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: "Learning & Development",
|
36
|
+
value: "Learning & Development",
|
37
|
+
id: "development1",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "People Experience",
|
43
|
+
value: "People Experience",
|
44
|
+
id: "experience1",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: "Contact Center",
|
50
|
+
value: "Contact Center",
|
51
|
+
id: "contact1",
|
52
|
+
children: [
|
53
|
+
{
|
54
|
+
label: "Appointment Management",
|
55
|
+
value: "Appointment Management",
|
56
|
+
id: "appointment1",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "Customer Service",
|
60
|
+
value: "Customer Service",
|
61
|
+
id: "customer1",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: "Energy",
|
65
|
+
value: "Energy",
|
66
|
+
id: "energy1",
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
],
|
71
|
+
},
|
72
|
+
];
|
73
|
+
|
74
|
+
const MultiLevelSelectDisabledOptionsParent = (props) => {
|
75
|
+
return (
|
76
|
+
<div>
|
77
|
+
<MultiLevelSelect
|
78
|
+
id='multiselect-disabled-options-parent'
|
79
|
+
onSelect={(selectedNodes) =>
|
80
|
+
console.log(
|
81
|
+
"Selected Items",
|
82
|
+
selectedNodes
|
83
|
+
)
|
84
|
+
}
|
85
|
+
returnAllSelected
|
86
|
+
treeData={treeData}
|
87
|
+
{...props}
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
)
|
91
|
+
};
|
92
|
+
|
93
|
+
export default MultiLevelSelectDisabledOptionsParent;
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
For the `returnAllSelected`/`return_all_selected` variant, disabling the parent item will NOT automatically disable it's children since this version allows you to select a parent even if all children are unselected.
|
2
|
+
|
3
|
+
You can manually pass `disabled:true` to any and all children of a disabled parent if you want to do so.
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "powerhome1",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "people1",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "talent1",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "business1",
|
22
|
+
expanded: true,
|
23
|
+
disabled: true,
|
24
|
+
children: [
|
25
|
+
{
|
26
|
+
label: "Initiatives",
|
27
|
+
value: "Initiatives",
|
28
|
+
id: "initiative1",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Learning & Development",
|
32
|
+
value: "Learning & Development",
|
33
|
+
id: "development1",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "People Experience",
|
39
|
+
value: "People Experience",
|
40
|
+
id: "experience1",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
label: "Contact Center",
|
46
|
+
value: "Contact Center",
|
47
|
+
id: "contact1",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
label: "Appointment Management",
|
51
|
+
value: "Appointment Management",
|
52
|
+
id: "appointment1",
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: "Customer Service",
|
56
|
+
value: "Customer Service",
|
57
|
+
id: "customer1",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
label: "Energy",
|
61
|
+
value: "Energy",
|
62
|
+
id: "energy1",
|
63
|
+
},
|
64
|
+
],
|
65
|
+
},
|
66
|
+
],
|
67
|
+
}] %>
|
68
|
+
|
69
|
+
|
70
|
+
<%= pb_rails("multi_level_select", props: {
|
71
|
+
id: "mls-disabled-options-parent-default-rails",
|
72
|
+
name: "disabled_options_parent_default",
|
73
|
+
tree_data: treeData
|
74
|
+
}) %>
|
@@ -0,0 +1,92 @@
|
|
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
|
+
expanded: true,
|
27
|
+
disabled: true,
|
28
|
+
children: [
|
29
|
+
{
|
30
|
+
label: "Initiatives",
|
31
|
+
value: "Initiatives",
|
32
|
+
id: "initiative1",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: "Learning & Development",
|
36
|
+
value: "Learning & Development",
|
37
|
+
id: "development1",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "People Experience",
|
43
|
+
value: "People Experience",
|
44
|
+
id: "experience1",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: "Contact Center",
|
50
|
+
value: "Contact Center",
|
51
|
+
id: "contact1",
|
52
|
+
children: [
|
53
|
+
{
|
54
|
+
label: "Appointment Management",
|
55
|
+
value: "Appointment Management",
|
56
|
+
id: "appointment1",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "Customer Service",
|
60
|
+
value: "Customer Service",
|
61
|
+
id: "customer1",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: "Energy",
|
65
|
+
value: "Energy",
|
66
|
+
id: "energy1",
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
],
|
71
|
+
},
|
72
|
+
];
|
73
|
+
|
74
|
+
const MultiLevelSelectDisabledOptionsParentDefault = (props) => {
|
75
|
+
return (
|
76
|
+
<div>
|
77
|
+
<MultiLevelSelect
|
78
|
+
id='multiselect-disabled-options-parent-default'
|
79
|
+
onSelect={(selectedNodes) =>
|
80
|
+
console.log(
|
81
|
+
"Selected Items",
|
82
|
+
selectedNodes
|
83
|
+
)
|
84
|
+
}
|
85
|
+
treeData={treeData}
|
86
|
+
{...props}
|
87
|
+
/>
|
88
|
+
</div>
|
89
|
+
)
|
90
|
+
};
|
91
|
+
|
92
|
+
export default MultiLevelSelectDisabledOptionsParentDefault;
|
@@ -8,7 +8,11 @@ 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_disabled: Disabled
|
11
|
+
- multi_level_select_disabled: Disabled Input
|
12
|
+
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
13
|
+
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
14
|
+
- multi_level_select_disabled_options_parent_default: Disabled Parent Option (Default)
|
15
|
+
- multi_level_select_disabled_options_parent: Disabled Parent Option (Return All Selected)
|
12
16
|
|
13
17
|
react:
|
14
18
|
- multi_level_select_default: Default
|
@@ -20,4 +24,8 @@ examples:
|
|
20
24
|
- multi_level_select_color: With Pills (Custom Color)
|
21
25
|
- multi_level_select_with_children: Checkboxes With Children
|
22
26
|
- multi_level_select_with_children_with_radios: Single Select With Children
|
23
|
-
- multi_level_select_disabled: Disabled
|
27
|
+
- multi_level_select_disabled: Disabled Input
|
28
|
+
- multi_level_select_disabled_options_default: Disabled Options (Default)
|
29
|
+
- multi_level_select_disabled_options: Disabled Options (Return All Selected)
|
30
|
+
- multi_level_select_disabled_options_parent_default: Disabled Parent Option (Default)
|
31
|
+
- multi_level_select_disabled_options_parent: Disabled Parent Option (Return All Selected)
|
@@ -8,3 +8,7 @@ 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 MultiLevelSelectDisabledOptions } from './_multi_level_select_disabled_options.jsx'
|
12
|
+
export { default as MultiLevelSelectDisabledOptionsParent } from './_multi_level_select_disabled_options_parent.jsx'
|
13
|
+
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'
|
@@ -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'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
2
|
-
import { debounce } from '
|
2
|
+
import { debounce } from 'lodash'
|
3
3
|
|
4
4
|
export default class PbTypeahead extends PbEnhancedElement {
|
5
5
|
_searchInput: HTMLInputElement
|
@@ -284,4 +284,4 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
284
284
|
if (visible) visibilityProperty = '1'
|
285
285
|
this.resultsLoadingIndicator.style.opacity = visibilityProperty
|
286
286
|
}
|
287
|
-
}
|
287
|
+
}
|
@@ -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?
|
@@ -7,6 +7,8 @@ import { GlobalProps, globalProps } from '../utilities/globalProps'
|
|
7
7
|
import Avatar from '../pb_avatar/_avatar'
|
8
8
|
import Body from '../pb_body/_body'
|
9
9
|
import Title from '../pb_title/_title'
|
10
|
+
import Caption from '../pb_caption/_caption'
|
11
|
+
import Detail from '../pb_detail/_detail'
|
10
12
|
|
11
13
|
type UserProps = {
|
12
14
|
align?: "left" | "center" | "right",
|
@@ -20,11 +22,13 @@ type UserProps = {
|
|
20
22
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
21
23
|
id?: string,
|
22
24
|
name?: string,
|
25
|
+
nameStyle?: "title" | "body" | "caption" | "detail"
|
23
26
|
orientation?: "horizontal" | "vertical",
|
24
27
|
size?: "sm" | "md" | "lg",
|
25
28
|
subtitle?: string | Array<Node> | Node,
|
26
29
|
territory?: string,
|
27
30
|
title?: string,
|
31
|
+
titleStyle?: "title" | "body" | "caption" | "detail",
|
28
32
|
} & GlobalProps
|
29
33
|
|
30
34
|
const User = (props: UserProps): React.ReactElement => {
|
@@ -40,11 +44,13 @@ const User = (props: UserProps): React.ReactElement => {
|
|
40
44
|
htmlOptions = {},
|
41
45
|
id,
|
42
46
|
name,
|
47
|
+
nameStyle = 'title',
|
43
48
|
orientation = 'horizontal',
|
44
49
|
size = 'sm',
|
45
50
|
subtitle,
|
46
51
|
territory = '',
|
47
52
|
title = '',
|
53
|
+
titleStyle = 'body',
|
48
54
|
} = props
|
49
55
|
|
50
56
|
const dataProps: {[key: string]: string} = buildDataProps(data)
|
@@ -58,6 +64,76 @@ const User = (props: UserProps): React.ReactElement => {
|
|
58
64
|
)
|
59
65
|
|
60
66
|
const avatarPresent = avatar || avatarUrl
|
67
|
+
const titleText = territory === '' ? title : `${territory} • ${title}`
|
68
|
+
|
69
|
+
const renderNameComponent = () => {
|
70
|
+
switch (nameStyle) {
|
71
|
+
case "title":
|
72
|
+
return (
|
73
|
+
<Title
|
74
|
+
bold={bold}
|
75
|
+
dark={dark}
|
76
|
+
size={size === "lg" ? 3 : 4}
|
77
|
+
text={name}
|
78
|
+
/>
|
79
|
+
);
|
80
|
+
case "body":
|
81
|
+
return (
|
82
|
+
<Body
|
83
|
+
dark={dark}
|
84
|
+
text={name}
|
85
|
+
/>
|
86
|
+
);
|
87
|
+
case "caption":
|
88
|
+
return (
|
89
|
+
<Caption
|
90
|
+
dark={dark}
|
91
|
+
size={size === "sm" ? "xs" : size}
|
92
|
+
text={name}
|
93
|
+
/>
|
94
|
+
);
|
95
|
+
case "detail":
|
96
|
+
return (
|
97
|
+
<Detail
|
98
|
+
dark={dark}
|
99
|
+
text={name}
|
100
|
+
/>
|
101
|
+
);
|
102
|
+
default:
|
103
|
+
return null;
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
const renderTitleComponent = () => {
|
108
|
+
switch (titleStyle) {
|
109
|
+
case "body":
|
110
|
+
return (
|
111
|
+
<Body
|
112
|
+
color="light"
|
113
|
+
dark={dark}
|
114
|
+
text={titleText}
|
115
|
+
variant={null}
|
116
|
+
/>
|
117
|
+
);
|
118
|
+
case "caption":
|
119
|
+
return (
|
120
|
+
<Caption
|
121
|
+
dark={dark}
|
122
|
+
size={size === "sm" ? "xs" : size}
|
123
|
+
text={titleText}
|
124
|
+
/>
|
125
|
+
);
|
126
|
+
case "detail":
|
127
|
+
return (
|
128
|
+
<Detail
|
129
|
+
dark={dark}
|
130
|
+
text={titleText}
|
131
|
+
/>
|
132
|
+
);
|
133
|
+
default:
|
134
|
+
return null;
|
135
|
+
}
|
136
|
+
};
|
61
137
|
|
62
138
|
return (
|
63
139
|
<div
|
@@ -76,19 +152,8 @@ const User = (props: UserProps): React.ReactElement => {
|
|
76
152
|
/>
|
77
153
|
}
|
78
154
|
<div className="content_wrapper">
|
79
|
-
|
80
|
-
|
81
|
-
dark={dark}
|
82
|
-
size={size == 'lg' ? 3 : 4}
|
83
|
-
text={name}
|
84
|
-
/>
|
85
|
-
<Body
|
86
|
-
color="light"
|
87
|
-
dark={dark}
|
88
|
-
variant={null}
|
89
|
-
>
|
90
|
-
{territory === '' ? title : `${territory} • ${title}`}
|
91
|
-
</Body>
|
155
|
+
{renderNameComponent()}
|
156
|
+
{renderTitleComponent()}
|
92
157
|
{ typeof(subtitle) === 'string' &&
|
93
158
|
<Body
|
94
159
|
color="light"
|