@newlogic-digital/stimulus-components 0.0.9 → 0.0.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newlogic-digital/stimulus-components",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "eslint": "eslint '**/*.js'",
@@ -1,5 +1,5 @@
1
1
  import { Controller } from '@hotwired/stimulus'
2
- import { importScript } from "@newlogic-digital/utils-js";
2
+ import { dispatchCustomEvent, 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' }).then((token) => {
22
- this.element.gtoken.value = token
23
- this.element.dispatchEvent(new CustomEvent('submit', { cancelable: true, detail: { recaptchaExecuted: true } }))
24
- })
20
+ window.grecaptcha.enterprise.ready(async () => {
21
+ this.element.gtoken.value = await 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
  }
@@ -1,5 +1,5 @@
1
- import { Controller } from "@hotwired/stimulus";
2
- import { dataset } from "@newlogic-digital/utils-js";
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.controllerLazyParam) {
14
- dataset(entry.target, 'controller').add(entry.target.dataset.controllerLazyParam)
13
+ if (entry.target.dataset.lazyController) {
14
+ dataset(entry.target, 'controller').add(entry.target.dataset.lazyController)
15
15
  }
16
16
  }
17
17
  })