playbook_ui_docs 14.20.0.pre.alpha.PLAY2214checkboxhiddeninput8052 → 14.20.0.pre.alpha.PLAY21817891

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
  4. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.html.erb +0 -1
  5. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +48 -2
  6. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_options.html.erb +0 -1
  7. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +0 -1
  8. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -2
  9. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
  10. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  11. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
  12. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -4
  13. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
  14. data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
  15. data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
  16. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +51 -3
  17. data/dist/playbook-doc.js +2 -2
  18. metadata +2 -16
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +0 -57
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +0 -5
  21. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom_rails.md +0 -1
  22. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_form.html.erb +0 -22
  23. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_form.md +0 -5
  24. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +0 -1
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.jsx +0 -42
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.md +0 -1
  27. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +0 -4
  28. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +0 -15
  29. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +0 -1
  30. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +0 -12
  31. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +0 -31
  32. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f3218c35e8634460f531a5ec901105a2f2a4b71da0f90bca466def14ed29b72
4
- data.tar.gz: 7af0cd726230f611174116707be74dca42f8209dbdbd57dd7b0c1692de227162
3
+ metadata.gz: a4cc5170ba04451afe5d835c6dd5bf28cd786f619366f125f9fea9350b6b3358
4
+ data.tar.gz: 5ce7096fd7f978b0d0954b326bc28a4e87152a5a96aecd090bc849b04b6f731d
5
5
  SHA512:
6
- metadata.gz: 3add2e5c13da822a9d2c8e7c83b6a449f7b861567ea3e6fc14337d8fe8163df65f9684d9464aebcf4319f4dd9b03875382fb3ee66101d207b483497e9febdd21
7
- data.tar.gz: 95a659f716b7a3ad8fc9ab67d813e1242e389947f37537edb6e4bbf03370a494c5e87cf5798664e8d8e4380a6cc0a356fa87c4962a8745bbc532f14b1f428e7f
6
+ metadata.gz: 3cb2335e5a3ab6d27d1cdddfa426d42f159ab9feb629208d0a36a9ec5edc0c26608d743687d9ea9f2c596415ad906966792b9c9633b4f2a801b113803349cf6c
7
+ data.tar.gz: 253354b041ca423e15617e642a7edb3493ba7d2b3843fed80a3ed1f7f47e380f00a57a9ab83578587d9ab119819d100f68f289965f94ec716f8dcc5762feef33
@@ -52,5 +52,4 @@ examples:
52
52
  - advanced_table_column_visibility: Column Visibility Control
53
53
  - advanced_table_column_visibility_with_state: Column Visibility Control With State
54
54
  - advanced_table_column_visibility_custom: Column Visibility Control with Custom Dropdown
55
- - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
56
- - advanced_table_pinned_rows: Pinned Rows
55
+ - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
@@ -31,5 +31,4 @@ export { default as AdvancedTableColumnBorderColor} from './_advanced_table_colu
31
31
  export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
32
32
  export { default as AdvancedTableColumnVisibilityCustom } from './_advanced_table_column_visibility_custom.jsx'
33
33
  export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table_column_visibility_multi.jsx'
34
- export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
35
- export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
34
+ export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
@@ -1,4 +1,3 @@
1
1
  <%= pb_rails("checkbox", props: {text: "Custom Checkbox"}) do%>
2
- <input type="hidden" name="custom-name" value="0" />
3
2
  <input type="checkbox" name="custom-name" value="custom-value"/>
4
3
  <% end %>
@@ -9,10 +9,11 @@
9
9
  <tr>
10
10
  <th>
11
11
  <%= pb_rails("checkbox", props: {
12
+ checked: true,
12
13
  text: "Uncheck All",
13
14
  value: "checkbox-value",
14
15
  name: "main-checkbox",
15
- indeterminate_main: true,
16
+ indeterminate: true,
16
17
  id: "indeterminate-checkbox"
17
18
  }) %>
18
19
  </th>
@@ -29,10 +30,55 @@
29
30
  value: checkbox[:id],
30
31
  name: "#{checkbox[:id]}-indeterminate-checkbox",
31
32
  id: "#{checkbox[:id]}-indeterminate-checkbox",
32
- indeterminate_parent: "indeterminate-checkbox",
33
33
  }) %>
34
34
  </td>
35
35
  </tr>
36
36
  <% end %>
37
37
  </tbody>
38
38
  <% end %>
39
+
40
+ <script>
41
+ document.addEventListener('DOMContentLoaded', function() {
42
+ const mainCheckboxWrapper = document.getElementById('indeterminate-checkbox');
43
+ const mainCheckbox = document.getElementsByName("main-checkbox")[0];
44
+ const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="indeterminate-checkbox"]');
45
+
46
+ const updateMainCheckbox = () => {
47
+ // Count the number of checked child checkboxes
48
+ const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
49
+ // Determine if the main checkbox should be in an indeterminate state
50
+ const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
51
+
52
+ // Set the main checkbox states
53
+ mainCheckbox.indeterminate = indeterminate;
54
+ mainCheckbox.checked = checkedCount > 0;
55
+
56
+ // Determine the main checkbox label based on the number of checked checkboxes
57
+ const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
58
+
59
+ // Determine the icon class to add and remove based on the number of checked checkboxes
60
+ const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
61
+ const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
62
+
63
+ // Update main checkbox label
64
+ mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
65
+
66
+ // Add and remove the icon class to the main checkbox wrapper
67
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
68
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
69
+
70
+ // Toggle the visibility of the checkbox icon based on the indeterminate state
71
+ mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
72
+ mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
73
+ };
74
+
75
+ mainCheckbox.addEventListener('change', function() {
76
+ childCheckboxes.forEach(cb => cb.checked = this.checked);
77
+ updateMainCheckbox();
78
+ });
79
+
80
+ childCheckboxes.forEach(cb => {
81
+ cb.addEventListener('change', updateMainCheckbox);
82
+ });
83
+ });
84
+ </script>
@@ -1,6 +1,5 @@
1
1
  <%= pb_rails("checkbox" , props: {
2
2
  text: "Checkbox with Options",
3
- hidden_input: true,
4
3
  input_options: {
5
4
  id: "checkbox-id",
6
5
  name: "checkbox-name",
@@ -7,7 +7,6 @@ examples:
7
7
  - checkbox_options: Checkbox w/ Options
8
8
  - checkbox_indeterminate: Indeterminate Checkbox
9
9
  - checkbox_disabled: Disabled Checkbox
10
- - checkbox_form: Form and Hidden Input
11
10
 
12
11
  react:
13
12
  - checkbox_default: Default
@@ -44,6 +44,4 @@ examples:
44
44
  - dropdown_clear_selection: Clear Selection
45
45
  - dropdown_separators_hidden: Separators Hidden
46
46
  - dropdown_with_external_control: useDropdown Hook
47
- - dropdown_close_on_select: Close On Selection
48
-
49
47
 
@@ -19,5 +19,4 @@ export { default as DropdownMultiSelect } from './_dropdown_multi_select.jsx'
19
19
  export { default as DropdownMultiSelectDisplay } from './_dropdown_multi_select_display.jsx'
20
20
  export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_multi_select_with_autocomplete.jsx'
21
21
  export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
22
- export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
23
- export { default as DropdownCloseOnSelect } from './_dropdown_close_on_select.jsx'
22
+ export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
@@ -101,7 +101,7 @@
101
101
  <%= form.dropdown_field :example_dropdown_validation_multi, props: { label: true, options: example_dropdown_options, multi_select: true, required: true } %>
102
102
  <%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
103
103
  <%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
104
- <%= form.check_box :example_checkbox_validation, props: { text: "Example Checkbox Validation", label: true, required: true }, checked_value: "1", unchecked_value: "0" %>
104
+ <%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
105
105
  <%= form.date_picker :example_date_picker_2, props: { label: true, required: true, validation_message: "Please, select a date.", allow_input: true } %>
106
106
  <%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
107
107
  <%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
@@ -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,8 +4,7 @@ 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: Only Countries
8
- - phone_number_input_exclude_countries: Exclude Countries
7
+ - phone_number_input_only_countries: Limited Countries
9
8
  - phone_number_input_validation: Form Validation
10
9
  - phone_number_input_clear_field: Clearing the Input Field
11
10
  - phone_number_input_access_input_element: Accessing the Input Element
@@ -16,9 +15,9 @@ examples:
16
15
  - phone_number_input_default: Default
17
16
  - phone_number_input_preferred_countries: Preferred Countries
18
17
  - phone_number_input_initial_country: Initial Country
19
- - phone_number_input_only_countries: Only Countries
20
- - phone_number_input_exclude_countries: Exclude Countries
18
+ - phone_number_input_only_countries: Limited Countries
21
19
  - phone_number_input_validation: Form Validation
22
20
  - phone_number_input_format: Format as You Type
23
21
  - phone_number_input_hidden_inputs: Hidden Inputs
24
22
  - phone_number_input_country_search: Country Search
23
+
@@ -2,7 +2,6 @@ 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'
6
5
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
7
6
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
8
7
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
@@ -8,7 +8,6 @@ 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
12
11
  - select_error: Select w/ Error
13
12
  - select_inline: Select Inline
14
13
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -26,7 +25,6 @@ examples:
26
25
  - select_required: Required Select Field
27
26
  - select_value_text_same: Equal option value and value text
28
27
  - select_custom_select: Custom Select
29
- - select_custom_select_subheaders: Custom Select Subheaders
30
28
  - select_error: Select w/ Error
31
29
  - select_inline: Select Inline
32
30
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -11,4 +11,3 @@ 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_main: true,
21
+ indeterminate: 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", indeterminate_parent: "checkbox-selectable" }) %>
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" }) %>
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,4 +45,52 @@
45
45
  <% end %>
46
46
  <% end %>
47
47
  <% end %>
48
- <% 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>