css-zero 1.1.14 → 1.1.15

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: 1d12ea13a67b496f1781d2b19b1f7cdbe3571247ccfba8058e6f86224a78ca96
4
- data.tar.gz: 1205cd68c1a55d97f7f145d035176c0fe554f60191c7bdef3e6f1d14e62315ed
3
+ metadata.gz: 85f26c4b3878c23f7eb9a1193171f01715e429bb76f7a718692d5ee8d1e15ce9
4
+ data.tar.gz: 7e0bdca2427cddb32a1e3155a4bc545d8c52bd0a9e8e3ba84a255cc67f12cf3a
5
5
  SHA512:
6
- metadata.gz: 2e4be07882ae3121a041a18de96ddb6b9c9210b0e999b63271ac58645f1b7ae959cbc9b69aa38dd6fe15580899fed6949f80424b45026fb1d791efe1a2a09d07
7
- data.tar.gz: 6ea61906b720da2f4a391768eca9844113f4f8ab7891917d71a0f473d7439ff0a3a79696752342030229e953424fbb88f1c7e952a6dff229de72baaf1d586785
6
+ metadata.gz: a5ef9408445e3468b1606dd809161e78874fee85209fd50682c8499469d0dea67322d9c751a751723921ed33c9211fa7e8d022a5003f20bf37d9445580b63020
7
+ data.tar.gz: 2f1f8f0cdd19b09f4e626b1a762a6c95f43b431fdcdb33068c382ce90fb6c59881cd78d0ea99ae6e665ca679864a76835fdfb57e41206b0a7f0eac7c822da4d6
@@ -1,3 +1,3 @@
1
1
  module CssZero
2
- VERSION = "1.1.14"
2
+ VERSION = "1.1.15"
3
3
  end
@@ -33,7 +33,7 @@
33
33
  outline: var(--btn-outline-size, 2px) solid var(--color-selected-dark);
34
34
  }
35
35
 
36
- &:is(:disabled, [aria-disabled]) {
36
+ &:is(:disabled, [aria-disabled=true]) {
37
37
  opacity: var(--opacity-50);
38
38
  pointer-events: none;
39
39
  }
@@ -82,7 +82,7 @@
82
82
  --btn-padding: var(--size-2);
83
83
  }
84
84
 
85
- [aria-busy] .btn--loading:disabled {
85
+ [aria-busy=true] .btn--loading:disabled {
86
86
  > * {
87
87
  visibility: hidden;
88
88
  }
@@ -6,11 +6,11 @@
6
6
  padding: var(--size-6);
7
7
  position: relative;
8
8
 
9
- &[aria-disabled] {
9
+ &[aria-disabled=true] {
10
10
  pointer-events: none;
11
11
  }
12
12
 
13
- &[aria-disabled]::after {
13
+ &[aria-disabled=true]::after {
14
14
  background-color: rgba(0, 0, 0, .3);
15
15
  border-radius: inherit;
16
16
  content: "";
@@ -14,7 +14,7 @@ export default class extends Controller {
14
14
 
15
15
  change() {
16
16
  !this.#dirty && this.#scheduleSave()
17
- !this.#dirty && this.#updateAppearance()
17
+ !this.#dirty && this.#updateAppearance(false)
18
18
  }
19
19
 
20
20
  async #submit() {
@@ -25,7 +25,7 @@ export default class extends Controller {
25
25
  this.#updateAppearance(true)
26
26
  this.#resetTimer()
27
27
  await this.#submitForm(this.element)
28
- this.#updateAppearance()
28
+ this.#updateAppearance(false)
29
29
  }
30
30
 
31
31
  async #submitForm(form) {
@@ -33,16 +33,10 @@ export default class extends Controller {
33
33
  return await request.perform()
34
34
  }
35
35
 
36
- #updateAppearance(saving = false) {
37
- if (saving) {
38
- this.element.setAttribute("aria-busy", true)
39
- this.submitterTarget.setAttribute("aria-disabled", true)
40
- this.submitterTarget.disabled = true
41
- } else {
42
- this.element.removeAttribute("aria-busy")
43
- this.submitterTarget.removeAttribute("aria-disabled")
44
- this.submitterTarget.disabled = false
45
- }
36
+ #updateAppearance(saving) {
37
+ this.element.ariaBusy = saving
38
+ this.submitterTarget.ariaDisabled = saving
39
+ this.submitterTarget.disabled = saving
46
40
  }
47
41
 
48
42
  #scheduleSave() {
@@ -1,19 +1,14 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import debounce from "https://esm.sh/just-debounce-it@3.2.0?standalone"
3
2
 
4
3
  export default class extends Controller {
5
4
  static targets = [ "cancel" ]
6
5
 
7
- initialize() {
8
- this.search = debounce(this.search.bind(this), 500)
9
- }
10
-
11
6
  submit({ params }) {
12
- params.submitter ? this.#click(params.submitter) : this.element.requestSubmit()
13
- }
14
-
15
- search({ params }) {
16
- params.submitter ? this.#click(params.submitter) : this.element.requestSubmit()
7
+ if (params.submitter) {
8
+ this.element.requestSubmit(this.#get(params.submitter))
9
+ } else {
10
+ this.element.requestSubmit()
11
+ }
17
12
  }
18
13
 
19
14
  cancel() {
@@ -24,7 +19,11 @@ export default class extends Controller {
24
19
  event.preventDefault()
25
20
  }
26
21
 
27
- #click(selectors) {
28
- this.element.querySelector(selectors).click()
22
+ #get(id) {
23
+ return document.getElementById(id) || this.#notFound(id)
24
+ }
25
+
26
+ #notFound(id) {
27
+ throw new Error(`Element with ID "${id}" not found in the DOM`)
29
28
  }
30
29
  }
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: 1.1.14
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lázaro Nixon