css-zero 4.2.2 → 4.2.3

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: 14a22c54b379b8a90a4144a252413a0cc388b140781ffdbe98101f00aa9f4ff3
4
- data.tar.gz: 04061c71ca6daef8635b92d8691508c5726e7b6e20f9aba4c8c9f9994d73c20a
3
+ metadata.gz: 4f9bdbed4f12a30f34164d4ce75833c380b42a75e70a5f999206fbfb0068d7a3
4
+ data.tar.gz: 2488b61d43b1c9595d5adcd2bb531715b16a2fa2a56c43ab9f3736b400a6e85c
5
5
  SHA512:
6
- metadata.gz: 538545d4c41977daedaf54485fc5e796b42621484e8017c27cf768ca9ec58f1ab0e52fe2155e5cd24ace58fe957737c344b1d776f975a0ae3d22abb22e8e06f4
7
- data.tar.gz: 209ec906573f718d1d621fed9d7099d7938e69079e0cd3ee6765018b0a06043b1e3b14d53cc9233aba62b9fc6f23e704a491809cd5e0bce9f2681627103a1e75
6
+ metadata.gz: 5d7371f499c12dda9f40d8c58bfbc30a91f60ed4463d938589134954c167d833505fcdafafa20fab300cc963f312c9419f0c5f60b47ad68a59a0fac151dc59f9
7
+ data.tar.gz: 56a0fa99d397354945887680cd2de0aa18c9d84122af17f47c694c25828d47ed7d026853119165d93c1e4b6e5b1ac69a3214a0823335701930f0de6fac09cc19
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 4.2.3 - 2026-09-07
2
+ - Prevent month header from wrapping in datepicker
3
+ - Refactor autosave
4
+ - Rebuild menu on top of roving-ux
5
+
1
6
  ## 4.2.2 - 2026-08-29
2
7
  - Use position-try shorthand in popover
3
8
  - Adjust dialog transition durations
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "4.2.2"
2
+ VERSION = "4.2.3"
3
3
  end
@@ -40,6 +40,11 @@
40
40
  color: var(--color-text);
41
41
  }
42
42
 
43
+ .flatpickr-current-month {
44
+ inline-size: 85%;
45
+ padding-block-start: 6.48px;
46
+ }
47
+
43
48
  span.cur-month {
44
49
  font-size: var(--text-sm);
45
50
  font-weight: var(--font-medium);
@@ -16,15 +16,9 @@ export default class extends Controller {
16
16
  !this.#dirty && this.#scheduleSave()
17
17
  }
18
18
 
19
- async #save() {
19
+ #save() {
20
20
  this.#resetTimer()
21
- this.#toggleSaving(true)
22
- await this.#submitForm(this.element)
23
- this.#toggleSaving(false)
24
- }
25
-
26
- async #submitForm(form) {
27
- return await new FetchRequest(form.method, form.action, { body: new FormData(form) }).perform()
21
+ this.#submit()
28
22
  }
29
23
 
30
24
  #scheduleSave() {
@@ -36,11 +30,33 @@ export default class extends Controller {
36
30
  this.#timer = null
37
31
  }
38
32
 
33
+ async #submit() {
34
+ this.#toggleSaving(true)
35
+ await this.#performRequest()
36
+ this.#toggleSaving(false)
37
+ }
38
+
39
39
  #toggleSaving(saving) {
40
40
  this.element.ariaBusy = saving
41
41
  this.submitTarget.disabled = saving
42
42
  }
43
43
 
44
+ #performRequest() {
45
+ return new FetchRequest(this.#method, this.#action, { body: this.#body }).perform()
46
+ }
47
+
48
+ get #method() {
49
+ return this.element.method
50
+ }
51
+
52
+ get #action() {
53
+ return this.element.action
54
+ }
55
+
56
+ get #body() {
57
+ return new FormData(this.element)
58
+ }
59
+
44
60
  get #dirty() {
45
61
  return !!this.#timer
46
62
  }
@@ -1,8 +1,8 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
+ import { rovingIndex } from "https://esm.sh/roving-ux@1.0.5?standalone"
2
3
 
3
4
  export default class extends Controller {
4
5
  static targets = [ "item" ]
5
- static values = { index: Number }
6
6
 
7
7
  #observer
8
8
 
@@ -18,85 +18,20 @@ export default class extends Controller {
18
18
  this.#observer.disconnect()
19
19
  }
20
20
 
21
- navigate(event) {
22
- switch (event.key) {
23
- case " ":
24
- case "Enter":
25
- this.#cancel(event)
26
- this.#activate(event.target)
27
- break
28
- case "ArrowUp":
29
- this.#cancel(event)
30
- this.#prev()
31
- break
32
- case "ArrowDown":
33
- this.#cancel(event)
34
- this.#next()
35
- break
36
- case "Home":
37
- this.#cancel(event)
38
- this.#first()
39
- break
40
- case "End":
41
- this.#cancel(event)
42
- this.#last()
43
- break
44
- }
45
- }
46
-
47
- #cancel(event) {
48
- event.stopPropagation()
49
- event.preventDefault()
50
- }
51
-
52
- #activate(menuItem) {
53
- menuItem.click()
54
- }
55
-
56
21
  #reset([ entry ]) {
57
- entry.isIntersecting && this.#first()
58
- }
59
-
60
- #prev() {
61
- if (this.indexValue > 0) {
62
- this.indexValue--
63
- this.#update()
64
- }
65
- }
66
-
67
- #next() {
68
- if (this.indexValue < this.#lastIndex) {
69
- this.indexValue++
70
- this.#update()
71
- }
72
- }
73
-
74
- #first() {
75
- this.indexValue = 0
76
- this.#update()
77
- }
78
-
79
- #last() {
80
- this.indexValue = this.#lastIndex
81
- this.#update()
82
- }
83
-
84
- #update() {
85
- this.#updateTabstops()
86
- this.#focusItemAtIndex()
22
+ entry.isIntersecting && this.#start()
87
23
  }
88
24
 
89
- #updateTabstops() {
90
- this.itemTargets.forEach((it, index) => {
91
- it.tabIndex = index === this.indexValue ? 0 : -1
92
- })
25
+ #start() {
26
+ this.#rovingIndex()
27
+ this.#focus()
93
28
  }
94
29
 
95
- #focusItemAtIndex() {
96
- this.itemTargets[this.indexValue].focus()
30
+ #rovingIndex() {
31
+ rovingIndex({ element: this.element, target: "[data-menu-target='item']" })
97
32
  }
98
33
 
99
- get #lastIndex() {
100
- return this.itemTargets.length -1
34
+ #focus() {
35
+ this.itemTargets[0].focus()
101
36
  }
102
37
  }
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: 4.2.2
4
+ version: 4.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lázaro Nixon