@justeattakeaway/pie-text-input 0.21.0 → 0.22.1

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/README.md CHANGED
@@ -140,8 +140,10 @@ In your markup or JSX, you can then use these to set the properties for the `pie
140
140
  ## Slots
141
141
  | Slot | Description |
142
142
  |------|-------------|
143
- | `leading` | An icon or short text to display at the start of the input. |
144
- | `trailing` | An icon or short text to display at the end of the input. |
143
+ | `leadingText` | Short text to display at the start of the input. Wrap the text in a `<span>`. Do not use with `leadingIcon` at the same time. |
144
+ | `leadingIcon` | An icon to display at the start of the input. Do not use with `leadingText` at the same time. |
145
+ | `trailingText` | Short text to display at the end of the input. Wrap the text in a `<span>`. Do not use with `trailingIcon` at the same time. |
146
+ | `trailingIcon` | An icon to display at the end of the input. Do not use with `trailingText` at the same time. |
145
147
 
146
148
  ## Contributing
147
149
 
@@ -107,12 +107,20 @@
107
107
  "name": "PieTextInput",
108
108
  "slots": [
109
109
  {
110
- "description": "An icon or short text to display at the start of the input.",
111
- "name": "leading"
110
+ "description": "Short text to display at the start of the input. Wrap the text in a <span>. Do not use with leadingIcon at the same time.",
111
+ "name": "leadingText"
112
112
  },
113
113
  {
114
- "description": "An icon or short text to display at the end of the input.",
115
- "name": "trailing"
114
+ "description": "An icon to display at the start of the input. Do not use with leadingText at the same time.",
115
+ "name": "leadingIcon"
116
+ },
117
+ {
118
+ "description": "Short text to display at the end of the input. Wrap the text in a <span>. Do not use with trailingIcon at the same time.",
119
+ "name": "trailingText"
120
+ },
121
+ {
122
+ "description": "An icon to display at the end of the input. Do not use with trailingText at the same time.",
123
+ "name": "trailingIcon"
116
124
  }
117
125
  ],
118
126
  "members": [
package/dist/index.d.ts CHANGED
@@ -24,8 +24,10 @@ export declare const inputModes: readonly ["none", "text", "tel", "url", "email"
24
24
  * @tagname pie-text-input
25
25
  * @event {InputEvent} input - when the input value is changed.
26
26
  * @event {CustomEvent} change - when the input value is changed.
27
- * @slot leading - An icon or short text to display at the start of the input.
28
- * @slot trailing - An icon or short text to display at the end of the input.
27
+ * @slot leadingText - Short text to display at the start of the input. Wrap the text in a <span>. Do not use with leadingIcon at the same time.
28
+ * @slot leadingIcon - An icon to display at the start of the input. Do not use with leadingText at the same time.
29
+ * @slot trailingText - Short text to display at the end of the input. Wrap the text in a <span>. Do not use with trailingIcon at the same time.
30
+ * @slot trailingIcon - An icon to display at the end of the input. Do not use with trailingText at the same time.
29
31
  */
30
32
  export declare class PieTextInput extends PieTextInput_base implements TextInputProps, PIEInputElement {
31
33
  static shadowRootOptions: {
package/dist/index.js CHANGED
@@ -2,17 +2,17 @@ import { LitElement as pt, html as ut, nothing as At, unsafeCSS as Vt } from "li
2
2
  import { property as u, query as mt } from "lit/decorators.js";
3
3
  import { ifDefined as m } from "lit/directives/if-defined.js";
4
4
  import { live as J } from "lit/directives/live.js";
5
- import { FormControlMixin as Nt, RtlMixin as $t, wrapNativeEvent as Lt, validPropertyValues as ft, defineCustomElement as Ot } from "@justeattakeaway/pie-webc-core";
5
+ import { FormControlMixin as Nt, RtlMixin as Lt, wrapNativeEvent as $t, validPropertyValues as ht, defineCustomElement as Ot } from "@justeattakeaway/pie-webc-core";
6
6
  import "@justeattakeaway/pie-assistive-text";
7
- const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-block: var(--dt-spacing-c);--input-padding-inline: var(--dt-spacing-d);--input-gap: var(--dt-spacing-d);--input-text-color: var(--dt-color-content-default);--input-text-color-leading-trailing-content: var(--dt-color-content-default);--input-text-color-placeholder: var(--dt-color-content-subdued);--input-border-color: var(--dt-color-interactive-form);--input-container-color: var(--dt-color-container-default);--input-radius: var(--dt-radius-rounded-c);--input-font-size: var(--dt-font-body-l-size);--input-height: 48px;--input-cursor: text;--icon-display-override: block;--icon-size-override: 24px;height:var(--input-height);border:1px solid var(--input-border-color);border-radius:var(--input-radius);padding-inline-start:var(--input-padding-inline);padding-inline-end:var(--input-padding-inline);padding-block-start:var(--input-padding-block);padding-block-end:var(--input-padding-block);line-height:24px;font-size:var(--input-font-size);display:flex;flex-wrap:nowrap;align-items:center;background-color:var(--input-container-color);color:var(--input-text-color-leading-trailing-content);cursor:var(--input-cursor)}.c-textInput[data-pie-size=large]{--input-padding-block: var(--dt-spacing-d);--input-height: 56px}.c-textInput[data-pie-size=small]{--input-padding-block: var(--dt-spacing-b);--input-height: 40px}.c-textInput[data-pie-status=error]{--input-border-color: var(--dt-color-support-error)}.c-textInput ::slotted([slot=leading]){margin-inline-end:var(--input-gap)}.c-textInput ::slotted([slot=trailing]){margin-inline-start:var(--input-gap)}@supports (gap: var(--input-gap)){.c-textInput{gap:var(--input-gap)}.c-textInput ::slotted([slot=leading]){margin-inline-end:0}.c-textInput ::slotted([slot=trailing]){margin-inline-start:0}}@media (hover: hover){.c-textInput:hover{--input-container-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}}.c-textInput[data-pie-readonly]{--input-container-color: var(--dt-color-disabled-01);--input-border-color: var(--dt-color-border-inverse)}.c-textInput[data-pie-disabled][data-pie-readonly],.c-textInput[data-pie-disabled]{--input-container-color: var(--dt-color-disabled-01);--input-border-color: var(--dt-color-disabled-01);--input-text-color: var(--dt-color-content-disabled);--input-text-color-placeholder: var(--dt-color-content-disabled);--input-text-color-leading-trailing-content: var(--dt-color-content-disabled);--input-cursor: auto}.c-textInput:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}input{border:0;outline:0;height:24px;padding:0;color:var(--input-text-color);width:100%;font-size:var(--input-font-size);font-family:inherit;background:none;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none}input::placeholder{color:var(--input-text-color-placeholder)}input:disabled{-webkit-text-fill-color:var(--input-text-color);color:var(--input-text-color);-webkit-opacity:1;opacity:1}input[type=number]:not([step])::-webkit-inner-spin-button,input[type=number]:not([step])::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]:not([step]){-moz-appearance:textfield}
7
+ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-block: var(--dt-spacing-c);--input-padding-inline: var(--dt-spacing-d);--input-gap: var(--dt-spacing-d);--input-text-color: var(--dt-color-content-default);--input-text-color-leading-trailing-content: var(--dt-color-content-default);--input-text-color-placeholder: var(--dt-color-content-subdued);--input-border-color: var(--dt-color-interactive-form);--input-container-color: var(--dt-color-container-default);--input-radius: var(--dt-radius-rounded-c);--input-font-size: var(--dt-font-body-l-size);--input-height: 48px;--input-cursor: text;--icon-display-override: block;--icon-size-override: 24px;height:var(--input-height);border:1px solid var(--input-border-color);border-radius:var(--input-radius);padding-inline-start:var(--input-padding-inline);padding-inline-end:var(--input-padding-inline);padding-block-start:var(--input-padding-block);padding-block-end:var(--input-padding-block);line-height:24px;font-size:var(--input-font-size);display:flex;flex-wrap:nowrap;align-items:center;background-color:var(--input-container-color);color:var(--input-text-color-leading-trailing-content);cursor:var(--input-cursor)}.c-textInput[data-pie-size=large]{--input-padding-block: var(--dt-spacing-d);--input-height: 56px}.c-textInput[data-pie-size=small]{--input-padding-block: var(--dt-spacing-b);--input-height: 40px}.c-textInput[data-pie-status=error]{--input-border-color: var(--dt-color-support-error)}.c-textInput ::slotted([slot=leadingText]),.c-textInput ::slotted([slot=leadingIcon]){margin-inline-end:var(--input-gap)}.c-textInput ::slotted([slot=trailingText]),.c-textInput ::slotted([slot=trailingIcon]){margin-inline-start:var(--input-gap)}@supports (gap: var(--input-gap)){.c-textInput{gap:var(--input-gap)}.c-textInput ::slotted([slot=leadingText]),.c-textInput ::slotted([slot=leadingIcon]){margin-inline-end:0}.c-textInput ::slotted([slot=trailingText]),.c-textInput ::slotted([slot=trailingIcon]){margin-inline-start:0}}.c-textInput:not([data-pie-disabled]) ::slotted([slot=leadingIcon]),.c-textInput:not([data-pie-disabled]) ::slotted([slot=trailingIcon]){color:var(--dt-color-content-subdued)}@media (hover: hover){.c-textInput:hover{--input-container-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}}.c-textInput[data-pie-readonly]{--input-container-color: var(--dt-color-disabled-01);--input-border-color: var(--dt-color-interactive-form)}.c-textInput[data-pie-disabled][data-pie-readonly],.c-textInput[data-pie-disabled]{--input-container-color: var(--dt-color-disabled-01);--input-border-color: var(--dt-color-disabled-01);--input-text-color: var(--dt-color-content-disabled);--input-text-color-placeholder: var(--dt-color-content-disabled);--input-text-color-leading-trailing-content: var(--dt-color-content-disabled);--input-cursor: auto}.c-textInput:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}input{border:0;outline:0;height:24px;padding:0;color:var(--input-text-color);width:100%;font-size:var(--input-font-size);font-family:inherit;background:none;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none}input::placeholder{color:var(--input-text-color-placeholder)}input:disabled{-webkit-text-fill-color:var(--input-text-color);color:var(--input-text-color);-webkit-opacity:1;opacity:1}input[type=number]:not([step])::-webkit-inner-spin-button,input[type=number]:not([step])::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]:not([step]){-moz-appearance:textfield}
8
8
  `, Rt = ["text", "number", "password", "url", "email", "tel"], Gt = ["none", "text", "tel", "url", "email", "numeric", "decimal", "search"], _t = ["success", "error"], Jt = ["small", "medium", "large"], A = {
9
9
  type: "text",
10
10
  value: "",
11
11
  size: "medium"
12
12
  };
13
13
  (function() {
14
- (function(x) {
15
- const s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), C = {
14
+ (function(E) {
15
+ const s = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), k = {
16
16
  ariaAtomic: "aria-atomic",
17
17
  ariaAutoComplete: "aria-autocomplete",
18
18
  ariaBusy: "aria-busy",
@@ -56,16 +56,16 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
56
56
  ariaValueText: "aria-valuetext",
57
57
  role: "role"
58
58
  }, H = (e, t) => {
59
- for (let a in C) {
59
+ for (let a in k) {
60
60
  t[a] = null;
61
61
  let i = null;
62
- const r = C[a];
62
+ const o = k[a];
63
63
  Object.defineProperty(t, a, {
64
64
  get() {
65
65
  return i;
66
66
  },
67
67
  set(n) {
68
- i = n, e.isConnected ? e.setAttribute(r, n) : k.set(e, t);
68
+ i = n, e.isConnected ? e.setAttribute(o, n) : T.set(e, t);
69
69
  }
70
70
  });
71
71
  }
@@ -81,63 +81,63 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
81
81
  }
82
82
  });
83
83
  let i = a.nextNode();
84
- const r = !t || e.disabled;
84
+ const o = !t || e.disabled;
85
85
  for (; i; )
86
- i.formDisabledCallback && r && B(i, e.disabled), i = a.nextNode();
86
+ i.formDisabledCallback && o && B(i, e.disabled), i = a.nextNode();
87
87
  }, Y = { attributes: !0, attributeFilter: ["disabled", "name"] }, R = z() ? new MutationObserver((e) => {
88
88
  for (const t of e) {
89
89
  const a = t.target;
90
90
  if (t.attributeName === "disabled" && (a.constructor.formAssociated ? B(a, a.hasAttribute("disabled")) : a.localName === "fieldset" && P(a)), t.attributeName === "name" && a.constructor.formAssociated) {
91
- const i = c.get(a), r = V.get(a);
92
- i.setFormValue(r);
91
+ const i = c.get(a), o = V.get(a);
92
+ i.setFormValue(o);
93
93
  }
94
94
  }
95
95
  }) : {};
96
96
  function W(e) {
97
97
  e.forEach((t) => {
98
- const { addedNodes: a, removedNodes: i } = t, r = Array.from(a), n = Array.from(i);
99
- r.forEach((o) => {
100
- var f;
101
- if (c.has(o) && o.constructor.formAssociated && O(o), k.has(o)) {
102
- const p = k.get(o);
103
- Object.keys(C).filter((v) => p[v] !== null).forEach((v) => {
104
- o.setAttribute(C[v], p[v]);
105
- }), k.delete(o);
98
+ const { addedNodes: a, removedNodes: i } = t, o = Array.from(a), n = Array.from(i);
99
+ o.forEach((r) => {
100
+ var h;
101
+ if (c.has(r) && r.constructor.formAssociated && O(r), T.has(r)) {
102
+ const p = T.get(r);
103
+ Object.keys(k).filter((v) => p[v] !== null).forEach((v) => {
104
+ r.setAttribute(k[v], p[v]);
105
+ }), T.delete(r);
106
106
  }
107
- if (b.has(o)) {
108
- const p = b.get(o);
109
- o.setAttribute("internals-valid", p.validity.valid.toString()), o.setAttribute("internals-invalid", (!p.validity.valid).toString()), o.setAttribute("aria-invalid", (!p.validity.valid).toString()), b.delete(o);
107
+ if (b.has(r)) {
108
+ const p = b.get(r);
109
+ r.setAttribute("internals-valid", p.validity.valid.toString()), r.setAttribute("internals-invalid", (!p.validity.valid).toString()), r.setAttribute("aria-invalid", (!p.validity.valid).toString()), b.delete(r);
110
110
  }
111
- if (o.localName === "form") {
112
- const p = y.get(o), E = document.createTreeWalker(o, NodeFilter.SHOW_ELEMENT, {
111
+ if (r.localName === "form") {
112
+ const p = y.get(r), x = document.createTreeWalker(r, NodeFilter.SHOW_ELEMENT, {
113
113
  acceptNode(G) {
114
114
  return c.has(G) && G.constructor.formAssociated && !(p && p.has(G)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
115
115
  }
116
116
  });
117
- let v = E.nextNode();
117
+ let v = x.nextNode();
118
118
  for (; v; )
119
- O(v), v = E.nextNode();
119
+ O(v), v = x.nextNode();
120
120
  }
121
- o.localName === "fieldset" && ((f = R.observe) === null || f === void 0 || f.call(R, o, Y), P(o, !0));
122
- }), n.forEach((o) => {
123
- const f = c.get(o);
124
- f && g.get(f) && Z(f), S.has(o) && S.get(o).disconnect();
121
+ r.localName === "fieldset" && ((h = R.observe) === null || h === void 0 || h.call(R, r, Y), P(r, !0));
122
+ }), n.forEach((r) => {
123
+ const h = c.get(r);
124
+ h && g.get(h) && Z(h), S.has(r) && S.get(r).disconnect();
125
125
  });
126
126
  });
127
127
  }
128
- function ht(e) {
128
+ function ft(e) {
129
129
  e.forEach((t) => {
130
130
  const { removedNodes: a } = t;
131
131
  a.forEach((i) => {
132
- const r = L.get(t.target);
133
- c.has(i) && rt(i), r.disconnect();
132
+ const o = $.get(t.target);
133
+ c.has(i) && ot(i), o.disconnect();
134
134
  });
135
135
  });
136
136
  }
137
137
  const gt = (e) => {
138
138
  var t, a;
139
- const i = new MutationObserver(ht);
140
- !((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (a = i.observe) === null || a === void 0 || a.call(i, e, { childList: !0 }), L.set(e, i);
139
+ const i = new MutationObserver(ft);
140
+ !((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (a = i.observe) === null || a === void 0 || a.call(i, e, { childList: !0 }), $.set(e, i);
141
141
  };
142
142
  z() && new MutationObserver(W);
143
143
  const q = {
@@ -162,8 +162,8 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
162
162
  t[0].id || (a = `${t[0].htmlFor}_Label`, t[0].id = a), e.setAttribute("aria-labelledby", a);
163
163
  }
164
164
  }, _ = (e) => {
165
- const t = Array.from(e.elements).filter((n) => !n.tagName.includes("-") && n.validity).map((n) => n.validity.valid), a = y.get(e) || [], i = Array.from(a).filter((n) => n.isConnected).map((n) => c.get(n).validity.valid), r = [...t, ...i].includes(!1);
166
- e.toggleAttribute("internals-invalid", r), e.toggleAttribute("internals-valid", !r);
165
+ const t = Array.from(e.elements).filter((n) => !n.tagName.includes("-") && n.validity).map((n) => n.validity.valid), a = y.get(e) || [], i = Array.from(a).filter((n) => n.isConnected).map((n) => c.get(n).validity.valid), o = [...t, ...i].includes(!1);
166
+ e.toggleAttribute("internals-invalid", o), e.toggleAttribute("internals-valid", !o);
167
167
  }, vt = (e) => {
168
168
  _(D(e.target));
169
169
  }, bt = (e) => {
@@ -172,13 +172,13 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
172
172
  const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((a) => `${a}:not([disabled])`).map((a) => `${a}:not([form])${e.id ? `,${a}[form='${e.id}']` : ""}`).join(",");
173
173
  e.addEventListener("click", (a) => {
174
174
  if (a.target.closest(t)) {
175
- const r = y.get(e);
175
+ const o = y.get(e);
176
176
  if (e.noValidate)
177
177
  return;
178
- r.size && Array.from(r).reverse().map((f) => c.get(f).reportValidity()).includes(!1) && a.preventDefault();
178
+ o.size && Array.from(o).reverse().map((h) => c.get(h).reportValidity()).includes(!1) && a.preventDefault();
179
179
  }
180
180
  });
181
- }, Et = (e) => {
181
+ }, xt = (e) => {
182
182
  const t = y.get(e.target);
183
183
  t && t.size && t.forEach((a) => {
184
184
  a.constructor.formAssociated && a.formResetCallback && a.formResetCallback.apply(a);
@@ -189,8 +189,8 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
189
189
  if (i)
190
190
  i.add(e);
191
191
  else {
192
- const r = /* @__PURE__ */ new Set();
193
- r.add(e), y.set(t, r), wt(t), t.addEventListener("reset", Et), t.addEventListener("input", vt), t.addEventListener("change", bt);
192
+ const o = /* @__PURE__ */ new Set();
193
+ o.add(e), y.set(t, o), wt(t), t.addEventListener("reset", xt), t.addEventListener("input", vt), t.addEventListener("change", bt);
194
194
  }
195
195
  I.set(t, { ref: e, internals: a }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
196
196
  e.formAssociatedCallback.apply(e, [t]);
@@ -204,10 +204,10 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
204
204
  throw new a(t);
205
205
  }, it = (e, t, a) => {
206
206
  const i = y.get(e);
207
- return i && i.size && i.forEach((r) => {
208
- c.get(r)[a]() || (t = !1);
207
+ return i && i.size && i.forEach((o) => {
208
+ c.get(o)[a]() || (t = !1);
209
209
  }), t;
210
- }, rt = (e) => {
210
+ }, ot = (e) => {
211
211
  if (e.constructor.formAssociated) {
212
212
  const t = c.get(e), { labels: a, form: i } = t;
213
213
  et(e, a), at(e, i, t);
@@ -216,12 +216,12 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
216
216
  function z() {
217
217
  return typeof MutationObserver < "u";
218
218
  }
219
- class xt {
219
+ class Et {
220
220
  constructor() {
221
221
  this.badInput = !1, this.customError = !1, this.patternMismatch = !1, this.rangeOverflow = !1, this.rangeUnderflow = !1, this.stepMismatch = !1, this.tooLong = !1, this.tooShort = !1, this.typeMismatch = !1, this.valid = !0, this.valueMissing = !1, Object.seal(this);
222
222
  }
223
223
  }
224
- const Mt = (e) => (e.badInput = !1, e.customError = !1, e.patternMismatch = !1, e.rangeOverflow = !1, e.rangeUnderflow = !1, e.stepMismatch = !1, e.tooLong = !1, e.tooShort = !1, e.typeMismatch = !1, e.valid = !0, e.valueMissing = !1, e), It = (e, t, a) => (e.valid = kt(t), Object.keys(t).forEach((i) => e[i] = t[i]), a && _(a), e), kt = (e) => {
224
+ const Mt = (e) => (e.badInput = !1, e.customError = !1, e.patternMismatch = !1, e.rangeOverflow = !1, e.rangeUnderflow = !1, e.stepMismatch = !1, e.tooLong = !1, e.tooShort = !1, e.typeMismatch = !1, e.valid = !0, e.valueMissing = !1, e), It = (e, t, a) => (e.valid = Tt(t), Object.keys(t).forEach((i) => e[i] = t[i]), a && _(a), e), Tt = (e) => {
225
225
  let t = !0;
226
226
  for (let a in e)
227
227
  a !== "valid" && e[a] !== !1 && (t = !1);
@@ -242,9 +242,9 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
242
242
  add(t) {
243
243
  if (!/^--/.test(t) || typeof t != "string")
244
244
  throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
245
- const a = super.add(t), i = U.get(this), r = `state${t}`;
246
- return i.isConnected ? nt(i, r) : setTimeout(() => {
247
- nt(i, r);
245
+ const a = super.add(t), i = U.get(this), o = `state${t}`;
246
+ return i.isConnected ? nt(i, o) : setTimeout(() => {
247
+ nt(i, o);
248
248
  }), a;
249
249
  }
250
250
  clear() {
@@ -259,26 +259,26 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
259
259
  }), a;
260
260
  }
261
261
  }
262
- function ot(e, t, a, i) {
262
+ function rt(e, t, a, i) {
263
263
  if (a === "a" && !i)
264
264
  throw new TypeError("Private accessor was defined without a getter");
265
265
  if (typeof t == "function" ? e !== t || !i : !t.has(e))
266
266
  throw new TypeError("Cannot read private member from an object whose class did not declare it");
267
267
  return a === "m" ? i : a === "a" ? i.call(e) : i ? i.value : t.get(e);
268
268
  }
269
- function Ct(e, t, a, i, r) {
269
+ function kt(e, t, a, i, o) {
270
270
  if (i === "m")
271
271
  throw new TypeError("Private method is not writable");
272
- if (i === "a" && !r)
272
+ if (i === "a" && !o)
273
273
  throw new TypeError("Private accessor was defined without a setter");
274
- if (typeof t == "function" ? e !== t || !r : !t.has(e))
274
+ if (typeof t == "function" ? e !== t || !o : !t.has(e))
275
275
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
276
- return i === "a" ? r.call(e, a) : r ? r.value = a : t.set(e, a), a;
276
+ return i === "a" ? o.call(e, a) : o ? o.value = a : t.set(e, a), a;
277
277
  }
278
- var T;
278
+ var F;
279
279
  class St {
280
280
  constructor(t) {
281
- T.set(this, void 0), Ct(this, T, t, "f");
281
+ F.set(this, void 0), kt(this, F, t, "f");
282
282
  for (let a = 0; a < t.length; a++) {
283
283
  let i = t[a];
284
284
  this[a] = i, i.hasAttribute("name") && (this[i.getAttribute("name")] = i);
@@ -286,10 +286,10 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
286
286
  Object.freeze(this);
287
287
  }
288
288
  get length() {
289
- return ot(this, T, "f").length;
289
+ return rt(this, F, "f").length;
290
290
  }
291
- [(T = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
292
- return ot(this, T, "f")[Symbol.iterator]();
291
+ [(F = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
292
+ return rt(this, F, "f")[Symbol.iterator]();
293
293
  }
294
294
  item(t) {
295
295
  return this[t] == null ? null : this[t];
@@ -298,26 +298,26 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
298
298
  return this[t] == null ? null : this[t];
299
299
  }
300
300
  }
301
- function Ft() {
301
+ function Ct() {
302
302
  const e = HTMLFormElement.prototype.checkValidity;
303
303
  HTMLFormElement.prototype.checkValidity = a;
304
304
  const t = HTMLFormElement.prototype.reportValidity;
305
305
  HTMLFormElement.prototype.reportValidity = i;
306
306
  function a(...n) {
307
- let o = e.apply(this, n);
308
- return it(this, o, "checkValidity");
307
+ let r = e.apply(this, n);
308
+ return it(this, r, "checkValidity");
309
309
  }
310
310
  function i(...n) {
311
- let o = t.apply(this, n);
312
- return it(this, o, "reportValidity");
311
+ let r = t.apply(this, n);
312
+ return it(this, r, "reportValidity");
313
313
  }
314
- const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
314
+ const { get: o } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
315
315
  Object.defineProperty(HTMLFormElement.prototype, "elements", {
316
316
  get(...n) {
317
- const o = r.call(this, ...n), f = Array.from(y.get(this) || []);
318
- if (f.length === 0)
319
- return o;
320
- const p = Array.from(o).concat(f).sort((E, v) => E.compareDocumentPosition ? E.compareDocumentPosition(v) & 2 ? 1 : -1 : 0);
317
+ const r = o.call(this, ...n), h = Array.from(y.get(this) || []);
318
+ if (h.length === 0)
319
+ return r;
320
+ const p = Array.from(r).concat(h).sort((x, v) => x.compareDocumentPosition ? x.compareDocumentPosition(v) & 2 ? 1 : -1 : 0);
321
321
  return new St(p);
322
322
  }
323
323
  });
@@ -329,14 +329,14 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
329
329
  constructor(t) {
330
330
  if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
331
331
  throw new TypeError("Illegal constructor");
332
- const a = t.getRootNode(), i = new xt();
333
- this.states = new j(t), s.set(this, t), h.set(this, i), c.set(t, this), H(t, this), yt(t, this), Object.seal(this), a instanceof DocumentFragment && gt(a);
332
+ const a = t.getRootNode(), i = new Et();
333
+ this.states = new j(t), s.set(this, t), f.set(this, i), c.set(t, this), H(t, this), yt(t, this), Object.seal(this), a instanceof DocumentFragment && gt(a);
334
334
  }
335
335
  checkValidity() {
336
336
  const t = s.get(this);
337
337
  if (w(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
338
338
  return !0;
339
- const a = h.get(this);
339
+ const a = f.get(this);
340
340
  if (!a.valid) {
341
341
  const i = new Event("invalid", {
342
342
  bubbles: !1,
@@ -363,7 +363,7 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
363
363
  const t = s.get(this);
364
364
  if (w(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
365
365
  return !0;
366
- const a = this.checkValidity(), i = $.get(this);
366
+ const a = this.checkValidity(), i = L.get(this);
367
367
  if (i && !t.constructor.formAssociated)
368
368
  throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
369
369
  return !a && i && (t.focus(), i.focus()), a;
@@ -376,29 +376,29 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
376
376
  i.value = t;
377
377
  }
378
378
  } else
379
- t != null && t instanceof FormData && Array.from(t).reverse().forEach(([i, r]) => {
380
- if (typeof r == "string") {
379
+ t != null && t instanceof FormData && Array.from(t).reverse().forEach(([i, o]) => {
380
+ if (typeof o == "string") {
381
381
  const n = tt(a, this);
382
- n.name = i, n.value = r;
382
+ n.name = i, n.value = o;
383
383
  }
384
384
  });
385
385
  V.set(a, t);
386
386
  }
387
387
  setValidity(t, a, i) {
388
- const r = s.get(this);
389
- if (w(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
388
+ const o = s.get(this);
389
+ if (w(o, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
390
390
  throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
391
- $.set(this, i);
392
- const n = h.get(this), o = {};
393
- for (const E in t)
394
- o[E] = t[E];
395
- Object.keys(o).length === 0 && Mt(n);
396
- const f = Object.assign(Object.assign({}, n), o);
397
- delete f.valid;
398
- const { valid: p } = It(n, f, this.form);
391
+ L.set(this, i);
392
+ const n = f.get(this), r = {};
393
+ for (const x in t)
394
+ r[x] = t[x];
395
+ Object.keys(r).length === 0 && Mt(n);
396
+ const h = Object.assign(Object.assign({}, n), r);
397
+ delete h.valid;
398
+ const { valid: p } = It(n, h, this.form);
399
399
  if (!p && !a)
400
400
  throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");
401
- M.set(this, p ? "" : a), r.isConnected ? (r.toggleAttribute("internals-invalid", !p), r.toggleAttribute("internals-valid", p), r.setAttribute("aria-invalid", `${!p}`)) : b.set(r, this);
401
+ M.set(this, p ? "" : a), o.isConnected ? (o.toggleAttribute("internals-invalid", !p), o.toggleAttribute("internals-valid", p), o.setAttribute("aria-invalid", `${!p}`)) : b.set(o, this);
402
402
  }
403
403
  get shadowRoot() {
404
404
  const t = s.get(this), a = N.get(t);
@@ -410,14 +410,14 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
410
410
  }
411
411
  get validity() {
412
412
  const t = s.get(this);
413
- return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), h.get(this);
413
+ return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), f.get(this);
414
414
  }
415
415
  get willValidate() {
416
416
  const t = s.get(this);
417
417
  return w(t, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(t.disabled || t.hasAttribute("disabled") || t.hasAttribute("readonly"));
418
418
  }
419
419
  }
420
- function Tt() {
420
+ function Ft() {
421
421
  if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
422
422
  return !1;
423
423
  class e extends HTMLElement {
@@ -452,14 +452,14 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
452
452
  if (!lt) {
453
453
  if (lt = !0, typeof window < "u" && (window.ElementInternals = st), typeof CustomElementRegistry < "u") {
454
454
  const t = CustomElementRegistry.prototype.define;
455
- CustomElementRegistry.prototype.define = function(a, i, r) {
455
+ CustomElementRegistry.prototype.define = function(a, i, o) {
456
456
  if (i.formAssociated) {
457
457
  const n = i.prototype.connectedCallback;
458
458
  i.prototype.connectedCallback = function() {
459
- F.has(this) || (F.set(this, !0), this.hasAttribute("disabled") && B(this, !0)), n != null && n.apply(this), rt(this);
459
+ C.has(this) || (C.set(this, !0), this.hasAttribute("disabled") && B(this, !0)), n != null && n.apply(this), ot(this);
460
460
  };
461
461
  }
462
- t.call(this, a, i, r);
462
+ t.call(this, a, i, o);
463
463
  };
464
464
  }
465
465
  if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
@@ -473,35 +473,35 @@ const Pt = `*,*:after,*:before{box-sizing:inherit}.c-textInput{--input-padding-b
473
473
  return new st(this);
474
474
  }), typeof Element < "u") {
475
475
  let t = function(...i) {
476
- const r = a.apply(this, i);
477
- if (N.set(this, r), z()) {
476
+ const o = a.apply(this, i);
477
+ if (N.set(this, o), z()) {
478
478
  const n = new MutationObserver(W);
479
- window.ShadyDOM ? n.observe(this, q) : n.observe(r, q), S.set(this, n);
479
+ window.ShadyDOM ? n.observe(this, q) : n.observe(o, q), S.set(this, n);
480
480
  }
481
- return r;
481
+ return o;
482
482
  };
483
483
  const a = Element.prototype.attachShadow;
484
484
  Element.prototype.attachShadow = t;
485
485
  }
486
- z() && typeof document < "u" && new MutationObserver(W).observe(document.documentElement, q), typeof HTMLFormElement < "u" && Ft(), (e || typeof window < "u" && !window.CustomStateSet) && K();
486
+ z() && typeof document < "u" && new MutationObserver(W).observe(document.documentElement, q), typeof HTMLFormElement < "u" && Ct(), (e || typeof window < "u" && !window.CustomStateSet) && K();
487
487
  }
488
488
  }
489
- return !!customElements.polyfillWrapFlushCallback || (Tt() ? typeof window < "u" && !window.CustomStateSet && K(HTMLElement.prototype.attachInternals) : dt(!1)), x.forceCustomStateSetPolyfill = K, x.forceElementInternalsPolyfill = dt, Object.defineProperty(x, "__esModule", { value: !0 }), x;
489
+ return !!customElements.polyfillWrapFlushCallback || (Ft() ? typeof window < "u" && !window.CustomStateSet && K(HTMLElement.prototype.attachInternals) : dt(!1)), E.forceCustomStateSetPolyfill = K, E.forceElementInternalsPolyfill = dt, Object.defineProperty(E, "__esModule", { value: !0 }), E;
490
490
  })({});
491
491
  })();
492
- var Dt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, d = (x, s, h, g) => {
493
- for (var c = g > 1 ? void 0 : g ? zt(s, h) : s, M = x.length - 1, I; M >= 0; M--)
494
- (I = x[M]) && (c = (g ? I(s, h, c) : I(c)) || c);
495
- return g && c && Dt(s, h, c), c;
492
+ var Dt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, d = (E, s, f, g) => {
493
+ for (var c = g > 1 ? void 0 : g ? zt(s, f) : s, M = E.length - 1, I; M >= 0; M--)
494
+ (I = E[M]) && (c = (g ? I(s, f, c) : I(c)) || c);
495
+ return g && c && Dt(s, f, c), c;
496
496
  };
497
497
  const X = "pie-text-input", Q = "assistive-text";
498
- class l extends Nt($t(pt)) {
498
+ class l extends Nt(Lt(pt)) {
499
499
  constructor() {
500
500
  super(...arguments), this.type = A.type, this.value = A.value, this.size = A.size, this.required = !1, this.handleInput = (s) => {
501
501
  this.value = s.target.value, this._internals.setFormValue(this.value);
502
502
  }, this.handleChange = (s) => {
503
- const h = Lt(s);
504
- this.dispatchEvent(h);
503
+ const f = $t(s);
504
+ this.dispatchEvent(f);
505
505
  };
506
506
  }
507
507
  /**
@@ -536,7 +536,7 @@ class l extends Nt($t(pt)) {
536
536
  render() {
537
537
  const {
538
538
  assistiveText: s,
539
- autocomplete: h,
539
+ autocomplete: f,
540
540
  autoFocus: g,
541
541
  disabled: c,
542
542
  inputmode: M,
@@ -544,13 +544,13 @@ class l extends Nt($t(pt)) {
544
544
  minlength: S,
545
545
  min: y,
546
546
  max: V,
547
- name: k,
547
+ name: T,
548
548
  pattern: N,
549
- step: $,
550
- placeholder: L,
551
- readonly: F,
549
+ step: L,
550
+ placeholder: $,
551
+ readonly: C,
552
552
  status: b,
553
- type: C,
553
+ type: k,
554
554
  value: H,
555
555
  size: O,
556
556
  required: P
@@ -562,24 +562,29 @@ class l extends Nt($t(pt)) {
562
562
  data-pie-size=${m(O)}
563
563
  data-pie-status=${m(b)}
564
564
  ?data-pie-disabled=${J(c)}
565
- ?data-pie-readonly=${F}>
566
- <slot name="leading"></slot>
565
+ ?data-pie-readonly=${C}>
566
+ <!-- The reason for separate slots for icons and text is that we cannot programmatically be aware of the
567
+ HTML used inside of the slot without breaking SSR in consuming applications (icons need to use different colours than text content)
568
+ Therefore, we provide two slots and advise consumers do not attempt to use both leading/trailing at the same time
569
+ as this would violate the design guidelines for this component. -->
570
+ <slot name="leadingIcon"></slot>
571
+ <slot name="leadingText"></slot>
567
572
  <input
568
- type=${m(C)}
573
+ type=${m(k)}
569
574
  .value=${J(H)}
570
- name=${m(k)}
575
+ name=${m(T)}
571
576
  ?disabled=${J(c)}
572
577
  pattern=${m(N)}
573
- step=${m($)}
578
+ step=${m(L)}
574
579
  minlength=${m(S)}
575
580
  maxlength=${m(I)}
576
581
  min=${m(y)}
577
582
  max=${m(V)}
578
- autocomplete=${m(h)}
583
+ autocomplete=${m(f)}
579
584
  ?autofocus=${g}
580
585
  inputmode=${m(M)}
581
- placeholder=${m(L)}
582
- ?readonly=${F}
586
+ placeholder=${m($)}
587
+ ?readonly=${C}
583
588
  ?required=${P}
584
589
  aria-describedby=${m(s ? Q : void 0)}
585
590
  aria-invalid=${b === "error" ? "true" : "false"}
@@ -587,7 +592,12 @@ class l extends Nt($t(pt)) {
587
592
  @input=${this.handleInput}
588
593
  @change=${this.handleChange}
589
594
  data-test-id="pie-text-input">
590
- <slot name="trailing"></slot>
595
+ <!-- The reason for separate slots for icons and text is that we cannot programmatically be aware of the
596
+ HTML used inside of the slot without breaking SSR in consuming applications (icons need to use different colours than text content)
597
+ Therefore, we provide two slots and advise consumers do not attempt to use both leading/trailing at the same time
598
+ as this would violate the design guidelines for this component. -->
599
+ <slot name="trailingIcon"></slot>
600
+ <slot name="trailingText"></slot>
591
601
  </div>
592
602
  ${s ? ut`<pie-assistive-text id="${Q}" variant=${m(b)} data-test-id="pie-text-input-assistive-text">${s}</pie-assistive-text>` : At}`;
593
603
  }
@@ -596,7 +606,7 @@ l.shadowRootOptions = { ...pt.shadowRootOptions, delegatesFocus: !0 };
596
606
  l.styles = Vt(Pt);
597
607
  d([
598
608
  u({ type: String, reflect: !0 }),
599
- ft(X, Rt, A.type)
609
+ ht(X, Rt, A.type)
600
610
  ], l.prototype, "type", 2);
601
611
  d([
602
612
  u({ type: String })
@@ -639,7 +649,7 @@ d([
639
649
  ], l.prototype, "assistiveText", 2);
640
650
  d([
641
651
  u({ type: String }),
642
- ft(X, _t, void 0)
652
+ ht(X, _t, void 0)
643
653
  ], l.prototype, "status", 2);
644
654
  d([
645
655
  u({ type: Number })
package/dist/react.d.ts CHANGED
@@ -27,8 +27,10 @@ export declare const PieTextInput: React_2.ForwardRefExoticComponent<TextInputPr
27
27
  * @tagname pie-text-input
28
28
  * @event {InputEvent} input - when the input value is changed.
29
29
  * @event {CustomEvent} change - when the input value is changed.
30
- * @slot leading - An icon or short text to display at the start of the input.
31
- * @slot trailing - An icon or short text to display at the end of the input.
30
+ * @slot leadingText - Short text to display at the start of the input. Wrap the text in a <span>. Do not use with leadingIcon at the same time.
31
+ * @slot leadingIcon - An icon to display at the start of the input. Do not use with leadingText at the same time.
32
+ * @slot trailingText - Short text to display at the end of the input. Wrap the text in a <span>. Do not use with trailingIcon at the same time.
33
+ * @slot trailingIcon - An icon to display at the end of the input. Do not use with trailingText at the same time.
32
34
  */
33
35
  declare class PieTextInput_2 extends PieTextInput_base implements TextInputProps, PIEInputElement {
34
36
  static shadowRootOptions: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-text-input",
3
3
  "description": "PIE Design System Input built using Web Components",
4
- "version": "0.21.0",
4
+ "version": "0.22.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "cem-plugin-module-file-extensions": "0.0.5"
43
43
  },
44
44
  "dependencies": {
45
- "@justeattakeaway/pie-assistive-text": "0.3.7",
45
+ "@justeattakeaway/pie-assistive-text": "0.4.0",
46
46
  "@justeattakeaway/pie-webc-core": "0.23.0",
47
47
  "element-internals-polyfill": "1.3.11"
48
48
  },
package/src/index.ts CHANGED
@@ -26,8 +26,10 @@ const assistiveTextIdValue = 'assistive-text';
26
26
  * @tagname pie-text-input
27
27
  * @event {InputEvent} input - when the input value is changed.
28
28
  * @event {CustomEvent} change - when the input value is changed.
29
- * @slot leading - An icon or short text to display at the start of the input.
30
- * @slot trailing - An icon or short text to display at the end of the input.
29
+ * @slot leadingText - Short text to display at the start of the input. Wrap the text in a <span>. Do not use with leadingIcon at the same time.
30
+ * @slot leadingIcon - An icon to display at the start of the input. Do not use with leadingText at the same time.
31
+ * @slot trailingText - Short text to display at the end of the input. Wrap the text in a <span>. Do not use with trailingIcon at the same time.
32
+ * @slot trailingIcon - An icon to display at the end of the input. Do not use with trailingText at the same time.
31
33
  */
32
34
  export class PieTextInput extends FormControlMixin(RtlMixin(LitElement)) implements TextInputProps, PIEInputElement {
33
35
  static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
@@ -201,7 +203,12 @@ export class PieTextInput extends FormControlMixin(RtlMixin(LitElement)) impleme
201
203
  data-pie-status=${ifDefined(status)}
202
204
  ?data-pie-disabled=${live(disabled)}
203
205
  ?data-pie-readonly=${readonly}>
204
- <slot name="leading"></slot>
206
+ <!-- The reason for separate slots for icons and text is that we cannot programmatically be aware of the
207
+ HTML used inside of the slot without breaking SSR in consuming applications (icons need to use different colours than text content)
208
+ Therefore, we provide two slots and advise consumers do not attempt to use both leading/trailing at the same time
209
+ as this would violate the design guidelines for this component. -->
210
+ <slot name="leadingIcon"></slot>
211
+ <slot name="leadingText"></slot>
205
212
  <input
206
213
  type=${ifDefined(type)}
207
214
  .value=${live(value)}
@@ -225,7 +232,12 @@ export class PieTextInput extends FormControlMixin(RtlMixin(LitElement)) impleme
225
232
  @input=${this.handleInput}
226
233
  @change=${this.handleChange}
227
234
  data-test-id="pie-text-input">
228
- <slot name="trailing"></slot>
235
+ <!-- The reason for separate slots for icons and text is that we cannot programmatically be aware of the
236
+ HTML used inside of the slot without breaking SSR in consuming applications (icons need to use different colours than text content)
237
+ Therefore, we provide two slots and advise consumers do not attempt to use both leading/trailing at the same time
238
+ as this would violate the design guidelines for this component. -->
239
+ <slot name="trailingIcon"></slot>
240
+ <slot name="trailingText"></slot>
229
241
  </div>
230
242
  ${assistiveText ? html`<pie-assistive-text id="${assistiveTextIdValue}" variant=${ifDefined(status)} data-test-id="pie-text-input-assistive-text">${assistiveText}</pie-assistive-text>` : nothing}`;
231
243
  }
@@ -18,7 +18,6 @@
18
18
  --icon-display-override: block;
19
19
  --icon-size-override: 24px;
20
20
 
21
-
22
21
  height: var(--input-height);
23
22
  border: 1px solid var(--input-border-color);
24
23
  border-radius: var(--input-radius);
@@ -32,7 +31,7 @@
32
31
  flex-wrap: nowrap;
33
32
  align-items: center;
34
33
  background-color: var(--input-container-color);
35
- color: var(--input-text-color-leading-trailing-content); // Applies to the leading/trailing slot text
34
+ color: var(--input-text-color-leading-trailing-content); // Applies to the leadingText and trailingText slot content
36
35
  cursor: var(--input-cursor);
37
36
 
38
37
  &[data-pie-size="large"] {
@@ -49,26 +48,35 @@
49
48
  --input-border-color: var(--dt-color-support-error);
50
49
  }
51
50
 
52
- ::slotted([slot="leading"]) {
51
+ ::slotted([slot="leadingText"]),
52
+ ::slotted([slot="leadingIcon"]) {
53
53
  margin-inline-end: var(--input-gap);
54
54
  }
55
55
 
56
- ::slotted([slot="trailing"]) {
56
+ ::slotted([slot="trailingText"]),
57
+ ::slotted([slot="trailingIcon"]) {
57
58
  margin-inline-start: var(--input-gap);
58
59
  }
59
60
 
60
61
  @supports (gap: var(--input-gap)) {
61
62
  gap: var(--input-gap);
62
63
 
63
- ::slotted([slot="leading"]) {
64
+ ::slotted([slot="leadingText"]),
65
+ ::slotted([slot="leadingIcon"]) {
64
66
  margin-inline-end: 0;
65
67
  }
66
68
 
67
- ::slotted([slot="trailing"]) {
69
+ ::slotted([slot="trailingText"]),
70
+ ::slotted([slot="trailingIcon"]) {
68
71
  margin-inline-start: 0;
69
72
  }
70
73
  }
71
74
 
75
+ &:not([data-pie-disabled]) ::slotted([slot="leadingIcon"]),
76
+ &:not([data-pie-disabled]) ::slotted([slot="trailingIcon"]) {
77
+ color: var(--dt-color-content-subdued);
78
+ }
79
+
72
80
  @media (hover: hover) {
73
81
  &:hover {
74
82
  --input-container-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))));
@@ -77,7 +85,7 @@
77
85
 
78
86
  &[data-pie-readonly] {
79
87
  --input-container-color: var(--dt-color-disabled-01);
80
- --input-border-color: var(--dt-color-border-inverse);
88
+ --input-border-color: var(--dt-color-interactive-form);
81
89
  }
82
90
 
83
91
  // Ensure that if an input is readonly and disabled, the disabled styles take precedence