playbook_ui 14.20.0.pre.alpha.play2224scrollbarfix7991 → 14.20.0.pre.alpha.revert4453PBNTR933reactdraggablebugdragbtwnexamples7854
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -18
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +8 -16
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +0 -9
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +2 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/index.js +12 -155
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -4
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +12 -8
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +6 -3
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +48 -2
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +17 -58
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +2 -108
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -24
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/dist/chunks/{_typeahead-CRW6dJbW.js → _typeahead-C-CI5Vgw.js} +2 -2
- data/dist/chunks/{_weekday_stacked-DoXl8xrB.js → _weekday_stacked-BCiM3zWM.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +4 -18
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +0 -137
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +0 -40
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +0 -23
- data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.rb +0 -19
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +0 -1
- data/app/pb_kits/playbook/pb_checkbox/index.js +0 -56
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +0 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +0 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +0 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +0 -12
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +0 -31
- data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +0 -1
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.20.0.pre.alpha.
|
4
|
+
version: 14.20.0.pre.alpha.revert4453PBNTR933reactdraggablebugdragbtwnexamples7854
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-05-
|
12
|
+
date: 2025-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -347,12 +347,8 @@ files:
|
|
347
347
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md
|
348
348
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx
|
349
349
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md
|
350
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb
|
351
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md
|
352
350
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx
|
353
351
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md
|
354
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb
|
355
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md
|
356
352
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.html.erb
|
357
353
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md
|
358
354
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_react.jsx
|
@@ -397,8 +393,6 @@ files:
|
|
397
393
|
- app/pb_kits/playbook/pb_advanced_table/scss_partials/_loading.scss
|
398
394
|
- app/pb_kits/playbook/pb_advanced_table/scss_partials/_pseudo_states.scss
|
399
395
|
- app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss
|
400
|
-
- app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb
|
401
|
-
- app/pb_kits/playbook/pb_advanced_table/table_action_bar.rb
|
402
396
|
- app/pb_kits/playbook/pb_advanced_table/table_body.html.erb
|
403
397
|
- app/pb_kits/playbook/pb_advanced_table/table_body.rb
|
404
398
|
- app/pb_kits/playbook/pb_advanced_table/table_header.html.erb
|
@@ -723,7 +717,6 @@ files:
|
|
723
717
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_error_swift.md
|
724
718
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb
|
725
719
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.jsx
|
726
|
-
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md
|
727
720
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_swift.md
|
728
721
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_options.html.erb
|
729
722
|
- app/pb_kits/playbook/pb_checkbox/docs/_checkbox_props_swift.md
|
@@ -732,7 +725,6 @@ files:
|
|
732
725
|
- app/pb_kits/playbook/pb_checkbox/docs/_description.md
|
733
726
|
- app/pb_kits/playbook/pb_checkbox/docs/example.yml
|
734
727
|
- app/pb_kits/playbook/pb_checkbox/docs/index.js
|
735
|
-
- app/pb_kits/playbook/pb_checkbox/index.js
|
736
728
|
- app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts
|
737
729
|
- app/pb_kits/playbook/pb_circle_chart/_circle_chart.scss
|
738
730
|
- app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx
|
@@ -2413,9 +2405,6 @@ files:
|
|
2413
2405
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb
|
2414
2406
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.jsx
|
2415
2407
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.md
|
2416
|
-
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb
|
2417
|
-
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx
|
2418
|
-
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md
|
2419
2408
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb
|
2420
2409
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx
|
2421
2410
|
- app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md
|
@@ -2667,9 +2656,6 @@ files:
|
|
2667
2656
|
- app/pb_kits/playbook/pb_select/docs/_select_blank.jsx
|
2668
2657
|
- app/pb_kits/playbook/pb_select/docs/_select_custom_select.html.erb
|
2669
2658
|
- app/pb_kits/playbook/pb_select/docs/_select_custom_select.jsx
|
2670
|
-
- app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb
|
2671
|
-
- app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx
|
2672
|
-
- app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md
|
2673
2659
|
- app/pb_kits/playbook/pb_select/docs/_select_default.html.erb
|
2674
2660
|
- app/pb_kits/playbook/pb_select/docs/_select_default.jsx
|
2675
2661
|
- app/pb_kits/playbook/pb_select/docs/_select_default_swift.md
|
@@ -3600,8 +3586,8 @@ files:
|
|
3600
3586
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3601
3587
|
- app/pb_kits/playbook/utilities/text.ts
|
3602
3588
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3603
|
-
- dist/chunks/_typeahead-
|
3604
|
-
- dist/chunks/_weekday_stacked-
|
3589
|
+
- dist/chunks/_typeahead-C-CI5Vgw.js
|
3590
|
+
- dist/chunks/_weekday_stacked-BCiM3zWM.js
|
3605
3591
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3606
3592
|
- dist/chunks/lib-D5R1BjUn.js
|
3607
3593
|
- dist/chunks/pb_form_validation-BZ2AVAi_.js
|
@@ -1,137 +0,0 @@
|
|
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>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md
DELETED
@@ -1,3 +0,0 @@
|
|
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.
|
@@ -1,40 +0,0 @@
|
|
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
|
-
}) %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md
DELETED
@@ -1 +0,0 @@
|
|
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`
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<%= pb_rails("card", props: {
|
2
|
-
border_none: object.is_visible,
|
3
|
-
classname: object.classname,
|
4
|
-
padding: object.is_visible ? "xs" : "none",
|
5
|
-
data: {
|
6
|
-
action_bar: true
|
7
|
-
}
|
8
|
-
}) do %>
|
9
|
-
<%= pb_rails("flex", props: { align_items: "center", justify: "between" }) do %>
|
10
|
-
<%= pb_rails("caption", props: { color: "light", padding_left: "xs", size: "xs" }) do %>
|
11
|
-
<span class="selected-count"><%= object.selected_count %> Selected</span>
|
12
|
-
<% end %>
|
13
|
-
<%= pb_rails("flex/flex_item") do %>
|
14
|
-
<%= pb_rails("flex") do %>
|
15
|
-
<% if object.actions.present? %>
|
16
|
-
<% object.actions.each do |action| %>
|
17
|
-
<%= action %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module PbAdvancedTable
|
5
|
-
class TableActionBar < Playbook::KitBase
|
6
|
-
prop :actions, type: Playbook::Props::Array,
|
7
|
-
default: []
|
8
|
-
prop :is_visible, type: Playbook::Props::Boolean,
|
9
|
-
default: false
|
10
|
-
prop :selected_count, type: Playbook::Props::Number,
|
11
|
-
default: 0
|
12
|
-
|
13
|
-
def classname
|
14
|
-
# Just use row-selection-actions-card as the base class
|
15
|
-
generate_classname("row-selection-actions-card", separator: " ")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1 +0,0 @@
|
|
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.
|
@@ -1,56 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element"
|
2
|
-
|
3
|
-
const INDETERMINATE_MAIN_CHECKBOX_SELECTOR = "[data-pb-checkbox-indeterminate-main='true']"
|
4
|
-
|
5
|
-
export default class PbCheckbox extends PbEnhancedElement {
|
6
|
-
static get selector() {
|
7
|
-
return INDETERMINATE_MAIN_CHECKBOX_SELECTOR
|
8
|
-
}
|
9
|
-
|
10
|
-
connect() {
|
11
|
-
const mainCheckboxWrapper = this.element;
|
12
|
-
const mainCheckbox = mainCheckboxWrapper.querySelector('input')
|
13
|
-
const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
|
14
|
-
|
15
|
-
const updateMainCheckbox = () => {
|
16
|
-
// Count the number of checked child checkboxes
|
17
|
-
const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
|
18
|
-
// Determine if the main checkbox should be in an indeterminate state
|
19
|
-
const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
|
20
|
-
|
21
|
-
// Set the main checkbox states
|
22
|
-
mainCheckbox.indeterminate = indeterminate;
|
23
|
-
mainCheckbox.checked = checkedCount > 0;
|
24
|
-
|
25
|
-
// Determine the main checkbox label based on the number of checked checkboxes
|
26
|
-
const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
|
27
|
-
|
28
|
-
// Determine the icon class to add and remove based on the number of checked checkboxes
|
29
|
-
const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
|
30
|
-
const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
|
31
|
-
|
32
|
-
// Update main checkbox label
|
33
|
-
mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
|
34
|
-
|
35
|
-
// Add and remove the icon class to the main checkbox wrapper
|
36
|
-
mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
|
37
|
-
mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
|
38
|
-
|
39
|
-
// Toggle the visibility of the checkbox icon based on the indeterminate state
|
40
|
-
mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
|
41
|
-
mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
|
42
|
-
};
|
43
|
-
|
44
|
-
// Set indeterminate icon on main checkbox if initial children checkboxes are checked
|
45
|
-
updateMainCheckbox();
|
46
|
-
|
47
|
-
this.element.querySelector('input').addEventListener('change', function() {
|
48
|
-
childCheckboxes.forEach(cb => cb.checked = this.checked);
|
49
|
-
updateMainCheckbox();
|
50
|
-
});
|
51
|
-
|
52
|
-
childCheckboxes.forEach(cb => {
|
53
|
-
cb.addEventListener('change', updateMainCheckbox);
|
54
|
-
});
|
55
|
-
}
|
56
|
-
}
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx
DELETED
@@ -1,15 +0,0 @@
|
|
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
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Excluding countries removes the selected countries from the dropdown.
|
@@ -1,12 +0,0 @@
|
|
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 %>
|
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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.
|