playbook_ui_docs 14.20.0 → 14.21.0.pre.alpha.PLAY2140upgraderailsdependency8110

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 (36) 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_default.md +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.html.erb +33 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +0 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows.jsx +57 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_react.md +5 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.html.erb +33 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_scrollbar_none.jsx +53 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +8 -2
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +3 -1
  16. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +2 -48
  17. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -0
  18. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_date_display.html.erb +13 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.jsx +42 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_close_on_select.md +1 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
  23. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +4 -0
  24. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +15 -0
  25. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +1 -0
  26. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
  27. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +4 -3
  28. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  29. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
  30. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
  31. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
  32. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  33. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  34. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +3 -51
  35. data/dist/playbook-doc.js +2 -2
  36. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 368099700f434914add2572c8b6beff68d754c1945a3d28b67449a82e7a45f05
4
- data.tar.gz: bb0447607b80dfb927bf10f9a86d7b5253b57f5aa30920cfbcbd537e6fe25866
3
+ metadata.gz: bd11a210b4fee13816e486c2982cbc4644c299ecf909287d48bfe560ee961d42
4
+ data.tar.gz: 3d50377519d3daa22e7ebbaf05882944d556bd0cc366fb483a127610aa31fd8e
5
5
  SHA512:
6
- metadata.gz: 1d90fcb5a77f2ad30e4f134e224a35eee87291830cf9b34d031369f1bf2bd47b61af1667b019afa6523c8c44b5ef7531709afc58d5f3f7966c7b8f800f3bd493
7
- data.tar.gz: 9c3d8b9f6ab2b4a02bada9ce7f384b1d3b956b630c1c2a7c99100431a1a278ebea4cd91c0af59956863319768371a3be5e46acdda00c97ec89ca26305c6eb070
6
+ metadata.gz: 5dcb8423bb6a6017eecab5cc6223f2e1e2cc19368d9c3f41590a30cb0b733fac72696dfcef303864e60b4125638e516d9fdb76474b340c67a19aa8d507351b2d
7
+ data.tar.gz: c005f8ac61294928eb4ecc4de3c56f18b60771e6f88fbeb6001c6ae54479852c61b35be08353bfbd19b87f02313c3a83d552a270a759ecf2bf6bafc5f7d8c168
@@ -1,4 +1,8 @@
1
- The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has two required props__:
1
+ The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has three required props__:
2
+
3
+ ### id
4
+
5
+ A unique `id` is required to allow the table functionality to work properly. Without it, certain functions like the action bar will not be able to properly reference the correct table.
2
6
 
3
7
  ### table_data
4
8
 
@@ -13,6 +17,6 @@ Column definitions are the single most important part of building a table as the
13
17
  - `accessor`: this is the key from your data for the value you want rendered in that column
14
18
  - `label`: this is what will be rendered as the column header label
15
19
 
16
- There is also one optional item that is only required if the table has nested data:
20
+ There is also one optional item that is only required if the table has nested data:
17
21
 
18
22
  - `cellAccessors`: This is an array of strings that represent keys from your data object. This is only required for the first column in case of nested data. If you have nested data, the AdvancedTable needs to know what to render in that first column for nested items. This array represents the nested data in the order you want it rendered.
@@ -3,7 +3,7 @@
3
3
  <br />
4
4
  <br />
5
5
 
6
- The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has two required props__:
6
+ The AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, __the kit has two required props__:
7
7
 
8
8
  ### tableData
9
9
 
@@ -0,0 +1,33 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: { id: "table-no-children", enable_toggle_expansion: "none", table_data: @table_data_no_subrows, column_definitions: column_definitions }) %>
@@ -39,7 +39,6 @@ const AdvancedTableNoSubrows = (props) => {
39
39
  <div>
40
40
  <AdvancedTable
41
41
  columnDefinitions={columnDefinitions}
42
- enableToggleExpansion="all"
43
42
  tableData={MOCK_DATA}
44
43
  {...props}
45
44
  />
@@ -0,0 +1,57 @@
1
+ import React, { useState } from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTableRowPinning = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const [pinnedRows, setPinnedRows] = useState({top: ["8", "9", "10", "11", "12", "13", "14"]})
39
+
40
+ return (
41
+ <div>
42
+ <AdvancedTable
43
+ columnDefinitions={columnDefinitions}
44
+ maxHeight="xs"
45
+ pinnedRows={{value: pinnedRows, onChange: setPinnedRows}}
46
+ tableData={MOCK_DATA}
47
+ tableProps={{sticky: true}}
48
+ {...props}
49
+ >
50
+ <AdvancedTable.Header enableSorting />
51
+ <AdvancedTable.Body />
52
+ </AdvancedTable>
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTableRowPinning
@@ -0,0 +1,5 @@
1
+ Use the `pinnedRows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and reorganizing via sorting.
2
+
3
+ **NOTE:** This prop is in Beta. Current Requirements for V1:
4
+ - Sticky header required: Pinned rows must be used with `sticky: true` via `tableProps` (works with both responsive and non-responsive tables)
5
+ - Row ids required: Pass an array of row ids to the `top` property. For expandable rows, both parent and all its child row ids must be included individually
@@ -0,0 +1,33 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", scroll_bar_none: true }) %>
@@ -0,0 +1,53 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableScrollbarNone = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ return (
39
+ <div>
40
+ <AdvancedTable
41
+ columnDefinitions={columnDefinitions}
42
+ maxHeight="xs"
43
+ overflow="auto"
44
+ responsive="scroll"
45
+ scrollBarNone
46
+ tableData={MOCK_DATA}
47
+ {...props}
48
+ />
49
+ </div>
50
+ )
51
+ }
52
+
53
+ export default AdvancedTableScrollbarNone
@@ -0,0 +1,137 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ]
32
+
33
+ actions = [
34
+ pb_rails("circle_icon_button", props: {
35
+ icon: "file-csv",
36
+ variant: "link",
37
+ id: "export-selected-rows-btn",
38
+ data: {
39
+ action_type: "export"
40
+ }
41
+ }),
42
+ pb_rails("circle_icon_button", props: {
43
+ icon: "trash-alt",
44
+ variant: "link",
45
+ id: "delete-selected-rows-btn",
46
+ data: {
47
+ action_type: "delete"
48
+ }
49
+ })
50
+ ]
51
+ %>
52
+
53
+ <%= pb_rails("advanced_table", props: {
54
+ id: "selectable_rows_with_actions",
55
+ table_data: @table_data_no_subrows,
56
+ column_definitions: column_definitions,
57
+ selectable_rows: true,
58
+ enable_toggle_expansion: "none",
59
+ actions: actions
60
+ }) %>
61
+
62
+ <script>
63
+ // Handle action clicks using the data-selected-rows attribute
64
+ window.handleActionClick = function(actionType) {
65
+ const tableContainer = document.getElementById('selectable_rows_with_actions');
66
+ if (!tableContainer) return;
67
+
68
+ // Get selected rows from the data attribute
69
+ const selectedRowsJSON = tableContainer.getAttribute('data-selected-rows');
70
+ let selectedRowIds = [];
71
+
72
+ try {
73
+ // Parse the JSON string from the data attribute
74
+ if (selectedRowsJSON) {
75
+ selectedRowIds = JSON.parse(selectedRowsJSON);
76
+ }
77
+ } catch (e) {
78
+ // Fallback if JSON parsing fails
79
+ const checkboxes = tableContainer.querySelectorAll('input[type="checkbox"]:checked');
80
+ const selectedCheckboxes = Array.from(checkboxes).filter(checkbox =>
81
+ checkbox.id !== 'select-all-rows' &&
82
+ !checkbox.closest('#select-all-rows')
83
+ );
84
+ selectedRowIds = selectedCheckboxes.map(checkbox => checkbox.id);
85
+ }
86
+
87
+ // Show appropriate message
88
+ if (!selectedRowIds || selectedRowIds.length === 0) {
89
+ alert('No Selection Made');
90
+ } else {
91
+ if (actionType === 'export') {
92
+ alert(`Row ids ${selectedRowIds.join(', ')} will be exported!`);
93
+ } else if (actionType === 'delete') {
94
+ alert(`Row ids ${selectedRowIds.join(', ')} will be deleted!`);
95
+ }
96
+ }
97
+ };
98
+
99
+ // Add event listeners when the DOM is ready
100
+ document.addEventListener('DOMContentLoaded', function() {
101
+ // Get the buttons
102
+ const exportBtn = document.getElementById('export-selected-rows-btn');
103
+ const deleteBtn = document.getElementById('delete-selected-rows-btn');
104
+
105
+ // Add click event listeners
106
+ if (exportBtn) {
107
+ exportBtn.addEventListener('click', function(e) {
108
+ e.preventDefault();
109
+ window.handleActionClick('export');
110
+ });
111
+ }
112
+
113
+ if (deleteBtn) {
114
+ deleteBtn.addEventListener('click', function(e) {
115
+ e.preventDefault();
116
+ window.handleActionClick('delete');
117
+ });
118
+ }
119
+
120
+ // Optional: Event delegation through the action bar
121
+ const actionBar = document.querySelector('.row-selection-actions-card');
122
+ if (actionBar) {
123
+ actionBar.addEventListener('click', function(e) {
124
+ const exportButton = e.target.closest('#export-selected-rows-btn');
125
+ const deleteButton = e.target.closest('#delete-selected-rows-btn');
126
+
127
+ if (exportButton) {
128
+ e.preventDefault();
129
+ window.handleActionClick('export');
130
+ } else if (deleteButton) {
131
+ e.preventDefault();
132
+ window.handleActionClick('delete');
133
+ }
134
+ });
135
+ }
136
+ });
137
+ </script>
@@ -0,0 +1,3 @@
1
+ Custom actions content can be rendered within the Actions Bar as shown in this doc example. The component passed to `actions` will be rendered on the right of the actionsBar.
2
+
3
+ You can utilize script tags with your actions to provide your buttons with any clickable events needed.
@@ -0,0 +1,40 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: {
34
+ id: "selectable_rows_with_actions",
35
+ table_data: @table_data_no_subrows,
36
+ column_definitions: column_definitions,
37
+ selectable_rows: true,
38
+ enable_toggle_expansion: "none",
39
+ show_actions_bar: false
40
+ }) %>
@@ -0,0 +1 @@
1
+ `show_actions_bar` is an optional prop that renders the header at the top showing the row count. This is set to `true` by default but can be toggled off by setting it to `false`
@@ -13,8 +13,12 @@ examples:
13
13
  - advanced_table_column_headers: Multi-Header Columns
14
14
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
15
15
  - advanced_table_column_border_color_rails: Column Group Border Color
16
+ - advanced_table_no_subrows: Table with No Subrows or Expansion
16
17
  - advanced_table_selectable_rows_rails: Selectable Rows
17
18
  - advanced_table_selectable_rows_no_subrows_rails: Selectable Rows (No Subrows)
19
+ - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
+ - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
+ - advanced_table_scrollbar_none: Advanced Table Scrollbar None
18
22
 
19
23
  react:
20
24
  - advanced_table_default: Default (Required Props)
@@ -40,7 +44,7 @@ examples:
40
44
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
41
45
  - advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
42
46
  - advanced_table_column_border_color: Column Group Border Color
43
- # - advanced_table_no_subrows: Table with No Subrows
47
+ - advanced_table_no_subrows: Table with No Subrows or Expansion
44
48
  - advanced_table_selectable_rows: Selectable Rows
45
49
  - advanced_table_selectable_rows_no_subrows_react: Selectable Rows (No Subrows)
46
50
  - advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
@@ -50,4 +54,6 @@ examples:
50
54
  - advanced_table_column_visibility: Column Visibility Control
51
55
  - advanced_table_column_visibility_with_state: Column Visibility Control With State
52
56
  - advanced_table_column_visibility_custom: Column Visibility Control with Custom Dropdown
53
- - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
57
+ - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
58
+ - advanced_table_pinned_rows: Pinned Rows
59
+ - advanced_table_scrollbar_none: Advanced Table Scrollbar None
@@ -31,4 +31,6 @@ 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'
34
+ export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
35
+ export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
36
+ export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
@@ -9,11 +9,10 @@
9
9
  <tr>
10
10
  <th>
11
11
  <%= pb_rails("checkbox", props: {
12
- checked: true,
13
12
  text: "Uncheck All",
14
13
  value: "checkbox-value",
15
14
  name: "main-checkbox",
16
- indeterminate: true,
15
+ indeterminate_main: true,
17
16
  id: "indeterminate-checkbox"
18
17
  }) %>
19
18
  </th>
@@ -30,55 +29,10 @@
30
29
  value: checkbox[:id],
31
30
  name: "#{checkbox[:id]}-indeterminate-checkbox",
32
31
  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>
@@ -0,0 +1 @@
1
+ If you want to use indeterminate, "check/uncheck all" checkboxes, add `indeterminate_main: true` and an `id` to the main checkbox. Then, add an `indeterminate_parent` prop with the main checkbox's `id` to the children checkboxes.
@@ -0,0 +1,13 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ allow_input: true,
3
+ date_display: false,
4
+ end_date_id: "quick-pick-end-date",
5
+ end_date_name: "quick-pick-end-date",
6
+ mode: "range",
7
+ picker_id: "date-picker-quick-pick-date-display",
8
+ placeholder: "mm/dd/yyyy to mm/dd/yyyy",
9
+ selection_type: "quickpick",
10
+ start_date_id: "quick-pick-start-date",
11
+ start_date_name: "quick-pick-start-date"
12
+ }) %>
13
+
@@ -0,0 +1,42 @@
1
+ import React from 'react'
2
+ import Dropdown from '../../pb_dropdown/_dropdown'
3
+
4
+ const DropdownCloseOnSelect = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "United States",
10
+ },
11
+ {
12
+ label: "Canada",
13
+ value: "Canada",
14
+ },
15
+ {
16
+ label: "Pakistan",
17
+ value: "Pakistan",
18
+ }
19
+ ];
20
+
21
+
22
+ return (
23
+ <div>
24
+ <Dropdown
25
+ closeOnSelection={false}
26
+ label="Default"
27
+ options={options}
28
+ {...props}
29
+ />
30
+ <br />
31
+ <Dropdown
32
+ closeOnSelection={false}
33
+ label="Multi Select"
34
+ multiSelect
35
+ options={options}
36
+ {...props}
37
+ />
38
+ </div>
39
+ )
40
+ }
41
+
42
+ export default DropdownCloseOnSelect
@@ -0,0 +1 @@
1
+ By default, the dropdown menu will close when a selection is made. You can prevent this behavior by using the `closeOnSelection` prop, which will leave the menu open after a selection is made when set to 'false'.
@@ -44,4 +44,6 @@ 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
+
47
49
 
@@ -19,4 +19,5 @@ 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'
22
+ export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
23
+ export { default as DropdownCloseOnSelect } from './_dropdown_close_on_select.jsx'
@@ -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
  )