css-zero 0.0.47 → 0.0.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/css_zero/version.rb +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js +11 -19
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js +0 -11
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js +13 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c2fa4f9172129b3e90a0a4cdcb7870f5467d8cbee3fd8d9d621eebd65212912
|
4
|
+
data.tar.gz: 0ddf2089702a14920122e9ce9d421dc8017e6a2c3fe9aa42284b83700b83a357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a98928f94335f61b029d53858d524919c940f14012bdaa9af96b22c924f03d6bff5b79c1aa774caebb4d7b494de2a9392f4e6315dc7445c9734244f09e88313f
|
7
|
+
data.tar.gz: d682b0a2a721c13c04e250ca332eaf1bd531b173b96552b60fd1f93f8cb94813a139b4926fdb718c423412d9151be3b18242235d0e51cc21886411ad28ab2a93
|
data/lib/css_zero/version.rb
CHANGED
@@ -4,37 +4,29 @@ export default class extends Controller {
|
|
4
4
|
static targets = [ "item" ]
|
5
5
|
static values = { index: Number }
|
6
6
|
|
7
|
-
indexValueChanged() {
|
8
|
-
this.#
|
7
|
+
indexValueChanged(index, previousIndex) {
|
8
|
+
this.#updateTabstops(previousIndex !== undefined)
|
9
9
|
}
|
10
10
|
|
11
11
|
prev() {
|
12
|
-
|
13
|
-
hasPrevious && this.indexValue--
|
14
|
-
hasPrevious && this.#focusCurrentItem()
|
12
|
+
this.indexValue > 0 && this.indexValue--
|
15
13
|
}
|
16
14
|
|
17
15
|
next() {
|
18
|
-
|
19
|
-
hasNext && this.indexValue++
|
20
|
-
hasNext && this.#focusCurrentItem()
|
16
|
+
this.indexValue < this.itemTargets.length -1 && this.indexValue++
|
21
17
|
}
|
22
18
|
|
23
19
|
reset() {
|
24
20
|
this.indexValue = 0
|
25
|
-
this.#focusCurrentItem()
|
26
21
|
}
|
27
22
|
|
28
|
-
#
|
29
|
-
this.itemTargets.forEach(
|
30
|
-
|
31
|
-
|
32
|
-
#focusCurrentItem() {
|
33
|
-
this.itemTargets[this.indexValue].tabIndex = 0
|
34
|
-
this.itemTargets[this.indexValue].focus()
|
35
|
-
}
|
23
|
+
#updateTabstops(shouldFocus) {
|
24
|
+
this.itemTargets.forEach((element, index) => {
|
25
|
+
element.tabIndex = index == this.indexValue ? 0 : -1
|
26
|
+
})
|
36
27
|
|
37
|
-
|
38
|
-
|
28
|
+
if (shouldFocus) {
|
29
|
+
this.itemTargets[this.indexValue].focus()
|
30
|
+
}
|
39
31
|
}
|
40
32
|
}
|
@@ -6,10 +6,7 @@ export default class extends Controller {
|
|
6
6
|
static targets = [ "button", "menu" ]
|
7
7
|
static classes = [ "flip" ]
|
8
8
|
|
9
|
-
#closeTimer
|
10
|
-
|
11
9
|
show() {
|
12
|
-
this.#resetTimer()
|
13
10
|
this.menuTarget.show()
|
14
11
|
this.#updateExpanded()
|
15
12
|
this.#orient()
|
@@ -20,10 +17,6 @@ export default class extends Controller {
|
|
20
17
|
this.#updateExpanded()
|
21
18
|
}
|
22
19
|
|
23
|
-
closeLater() {
|
24
|
-
this.#closeTimer = setTimeout(() => this.close(), 300)
|
25
|
-
}
|
26
|
-
|
27
20
|
toggle() {
|
28
21
|
this.menuTarget.open ? this.close() : this.show()
|
29
22
|
}
|
@@ -32,10 +25,6 @@ export default class extends Controller {
|
|
32
25
|
!this.element.contains(target) && this.close()
|
33
26
|
}
|
34
27
|
|
35
|
-
#resetTimer() {
|
36
|
-
clearTimeout(this.#closeTimer)
|
37
|
-
}
|
38
|
-
|
39
28
|
#orient() {
|
40
29
|
this.menuTarget.classList.toggle(this.flipClass, this.#distanceToBottom < BOTTOM_THRESHOLD)
|
41
30
|
}
|
@@ -4,8 +4,8 @@ export default class extends Controller {
|
|
4
4
|
static targets = [ "button", "tab" ]
|
5
5
|
static values = { index: Number }
|
6
6
|
|
7
|
-
indexValueChanged() {
|
8
|
-
this.#showCurrentTab()
|
7
|
+
indexValueChanged(index, previousIndex) {
|
8
|
+
this.#showCurrentTab(previousIndex !== undefined)
|
9
9
|
}
|
10
10
|
|
11
11
|
select({ target }) {
|
@@ -13,33 +13,25 @@ export default class extends Controller {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
prev() {
|
16
|
-
|
17
|
-
hasPrevious && this.indexValue--
|
18
|
-
hasPrevious && this.#focusCurrentButton()
|
16
|
+
this.indexValue > 0 && this.indexValue--
|
19
17
|
}
|
20
18
|
|
21
19
|
next() {
|
22
|
-
|
23
|
-
hasNext && this.indexValue++
|
24
|
-
hasNext && this.#focusCurrentButton()
|
20
|
+
this.indexValue < this.tabTargets.length -1 && this.indexValue++
|
25
21
|
}
|
26
22
|
|
27
|
-
#showCurrentTab() {
|
28
|
-
this.buttonTargets.forEach((
|
29
|
-
|
30
|
-
|
23
|
+
#showCurrentTab(shouldFocus) {
|
24
|
+
this.buttonTargets.forEach((element, index) => {
|
25
|
+
element.ariaSelected = index == this.indexValue
|
26
|
+
element.tabIndex = index == this.indexValue ? 0 : -1
|
31
27
|
})
|
32
28
|
|
33
|
-
this.tabTargets.forEach((
|
34
|
-
|
29
|
+
this.tabTargets.forEach((element, index) => {
|
30
|
+
element.hidden = index !== this.indexValue
|
35
31
|
})
|
36
|
-
}
|
37
|
-
|
38
|
-
#focusCurrentButton() {
|
39
|
-
this.buttonTargets[this.indexValue].focus()
|
40
|
-
}
|
41
32
|
|
42
|
-
|
43
|
-
|
33
|
+
if (shouldFocus) {
|
34
|
+
this.buttonTargets[this.indexValue].focus()
|
35
|
+
}
|
44
36
|
}
|
45
37
|
}
|