playbook_ui 14.21.0.pre.rc.1 → 14.21.0.pre.rc.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 336755bba6712ce669382639b82a88f8dc5020d88808191eb6897897716d64a9
4
- data.tar.gz: 0eb8dd3e40bca57c15ee0da1e9da8c94c8fb72ee1ffef42e383385b087008ec1
3
+ metadata.gz: feaf6f2c267cd3a356273dca3cb6ce00b49ceb72745c5fd8f3e217d9262b4a32
4
+ data.tar.gz: e5d40c29302026274aa4ad7557de1d057d3dd18addbdc530ca3ecdee1f068e94
5
5
  SHA512:
6
- metadata.gz: d577d4f25a65cbda96295bedb5e4b339fa67c17a5f6cbcd1ea98d102cc1c851d8a715432c49c436fc64478964fe8f885f5eee8ce3b6ccbdf72d6ae3c05bc16cd
7
- data.tar.gz: 60a7fa9c59ca86adf29b72a9624d42300d3ae46059ccefc0e1ac228984346258673cc5dc46996eb06b70197093848bb078d47e81ed14fa045250920274990f29
6
+ metadata.gz: eafcb51b853cd63b2d3744c88be09685bdb4e12657fbcbea9ccca1af21b630057300f9cb90a216c385dd32406c325edbcd22e06328a312a366b77fbd37826552
7
+ data.tar.gz: d44e83bea74f94b307b6fee2d8ddb7d5973d9b315868ae58c928665ccfb944475c681cda5de75f6b3fda503cdb58d6d27b3ddab160714d3d8c63c8703a31e06d
@@ -1,7 +1,4 @@
1
- <%= pb_content_tag(:label, data: {
2
- pb_checkbox_indeterminate_main: object.indeterminate_main,
3
- pb_checkbox_indeterminate_parent: object.indeterminate_parent,
4
- }) do %>
1
+ <%= pb_content_tag(:label) do %>
5
2
  <%= content.presence || object.input %>
6
3
  <span data-pb-checkbox-icon-span="true" class="pb_checkbox_checkmark">
7
4
  <%= pb_rails("icon", props: { icon: "check", classname: "check_icon", fixed_width: true}) %>
@@ -31,6 +31,13 @@ module Playbook
31
31
  error ? "negative" : nil
32
32
  end
33
33
 
34
+ def data
35
+ Hash(prop(:data)).merge(
36
+ pb_checkbox_indeterminate_main: indeterminate_main,
37
+ pb_checkbox_indeterminate_parent: indeterminate_parent
38
+ )
39
+ end
40
+
34
41
  private
35
42
 
36
43
  def error_class
@@ -18,7 +18,7 @@
18
18
  checked: true,
19
19
  value: "checkbox-value",
20
20
  name: "main-checkbox-selectable",
21
- indeterminate: true,
21
+ indeterminate_main: true,
22
22
  id: "checkbox-selectable"
23
23
  }) %>
24
24
  <% end %>
@@ -33,7 +33,7 @@
33
33
  <% checkboxes.each_with_index do |checkbox, index| %>
34
34
  <%= pb_rails("table/table_row") do %>
35
35
  <%= pb_rails("table/table_cell") do %>
36
- <%= pb_rails("checkbox", props: { checked: checkbox[:checked], id: "#{checkbox[:id]}-selectable-checkbox", name: "#{checkbox[:id]}-selectable-checkbox", on_change: "updateCheckboxes(#{index})", value: "check-box value" }) %>
36
+ <%= pb_rails("checkbox", props: { checked: checkbox[:checked], id: "#{checkbox[:id]}-selectable-checkbox", name: "#{checkbox[:id]}-selectable-checkbox", on_change: "updateCheckboxes(#{index})", value: "check-box value", indeterminate_parent: "checkbox-selectable" }) %>
37
37
  <% end %>
38
38
  <%= pb_rails("table/table_cell") do %>
39
39
  <%= pb_rails("image", props: { alt: "picture of a misty forest", size: "xs", url: "https://unsplash.it/500/400/?image=634" }) %>
@@ -45,52 +45,4 @@
45
45
  <% end %>
46
46
  <% end %>
47
47
  <% end %>
48
- <% end %>
49
-
50
- <script>
51
- document.addEventListener('DOMContentLoaded', function() {
52
- const mainCheckboxWrapper = document.getElementById('checkbox-selectable');
53
- const mainCheckbox = document.getElementsByName("main-checkbox-selectable")[0];
54
- const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="selectable-checkbox"]');
55
- const deleteButton = document.getElementById('delete-button');
56
-
57
- const updateDeleteButton = () => {
58
- const anyChecked = Array.from(childCheckboxes).some(checkbox => checkbox.checked);
59
- deleteButton.style.display = anyChecked ? 'block' : 'none';
60
- };
61
-
62
- const updateMainCheckbox = () => {
63
- // Count the number of checked child checkboxes
64
- const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
65
- // Determine if the main checkbox should be in an indeterminate state
66
- const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
67
-
68
- // Set the main checkbox states
69
- mainCheckbox.indeterminate = indeterminate;
70
- mainCheckbox.checked = checkedCount > 0;
71
-
72
- // Determine the icon class to add and remove based on the number of checked checkboxes
73
- const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
74
- const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
75
-
76
- // Add and remove the icon class to the main checkbox wrapper
77
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
78
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
79
-
80
- // Toggle the visibility of the checkbox icon based on the indeterminate state
81
- mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
82
- mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
83
-
84
- updateDeleteButton();
85
- };
86
-
87
- mainCheckbox.addEventListener('change', function() {
88
- childCheckboxes.forEach(cb => cb.checked = this.checked);
89
- updateMainCheckbox();
90
- });
91
-
92
- childCheckboxes.forEach(cb => {
93
- cb.addEventListener('change', updateMainCheckbox);
94
- });
95
- });
96
- </script>
48
+ <% end %>
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "14.20.0"
5
- VERSION = "14.21.0.pre.rc.1"
5
+ VERSION = "14.21.0.pre.rc.2"
6
6
  end
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.21.0.pre.rc.1
4
+ version: 14.21.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX