css-zero 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1421a60d112863654f94a4b070a0da95043d7cbada5cad2ddf49b115cf61e9ff
4
- data.tar.gz: 5faa34fbd968a3ad3197f3782aeb34300ade587897fdec6a21a6e24245bd925c
3
+ metadata.gz: b786d5d38b248a7289f4dcce1246ddcdffebc21deb4327dc8ac575c1466ba5b9
4
+ data.tar.gz: 4364538047fdcd11f323687ed346662b334651404bdabf2c125d822c3f96cc3f
5
5
  SHA512:
6
- metadata.gz: 610498e4c9ca04696ffa786da7498d344e9ef5704a6899bed3d3c75dd29fc88d2205ef59023e1e6fd2f8a82fd05cf91e901ed1ec90e4361519c71be9d0c4516b
7
- data.tar.gz: bf00a3e2988209b59a7fac29479bc05150367f7db0659f58c2030c7f1f2bb0b8d8061643bc1dd2845634e812fc3f4c6ae4be883f2920e2ed6ae89cb97517cc4e
6
+ metadata.gz: a9efa1df9e4643f47ef0dd2cf9d334a02ddfcbfcf1979819acdada8068aefe81c22347180d392151b6d8699ca6022253763cb7438bba59c20fec123f5d7ff0d8
7
+ data.tar.gz: fd75ca1525671ceb6ffcb24c3fd4291e0f044366999c2958c3fb33c84973fff0ca32e35c509cfce4b7e5ead3218706787fc29763096a1b30ad8c438d281a76ed
@@ -1,5 +1,9 @@
1
1
  module TabsHelper
2
- def tab_button(content = nil, value:, **, &)
3
- tag.button(content, class: "btn", data: { tabs_target: "button", action: "tabs#select", value: }, **, &)
2
+ def tab_button(content = nil, id:, value:, **, &)
3
+ tag.button(content, id:, class: "btn", role: "tab", aria: { controls: value }, data: { tabs_target: "button", action: "tabs#select", value: }, **, &)
4
+ end
5
+
6
+ def tab_panel(id, labelled_by:, **, &)
7
+ tag.div(id:, role: "tabpanel", aria: { labelledby: labelled_by }, data: { tabs_target: "tab" }, **, &)
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
@@ -19,7 +19,7 @@
19
19
  inline-size: var(--size-full);
20
20
  }
21
21
 
22
- button[data-selected=true] {
22
+ button[aria-selected=true] {
23
23
  background-color: var(--color-bg);
24
24
  color: var(--color-text);
25
25
  }
@@ -2,24 +2,24 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  static targets = [ "button", "tab" ]
5
- static values = { selected: String }
5
+ static values = { selected: String }
6
6
 
7
7
  initialize() {
8
8
  this.#showSelectedTab()
9
9
  }
10
10
 
11
- select(event) {
12
- this.selectedValue = event.target.dataset.value
11
+ select({ target }) {
12
+ this.selectedValue = target.dataset.value
13
13
  this.#showSelectedTab()
14
14
  }
15
15
 
16
16
  #showSelectedTab() {
17
17
  this.buttonTargets.forEach(element => {
18
- element.dataset.selected = element.dataset.value === this.selectedValue
18
+ element.ariaSelected = element.dataset.value === this.selectedValue
19
19
  })
20
20
 
21
21
  this.tabTargets.forEach(element => {
22
- element.hidden = element.dataset.value !== this.selectedValue
22
+ element.hidden = element.id !== this.selectedValue
23
23
  })
24
24
  }
25
25
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lázaro Nixon