@justeattakeaway/pie-webc-core
Advanced tools
Comparing version 0.0.0-snapshot-release-20240405110454 to 0.0.0-snapshot-release-20240405114830
# Changelog | ||
## 0.0.0-snapshot-release-20240405110454 | ||
## 0.0.0-snapshot-release-20240405114830 | ||
@@ -5,0 +5,0 @@ ### Minor Changes |
@@ -1,5 +0,5 @@ | ||
import { isServer as l } from "lit"; | ||
const m = (t, e, n) => function(s, r) { | ||
const o = `#${r}`; | ||
Object.defineProperty(s, r, { | ||
import { isServer as c } from "lit"; | ||
const m = (t, e, n) => function(s, i) { | ||
const o = `#${i}`; | ||
Object.defineProperty(s, i, { | ||
get() { | ||
@@ -10,3 +10,3 @@ return this[o]; | ||
e.includes(a) ? this[o] = a : (console.error( | ||
`<${t}> Invalid value "${a}" provided for property "${r}".`, | ||
`<${t}> Invalid value "${a}" provided for property "${i}".`, | ||
`Must be one of: ${e.join(" | ")}.`, | ||
@@ -18,10 +18,10 @@ `Falling back to default value: "${n}"` | ||
}); | ||
}, f = (t) => function(n, i) { | ||
const s = `#${i}`; | ||
Object.defineProperty(n, i, { | ||
}, f = (t) => function(n, r) { | ||
const s = `#${r}`; | ||
Object.defineProperty(n, r, { | ||
get() { | ||
return this[s]; | ||
}, | ||
set(r) { | ||
(r == null || typeof r == "string" && r.trim() === "") && console.error(`<${t}> Missing required attribute "${i}"`), this[s] = r; | ||
set(i) { | ||
(i == null || typeof i == "string" && i.trim() === "") && console.error(`<${t}> Missing required attribute "${r}"`), this[s] = i; | ||
}, | ||
@@ -45,3 +45,3 @@ configurable: !0 | ||
e.startsWith("pie-") || console.warn("A custom event name should start with `pie-`"); | ||
const i = new CustomEvent(e, { | ||
const r = new CustomEvent(e, { | ||
bubbles: !0, | ||
@@ -51,3 +51,3 @@ composed: !0, | ||
}); | ||
t.dispatchEvent(i); | ||
t.dispatchEvent(r); | ||
} | ||
@@ -66,3 +66,3 @@ const b = (t) => { | ||
get isRTL() { | ||
return this.dir ? this.dir === "rtl" : !l && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1; | ||
return this.dir ? this.dir === "rtl" : !c && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1; | ||
} | ||
@@ -72,7 +72,6 @@ } | ||
}; | ||
function c(t, e) { | ||
const n = t.querySelectorAll("pie-input"), i = Array.from(n).find((s) => !s.validity.valid); | ||
i && (e.preventDefault(), setTimeout(() => { | ||
i.focus(); | ||
}, 0)); | ||
function l(t, e) { | ||
var s; | ||
const n = t.querySelectorAll("pie-input"), r = Array.from(n).find((i) => !i.validity.valid); | ||
r && (e.preventDefault(), (s = r.focusTarget) == null || s.focus()); | ||
} | ||
@@ -88,3 +87,3 @@ class d { | ||
const n = e.target; | ||
c(n, e); | ||
l(n, e); | ||
} | ||
@@ -97,7 +96,7 @@ /** | ||
return; | ||
const i = { | ||
const r = { | ||
listener: this.handleSubmit, | ||
form: e | ||
}; | ||
e.addEventListener("submit", i.listener), this._forms.set(e, i); | ||
e.addEventListener("submit", r.listener), this._forms.set(e, r); | ||
} | ||
@@ -124,4 +123,4 @@ /** | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
constructor(...i) { | ||
super(...i), this._internals = this.attachInternals(); | ||
constructor(...r) { | ||
super(...r), this._internals = this.attachInternals(); | ||
} | ||
@@ -132,4 +131,4 @@ get form() { | ||
connectedCallback() { | ||
var i; | ||
super.connectedCallback(), this.form && (window.pieFormManager || (window.pieFormManager = new d()), window.pieFormManager && (window.pieFormManager.addForm(this.form), this._managedForm = (i = window.pieFormManager.getForm(this.form)) == null ? void 0 : i.form)); | ||
var r; | ||
super.connectedCallback(), this.form && (window.pieFormManager || (window.pieFormManager = new d()), window.pieFormManager && (window.pieFormManager.addForm(this.form), this._managedForm = (r = window.pieFormManager.getForm(this.form)) == null ? void 0 : r.form)); | ||
} | ||
@@ -136,0 +135,0 @@ disconnectedCallback() { |
{ | ||
"name": "@justeattakeaway/pie-webc-core", | ||
"version": "0.0.0-snapshot-release-20240405110454", | ||
"version": "0.0.0-snapshot-release-20240405114830", | ||
"description": "PIE design system base classes, mixins and utilities for web components", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -8,3 +8,2 @@ import { PIEInputElement } from '../interfaces'; | ||
function focusFirstInvalidInput (form: HTMLFormElement, event: Event): void { | ||
// We can extend this to include more form control components as we create them. | ||
const allPieInputs = form.querySelectorAll('pie-input'); | ||
@@ -15,5 +14,3 @@ const firstInvalidInput = Array.from(allPieInputs).find((input) => !(input as ElementWithValidityState).validity.valid) as PIEInputElement | undefined; | ||
event.preventDefault(); | ||
setTimeout(() => { | ||
firstInvalidInput.focus(); | ||
}, 0); | ||
firstInvalidInput.focusTarget?.focus(); | ||
} | ||
@@ -20,0 +17,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62838
1274