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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
  3. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
  4. data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +4 -3
  5. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +3 -2
  6. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
  7. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
  8. data/app/pb_kits/playbook/pb_icon/_icon.scss +8 -1
  9. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
  10. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
  11. data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
  12. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +5 -1
  13. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +15 -6
  14. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +1 -1
  15. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +76 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +94 -0
  17. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.md +1 -0
  18. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +75 -0
  19. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +93 -0
  20. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.md +3 -0
  21. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +75 -0
  22. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +93 -0
  23. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.md +3 -0
  24. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +74 -0
  25. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +92 -0
  26. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.md +3 -0
  27. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +10 -2
  28. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +4 -0
  29. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +1 -0
  30. data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
  31. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
  32. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
  33. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
  34. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
  35. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  36. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  37. data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
  38. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
  39. data/app/pb_kits/playbook/pb_user/_user.tsx +78 -13
  40. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
  41. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
  42. data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
  43. data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
  44. data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
  45. data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
  46. data/app/pb_kits/playbook/pb_user/user.html.erb +27 -6
  47. data/app/pb_kits/playbook/pb_user/user.rb +17 -1
  48. data/app/pb_kits/playbook/pb_user/user.test.js +182 -1
  49. data/app/pb_kits/playbook/tokens/_colors.scss +1 -4
  50. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  51. data/app/pb_kits/playbook/utilities/object.test.js +1 -149
  52. data/app/pb_kits/playbook/utilities/object.ts +42 -124
  53. data/dist/chunks/_typeahead-CVryXNui.js +22 -0
  54. data/dist/chunks/_weekday_stacked-BGcc0MlV.js +45 -0
  55. data/dist/chunks/{lib-DpO_YjaF.js → lib-Co5y3V4K.js} +3 -3
  56. data/dist/chunks/{pb_form_validation-C3rQtNR-.js → pb_form_validation-DMajaRt3.js} +1 -1
  57. data/dist/chunks/vendor.js +1 -1
  58. data/dist/playbook-doc.js +1 -1
  59. data/dist/playbook-rails-react-bindings.js +1 -1
  60. data/dist/playbook-rails.js +1 -1
  61. data/dist/playbook.css +1 -1
  62. data/lib/playbook/version.rb +1 -1
  63. metadata +24 -6
  64. data/dist/chunks/_typeahead-tLz4QFO8.js +0 -22
  65. data/dist/chunks/_weekday_stacked-DLFmBReC.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c1e04d125fc583873d510ededd4f53884d47b8debf146b933fc7e91e380ed99
4
- data.tar.gz: 202ab46a86392fe0fbfc5a0ec8089c33dc562f48579d1b18db855b769f5e0eaf
3
+ metadata.gz: c8462d011ee01fbc2e1dcbcc3da414e4c97080fd50b0fca45cbdaa02e39015a4
4
+ data.tar.gz: 1ca28020da66e69a5262d5817ab9a827f82586f861ffeb2657d939fe1e0335a7
5
5
  SHA512:
6
- metadata.gz: c587c24ab590f8471ad5d1bb7fe6874e126a7a3da4f224efac7fe5ea7b3c1867c39e1c59dcba64a172fbcbc2c2ac39f2a72f7ad50329ee982d22e55bcb6962c5
7
- data.tar.gz: 18d4482b5bcc8c53fd4deb953af572295dec9b6f41e45dc1a4ae2e2a34f5d4d8ed84a82b3a754a62b6b52b00657682cdf328e9a32cc7a0a8dcb363a8528a7f73
6
+ metadata.gz: 6cdcb36480d01c4657d5dcc7614a39b8d4f068c5122242d2eea84e189216cc146fb14ba5c17d0a9716211284fb542c15c6a4a9902274236f2623a0a9cc46b1b0
7
+ data.tar.gz: 6f2d7d27c882350ea27cf7c31dac83c82b029b32e54511f0783b85d3279be6314eb19253a9e3680d81cf5f0b7112c25f78b593dfa9c686a284148616dbfc0db2
@@ -0,0 +1,3 @@
1
+
2
+ <%= pb_rails("body", props: { text: " The breakpoint prop determines when the Drawer is always visible. Above the specified breakpoint, the Drawer remains open on the page. Below it, only the trigger element is shown, allowing you to toggle the drawer open and closed. To see this in action, click the button below and resize your window.", padding_bottom: "md" }) %>
3
+ <%= pb_rails("button", props: { text: "Open Doc Example in New Tab", new_window: true, link: "/drawer_page", margin_right: "lg" }) %>
@@ -6,6 +6,7 @@ examples:
6
6
  - drawer_menu: Within Element
7
7
  - drawer_sizes: Sizes
8
8
  - drawer_overlay: Overlay
9
+ - drawer_breakpoints: Breakpoints
9
10
  - drawer_borders: Borders
10
11
 
11
12
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { isEmpty, omitBy, map } from '../../utilities/object'
2
+ import { map } from 'lodash'
3
+ import { isEmpty, omitBy } from '../../utilities/object'
3
4
 
4
5
  import Body from '../../pb_body/_body'
5
6
  import Caption from '../../pb_caption/_caption'
@@ -45,12 +46,12 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
45
46
  dark={dark}
46
47
  size={4}
47
48
  tag="h4"
48
- text={`${name}`}
49
+ text={name}
49
50
  /> :
50
51
  <div>
51
52
  <Caption
52
53
  dark={dark}
53
- text={`${name}`}
54
+ text={name}
54
55
  />
55
56
  <Title
56
57
  dark={dark}
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from 'react'
2
- import { find, partial, map } from '../../utilities/object'
2
+ import { map } from 'lodash'
3
+ import { find, partial } from '../../utilities/object'
3
4
 
4
5
  import Button from '../../pb_button/_button'
5
6
  import Icon from '../../pb_icon/_icon'
@@ -26,7 +27,7 @@ const directionIcon = (dir: Direction) => (
26
27
 
27
28
  const renderOptions = (options: SortOptions, value: SortValue[], handleChange: (arg0: SortValue) => void) => (
28
29
  map(options, (label, name) => {
29
- const next = nextValue(value, String(name))
30
+ const next = nextValue(value, name)
30
31
  return (
31
32
  <ListItem key={`option-${next.name}-${next.dir}`}>
32
33
  <Button
@@ -7,7 +7,7 @@ $pb_pill_height: 25px;
7
7
 
8
8
 
9
9
  $confirmation_toast_colors: (
10
- neutral: $neutral,
10
+ neutral: $text_lt_light,
11
11
  success: $success,
12
12
  error: $error,
13
13
  tip: transparent,
@@ -87,7 +87,7 @@ $confirmation_toast_colors: (
87
87
  overflow: hidden;
88
88
  display: -webkit-box;
89
89
  -webkit-line-clamp: 3;
90
- -webkit-box-orient: vertical;
90
+ -webkit-box-orient: vertical;
91
91
  white-space: normal;
92
92
  text-align: left;
93
93
  }
@@ -1,5 +1,5 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
- import { debounce } from '../utilities/object'
2
+ import { debounce } from 'lodash'
3
3
 
4
4
  // Kit selectors
5
5
  const KIT_SELECTOR = '[class^="pb_"][class*="_kit"]'
@@ -1,10 +1,17 @@
1
1
  @import "../tokens/colors";
2
2
 
3
+ $additional_colors: (
4
+ "light": $text_lt_light,
5
+ "lighter": $text_lt_lighter,
6
+ "link": $primary
7
+ );
8
+
3
9
  // All the merges below create $icon_colors, a map of all color tokens in colors.scss
4
10
  $merge_kits1: map-merge($status_colors, $category_colors);
5
11
  $merge_kits2: map-merge($merge_kits1, $product_colors);
6
12
  $merge_kits3: map-merge($merge_kits2, $text_colors);
7
- $icon_colors: map-merge($merge_kits3, $data_colors);
13
+ $merge_kits4: map-merge($merge_kits3, $data_colors);
14
+ $icon_colors: map-merge($merge_kits4, $additional_colors);
8
15
 
9
16
  .pb_custom_icon, .pb_icon_kit {
10
17
  @each $color_name, $color_value in $icon_colors {
@@ -1,5 +1,11 @@
1
- <%= pb_rails("flex", props: {orientation: "column"}) do %>
2
- <%= pb_rails("icon", props: { icon: "user", fixed_width: true, color: "primary", padding_bottom: "sm", size: "2x" }) %>
3
- <%= pb_rails("icon", props: { icon: "recycle", fixed_width: true, color: "data_4", padding_bottom: "sm", size: "2x" }) %>
1
+ <%= pb_rails("flex", props: { margin_bottom: "sm" }) do %>
2
+ <%= pb_rails("icon", props: { icon: "user", fixed_width: true, color: "primary", size: "2x" }) %>
3
+ <%= pb_rails("icon", props: { icon: "recycle", fixed_width: true, color: "data_4", size: "2x" }) %>
4
4
  <%= pb_rails("icon", props: { icon: "roofing", fixed_width: true, color: "product_5_background", size: "2x" }) %>
5
- <% end %>
5
+ <% end %>
6
+
7
+ <%= pb_rails("flex", props: {}) do %>
8
+ <%= pb_rails("icon", props: { icon: "user", fixed_width: true, color: "light", size: "2x" }) %>
9
+ <%= pb_rails("icon", props: { icon: "recycle", fixed_width: true, color: "lighter", size: "2x" }) %>
10
+ <%= pb_rails("icon", props: { icon: "roofing", fixed_width: true, color: "link", size: "2x" }) %>
11
+ <% end %>
@@ -1,32 +1,57 @@
1
1
  import React from "react"
2
2
  import Icon from "../_icon"
3
+ import Flex from "../../pb_flex/_flex"
3
4
 
4
5
  const IconDefault = (props) => {
5
6
  return (
6
- <div style={{ display: "flex", flexDirection: "column"}}>
7
- <Icon
8
- color="primary"
9
- fixedWidth
10
- icon="user"
11
- paddingBottom="sm"
12
- size="2x"
13
- {...props}
14
- />
15
- <Icon
16
- color="data_4"
17
- fixedWidth
18
- icon="recycle"
19
- paddingBottom="sm"
20
- size="2x"
21
- {...props}
22
- />
23
- <Icon
24
- color="product_5_background"
25
- fixedWidth
26
- icon="product-roofing"
27
- size="2x"
28
- {...props}
29
- />
7
+ <div>
8
+ <Flex marginBottom="sm">
9
+ <Icon
10
+ color="primary"
11
+ fixedWidth
12
+ icon="user"
13
+ size="2x"
14
+ {...props}
15
+ />
16
+ <Icon
17
+ color="data_4"
18
+ fixedWidth
19
+ icon="recycle"
20
+ size="2x"
21
+ {...props}
22
+ />
23
+ <Icon
24
+ color="product_5_background"
25
+ fixedWidth
26
+ icon="product-roofing"
27
+ size="2x"
28
+ {...props}
29
+ />
30
+ </Flex>
31
+
32
+ <Flex>
33
+ <Icon
34
+ color="light"
35
+ fixedWidth
36
+ icon="user"
37
+ size="2x"
38
+ {...props}
39
+ />
40
+ <Icon
41
+ color="lighter"
42
+ fixedWidth
43
+ icon="recycle"
44
+ size="2x"
45
+ {...props}
46
+ />
47
+ <Icon
48
+ color="link"
49
+ fixedWidth
50
+ icon="product-roofing"
51
+ size="2x"
52
+ {...props}
53
+ />
54
+ </Flex>
30
55
  </div>
31
56
  )
32
57
  }
@@ -1,4 +1,4 @@
1
- import { debounce } from "../../utilities/object"
1
+ import { debounce } from 'lodash'
2
2
  import { useCallback, useMemo, useState } from 'react'
3
3
 
4
4
  export default function useVisibility(initialState = false) {
@@ -88,7 +88,11 @@ export const getDefaultCheckedItems = (
88
88
  items.forEach((item: { [key: string]: any }) => {
89
89
  if (item.checked) {
90
90
  if (item.children && item.children.length > 0) {
91
- const uncheckedChildren = item.children.filter(
91
+ // Filter out disabled children (only consider selectable items)
92
+ const selectableChildren = item.children.filter(
93
+ (child: { [key: string]: any }) => !child.disabled
94
+ );
95
+ const uncheckedChildren = selectableChildren.filter(
92
96
  (child: { [key: string]: any }) => !child.checked
93
97
  );
94
98
  if (uncheckedChildren.length === 0) {
@@ -9,7 +9,7 @@ import {
9
9
  } from "../utilities/props";
10
10
  import Icon from "../pb_icon/_icon";
11
11
  import FormPill from "../pb_form_pill/_form_pill";
12
- import { cloneDeep } from "../utilities/object";
12
+ import { cloneDeep } from "lodash";
13
13
  import MultiLevelSelectOptions from "./multi_level_select_options";
14
14
  import MultiLevelSelectContext from "./context";
15
15
 
@@ -113,7 +113,9 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
113
113
  return;
114
114
  }
115
115
  return tree.map((item: { [key: string]: any }) => {
116
- item.checked = check;
116
+ if (!item.disabled) {
117
+ item.checked = check;
118
+ }
117
119
  item.children = modifyRecursive(item.children, check);
118
120
  return item;
119
121
  });
@@ -124,12 +126,16 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
124
126
  treeData: { [key: string]: any }[],
125
127
  selectedIds: string[],
126
128
  parent_id: string | null = null,
127
- depth = 0
129
+ depth = 0,
130
+ parentDisabled = false
128
131
  ) => {
129
132
  if (!Array.isArray(treeData)) {
130
133
  return;
131
134
  }
132
135
  return treeData.map((item: { [key: string]: any } | any) => {
136
+ // An item is disabled if it is explicitly set as disabled or if its parent is disabled
137
+ const isDisabled = item.disabled || (parentDisabled && !returnAllSelected);
138
+
133
139
  const newItem = {
134
140
  ...item,
135
141
  checked: Boolean(
@@ -137,6 +143,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
137
143
  ),
138
144
  parent_id,
139
145
  depth,
146
+ disabled: isDisabled,
140
147
  };
141
148
  if (newItem.children && newItem.children.length > 0) {
142
149
  const children =
@@ -147,7 +154,8 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
147
154
  children,
148
155
  selectedIds,
149
156
  newItem.id,
150
- depth + 1
157
+ depth + 1,
158
+ isDisabled
151
159
  );
152
160
  }
153
161
  return newItem;
@@ -244,8 +252,9 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
244
252
  return tree.map((item: any) => {
245
253
  if (item.id != id) item.children = modifyValue(id, item.children, check);
246
254
  else {
247
- item.checked = check;
248
-
255
+ if (!item.disabled) {
256
+ item.checked = check;
257
+ }
249
258
  if (variant === "single") {
250
259
  // Single select: no children should be checked
251
260
  item.children = modifyRecursive(item.children, !check);
@@ -66,7 +66,7 @@
66
66
 
67
67
  <%= pb_rails("multi_level_select", props: {
68
68
  disabled: true,
69
- id: "multi-level-select-default-rails",
69
+ id: "multi-level-select-disabled-rails",
70
70
  name: "my_array",
71
71
  tree_data: treeData
72
72
  }) %>
@@ -0,0 +1,76 @@
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
+ disabled: true,
18
+ },
19
+ {
20
+ label: "Business Affairs",
21
+ value: "Business Affairs",
22
+ id: "business1",
23
+ children: [
24
+ {
25
+ label: "Initiatives",
26
+ value: "Initiatives",
27
+ id: "initiative1",
28
+ disabled: true,
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
+ disabled: true,
59
+ },
60
+ {
61
+ label: "Energy",
62
+ value: "Energy",
63
+ id: "energy1",
64
+ },
65
+ ],
66
+ },
67
+ ],
68
+ }] %>
69
+
70
+
71
+ <%= pb_rails("multi_level_select", props: {
72
+ id: "multi-level-select-disabled-options-rails",
73
+ name: "disabled_options",
74
+ return_all_selected: true,
75
+ tree_data: treeData
76
+ }) %>
@@ -0,0 +1,94 @@
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
+ disabled: true,
22
+ },
23
+ {
24
+ label: "Business Affairs",
25
+ value: "Business Affairs",
26
+ id: "business1",
27
+ children: [
28
+ {
29
+ label: "Initiatives",
30
+ value: "Initiatives",
31
+ id: "initiative1",
32
+ disabled: true,
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
+ disabled: true,
63
+ },
64
+ {
65
+ label: "Energy",
66
+ value: "Energy",
67
+ id: "energy1",
68
+ },
69
+ ],
70
+ },
71
+ ],
72
+ },
73
+ ];
74
+
75
+ const MultiLevelSelectDisabledOptions = (props) => {
76
+ return (
77
+ <div>
78
+ <MultiLevelSelect
79
+ id='multiselect-disabled-options'
80
+ onSelect={(selectedNodes) =>
81
+ console.log(
82
+ "Selected Items",
83
+ selectedNodes
84
+ )
85
+ }
86
+ returnAllSelected
87
+ treeData={treeData}
88
+ {...props}
89
+ />
90
+ </div>
91
+ )
92
+ };
93
+
94
+ export default MultiLevelSelectDisabledOptions;
@@ -0,0 +1 @@
1
+ individual items can also be disabled by including the `disabled:true` within the object on the treeData for the `returnAllSelected`/`return_all_selected` variant. As noted above, this variant will return data on all checked nodes from the dropdown, irrespective of whether it is a parent or child node.
@@ -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
+ disabled: true,
18
+ },
19
+ {
20
+ label: "Business Affairs",
21
+ value: "Business Affairs",
22
+ id: "business1",
23
+ children: [
24
+ {
25
+ label: "Initiatives",
26
+ value: "Initiatives",
27
+ id: "initiative1",
28
+ disabled: true,
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
+ disabled: true,
59
+ },
60
+ {
61
+ label: "Energy",
62
+ value: "Energy",
63
+ id: "energy1",
64
+ },
65
+ ],
66
+ },
67
+ ],
68
+ }] %>
69
+
70
+
71
+ <%= pb_rails("multi_level_select", props: {
72
+ id: "multi-level-select-disabled-options-default-rails",
73
+ name: "disabled_options_default",
74
+ tree_data: treeData
75
+ }) %>
@@ -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
+ disabled: true,
22
+ },
23
+ {
24
+ label: "Business Affairs",
25
+ value: "Business Affairs",
26
+ id: "business1",
27
+ children: [
28
+ {
29
+ label: "Initiatives",
30
+ value: "Initiatives",
31
+ id: "initiative1",
32
+ disabled: true,
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
+ disabled: true,
63
+ },
64
+ {
65
+ label: "Energy",
66
+ value: "Energy",
67
+ id: "energy1",
68
+ },
69
+ ],
70
+ },
71
+ ],
72
+ },
73
+ ];
74
+
75
+ const MultiLevelSelectDisabledOptionsDefault = (props) => {
76
+ return (
77
+ <div>
78
+ <MultiLevelSelect
79
+ id='multiselect-disabled-options-default'
80
+ onSelect={(selectedNodes) =>
81
+ console.log(
82
+ "Selected Items",
83
+ selectedNodes
84
+ )
85
+ }
86
+ treeData={treeData}
87
+ {...props}
88
+ />
89
+ </div>
90
+ )
91
+ };
92
+
93
+ export default MultiLevelSelectDisabledOptionsDefault;
@@ -0,0 +1,3 @@
1
+ To disable individual items in the treeData, include `disabled:true` within the object on the treeData that you want disabled. See the code snippet below for an example of how to do this.
2
+
3
+ If a parent is selected, the parent will be returned in the selected items list, even if it has disabled children.