playbook_ui 14.16.0.pre.rc.6 → 14.17.0.pre.alpha.play1499backgroundkitoverlay7105

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 (173) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.html.erb +39 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
  20. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
  22. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
  23. data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
  24. data/app/pb_kits/playbook/pb_background/_background.tsx +8 -4
  25. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +36 -0
  26. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
  27. data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
  28. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  29. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
  30. data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
  31. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
  32. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
  33. data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
  34. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
  35. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
  36. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
  37. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
  38. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
  39. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
  40. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
  41. data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
  42. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +115 -5
  43. data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +6 -4
  44. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +91 -24
  45. data/app/pb_kits/playbook/pb_draggable/context/types.ts +35 -28
  46. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +184 -0
  47. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +5 -0
  48. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +97 -0
  49. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -0
  50. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +3 -3
  51. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +11 -2
  52. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +65 -6
  53. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
  54. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
  57. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
  59. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
  60. data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
  61. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -2
  62. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
  63. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +67 -0
  64. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +67 -0
  65. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
  66. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
  67. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
  68. data/app/pb_kits/playbook/pb_icon/_icon.scss +8 -1
  69. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
  70. data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
  71. data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
  72. data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +4 -1
  73. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +13 -0
  74. data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -0
  75. data/app/pb_kits/playbook/pb_icon_button/docs/index.js +1 -0
  76. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
  77. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
  78. data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
  79. data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
  80. data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
  81. data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
  82. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
  83. data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
  84. data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
  85. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  86. data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
  87. data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
  88. data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
  89. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
  91. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
  92. data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
  93. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
  94. data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
  95. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +23 -0
  96. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +28 -1
  97. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +72 -0
  98. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +97 -0
  99. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +71 -0
  100. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +91 -0
  101. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +4 -0
  102. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +3 -1
  103. data/app/pb_kits/playbook/pb_multi_level_select/index.js +105 -0
  104. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +10 -0
  105. data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
  106. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
  107. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
  108. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
  109. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
  110. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
  111. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
  112. data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
  113. data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
  114. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
  115. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
  116. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
  117. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
  118. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  119. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  120. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
  121. data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
  122. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
  123. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
  124. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
  125. data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
  126. data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
  127. data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
  128. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
  129. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
  130. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
  131. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
  132. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
  133. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
  134. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  135. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  136. data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
  137. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  138. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
  139. data/app/pb_kits/playbook/pb_user/_user.tsx +78 -13
  140. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
  141. data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
  142. data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
  143. data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
  144. data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
  145. data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
  146. data/app/pb_kits/playbook/pb_user/user.html.erb +28 -12
  147. data/app/pb_kits/playbook/pb_user/user.rb +17 -1
  148. data/app/pb_kits/playbook/pb_user/user.test.js +182 -1
  149. data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
  150. data/app/pb_kits/playbook/tokens/_colors.scss +1 -4
  151. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  152. data/app/pb_kits/playbook/utilities/object.test.js +287 -1
  153. data/app/pb_kits/playbook/utilities/object.ts +171 -3
  154. data/app/pb_kits/playbook/utilities/text.ts +1 -1
  155. data/dist/chunks/_typeahead-ySWHB-7p.js +22 -0
  156. data/dist/chunks/_weekday_stacked-36N8xzXL.js +45 -0
  157. data/dist/chunks/lib-BGzBzFZX.js +29 -0
  158. data/dist/chunks/{pb_form_validation-BvDxpfs-.js → pb_form_validation-BvNy9Bd6.js} +1 -1
  159. data/dist/chunks/vendor.js +1 -1
  160. data/dist/playbook-doc.js +1 -1
  161. data/dist/playbook-rails-react-bindings.js +1 -1
  162. data/dist/playbook-rails.js +1 -1
  163. data/dist/playbook.css +1 -1
  164. data/lib/playbook/forms/builder/multi_level_select_field.rb +2 -0
  165. data/lib/playbook/kit_base.rb +4 -4
  166. data/lib/playbook/version.rb +2 -2
  167. metadata +41 -9
  168. data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
  169. data/dist/chunks/_typeahead-CRAPc8k-.js +0 -22
  170. data/dist/chunks/_weekday_stacked-T0kFfioG.js +0 -45
  171. data/dist/chunks/lib-BeKPJYlk.js +0 -29
  172. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
  173. /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
@@ -0,0 +1,57 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { GlobalProps, globalProps, globalInlineProps } from '../../utilities/globalProps'
5
+
6
+ type LayoutRoundLabelProps = {
7
+ children: React.ReactNode[] | React.ReactNode,
8
+ className?: string,
9
+ } & GlobalProps
10
+
11
+ export const RoundLabel = (props: LayoutRoundLabelProps) => {
12
+ const { children, className } = props
13
+ const dynamicInlineProps = globalInlineProps(props)
14
+ return (
15
+ <div
16
+ className={classnames('layout_round_label', className)}
17
+ style={dynamicInlineProps}
18
+ >
19
+ {children}
20
+ </div>
21
+ )
22
+ }
23
+
24
+ type LayoutRoundProps = {
25
+ children: React.ReactNode[] | React.ReactNode,
26
+ className?: string,
27
+ numberOfRounds: number,
28
+ } & GlobalProps
29
+
30
+ export const Round = (props: LayoutRoundProps) => {
31
+ const { children, className, numberOfRounds } = props
32
+ const dynamicInlineProps = globalInlineProps(props)
33
+ const numberOfChildren = Array.isArray(children) ? children.length : 0
34
+
35
+ const childrenWithProps = Array.isArray(children) ? children.map((child, index) =>
36
+ React.isValidElement(child) ? React.cloneElement(child, { numberOfRounds, numberOfGames: numberOfChildren, isOdd: index % 2 === 0, key: `child_${index}` }) : child
37
+ ) : children
38
+
39
+ const rightConnectors = Array.from({ length: numberOfChildren / 2 }, (_, index) => (
40
+ <div
41
+ className="right_connector"
42
+ key={`right_connector_${index}`}
43
+ />
44
+ ))
45
+
46
+ return (
47
+ <>
48
+ <div
49
+ className={classnames('layout_round', globalProps(props), className)}
50
+ style={dynamicInlineProps}
51
+ >
52
+ {childrenWithProps}
53
+ </div>
54
+ <div className="connector_container">{rightConnectors}</div>
55
+ </>
56
+ )
57
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { noop } from 'lodash'
2
+ import { noop } from '../../utilities/object'
3
3
  import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch'
4
4
  import Image from '../../pb_image/_image'
5
5
 
@@ -1,4 +1,4 @@
1
- import { noop } from 'lodash'
1
+ import { noop } from '../../utilities/object'
2
2
  import React, { useState } from 'react'
3
3
  import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
4
4
 
@@ -1,4 +1,4 @@
1
- import { noop } from 'lodash'
1
+ import { noop } from '../../utilities/object'
2
2
  import classnames from 'classnames'
3
3
  import React, { useLayoutEffect } from 'react'
4
4
  import { useWindowSize } from '../hooks/useWindowSize'
@@ -1,4 +1,4 @@
1
- import { debounce } from 'lodash'
1
+ import { debounce } from "../../utilities/object"
2
2
  import { useCallback, useMemo, useState } from 'react'
3
3
 
4
4
  export default function useVisibility(initialState = false) {
@@ -8,7 +8,7 @@ import Highcharts from "highcharts";
8
8
  import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
9
9
  import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
10
10
  import mapColors from "../pb_dashboard/pbChartsColorsHelper";
11
- import { merge } from 'lodash'
11
+ import { merge } from '../utilities/object'
12
12
 
13
13
  type LineGraphProps = {
14
14
  align?: "left" | "right" | "center";
@@ -73,7 +73,7 @@ test('adds icon', () => {
73
73
 
74
74
  const kit = screen.getByTestId('icon-test')
75
75
 
76
- const icon = kit.querySelector('.pb_icon_kit')
76
+ const icon = kit.querySelector('.pb_custom_icon')
77
77
  expect(icon).toBeInTheDocument();
78
78
  })
79
79
 
@@ -87,7 +87,7 @@ test('adds icon right', () => {
87
87
 
88
88
  const kit = screen.getByTestId('icon-right-test')
89
89
 
90
- const icon = kit.querySelector('.pb_icon_kit')
90
+ const icon = kit.querySelector('.pb_custom_icon')
91
91
  expect(icon).toBeInTheDocument();
92
92
  })
93
93
 
@@ -10,6 +10,16 @@
10
10
  .pb_multi_level_select {
11
11
  font-family: $font-family-base;
12
12
 
13
+ &.error {
14
+ .wrapper {
15
+ .input_wrapper {
16
+ border-color: $error;
17
+ }
18
+ }
19
+ [class*=pb_body_kit_negative] {
20
+ margin-top: $space_xxs;
21
+ }
22
+ }
13
23
  .wrapper {
14
24
  position: relative;
15
25
 
@@ -92,4 +102,17 @@
92
102
  .open {
93
103
  display: block;
94
104
  }
105
+
106
+ &.dark {
107
+ &.error {
108
+ .wrapper {
109
+ .input_wrapper {
110
+ border-color: $error_dark;
111
+ }
112
+ }
113
+ [class*=pb_body_kit_negative] {
114
+ color: $error_dark;
115
+ }
116
+ }
117
+ }
95
118
  }
@@ -7,9 +7,12 @@ import {
7
7
  buildDataProps,
8
8
  buildHtmlProps,
9
9
  } from "../utilities/props";
10
+ import { cloneDeep } from "../utilities/object";
11
+
10
12
  import Icon from "../pb_icon/_icon";
11
13
  import FormPill from "../pb_form_pill/_form_pill";
12
- import { cloneDeep } from "lodash";
14
+ import Body from "../pb_body/_body";
15
+ import Caption from "../pb_caption/_caption";
13
16
  import MultiLevelSelectOptions from "./multi_level_select_options";
14
17
  import MultiLevelSelectContext from "./context";
15
18
 
@@ -35,11 +38,14 @@ type MultiLevelSelectProps = {
35
38
  className?: string
36
39
  data?: { [key: string]: string }
37
40
  disabled?: boolean
41
+ error?: string
38
42
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
39
43
  id?: string
40
44
  inputDisplay?: "pills" | "none"
41
45
  inputName?: string
46
+ label?: string
42
47
  name?: string
48
+ required?: boolean
43
49
  returnAllSelected?: boolean
44
50
  treeData?: { [key: string]: string; }[] | any
45
51
  onChange?: (event: { target: { name?: string; value: any } }) => void
@@ -56,11 +62,14 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
56
62
  className,
57
63
  data = {},
58
64
  disabled = false,
65
+ error,
59
66
  htmlOptions = {},
60
67
  id,
61
68
  inputDisplay = "pills",
62
69
  inputName,
63
70
  name,
71
+ label,
72
+ required = false,
64
73
  returnAllSelected = false,
65
74
  treeData,
66
75
  onChange = () => null,
@@ -77,6 +86,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
77
86
  const htmlProps = buildHtmlProps(htmlOptions);
78
87
  const classes = classnames(
79
88
  buildCss("pb_multi_level_select"),
89
+ error && "error",
80
90
  globalProps(props),
81
91
  className
82
92
  );
@@ -439,6 +449,12 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
439
449
  className={classes}
440
450
  id={id}
441
451
  >
452
+ {label &&
453
+ <Caption
454
+ marginBottom="xs"
455
+ text={label}
456
+ />
457
+ }
442
458
  <MultiLevelSelectContext.Provider value={{
443
459
  variant,
444
460
  inputName,
@@ -462,6 +478,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
462
478
  disabled={disabled}
463
479
  key={selectedItem.id}
464
480
  name={`${name}[]`}
481
+ required={required}
465
482
  type="hidden"
466
483
  value={selectedItem.id}
467
484
  />
@@ -476,6 +493,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
476
493
  disabled={disabled}
477
494
  key={item.id}
478
495
  name={`${name}[]`}
496
+ required={required}
479
497
  type="hidden"
480
498
  value={item.id}
481
499
  />
@@ -488,6 +506,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
488
506
  disabled={disabled}
489
507
  key={item.id}
490
508
  name={`${name}[]`}
509
+ required={required}
491
510
  type="hidden"
492
511
  value={item.id}
493
512
  />
@@ -548,6 +567,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
548
567
  } selected`
549
568
  : "Start typing..."
550
569
  }
570
+ required={required}
551
571
  value={singleSelectedItem.value || filterItem}
552
572
  />
553
573
  </div>
@@ -580,6 +600,13 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
580
600
  </div>
581
601
  </div>
582
602
  </MultiLevelSelectContext.Provider>
603
+ {error &&
604
+ <Body
605
+ dark={props.dark}
606
+ status="negative"
607
+ text={error}
608
+ />
609
+ }
583
610
  </div>
584
611
  );
585
612
  }) as MultiLevelSelectComponent;
@@ -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'