playbook_ui 14.24.0.pre.alpha.testingwithoutlazyload9529 → 14.24.0.pre.rc.0
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +13 -11
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -112
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -12
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -90
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -10
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +5 -22
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
- data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +1 -10
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +3 -5
- data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
- data/app/pb_kits/playbook/pb_date/date.rb +0 -2
- data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +0 -6
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +1 -12
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -11
- data/app/pb_kits/playbook/pb_select/select.rb +2 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +1 -49
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
- data/dist/chunks/{_line_graph-qk_BN_J0.js → _line_graph-BfCo79KE.js} +1 -1
- data/dist/chunks/{_typeahead-ZLTFtAoW.js → _typeahead-Db4YQA5c.js} +2 -2
- data/dist/chunks/_weekday_stacked-DhFTG-Jt.js +61 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-CY5ZPzic.js → lib-DnQyMxO1.js} +2 -2
- data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-kl-4Jv4t.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +11 -4
- 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 +2 -2
- metadata +19 -36
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +0 -24
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +0 -3
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +0 -17
- data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +0 -212
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +0 -112
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +0 -3
- data/dist/chunks/_weekday_stacked-rU5SIBAO.js +0 -37
@@ -29,10 +29,6 @@ module Playbook
|
|
29
29
|
default: "header"
|
30
30
|
prop :row_styling, type: Playbook::Props::Array,
|
31
31
|
default: []
|
32
|
-
prop :last_row, type: Playbook::Props::Boolean,
|
33
|
-
default: false
|
34
|
-
prop :immediate_parent_row_id, type: Playbook::Props::String,
|
35
|
-
default: ""
|
36
32
|
|
37
33
|
def data
|
38
34
|
Hash(prop(:data)).merge(table_data_attributes)
|
@@ -43,7 +39,7 @@ module Playbook
|
|
43
39
|
end
|
44
40
|
|
45
41
|
def td_classname(column, index)
|
46
|
-
classes = %w[id-cell]
|
42
|
+
classes = %w[id-cell chrome-styles]
|
47
43
|
classes << "last-cell" if column[:is_last_in_group]
|
48
44
|
classes << "pinned-left" if index.zero? && is_pinned_left && responsive == "scroll"
|
49
45
|
classes.join(" ")
|
@@ -58,14 +54,12 @@ module Playbook
|
|
58
54
|
# Selectable Rows No Subrows - checkboxes in their own first cell
|
59
55
|
def render_checkbox_cell
|
60
56
|
if selectable_rows
|
61
|
-
prefix = id ? "#{id}-" : ""
|
62
57
|
pb_rails("table/table_cell", props: {
|
63
58
|
classname: "checkbox-cell",
|
64
59
|
}) do
|
65
60
|
pb_rails("checkbox", props: {
|
66
|
-
id: "
|
67
|
-
|
68
|
-
name: "#{prefix}select-row-#{row_id || row.object_id}",
|
61
|
+
id: "select-row-#{row_id || row.object_id}",
|
62
|
+
name: "select-row-#{row_id || row.object_id}",
|
69
63
|
data: {
|
70
64
|
row_id: row_id || row.object_id.to_s,
|
71
65
|
flat_advanced_table_select: true,
|
@@ -78,20 +72,9 @@ module Playbook
|
|
78
72
|
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
79
73
|
def render_row_checkbox
|
80
74
|
if selectable_rows
|
81
|
-
prefix = id ? "#{id}-" : ""
|
82
|
-
indeterminate_parent =
|
83
|
-
if depth.zero?
|
84
|
-
"#{prefix}select-all-rows"
|
85
|
-
else
|
86
|
-
"#{prefix}select-row-#{immediate_parent_row_id}"
|
87
|
-
end
|
88
|
-
|
89
75
|
pb_rails("checkbox", props: {
|
90
|
-
id: "
|
91
|
-
|
92
|
-
indeterminate_main_labels: ["", ""],
|
93
|
-
indeterminate_parent: indeterminate_parent,
|
94
|
-
name: "#{prefix}select-row-#{row_id || row.object_id}",
|
76
|
+
id: "select-row-#{row_id || row.object_id}",
|
77
|
+
name: "select-row-#{row_id || row.object_id}",
|
95
78
|
data: {
|
96
79
|
row_id: row_id || row.object_id.to_s,
|
97
80
|
},
|
@@ -6,8 +6,6 @@ module Playbook
|
|
6
6
|
prop :error, type: Playbook::Props::Boolean, default: false
|
7
7
|
prop :checked, type: Playbook::Props::Boolean, default: false
|
8
8
|
prop :indeterminate_main, type: Playbook::Props::Boolean, default: false
|
9
|
-
prop :indeterminate_main_labels, type: Playbook::Props::Array,
|
10
|
-
default: []
|
11
9
|
prop :indeterminate_parent
|
12
10
|
prop :text
|
13
11
|
prop :value
|
@@ -51,19 +49,10 @@ module Playbook
|
|
51
49
|
end
|
52
50
|
|
53
51
|
def data
|
54
|
-
|
52
|
+
Hash(prop(:data)).merge(
|
55
53
|
pb_checkbox_indeterminate_main: indeterminate_main,
|
56
54
|
pb_checkbox_indeterminate_parent: indeterminate_parent
|
57
55
|
)
|
58
|
-
|
59
|
-
if indeterminate_main && indeterminate_main_labels.size == 2
|
60
|
-
base_data.merge!(
|
61
|
-
pb_checkbox_indeterminate_main_label_check: indeterminate_main_labels[0],
|
62
|
-
pb_checkbox_indeterminate_main_label_uncheck: indeterminate_main_labels[1]
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
base_data
|
67
56
|
end
|
68
57
|
|
69
58
|
private
|
@@ -9,10 +9,10 @@
|
|
9
9
|
<tr>
|
10
10
|
<th>
|
11
11
|
<%= pb_rails("checkbox", props: {
|
12
|
+
text: "Uncheck All",
|
12
13
|
value: "checkbox-value",
|
13
14
|
name: "main-checkbox",
|
14
15
|
indeterminate_main: true,
|
15
|
-
indeterminate_main_labels: ["Check All Ice Cream", "Uncheck All Ice Cream"],
|
16
16
|
id: "indeterminate-checkbox"
|
17
17
|
}) %>
|
18
18
|
</th>
|
@@ -1,2 +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.
|
2
|
-
If you want to customize the main checkbox labels, set an array `indeterminate_main_labels` with "Check All" and "Uncheck All" labels.
|
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.
|
@@ -10,239 +10,47 @@ export default class PbCheckbox extends PbEnhancedElement {
|
|
10
10
|
connect() {
|
11
11
|
const mainCheckboxWrapper = this.element;
|
12
12
|
const mainCheckbox = mainCheckboxWrapper.querySelector('input')
|
13
|
-
const
|
13
|
+
const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
// Breadth-first search to find all nested descendants
|
21
|
-
while (queue.length > 0) {
|
22
|
-
const checkbox = queue.shift();
|
23
|
-
descendants.push(checkbox);
|
24
|
-
|
25
|
-
// Find children of this checkbox
|
26
|
-
const checkboxWrapper = checkbox.closest('[data-pb-checkbox-indeterminate-main="true"]');
|
27
|
-
if (checkboxWrapper) {
|
28
|
-
const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${checkboxWrapper.id}"] input[type="checkbox"]`);
|
29
|
-
queue.push(...childCheckboxes);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
// Also include any non-"main" checkboxes that have this as a parent
|
34
|
-
const nonMainChildCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
|
35
|
-
nonMainChildCheckboxes.forEach(cb => {
|
36
|
-
if (!descendants.includes(cb)) {
|
37
|
-
descendants.push(cb);
|
38
|
-
}
|
39
|
-
});
|
40
|
-
|
41
|
-
return descendants;
|
42
|
-
};
|
43
|
-
|
44
|
-
// Helper function to determine checkbox state
|
45
|
-
const getCheckboxState = (checkboxes) => {
|
46
|
-
const checkedCount = checkboxes.filter(cb => cb.checked).length;
|
47
|
-
const totalCount = checkboxes.length;
|
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;
|
48
20
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
indeterminate: !(checkedCount === totalCount || checkedCount === 0),
|
53
|
-
checkedCount,
|
54
|
-
totalCount
|
55
|
-
};
|
56
|
-
};
|
21
|
+
// Set the main checkbox states
|
22
|
+
mainCheckbox.indeterminate = indeterminate;
|
23
|
+
mainCheckbox.checked = checkedCount > 0;
|
57
24
|
|
58
|
-
|
59
|
-
|
60
|
-
checkbox.indeterminate = isIndeterminate;
|
61
|
-
checkbox.checked = isChecked;
|
62
|
-
};
|
25
|
+
// Determine the main checkbox label based on the number of checked checkboxes
|
26
|
+
const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
|
63
27
|
|
64
|
-
|
65
|
-
|
66
|
-
const
|
67
|
-
const uncheckAllLabel = wrapper.dataset.pbCheckboxIndeterminateMainLabelUncheck ?? 'Uncheck All';
|
68
|
-
const text = checkedCount === 0 ? checkAllLabel : uncheckAllLabel;
|
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';
|
69
31
|
|
70
|
-
// Update label
|
71
|
-
|
72
|
-
if (bodyKitElement) {
|
73
|
-
bodyKitElement.textContent = text;
|
74
|
-
}
|
32
|
+
// Update main checkbox label
|
33
|
+
mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
|
75
34
|
|
76
|
-
//
|
77
|
-
|
78
|
-
|
79
|
-
const iconClassToAdd = isIndeterminate ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
|
80
|
-
const iconClassToRemove = isIndeterminate ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
|
81
|
-
iconSpan.classList.add(iconClassToAdd);
|
82
|
-
iconSpan.classList.remove(iconClassToRemove);
|
83
|
-
}
|
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);
|
84
38
|
|
85
|
-
// Toggle icon
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
if (indeterminateIcon) {
|
90
|
-
indeterminateIcon.classList.toggle('hidden', !isIndeterminate);
|
91
|
-
}
|
92
|
-
if (checkIcon) {
|
93
|
-
checkIcon.classList.toggle('hidden', isIndeterminate);
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
|
-
// Main function to update this checkbox's state
|
98
|
-
const updateMainCheckbox = () => {
|
99
|
-
const allDescendantCheckboxes = getAllDescendantCheckboxes();
|
100
|
-
const state = getCheckboxState(allDescendantCheckboxes);
|
101
|
-
|
102
|
-
updateCheckboxVisualState(mainCheckbox, state.indeterminate, state.allChecked);
|
103
|
-
updateCheckboxLabelAndIcons(mainCheckboxWrapper, state.indeterminate, state.checkedCount);
|
104
|
-
};
|
105
|
-
|
106
|
-
// Function to update parent checkboxes recursively
|
107
|
-
const updateParentCheckboxes = () => {
|
108
|
-
const parentId = mainCheckboxWrapper.dataset.pbCheckboxIndeterminateParent;
|
109
|
-
if (parentId) {
|
110
|
-
const parentCheckbox = document.getElementById(parentId);
|
111
|
-
if (parentCheckbox) {
|
112
|
-
const parentWrapper = parentCheckbox.closest('[data-pb-checkbox-indeterminate-main="true"]');
|
113
|
-
if (parentWrapper) {
|
114
|
-
const parentInstance = parentWrapper.pbCheckboxInstance;
|
115
|
-
if (parentInstance && parentInstance.updateMainCheckbox) {
|
116
|
-
parentInstance.updateMainCheckbox();
|
117
|
-
parentInstance.updateParentCheckboxes();
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
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);
|
122
42
|
};
|
123
43
|
|
124
|
-
//
|
125
|
-
const setupNonMainCheckboxUpdates = () => {
|
126
|
-
const allCheckboxesWithChildren = document.querySelectorAll('input[type="checkbox"]');
|
127
|
-
allCheckboxesWithChildren.forEach(cb => {
|
128
|
-
const checkboxWrapper = cb.closest('[data-pb-checkbox-indeterminate-main="true"]');
|
129
|
-
if (checkboxWrapper && checkboxWrapper !== mainCheckboxWrapper) {
|
130
|
-
return; // Skip different "main" checkboxes
|
131
|
-
}
|
132
|
-
|
133
|
-
const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${cb.id}"] input[type="checkbox"]`);
|
134
|
-
if (childCheckboxes.length > 0) {
|
135
|
-
childCheckboxes.forEach(childCb => {
|
136
|
-
childCb.addEventListener('change', () => {
|
137
|
-
const state = getCheckboxState(Array.from(childCheckboxes));
|
138
|
-
updateCheckboxVisualState(cb, state.indeterminate, state.allChecked);
|
139
|
-
|
140
|
-
// Trigger updates on all main checkboxes that might be affected
|
141
|
-
const mainCheckboxes = document.querySelectorAll('[data-pb-checkbox-indeterminate-main="true"]');
|
142
|
-
mainCheckboxes.forEach(mainCb => {
|
143
|
-
const mainInstance = mainCb.pbCheckboxInstance;
|
144
|
-
if (mainInstance && mainInstance.updateMainCheckbox) {
|
145
|
-
setTimeout(() => {
|
146
|
-
mainInstance.updateMainCheckbox();
|
147
|
-
}, 0);
|
148
|
-
}
|
149
|
-
});
|
150
|
-
});
|
151
|
-
});
|
152
|
-
}
|
153
|
-
});
|
154
|
-
};
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
// Initialize checkbox state
|
44
|
+
// Set indeterminate icon on main checkbox if initial children checkboxes are checked
|
159
45
|
updateMainCheckbox();
|
160
46
|
|
161
|
-
|
162
|
-
|
163
|
-
const allDescendantCheckboxes = getAllDescendantCheckboxes();
|
164
|
-
const state = getCheckboxState(allDescendantCheckboxes);
|
165
|
-
|
166
|
-
if (state.indeterminate) {
|
167
|
-
// If indeterminate, uncheck all descendants and the parent
|
168
|
-
allDescendantCheckboxes.forEach(cb => {
|
169
|
-
cb.checked = false;
|
170
|
-
// Dispatch custom event for programmatic changes- change styles in advanced table
|
171
|
-
cb.dispatchEvent(new Event('checkbox-programmatic-change', { bubbles: true }));
|
172
|
-
});
|
173
|
-
this.checked = false;
|
174
|
-
} else {
|
175
|
-
// Otherwise, set all descendants to the same state as this checkbox
|
176
|
-
allDescendantCheckboxes.forEach(cb => {
|
177
|
-
cb.checked = this.checked;
|
178
|
-
// Dispatch custom event for programmatic changes- change styles in advanced table
|
179
|
-
cb.dispatchEvent(new Event('checkbox-programmatic-change', { bubbles: true }));
|
180
|
-
});
|
181
|
-
}
|
182
|
-
|
183
|
-
// Update this checkbox first, then parents after a delay
|
47
|
+
this.element.querySelector('input').addEventListener('change', function() {
|
48
|
+
childCheckboxes.forEach(cb => cb.checked = this.checked);
|
184
49
|
updateMainCheckbox();
|
185
|
-
setTimeout(() => {
|
186
|
-
updateParentCheckboxes();
|
187
|
-
}, 0);
|
188
|
-
|
189
|
-
// Also trigger updates on all main checkboxes to ensure proper state propagation
|
190
|
-
triggerAllMainCheckboxUpdates();
|
191
50
|
});
|
192
51
|
|
193
|
-
|
194
|
-
directChildCheckboxes.forEach(cb => {
|
52
|
+
childCheckboxes.forEach(cb => {
|
195
53
|
cb.addEventListener('change', updateMainCheckbox);
|
196
54
|
});
|
197
|
-
|
198
|
-
// Handle deeper descendant changes
|
199
|
-
const allDescendantCheckboxes = getAllDescendantCheckboxes();
|
200
|
-
allDescendantCheckboxes.forEach(cb => {
|
201
|
-
if (!Array.from(directChildCheckboxes).includes(cb)) {
|
202
|
-
cb.addEventListener('change', updateMainCheckbox);
|
203
|
-
}
|
204
|
-
});
|
205
|
-
|
206
|
-
// Handle non-main child checkboxes
|
207
|
-
const allChildCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
|
208
|
-
allChildCheckboxes.forEach(cb => {
|
209
|
-
if (!allDescendantCheckboxes.includes(cb)) {
|
210
|
-
cb.addEventListener('change', updateMainCheckbox);
|
211
|
-
}
|
212
|
-
});
|
213
|
-
|
214
|
-
// Also trigger updates on all main checkboxes when any checkbox changes
|
215
|
-
let updateTimeout = null;
|
216
|
-
const triggerAllMainCheckboxUpdates = () => {
|
217
|
-
// Debounce the updates to prevent excessive calls
|
218
|
-
if (updateTimeout) {
|
219
|
-
clearTimeout(updateTimeout);
|
220
|
-
}
|
221
|
-
updateTimeout = setTimeout(() => {
|
222
|
-
const mainCheckboxes = document.querySelectorAll('[data-pb-checkbox-indeterminate-main="true"]');
|
223
|
-
mainCheckboxes.forEach(mainCb => {
|
224
|
-
const mainInstance = mainCb.pbCheckboxInstance;
|
225
|
-
if (mainInstance && mainInstance.updateMainCheckbox) {
|
226
|
-
mainInstance.updateMainCheckbox();
|
227
|
-
}
|
228
|
-
});
|
229
|
-
}, 10); // Small delay to batch updates
|
230
|
-
};
|
231
|
-
|
232
|
-
// Store the original updateMainCheckbox function and create a new one that also triggers updates
|
233
|
-
const originalUpdateMainCheckbox = updateMainCheckbox;
|
234
|
-
const enhancedUpdateMainCheckbox = () => {
|
235
|
-
originalUpdateMainCheckbox();
|
236
|
-
triggerAllMainCheckboxUpdates();
|
237
|
-
};
|
238
|
-
|
239
|
-
// Replace the updateMainCheckbox function
|
240
|
-
mainCheckboxWrapper.pbCheckboxInstance = {
|
241
|
-
updateMainCheckbox: enhancedUpdateMainCheckbox,
|
242
|
-
updateParentCheckboxes
|
243
|
-
};
|
244
|
-
|
245
|
-
// Setup updates for non-main checkboxes with children
|
246
|
-
setupNonMainCheckboxUpdates();
|
247
55
|
}
|
248
56
|
}
|
@@ -1,14 +1,5 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("button", props: {
|
3
|
-
type: object.type,
|
4
|
-
loading: object.loading,
|
5
|
-
link: object.link,
|
6
|
-
new_window: object.new_window,
|
7
|
-
variant: object.variant,
|
8
|
-
target: object.target,
|
9
|
-
disabled: object.disabled,
|
10
|
-
dark: object.dark
|
11
|
-
}.merge(object.input_options)) do %>
|
2
|
+
<%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant, target: object.target, disabled: object.disabled, dark: object.dark}) do %>
|
12
3
|
<%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
|
13
4
|
<% end %>
|
14
5
|
<% end %>
|
@@ -21,8 +21,6 @@ module Playbook
|
|
21
21
|
prop :size, type: Playbook::Props::Enum,
|
22
22
|
values: %w[default sm],
|
23
23
|
default: "default"
|
24
|
-
prop :input_options, type: Playbook::Props::HashProp,
|
25
|
-
default: {}
|
26
24
|
|
27
25
|
def classname
|
28
26
|
generate_classname("pb_circle_icon_button_kit") + size_class
|
@@ -19,7 +19,6 @@ type PbDateProps = {
|
|
19
19
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
20
20
|
id?: string;
|
21
21
|
showDayOfWeek?: boolean;
|
22
|
-
showCurrentYear?: boolean;
|
23
22
|
showIcon?: boolean;
|
24
23
|
size?: "sm" | "md" | "lg";
|
25
24
|
unstyled?: boolean;
|
@@ -36,7 +35,6 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
36
35
|
htmlOptions = {},
|
37
36
|
id,
|
38
37
|
showDayOfWeek = false,
|
39
|
-
showCurrentYear = false,
|
40
38
|
showIcon = false,
|
41
39
|
size = "md",
|
42
40
|
unstyled = false,
|
@@ -92,7 +90,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
92
90
|
{month} {day}
|
93
91
|
</span>
|
94
92
|
|
95
|
-
{
|
93
|
+
{currentYear != year && <span>{`, ${year}`}</span>}
|
96
94
|
</span>
|
97
95
|
</>
|
98
96
|
: size == "md" || size == "lg"
|
@@ -126,7 +124,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
126
124
|
<span>
|
127
125
|
{month} {day}
|
128
126
|
</span>
|
129
|
-
{
|
127
|
+
{currentYear != year && <span>{`, ${year}`}</span>}
|
130
128
|
</Title>
|
131
129
|
)
|
132
130
|
: (
|
@@ -160,7 +158,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
160
158
|
<Caption dark={dark}
|
161
159
|
tag="span">
|
162
160
|
{month} {day}
|
163
|
-
{
|
161
|
+
{currentYear != year && <>{`, ${year}`}</>}
|
164
162
|
</Caption>
|
165
163
|
</>
|
166
164
|
)}
|
@@ -13,8 +13,8 @@
|
|
13
13
|
<% end %>
|
14
14
|
|
15
15
|
<!-- month day, year -->
|
16
|
-
<%# if not current year
|
17
|
-
<% if object.year.to_s == DateTime.now.year.to_s
|
16
|
+
<%# if not current year %>
|
17
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
18
18
|
<span><%= "#{object.month} #{object.day}" %></span>
|
19
19
|
<%# if is current year %>
|
20
20
|
<% else %>
|
@@ -44,8 +44,8 @@
|
|
44
44
|
|
45
45
|
<!-- month day, year -->
|
46
46
|
|
47
|
-
<%# if not current year
|
48
|
-
<% if object.year.to_s == DateTime.now.year.to_s
|
47
|
+
<%# if not current year %>
|
48
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
49
49
|
<%= pb_rails("title", props: { tag: "div", text: "#{object.month} #{object.day}", size: 4 }) %>
|
50
50
|
<%# if is current year %>
|
51
51
|
<% else %>
|
@@ -74,8 +74,8 @@
|
|
74
74
|
|
75
75
|
<!-- month day, year -->
|
76
76
|
|
77
|
-
<%# if not current year
|
78
|
-
<% if object.year.to_s == DateTime.now.year.to_s
|
77
|
+
<%# if not current year %>
|
78
|
+
<% if object.year.to_s == DateTime.now.year.to_s %>
|
79
79
|
<%= pb_rails("caption", props: { tag: "span", text: "#{object.month} #{object.day}" }) %>
|
80
80
|
<%# if is current year %>
|
81
81
|
<% else %>
|
@@ -11,8 +11,6 @@ module Playbook
|
|
11
11
|
default: false
|
12
12
|
prop :show_day_of_week, type: Playbook::Props::Boolean,
|
13
13
|
default: false
|
14
|
-
prop :show_current_year, type: Playbook::Props::Boolean,
|
15
|
-
default: false
|
16
14
|
prop :size, type: Playbook::Props::Enum,
|
17
15
|
values: %w[lg md sm xs],
|
18
16
|
default: "md"
|
@@ -5,14 +5,12 @@ examples:
|
|
5
5
|
- date_variants: Variants
|
6
6
|
- date_alignment: Alignment
|
7
7
|
- date_timezone: Timezones
|
8
|
-
- date_with_show_current_year: Show Current Year
|
9
8
|
- date_unstyled: Unstyled
|
10
9
|
|
11
10
|
react:
|
12
11
|
- date_default: Default
|
13
12
|
- date_variants: Variants
|
14
13
|
- date_alignment: Alignment
|
15
|
-
- date_with_show_current_year: Show Current Year
|
16
14
|
- date_unstyled: Unstyled
|
17
15
|
|
18
16
|
swift:
|
@@ -2,4 +2,3 @@ export { default as DateDefault } from './_date_default.jsx'
|
|
2
2
|
export { default as DateVariants } from './_date_variants.jsx'
|
3
3
|
export { default as DateAlignment } from './_date_alignment.jsx'
|
4
4
|
export { default as DateUnstyled } from './_date_unstyled.jsx'
|
5
|
-
export { default as DateWithShowCurrentYear } from './_date_with_show_current_year.jsx'
|
@@ -8,7 +8,6 @@
|
|
8
8
|
@import "../pb_textarea/textarea_mixin";
|
9
9
|
|
10
10
|
@import "./scss_partials/dropdown_animation";
|
11
|
-
@import "dropdown_mixin";
|
12
11
|
|
13
12
|
[class*="pb_dropdown"] {
|
14
13
|
.dropdown_wrapper {
|
@@ -99,23 +98,9 @@
|
|
99
98
|
[class^="pb_title_kit"], a {
|
100
99
|
color: $white !important;
|
101
100
|
}
|
102
|
-
border-bottom: 1px solid $border_light;
|
103
101
|
&:hover {
|
104
|
-
background-color: $product_1_background;
|
105
|
-
}
|
106
|
-
|
107
|
-
// activeStyle font color map
|
108
|
-
@each $name, $color in $font-colors {
|
109
|
-
&.font-#{$name} {
|
110
|
-
@include apply-font-color($color);
|
111
|
-
}
|
102
|
+
background-color: $product_1_background !important;
|
112
103
|
}
|
113
|
-
// activeStyle background color map (no difference between selected and selected+hover custom colors)
|
114
|
-
@each $name, $bg in $background-colors {
|
115
|
-
&.bg-#{$name} {
|
116
|
-
background-color: $bg;
|
117
|
-
}
|
118
|
-
}
|
119
104
|
}
|
120
105
|
}
|
121
106
|
|
@@ -282,7 +267,6 @@
|
|
282
267
|
}
|
283
268
|
&[class*="selected"] {
|
284
269
|
background-color: $primary;
|
285
|
-
border-bottom: rgba($white, 0.15);
|
286
270
|
}
|
287
271
|
}
|
288
272
|
}
|
@@ -39,10 +39,6 @@ type DropdownProps = {
|
|
39
39
|
options: GenericObject;
|
40
40
|
separators?: boolean;
|
41
41
|
variant?: "default" | "subtle";
|
42
|
-
activeStyle?: {
|
43
|
-
backgroundColor?: string;
|
44
|
-
fontColor?: string;
|
45
|
-
};
|
46
42
|
};
|
47
43
|
|
48
44
|
interface DropdownComponent
|
@@ -73,7 +69,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
73
69
|
options,
|
74
70
|
separators = true,
|
75
71
|
variant = "default",
|
76
|
-
activeStyle,
|
77
72
|
} = props;
|
78
73
|
|
79
74
|
const ariaProps = buildAriaProps(aria);
|
@@ -256,7 +251,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
256
251
|
>
|
257
252
|
<DropdownContext.Provider
|
258
253
|
value={{
|
259
|
-
activeStyle,
|
260
254
|
autocomplete,
|
261
255
|
dropdownContainerRef,
|
262
256
|
filteredOptions,
|
@@ -18,7 +18,6 @@ const DropdownCustomRadioOptions = (props) => {
|
|
18
18
|
return (
|
19
19
|
<div>
|
20
20
|
<Dropdown
|
21
|
-
activeStyle={{ backgroundColor: "bg_light", fontColor: "text_lt_default" }}
|
22
21
|
label="Select Item"
|
23
22
|
onSelect={(selectedItem) => setSelectedValue(selectedItem?.value)}
|
24
23
|
options={options}
|
@@ -1 +1 @@
|
|
1
|
-
Radio inputs can be used inside `Dropdown.Option` for a custom layout that mimics form-like selection within a dropdown.
|
1
|
+
Radio inputs can be used inside `Dropdown.Option` for a custom layout that mimics form-like selection within a dropdown.
|
@@ -16,7 +16,7 @@ examples:
|
|
16
16
|
- dropdown_with_search_rails: Custom Trigger Dropdown with Search
|
17
17
|
- dropdown_with_custom_padding: Custom Option Padding
|
18
18
|
- dropdown_with_custom_icon_options: Custom Icon Options
|
19
|
-
# - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in
|
19
|
+
# - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
|
20
20
|
- dropdown_error: Dropdown with Error
|
21
21
|
- dropdown_default_value: Default Value
|
22
22
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
@@ -39,9 +39,8 @@ examples:
|
|
39
39
|
- dropdown_with_custom_trigger: Custom Trigger
|
40
40
|
- dropdown_with_search: Custom Trigger Dropdown with Search
|
41
41
|
- dropdown_with_custom_padding: Custom Option Padding
|
42
|
-
- dropdown_with_custom_active_style_options: Custom Active Style Options
|
43
42
|
- dropdown_with_custom_icon_options: Custom Icon Options
|
44
|
-
- dropdown_with_custom_radio_options: Custom Radio Options
|
43
|
+
# - dropdown_with_custom_radio_options: Custom Radio Options # TODO: Update and publish doc ex in [PLAY-2146](https://runway.powerhrg.com/backlog_items/PLAY-2146) (remove this comment afterwards)
|
45
44
|
- dropdown_error: Dropdown with Error
|
46
45
|
- dropdown_default_value: Default Value
|
47
46
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
@@ -21,5 +21,4 @@ export { default as DropdownMultiSelectWithAutocomplete } from './_dropdown_mult
|
|
21
21
|
export { default as DropdownMultiSelectWithDefault } from './_dropdown_multi_select_with_default.jsx'
|
22
22
|
export { default as DropdownMultiSelectWithCustomOptions } from './_dropdown_multi_select_with_custom_options.jsx'
|
23
23
|
export {default as DropdownWithCustomIconOptions} from './_dropdown_with_custom_icon_options.jsx'
|
24
|
-
export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
|
25
|
-
export {default as DropdownWithCustomActiveStyleOptions} from './_dropdown_with_custom_active_style_options.jsx'
|
24
|
+
export {default as DropdownWithCustomRadioOptions} from './_dropdown_with_custom_radio_options.jsx'
|