@viasat/beam-web-components 2.73.0 → 2.75.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.js +3 -3
- package/Accordion/AccordionGroup.js +3 -3
- package/Accordion/index.js +1 -1
- package/Alert/Alert.js +5 -5
- package/Avatar/Avatar.js +2 -2
- package/Avatar/AvatarGroup.js +2 -2
- package/Avatar/index.js +1 -1
- package/Badge/Badge.js +2 -2
- package/BadgeDot/BadgeDot.js +2 -2
- package/Box/Box.js +2 -2
- package/Breadcrumbs/Breadcrumbs.js +3 -3
- package/Breadcrumbs/BreadcrumbsItem.js +3 -3
- package/Breadcrumbs/index.js +1 -1
- package/Button/Button.js +2 -2
- package/CloseButton/CloseButton.js +2 -2
- package/Divider/Divider.js +2 -2
- package/EmptyState/EmptyState.js +2 -2
- package/HelperText/HelperText.js +3 -3
- package/HelperText/index.js +1 -1
- package/Icon/Icon.js +2 -2
- package/InputChoiceGroup/InputChoiceGroup.js +2 -2
- package/Label/Label.js +2 -2
- package/Link/Link.js +2 -2
- package/List/List.js +2 -2
- package/List/ListItem.js +2 -2
- package/ProgressBar/ProgressBar.js +2 -2
- package/SegmentedControl/SegmentedControl.js +2 -2
- package/SegmentedControl/SegmentedControlItem.js +10 -10
- package/SegmentedControl/SegmentedControlList.js +2 -2
- package/SegmentedControl/SegmentedControlPanel.js +2 -2
- package/Spinner/Spinner.js +2 -2
- package/Text/Text.js +2 -2
- package/TextArea/TextArea.js +5 -5
- package/TextField/TextField.js +6 -6
- package/Tooltip/Tooltip.js +9 -9
- package/chunks/{Accordion.fbo-T2zU.js → Accordion.BF2pHMSP.js} +4 -4
- package/chunks/{Avatar.DkegKDfD.js → Avatar.kVWwOxWe.js} +2 -2
- package/chunks/{BreadcrumbsItem.kovG2GHz.js → BreadcrumbsItem.BmqxxC44.js} +2 -2
- package/chunks/{HelperText.Cc_6DlKP.js → HelperText.3YJvB8x0.js} +5 -5
- package/chunks/{register-custom-element.D_kw6JXe.js → classNames.BQclmCHG.js} +29 -34
- package/chunks/register-custom-element.DHGKOhmA.js +17 -0
- package/custom-elements.json +1428 -1428
- package/local/Accordion/Accordion.js +4 -4
- package/local/Accordion/AccordionGroup.js +4 -4
- package/local/Accordion/index.js +1 -1
- package/local/Alert/Alert.js +11 -11
- package/local/Avatar/Avatar.js +3 -3
- package/local/Avatar/AvatarGroup.js +3 -3
- package/local/Avatar/index.js +1 -1
- package/local/Badge/Badge.js +2 -2
- package/local/BadgeDot/BadgeDot.js +2 -2
- package/local/Box/Box.js +2 -2
- package/local/Breadcrumbs/Breadcrumbs.js +3 -3
- package/local/Breadcrumbs/BreadcrumbsItem.js +3 -3
- package/local/Breadcrumbs/index.js +1 -1
- package/local/Button/Button.js +3 -3
- package/local/CloseButton/CloseButton.js +2 -2
- package/local/Divider/Divider.js +7 -7
- package/local/EmptyState/EmptyState.js +2 -2
- package/local/HelperText/HelperText.js +3 -3
- package/local/HelperText/index.js +1 -1
- package/local/Icon/Icon.js +2 -2
- package/local/InputChoiceGroup/InputChoiceGroup.js +3 -3
- package/local/Label/Label.js +2 -2
- package/local/Link/Link.js +2 -2
- package/local/List/List.js +3 -3
- package/local/List/ListItem.js +3 -3
- package/local/ProgressBar/ProgressBar.js +2 -2
- package/local/SegmentedControl/SegmentedControl.js +3 -3
- package/local/SegmentedControl/SegmentedControlItem.js +7 -7
- package/local/SegmentedControl/SegmentedControlList.js +2 -2
- package/local/SegmentedControl/SegmentedControlPanel.js +2 -2
- package/local/Spinner/Spinner.js +2 -2
- package/local/Text/Text.js +2 -2
- package/local/TextArea/TextArea.js +9 -9
- package/local/TextField/TextField.js +7 -7
- package/local/Tooltip/Tooltip.js +8 -8
- package/local/chunks/{Accordion.QupR4x7N.js → Accordion.DM6Nkgnh.js} +9 -9
- package/local/chunks/{Avatar.D0_A6fGG.js → Avatar.BT61pkbV.js} +2 -2
- package/local/chunks/{BreadcrumbsItem.Ds7TtgQn.js → BreadcrumbsItem.CsPbcOZ5.js} +2 -2
- package/local/chunks/classNames.CARKFDmR.js +106 -0
- package/local/chunks/{index.BoeGm2HZ.js → index.CUGawMXL.js} +8 -8
- package/local/chunks/register-custom-element.vod7zfGv.js +51 -0
- package/local/chunks/{state.Dr3yBpId.js → state.CqiuSzAl.js} +1 -1
- package/local/wip/Checkbox/Checkbox.js +2 -2
- package/local/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -1
- package/local/wip/FileUpload/FileUpload.Button.js +2 -2
- package/local/wip/FileUpload/FileUpload.Dropzone.js +3 -3
- package/local/wip/FileUpload/FileUpload.List.Item.js +3 -3
- package/local/wip/FileUpload/FileUpload.List.js +2 -2
- package/local/wip/FileUpload/FileUpload.js +8 -8
- package/local/wip/Form/Form.decorator.js +3 -3
- package/local/wip/Form/Form.js +183 -161
- package/local/wip/NativeSelect/NativeSelect.js +10 -10
- package/local/wip/RadioButton/RadioButton.js +2 -2
- package/local/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/local/wip/Switch/Switch.js +2 -2
- package/local/wip/Switch/SwitchGroup/SwitchGroup.js +1 -1
- package/package.json +6 -6
- package/vscode.html-custom-data.json +226 -226
- package/wip/Checkbox/Checkbox.js +2 -2
- package/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -1
- package/wip/FileUpload/FileUpload.Button.js +2 -2
- package/wip/FileUpload/FileUpload.Dropzone.js +2 -2
- package/wip/FileUpload/FileUpload.List.Item.js +3 -3
- package/wip/FileUpload/FileUpload.List.js +2 -2
- package/wip/FileUpload/FileUpload.js +12 -12
- package/wip/Form/Form.decorator.js +1 -1
- package/wip/Form/Form.js +184 -162
- package/wip/NativeSelect/NativeSelect.js +9 -9
- package/wip/RadioButton/RadioButton.js +2 -2
- package/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/wip/Switch/Switch.js +5 -5
- package/wip/Switch/SwitchGroup/SwitchGroup.js +1 -1
- package/chunks/classNames.m6VYRyOu.js +0 -18
- package/local/chunks/classNames.Ciobzb4w.js +0 -30
- package/local/chunks/register-custom-element.AOEv8hcs.js +0 -133
|
@@ -5,10 +5,10 @@ import { createRef as u, ref as g } from "lit/directives/ref.js";
|
|
|
5
5
|
import { unsafeSVG as b } from "lit/directives/unsafe-svg.js";
|
|
6
6
|
import E from "clsx";
|
|
7
7
|
import { U as _ } from "../../chunks/Upload.B9YEyp7b.js";
|
|
8
|
-
import { g as R } from "../../chunks/classNames.
|
|
8
|
+
import { g as R } from "../../chunks/classNames.BQclmCHG.js";
|
|
9
9
|
import { t as S } from "../../chunks/constants.ZIKMMCJH.js";
|
|
10
10
|
import { f as I } from "../../chunks/fileUpload.module.WyOEuxoP.js";
|
|
11
|
-
import { c as U } from "../../chunks/register-custom-element.
|
|
11
|
+
import { c as U } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
12
12
|
import { stateLayerStyles as w, stateLayerClassName as P } from "../../StateLayer/StateLayer.js";
|
|
13
13
|
import { fileUploadContext as k } from "./FileUploadContext.js";
|
|
14
14
|
import "../../Icon/Icon.js";
|
|
@@ -4,12 +4,12 @@ import { property as p } from "lit/decorators.js";
|
|
|
4
4
|
import { createRef as _, ref as C } from "lit/directives/ref.js";
|
|
5
5
|
import { unsafeSVG as y } from "lit/directives/unsafe-svg.js";
|
|
6
6
|
import M from "clsx";
|
|
7
|
-
import { C as R, E as W } from "../../chunks/HelperText.
|
|
8
|
-
import { g as D } from "../../chunks/classNames.
|
|
7
|
+
import { C as R, E as W } from "../../chunks/HelperText.3YJvB8x0.js";
|
|
8
|
+
import { g as D } from "../../chunks/classNames.BQclmCHG.js";
|
|
9
9
|
import { t as H, p as U } from "../../chunks/constants.ZIKMMCJH.js";
|
|
10
10
|
import { f as O } from "../../chunks/fileUpload.module.WyOEuxoP.js";
|
|
11
11
|
import { a as V, c as k } from "../../chunks/tokens.CTW8Tt94.js";
|
|
12
|
-
import { c as A } from "../../chunks/register-custom-element.
|
|
12
|
+
import { c as A } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
13
13
|
import { fileUploadListContext as G } from "./FileUploadListContext.js";
|
|
14
14
|
import "../../Icon/Icon.js";
|
|
15
15
|
import "../../Tooltip/Tooltip.js";
|
|
@@ -2,10 +2,10 @@ import { provide as c, consume as u } from "@lit/context";
|
|
|
2
2
|
import { unsafeCSS as x, LitElement as C, html as m } from "lit";
|
|
3
3
|
import { property as n } from "lit/decorators.js";
|
|
4
4
|
import v from "clsx";
|
|
5
|
-
import { g as b } from "../../chunks/classNames.
|
|
5
|
+
import { g as b } from "../../chunks/classNames.BQclmCHG.js";
|
|
6
6
|
import { t as g } from "../../chunks/constants.ZIKMMCJH.js";
|
|
7
7
|
import { f as y } from "../../chunks/fileUpload.module.WyOEuxoP.js";
|
|
8
|
-
import { c as _ } from "../../chunks/register-custom-element.
|
|
8
|
+
import { c as _ } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
9
9
|
import { fileUploadContext as S } from "./FileUploadContext.js";
|
|
10
10
|
import { fileUploadListContext as $ } from "./FileUploadListContext.js";
|
|
11
11
|
import "./FileUpload.List.Item.js";
|
|
@@ -4,15 +4,15 @@ import { property as c, queryAssignedElements as N, state as P } from "lit/decor
|
|
|
4
4
|
import { createRef as Q } from "lit/directives/ref.js";
|
|
5
5
|
import X from "clsx";
|
|
6
6
|
import { t as Y } from "../../chunks/constants.ZIKMMCJH.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { p as Z, a as q, g as ee, d as z } from "../../chunks/classNames.BQclmCHG.js";
|
|
8
|
+
import { f as te } from "../../chunks/fileUpload.module.WyOEuxoP.js";
|
|
9
|
+
import { d as ie } from "../../chunks/tokens.CTW8Tt94.js";
|
|
10
|
+
import { r as re } from "../../chunks/delegate.baxDQosr.js";
|
|
11
|
+
import { c as se } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
12
12
|
import { bmFormContext as oe, bmFormInitials as H } from "../Form/Form.context.js";
|
|
13
13
|
import { FormField as ae } from "../Form/Form.decorator.js";
|
|
14
14
|
import { fileUploadContext as le } from "./FileUploadContext.js";
|
|
15
|
-
import "../../chunks/HelperText.
|
|
15
|
+
import "../../chunks/HelperText.3YJvB8x0.js";
|
|
16
16
|
import "./FileUpload.Dropzone.js";
|
|
17
17
|
import "./FileUpload.List.js";
|
|
18
18
|
var ne = function(e, t) {
|
|
@@ -219,7 +219,7 @@ var be = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, j = (e) =>
|
|
|
219
219
|
(p = e[n]) && (s = (r ? p(t, i, s) : p(s)) || s);
|
|
220
220
|
return r && s && be(t, i, s), s;
|
|
221
221
|
}, we = (e, t, i) => t.has(e) || j("Cannot " + i), o = (e, t, i) => (we(e, t, "read from private field"), i ? i.call(e) : t.get(e)), h = (e, t, i) => t.has(e) ? j("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), u, L, A, S, T, W, E, _, I, F, M, R, D, B, U, O;
|
|
222
|
-
const { baseClassNamePrefix: Se, classModifierPrefix: g, subElementClassPrefix: w } =
|
|
222
|
+
const { baseClassNamePrefix: Se, classModifierPrefix: g, subElementClassPrefix: w } = ee("file-upload");
|
|
223
223
|
class _e extends CustomEvent {
|
|
224
224
|
constructor(t, i, r) {
|
|
225
225
|
super("bm-selected", {
|
|
@@ -304,7 +304,7 @@ let a = class extends ae {
|
|
|
304
304
|
ctxError: !!this.error,
|
|
305
305
|
ctxDisabled: o(this, u).call(this)
|
|
306
306
|
};
|
|
307
|
-
const e = this.fluid ? "100%" : this.width ??
|
|
307
|
+
const e = this.fluid ? "100%" : this.width ?? ie;
|
|
308
308
|
o(this, _).replace(`:host { width: ${e}; }`);
|
|
309
309
|
}
|
|
310
310
|
firstUpdated() {
|
|
@@ -320,7 +320,7 @@ let a = class extends ae {
|
|
|
320
320
|
}
|
|
321
321
|
updated(e) {
|
|
322
322
|
const [t] = this._textFieldLabel, [i] = this._textFieldHelperText, { decorate: r } = q(t), { decorate: s } = q(i);
|
|
323
|
-
|
|
323
|
+
Z(e, ["formContext"]) && this.ctxValueChanged(this.formContext, this.pickerRef) && o(this, F).call(this), s({ disabled: o(this, u).call(this) }), r({
|
|
324
324
|
disabled: o(this, u).call(this),
|
|
325
325
|
required: o(this, A).call(this) && !this.hideRequiredMarker
|
|
326
326
|
});
|
|
@@ -374,8 +374,8 @@ D = /* @__PURE__ */ new WeakMap();
|
|
|
374
374
|
B = /* @__PURE__ */ new WeakMap();
|
|
375
375
|
U = /* @__PURE__ */ new WeakMap();
|
|
376
376
|
O = /* @__PURE__ */ new WeakMap();
|
|
377
|
-
a.styles = J(
|
|
378
|
-
|
|
377
|
+
a.styles = J(te);
|
|
378
|
+
re(a);
|
|
379
379
|
l([
|
|
380
380
|
c({ type: String })
|
|
381
381
|
], a.prototype, "accept", 2);
|
|
@@ -443,7 +443,7 @@ l([
|
|
|
443
443
|
P()
|
|
444
444
|
], a.prototype, "_hasFilesListSlot", 2);
|
|
445
445
|
a = l([
|
|
446
|
-
|
|
446
|
+
se("bm-file-upload")
|
|
447
447
|
], a);
|
|
448
448
|
export {
|
|
449
449
|
a as BmFileUpload,
|
|
@@ -10,7 +10,7 @@ import { createRef as I } from "lit/directives/ref.js";
|
|
|
10
10
|
import { b as S } from "../../chunks/tokens.CTW8Tt94.js";
|
|
11
11
|
import { bmFormInitials as p, bmFormContext as R } from "./Form.context.js";
|
|
12
12
|
import { createId as b } from "./Form.utils.js";
|
|
13
|
-
import "../../chunks/HelperText.
|
|
13
|
+
import "../../chunks/HelperText.3YJvB8x0.js";
|
|
14
14
|
var w = Object.defineProperty, l = (e, s, t, i) => {
|
|
15
15
|
for (var r = void 0, a = e.length - 1, n; a >= 0; a--)
|
|
16
16
|
(n = e[a]) && (r = n(s, t, r) || r);
|
package/wip/Form/Form.js
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
import { provide as
|
|
2
|
-
import { LitElement as
|
|
3
|
-
import { property as d, state as
|
|
4
|
-
import { createRef as N, ref as
|
|
5
|
-
import {
|
|
6
|
-
import { bmFormContext as
|
|
7
|
-
const P =
|
|
8
|
-
|
|
1
|
+
import { provide as V } from "@lit/context";
|
|
2
|
+
import { LitElement as $, html as D } from "lit";
|
|
3
|
+
import { property as d, state as L } from "lit/decorators.js";
|
|
4
|
+
import { createRef as N, ref as H } from "lit/directives/ref.js";
|
|
5
|
+
import { c as K } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
6
|
+
import { bmFormContext as T, bmFormInitials as q } from "./Form.context.js";
|
|
7
|
+
const G = 100, P = (e, t, r = G) => {
|
|
8
|
+
const o = /* @__PURE__ */ new Map();
|
|
9
|
+
return Object.assign((...n) => {
|
|
10
|
+
const a = e(...n);
|
|
11
|
+
if (o.has(a)) {
|
|
12
|
+
const c = o.get(a);
|
|
13
|
+
return o.delete(a), o.set(a, c), c;
|
|
14
|
+
}
|
|
15
|
+
const i = t(...n);
|
|
16
|
+
return o.set(a, i), o.size > r && o.delete(o.keys().next().value), i;
|
|
17
|
+
}, { clear: () => o.clear() });
|
|
18
|
+
}, W = (e, t, r) => e * 1e4 + t * 100 + r, S = (e) => W(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
19
|
+
P(
|
|
20
|
+
(e) => e,
|
|
21
|
+
(e) => {
|
|
22
|
+
try {
|
|
23
|
+
return new Intl.Locale(e).toString();
|
|
24
|
+
} catch {
|
|
25
|
+
return e.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const R = async (e, t) => (await Promise.all(
|
|
30
|
+
t.map(
|
|
9
31
|
async (o) => {
|
|
10
32
|
const { validator: s } = o;
|
|
11
|
-
return s(
|
|
33
|
+
return s(e);
|
|
12
34
|
}
|
|
13
35
|
)
|
|
14
36
|
)).reduce(
|
|
@@ -17,31 +39,31 @@ const P = async (t, e) => (await Promise.all(
|
|
|
17
39
|
return n ? [...o, a] : o;
|
|
18
40
|
},
|
|
19
41
|
[]
|
|
20
|
-
), F = (
|
|
21
|
-
const { type:
|
|
42
|
+
), F = (e) => {
|
|
43
|
+
const { type: t, checked: r } = e, o = t === "checkbox";
|
|
22
44
|
if (o)
|
|
23
45
|
return {
|
|
24
46
|
isCheckBoxGroup: o,
|
|
25
|
-
selectedBoxes: r ? [
|
|
47
|
+
selectedBoxes: r ? [e] : []
|
|
26
48
|
};
|
|
27
|
-
const s = Array.from(
|
|
28
|
-
const { type: p } =
|
|
49
|
+
const s = Array.from(e), n = s.every((c) => {
|
|
50
|
+
const { type: p } = c;
|
|
29
51
|
return p === "checkbox";
|
|
30
52
|
}), a = !!s.length && n;
|
|
31
53
|
if (!a) return { isCheckBoxGroup: a, selectedBoxes: [] };
|
|
32
|
-
const
|
|
33
|
-
({ checked:
|
|
54
|
+
const i = s.filter(
|
|
55
|
+
({ checked: c }) => c
|
|
34
56
|
);
|
|
35
|
-
return { isCheckBoxGroup: a, selectedBoxes:
|
|
36
|
-
}, E = (
|
|
37
|
-
const { type:
|
|
57
|
+
return { isCheckBoxGroup: a, selectedBoxes: i };
|
|
58
|
+
}, E = (e) => {
|
|
59
|
+
const { type: t, multiple: r, options: o } = e, s = t === "select-multiple" && r;
|
|
38
60
|
if (!s) return { isMultiSelect: s, selectedOptions: [] };
|
|
39
61
|
const n = [].filter.call(
|
|
40
62
|
o,
|
|
41
63
|
({ selected: a }) => a
|
|
42
64
|
);
|
|
43
65
|
return { isMultiSelect: s, selectedOptions: n };
|
|
44
|
-
},
|
|
66
|
+
}, j = new RegExp(
|
|
45
67
|
[
|
|
46
68
|
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:",
|
|
47
69
|
"\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:",
|
|
@@ -55,130 +77,130 @@ const P = async (t, e) => (await Promise.all(
|
|
|
55
77
|
"[-\b\v\f-!-ZS-]|\\\\[-",
|
|
56
78
|
" \v\f-])+)\\])"
|
|
57
79
|
].join("")
|
|
58
|
-
),
|
|
80
|
+
), I = (e) => ({
|
|
59
81
|
name: "min",
|
|
60
|
-
validator: (
|
|
61
|
-
const { value: r, message: o } =
|
|
82
|
+
validator: (t) => {
|
|
83
|
+
const { value: r, message: o } = e, { value: s } = t;
|
|
62
84
|
return { error: !!s && Number(s) < r, message: o };
|
|
63
85
|
}
|
|
64
|
-
}),
|
|
86
|
+
}), A = (e) => ({
|
|
65
87
|
name: "max",
|
|
66
|
-
validator: (
|
|
67
|
-
const { value: r, message: o } =
|
|
88
|
+
validator: (t) => {
|
|
89
|
+
const { value: r, message: o } = e, { value: s } = t;
|
|
68
90
|
return { error: !!s && Number(s) > r, message: o };
|
|
69
91
|
}
|
|
70
|
-
}),
|
|
92
|
+
}), U = (e) => ({
|
|
71
93
|
name: "email",
|
|
72
|
-
validator: (
|
|
73
|
-
const { message: r } =
|
|
74
|
-
return { error: !!o && !
|
|
94
|
+
validator: (t) => {
|
|
95
|
+
const { message: r } = e || {}, { value: o } = t;
|
|
96
|
+
return { error: !!o && !j.test(o), message: r };
|
|
75
97
|
}
|
|
76
|
-
}),
|
|
98
|
+
}), Y = (e) => ({
|
|
77
99
|
name: "pattern",
|
|
78
|
-
validator: (
|
|
79
|
-
const { pattern: r, message: o } =
|
|
100
|
+
validator: (t) => {
|
|
101
|
+
const { pattern: r, message: o } = e, { value: s } = t;
|
|
80
102
|
return { error: !!s && !s.match(r), message: o };
|
|
81
103
|
}
|
|
82
|
-
}),
|
|
104
|
+
}), Z = (e) => ({
|
|
83
105
|
name: "required",
|
|
84
|
-
validator: (
|
|
85
|
-
const { message: r } =
|
|
106
|
+
validator: (t) => {
|
|
107
|
+
const { message: r } = e || {}, { value: o } = t, {
|
|
86
108
|
isCheckBoxGroup: s,
|
|
87
109
|
selectedBoxes: { length: n }
|
|
88
|
-
} = F(
|
|
110
|
+
} = F(t);
|
|
89
111
|
if (s) return { error: !n, message: r };
|
|
90
112
|
const {
|
|
91
113
|
isMultiSelect: a,
|
|
92
|
-
selectedOptions: { length:
|
|
93
|
-
} = E(
|
|
94
|
-
return a ? { error: !
|
|
114
|
+
selectedOptions: { length: i }
|
|
115
|
+
} = E(t);
|
|
116
|
+
return a ? { error: !i, message: r } : { error: !o, message: r };
|
|
95
117
|
}
|
|
96
|
-
}),
|
|
118
|
+
}), J = (e) => ({
|
|
97
119
|
name: "minLength",
|
|
98
|
-
validator: (
|
|
99
|
-
const { length: r, message: o } =
|
|
120
|
+
validator: (t) => {
|
|
121
|
+
const { length: r, message: o } = e, { value: s } = t, n = !!s && s.length < r, {
|
|
100
122
|
isCheckBoxGroup: a,
|
|
101
|
-
selectedBoxes: { length:
|
|
102
|
-
} = F(
|
|
123
|
+
selectedBoxes: { length: i }
|
|
124
|
+
} = F(t);
|
|
103
125
|
if (a)
|
|
104
|
-
return { error: !!
|
|
126
|
+
return { error: !!i && i < r, message: o };
|
|
105
127
|
const {
|
|
106
|
-
isMultiSelect:
|
|
128
|
+
isMultiSelect: c,
|
|
107
129
|
selectedOptions: { length: p }
|
|
108
|
-
} = E(
|
|
109
|
-
return
|
|
130
|
+
} = E(t);
|
|
131
|
+
return c ? { error: !!p && p < r, message: o } : { error: n, message: o };
|
|
110
132
|
}
|
|
111
|
-
}),
|
|
133
|
+
}), Q = (e) => ({
|
|
112
134
|
name: "maxLength",
|
|
113
|
-
validator: (
|
|
114
|
-
const { length: r, message: o } =
|
|
135
|
+
validator: (t) => {
|
|
136
|
+
const { length: r, message: o } = e, { value: s } = t, n = !!s && s.length > r, {
|
|
115
137
|
isCheckBoxGroup: a,
|
|
116
|
-
selectedBoxes: { length:
|
|
117
|
-
} = F(
|
|
138
|
+
selectedBoxes: { length: i }
|
|
139
|
+
} = F(t);
|
|
118
140
|
if (a)
|
|
119
|
-
return { error: !!
|
|
141
|
+
return { error: !!i && i > r, message: o };
|
|
120
142
|
const {
|
|
121
|
-
isMultiSelect:
|
|
143
|
+
isMultiSelect: c,
|
|
122
144
|
selectedOptions: { length: p }
|
|
123
|
-
} = E(
|
|
124
|
-
return
|
|
145
|
+
} = E(t);
|
|
146
|
+
return c ? { error: !!p && p > r, message: o } : { error: n, message: o };
|
|
125
147
|
}
|
|
126
|
-
}),
|
|
148
|
+
}), X = (e) => ({
|
|
127
149
|
name: "define",
|
|
128
|
-
validator: (
|
|
129
|
-
}),
|
|
130
|
-
const
|
|
131
|
-
return
|
|
132
|
-
},
|
|
150
|
+
validator: (t) => e(t)
|
|
151
|
+
}), ee = (e) => {
|
|
152
|
+
const t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
153
|
+
return t ? W(Number(t[1]), Number(t[2]), Number(t[3])) : null;
|
|
154
|
+
}, te = (e) => ({
|
|
133
155
|
name: "dateRange",
|
|
134
|
-
validator: (
|
|
135
|
-
const { min: r, max: o, message: s } =
|
|
156
|
+
validator: (t) => {
|
|
157
|
+
const { min: r, max: o, message: s } = e, { value: n } = t, a = n ? ee(n) : null;
|
|
136
158
|
if (a === null) return { error: !1, message: s };
|
|
137
|
-
const
|
|
138
|
-
return
|
|
159
|
+
const i = r && !Number.isNaN(r.getTime()) ? S(r) : null, c = o && !Number.isNaN(o.getTime()) ? S(o) : null;
|
|
160
|
+
return i !== null && c !== null && i > c ? { error: !1, message: s } : { error: i !== null && a < i || c !== null && a > c, message: s };
|
|
139
161
|
}
|
|
140
|
-
}),
|
|
141
|
-
min:
|
|
142
|
-
max:
|
|
143
|
-
email:
|
|
144
|
-
define:
|
|
145
|
-
pattern:
|
|
146
|
-
required:
|
|
147
|
-
minLength:
|
|
148
|
-
maxLength:
|
|
149
|
-
dateRange:
|
|
162
|
+
}), ue = {
|
|
163
|
+
min: I,
|
|
164
|
+
max: A,
|
|
165
|
+
email: U,
|
|
166
|
+
define: X,
|
|
167
|
+
pattern: Y,
|
|
168
|
+
required: Z,
|
|
169
|
+
minLength: J,
|
|
170
|
+
maxLength: Q,
|
|
171
|
+
dateRange: te
|
|
150
172
|
};
|
|
151
|
-
var
|
|
152
|
-
throw TypeError(
|
|
153
|
-
},
|
|
154
|
-
for (var s = o > 1 ? void 0 : o ?
|
|
155
|
-
(a =
|
|
156
|
-
return o && s &&
|
|
157
|
-
},
|
|
158
|
-
let
|
|
173
|
+
var re = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, z = (e) => {
|
|
174
|
+
throw TypeError(e);
|
|
175
|
+
}, m = (e, t, r, o) => {
|
|
176
|
+
for (var s = o > 1 ? void 0 : o ? oe(t, r) : t, n = e.length - 1, a; n >= 0; n--)
|
|
177
|
+
(a = e[n]) && (s = (o ? a(t, r, s) : a(s)) || s);
|
|
178
|
+
return o && s && re(t, r, s), s;
|
|
179
|
+
}, se = (e, t, r) => t.has(e) || z("Cannot " + r), l = (e, t, r) => (se(e, t, "read from private field"), r ? r.call(e) : t.get(e)), u = (e, t, r) => t.has(e) ? z("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), y, x, g, w, f, _, v, k, b, B, C, O;
|
|
180
|
+
let h = class extends $ {
|
|
159
181
|
constructor() {
|
|
160
|
-
super(...arguments), this.validationMode = "onBlur", this.initialValues = {}, this.required = !1, this.disabled = !1, this.readOnly = !1, this.formMeta = {}, this.formRef = N(), this._actionFired = !1,
|
|
161
|
-
const { field:
|
|
162
|
-
r && (this.formMeta = { ...this.formMeta, [r]:
|
|
163
|
-
}),
|
|
164
|
-
const { validators:
|
|
165
|
-
|
|
166
|
-
}),
|
|
167
|
-
Object.keys(this.formMeta).forEach((
|
|
168
|
-
const { initializer:
|
|
169
|
-
|
|
182
|
+
super(...arguments), this.validationMode = "onBlur", this.initialValues = {}, this.required = !1, this.disabled = !1, this.readOnly = !1, this.formMeta = {}, this.formRef = N(), this._actionFired = !1, u(this, y, () => !!this._actionFired), this.formContext = q, u(this, x, (e) => {
|
|
183
|
+
const { field: t } = e, { name: r } = t;
|
|
184
|
+
r && (this.formMeta = { ...this.formMeta, [r]: e });
|
|
185
|
+
}), u(this, g, (e) => {
|
|
186
|
+
const { validators: t, errorSetter: r } = this.formMeta[e] || {};
|
|
187
|
+
t != null && t.length && r([]);
|
|
188
|
+
}), u(this, w, () => {
|
|
189
|
+
Object.keys(this.formMeta).forEach((e) => {
|
|
190
|
+
const { initializer: t } = this.formMeta[e];
|
|
191
|
+
t(), l(this, g).call(this, e);
|
|
170
192
|
});
|
|
171
|
-
}),
|
|
172
|
-
const { field:
|
|
193
|
+
}), u(this, f, async (e) => {
|
|
194
|
+
const { field: t, validators: r, errorSetter: o } = this.formMeta[e] || {}, { disabled: s } = t || {};
|
|
173
195
|
if (!(r != null && r.length) || s) return [];
|
|
174
|
-
const n = await
|
|
196
|
+
const n = await R(t, r);
|
|
175
197
|
return o(n), n;
|
|
176
|
-
}),
|
|
198
|
+
}), u(this, _, async () => await Promise.all(
|
|
177
199
|
Object.keys(this.formMeta).map(
|
|
178
|
-
async (
|
|
200
|
+
async (e) => await l(this, f).call(this, e)
|
|
179
201
|
)
|
|
180
|
-
)),
|
|
181
|
-
(await
|
|
202
|
+
)), u(this, v, async () => {
|
|
203
|
+
(await l(this, _).call(this)).some((r) => !!r.length) || this.dispatchEvent(
|
|
182
204
|
new CustomEvent("submit", {
|
|
183
205
|
bubbles: !0,
|
|
184
206
|
composed: !0,
|
|
@@ -190,55 +212,55 @@ let c = class extends L {
|
|
|
190
212
|
}, {})
|
|
191
213
|
})
|
|
192
214
|
);
|
|
193
|
-
}),
|
|
194
|
-
if (
|
|
195
|
-
this._actionFired = !
|
|
215
|
+
}), u(this, k, async ({ target: e }) => {
|
|
216
|
+
if (l(this, y).call(this)) {
|
|
217
|
+
this._actionFired = !l(this, y).call(this);
|
|
196
218
|
return;
|
|
197
219
|
}
|
|
198
|
-
const { name:
|
|
199
|
-
this.validationMode === "onBlur" && await
|
|
200
|
-
}),
|
|
201
|
-
const { name:
|
|
202
|
-
this.validationMode === "onChange" ? await
|
|
203
|
-
}),
|
|
204
|
-
const { type:
|
|
205
|
-
switch (
|
|
220
|
+
const { name: t } = e;
|
|
221
|
+
this.validationMode === "onBlur" && await l(this, f).call(this, t);
|
|
222
|
+
}), u(this, b, async ({ target: e }) => {
|
|
223
|
+
const { name: t } = e;
|
|
224
|
+
this.validationMode === "onChange" ? await l(this, f).call(this, t) : l(this, g).call(this, t);
|
|
225
|
+
}), u(this, B, async ({ target: e }) => {
|
|
226
|
+
const { type: t } = e;
|
|
227
|
+
switch (t) {
|
|
206
228
|
case "reset":
|
|
207
|
-
return
|
|
229
|
+
return l(this, w).call(this);
|
|
208
230
|
case "submit":
|
|
209
|
-
return
|
|
231
|
+
return l(this, v).call(this);
|
|
210
232
|
}
|
|
211
|
-
}),
|
|
212
|
-
const { target:
|
|
213
|
-
r === "Enter" && this.formMeta[o] && await
|
|
214
|
-
}),
|
|
215
|
-
const
|
|
233
|
+
}), u(this, C, async (e) => {
|
|
234
|
+
const { target: t, key: r } = e, { name: o } = t;
|
|
235
|
+
r === "Enter" && this.formMeta[o] && await l(this, v).call(this);
|
|
236
|
+
}), u(this, O, (e) => {
|
|
237
|
+
const t = e.target, { name: r } = document.activeElement || {}, o = t.closest("[type=reset]") || t.closest("[type=submit]");
|
|
216
238
|
this.formMeta[r] && (this._actionFired = !!o);
|
|
217
239
|
});
|
|
218
240
|
}
|
|
219
|
-
willUpdate(
|
|
220
|
-
Object.keys(this.formContext).some((o) =>
|
|
241
|
+
willUpdate(e) {
|
|
242
|
+
Object.keys(this.formContext).some((o) => e.has(o)) && (this.formContext = {
|
|
221
243
|
required: this.required,
|
|
222
244
|
readOnly: this.readOnly,
|
|
223
245
|
disabled: this.disabled,
|
|
224
246
|
initialValues: this.initialValues,
|
|
225
|
-
registerField:
|
|
226
|
-
formBlurHandler:
|
|
227
|
-
formChangeHandler:
|
|
247
|
+
registerField: l(this, x),
|
|
248
|
+
formBlurHandler: l(this, k),
|
|
249
|
+
formChangeHandler: l(this, b)
|
|
228
250
|
});
|
|
229
251
|
}
|
|
230
252
|
render() {
|
|
231
|
-
return
|
|
253
|
+
return D`
|
|
232
254
|
<form
|
|
233
255
|
novalidate
|
|
234
|
-
${
|
|
256
|
+
${H(this.formRef)}
|
|
235
257
|
action="${this.action}"
|
|
236
258
|
method="${this.method}"
|
|
237
259
|
target="${this.target}"
|
|
238
260
|
enctype="${this.enctype}"
|
|
239
|
-
@click="${
|
|
240
|
-
@keydown="${
|
|
241
|
-
@mousedown="${
|
|
261
|
+
@click="${l(this, B)}"
|
|
262
|
+
@keydown="${l(this, C)}"
|
|
263
|
+
@mousedown="${l(this, O)}"
|
|
242
264
|
>
|
|
243
265
|
<slot></slot>
|
|
244
266
|
</form>
|
|
@@ -246,55 +268,55 @@ let c = class extends L {
|
|
|
246
268
|
}
|
|
247
269
|
};
|
|
248
270
|
y = /* @__PURE__ */ new WeakMap();
|
|
249
|
-
|
|
271
|
+
x = /* @__PURE__ */ new WeakMap();
|
|
250
272
|
g = /* @__PURE__ */ new WeakMap();
|
|
251
273
|
w = /* @__PURE__ */ new WeakMap();
|
|
252
274
|
f = /* @__PURE__ */ new WeakMap();
|
|
253
275
|
_ = /* @__PURE__ */ new WeakMap();
|
|
254
276
|
v = /* @__PURE__ */ new WeakMap();
|
|
255
|
-
b = /* @__PURE__ */ new WeakMap();
|
|
256
277
|
k = /* @__PURE__ */ new WeakMap();
|
|
278
|
+
b = /* @__PURE__ */ new WeakMap();
|
|
257
279
|
B = /* @__PURE__ */ new WeakMap();
|
|
258
280
|
C = /* @__PURE__ */ new WeakMap();
|
|
259
281
|
O = /* @__PURE__ */ new WeakMap();
|
|
260
|
-
|
|
282
|
+
m([
|
|
261
283
|
d({ type: String })
|
|
262
|
-
],
|
|
263
|
-
|
|
284
|
+
], h.prototype, "validationMode", 2);
|
|
285
|
+
m([
|
|
264
286
|
d({ type: Object })
|
|
265
|
-
],
|
|
266
|
-
|
|
287
|
+
], h.prototype, "initialValues", 2);
|
|
288
|
+
m([
|
|
267
289
|
d({ type: Boolean })
|
|
268
|
-
],
|
|
269
|
-
|
|
290
|
+
], h.prototype, "required", 2);
|
|
291
|
+
m([
|
|
270
292
|
d({ type: Boolean })
|
|
271
|
-
],
|
|
272
|
-
|
|
293
|
+
], h.prototype, "disabled", 2);
|
|
294
|
+
m([
|
|
273
295
|
d({ type: Boolean })
|
|
274
|
-
],
|
|
275
|
-
|
|
296
|
+
], h.prototype, "readOnly", 2);
|
|
297
|
+
m([
|
|
276
298
|
d({ type: String })
|
|
277
|
-
],
|
|
278
|
-
|
|
299
|
+
], h.prototype, "action", 2);
|
|
300
|
+
m([
|
|
279
301
|
d({ type: String })
|
|
280
|
-
],
|
|
281
|
-
|
|
302
|
+
], h.prototype, "method", 2);
|
|
303
|
+
m([
|
|
282
304
|
d({ type: String })
|
|
283
|
-
],
|
|
284
|
-
|
|
305
|
+
], h.prototype, "target", 2);
|
|
306
|
+
m([
|
|
285
307
|
d({ type: String })
|
|
286
|
-
],
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
],
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
],
|
|
294
|
-
|
|
308
|
+
], h.prototype, "enctype", 2);
|
|
309
|
+
m([
|
|
310
|
+
L()
|
|
311
|
+
], h.prototype, "_actionFired", 2);
|
|
312
|
+
m([
|
|
313
|
+
V({ context: T }),
|
|
314
|
+
L()
|
|
315
|
+
], h.prototype, "formContext", 2);
|
|
316
|
+
h = m([
|
|
295
317
|
K("bm-form")
|
|
296
|
-
],
|
|
318
|
+
], h);
|
|
297
319
|
export {
|
|
298
|
-
|
|
299
|
-
|
|
320
|
+
h as BmForm,
|
|
321
|
+
ue as validators
|
|
300
322
|
};
|