bulma-rails-helpers 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 347a5e9175dcd570a12788b66d3879b62086def07f691534c523adf52e025512
4
- data.tar.gz: 4725fa0aa7a19f42900e722052c87c86c4a9fa4b8e4d0ba1cb3b4f44c7204dc2
3
+ metadata.gz: 20e1c09d7804b5a236d1d742c33a462d37511009d94af974aa3a0120eaa606be
4
+ data.tar.gz: 6550cf6c2a8ff16ac59221542873e62a5bdff93c04aeabb27b5ed019b1b01e93
5
5
  SHA512:
6
- metadata.gz: 8569b3574a226c561db4f7c1c6d1170f6bd20703b4a1803f482049216c8764ec87957056fd0685f0f573d07a233f02227f66a9ea24638182c1f1a2f64f30333e
7
- data.tar.gz: a6a11d469c862730ef1ae91b6bff9c58108bf3228b89c851c9ff7a93f5072cecf08f09da546863704e41969ac7c3ddc22906c97957e56b3a6bf3ab6e8470c144
6
+ metadata.gz: 548fc0401cd1fb44faa8d6f6f5db6719a4391a588e09f8dd23cbea42426f0911cda8b9972756bf603243dcd243d37277402547bbee5be639f56fa278d436a232
7
+ data.tar.gz: 0ceae2f54bf4394912e505d779088e5170f040dd647b00a9a6ee40c91cdd0d6e8e5b00bde59b8e818cbf4da61e17c1d75a543c2fd7f9381c4edcbb9b0b5f4a7d
@@ -0,0 +1,37 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ export default class extends Controller {
4
+ static targets = ["tab", "content"];
5
+
6
+ showTabContent(event) {
7
+ event.preventDefault();
8
+
9
+ const id = event.currentTarget.dataset.tabContent;
10
+ this.showTabAndContentForId(id);
11
+ }
12
+
13
+ showTabAndContentForId(id) {
14
+ this.manageTabs(id);
15
+ this.manageContent(id);
16
+ }
17
+
18
+ manageTabs(id) {
19
+ this.tabTargets.forEach((tab) => {
20
+ if (tab.dataset.tabContent === id) {
21
+ tab.classList.add("is-active");
22
+ } else {
23
+ tab.classList.remove("is-active");
24
+ }
25
+ });
26
+ }
27
+
28
+ manageContent(id) {
29
+ this.contentTargets.forEach((content) => {
30
+ if (content.id === id) {
31
+ content.classList.remove("is-hidden");
32
+ } else {
33
+ content.classList.add("is-hidden");
34
+ }
35
+ });
36
+ }
37
+ }
data/lib/bulma/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bulma
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulma-rails-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Kummer
@@ -49,6 +49,7 @@ files:
49
49
  - app/javascript/controllers/bulma/dropdown_controller.js
50
50
  - app/javascript/controllers/bulma/file_input_display_controller.js
51
51
  - app/javascript/controllers/bulma/navigation_bar_controller.js
52
+ - app/javascript/controllers/bulma/tabs_controller.js
52
53
  - config/importmap.rb
53
54
  - lib/bulma-rails-helpers.rb
54
55
  - lib/bulma/engine.rb