@viasat/beam-web-components 2.63.0 → 2.64.0
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/Accordion/Accordion.d.ts +1 -1
- package/Accordion/AccordionGroup.d.ts +1 -1
- package/Alert/Alert.d.ts +1 -1
- package/Avatar/Avatar.d.ts +1 -1
- package/Avatar/AvatarGroup.d.ts +1 -1
- package/Badge/Badge.d.ts +1 -1
- package/BadgeDot/BadgeDot.d.ts +1 -1
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/Breadcrumbs/BreadcrumbsItem.d.ts +1 -1
- package/Button/Button.d.ts +1 -1
- package/CloseButton/CloseButton.d.ts +1 -1
- package/EmptyState/EmptyState.d.ts +1 -1
- package/HelperText/HelperText.d.ts +1 -1
- package/Icon/Icon.d.ts +1 -1
- package/InputChoiceGroup/InputChoiceGroup.d.ts +1 -1
- package/Label/Label.d.ts +1 -1
- package/Link/Link.d.ts +1 -1
- package/List/List.d.ts +1 -1
- package/List/ListItem.d.ts +1 -1
- package/ProgressBar/ProgressBar.d.ts +1 -1
- package/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/SegmentedControl/SegmentedControlList.d.ts +1 -1
- package/SegmentedControl/SegmentedControlPanel.d.ts +1 -1
- package/Spinner/Spinner.d.ts +1 -1
- package/Text/Text.d.ts +1 -1
- package/Tooltip/Tooltip.d.ts +2 -2
- package/custom-elements.json +2595 -2586
- package/local/wip/Form/Form.decorator.js +55 -54
- package/package.json +6 -6
- package/vscode.html-custom-data.json +244 -244
- package/wip/Checkbox/Checkbox.d.ts +1 -1
- package/wip/FileUpload/FileUpload.Button.d.ts +1 -1
- package/wip/FileUpload/FileUpload.Dropzone.d.ts +1 -1
- package/wip/FileUpload/FileUpload.List.Item.d.ts +1 -1
- package/wip/FileUpload/FileUpload.List.d.ts +1 -1
- package/wip/FileUpload/FileUpload.d.ts +2 -2
- package/wip/Form/Form.d.ts +2 -2
- package/wip/Form/Form.decorator.d.ts +2 -2
- package/wip/Form/Form.decorator.js +53 -52
- package/wip/RadioButton/RadioButton.d.ts +2 -2
- package/wip/Switch/Switch.d.ts +2 -2
- package/wip/TextArea/TextArea.d.ts +1 -1
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var V = (r) => {
|
|
2
|
+
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { c as
|
|
7
|
-
import { a as
|
|
8
|
-
import { n as
|
|
9
|
-
import { r as
|
|
10
|
-
import { e as
|
|
11
|
-
import { b as
|
|
12
|
-
import { bmFormInitials as
|
|
13
|
-
import { createId as
|
|
4
|
+
var y = (r, a, t) => a.has(r) || V("Cannot " + t);
|
|
5
|
+
var f = (r, a, t) => (y(r, a, "read from private field"), t ? t.call(r) : a.get(r)), b = (r, a, t) => a.has(r) ? V("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(r) : a.set(r, t), m = (r, a, t, e) => (y(r, a, "write to private field"), e ? e.call(r, t) : a.set(r, t), t);
|
|
6
|
+
import { c as E } from "../../chunks/consume.Ce9k1-wN.js";
|
|
7
|
+
import { a as k, E as v, x } from "../../chunks/lit-element.CJtt9wj5.js";
|
|
8
|
+
import { n as d } from "../../chunks/register-custom-element.AOEv8hcs.js";
|
|
9
|
+
import { r as A } from "../../chunks/state.Dr3yBpId.js";
|
|
10
|
+
import { e as F } from "../../chunks/ref.B7e1Hu4F.js";
|
|
11
|
+
import { b as I } from "../../chunks/tokens.CTW8Tt94.js";
|
|
12
|
+
import { bmFormInitials as u, bmFormContext as S } from "./Form.context.js";
|
|
13
|
+
import { createId as p } from "./Form.utils.js";
|
|
14
14
|
import "../../chunks/index.BoeGm2HZ.js";
|
|
15
|
-
var
|
|
16
|
-
for (var i = void 0, s =
|
|
17
|
-
(
|
|
18
|
-
return i &&
|
|
19
|
-
},
|
|
20
|
-
const
|
|
15
|
+
var R = Object.defineProperty, l = (r, a, t, e) => {
|
|
16
|
+
for (var i = void 0, s = r.length - 1, c; s >= 0; s--)
|
|
17
|
+
(c = r[s]) && (i = c(a, t, i) || i);
|
|
18
|
+
return i && R(a, t, i), i;
|
|
19
|
+
}, n, h;
|
|
20
|
+
const C = class C extends k {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
b(this, n);
|
|
24
|
+
b(this, h);
|
|
25
|
+
this.labelId = p(), this.errorId = p(), this.helperTextId = p(), this.validationErrorsId = p(), this.internals = this.attachInternals(), this.formFieldRef = F(), this.id = "", this.name = "", this.value = "", this.validationRules = [], this._validationErrors = [], this.validationErrors = () => this._validationErrors, m(this, n, !1), this.setValidationErrors = (t) => {
|
|
25
26
|
this._validationErrors = t;
|
|
26
|
-
}, this.validationErrorShown = () => this.validationErrors().some((t) => !!(t != null && t.length)),
|
|
27
|
+
}, this.validationErrorShown = () => this.validationErrors().some((t) => !!(t != null && t.length)), m(this, h, /* @__PURE__ */ new WeakMap()), this.submitFormByEnter = ({ key: t }) => {
|
|
27
28
|
t === "Enter" && this.requestAssociatedSubmit();
|
|
28
29
|
}, this.forwardLabelFocus = () => {
|
|
29
30
|
const { value: t } = this.formFieldRef;
|
|
30
31
|
t.focus();
|
|
31
32
|
}, this.validateFieldOnBlur = (t) => {
|
|
32
|
-
const { formBlurHandler: e } = this.formContext ||
|
|
33
|
+
const { formBlurHandler: e } = this.formContext || u;
|
|
33
34
|
e(t);
|
|
34
35
|
}, this.validateFieldOnChange = (t) => {
|
|
35
|
-
const { value: e } = t.target, { formChangeHandler: i } = this.formContext ||
|
|
36
|
+
const { value: e } = t.target, { formChangeHandler: i } = this.formContext || u;
|
|
36
37
|
i(t), this.setAssociatedValue(e);
|
|
37
38
|
}, this.getContextValue = () => {
|
|
38
|
-
const { initialValues: t } = this.formContext ||
|
|
39
|
+
const { initialValues: t } = this.formContext || u;
|
|
39
40
|
return (t == null ? void 0 : t[this.name]) || this.value;
|
|
40
41
|
}, this.setContextValue = () => {
|
|
41
42
|
const { value: t } = this.formFieldRef, { ctxValue: e, finalizeCallback: i = () => {
|
|
42
43
|
} } = this.finalizeAssociatedCallback(this.getContextValue()), s = t;
|
|
43
44
|
s.value !== e && (s.value = e), this.setAssociatedValue(e), i();
|
|
44
45
|
}, this.setContextValidation = () => {
|
|
45
|
-
const { value: t } = this.formFieldRef, { registerField: e } = this.formContext ||
|
|
46
|
+
const { value: t } = this.formFieldRef, { registerField: e } = this.formContext || u;
|
|
46
47
|
e({
|
|
47
48
|
field: t,
|
|
48
49
|
validators: this.validationRules,
|
|
@@ -50,16 +51,16 @@ const b = class b extends E {
|
|
|
50
51
|
errorSetter: this.setValidationErrors
|
|
51
52
|
});
|
|
52
53
|
}, this.contextInitialsChanged = () => {
|
|
53
|
-
const { initialValues: t } = this.formContext ||
|
|
54
|
+
const { initialValues: t } = this.formContext || u, e = t == null ? void 0 : t[this.name], i = e !== this.contextInitialValue;
|
|
54
55
|
return i && (this.contextInitialValue = e), i;
|
|
55
|
-
}, this.renderError = (t, e) => t ?
|
|
56
|
+
}, this.renderError = (t, e) => t ? x`
|
|
56
57
|
<bm-helper-text
|
|
57
58
|
text="${t}"
|
|
58
59
|
id="${this.errorId}"
|
|
59
60
|
appearance="negative"
|
|
60
61
|
.disabled="${e}"
|
|
61
62
|
></bm-helper-text>
|
|
62
|
-
` :
|
|
63
|
+
` : v, this.renderValidationErrors = () => this.validationErrorShown() ? x`
|
|
63
64
|
<div
|
|
64
65
|
role="log"
|
|
65
66
|
aria-live="polite"
|
|
@@ -68,20 +69,20 @@ const b = class b extends E {
|
|
|
68
69
|
id="${this.validationErrorsId}"
|
|
69
70
|
>
|
|
70
71
|
${this.validationErrors().map(
|
|
71
|
-
(t) => t ?
|
|
72
|
+
(t) => t ? x`
|
|
72
73
|
<bm-helper-text
|
|
73
74
|
text="${t}"
|
|
74
75
|
appearance="negative"
|
|
75
|
-
style="display: block; margin-top: ${
|
|
76
|
+
style="display: block; margin-top: ${I};"
|
|
76
77
|
></bm-helper-text>
|
|
77
|
-
` :
|
|
78
|
+
` : v
|
|
78
79
|
)}
|
|
79
80
|
</div>
|
|
80
|
-
` :
|
|
81
|
+
` : v;
|
|
81
82
|
}
|
|
82
83
|
setAssociatedValue(t) {
|
|
83
84
|
if (typeof t == "string") {
|
|
84
|
-
if (this.value === t) return;
|
|
85
|
+
if (this.value === t && f(this, n)) return;
|
|
85
86
|
this.value = t;
|
|
86
87
|
}
|
|
87
88
|
let e = null;
|
|
@@ -94,7 +95,7 @@ const b = class b extends E {
|
|
|
94
95
|
t.forEach((s) => i.append(this.name, s.toString())), e = i;
|
|
95
96
|
} else
|
|
96
97
|
e = t;
|
|
97
|
-
this.internals.form && this.internals.setFormValue(e);
|
|
98
|
+
m(this, n, !0), this.internals.form && this.internals.setFormValue(e);
|
|
98
99
|
}
|
|
99
100
|
requestAssociatedSubmit() {
|
|
100
101
|
this.internals.form && this.internals.form.requestSubmit();
|
|
@@ -103,14 +104,14 @@ const b = class b extends E {
|
|
|
103
104
|
super.connectedCallback(), this.addEventListener("bm-label-click", this.forwardLabelFocus);
|
|
104
105
|
}
|
|
105
106
|
ctxValueChanged(t, e) {
|
|
106
|
-
const { value: i } = e, s =
|
|
107
|
-
return
|
|
107
|
+
const { value: i } = e, s = f(this, h).get(i), { initialValues: { [this.name]: c } = {} } = t, g = c !== s;
|
|
108
|
+
return g && f(this, h).set(i, c), g;
|
|
108
109
|
}
|
|
109
110
|
disconnectedCallback() {
|
|
110
111
|
super.disconnectedCallback(), this.removeEventListener("bm-label-click", this.forwardLabelFocus);
|
|
111
112
|
}
|
|
112
113
|
formAssociatedCallback() {
|
|
113
|
-
this.setAssociatedValue(this.value);
|
|
114
|
+
m(this, n, !1), this.setAssociatedValue(this.value);
|
|
114
115
|
}
|
|
115
116
|
formResetCallback() {
|
|
116
117
|
this.setContextValue();
|
|
@@ -120,29 +121,29 @@ const b = class b extends E {
|
|
|
120
121
|
} };
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
|
-
|
|
124
|
-
let o =
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
n = new WeakMap(), h = new WeakMap(), C.formAssociated = !0;
|
|
125
|
+
let o = C;
|
|
126
|
+
l([
|
|
127
|
+
d({ type: String })
|
|
127
128
|
], o.prototype, "id");
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
l([
|
|
130
|
+
d({ type: String, reflect: !0 })
|
|
130
131
|
], o.prototype, "name");
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
l([
|
|
133
|
+
d({ type: String })
|
|
133
134
|
], o.prototype, "value");
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
l([
|
|
136
|
+
d({ type: Array })
|
|
136
137
|
], o.prototype, "validationRules");
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
l([
|
|
139
|
+
d({ type: String, attribute: "input-aria-label" })
|
|
139
140
|
], o.prototype, "inputAriaLabel");
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
l([
|
|
142
|
+
E({ context: S, subscribe: !0 }),
|
|
143
|
+
d({ attribute: !1 })
|
|
143
144
|
], o.prototype, "formContext");
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
l([
|
|
146
|
+
A()
|
|
146
147
|
], o.prototype, "_validationErrors");
|
|
147
148
|
export {
|
|
148
149
|
o as FormField
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasat/beam-web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.64.0",
|
|
4
4
|
"description": "Framework-agnostic web components for the Beam Design System built with Lit, compatible with Angular, Vue, Svelte, and vanilla JavaScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Viasat",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@viasat/beam-fonts": "2.
|
|
68
|
-
"@viasat/beam-shared": "2.
|
|
69
|
-
"@viasat/beam-styles": "2.
|
|
70
|
-
"@viasat/beam-tokens": "2.
|
|
71
|
-
"@viasat/beam-icons": "2.
|
|
67
|
+
"@viasat/beam-fonts": "2.64.0",
|
|
68
|
+
"@viasat/beam-shared": "2.64.0",
|
|
69
|
+
"@viasat/beam-styles": "2.64.0",
|
|
70
|
+
"@viasat/beam-tokens": "2.64.0",
|
|
71
|
+
"@viasat/beam-icons": "2.64.0",
|
|
72
72
|
"clsx": "^1.2.1",
|
|
73
73
|
"lit": "^3.1.0",
|
|
74
74
|
"@lit/context": "^1.1.1",
|