@viasat/beam-web-components 2.0.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 +56 -0
- package/Accordion/Accordion.js +12 -0
- package/Accordion/AccordionGroup.context.d.ts +10 -0
- package/Accordion/AccordionGroup.context.js +8 -0
- package/Accordion/AccordionGroup.d.ts +33 -0
- package/Accordion/AccordionGroup.js +79 -0
- package/Accordion/index.d.ts +3 -0
- package/Accordion/index.js +6 -0
- package/Alert/Alert.d.ts +64 -0
- package/Alert/Alert.js +300 -0
- package/Alert/index.d.ts +2 -0
- package/Alert/index.js +4 -0
- package/Avatar/Avatar.d.ts +60 -0
- package/Avatar/Avatar.js +12 -0
- package/Avatar/AvatarGroup.context.d.ts +11 -0
- package/Avatar/AvatarGroup.context.js +8 -0
- package/Avatar/AvatarGroup.d.ts +43 -0
- package/Avatar/AvatarGroup.js +181 -0
- package/Avatar/index.d.ts +3 -0
- package/Avatar/index.js +6 -0
- package/Badge/Badge.d.ts +40 -0
- package/Badge/Badge.js +125 -0
- package/Badge/index.d.ts +2 -0
- package/Badge/index.js +4 -0
- package/BadgeDot/BadgeDot.d.ts +38 -0
- package/BadgeDot/BadgeDot.js +59 -0
- package/BadgeDot/index.d.ts +2 -0
- package/BadgeDot/index.js +4 -0
- package/Box/Box.d.ts +99 -0
- package/Box/Box.js +115 -0
- package/Box/index.d.ts +2 -0
- package/Box/index.js +4 -0
- package/Breadcrumbs/Breadcrumbs.context.d.ts +10 -0
- package/Breadcrumbs/Breadcrumbs.context.js +8 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +38 -0
- package/Breadcrumbs/Breadcrumbs.js +115 -0
- package/Breadcrumbs/BreadcrumbsItem.d.ts +39 -0
- package/Breadcrumbs/BreadcrumbsItem.js +13 -0
- package/Breadcrumbs/index.d.ts +3 -0
- package/Breadcrumbs/index.js +6 -0
- package/Button/Button.d.ts +73 -0
- package/Button/Button.js +125 -0
- package/Button/index.d.ts +2 -0
- package/Button/index.js +4 -0
- package/CloseButton/CloseButton.d.ts +25 -0
- package/CloseButton/CloseButton.js +60 -0
- package/CloseButton/index.d.ts +2 -0
- package/CloseButton/index.js +4 -0
- package/Divider/Divider.d.ts +56 -0
- package/Divider/Divider.js +111 -0
- package/Divider/index.d.ts +2 -0
- package/Divider/index.js +4 -0
- package/EmptyState/EmptyState.d.ts +36 -0
- package/EmptyState/EmptyState.js +56 -0
- package/EmptyState/index.d.ts +2 -0
- package/EmptyState/index.js +4 -0
- package/HelperText/HelperText.d.ts +45 -0
- package/HelperText/HelperText.js +11 -0
- package/HelperText/index.d.ts +2 -0
- package/HelperText/index.js +4 -0
- package/Icon/Icon.d.ts +35 -0
- package/Icon/Icon.js +62 -0
- package/Icon/index.d.ts +2 -0
- package/Icon/index.js +4 -0
- package/InputChoiceGroup/InputChoiceGroup.context.d.ts +13 -0
- package/InputChoiceGroup/InputChoiceGroup.context.js +8 -0
- package/InputChoiceGroup/InputChoiceGroup.d.ts +87 -0
- package/InputChoiceGroup/InputChoiceGroup.js +205 -0
- package/InputChoiceGroup/index.d.ts +2 -0
- package/InputChoiceGroup/index.js +4 -0
- package/Link/Link.d.ts +48 -0
- package/Link/Link.js +77 -0
- package/Link/index.d.ts +2 -0
- package/Link/index.js +4 -0
- package/List/List.context.d.ts +15 -0
- package/List/List.context.js +8 -0
- package/List/List.d.ts +43 -0
- package/List/List.js +101 -0
- package/List/ListItem.d.ts +23 -0
- package/List/ListItem.js +90 -0
- package/List/index.d.ts +3 -0
- package/List/index.js +6 -0
- package/ProgressBar/ProgressBar.d.ts +52 -0
- package/ProgressBar/ProgressBar.js +128 -0
- package/ProgressBar/index.d.ts +2 -0
- package/ProgressBar/index.js +4 -0
- package/README.md +360 -0
- package/SegmentedControl/SegmentedControl.context.d.ts +16 -0
- package/SegmentedControl/SegmentedControl.context.js +8 -0
- package/SegmentedControl/SegmentedControl.d.ts +41 -0
- package/SegmentedControl/SegmentedControl.js +103 -0
- package/SegmentedControl/SegmentedControlItem.d.ts +54 -0
- package/SegmentedControl/SegmentedControlItem.js +284 -0
- package/SegmentedControl/SegmentedControlList.d.ts +23 -0
- package/SegmentedControl/SegmentedControlList.js +61 -0
- package/SegmentedControl/SegmentedControlPanel.d.ts +21 -0
- package/SegmentedControl/SegmentedControlPanel.js +43 -0
- package/SegmentedControl/index.d.ts +5 -0
- package/SegmentedControl/index.js +10 -0
- package/Spinner/Spinner.d.ts +50 -0
- package/Spinner/Spinner.js +186 -0
- package/Spinner/index.d.ts +2 -0
- package/Spinner/index.js +4 -0
- package/StateLayer/StateLayer.d.ts +17 -0
- package/StateLayer/StateLayer.js +6 -0
- package/StateLayer/index.d.ts +2 -0
- package/StateLayer/index.js +5 -0
- package/Text/Text.d.ts +85 -0
- package/Text/Text.js +103 -0
- package/Text/index.d.ts +2 -0
- package/Text/index.js +4 -0
- package/Tooltip/Tooltip.d.ts +139 -0
- package/Tooltip/Tooltip.js +1827 -0
- package/Tooltip/index.d.ts +2 -0
- package/Tooltip/index.js +5 -0
- package/chunks/Accordion.DYD3XcAx.js +161 -0
- package/chunks/Avatar.C2rfzUGP.js +174 -0
- package/chunks/BreadcrumbsItem.4ZR6wbMz.js +121 -0
- package/chunks/CSSLookup.BdqZ5Li9.js +106 -0
- package/chunks/HelperText.CcVVOtA3.js +108 -0
- package/chunks/Upload.B9YEyp7b.js +12 -0
- package/chunks/WarningOutlined.DPfQnPPj.js +12 -0
- package/chunks/classNames.Cq_tbDRp.js +94 -0
- package/chunks/constants.jOWREYQE.js +30 -0
- package/chunks/delegate.baxDQosr.js +63 -0
- package/chunks/dom.C98AFbJh.js +22 -0
- package/chunks/fileUpload.module.kN6o64aL.js +4 -0
- package/chunks/globals.Bz4SVF2g.js +4 -0
- package/chunks/helpers.AwJwaZvv.js +53 -0
- package/chunks/list.module.CZRPBLzy.js +4 -0
- package/chunks/register-custom-element.DHGKOhmA.js +17 -0
- package/chunks/segmentedControl.module.BPXEWodj.js +4 -0
- package/chunks/tokens.CTW8Tt94.js +9 -0
- package/custom-elements.json +11341 -0
- package/local/Accordion/Accordion.js +12 -0
- package/local/Accordion/AccordionGroup.context.js +8 -0
- package/local/Accordion/AccordionGroup.js +78 -0
- package/local/Accordion/index.js +6 -0
- package/local/Alert/Alert.js +301 -0
- package/local/Alert/index.js +4 -0
- package/local/Avatar/Avatar.js +11 -0
- package/local/Avatar/AvatarGroup.context.js +8 -0
- package/local/Avatar/AvatarGroup.js +180 -0
- package/local/Avatar/index.js +6 -0
- package/local/Badge/Badge.js +123 -0
- package/local/Badge/index.js +4 -0
- package/local/BadgeDot/BadgeDot.js +57 -0
- package/local/BadgeDot/index.js +4 -0
- package/local/Box/Box.js +113 -0
- package/local/Box/index.js +4 -0
- package/local/Breadcrumbs/Breadcrumbs.context.js +8 -0
- package/local/Breadcrumbs/Breadcrumbs.js +113 -0
- package/local/Breadcrumbs/BreadcrumbsItem.js +13 -0
- package/local/Breadcrumbs/index.js +6 -0
- package/local/Button/Button.js +154 -0
- package/local/Button/index.js +4 -0
- package/local/CloseButton/CloseButton.js +58 -0
- package/local/CloseButton/index.js +4 -0
- package/local/Divider/Divider.js +111 -0
- package/local/Divider/index.js +4 -0
- package/local/EmptyState/EmptyState.js +54 -0
- package/local/EmptyState/index.js +4 -0
- package/local/HelperText/HelperText.js +9 -0
- package/local/HelperText/index.js +4 -0
- package/local/Icon/Icon.js +60 -0
- package/local/Icon/index.js +4 -0
- package/local/InputChoiceGroup/InputChoiceGroup.context.js +8 -0
- package/local/InputChoiceGroup/InputChoiceGroup.js +205 -0
- package/local/InputChoiceGroup/index.js +4 -0
- package/local/Link/Link.js +75 -0
- package/local/Link/index.js +4 -0
- package/local/List/List.context.js +8 -0
- package/local/List/List.js +101 -0
- package/local/List/ListItem.js +90 -0
- package/local/List/index.js +6 -0
- package/local/ProgressBar/ProgressBar.js +126 -0
- package/local/ProgressBar/index.js +4 -0
- package/local/SegmentedControl/SegmentedControl.context.js +8 -0
- package/local/SegmentedControl/SegmentedControl.js +103 -0
- package/local/SegmentedControl/SegmentedControlItem.js +284 -0
- package/local/SegmentedControl/SegmentedControlList.js +59 -0
- package/local/SegmentedControl/SegmentedControlPanel.js +41 -0
- package/local/SegmentedControl/index.js +10 -0
- package/local/Spinner/Spinner.js +185 -0
- package/local/Spinner/index.js +4 -0
- package/local/StateLayer/StateLayer.js +6 -0
- package/local/StateLayer/index.js +5 -0
- package/local/Text/Text.js +121 -0
- package/local/Text/index.js +4 -0
- package/local/Tooltip/Tooltip.js +1826 -0
- package/local/Tooltip/index.js +5 -0
- package/local/chunks/Accordion.PGU7OILE.js +161 -0
- package/local/chunks/Avatar.CvTOzaRT.js +172 -0
- package/local/chunks/BreadcrumbsItem.GM6sBp_o.js +121 -0
- package/local/chunks/CSSLookup.BdqZ5Li9.js +106 -0
- package/local/chunks/Upload.B9YEyp7b.js +12 -0
- package/local/chunks/WarningOutlined.DPfQnPPj.js +12 -0
- package/local/chunks/base.D76d76ww.js +9 -0
- package/local/chunks/classNames.C6fNrXWF.js +106 -0
- package/local/chunks/constants.jOWREYQE.js +30 -0
- package/local/chunks/consume.Ce9k1-wN.js +47 -0
- package/local/chunks/context-request-event.Bl9Vpkzl.js +13 -0
- package/local/chunks/create-context.DS1OG3vJ.js +11 -0
- package/local/chunks/delegate.baxDQosr.js +63 -0
- package/local/chunks/directive.kLG6oqUu.js +27 -0
- package/local/chunks/dom.C98AFbJh.js +22 -0
- package/local/chunks/fileUpload.module.kN6o64aL.js +4 -0
- package/local/chunks/globals.Bz4SVF2g.js +4 -0
- package/local/chunks/helpers.BWcXAteC.js +53 -0
- package/local/chunks/index.Bz1Jq4c2.js +106 -0
- package/local/chunks/list.module.CZRPBLzy.js +4 -0
- package/local/chunks/lit-element.CJtt9wj5.js +557 -0
- package/local/chunks/provide.i2FlUkOu.js +110 -0
- package/local/chunks/query-assigned-elements.Drkgpk9q.js +19 -0
- package/local/chunks/query-assigned-nodes.Dgvsf6BR.js +19 -0
- package/local/chunks/query.lbpOn5CD.js +20 -0
- package/local/chunks/ref.B7e1Hu4F.js +107 -0
- package/local/chunks/register-custom-element.vod7zfGv.js +51 -0
- package/local/chunks/segmentedControl.module.BPXEWodj.js +4 -0
- package/local/chunks/state.CqiuSzAl.js +12 -0
- package/local/chunks/tokens.CTW8Tt94.js +9 -0
- package/local/chunks/unsafe-html.BzhXEygn.js +27 -0
- package/local/chunks/unsafe-svg.HSGf1NCU.js +14 -0
- package/local/wip/Checkbox/Checkbox.js +102 -0
- package/local/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +27 -0
- package/local/wip/Checkbox/index.js +6 -0
- package/local/wip/FileUpload/FileUpload.Button.js +75 -0
- package/local/wip/FileUpload/FileUpload.Dropzone.js +149 -0
- package/local/wip/FileUpload/FileUpload.List.Item.js +201 -0
- package/local/wip/FileUpload/FileUpload.List.js +105 -0
- package/local/wip/FileUpload/FileUpload.js +452 -0
- package/local/wip/FileUpload/FileUploadContext.js +8 -0
- package/local/wip/FileUpload/FileUploadListContext.js +8 -0
- package/local/wip/FileUpload/index.js +13 -0
- package/local/wip/Form/Form.context.js +20 -0
- package/local/wip/Form/Form.decorator.js +145 -0
- package/local/wip/Form/Form.js +288 -0
- package/local/wip/Form/Form.utils.js +8 -0
- package/local/wip/Form/index.js +7 -0
- package/local/wip/Label/Label.js +86 -0
- package/local/wip/Label/index.js +4 -0
- package/local/wip/NativeSelect/NativeSelect.js +162 -0
- package/local/wip/NativeSelect/index.js +4 -0
- package/local/wip/RadioButton/RadioButton.js +123 -0
- package/local/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +96 -0
- package/local/wip/RadioButton/index.js +6 -0
- package/local/wip/Switch/Switch.js +153 -0
- package/local/wip/Switch/SwitchGroup/SwitchGroup.js +15 -0
- package/local/wip/Switch/index.js +6 -0
- package/local/wip/TextArea/TextArea.js +192 -0
- package/local/wip/TextArea/index.js +4 -0
- package/local/wip/TextField/TextField.js +169 -0
- package/local/wip/TextField/index.js +4 -0
- package/package.json +78 -0
- package/vscode.css-custom-data.json +6 -0
- package/vscode.html-custom-data.json +2704 -0
- package/wip/Checkbox/Checkbox.d.ts +55 -0
- package/wip/Checkbox/Checkbox.js +104 -0
- package/wip/Checkbox/CheckboxGroup/CheckboxGroup.d.ts +11 -0
- package/wip/Checkbox/CheckboxGroup/CheckboxGroup.js +27 -0
- package/wip/Checkbox/index.d.ts +3 -0
- package/wip/Checkbox/index.js +6 -0
- package/wip/FileUpload/FileUpload.Button.d.ts +36 -0
- package/wip/FileUpload/FileUpload.Button.js +77 -0
- package/wip/FileUpload/FileUpload.Dropzone.d.ts +55 -0
- package/wip/FileUpload/FileUpload.Dropzone.js +150 -0
- package/wip/FileUpload/FileUpload.List.Item.d.ts +62 -0
- package/wip/FileUpload/FileUpload.List.Item.js +203 -0
- package/wip/FileUpload/FileUpload.List.d.ts +46 -0
- package/wip/FileUpload/FileUpload.List.js +106 -0
- package/wip/FileUpload/FileUpload.d.ts +101 -0
- package/wip/FileUpload/FileUpload.js +451 -0
- package/wip/FileUpload/FileUploadContext.d.ts +5 -0
- package/wip/FileUpload/FileUploadContext.js +8 -0
- package/wip/FileUpload/FileUploadListContext.d.ts +5 -0
- package/wip/FileUpload/FileUploadListContext.js +8 -0
- package/wip/FileUpload/index.d.ts +6 -0
- package/wip/FileUpload/index.js +13 -0
- package/wip/Form/Form.context.d.ts +19 -0
- package/wip/Form/Form.context.js +20 -0
- package/wip/Form/Form.d.ts +50 -0
- package/wip/Form/Form.decorator.d.ts +47 -0
- package/wip/Form/Form.decorator.js +144 -0
- package/wip/Form/Form.js +288 -0
- package/wip/Form/Form.utils.d.ts +2 -0
- package/wip/Form/Form.utils.js +8 -0
- package/wip/Form/index.d.ts +3 -0
- package/wip/Form/index.js +7 -0
- package/wip/Label/Label.d.ts +43 -0
- package/wip/Label/Label.js +87 -0
- package/wip/Label/index.d.ts +2 -0
- package/wip/Label/index.js +4 -0
- package/wip/NativeSelect/NativeSelect.d.ts +69 -0
- package/wip/NativeSelect/NativeSelect.js +163 -0
- package/wip/NativeSelect/index.d.ts +2 -0
- package/wip/NativeSelect/index.js +4 -0
- package/wip/RadioButton/RadioButton.d.ts +56 -0
- package/wip/RadioButton/RadioButton.js +125 -0
- package/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.d.ts +23 -0
- package/wip/RadioButton/RadioButtonGroup/RadioButtonGroup.js +96 -0
- package/wip/RadioButton/index.d.ts +3 -0
- package/wip/RadioButton/index.js +6 -0
- package/wip/Switch/Switch.d.ts +62 -0
- package/wip/Switch/Switch.js +155 -0
- package/wip/Switch/SwitchGroup/SwitchGroup.d.ts +15 -0
- package/wip/Switch/SwitchGroup/SwitchGroup.js +15 -0
- package/wip/Switch/index.d.ts +3 -0
- package/wip/Switch/index.js +6 -0
- package/wip/TextArea/TextArea.d.ts +89 -0
- package/wip/TextArea/TextArea.js +193 -0
- package/wip/TextArea/index.d.ts +2 -0
- package/wip/TextArea/index.js +4 -0
- package/wip/TextField/TextField.d.ts +70 -0
- package/wip/TextField/TextField.js +169 -0
- package/wip/TextField/index.d.ts +2 -0
- package/wip/TextField/index.js +4 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var x = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
|
+
};
|
|
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";
|
|
7
|
+
import { LitElement as E, nothing as f, html as p } from "lit";
|
|
8
|
+
import { property as h, state as k } from "lit/decorators.js";
|
|
9
|
+
import { createRef as A } from "lit/directives/ref.js";
|
|
10
|
+
import { b as F } from "../../chunks/tokens.CTW8Tt94.js";
|
|
11
|
+
import { bmFormInitials as c, bmFormContext as I } from "./Form.context.js";
|
|
12
|
+
import { createId as m } from "./Form.utils.js";
|
|
13
|
+
import "../../chunks/HelperText.CcVVOtA3.js";
|
|
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);
|
|
17
|
+
return i && S(r, t, i), i;
|
|
18
|
+
}, l;
|
|
19
|
+
const b = class b extends E {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
g(this, l);
|
|
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
|
+
this._validationErrors = t;
|
|
25
|
+
}, this.validationErrorShown = () => this.validationErrors().some((t) => !!(t != null && t.length)), V(this, l, /* @__PURE__ */ new WeakMap()), this.submitFormByEnter = ({ key: t }) => {
|
|
26
|
+
t === "Enter" && this.requestAssociatedSubmit();
|
|
27
|
+
}, this.forwardLabelFocus = () => {
|
|
28
|
+
const { value: t } = this.formFieldRef;
|
|
29
|
+
t.focus();
|
|
30
|
+
}, this.validateFieldOnBlur = (t) => {
|
|
31
|
+
const { formBlurHandler: e } = this.formContext || c;
|
|
32
|
+
e(t);
|
|
33
|
+
}, this.validateFieldOnChange = (t) => {
|
|
34
|
+
const { value: e } = t.target, { formChangeHandler: i } = this.formContext || c;
|
|
35
|
+
i(t), this.setAssociatedValue(e);
|
|
36
|
+
}, this.getContextValue = () => {
|
|
37
|
+
const { initialValues: t } = this.formContext || c;
|
|
38
|
+
return (t == null ? void 0 : t[this.name]) || this.value;
|
|
39
|
+
}, this.setContextValue = () => {
|
|
40
|
+
const { value: t } = this.formFieldRef, { ctxValue: e, finalizeCallback: i = () => {
|
|
41
|
+
} } = this.finalizeAssociatedCallback(this.getContextValue());
|
|
42
|
+
t.value = e, this.setAssociatedValue(e), i();
|
|
43
|
+
}, this.setContextValidation = () => {
|
|
44
|
+
const { value: t } = this.formFieldRef, { registerField: e } = this.formContext || c;
|
|
45
|
+
e({
|
|
46
|
+
field: t,
|
|
47
|
+
validators: this.validationRules,
|
|
48
|
+
initializer: this.setContextValue,
|
|
49
|
+
errorSetter: this.setValidationErrors
|
|
50
|
+
});
|
|
51
|
+
}, this.contextInitialsChanged = () => {
|
|
52
|
+
const { initialValues: t } = this.formContext || c, e = t == null ? void 0 : t[this.name], i = e !== this.contextInitialValue;
|
|
53
|
+
return i && (this.contextInitialValue = e), i;
|
|
54
|
+
}, this.renderError = (t, e) => t ? p`
|
|
55
|
+
<bm-helper-text
|
|
56
|
+
text="${t}"
|
|
57
|
+
id="${this.errorId}"
|
|
58
|
+
appearance="negative"
|
|
59
|
+
.disabled="${e}"
|
|
60
|
+
></bm-helper-text>
|
|
61
|
+
` : f, this.renderValidationErrors = () => this.validationErrorShown() ? p`
|
|
62
|
+
<div
|
|
63
|
+
role="log"
|
|
64
|
+
aria-live="polite"
|
|
65
|
+
aria-atomic="true"
|
|
66
|
+
aria-relevant="additions"
|
|
67
|
+
id="${this.validationErrorsId}"
|
|
68
|
+
>
|
|
69
|
+
${this.validationErrors().map(
|
|
70
|
+
(t) => t ? p`
|
|
71
|
+
<bm-helper-text
|
|
72
|
+
text="${t}"
|
|
73
|
+
appearance="negative"
|
|
74
|
+
style="display: block; margin-top: ${F};"
|
|
75
|
+
></bm-helper-text>
|
|
76
|
+
` : f
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
` : f;
|
|
80
|
+
}
|
|
81
|
+
setAssociatedValue(t) {
|
|
82
|
+
let e = null;
|
|
83
|
+
if (typeof t == "boolean")
|
|
84
|
+
e = t ? "on" : null;
|
|
85
|
+
else if (typeof t == "number")
|
|
86
|
+
e = t.toString();
|
|
87
|
+
else if (Array.isArray(t)) {
|
|
88
|
+
const i = new FormData();
|
|
89
|
+
t.forEach((o) => i.append(this.name, o.toString())), e = i;
|
|
90
|
+
} else
|
|
91
|
+
e = t;
|
|
92
|
+
this.internals.form && this.internals.setFormValue(e);
|
|
93
|
+
}
|
|
94
|
+
requestAssociatedSubmit() {
|
|
95
|
+
this.internals.form && this.internals.form.requestSubmit();
|
|
96
|
+
}
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
super.connectedCallback(), this.addEventListener("bm-label-click", this.forwardLabelFocus);
|
|
99
|
+
}
|
|
100
|
+
ctxValueChanged(t, e) {
|
|
101
|
+
const { value: i } = e, o = u(this, l).get(i), { initialValues: { [this.name]: d } = {} } = t, v = d !== o;
|
|
102
|
+
return v && u(this, l).set(i, d), v;
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
super.disconnectedCallback(), this.removeEventListener("bm-label-click", this.forwardLabelFocus);
|
|
106
|
+
}
|
|
107
|
+
formAssociatedCallback() {
|
|
108
|
+
this.setAssociatedValue(this.value);
|
|
109
|
+
}
|
|
110
|
+
formResetCallback() {
|
|
111
|
+
this.setContextValue();
|
|
112
|
+
}
|
|
113
|
+
finalizeAssociatedCallback(t) {
|
|
114
|
+
return { ctxValue: t, finalizeCallback: () => {
|
|
115
|
+
} };
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
l = new WeakMap(), b.formAssociated = !0;
|
|
119
|
+
let s = b;
|
|
120
|
+
n([
|
|
121
|
+
h({ type: String })
|
|
122
|
+
], s.prototype, "id");
|
|
123
|
+
n([
|
|
124
|
+
h({ type: String })
|
|
125
|
+
], s.prototype, "name");
|
|
126
|
+
n([
|
|
127
|
+
h({ type: String })
|
|
128
|
+
], s.prototype, "value");
|
|
129
|
+
n([
|
|
130
|
+
h({ type: Array })
|
|
131
|
+
], s.prototype, "validationRules");
|
|
132
|
+
n([
|
|
133
|
+
h({ type: String, attribute: "input-aria-label" })
|
|
134
|
+
], s.prototype, "inputAriaLabel");
|
|
135
|
+
n([
|
|
136
|
+
y({ context: I, subscribe: !0 }),
|
|
137
|
+
h({ attribute: !1 })
|
|
138
|
+
], s.prototype, "formContext");
|
|
139
|
+
n([
|
|
140
|
+
k()
|
|
141
|
+
], s.prototype, "_validationErrors");
|
|
142
|
+
export {
|
|
143
|
+
s as FormField
|
|
144
|
+
};
|
package/wip/Form/Form.js
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { provide as V } from "@lit/context";
|
|
2
|
+
import { LitElement as z, html as L } from "lit";
|
|
3
|
+
import { property as p, state as S } from "lit/decorators.js";
|
|
4
|
+
import { createRef as $, ref as H } from "lit/directives/ref.js";
|
|
5
|
+
import { c as q } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
6
|
+
import { bmFormContext as G, bmFormInitials as P } from "./Form.context.js";
|
|
7
|
+
const K = async (t, e) => (await Promise.all(
|
|
8
|
+
e.map(
|
|
9
|
+
async (o) => {
|
|
10
|
+
const { validator: s } = o;
|
|
11
|
+
return s(t);
|
|
12
|
+
}
|
|
13
|
+
)
|
|
14
|
+
)).reduce(
|
|
15
|
+
(o, s) => {
|
|
16
|
+
const { error: n, message: a } = s;
|
|
17
|
+
return n ? [...o, a] : o;
|
|
18
|
+
},
|
|
19
|
+
[]
|
|
20
|
+
), F = (t) => {
|
|
21
|
+
const { type: e, checked: r } = t, o = e === "checkbox";
|
|
22
|
+
if (o)
|
|
23
|
+
return {
|
|
24
|
+
isCheckBoxGroup: o,
|
|
25
|
+
selectedBoxes: r ? [t] : []
|
|
26
|
+
};
|
|
27
|
+
const s = Array.from(t), n = s.every((m) => {
|
|
28
|
+
const { type: u } = m;
|
|
29
|
+
return u === "checkbox";
|
|
30
|
+
}), a = !!s.length && n;
|
|
31
|
+
if (!a) return { isCheckBoxGroup: a, selectedBoxes: [] };
|
|
32
|
+
const d = s.filter(
|
|
33
|
+
({ checked: m }) => m
|
|
34
|
+
);
|
|
35
|
+
return { isCheckBoxGroup: a, selectedBoxes: d };
|
|
36
|
+
}, E = (t) => {
|
|
37
|
+
const { type: e, multiple: r, options: o } = t, s = e === "select-multiple" && r;
|
|
38
|
+
if (!s) return { isMultiSelect: s, selectedOptions: [] };
|
|
39
|
+
const n = [].filter.call(
|
|
40
|
+
o,
|
|
41
|
+
({ selected: a }) => a
|
|
42
|
+
);
|
|
43
|
+
return { isMultiSelect: s, selectedOptions: n };
|
|
44
|
+
}, j = new RegExp(
|
|
45
|
+
[
|
|
46
|
+
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:",
|
|
47
|
+
"\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:",
|
|
48
|
+
"[-\b\v\f-!#-[]-]",
|
|
49
|
+
'|\\\\[- \v\f-])*")@(?:(?:',
|
|
50
|
+
"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:",
|
|
51
|
+
"[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|",
|
|
52
|
+
"[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:",
|
|
53
|
+
"(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?",
|
|
54
|
+
"[0-9])|[a-z0-9-]*[a-z0-9]:(?:",
|
|
55
|
+
"[-\b\v\f-!-ZS-]|\\\\[-",
|
|
56
|
+
" \v\f-])+)\\])"
|
|
57
|
+
].join("")
|
|
58
|
+
), R = (t) => ({
|
|
59
|
+
name: "min",
|
|
60
|
+
validator: (e) => {
|
|
61
|
+
const { value: r, message: o } = t, { value: s } = e;
|
|
62
|
+
return { error: !!s && Number(s) < r, message: o };
|
|
63
|
+
}
|
|
64
|
+
}), A = (t) => ({
|
|
65
|
+
name: "max",
|
|
66
|
+
validator: (e) => {
|
|
67
|
+
const { value: r, message: o } = t, { value: s } = e;
|
|
68
|
+
return { error: !!s && Number(s) > r, message: o };
|
|
69
|
+
}
|
|
70
|
+
}), D = (t) => ({
|
|
71
|
+
name: "email",
|
|
72
|
+
validator: (e) => {
|
|
73
|
+
const { message: r } = t || {}, { value: o } = e;
|
|
74
|
+
return { error: !!o && !j.test(o), message: r };
|
|
75
|
+
}
|
|
76
|
+
}), U = (t) => ({
|
|
77
|
+
name: "pattern",
|
|
78
|
+
validator: (e) => {
|
|
79
|
+
const { pattern: r, message: o } = t, { value: s } = e;
|
|
80
|
+
return { error: !!s && !s.match(r), message: o };
|
|
81
|
+
}
|
|
82
|
+
}), I = (t) => ({
|
|
83
|
+
name: "required",
|
|
84
|
+
validator: (e) => {
|
|
85
|
+
const { message: r } = t || {}, { value: o } = e, {
|
|
86
|
+
isCheckBoxGroup: s,
|
|
87
|
+
selectedBoxes: { length: n }
|
|
88
|
+
} = F(e);
|
|
89
|
+
if (s) return { error: !n, message: r };
|
|
90
|
+
const {
|
|
91
|
+
isMultiSelect: a,
|
|
92
|
+
selectedOptions: { length: d }
|
|
93
|
+
} = E(e);
|
|
94
|
+
return a ? { error: !d, message: r } : { error: !o, message: r };
|
|
95
|
+
}
|
|
96
|
+
}), T = (t) => ({
|
|
97
|
+
name: "minLength",
|
|
98
|
+
validator: (e) => {
|
|
99
|
+
const { length: r, message: o } = t, { value: s } = e, n = !!s && s.length < r, {
|
|
100
|
+
isCheckBoxGroup: a,
|
|
101
|
+
selectedBoxes: { length: d }
|
|
102
|
+
} = F(e);
|
|
103
|
+
if (a)
|
|
104
|
+
return { error: !!d && d < r, message: o };
|
|
105
|
+
const {
|
|
106
|
+
isMultiSelect: m,
|
|
107
|
+
selectedOptions: { length: u }
|
|
108
|
+
} = E(e);
|
|
109
|
+
return m ? { error: !!u && u < r, message: o } : { error: n, message: o };
|
|
110
|
+
}
|
|
111
|
+
}), Z = (t) => ({
|
|
112
|
+
name: "maxLength",
|
|
113
|
+
validator: (e) => {
|
|
114
|
+
const { length: r, message: o } = t, { value: s } = e, n = !!s && s.length > r, {
|
|
115
|
+
isCheckBoxGroup: a,
|
|
116
|
+
selectedBoxes: { length: d }
|
|
117
|
+
} = F(e);
|
|
118
|
+
if (a)
|
|
119
|
+
return { error: !!d && d > r, message: o };
|
|
120
|
+
const {
|
|
121
|
+
isMultiSelect: m,
|
|
122
|
+
selectedOptions: { length: u }
|
|
123
|
+
} = E(e);
|
|
124
|
+
return m ? { error: !!u && u > r, message: o } : { error: n, message: o };
|
|
125
|
+
}
|
|
126
|
+
}), J = (t) => ({
|
|
127
|
+
name: "define",
|
|
128
|
+
validator: (e) => t(e)
|
|
129
|
+
}), ne = {
|
|
130
|
+
min: R,
|
|
131
|
+
max: A,
|
|
132
|
+
email: D,
|
|
133
|
+
define: J,
|
|
134
|
+
pattern: U,
|
|
135
|
+
required: I,
|
|
136
|
+
minLength: T,
|
|
137
|
+
maxLength: Z
|
|
138
|
+
};
|
|
139
|
+
var N = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, W = (t) => {
|
|
140
|
+
throw TypeError(t);
|
|
141
|
+
}, h = (t, e, r, o) => {
|
|
142
|
+
for (var s = o > 1 ? void 0 : o ? Q(e, r) : e, n = t.length - 1, a; n >= 0; n--)
|
|
143
|
+
(a = t[n]) && (s = (o ? a(e, r, s) : a(s)) || s);
|
|
144
|
+
return o && s && N(e, r, s), s;
|
|
145
|
+
}, X = (t, e, r) => e.has(t) || W("Cannot " + r), i = (t, e, r) => (X(t, e, "read from private field"), r ? r.call(t) : e.get(t)), c = (t, e, r) => e.has(t) ? W("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), g, w, y, x, f, _, v, k, B, C, b, O;
|
|
146
|
+
let l = class extends z {
|
|
147
|
+
constructor() {
|
|
148
|
+
super(...arguments), this.validationMode = "onBlur", this.initialValues = {}, this.required = !1, this.disabled = !1, this.readOnly = !1, this.formMeta = {}, this.formRef = $(), this._actionFired = !1, c(this, g, () => !!this._actionFired), this.formContext = P, c(this, w, (t) => {
|
|
149
|
+
const { field: e } = t, { name: r } = e;
|
|
150
|
+
r && (this.formMeta = { ...this.formMeta, [r]: t });
|
|
151
|
+
}), c(this, y, (t) => {
|
|
152
|
+
const { validators: e, errorSetter: r } = this.formMeta[t] || {};
|
|
153
|
+
e != null && e.length && r([]);
|
|
154
|
+
}), c(this, x, () => {
|
|
155
|
+
Object.keys(this.formMeta).forEach((t) => {
|
|
156
|
+
const { initializer: e } = this.formMeta[t];
|
|
157
|
+
e(), i(this, y).call(this, t);
|
|
158
|
+
});
|
|
159
|
+
}), c(this, f, async (t) => {
|
|
160
|
+
const { field: e, validators: r, errorSetter: o } = this.formMeta[t] || {}, { disabled: s } = e || {};
|
|
161
|
+
if (!(r != null && r.length) || s) return [];
|
|
162
|
+
const n = await K(e, r);
|
|
163
|
+
return o(n), n;
|
|
164
|
+
}), c(this, _, async () => await Promise.all(
|
|
165
|
+
Object.keys(this.formMeta).map(
|
|
166
|
+
async (t) => await i(this, f).call(this, t)
|
|
167
|
+
)
|
|
168
|
+
)), c(this, v, async () => {
|
|
169
|
+
(await i(this, _).call(this)).some((r) => !!r.length) || this.dispatchEvent(
|
|
170
|
+
new CustomEvent("submit", {
|
|
171
|
+
bubbles: !0,
|
|
172
|
+
composed: !0,
|
|
173
|
+
detail: Object.keys(this.formMeta).reduce((r, o) => {
|
|
174
|
+
const {
|
|
175
|
+
[o]: { field: s }
|
|
176
|
+
} = this.formMeta, { value: n, disabled: a } = s;
|
|
177
|
+
return a ? r : { ...r, [o]: n };
|
|
178
|
+
}, {})
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
}), c(this, k, async ({ target: t }) => {
|
|
182
|
+
if (i(this, g).call(this)) {
|
|
183
|
+
this._actionFired = !i(this, g).call(this);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const { name: e } = t;
|
|
187
|
+
this.validationMode === "onBlur" && await i(this, f).call(this, e);
|
|
188
|
+
}), c(this, B, async ({ target: t }) => {
|
|
189
|
+
const { name: e } = t;
|
|
190
|
+
this.validationMode === "onChange" ? await i(this, f).call(this, e) : i(this, y).call(this, e);
|
|
191
|
+
}), c(this, C, async ({ target: t }) => {
|
|
192
|
+
const { type: e } = t;
|
|
193
|
+
switch (e) {
|
|
194
|
+
case "reset":
|
|
195
|
+
return i(this, x).call(this);
|
|
196
|
+
case "submit":
|
|
197
|
+
return i(this, v).call(this);
|
|
198
|
+
}
|
|
199
|
+
}), c(this, b, async (t) => {
|
|
200
|
+
const { target: e, key: r } = t, { name: o } = e;
|
|
201
|
+
r === "Enter" && this.formMeta[o] && await i(this, v).call(this);
|
|
202
|
+
}), c(this, O, (t) => {
|
|
203
|
+
const e = t.target, { name: r } = document.activeElement || {}, o = e.closest("[type=reset]") || e.closest("[type=submit]");
|
|
204
|
+
this.formMeta[r] && (this._actionFired = !!o);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
willUpdate(t) {
|
|
208
|
+
Object.keys(this.formContext).some((o) => t.has(o)) && (this.formContext = {
|
|
209
|
+
required: this.required,
|
|
210
|
+
readOnly: this.readOnly,
|
|
211
|
+
disabled: this.disabled,
|
|
212
|
+
initialValues: this.initialValues,
|
|
213
|
+
registerField: i(this, w),
|
|
214
|
+
formBlurHandler: i(this, k),
|
|
215
|
+
formChangeHandler: i(this, B)
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
render() {
|
|
219
|
+
return L`
|
|
220
|
+
<form
|
|
221
|
+
novalidate
|
|
222
|
+
${H(this.formRef)}
|
|
223
|
+
action="${this.action}"
|
|
224
|
+
method="${this.method}"
|
|
225
|
+
target="${this.target}"
|
|
226
|
+
enctype="${this.enctype}"
|
|
227
|
+
@click="${i(this, C)}"
|
|
228
|
+
@keydown="${i(this, b)}"
|
|
229
|
+
@mousedown="${i(this, O)}"
|
|
230
|
+
>
|
|
231
|
+
<slot></slot>
|
|
232
|
+
</form>
|
|
233
|
+
`;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
g = /* @__PURE__ */ new WeakMap();
|
|
237
|
+
w = /* @__PURE__ */ new WeakMap();
|
|
238
|
+
y = /* @__PURE__ */ new WeakMap();
|
|
239
|
+
x = /* @__PURE__ */ new WeakMap();
|
|
240
|
+
f = /* @__PURE__ */ new WeakMap();
|
|
241
|
+
_ = /* @__PURE__ */ new WeakMap();
|
|
242
|
+
v = /* @__PURE__ */ new WeakMap();
|
|
243
|
+
k = /* @__PURE__ */ new WeakMap();
|
|
244
|
+
B = /* @__PURE__ */ new WeakMap();
|
|
245
|
+
C = /* @__PURE__ */ new WeakMap();
|
|
246
|
+
b = /* @__PURE__ */ new WeakMap();
|
|
247
|
+
O = /* @__PURE__ */ new WeakMap();
|
|
248
|
+
h([
|
|
249
|
+
p({ type: String })
|
|
250
|
+
], l.prototype, "validationMode", 2);
|
|
251
|
+
h([
|
|
252
|
+
p({ type: Object })
|
|
253
|
+
], l.prototype, "initialValues", 2);
|
|
254
|
+
h([
|
|
255
|
+
p({ type: Boolean })
|
|
256
|
+
], l.prototype, "required", 2);
|
|
257
|
+
h([
|
|
258
|
+
p({ type: Boolean })
|
|
259
|
+
], l.prototype, "disabled", 2);
|
|
260
|
+
h([
|
|
261
|
+
p({ type: Boolean })
|
|
262
|
+
], l.prototype, "readOnly", 2);
|
|
263
|
+
h([
|
|
264
|
+
p({ type: String })
|
|
265
|
+
], l.prototype, "action", 2);
|
|
266
|
+
h([
|
|
267
|
+
p({ type: String })
|
|
268
|
+
], l.prototype, "method", 2);
|
|
269
|
+
h([
|
|
270
|
+
p({ type: String })
|
|
271
|
+
], l.prototype, "target", 2);
|
|
272
|
+
h([
|
|
273
|
+
p({ type: String })
|
|
274
|
+
], l.prototype, "enctype", 2);
|
|
275
|
+
h([
|
|
276
|
+
S()
|
|
277
|
+
], l.prototype, "_actionFired", 2);
|
|
278
|
+
h([
|
|
279
|
+
V({ context: G }),
|
|
280
|
+
S()
|
|
281
|
+
], l.prototype, "formContext", 2);
|
|
282
|
+
l = h([
|
|
283
|
+
q("bm-form")
|
|
284
|
+
], l);
|
|
285
|
+
export {
|
|
286
|
+
l as BmForm,
|
|
287
|
+
ne as validators
|
|
288
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ThemeTypes } from '@viasat/beam-shared/utils/constants';
|
|
3
|
+
import { Optional } from '@viasat/beam-shared/utils/types';
|
|
4
|
+
/**
|
|
5
|
+
* @summary `bm-label`
|
|
6
|
+
*
|
|
7
|
+
* @slot text - Specify the text for Label
|
|
8
|
+
* @slot optional - Specify if the Label displays as optional
|
|
9
|
+
* @slot tooltip - Specify if the icon displays to add a Tooltip
|
|
10
|
+
*/
|
|
11
|
+
export declare class BmLabel extends LitElement {
|
|
12
|
+
#private;
|
|
13
|
+
/**
|
|
14
|
+
* Specify if the Label displays disabled
|
|
15
|
+
*/
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Specify if the Label displays as required
|
|
19
|
+
*/
|
|
20
|
+
required: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Specify the text for Label
|
|
23
|
+
*/
|
|
24
|
+
text: Optional<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Specify the text for Label
|
|
27
|
+
*/
|
|
28
|
+
optional: Optional<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Specify the theme of the Label. By default it inherits the theme from the parent
|
|
31
|
+
*/
|
|
32
|
+
theme: Optional<ThemeTypes>;
|
|
33
|
+
static styles: import('lit').CSSResult;
|
|
34
|
+
private optionalNodes?;
|
|
35
|
+
private get hasOptionalSlot();
|
|
36
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
'bm-label': BmLabel;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { unsafeCSS as _, LitElement as S, html as u } from "lit";
|
|
2
|
+
import { property as s, queryAssignedNodes as x } from "lit/decorators.js";
|
|
3
|
+
import f from "clsx";
|
|
4
|
+
import { n as P, g as C } from "../../chunks/classNames.Cq_tbDRp.js";
|
|
5
|
+
import { t as $ } from "../../chunks/constants.jOWREYQE.js";
|
|
6
|
+
import { c as q } from "../../chunks/register-custom-element.DHGKOhmA.js";
|
|
7
|
+
const w = ':root,:host,.bm-light,.bm-dark .bm-inverse,[data-bm-theme~=bm-light]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #576775);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #576775);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}:host,.bm-dark,.bm-light .bm-inverse,[data-bm-theme~=bm-dark]{--bm-comp-label-color-text: var(--bm-sem-color-text-secondary, #c3cdd5);--bm-comp-label-color-icon: var(--bm-sem-color-icon-secondary, #c3cdd5);--bm-comp-label-typo-default: var( --bm-sem-typo-label-sm, 600 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-optional: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-typo-character-count: var( --bm-sem-typo-body-sm, 400 .875rem/1.25rem "Source Sans Pro" );--bm-comp-label-space-gap: var(--bm-sem-space-25, .25rem);--bm-comp-label-space-bottom: var(--bm-sem-space-50, .5rem);--bm-comp-label-size-icon: var(--bm-sem-size-icon-sm, 1rem)}.bm-label{color:var(--bm-comp-label-color-text);font:var(--bm-comp-label-typo-default);margin-bottom:var(--bm-comp-label-space-bottom, var(--bm-sem-space-0))}.bm-label label{cursor:var(--bm-comp-label-cursor, default);pointer-events:var(--bm-comp-label-pointer-events, inherit)}.bm-label--disabled label{opacity:var(--bm-sem-opacity-disabled)}.bm-label--required label:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label--required label:has(:last-child):after{content:""}.bm-label--required label:has(:last-child)>*:last-child:after{content:"*";color:var(--bm-sem-color-text-negative)}.bm-label__optional{font:var(--bm-comp-label-typo-optional);margin-left:var(--bm-comp-label-space-gap)}.bm-label__tooltip{vertical-align:top;display:inline-block;margin-inline-start:var(--bm-comp-label-space-gap)}.bm-label__tooltip button{color:var(--bm-comp-tooltip-color-icon-trigger)}.bm-label__tooltip svg{height:var(--bm-comp-label-size-icon);width:var(--bm-comp-label-size-icon)}.bm-label--no-box{display:contents}';
|
|
8
|
+
var k = Object.defineProperty, E = Object.getOwnPropertyDescriptor, g = (e) => {
|
|
9
|
+
throw TypeError(e);
|
|
10
|
+
}, r = (e, a, o, b) => {
|
|
11
|
+
for (var l = b > 1 ? void 0 : b ? E(a, o) : a, c = e.length - 1, n; c >= 0; c--)
|
|
12
|
+
(n = e[c]) && (l = (b ? n(a, o, l) : n(l)) || l);
|
|
13
|
+
return b && l && k(a, o, l), l;
|
|
14
|
+
}, O = (e, a, o) => a.has(e) || g("Cannot " + o), m = (e, a, o) => (O(e, a, "read from private field"), o ? o.call(e) : a.get(e)), i = (e, a, o) => a.has(e) ? g("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(e) : a.set(e, o), p, h, v, y;
|
|
15
|
+
const { baseClassNamePrefix: N, subElementClassPrefix: z, classModifierPrefix: d } = C("label");
|
|
16
|
+
let t = class extends S {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this.disabled = !1, this.required = !1, i(this, p, () => !!(this.hasOptionalSlot || this.optional)), i(this, h, () => this.requestUpdate()), i(this, v, () => {
|
|
19
|
+
this.dispatchEvent(
|
|
20
|
+
new CustomEvent("bm-label-click", {
|
|
21
|
+
bubbles: !0,
|
|
22
|
+
composed: !0
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
}), i(this, y, () => u`
|
|
26
|
+
<span
|
|
27
|
+
class="${f(
|
|
28
|
+
`${z}optional`,
|
|
29
|
+
!m(this, p).call(this) && `${d}no-box`
|
|
30
|
+
)}"
|
|
31
|
+
>
|
|
32
|
+
<slot name="optional" @slotchange=${m(this, h)}>
|
|
33
|
+
${this.optional}
|
|
34
|
+
</slot>
|
|
35
|
+
</span>
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
get hasOptionalSlot() {
|
|
39
|
+
return P(this.optionalNodes);
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const e = f(
|
|
43
|
+
N,
|
|
44
|
+
this.theme && $(this.theme),
|
|
45
|
+
this.disabled && `${d}disabled`,
|
|
46
|
+
this.required && !m(this, p).call(this) && `${d}required`
|
|
47
|
+
);
|
|
48
|
+
return u`
|
|
49
|
+
<div class="${e}">
|
|
50
|
+
<label @click="${m(this, v)}">
|
|
51
|
+
<slot name="text">${this.text}</slot>
|
|
52
|
+
${m(this, y).call(this)}
|
|
53
|
+
</label>
|
|
54
|
+
<slot name="tooltip"></slot>
|
|
55
|
+
</div>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
p = /* @__PURE__ */ new WeakMap();
|
|
60
|
+
h = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
v = /* @__PURE__ */ new WeakMap();
|
|
62
|
+
y = /* @__PURE__ */ new WeakMap();
|
|
63
|
+
t.styles = _(w);
|
|
64
|
+
r([
|
|
65
|
+
s({ type: Boolean })
|
|
66
|
+
], t.prototype, "disabled", 2);
|
|
67
|
+
r([
|
|
68
|
+
s({ type: Boolean })
|
|
69
|
+
], t.prototype, "required", 2);
|
|
70
|
+
r([
|
|
71
|
+
s({ type: String })
|
|
72
|
+
], t.prototype, "text", 2);
|
|
73
|
+
r([
|
|
74
|
+
s({ type: String })
|
|
75
|
+
], t.prototype, "optional", 2);
|
|
76
|
+
r([
|
|
77
|
+
s({ type: String })
|
|
78
|
+
], t.prototype, "theme", 2);
|
|
79
|
+
r([
|
|
80
|
+
x({ slot: "optional", flatten: !0 })
|
|
81
|
+
], t.prototype, "optionalNodes", 2);
|
|
82
|
+
t = r([
|
|
83
|
+
q("bm-label")
|
|
84
|
+
], t);
|
|
85
|
+
export {
|
|
86
|
+
t as BmLabel
|
|
87
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { ThemeTypes } from '@viasat/beam-shared/utils/constants';
|
|
3
|
+
import { Optional } from '@viasat/beam-shared/utils/types';
|
|
4
|
+
import { FinalizeAssociatedResult } from '../../../utils/mixins/types';
|
|
5
|
+
import { FormField } from '../Form/Form.decorator';
|
|
6
|
+
/**
|
|
7
|
+
* @summary `bm-native-select`
|
|
8
|
+
*
|
|
9
|
+
* @slot slot - Specify Options for NativeSelect
|
|
10
|
+
* @slot label - Specify Label for NativeSelect
|
|
11
|
+
* @slot helper-text - Specify HelperText for NativeSelect
|
|
12
|
+
*/
|
|
13
|
+
export declare class BmNativeSelect extends FormField {
|
|
14
|
+
#private;
|
|
15
|
+
/**
|
|
16
|
+
* Specify if NativeSelect is a required input
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
required: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Specify if NativeSelect displays in a read-only state
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
readOnly: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specify if NativeSelect displays in a disabled state
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Specify error text and display error state of a NativeSelect
|
|
32
|
+
*/
|
|
33
|
+
error: Optional<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify if NativeSelect is fluid
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
fluid: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Specify the width of NativeSelect
|
|
41
|
+
*/
|
|
42
|
+
width: Optional<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Specify if overflow displays ellipsis
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
ellipse: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Specify if the NativeSelect displays with an asterisk
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
hideRequiredMarker: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Specify the theme of the NativeSelect. By default it inherits the theme from the parent
|
|
55
|
+
*/
|
|
56
|
+
theme: Optional<ThemeTypes>;
|
|
57
|
+
static styles: import('lit').CSSResult;
|
|
58
|
+
private _selectLabel;
|
|
59
|
+
private _selectHelperText;
|
|
60
|
+
updated(cP: Map<string, unknown>): void;
|
|
61
|
+
finalizeAssociatedCallback(value: string): FinalizeAssociatedResult;
|
|
62
|
+
render(): TemplateResult;
|
|
63
|
+
}
|
|
64
|
+
declare global {
|
|
65
|
+
interface HTMLElementTagNameMap {
|
|
66
|
+
'bm-native-select': BmNativeSelect;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=NativeSelect.d.ts.map
|