@justeattakeaway/pie-text-input 0.27.2 → 0.27.4
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/custom-elements.json +2 -1
- package/dist/index.js +37 -37
- package/dist/react.d.ts +1 -1
- package/package.json +1 -1
- package/src/defs-react.ts +2 -1
- package/src/index.ts +1 -1
- package/src/react.ts +1 -1
package/custom-elements.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as u, query as
|
|
3
|
-
import { ifDefined as
|
|
1
|
+
import { LitElement as ft, nothing as Nt, html as pt, unsafeCSS as Lt } from "lit";
|
|
2
|
+
import { property as u, query as ht } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
4
4
|
import { classMap as $t } from "lit/directives/class-map.js";
|
|
5
5
|
import { live as mt } from "lit/directives/live.js";
|
|
6
6
|
import { FormControlMixin as Ot, RtlMixin as Rt, wrapNativeEvent as Pt, validPropertyValues as Z, defineCustomElement as _t } from "@justeattakeaway/pie-webc-core";
|
|
7
7
|
import "@justeattakeaway/pie-assistive-text";
|
|
8
|
-
var Ht = Object.defineProperty, Dt = (v, l,
|
|
8
|
+
var Ht = Object.defineProperty, Dt = (v, l, f, x) => {
|
|
9
9
|
for (var s = void 0, g = v.length - 1, E; g >= 0; g--)
|
|
10
|
-
(E = v[g]) && (s = E(l,
|
|
11
|
-
return s && Ht(l,
|
|
10
|
+
(E = v[g]) && (s = E(l, f, s) || s);
|
|
11
|
+
return s && Ht(l, f, s), s;
|
|
12
12
|
};
|
|
13
|
-
class gt extends
|
|
13
|
+
class gt extends ft {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(...arguments), this.v = "0.27.
|
|
15
|
+
super(...arguments), this.v = "0.27.4";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
Dt([
|
|
@@ -28,7 +28,7 @@ const zt = "*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
|
|
|
28
28
|
};
|
|
29
29
|
(function() {
|
|
30
30
|
(function(v) {
|
|
31
|
-
const l = /* @__PURE__ */ new WeakMap(),
|
|
31
|
+
const l = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), C = {
|
|
32
32
|
ariaAtomic: "aria-atomic",
|
|
33
33
|
ariaAutoComplete: "aria-autocomplete",
|
|
34
34
|
ariaBusy: "aria-busy",
|
|
@@ -338,13 +338,13 @@ const zt = "*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
|
|
|
338
338
|
if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
|
|
339
339
|
throw new TypeError("Illegal constructor");
|
|
340
340
|
const a = t.getRootNode(), i = new Mt();
|
|
341
|
-
this.states = new J(t), l.set(this, t),
|
|
341
|
+
this.states = new J(t), l.set(this, t), f.set(this, i), s.set(t, this), B(t, this), bt(t, this), Object.seal(this), a instanceof DocumentFragment && yt(a);
|
|
342
342
|
}
|
|
343
343
|
checkValidity() {
|
|
344
344
|
const t = l.get(this);
|
|
345
345
|
if (M(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
346
346
|
return !0;
|
|
347
|
-
const a =
|
|
347
|
+
const a = f.get(this);
|
|
348
348
|
if (!a.valid) {
|
|
349
349
|
const i = new Event("invalid", {
|
|
350
350
|
bubbles: !1,
|
|
@@ -396,7 +396,7 @@ const zt = "*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
|
|
|
396
396
|
if (M(n, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
|
|
397
397
|
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
|
|
398
398
|
L.set(this, i);
|
|
399
|
-
const o =
|
|
399
|
+
const o = f.get(this), r = {};
|
|
400
400
|
for (const k in t)
|
|
401
401
|
r[k] = t[k];
|
|
402
402
|
Object.keys(r).length === 0 && kt(o);
|
|
@@ -417,7 +417,7 @@ const zt = "*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
|
|
|
417
417
|
}
|
|
418
418
|
get validity() {
|
|
419
419
|
const t = l.get(this);
|
|
420
|
-
return M(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),
|
|
420
|
+
return M(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), f.get(this);
|
|
421
421
|
}
|
|
422
422
|
get willValidate() {
|
|
423
423
|
const t = l.get(this);
|
|
@@ -495,18 +495,18 @@ const zt = "*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
|
|
|
495
495
|
return !!customElements.polyfillWrapFlushCallback || (Vt() ? typeof window < "u" && !window.CustomStateSet && Q(HTMLElement.prototype.attachInternals) : ut(!1)), v.forceCustomStateSetPolyfill = Q, v.forceElementInternalsPolyfill = ut, Object.defineProperty(v, "__esModule", { value: !0 }), v;
|
|
496
496
|
})({});
|
|
497
497
|
})();
|
|
498
|
-
var Ut = Object.defineProperty, d = (v, l,
|
|
498
|
+
var Ut = Object.defineProperty, d = (v, l, f, x) => {
|
|
499
499
|
for (var s = void 0, g = v.length - 1, E; g >= 0; g--)
|
|
500
|
-
(E = v[g]) && (s = E(l,
|
|
501
|
-
return s && Ut(l,
|
|
500
|
+
(E = v[g]) && (s = E(l, f, s) || s);
|
|
501
|
+
return s && Ut(l, f, s), s;
|
|
502
502
|
};
|
|
503
503
|
const q = "pie-text-input", Y = "assistive-text", W = class W extends Ot(Rt(gt)) {
|
|
504
504
|
constructor() {
|
|
505
505
|
super(...arguments), this.type = w.type, this.value = w.value, this.disabled = w.disabled, this.readonly = w.readonly, this.status = w.status, this.size = w.size, this.required = !1, this.handleInput = (l) => {
|
|
506
506
|
this.value = l.target.value, this._internals.setFormValue(this.value);
|
|
507
507
|
}, this.handleChange = (l) => {
|
|
508
|
-
const
|
|
509
|
-
this.dispatchEvent(
|
|
508
|
+
const f = Pt(l);
|
|
509
|
+
this.dispatchEvent(f);
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
@@ -541,7 +541,7 @@ const q = "pie-text-input", Y = "assistive-text", W = class W extends Ot(Rt(gt))
|
|
|
541
541
|
render() {
|
|
542
542
|
const {
|
|
543
543
|
assistiveText: l,
|
|
544
|
-
autocomplete:
|
|
544
|
+
autocomplete: f,
|
|
545
545
|
autoFocus: x,
|
|
546
546
|
disabled: s,
|
|
547
547
|
inputmode: g,
|
|
@@ -577,25 +577,25 @@ const q = "pie-text-input", Y = "assistive-text", W = class W extends Ot(Rt(gt))
|
|
|
577
577
|
<slot name="leadingIcon"></slot>
|
|
578
578
|
<slot name="leadingText"></slot>
|
|
579
579
|
<input
|
|
580
|
-
type=${
|
|
580
|
+
type=${h(C)}
|
|
581
581
|
.value=${mt(B)}
|
|
582
|
-
name=${
|
|
582
|
+
name=${h(S)}
|
|
583
583
|
?disabled=${mt(s)}
|
|
584
|
-
pattern=${
|
|
585
|
-
step=${
|
|
586
|
-
minlength=${
|
|
587
|
-
maxlength=${
|
|
588
|
-
min=${
|
|
589
|
-
max=${
|
|
590
|
-
autocomplete=${f
|
|
584
|
+
pattern=${h(N)}
|
|
585
|
+
step=${h(L)}
|
|
586
|
+
minlength=${h(F)}
|
|
587
|
+
maxlength=${h(E)}
|
|
588
|
+
min=${h(y)}
|
|
589
|
+
max=${h(V)}
|
|
590
|
+
autocomplete=${h(f)}
|
|
591
591
|
?autofocus=${x}
|
|
592
|
-
inputmode=${
|
|
593
|
-
placeholder=${
|
|
592
|
+
inputmode=${h(g)}
|
|
593
|
+
placeholder=${h($)}
|
|
594
594
|
?readonly=${T}
|
|
595
595
|
?required=${R}
|
|
596
|
-
aria-describedby=${
|
|
596
|
+
aria-describedby=${h(l ? Y : void 0)}
|
|
597
597
|
aria-invalid=${I === "error" ? "true" : "false"}
|
|
598
|
-
aria-errormessage="${
|
|
598
|
+
aria-errormessage="${h(I === "error" ? Y : void 0)}"
|
|
599
599
|
@input=${this.handleInput}
|
|
600
600
|
@change=${this.handleChange}
|
|
601
601
|
data-test-id="pie-text-input">
|
|
@@ -609,14 +609,14 @@ const q = "pie-text-input", Y = "assistive-text", W = class W extends Ot(Rt(gt))
|
|
|
609
609
|
${l ? pt`
|
|
610
610
|
<pie-assistive-text
|
|
611
611
|
id="${Y}"
|
|
612
|
-
variant=${
|
|
612
|
+
variant=${h(I)}
|
|
613
613
|
data-test-id="pie-text-input-assistive-text">
|
|
614
614
|
${l}
|
|
615
615
|
</pie-assistive-text>
|
|
616
616
|
` : Nt}`;
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
W.shadowRootOptions = { ...
|
|
619
|
+
W.shadowRootOptions = { ...ft.shadowRootOptions, delegatesFocus: !0 }, W.styles = Lt(zt);
|
|
620
620
|
let c = W;
|
|
621
621
|
d([
|
|
622
622
|
u({ type: String, reflect: !0 }),
|
|
@@ -626,7 +626,7 @@ d([
|
|
|
626
626
|
u({ type: String })
|
|
627
627
|
], c.prototype, "value");
|
|
628
628
|
d([
|
|
629
|
-
u({ type: String })
|
|
629
|
+
u({ type: String, reflect: !0 })
|
|
630
630
|
], c.prototype, "name");
|
|
631
631
|
d([
|
|
632
632
|
u({ type: Boolean, reflect: !0 })
|
|
@@ -682,10 +682,10 @@ d([
|
|
|
682
682
|
u({ type: Boolean })
|
|
683
683
|
], c.prototype, "required");
|
|
684
684
|
d([
|
|
685
|
-
|
|
685
|
+
ht("input")
|
|
686
686
|
], c.prototype, "input");
|
|
687
687
|
d([
|
|
688
|
-
|
|
688
|
+
ht("input")
|
|
689
689
|
], c.prototype, "focusTarget");
|
|
690
690
|
_t(q, c);
|
|
691
691
|
export {
|
package/dist/react.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ declare type PieTextInputEvents = {
|
|
|
100
100
|
onChange?: (event: CustomEvent) => void;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
declare type ReactBaseType = React_2.InputHTMLAttributes<HTMLInputElement>;
|
|
103
|
+
declare type ReactBaseType = Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onInput' | 'size'>;
|
|
104
104
|
|
|
105
105
|
export declare const sizes: readonly ["small", "medium", "large"];
|
|
106
106
|
|
package/package.json
CHANGED
package/src/defs-react.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Omit `size` and event types to avoid conflicting with PieTextInput's type definition
|
|
4
|
+
export type ReactBaseType = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onInput' | 'size'>
|
package/src/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ export class PieTextInput extends FormControlMixin(RtlMixin(PieElement)) impleme
|
|
|
44
44
|
@property({ type: String })
|
|
45
45
|
public value = defaultProps.value;
|
|
46
46
|
|
|
47
|
-
@property({ type: String })
|
|
47
|
+
@property({ type: String, reflect: true })
|
|
48
48
|
public name: TextInputProps['name'];
|
|
49
49
|
|
|
50
50
|
@property({ type: Boolean, reflect: true })
|
package/src/react.ts
CHANGED
|
@@ -16,7 +16,7 @@ const PieTextInputReact = createComponent({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
type ReactBaseType = React.InputHTMLAttributes<HTMLInputElement>
|
|
19
|
+
type ReactBaseType = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onInput' | 'size'>
|
|
20
20
|
|
|
21
21
|
type PieTextInputEvents = {
|
|
22
22
|
onInput?: (event: InputEvent) => void;
|