essence 0.3.0 → 0.3.1

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: 8a05b5cc8ee41e915b4d8646bb7357451484b0d36f9893deb21f58c540838d86
4
- data.tar.gz: 27b53f351c8b5fb5b6718cdf2c5b4b4834251042dc48657dd2a70ac42e4865be
3
+ metadata.gz: d1d7dc966c3eb0029d7e5a915b1ff3fa14b1d183d5112dee299658c7629aa864
4
+ data.tar.gz: bcf8f18a90536197d479dcd8db22838e4813ec3c7460554535e27719099ab54a
5
5
  SHA512:
6
- metadata.gz: 1f3d8aad9655e9a3d86ca7db39d6bdc03f608bfe6bc79f6cea64591340449b19fa4c9ffbbfe0f8939472b870dcf57508f1a1b0d9d29504757b49e3636ef3c074
7
- data.tar.gz: 846b1a2df22849a2c8cdb9b8d44a8e7dbc3204e4b90e68b93b8d355ae6aa86076da3206c00594a54d23b714b37562cf38a5e9070bcaf9e590d3120a372dceb16
6
+ metadata.gz: 9af42a72f2769c7a7bf6493126bed5c945b7220f083500a2c0728dacc5b3307c1b2e1a9170b6a566e55c3ca8e7d5930207cfa561c364f6e11bc572a4057cf983
7
+ data.tar.gz: 0b792623dee2c44c9ed33e60f824957790f18b3d6c2836b37aecfe7bad0355a013b06423125a2ade99074a2f2af8ce224a655677667bf97cc4b947598e52107b
@@ -0,0 +1,40 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ export default class extends Controller {
4
+ static targets = ["tab", "panel"];
5
+ static values = { active: String };
6
+
7
+ setActiveTab(event) {
8
+ this.activeValue = event.params.panelId;
9
+ }
10
+
11
+ activeValueChanged() {
12
+ this.tabTargets.forEach((tab) => {
13
+ tab.ariaSelected = tab.id === this.activeValue;
14
+ });
15
+
16
+ this.panelTargets.forEach((panel) => {
17
+ panel.ariaHidden = panel.id !== this.activeValue;
18
+ });
19
+ }
20
+
21
+ next(event) {
22
+ this.navigate(event, "next");
23
+ }
24
+
25
+ previous(event) {
26
+ this.navigate(event, "previous");
27
+ }
28
+
29
+ navigate(event, direction) {
30
+ const tab =
31
+ direction === "next"
32
+ ? event.target.nextElementSibling
33
+ : event.target.previousElementSibling;
34
+
35
+ if (!tab) return;
36
+
37
+ tab.click();
38
+ tab.focus();
39
+ }
40
+ }
@@ -1,3 +1,3 @@
1
1
  module Essence
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: essence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elvinas Predkelis
@@ -68,6 +68,7 @@ extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
70
  - README.md
71
+ - essence/stimulus/tabs_controller.js
71
72
  - exe/essence
72
73
  - lib/essence.rb
73
74
  - lib/essence/cli.rb