css-zero 0.0.82 → 0.0.83
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 +4 -4
- data/lib/css_zero/version.rb +1 -1
- data/lib/generators/css_zero/add/resources.yml +1 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/listbox_controller.js +22 -0
- metadata +3 -3
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/list_controller.js +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c3c38650e2b111579da72c2349589c5ae2bd114223701b7dd6dc2459136b35
|
4
|
+
data.tar.gz: 19401b13fa751a752893c70e9d9b84d641984a510fd66e246e188054360edbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d67f8fb7778c60e40e7bfcedd7524b6296091777561e48c60c267d1c4bef5969f124c8b80ccd37a1f28f2da8d7e9988e8d9d3b90fbc67e9d4e70c904aabf4c51
|
7
|
+
data.tar.gz: 52d1ebd7224d43b4a4d67cd9b473fbbd60f849cfe02f56b8abecd3cdb8c02f460d6f8795411a7a22fd08234e0f0958e8de7bd263ca5059bb09809d9c623bf877
|
data/lib/css_zero/version.rb
CHANGED
@@ -36,7 +36,7 @@ combobox:
|
|
36
36
|
command:
|
37
37
|
- app/assets/stylesheets/command.css
|
38
38
|
- app/javascript/controllers/filter_controller.js
|
39
|
-
- app/javascript/controllers/
|
39
|
+
- app/javascript/controllers/listbox_controller.js
|
40
40
|
- app/assets/images/search.svg
|
41
41
|
collapsible:
|
42
42
|
- app/javascript/controllers/collapsible_controller.js
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
import Listbox from "https://cdn.skypack.dev/@github/combobox-nav@3.0.1?min"
|
3
|
+
|
4
|
+
export default class extends Controller {
|
5
|
+
static targets = [ "input", "list" ]
|
6
|
+
|
7
|
+
connect() {
|
8
|
+
this.listbox = new Listbox(this.inputTarget, this.listTarget)
|
9
|
+
}
|
10
|
+
|
11
|
+
disconnect() {
|
12
|
+
this.listbox.destroy()
|
13
|
+
}
|
14
|
+
|
15
|
+
start() {
|
16
|
+
this.listbox.start()
|
17
|
+
}
|
18
|
+
|
19
|
+
stop() {
|
20
|
+
this.listbox.stop()
|
21
|
+
}
|
22
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lázaro Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: lazaronixon@hotmail.com
|
@@ -105,7 +105,7 @@ files:
|
|
105
105
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
|
106
106
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/inputmask_controller.js
|
107
107
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
|
108
|
-
- lib/generators/css_zero/add/templates/app/javascript/controllers/
|
108
|
+
- lib/generators/css_zero/add/templates/app/javascript/controllers/listbox_controller.js
|
109
109
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
|
110
110
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js
|
111
111
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/navigation_controller.js
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
2
|
-
|
3
|
-
export default class extends Controller {
|
4
|
-
static targets = [ "option" ]
|
5
|
-
static values = { index: Number }
|
6
|
-
|
7
|
-
connect() {
|
8
|
-
this.#removeTabstops()
|
9
|
-
this.#selectFirstOption()
|
10
|
-
}
|
11
|
-
|
12
|
-
reset() {
|
13
|
-
this.indexValue = 0
|
14
|
-
this.#selectCurrentOption()
|
15
|
-
}
|
16
|
-
|
17
|
-
navigate(event) {
|
18
|
-
switch (event.key) {
|
19
|
-
case "ArrowUp":
|
20
|
-
event.preventDefault()
|
21
|
-
this.#prev()
|
22
|
-
break
|
23
|
-
case "ArrowDown":
|
24
|
-
event.preventDefault()
|
25
|
-
this.#next()
|
26
|
-
break
|
27
|
-
case "Enter":
|
28
|
-
event.preventDefault()
|
29
|
-
this.#clickSelected()
|
30
|
-
break
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
#prev() {
|
35
|
-
if (this.indexValue > 0) {
|
36
|
-
this.indexValue--
|
37
|
-
this.#selectCurrentOption()
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
#next() {
|
42
|
-
if (this.indexValue < this.#lastIndex) {
|
43
|
-
this.indexValue++
|
44
|
-
this.#selectCurrentOption()
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
#clickSelected() {
|
49
|
-
this.#visibleOptions[this.indexValue]?.click()
|
50
|
-
}
|
51
|
-
|
52
|
-
#removeTabstops() {
|
53
|
-
this.optionTargets.forEach(e => e.tabIndex = -1)
|
54
|
-
}
|
55
|
-
|
56
|
-
#selectFirstOption() {
|
57
|
-
this.optionTargets.forEach((element, index) => {
|
58
|
-
element.ariaSelected = index === 0
|
59
|
-
})
|
60
|
-
}
|
61
|
-
|
62
|
-
#selectCurrentOption() {
|
63
|
-
this.optionTargets.forEach((element, index) => {
|
64
|
-
element.ariaSelected = false
|
65
|
-
})
|
66
|
-
|
67
|
-
this.#visibleOptions.forEach((element, index) => {
|
68
|
-
element.ariaSelected = index === this.indexValue
|
69
|
-
})
|
70
|
-
}
|
71
|
-
|
72
|
-
get #visibleOptions() {
|
73
|
-
return this.optionTargets.filter(e => e.offsetParent != null)
|
74
|
-
}
|
75
|
-
|
76
|
-
get #lastIndex() {
|
77
|
-
return this.#visibleOptions.length -1
|
78
|
-
}
|
79
|
-
}
|