playbook_ui_docs 14.19.0 → 14.20.0.pre.alpha.PLAY2140upgraderailsdependency8003

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.jsx +57 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md +4 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.jsx +62 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.md +1 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.jsx +82 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +66 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +6 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +5 -1
  18. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +2 -48
  19. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +31 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.md +5 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +56 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.md +3 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +58 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.md +3 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +20 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.md +1 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +19 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.md +3 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +20 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +57 -0
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.md +1 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +50 -0
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +105 -0
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +22 -0
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +67 -0
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +11 -0
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +1 -1
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +33 -2
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +3 -1
  41. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -1
  42. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -0
  43. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.html.erb +1 -0
  44. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.jsx +41 -0
  45. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -0
  46. data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
  47. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
  48. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
  49. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +11 -11
  50. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +11 -11
  51. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +11 -11
  52. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +11 -11
  53. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +11 -11
  54. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +11 -11
  55. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +11 -11
  56. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +11 -11
  57. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +11 -11
  58. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +11 -11
  59. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +11 -11
  60. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +11 -11
  61. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +11 -11
  62. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +11 -11
  63. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +11 -11
  64. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +11 -11
  65. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +11 -11
  66. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +11 -11
  67. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +11 -11
  68. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +11 -11
  69. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.html.erb +11 -11
  70. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.jsx +11 -11
  71. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.html.erb +11 -11
  72. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.md +2 -0
  73. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.jsx +11 -11
  74. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids_react.md +3 -1
  75. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +22 -22
  76. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +22 -22
  77. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.html.erb +22 -22
  78. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single_children_only.jsx +22 -22
  79. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +11 -11
  80. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +11 -11
  81. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_form.html.erb +11 -11
  82. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +4 -0
  83. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +15 -0
  84. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +1 -0
  85. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
  86. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +4 -3
  87. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  88. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
  89. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
  90. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
  91. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  92. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  93. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +3 -51
  94. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.jsx +23 -0
  95. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.md +1 -0
  96. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
  97. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  98. data/dist/playbook-doc.js +2 -2
  99. metadata +42 -3
  100. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb +0 -10
@@ -5,25 +5,25 @@ import Badge from "../../pb_badge/_badge";
5
5
  const treeData = [
6
6
  {
7
7
  label: "Power Home Remodeling",
8
- value: "Power Home Remodeling",
8
+ value: "powerHomeRemodeling",
9
9
  id: "powerhome1",
10
10
  expanded: true,
11
11
  children: [
12
12
  {
13
13
  label: "People",
14
- value: "People",
14
+ value: "people",
15
15
  id: "people1",
16
16
  expanded: true,
17
17
  status: "active",
18
18
  children: [
19
19
  {
20
20
  label: "Talent Acquisition",
21
- value: "Talent Acquisition",
21
+ value: "talentAcquisition",
22
22
  id: "talent1",
23
23
  },
24
24
  {
25
25
  label: "Business Affairs",
26
- value: "Business Affairs",
26
+ value: "businessAffairs",
27
27
  id: "business1",
28
28
  status: "active",
29
29
  variant: "primary",
@@ -31,12 +31,12 @@ const treeData = [
31
31
  children: [
32
32
  {
33
33
  label: "Initiatives",
34
- value: "Initiatives",
34
+ value: "initiatives",
35
35
  id: "initiative1",
36
36
  },
37
37
  {
38
38
  label: "Learning & Development",
39
- value: "Learning & Development",
39
+ value: "learningAndDevelopment",
40
40
  id: "development1",
41
41
  status: "Inactive",
42
42
  },
@@ -44,31 +44,31 @@ const treeData = [
44
44
  },
45
45
  {
46
46
  label: "People Experience",
47
- value: "People Experience",
47
+ value: "peopleExperience",
48
48
  id: "experience1",
49
49
  },
50
50
  ],
51
51
  },
52
52
  {
53
53
  label: "Contact Center",
54
- value: "Contact Center",
54
+ value: "contactCenter",
55
55
  id: "contact1",
56
56
  status: "Inactive",
57
57
  variant: "error",
58
58
  children: [
59
59
  {
60
60
  label: "Appointment Management",
61
- value: "Appointment Management",
61
+ value: "appointmentManagement",
62
62
  id: "appointment1",
63
63
  },
64
64
  {
65
65
  label: "Customer Service",
66
- value: "Customer Service",
66
+ value: "customerService",
67
67
  id: "customer1",
68
68
  },
69
69
  {
70
70
  label: "Energy",
71
- value: "Energy",
71
+ value: "energy",
72
72
  id: "energy1",
73
73
  },
74
74
  ],
@@ -2,62 +2,62 @@
2
2
 
3
3
  <% treeData = [{
4
4
  label: "Power Home Remodeling",
5
- value: "Power Home Remodeling",
5
+ value: "powerHomeRemodeling",
6
6
  id: "powerhome1",
7
7
  expanded: true,
8
8
  children: [
9
9
  {
10
10
  label: "People",
11
- value: "People",
11
+ value: "people",
12
12
  id: "people1",
13
13
  children: [
14
14
  {
15
15
  label: "Talent Acquisition",
16
- value: "Talent Acquisition",
16
+ value: "talentAcquisition",
17
17
  id: "talent1",
18
18
  },
19
19
  {
20
20
  label: "Business Affairs",
21
- value: "Business Affairs",
21
+ value: "businessAffairs",
22
22
  id: "business1",
23
23
  children: [
24
24
  {
25
25
  label: "Initiatives",
26
- value: "Initiatives",
26
+ value: "initiatives",
27
27
  id: "initiative1",
28
28
  },
29
29
  {
30
30
  label: "Learning & Development",
31
- value: "Learning & Development",
31
+ value: "learningAndDevelopment",
32
32
  id: "development1",
33
33
  },
34
34
  ],
35
35
  },
36
36
  {
37
37
  label: "People Experience",
38
- value: "People Experience",
38
+ value: "peopleExperience",
39
39
  id: "experience1",
40
40
  },
41
41
  ],
42
42
  },
43
43
  {
44
44
  label: "Contact Center",
45
- value: "Contact Center",
45
+ value: "contactCenter",
46
46
  id: "contact1",
47
47
  children: [
48
48
  {
49
49
  label: "Appointment Management",
50
- value: "Appointment Management",
50
+ value: "appointmentManagement",
51
51
  id: "appointment1",
52
52
  },
53
53
  {
54
54
  label: "Customer Service",
55
- value: "Customer Service",
55
+ value: "customerService",
56
56
  id: "customer1",
57
57
  },
58
58
  {
59
59
  label: "Energy",
60
- value: "Energy",
60
+ value: "energy",
61
61
  id: "energy1",
62
62
  },
63
63
  ],
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ initial_country: 'gb',
3
+ exclude_countries: ['us', 'br']
4
+ }) %>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
3
+
4
+ const PhoneNumberInputExcludeCountries = (props) => (
5
+ <>
6
+ <PhoneNumberInput
7
+ excludeCountries={['us', 'br']}
8
+ id='exclude'
9
+ initialCountry='gb'
10
+ {...props}
11
+ />
12
+ </>
13
+ )
14
+
15
+ export default PhoneNumberInputExcludeCountries
@@ -0,0 +1 @@
1
+ Excluding countries removes the selected countries from the dropdown.
@@ -6,7 +6,7 @@ const PhoneNumberInputOnlyCountries = (props) => (
6
6
  <PhoneNumberInput
7
7
  id='only'
8
8
  onlyCountries={['us', 'br']}
9
- {...props}
9
+ {...props}
10
10
  />
11
11
  </>
12
12
  )
@@ -4,7 +4,8 @@ examples:
4
4
  - phone_number_input_default: Default
5
5
  - phone_number_input_preferred_countries: Preferred Countries
6
6
  - phone_number_input_initial_country: Initial Country
7
- - phone_number_input_only_countries: Limited Countries
7
+ - phone_number_input_only_countries: Only Countries
8
+ - phone_number_input_exclude_countries: Exclude Countries
8
9
  - phone_number_input_validation: Form Validation
9
10
  - phone_number_input_clear_field: Clearing the Input Field
10
11
  - phone_number_input_access_input_element: Accessing the Input Element
@@ -15,9 +16,9 @@ examples:
15
16
  - phone_number_input_default: Default
16
17
  - phone_number_input_preferred_countries: Preferred Countries
17
18
  - phone_number_input_initial_country: Initial Country
18
- - phone_number_input_only_countries: Limited Countries
19
+ - phone_number_input_only_countries: Only Countries
20
+ - phone_number_input_exclude_countries: Exclude Countries
19
21
  - phone_number_input_validation: Form Validation
20
22
  - phone_number_input_format: Format as You Type
21
23
  - phone_number_input_hidden_inputs: Hidden Inputs
22
24
  - phone_number_input_country_search: Country Search
23
-
@@ -2,6 +2,7 @@ export { default as PhoneNumberInputDefault } from './_phone_number_input_defaul
2
2
  export { default as PhoneNumberInputPreferredCountries } from './_phone_number_input_preferred_countries'
3
3
  export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
4
4
  export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
5
+ export { default as PhoneNumberInputExcludeCountries } from './_phone_number_input_exclude_countries'
5
6
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
6
7
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
8
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("select", props: { label: "Favorite Animal" }) do %>
2
+ <select name="animal" id="animal">
3
+ <optgroup label="Mammal">
4
+ <option value="1">Cat</option>
5
+ <option value="2">Dog</option>
6
+ </optgroup>
7
+ <optgroup label="Amphibian">
8
+ <option value="3">Frog</option>
9
+ <option value="4">Salamander</option>
10
+ </optgroup>
11
+ </select>
12
+ <% end %>
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+
3
+ import Select from '../_select'
4
+
5
+ const SelectCustomSelectSubheaders = (props) => {
6
+ return (
7
+ <div>
8
+ <Select
9
+ label="Favorite Animal"
10
+ {...props}
11
+ >
12
+ <select
13
+ id="animal"
14
+ name="animal"
15
+ {...props}
16
+ >
17
+ <optgroup label="Mammal">
18
+ <option value="1">{'Cat'}</option>
19
+ <option value="2">{'Dog'}</option>
20
+ </optgroup>
21
+ <optgroup label="Amphibian">
22
+ <option value="3">{'Frog'}</option>
23
+ <option value="4">{'Salamander'}</option>
24
+ </optgroup>
25
+ </select>
26
+ </Select>
27
+ </div>
28
+ )
29
+ }
30
+
31
+ export default SelectCustomSelectSubheaders
@@ -0,0 +1 @@
1
+ To create a select with non-selectable subheaders, use a Custom Select component to render a native `<select>` containing `<optgroup>` elements. The [optgroup HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/optgroup) groups related options under a non-selectable label in the dropdown.
@@ -8,6 +8,7 @@ examples:
8
8
  - select_required: Required Select Field
9
9
  - select_value_text_same: Equal option value and value text
10
10
  - select_custom_select: Custom Select
11
+ - select_custom_select_subheaders: Custom Select Subheaders
11
12
  - select_error: Select w/ Error
12
13
  - select_inline: Select Inline
13
14
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -25,6 +26,7 @@ examples:
25
26
  - select_required: Required Select Field
26
27
  - select_value_text_same: Equal option value and value text
27
28
  - select_custom_select: Custom Select
29
+ - select_custom_select_subheaders: Custom Select Subheaders
28
30
  - select_error: Select w/ Error
29
31
  - select_inline: Select Inline
30
32
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -11,3 +11,4 @@ export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.js
11
11
  export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
12
12
  export { default as SelectMultiple } from './_select_multiple.jsx'
13
13
  export { default as SelectReactHook } from './_select_react_hook.jsx'
14
+ export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
@@ -18,7 +18,7 @@
18
18
  checked: true,
19
19
  value: "checkbox-value",
20
20
  name: "main-checkbox-selectable",
21
- indeterminate: true,
21
+ indeterminate_main: true,
22
22
  id: "checkbox-selectable"
23
23
  }) %>
24
24
  <% end %>
@@ -33,7 +33,7 @@
33
33
  <% checkboxes.each_with_index do |checkbox, index| %>
34
34
  <%= pb_rails("table/table_row") do %>
35
35
  <%= pb_rails("table/table_cell") do %>
36
- <%= pb_rails("checkbox", props: { checked: checkbox[:checked], id: "#{checkbox[:id]}-selectable-checkbox", name: "#{checkbox[:id]}-selectable-checkbox", on_change: "updateCheckboxes(#{index})", value: "check-box value" }) %>
36
+ <%= pb_rails("checkbox", props: { checked: checkbox[:checked], id: "#{checkbox[:id]}-selectable-checkbox", name: "#{checkbox[:id]}-selectable-checkbox", on_change: "updateCheckboxes(#{index})", value: "check-box value", indeterminate_parent: "checkbox-selectable" }) %>
37
37
  <% end %>
38
38
  <%= pb_rails("table/table_cell") do %>
39
39
  <%= pb_rails("image", props: { alt: "picture of a misty forest", size: "xs", url: "https://unsplash.it/500/400/?image=634" }) %>
@@ -45,52 +45,4 @@
45
45
  <% end %>
46
46
  <% end %>
47
47
  <% end %>
48
- <% end %>
49
-
50
- <script>
51
- document.addEventListener('DOMContentLoaded', function() {
52
- const mainCheckboxWrapper = document.getElementById('checkbox-selectable');
53
- const mainCheckbox = document.getElementsByName("main-checkbox-selectable")[0];
54
- const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="selectable-checkbox"]');
55
- const deleteButton = document.getElementById('delete-button');
56
-
57
- const updateDeleteButton = () => {
58
- const anyChecked = Array.from(childCheckboxes).some(checkbox => checkbox.checked);
59
- deleteButton.style.display = anyChecked ? 'block' : 'none';
60
- };
61
-
62
- const updateMainCheckbox = () => {
63
- // Count the number of checked child checkboxes
64
- const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
65
- // Determine if the main checkbox should be in an indeterminate state
66
- const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
67
-
68
- // Set the main checkbox states
69
- mainCheckbox.indeterminate = indeterminate;
70
- mainCheckbox.checked = checkedCount > 0;
71
-
72
- // Determine the icon class to add and remove based on the number of checked checkboxes
73
- const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
74
- const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
75
-
76
- // Add and remove the icon class to the main checkbox wrapper
77
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
78
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
79
-
80
- // Toggle the visibility of the checkbox icon based on the indeterminate state
81
- mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
82
- mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
83
-
84
- updateDeleteButton();
85
- };
86
-
87
- mainCheckbox.addEventListener('change', function() {
88
- childCheckboxes.forEach(cb => cb.checked = this.checked);
89
- updateMainCheckbox();
90
- });
91
-
92
- childCheckboxes.forEach(cb => {
93
- cb.addEventListener('change', updateMainCheckbox);
94
- });
95
- });
96
- </script>
48
+ <% end %>
@@ -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 TypeaheadPreserveInput = (props) => {
13
+ return (
14
+ <Typeahead
15
+ label="Colors"
16
+ options={options}
17
+ preserveSearchInput
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export default TypeaheadPreserveInput
@@ -0,0 +1 @@
1
+ By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserveSearchInput` prop in order to prevent text from being cleared when the field loses focus
@@ -34,3 +34,4 @@ examples:
34
34
  - typeahead_with_pills_color: With Pills (Custom Color)
35
35
  - typeahead_truncated_text: Truncated Text
36
36
  - typeahead_disabled: Disabled
37
+ - typeahead_preserve_input: Preserve Search Input
@@ -15,3 +15,4 @@ export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_colo
15
15
  export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
16
16
  export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
17
  export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
+ export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'