@newlogic-digital/stimulus-components 0.0.9 → 0.0.10
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.
- package/package.json +1 -1
- package/src/recaptcha/index.js +4 -6
- package/src/reveal/index.js +5 -5
package/package.json
CHANGED
package/src/recaptcha/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Controller } from '@hotwired/stimulus'
|
|
2
|
-
import { importScript } from
|
|
2
|
+
import { importScript } from '@newlogic-digital/utils-js'
|
|
3
3
|
|
|
4
4
|
export class ReCaptcha extends Controller {
|
|
5
5
|
static values = {
|
|
@@ -17,11 +17,9 @@ export class ReCaptcha extends Controller {
|
|
|
17
17
|
execute(event) {
|
|
18
18
|
if (event?.detail?.recaptchaExecuted) return
|
|
19
19
|
|
|
20
|
-
window.grecaptcha.enterprise.ready(() => {
|
|
21
|
-
window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' })
|
|
22
|
-
|
|
23
|
-
this.element.dispatchEvent(new CustomEvent('submit', { cancelable: true, detail: { recaptchaExecuted: true } }))
|
|
24
|
-
})
|
|
20
|
+
window.grecaptcha.enterprise.ready(async () => {
|
|
21
|
+
this.element.gtoken.value = window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' })
|
|
22
|
+
this.element.dispatchEvent(new CustomEvent('submit', { cancelable: true, detail: { recaptchaExecuted: true } }))
|
|
25
23
|
})
|
|
26
24
|
}
|
|
27
25
|
}
|
package/src/reveal/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Controller } from
|
|
2
|
-
import { dataset } from
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
|
2
|
+
import { dataset } from '@newlogic-digital/utils-js'
|
|
3
3
|
|
|
4
4
|
export class Reveal extends Controller {
|
|
5
5
|
static targets = ['item']
|
|
@@ -8,10 +8,10 @@ export class Reveal extends Controller {
|
|
|
8
8
|
this.observer = new IntersectionObserver((entries) => {
|
|
9
9
|
entries.forEach((entry) => {
|
|
10
10
|
if (entry.intersectionRatio > 0.1 && !entry.target.hasAttribute('data-in')) {
|
|
11
|
-
entry.target.setAttribute('data-in','')
|
|
11
|
+
entry.target.setAttribute('data-in', '')
|
|
12
12
|
|
|
13
|
-
if (entry.target.dataset.
|
|
14
|
-
dataset(entry.target, 'controller').add(entry.target.dataset.
|
|
13
|
+
if (entry.target.dataset.lazyController) {
|
|
14
|
+
dataset(entry.target, 'controller').add(entry.target.dataset.lazyController)
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
})
|