playbook_ui 12.26.1 → 12.27.0.pre.alpha.expandednotworking853

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +11 -9
  3. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss +1 -1
  4. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_week_styles.scss +1 -1
  5. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +1 -1
  6. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +161 -127
  7. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +17 -17
  8. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +8 -4
  9. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.md +2 -2
  10. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.html.erb +19 -16
  11. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.jsx +2 -2
  12. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_form.html.erb +72 -0
  13. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +1 -0
  14. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +7 -3
  15. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +3 -0
  16. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +109 -44
  17. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +14 -0
  18. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +60 -0
  19. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
  20. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  21. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +6 -0
  22. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +110 -62
  23. data/app/pb_kits/playbook/pb_rich_text_editor/_trix_styles.scss +2 -2
  24. data/app/pb_kits/playbook/pb_title/_title.scss +1 -1
  25. data/app/pb_kits/playbook/pb_title/_title.tsx +2 -3
  26. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.html.erb +1 -0
  27. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.jsx +6 -0
  28. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.md +1 -2
  29. data/app/pb_kits/playbook/pb_title/title.rb +3 -10
  30. data/app/pb_kits/playbook/pb_title/title.test.js +3 -3
  31. data/app/pb_kits/playbook/utilities/object.ts +3 -0
  32. data/dist/playbook-rails.js +4 -4
  33. data/lib/playbook/forms/builder/intl_telephone_field.rb +12 -0
  34. data/lib/playbook/forms/builder/multi_level_select_field.rb +12 -0
  35. data/lib/playbook/forms/builder.rb +2 -0
  36. data/lib/playbook/version.rb +2 -2
  37. metadata +13 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fbc9b56c02a9915257f3a1169f85773e8a063c14de44a2492a250f9015dee65
4
- data.tar.gz: f70c024e4feae26b0767595ad538df87eb08e78453a56c6ca22de07552d60d5d
3
+ metadata.gz: 3a910f0a34e4b15a05338890da54fbc4127569527ff821e0a1bc1d7798907b7b
4
+ data.tar.gz: 06da8f4e5abcae0b35ae9bb2bfcbc086fc334b92d8d0f18cdbbb61bd9e69cfbb
5
5
  SHA512:
6
- metadata.gz: e40a155458785168e1fb5f5f63efe8c5bcd7dca3d1b8c618557d86453d5008336454d205330742fc029e6593e05e566610eb853577b42a993934eeb20408ffa5
7
- data.tar.gz: 9acc8dcd73190cc433572b49bdef61cb4e425304125aaf8d5b61c7426f5f4c2a314f1e2b38e9b55a5f37b6f45b56cb8079ec9b82070c461699ae9b2357689a2d
6
+ metadata.gz: 7231015efe6dd12735a8b4ac07b6596b97ec320e7f13ce29ba67eccbd827f6ba0a3f63f52a76d5bcb29a429bbc9f653ffa0afea79d686976e1ad84b304aea0bc
7
+ data.tar.gz: 7f57205311d9ff7bb7f5df373d176fc921c917c88ca2fd3d8f413f10294fe214915a34c9dfa63dc57194312c70cb628ea50bb19df5e5b72c1510a1bcb7df2ec9
@@ -1,4 +1,6 @@
1
1
  // Manual Import -- Flatpickr Styles
2
+ @import "./tokens/typography";
3
+
2
4
  .flatpickr-calendar {
3
5
  background: transparent;
4
6
  opacity: 0;
@@ -295,7 +297,7 @@
295
297
  .flatpickr-current-month {
296
298
  font-size: 135%;
297
299
  line-height: inherit;
298
- font-weight: 300;
300
+ font-weight: $light;
299
301
  color: inherit;
300
302
  position: absolute;
301
303
  width: 75%;
@@ -310,7 +312,7 @@
310
312
  }
311
313
  .flatpickr-current-month span.cur-month {
312
314
  font-family: inherit;
313
- font-weight: 700;
315
+ font-weight: $bolder;
314
316
  color: inherit;
315
317
  display: inline-block;
316
318
  margin-left: 0.5ch;
@@ -341,7 +343,7 @@
341
343
  display: inline-block;
342
344
  font-size: inherit;
343
345
  font-family: inherit;
344
- font-weight: 300;
346
+ font-weight: $light;
345
347
  line-height: inherit;
346
348
  height: auto;
347
349
  border: 0;
@@ -371,7 +373,7 @@
371
373
  cursor: pointer;
372
374
  font-size: inherit;
373
375
  font-family: inherit;
374
- font-weight: 300;
376
+ font-weight: $light;
375
377
  height: auto;
376
378
  line-height: inherit;
377
379
  margin: -1px 0 0 0;
@@ -492,7 +494,7 @@ span.flatpickr-weekday {
492
494
  box-sizing: border-box;
493
495
  color: #393939;
494
496
  cursor: pointer;
495
- font-weight: 400;
497
+ font-weight: $regular;
496
498
  width: 14.2857143%;
497
499
  -webkit-flex-basis: 14.2857143%;
498
500
  -ms-flex-preferred-size: 14.2857143%;
@@ -707,11 +709,11 @@ span.flatpickr-weekday {
707
709
  appearance: textfield;
708
710
  }
709
711
  .flatpickr-time input.flatpickr-hour {
710
- font-weight: bold;
712
+ font-weight: $bolder;
711
713
  }
712
714
  .flatpickr-time input.flatpickr-minute,
713
715
  .flatpickr-time input.flatpickr-second {
714
- font-weight: 400;
716
+ font-weight: $regular;
715
717
  }
716
718
  .flatpickr-time input:focus {
717
719
  outline: 0;
@@ -723,7 +725,7 @@ span.flatpickr-weekday {
723
725
  float: left;
724
726
  line-height: inherit;
725
727
  color: #393939;
726
- font-weight: bold;
728
+ font-weight: $bolder;
727
729
  width: 2%;
728
730
  -webkit-user-select: none;
729
731
  -moz-user-select: none;
@@ -738,7 +740,7 @@ span.flatpickr-weekday {
738
740
  width: 18%;
739
741
  cursor: pointer;
740
742
  text-align: center;
741
- font-weight: 400;
743
+ font-weight: $regular;
742
744
  }
743
745
  .flatpickr-time input:hover,
744
746
  .flatpickr-time .flatpickr-am-pm:hover,
@@ -20,7 +20,7 @@
20
20
  color: $text_lt_default;
21
21
  cursor: pointer;
22
22
  display: inline-block;
23
- font-weight: 400;
23
+ font-weight: $regular;
24
24
  margin: 0.5px;
25
25
  justify-content: center;
26
26
  padding: 10px;
@@ -20,7 +20,7 @@
20
20
  color: $text_lt_default;
21
21
  cursor: pointer;
22
22
  display: inline-block;
23
- font-weight: 400;
23
+ font-weight: $regular;
24
24
  margin: 0.5px;
25
25
  justify-content: center;
26
26
  padding: 10px;
@@ -56,7 +56,7 @@ $form_pill_colors: (
56
56
  height: -moz-fit-content;
57
57
  .pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag {
58
58
  font-size: 16px;
59
- font-weight: 400;
59
+ font-weight: $regular;
60
60
  }
61
61
  .pb_form_pill_text, .pb_form_pill_tag {
62
62
  line-height: 1.7;
@@ -1,12 +1,12 @@
1
- import React, { useState, useEffect, useRef } from "react";
2
- import classnames from "classnames";
3
- import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
4
- import { globalProps, GlobalProps } from "../utilities/globalProps";
5
- import Icon from "../pb_icon/_icon";
6
- import Checkbox from "../pb_checkbox/_checkbox";
7
- import FormPill from "../pb_form_pill/_form_pill";
8
- import CircleIconButton from "../pb_circle_icon_button/_circle_icon_button";
9
- import { cloneDeep } from "lodash";
1
+ import React, { useState, useEffect, useRef } from "react"
2
+ import classnames from "classnames"
3
+ import { globalProps, GlobalProps } from "../utilities/globalProps"
4
+ import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props"
5
+ import Checkbox from "../pb_checkbox/_checkbox"
6
+ import Icon from "../pb_icon/_icon"
7
+ import FormPill from "../pb_form_pill/_form_pill"
8
+ import CircleIconButton from "../pb_circle_icon_button/_circle_icon_button"
9
+ import { cloneDeep } from "lodash"
10
10
 
11
11
  import {
12
12
  getAncestorsOfUnchecked,
@@ -15,17 +15,18 @@ import {
15
15
  getCheckedItems,
16
16
  getDefaultCheckedItems,
17
17
  recursiveCheckParent,
18
- } from "./_helper_functions";
18
+ } from "./_helper_functions"
19
19
 
20
20
  type MultiLevelSelectProps = {
21
- aria?: { [key: string]: string };
22
- className?: string;
23
- data?: { [key: string]: string };
24
- id?: string;
25
- returnAllSelected?: boolean;
26
- treeData?: { [key: string]: string }[];
27
- onSelect?: (prop: { [key: string]: any }) => void;
28
- } & GlobalProps;
21
+ aria?: { [key: string]: string }
22
+ className?: string
23
+ data?: { [key: string]: string }
24
+ id?: string
25
+ name?: string
26
+ returnAllSelected?: boolean
27
+ treeData?: { [key: string]: string }[]
28
+ onSelect?: (prop: { [key: string]: any }) => void
29
+ } & GlobalProps
29
30
 
30
31
  const MultiLevelSelect = (props: MultiLevelSelectProps) => {
31
32
  const {
@@ -33,71 +34,95 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
33
34
  className,
34
35
  data = {},
35
36
  id,
37
+ name,
36
38
  returnAllSelected = false,
37
39
  treeData,
38
40
  onSelect = () => {},
39
- } = props;
41
+ } = props
40
42
 
41
- const ariaProps = buildAriaProps(aria);
42
- const dataProps = buildDataProps(data);
43
+ const ariaProps = buildAriaProps(aria)
44
+ const dataProps = buildDataProps(data)
43
45
  const classes = classnames(
44
46
  buildCss("pb_multi_level_select"),
45
47
  globalProps(props),
46
48
  className
47
- );
49
+ )
48
50
 
49
- const dropdownRef = useRef(null);
51
+ const dropdownRef = useRef(null)
52
+
53
+
54
+ const getExpandedItems = (treeData: { [key: string]: string }[]) => {
55
+ let expandedItems: any[] = [];
56
+
57
+ const traverse = (items: string | any[]) => {
58
+ for (let i = 0; i < items.length; i++) {
59
+ const item = items[i];
60
+ if (item.expanded) {
61
+ expandedItems.push(item.id);
62
+ }
63
+ if (Array.isArray(item.children)) {
64
+ traverse(item.children);
65
+ }
66
+ }
67
+ }
68
+
69
+ traverse(treeData);
70
+ return expandedItems;
71
+ }
50
72
 
51
- //state for expanded property
52
- const [expanded, setExpanded] = useState([]);
53
73
  //state for whether dropdown is open or closed
54
- const [isClosed, setIsClosed] = useState(true);
74
+ const [isClosed, setIsClosed] = useState(true)
55
75
  //state from onchange for textinput, to use for filtering to create typeahead
56
- const [filterItem, setFilterItem] = useState("");
76
+ const [filterItem, setFilterItem] = useState("")
57
77
  //this is essentially the return that the user will get when they use the kit
58
- const [returnedArray, setReturnedArray] = useState([]);
78
+ const [returnedArray, setReturnedArray] = useState([])
59
79
  //formattedData with checked and parent_id added
60
- const [formattedData, setFormattedData] = useState([]);
80
+ const [formattedData, setFormattedData] = useState([])
61
81
  //state for return for default
62
- const [defaultReturn, setDefaultReturn] = useState([]);
82
+ const [defaultReturn, setDefaultReturn] = useState([])
83
+ // Get expanded items from treeData.
84
+ const initialExpandedItems = getExpandedItems(treeData);
85
+ // Initialize state with expanded items.
86
+ const [expanded, setExpanded] = useState(initialExpandedItems);
87
+
63
88
 
64
89
  useEffect(() => {
65
- setFormattedData(addCheckedAndParentProperty(treeData));
66
- }, [treeData]);
90
+ setFormattedData(addCheckedAndParentProperty(treeData))
91
+ }, [treeData])
67
92
 
68
93
  useEffect(() => {
69
94
  if (returnAllSelected) {
70
- setReturnedArray(getCheckedItems(formattedData));
95
+ setReturnedArray(getCheckedItems(formattedData))
71
96
  } else {
72
- setDefaultReturn(getDefaultCheckedItems(formattedData));
97
+ setDefaultReturn(getDefaultCheckedItems(formattedData))
73
98
  }
74
- }, [formattedData]);
99
+ }, [formattedData])
75
100
 
76
101
  useEffect(() => {
77
102
  // Function to handle clicks outside the dropdown
78
103
  const handleClickOutside = (event: any) => {
79
104
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
80
- setIsClosed(true);
105
+ setIsClosed(true)
81
106
  }
82
- };
107
+ }
83
108
  // Attach the event listener
84
- window.addEventListener("click", handleClickOutside);
109
+ window.addEventListener("click", handleClickOutside)
85
110
  // Clean up the event listener on unmount
86
111
  return () => {
87
- window.removeEventListener("click", handleClickOutside);
88
- };
89
- }, []);
112
+ window.removeEventListener("click", handleClickOutside)
113
+ }
114
+ }, [])
90
115
 
91
116
  const modifyRecursive = (tree: { [key: string]: any }[], check: boolean) => {
92
117
  if (!Array.isArray(tree)) {
93
- return;
118
+ return
94
119
  }
95
120
  return tree.map((item: { [key: string]: any }) => {
96
- item.checked = check;
97
- item.children = modifyRecursive(item.children, check);
98
- return item;
99
- });
100
- };
121
+ item.checked = check
122
+ item.children = modifyRecursive(item.children, check)
123
+ return item
124
+ })
125
+ }
101
126
 
102
127
  //iterate over tree, find item and set checked or unchecked
103
128
  const modifyValue = (
@@ -106,137 +131,138 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
106
131
  check: boolean
107
132
  ) => {
108
133
  if (!Array.isArray(tree)) {
109
- return;
134
+ return
110
135
  }
111
136
  return tree.map((item: any) => {
112
- if (item.id != id) item.children = modifyValue(id, item.children, check);
137
+ if (item.id != id) item.children = modifyValue(id, item.children, check)
113
138
  else {
114
- item.checked = check;
115
- item.children = modifyRecursive(item.children, check);
139
+ item.checked = check
140
+ item.children = modifyRecursive(item.children, check)
116
141
  }
117
142
 
118
- return item;
119
- });
120
- };
143
+ return item
144
+ })
145
+ }
121
146
 
122
147
  //clone tree, check items + children
123
148
  const checkItem = (item: { [key: string]: any }) => {
124
- const tree = cloneDeep(formattedData);
149
+ const tree = cloneDeep(formattedData)
125
150
  if (returnAllSelected) {
126
- return modifyValue(item.id, tree, true);
151
+ return modifyValue(item.id, tree, true)
127
152
  } else {
128
- const checkedTree = modifyValue(item.id, tree, true);
129
- return recursiveCheckParent(item, checkedTree);
153
+ const checkedTree = modifyValue(item.id, tree, true)
154
+ return recursiveCheckParent(item, checkedTree)
130
155
  }
131
- };
156
+ }
132
157
 
133
158
  //clone tree, uncheck items + children
134
159
  const unCheckItem = (item: { [key: string]: any }) => {
135
- const tree = cloneDeep(formattedData);
160
+ const tree = cloneDeep(formattedData)
136
161
  if (returnAllSelected) {
137
- return modifyValue(item.id, tree, false);
162
+ return modifyValue(item.id, tree, false)
138
163
  } else {
139
- const uncheckedTree = modifyValue(item.id, tree, false);
140
- return getAncestorsOfUnchecked(uncheckedTree, item);
164
+ const uncheckedTree = modifyValue(item.id, tree, false)
165
+ return getAncestorsOfUnchecked(uncheckedTree, item)
141
166
  }
142
- };
167
+ }
143
168
 
144
169
  //setformattedData with proper properties
145
170
  const changeItem = (item: { [key: string]: any }, check: boolean) => {
146
- const tree = check ? checkItem(item) : unCheckItem(item);
147
- setFormattedData(tree);
171
+ const tree = check ? checkItem(item) : unCheckItem(item)
172
+ setFormattedData(tree)
173
+
174
+ return tree
175
+ }
176
+
148
177
 
149
- return tree;
150
- };
151
178
 
152
179
  //function to map over data and add parent_id + depth property to each item
153
180
  const addCheckedAndParentProperty = (
154
181
  treeData: { [key: string]: any }[],
155
182
  parent_id: string = null,
156
- depth: number = 0
183
+ depth: number = 0,
157
184
  ) => {
158
185
  if (!Array.isArray(treeData)) {
159
- return;
186
+ return
160
187
  }
161
188
  return treeData.map((item: { [key: string]: any } | any) => {
162
189
  const newItem = {
163
190
  ...item,
164
191
  parent_id,
165
192
  depth,
166
- };
193
+ }
167
194
  if (newItem.children && newItem.children.length > 0) {
168
195
  const children =
169
196
  item.checked && !returnAllSelected
170
197
  ? modifyRecursive(item.children, true)
171
- : item.children;
198
+ : item.children
172
199
  newItem.children = addCheckedAndParentProperty(
173
200
  children,
174
201
  newItem.id,
175
202
  depth + 1
176
- );
203
+ )
177
204
  }
178
- return newItem;
179
- });
180
- };
205
+ return newItem
206
+ })
207
+ }
181
208
 
182
209
  //click event for x on form pill
183
210
  const handlePillClose = (event: any, clickedItem: { [key: string]: any }) => {
184
211
  // prevents the dropdown from closing when clicking on the pill
185
- event.stopPropagation();
186
- const updatedTree = changeItem(clickedItem, false);
212
+ event.stopPropagation()
213
+ const updatedTree = changeItem(clickedItem, false)
187
214
  //logic for removing items from returnArray or defaultReturn when pills clicked
188
215
  if (returnAllSelected) {
189
- onSelect(getCheckedItems(updatedTree));
216
+ onSelect(getCheckedItems(updatedTree))
190
217
  } else {
191
- onSelect(getDefaultCheckedItems(updatedTree));
218
+ onSelect(getDefaultCheckedItems(updatedTree))
192
219
  }
193
- };
220
+ }
194
221
 
195
222
  //handle click on input wrapper(entire div with pills, typeahead, etc) so it doesn't close when input or form pill is clicked
196
223
  const handleInputWrapperClick = (e: any) => {
197
- e.stopPropagation();
224
+ e.stopPropagation()
198
225
  if (
199
226
  e.target.id === "multiselect_input" ||
200
227
  e.target.classList.contains("pb_form_pill_tag")
201
228
  ) {
202
- return;
229
+ return
203
230
  }
204
- setIsClosed(!isClosed);
205
- };
231
+ setIsClosed(!isClosed)
232
+ }
206
233
 
207
234
  //Main function to handle any click inside dropdown
208
235
  const handledropdownItemClick = (e: any, check: boolean) => {
209
- const clickedItem = e.target.parentNode.id;
236
+ const clickedItem = e.target.parentNode.id
210
237
  //setting filterItem to "" will clear textinput and clear typeahead
211
- setFilterItem("");
238
+ setFilterItem("")
212
239
 
213
- const filtered = filterFormattedDataById(formattedData, clickedItem);
214
- const updatedTree = changeItem(filtered[0], check);
215
- console.log(updatedTree);
240
+ const filtered = filterFormattedDataById(formattedData, clickedItem)
241
+ const updatedTree = changeItem(filtered[0], check)
216
242
  if (returnAllSelected) {
217
- onSelect(getCheckedItems(updatedTree));
243
+ onSelect(getCheckedItems(updatedTree))
218
244
  } else {
219
- onSelect(getDefaultCheckedItems(updatedTree));
245
+ onSelect(getDefaultCheckedItems(updatedTree))
220
246
  }
221
- };
247
+ }
222
248
 
223
- const isExpanded = (item: any) => expanded.indexOf(item.id) > -1;
249
+ const isExpanded = (item: any) => expanded.indexOf(item.id) > -1
224
250
 
225
251
  //handle click on chevron toggles in dropdown
226
252
  const handleToggleClick = (id: string, event: React.MouseEvent) => {
227
- event.stopPropagation();
228
- const clickedItem = filterFormattedDataById(formattedData, id);
253
+ event.stopPropagation()
254
+ const clickedItem = filterFormattedDataById(formattedData, id)
229
255
  if (clickedItem) {
230
- let expandedArray = [...expanded];
231
- const itemExpanded = isExpanded(clickedItem[0]);
256
+ let expandedArray = [...expanded]
257
+ const itemExpanded = isExpanded(clickedItem[0])
232
258
 
233
259
  if (itemExpanded)
234
- expandedArray = expandedArray.filter((i) => i != clickedItem[0].id);
235
- else expandedArray.push(clickedItem[0].id);
260
+ expandedArray = expandedArray.filter((i) => i != clickedItem[0].id)
261
+ else expandedArray.push(clickedItem[0].id)
236
262
 
237
- setExpanded(expandedArray);
263
+ setExpanded(expandedArray)
238
264
  }
239
- };
265
+ }
240
266
 
241
267
  //rendering formattedData to UI based on typeahead
242
268
  const renderNestedOptions = (items: { [key: string]: any }[]) => {
@@ -245,9 +271,9 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
245
271
  {Array.isArray(items) &&
246
272
  items.map((item: { [key: string]: any }) => {
247
273
  return (
248
- <>
249
- <li key={item.id} className="dropdown_item" data-name={item.id}>
250
- <div className="dropdown_item_checkbox_row">
274
+ <div key={item.id}>
275
+ <li className='dropdown_item' data-name={item.id}>
276
+ <div className='dropdown_item_checkbox_row'>
251
277
  <div
252
278
  key={isExpanded(item) ? "chevron-down" : "chevron-right"}
253
279
  >
@@ -263,17 +289,17 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
263
289
  onClick={(event: any) =>
264
290
  handleToggleClick(item.id, event)
265
291
  }
266
- variant="link"
292
+ variant='link'
267
293
  />
268
294
  </div>
269
295
  <Checkbox text={item.label} id={item.id}>
270
296
  <input
271
297
  checked={item.checked}
272
- type="checkbox"
298
+ type='checkbox'
273
299
  name={item.label}
274
300
  value={item.label}
275
301
  onChange={(e) => {
276
- handledropdownItemClick(e, !item.checked);
302
+ handledropdownItemClick(e, !item.checked)
277
303
  }}
278
304
  />
279
305
  </Checkbox>
@@ -285,24 +311,32 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
285
311
  <div>{renderNestedOptions(item.children)}</div>
286
312
  )}
287
313
  </li>
288
- </>
289
- );
314
+ </div>
315
+ )
290
316
  })}
291
317
  </ul>
292
- );
293
- };
318
+ )
319
+ }
320
+
321
+
294
322
 
295
323
  return (
296
324
  <div {...ariaProps} {...dataProps} className={classes} id={id}>
297
- <div ref={dropdownRef} className="wrapper">
298
- <div className="input_wrapper" onClick={handleInputWrapperClick}>
299
- <div className="input_inner_container">
325
+ <div ref={dropdownRef} className='wrapper'>
326
+ <div className='input_wrapper' onClick={handleInputWrapperClick}>
327
+ <div className='input_inner_container'>
328
+ {returnedArray.length !== 0 && returnAllSelected
329
+ ? returnedArray.map((item) => (
330
+ <input type='hidden' name={`${name}[]`} value={item.id} />
331
+ ))
332
+ : null}
333
+
300
334
  {returnedArray.length !== 0 && returnAllSelected
301
335
  ? returnedArray.map((item, index) => (
302
336
  <FormPill
303
337
  key={index}
304
338
  text={item.label}
305
- size="small"
339
+ size='small'
306
340
  onClick={(event: any) => handlePillClose(event, item)}
307
341
  />
308
342
  ))
@@ -313,29 +347,29 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
313
347
  <FormPill
314
348
  key={index}
315
349
  text={item.label}
316
- size="small"
350
+ size='small'
317
351
  onClick={(event: any) => handlePillClose(event, item)}
318
352
  />
319
353
  ))}
320
354
  {returnedArray.length !== 0 && returnAllSelected && <br />}
321
355
  {defaultReturn.length !== 0 && !returnAllSelected && <br />}
322
356
  <input
323
- id="multiselect_input"
357
+ id='multiselect_input'
324
358
  onChange={(e) => {
325
- setFilterItem(e.target.value);
359
+ setFilterItem(e.target.value)
326
360
  }}
327
- placeholder="Start typing..."
361
+ placeholder='Start typing...'
328
362
  value={filterItem}
329
363
  onClick={() => setIsClosed(false)}
330
364
  />
331
365
  </div>
332
366
  {isClosed ? (
333
- <div key="chevron-down">
334
- <Icon icon="chevron-down" />
367
+ <div key='chevron-down'>
368
+ <Icon icon='chevron-down' />
335
369
  </div>
336
370
  ) : (
337
- <div key="chevron-up">
338
- <Icon icon="chevron-up" />
371
+ <div key='chevron-up'>
372
+ <Icon icon='chevron-up' />
339
373
  </div>
340
374
  )}
341
375
  </div>
@@ -346,7 +380,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
346
380
  </div>
347
381
  </div>
348
382
  </div>
349
- );
350
- };
383
+ )
384
+ }
351
385
 
352
- export default MultiLevelSelect;
386
+ export default MultiLevelSelect