@viasat/beam-web-components 2.25.0 → 2.26.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.
@@ -2,8 +2,8 @@ var x = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
4
  var C = (a, r, t) => r.has(a) || x("Cannot " + t);
5
- var u = (a, r, t) => (C(a, r, "read from private field"), t ? t.call(a) : r.get(a)), g = (a, r, t) => r.has(a) ? x("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, t), V = (a, r, t, e) => (C(a, r, "write to private field"), e ? e.call(a, t) : r.set(a, t), t);
6
- import { consume as y } from "@lit/context";
5
+ var u = (a, r, t) => (C(a, r, "read from private field"), t ? t.call(a) : r.get(a)), g = (a, r, t) => r.has(a) ? x("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, t), y = (a, r, t, e) => (C(a, r, "write to private field"), e ? e.call(a, t) : r.set(a, t), t);
6
+ import { consume as V } from "@lit/context";
7
7
  import { LitElement as E, nothing as f, html as p } from "lit";
8
8
  import { property as h, state as k } from "lit/decorators.js";
9
9
  import { createRef as A } from "lit/directives/ref.js";
@@ -12,8 +12,8 @@ import { bmFormInitials as c, bmFormContext as I } from "./Form.context.js";
12
12
  import { createId as m } from "./Form.utils.js";
13
13
  import "../../chunks/HelperText.SJGM6Q5H.js";
14
14
  var S = Object.defineProperty, n = (a, r, t, e) => {
15
- for (var i = void 0, o = a.length - 1, d; o >= 0; o--)
16
- (d = a[o]) && (i = d(r, t, i) || i);
15
+ for (var i = void 0, s = a.length - 1, d; s >= 0; s--)
16
+ (d = a[s]) && (i = d(r, t, i) || i);
17
17
  return i && S(r, t, i), i;
18
18
  }, l;
19
19
  const b = class b extends E {
@@ -22,7 +22,7 @@ const b = class b extends E {
22
22
  g(this, l);
23
23
  this.labelId = m(), this.errorId = m(), this.helperTextId = m(), this.validationErrorsId = m(), this.internals = this.attachInternals(), this.formFieldRef = A(), this.id = "", this.name = "", this.value = "", this.validationRules = [], this._validationErrors = [], this.validationErrors = () => this._validationErrors, this.setValidationErrors = (t) => {
24
24
  this._validationErrors = t;
25
- }, this.validationErrorShown = () => this.validationErrors().some((t) => !!(t != null && t.length)), V(this, l, /* @__PURE__ */ new WeakMap()), this.submitFormByEnter = ({ key: t }) => {
25
+ }, this.validationErrorShown = () => this.validationErrors().some((t) => !!(t != null && t.length)), y(this, l, /* @__PURE__ */ new WeakMap()), this.submitFormByEnter = ({ key: t }) => {
26
26
  t === "Enter" && this.requestAssociatedSubmit();
27
27
  }, this.forwardLabelFocus = () => {
28
28
  const { value: t } = this.formFieldRef;
@@ -38,8 +38,8 @@ const b = class b extends E {
38
38
  return (t == null ? void 0 : t[this.name]) || this.value;
39
39
  }, this.setContextValue = () => {
40
40
  const { value: t } = this.formFieldRef, { ctxValue: e, finalizeCallback: i = () => {
41
- } } = this.finalizeAssociatedCallback(this.getContextValue());
42
- t.value = e, this.setAssociatedValue(e), i();
41
+ } } = this.finalizeAssociatedCallback(this.getContextValue()), s = t;
42
+ s.value !== e && (s.value = e), this.setAssociatedValue(e), i();
43
43
  }, this.setContextValidation = () => {
44
44
  const { value: t } = this.formFieldRef, { registerField: e } = this.formContext || c;
45
45
  e({
@@ -79,6 +79,10 @@ const b = class b extends E {
79
79
  ` : f;
80
80
  }
81
81
  setAssociatedValue(t) {
82
+ if (typeof t == "string") {
83
+ if (this.value === t) return;
84
+ this.value = t;
85
+ }
82
86
  let e = null;
83
87
  if (typeof t == "boolean")
84
88
  e = t ? "on" : null;
@@ -86,7 +90,7 @@ const b = class b extends E {
86
90
  e = t.toString();
87
91
  else if (Array.isArray(t)) {
88
92
  const i = new FormData();
89
- t.forEach((o) => i.append(this.name, o.toString())), e = i;
93
+ t.forEach((s) => i.append(this.name, s.toString())), e = i;
90
94
  } else
91
95
  e = t;
92
96
  this.internals.form && this.internals.setFormValue(e);
@@ -98,7 +102,7 @@ const b = class b extends E {
98
102
  super.connectedCallback(), this.addEventListener("bm-label-click", this.forwardLabelFocus);
99
103
  }
100
104
  ctxValueChanged(t, e) {
101
- const { value: i } = e, o = u(this, l).get(i), { initialValues: { [this.name]: d } = {} } = t, v = d !== o;
105
+ const { value: i } = e, s = u(this, l).get(i), { initialValues: { [this.name]: d } = {} } = t, v = d !== s;
102
106
  return v && u(this, l).set(i, d), v;
103
107
  }
104
108
  disconnectedCallback() {
@@ -116,29 +120,29 @@ const b = class b extends E {
116
120
  }
117
121
  };
118
122
  l = new WeakMap(), b.formAssociated = !0;
119
- let s = b;
123
+ let o = b;
120
124
  n([
121
125
  h({ type: String })
122
- ], s.prototype, "id");
126
+ ], o.prototype, "id");
123
127
  n([
124
128
  h({ type: String })
125
- ], s.prototype, "name");
129
+ ], o.prototype, "name");
126
130
  n([
127
131
  h({ type: String })
128
- ], s.prototype, "value");
132
+ ], o.prototype, "value");
129
133
  n([
130
134
  h({ type: Array })
131
- ], s.prototype, "validationRules");
135
+ ], o.prototype, "validationRules");
132
136
  n([
133
137
  h({ type: String, attribute: "input-aria-label" })
134
- ], s.prototype, "inputAriaLabel");
138
+ ], o.prototype, "inputAriaLabel");
135
139
  n([
136
- y({ context: I, subscribe: !0 }),
140
+ V({ context: I, subscribe: !0 }),
137
141
  h({ attribute: !1 })
138
- ], s.prototype, "formContext");
142
+ ], o.prototype, "formContext");
139
143
  n([
140
144
  k()
141
- ], s.prototype, "_validationErrors");
145
+ ], o.prototype, "_validationErrors");
142
146
  export {
143
- s as FormField
147
+ o as FormField
144
148
  };
File without changes
File without changes
File without changes