@matter-server/dashboard 0.2.7-alpha.0-20260118-993a1c7 → 0.2.7-alpha.0-20260118-45c7af0

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.
Files changed (30) hide show
  1. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts +33 -0
  2. package/dist/esm/components/dialogs/settings/log-level-dialog.d.ts.map +1 -0
  3. package/dist/esm/components/dialogs/settings/log-level-dialog.js +185 -0
  4. package/dist/esm/components/dialogs/settings/log-level-dialog.js.map +6 -0
  5. package/dist/esm/components/dialogs/settings/show-log-level-dialog.d.ts +8 -0
  6. package/dist/esm/components/dialogs/settings/show-log-level-dialog.d.ts.map +1 -0
  7. package/dist/esm/components/dialogs/settings/show-log-level-dialog.js +15 -0
  8. package/dist/esm/components/dialogs/settings/show-log-level-dialog.js.map +6 -0
  9. package/dist/esm/pages/components/header.d.ts +1 -0
  10. package/dist/esm/pages/components/header.d.ts.map +1 -1
  11. package/dist/esm/pages/components/header.js +13 -1
  12. package/dist/esm/pages/components/header.js.map +1 -1
  13. package/dist/web/js/{commission-node-dialog-DGw5qDgH.js → commission-node-dialog-CoaDIV2Y.js} +5 -5
  14. package/dist/web/js/{commission-node-existing-CHyyeC8y.js → commission-node-existing-DEU_mJjO.js} +5 -4
  15. package/dist/web/js/{commission-node-thread-iRDSlidy.js → commission-node-thread-DZ6DghSs.js} +5 -4
  16. package/dist/web/js/{commission-node-wifi-C4YNR3bG.js → commission-node-wifi-DOyin0q3.js} +5 -4
  17. package/dist/web/js/{dialog-box-ag-xOaYh.js → dialog-box-B5sunUPv.js} +2 -2
  18. package/dist/web/js/{fire_event-BeiEbHcE.js → fire_event-C9Duc1j-.js} +1 -1
  19. package/dist/web/js/log-level-dialog-B7LsZYUL.js +3232 -0
  20. package/dist/web/js/main.js +24 -1
  21. package/dist/web/js/{matter-dashboard-app-BxQ4W_uT.js → matter-dashboard-app-DlHSE_Qh.js} +81 -5
  22. package/dist/web/js/{node-binding-dialog-ClziphM0.js → node-binding-dialog-BifZsigR.js} +4 -3
  23. package/dist/web/js/outlined-text-field-D2BOt1yD.js +968 -0
  24. package/dist/web/js/{prevent_default-Bs2sUnny.js → prevent_default-CuW2EnKR.js} +1 -1
  25. package/dist/web/js/validator-MOJiFndw.js +1122 -0
  26. package/package.json +4 -4
  27. package/src/components/dialogs/settings/log-level-dialog.ts +179 -0
  28. package/src/components/dialogs/settings/show-log-level-dialog.ts +14 -0
  29. package/src/pages/components/header.ts +16 -1
  30. package/dist/web/js/outlined-text-field-B-CiqgEJ.js +0 -2086
@@ -0,0 +1,968 @@
1
+ import { j as i, s as e, v as i$1, w as t, x as E, A, m as mixinDelegatesAria, k as mixinElementInternals, i as i$2, _ as __decorate, n, r as r$1, a as e$1, o, f as e$2, h as b, u, l as i$3, t as t$1 } from './matter-dashboard-app-DlHSE_Qh.js';
2
+ import { V as Validator, m as mixinOnReportValidity, a as mixinConstraintValidation, b as mixinFormAssociated, o as o$1, g as getFormValue, d as createValidator, e as getValidityAnchor, c as onReportValidity } from './validator-MOJiFndw.js';
3
+ import { r as redispatchEvent } from './prevent_default-CuW2EnKR.js';
4
+
5
+ /**
6
+ * @license
7
+ * Copyright 2024 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ // Generated stylesheet for ./textfield/internal/outlined-styles.css.
11
+ const styles$1 = i`:host{--_caret-color: var(--md-outlined-text-field-caret-color, var(--md-sys-color-primary, #6750a4));--_disabled-input-text-color: var(--md-outlined-text-field-disabled-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-input-text-opacity: var(--md-outlined-text-field-disabled-input-text-opacity, 0.38);--_disabled-label-text-color: var(--md-outlined-text-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-outlined-text-field-disabled-label-text-opacity, 0.38);--_disabled-leading-icon-color: var(--md-outlined-text-field-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-icon-opacity: var(--md-outlined-text-field-disabled-leading-icon-opacity, 0.38);--_disabled-outline-color: var(--md-outlined-text-field-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-opacity: var(--md-outlined-text-field-disabled-outline-opacity, 0.12);--_disabled-outline-width: var(--md-outlined-text-field-disabled-outline-width, 1px);--_disabled-supporting-text-color: var(--md-outlined-text-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-supporting-text-opacity: var(--md-outlined-text-field-disabled-supporting-text-opacity, 0.38);--_disabled-trailing-icon-color: var(--md-outlined-text-field-disabled-trailing-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-trailing-icon-opacity: var(--md-outlined-text-field-disabled-trailing-icon-opacity, 0.38);--_error-focus-caret-color: var(--md-outlined-text-field-error-focus-caret-color, var(--md-sys-color-error, #b3261e));--_error-focus-input-text-color: var(--md-outlined-text-field-error-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-focus-label-text-color: var(--md-outlined-text-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-leading-icon-color: var(--md-outlined-text-field-error-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-outline-color: var(--md-outlined-text-field-error-focus-outline-color, var(--md-sys-color-error, #b3261e));--_error-focus-supporting-text-color: var(--md-outlined-text-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-trailing-icon-color: var(--md-outlined-text-field-error-focus-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_error-hover-input-text-color: var(--md-outlined-text-field-error-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-label-text-color: var(--md-outlined-text-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-leading-icon-color: var(--md-outlined-text-field-error-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-hover-outline-color: var(--md-outlined-text-field-error-hover-outline-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-supporting-text-color: var(--md-outlined-text-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-hover-trailing-icon-color: var(--md-outlined-text-field-error-hover-trailing-icon-color, var(--md-sys-color-on-error-container, #410e0b));--_error-input-text-color: var(--md-outlined-text-field-error-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-label-text-color: var(--md-outlined-text-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_error-leading-icon-color: var(--md-outlined-text-field-error-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-outline-color: var(--md-outlined-text-field-error-outline-color, var(--md-sys-color-error, #b3261e));--_error-supporting-text-color: var(--md-outlined-text-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-trailing-icon-color: var(--md-outlined-text-field-error-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_focus-input-text-color: var(--md-outlined-text-field-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_focus-label-text-color: var(--md-outlined-text-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-leading-icon-color: var(--md-outlined-text-field-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-outline-color: var(--md-outlined-text-field-focus-outline-color, var(--md-sys-color-primary, #6750a4));--_focus-outline-width: var(--md-outlined-text-field-focus-outline-width, 3px);--_focus-supporting-text-color: var(--md-outlined-text-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-trailing-icon-color: var(--md-outlined-text-field-focus-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-input-text-color: var(--md-outlined-text-field-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-outlined-text-field-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-leading-icon-color: var(--md-outlined-text-field-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-outline-color: var(--md-outlined-text-field-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-outline-width: var(--md-outlined-text-field-hover-outline-width, 1px);--_hover-supporting-text-color: var(--md-outlined-text-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-trailing-icon-color: var(--md-outlined-text-field-hover-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-color: var(--md-outlined-text-field-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_input-text-font: var(--md-outlined-text-field-input-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_input-text-line-height: var(--md-outlined-text-field-input-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_input-text-placeholder-color: var(--md-outlined-text-field-input-text-placeholder-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-prefix-color: var(--md-outlined-text-field-input-text-prefix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-size: var(--md-outlined-text-field-input-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_input-text-suffix-color: var(--md-outlined-text-field-input-text-suffix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-weight: var(--md-outlined-text-field-input-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_label-text-color: var(--md-outlined-text-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-font: var(--md-outlined-text-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-outlined-text-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_label-text-populated-line-height: var(--md-outlined-text-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_label-text-populated-size: var(--md-outlined-text-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_label-text-size: var(--md-outlined-text-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_label-text-weight: var(--md-outlined-text-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_leading-icon-color: var(--md-outlined-text-field-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_leading-icon-size: var(--md-outlined-text-field-leading-icon-size, 24px);--_outline-color: var(--md-outlined-text-field-outline-color, var(--md-sys-color-outline, #79747e));--_outline-width: var(--md-outlined-text-field-outline-width, 1px);--_supporting-text-color: var(--md-outlined-text-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_supporting-text-font: var(--md-outlined-text-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_supporting-text-line-height: var(--md-outlined-text-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_supporting-text-size: var(--md-outlined-text-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_supporting-text-weight: var(--md-outlined-text-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_trailing-icon-color: var(--md-outlined-text-field-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_trailing-icon-size: var(--md-outlined-text-field-trailing-icon-size, 24px);--_container-shape-start-start: var(--md-outlined-text-field-container-shape-start-start, var(--md-outlined-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-start-end: var(--md-outlined-text-field-container-shape-start-end, var(--md-outlined-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-end: var(--md-outlined-text-field-container-shape-end-end, var(--md-outlined-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-start: var(--md-outlined-text-field-container-shape-end-start, var(--md-outlined-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_icon-input-space: var(--md-outlined-text-field-icon-input-space, 16px);--_leading-space: var(--md-outlined-text-field-leading-space, 16px);--_trailing-space: var(--md-outlined-text-field-trailing-space, 16px);--_top-space: var(--md-outlined-text-field-top-space, 16px);--_bottom-space: var(--md-outlined-text-field-bottom-space, 16px);--_input-text-prefix-trailing-space: var(--md-outlined-text-field-input-text-prefix-trailing-space, 2px);--_input-text-suffix-leading-space: var(--md-outlined-text-field-input-text-suffix-leading-space, 2px);--_focus-caret-color: var(--md-outlined-text-field-focus-caret-color, var(--md-sys-color-primary, #6750a4));--_with-leading-icon-leading-space: var(--md-outlined-text-field-with-leading-icon-leading-space, 12px);--_with-trailing-icon-trailing-space: var(--md-outlined-text-field-with-trailing-icon-trailing-space, 12px);--md-outlined-field-bottom-space: var(--_bottom-space);--md-outlined-field-container-shape-end-end: var(--_container-shape-end-end);--md-outlined-field-container-shape-end-start: var(--_container-shape-end-start);--md-outlined-field-container-shape-start-end: var(--_container-shape-start-end);--md-outlined-field-container-shape-start-start: var(--_container-shape-start-start);--md-outlined-field-content-color: var(--_input-text-color);--md-outlined-field-content-font: var(--_input-text-font);--md-outlined-field-content-line-height: var(--_input-text-line-height);--md-outlined-field-content-size: var(--_input-text-size);--md-outlined-field-content-space: var(--_icon-input-space);--md-outlined-field-content-weight: var(--_input-text-weight);--md-outlined-field-disabled-content-color: var(--_disabled-input-text-color);--md-outlined-field-disabled-content-opacity: var(--_disabled-input-text-opacity);--md-outlined-field-disabled-label-text-color: var(--_disabled-label-text-color);--md-outlined-field-disabled-label-text-opacity: var(--_disabled-label-text-opacity);--md-outlined-field-disabled-leading-content-color: var(--_disabled-leading-icon-color);--md-outlined-field-disabled-leading-content-opacity: var(--_disabled-leading-icon-opacity);--md-outlined-field-disabled-outline-color: var(--_disabled-outline-color);--md-outlined-field-disabled-outline-opacity: var(--_disabled-outline-opacity);--md-outlined-field-disabled-outline-width: var(--_disabled-outline-width);--md-outlined-field-disabled-supporting-text-color: var(--_disabled-supporting-text-color);--md-outlined-field-disabled-supporting-text-opacity: var(--_disabled-supporting-text-opacity);--md-outlined-field-disabled-trailing-content-color: var(--_disabled-trailing-icon-color);--md-outlined-field-disabled-trailing-content-opacity: var(--_disabled-trailing-icon-opacity);--md-outlined-field-error-content-color: var(--_error-input-text-color);--md-outlined-field-error-focus-content-color: var(--_error-focus-input-text-color);--md-outlined-field-error-focus-label-text-color: var(--_error-focus-label-text-color);--md-outlined-field-error-focus-leading-content-color: var(--_error-focus-leading-icon-color);--md-outlined-field-error-focus-outline-color: var(--_error-focus-outline-color);--md-outlined-field-error-focus-supporting-text-color: var(--_error-focus-supporting-text-color);--md-outlined-field-error-focus-trailing-content-color: var(--_error-focus-trailing-icon-color);--md-outlined-field-error-hover-content-color: var(--_error-hover-input-text-color);--md-outlined-field-error-hover-label-text-color: var(--_error-hover-label-text-color);--md-outlined-field-error-hover-leading-content-color: var(--_error-hover-leading-icon-color);--md-outlined-field-error-hover-outline-color: var(--_error-hover-outline-color);--md-outlined-field-error-hover-supporting-text-color: var(--_error-hover-supporting-text-color);--md-outlined-field-error-hover-trailing-content-color: var(--_error-hover-trailing-icon-color);--md-outlined-field-error-label-text-color: var(--_error-label-text-color);--md-outlined-field-error-leading-content-color: var(--_error-leading-icon-color);--md-outlined-field-error-outline-color: var(--_error-outline-color);--md-outlined-field-error-supporting-text-color: var(--_error-supporting-text-color);--md-outlined-field-error-trailing-content-color: var(--_error-trailing-icon-color);--md-outlined-field-focus-content-color: var(--_focus-input-text-color);--md-outlined-field-focus-label-text-color: var(--_focus-label-text-color);--md-outlined-field-focus-leading-content-color: var(--_focus-leading-icon-color);--md-outlined-field-focus-outline-color: var(--_focus-outline-color);--md-outlined-field-focus-outline-width: var(--_focus-outline-width);--md-outlined-field-focus-supporting-text-color: var(--_focus-supporting-text-color);--md-outlined-field-focus-trailing-content-color: var(--_focus-trailing-icon-color);--md-outlined-field-hover-content-color: var(--_hover-input-text-color);--md-outlined-field-hover-label-text-color: var(--_hover-label-text-color);--md-outlined-field-hover-leading-content-color: var(--_hover-leading-icon-color);--md-outlined-field-hover-outline-color: var(--_hover-outline-color);--md-outlined-field-hover-outline-width: var(--_hover-outline-width);--md-outlined-field-hover-supporting-text-color: var(--_hover-supporting-text-color);--md-outlined-field-hover-trailing-content-color: var(--_hover-trailing-icon-color);--md-outlined-field-label-text-color: var(--_label-text-color);--md-outlined-field-label-text-font: var(--_label-text-font);--md-outlined-field-label-text-line-height: var(--_label-text-line-height);--md-outlined-field-label-text-populated-line-height: var(--_label-text-populated-line-height);--md-outlined-field-label-text-populated-size: var(--_label-text-populated-size);--md-outlined-field-label-text-size: var(--_label-text-size);--md-outlined-field-label-text-weight: var(--_label-text-weight);--md-outlined-field-leading-content-color: var(--_leading-icon-color);--md-outlined-field-leading-space: var(--_leading-space);--md-outlined-field-outline-color: var(--_outline-color);--md-outlined-field-outline-width: var(--_outline-width);--md-outlined-field-supporting-text-color: var(--_supporting-text-color);--md-outlined-field-supporting-text-font: var(--_supporting-text-font);--md-outlined-field-supporting-text-line-height: var(--_supporting-text-line-height);--md-outlined-field-supporting-text-size: var(--_supporting-text-size);--md-outlined-field-supporting-text-weight: var(--_supporting-text-weight);--md-outlined-field-top-space: var(--_top-space);--md-outlined-field-trailing-content-color: var(--_trailing-icon-color);--md-outlined-field-trailing-space: var(--_trailing-space);--md-outlined-field-with-leading-content-leading-space: var(--_with-leading-icon-leading-space);--md-outlined-field-with-trailing-content-trailing-space: var(--_with-trailing-icon-trailing-space)}
12
+ `;
13
+
14
+ /**
15
+ * @license
16
+ * Copyright 2020 Google LLC
17
+ * SPDX-License-Identifier: BSD-3-Clause
18
+ */
19
+ const r = o => void 0 === o.strings,
20
+ m = {},
21
+ p = (o, t = m) => o._$AH = t;
22
+
23
+ /**
24
+ * @license
25
+ * Copyright 2020 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */
28
+ const l = e(class extends i$1 {
29
+ constructor(r$1) {
30
+ if (super(r$1), r$1.type !== t.PROPERTY && r$1.type !== t.ATTRIBUTE && r$1.type !== t.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
31
+ if (!r(r$1)) throw Error("`live` bindings can only contain a single expression");
32
+ }
33
+ render(r) {
34
+ return r;
35
+ }
36
+ update(i, [t$1]) {
37
+ if (t$1 === E || t$1 === A) return t$1;
38
+ const o = i.element,
39
+ l = i.name;
40
+ if (i.type === t.PROPERTY) {
41
+ if (t$1 === o[l]) return E;
42
+ } else if (i.type === t.BOOLEAN_ATTRIBUTE) {
43
+ if (!!t$1 === o.hasAttribute(l)) return E;
44
+ } else if (i.type === t.ATTRIBUTE && o.getAttribute(l) === t$1 + "") return E;
45
+ return p(i), t$1;
46
+ }
47
+ });
48
+
49
+ /**
50
+ * @license
51
+ * Copyright 2022 Google LLC
52
+ * SPDX-License-Identifier: Apache-2.0
53
+ */
54
+ const stringConverter = {
55
+ fromAttribute(value) {
56
+ return value ?? '';
57
+ },
58
+ toAttribute(value) {
59
+ return value || null;
60
+ }
61
+ };
62
+
63
+ /**
64
+ * @license
65
+ * Copyright 2023 Google LLC
66
+ * SPDX-License-Identifier: Apache-2.0
67
+ */
68
+ /**
69
+ * A validator that provides constraint validation that emulates `<input>` and
70
+ * `<textarea>` validation.
71
+ */
72
+ class TextFieldValidator extends Validator {
73
+ computeValidity({
74
+ state,
75
+ renderedControl
76
+ }) {
77
+ let inputOrTextArea = renderedControl;
78
+ if (isInputState(state) && !inputOrTextArea) {
79
+ // Get cached <input> or create it.
80
+ inputOrTextArea = this.inputControl || document.createElement('input');
81
+ // Cache the <input> to re-use it next time.
82
+ this.inputControl = inputOrTextArea;
83
+ } else if (!inputOrTextArea) {
84
+ // Get cached <textarea> or create it.
85
+ inputOrTextArea = this.textAreaControl || document.createElement('textarea');
86
+ // Cache the <textarea> to re-use it next time.
87
+ this.textAreaControl = inputOrTextArea;
88
+ }
89
+ // Set this variable so we can check it for input-specific properties.
90
+ const input = isInputState(state) ? inputOrTextArea : null;
91
+ // Set input's "type" first, since this can change the other properties
92
+ if (input) {
93
+ input.type = state.type;
94
+ }
95
+ if (inputOrTextArea.value !== state.value) {
96
+ // Only programmatically set the value if there's a difference. When using
97
+ // the rendered control, the value will always be up to date. Setting the
98
+ // property (even if it's the same string) will reset the internal <input>
99
+ // dirty flag, making minlength and maxlength validation reset.
100
+ inputOrTextArea.value = state.value;
101
+ }
102
+ inputOrTextArea.required = state.required;
103
+ // The following IDLAttribute properties will always hydrate an attribute,
104
+ // even if set to a the default value ('' or -1). The presence of the
105
+ // attribute triggers constraint validation, so we must remove the attribute
106
+ // when empty.
107
+ if (input) {
108
+ const inputState = state;
109
+ if (inputState.pattern) {
110
+ input.pattern = inputState.pattern;
111
+ } else {
112
+ input.removeAttribute('pattern');
113
+ }
114
+ if (inputState.min) {
115
+ input.min = inputState.min;
116
+ } else {
117
+ input.removeAttribute('min');
118
+ }
119
+ if (inputState.max) {
120
+ input.max = inputState.max;
121
+ } else {
122
+ input.removeAttribute('max');
123
+ }
124
+ if (inputState.step) {
125
+ input.step = inputState.step;
126
+ } else {
127
+ input.removeAttribute('step');
128
+ }
129
+ }
130
+ // Use -1 to represent no minlength and maxlength, which is what the
131
+ // platform input returns. However, it will throw an error if you try to
132
+ // manually set it to -1.
133
+ //
134
+ // While the type is `number`, it may actually be `null` at runtime.
135
+ // `null > -1` is true since `null` coerces to `0`, so we default null and
136
+ // undefined to -1.
137
+ //
138
+ // We set attributes instead of properties since setting a property may
139
+ // throw an out of bounds error in relation to the other property.
140
+ // Attributes will not throw errors while the state is updating.
141
+ if ((state.minLength ?? -1) > -1) {
142
+ inputOrTextArea.setAttribute('minlength', String(state.minLength));
143
+ } else {
144
+ inputOrTextArea.removeAttribute('minlength');
145
+ }
146
+ if ((state.maxLength ?? -1) > -1) {
147
+ inputOrTextArea.setAttribute('maxlength', String(state.maxLength));
148
+ } else {
149
+ inputOrTextArea.removeAttribute('maxlength');
150
+ }
151
+ return {
152
+ validity: inputOrTextArea.validity,
153
+ validationMessage: inputOrTextArea.validationMessage
154
+ };
155
+ }
156
+ equals({
157
+ state: prev
158
+ }, {
159
+ state: next
160
+ }) {
161
+ // Check shared input and textarea properties
162
+ const inputOrTextAreaEqual = prev.type === next.type && prev.value === next.value && prev.required === next.required && prev.minLength === next.minLength && prev.maxLength === next.maxLength;
163
+ if (!isInputState(prev) || !isInputState(next)) {
164
+ // Both are textareas, all relevant properties are equal.
165
+ return inputOrTextAreaEqual;
166
+ }
167
+ // Check additional input-specific properties.
168
+ return inputOrTextAreaEqual && prev.pattern === next.pattern && prev.min === next.min && prev.max === next.max && prev.step === next.step;
169
+ }
170
+ copy({
171
+ state
172
+ }) {
173
+ // Don't hold a reference to the rendered control when copying since we
174
+ // don't use it when checking if the state changed.
175
+ return {
176
+ state: isInputState(state) ? this.copyInput(state) : this.copyTextArea(state),
177
+ renderedControl: null
178
+ };
179
+ }
180
+ copyInput(state) {
181
+ const {
182
+ type,
183
+ pattern,
184
+ min,
185
+ max,
186
+ step
187
+ } = state;
188
+ return {
189
+ ...this.copySharedState(state),
190
+ type,
191
+ pattern,
192
+ min,
193
+ max,
194
+ step
195
+ };
196
+ }
197
+ copyTextArea(state) {
198
+ return {
199
+ ...this.copySharedState(state),
200
+ type: state.type
201
+ };
202
+ }
203
+ copySharedState({
204
+ value,
205
+ required,
206
+ minLength,
207
+ maxLength
208
+ }) {
209
+ return {
210
+ value,
211
+ required,
212
+ minLength,
213
+ maxLength
214
+ };
215
+ }
216
+ }
217
+ function isInputState(state) {
218
+ return state.type !== 'textarea';
219
+ }
220
+
221
+ /**
222
+ * @license
223
+ * Copyright 2021 Google LLC
224
+ * SPDX-License-Identifier: Apache-2.0
225
+ */
226
+ // Separate variable needed for closure.
227
+ const textFieldBaseClass = mixinDelegatesAria(mixinOnReportValidity(mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(i$2)))));
228
+ /**
229
+ * A text field component.
230
+ *
231
+ * @fires select {Event} The native `select` event on
232
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select_event)
233
+ * --bubbles
234
+ * @fires change {Event} The native `change` event on
235
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)
236
+ * --bubbles
237
+ * @fires input {InputEvent} The native `input` event on
238
+ * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)
239
+ * --bubbles --composed
240
+ */
241
+ class TextField extends textFieldBaseClass {
242
+ constructor() {
243
+ super(...arguments);
244
+ /**
245
+ * Gets or sets whether or not the text field is in a visually invalid state.
246
+ *
247
+ * This error state overrides the error state controlled by
248
+ * `reportValidity()`.
249
+ */
250
+ this.error = false;
251
+ /**
252
+ * The error message that replaces supporting text when `error` is true. If
253
+ * `errorText` is an empty string, then the supporting text will continue to
254
+ * show.
255
+ *
256
+ * This error message overrides the error message displayed by
257
+ * `reportValidity()`.
258
+ */
259
+ this.errorText = '';
260
+ /**
261
+ * The floating Material label of the textfield component. It informs the user
262
+ * about what information is requested for a text field. It is aligned with
263
+ * the input text, is always visible, and it floats when focused or when text
264
+ * is entered into the textfield. This label also sets accessibilty labels,
265
+ * but the accessible label is overriden by `aria-label`.
266
+ *
267
+ * Learn more about floating labels from the Material Design guidelines:
268
+ * https://m3.material.io/components/text-fields/guidelines
269
+ */
270
+ this.label = '';
271
+ /**
272
+ * Disables the asterisk on the floating label, when the text field is
273
+ * required.
274
+ */
275
+ this.noAsterisk = false;
276
+ /**
277
+ * Indicates that the user must specify a value for the input before the
278
+ * owning form can be submitted and will render an error state when
279
+ * `reportValidity()` is invoked when value is empty. Additionally the
280
+ * floating label will render an asterisk `"*"` when true.
281
+ *
282
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required
283
+ */
284
+ this.required = false;
285
+ /**
286
+ * The current value of the text field. It is always a string.
287
+ */
288
+ this.value = '';
289
+ /**
290
+ * An optional prefix to display before the input value.
291
+ */
292
+ this.prefixText = '';
293
+ /**
294
+ * An optional suffix to display after the input value.
295
+ */
296
+ this.suffixText = '';
297
+ /**
298
+ * Whether or not the text field has a leading icon. Used for SSR.
299
+ */
300
+ this.hasLeadingIcon = false;
301
+ /**
302
+ * Whether or not the text field has a trailing icon. Used for SSR.
303
+ */
304
+ this.hasTrailingIcon = false;
305
+ /**
306
+ * Conveys additional information below the text field, such as how it should
307
+ * be used.
308
+ */
309
+ this.supportingText = '';
310
+ /**
311
+ * Override the input text CSS `direction`. Useful for RTL languages that use
312
+ * LTR notation for fractions.
313
+ */
314
+ this.textDirection = '';
315
+ /**
316
+ * The number of rows to display for a `type="textarea"` text field.
317
+ * Defaults to 2.
318
+ */
319
+ this.rows = 2;
320
+ /**
321
+ * The number of cols to display for a `type="textarea"` text field.
322
+ * Defaults to 20.
323
+ */
324
+ this.cols = 20;
325
+ // <input> properties
326
+ this.inputMode = '';
327
+ /**
328
+ * Defines the greatest value in the range of permitted values.
329
+ *
330
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max
331
+ */
332
+ this.max = '';
333
+ /**
334
+ * The maximum number of characters a user can enter into the text field. Set
335
+ * to -1 for none.
336
+ *
337
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
338
+ */
339
+ this.maxLength = -1;
340
+ /**
341
+ * Defines the most negative value in the range of permitted values.
342
+ *
343
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min
344
+ */
345
+ this.min = '';
346
+ /**
347
+ * The minimum number of characters a user can enter into the text field. Set
348
+ * to -1 for none.
349
+ *
350
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
351
+ */
352
+ this.minLength = -1;
353
+ /**
354
+ * When true, hide the spinner for `type="number"` text fields.
355
+ */
356
+ this.noSpinner = false;
357
+ /**
358
+ * A regular expression that the text field's value must match to pass
359
+ * constraint validation.
360
+ *
361
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern
362
+ */
363
+ this.pattern = '';
364
+ /**
365
+ * Defines the text displayed in the textfield when it has no value. Provides
366
+ * a brief hint to the user as to the expected type of data that should be
367
+ * entered into the control. Unlike `label`, the placeholder is not visible
368
+ * and does not float when the textfield has a value.
369
+ *
370
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder
371
+ */
372
+ this.placeholder = '';
373
+ /**
374
+ * Indicates whether or not a user should be able to edit the text field's
375
+ * value.
376
+ *
377
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly
378
+ */
379
+ this.readOnly = false;
380
+ /**
381
+ * Indicates that input accepts multiple email addresses.
382
+ *
383
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple
384
+ */
385
+ this.multiple = false;
386
+ /**
387
+ * Returns or sets the element's step attribute, which works with min and max
388
+ * to limit the increments at which a numeric or date-time value can be set.
389
+ *
390
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
391
+ */
392
+ this.step = '';
393
+ /**
394
+ * The `<input>` type to use, defaults to "text". The type greatly changes how
395
+ * the text field behaves.
396
+ *
397
+ * Text fields support a limited number of `<input>` types:
398
+ *
399
+ * - text
400
+ * - textarea
401
+ * - email
402
+ * - number
403
+ * - password
404
+ * - search
405
+ * - tel
406
+ * - url
407
+ *
408
+ * See
409
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
410
+ * for more details on each input type.
411
+ */
412
+ this.type = 'text';
413
+ /**
414
+ * Describes what, if any, type of autocomplete functionality the input
415
+ * should provide.
416
+ *
417
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
418
+ */
419
+ this.autocomplete = '';
420
+ /**
421
+ * Returns true when the text field has been interacted with. Native
422
+ * validation errors only display in response to user interactions.
423
+ */
424
+ this.dirty = false;
425
+ this.focused = false;
426
+ /**
427
+ * Whether or not a native error has been reported via `reportValidity()`.
428
+ */
429
+ this.nativeError = false;
430
+ /**
431
+ * The validation message displayed from a native error via
432
+ * `reportValidity()`.
433
+ */
434
+ this.nativeErrorText = '';
435
+ }
436
+ /**
437
+ * Gets or sets the direction in which selection occurred.
438
+ */
439
+ get selectionDirection() {
440
+ return this.getInputOrTextarea().selectionDirection;
441
+ }
442
+ set selectionDirection(value) {
443
+ this.getInputOrTextarea().selectionDirection = value;
444
+ }
445
+ /**
446
+ * Gets or sets the end position or offset of a text selection.
447
+ */
448
+ get selectionEnd() {
449
+ return this.getInputOrTextarea().selectionEnd;
450
+ }
451
+ set selectionEnd(value) {
452
+ this.getInputOrTextarea().selectionEnd = value;
453
+ }
454
+ /**
455
+ * Gets or sets the starting position or offset of a text selection.
456
+ */
457
+ get selectionStart() {
458
+ return this.getInputOrTextarea().selectionStart;
459
+ }
460
+ set selectionStart(value) {
461
+ this.getInputOrTextarea().selectionStart = value;
462
+ }
463
+ /**
464
+ * The text field's value as a number.
465
+ */
466
+ get valueAsNumber() {
467
+ const input = this.getInput();
468
+ if (!input) {
469
+ return NaN;
470
+ }
471
+ return input.valueAsNumber;
472
+ }
473
+ set valueAsNumber(value) {
474
+ const input = this.getInput();
475
+ if (!input) {
476
+ return;
477
+ }
478
+ input.valueAsNumber = value;
479
+ this.value = input.value;
480
+ }
481
+ /**
482
+ * The text field's value as a Date.
483
+ */
484
+ get valueAsDate() {
485
+ const input = this.getInput();
486
+ if (!input) {
487
+ return null;
488
+ }
489
+ return input.valueAsDate;
490
+ }
491
+ set valueAsDate(value) {
492
+ const input = this.getInput();
493
+ if (!input) {
494
+ return;
495
+ }
496
+ input.valueAsDate = value;
497
+ this.value = input.value;
498
+ }
499
+ get hasError() {
500
+ return this.error || this.nativeError;
501
+ }
502
+ /**
503
+ * Selects all the text in the text field.
504
+ *
505
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select
506
+ */
507
+ select() {
508
+ this.getInputOrTextarea().select();
509
+ }
510
+ setRangeText(...args) {
511
+ // Calling setRangeText with 1 vs 3-4 arguments has different behavior.
512
+ // Use spread syntax and type casting to ensure correct usage.
513
+ this.getInputOrTextarea().setRangeText(...args);
514
+ this.value = this.getInputOrTextarea().value;
515
+ }
516
+ /**
517
+ * Sets the start and end positions of a selection in the text field.
518
+ *
519
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
520
+ *
521
+ * @param start The offset into the text field for the start of the selection.
522
+ * @param end The offset into the text field for the end of the selection.
523
+ * @param direction The direction in which the selection is performed.
524
+ */
525
+ setSelectionRange(start, end, direction) {
526
+ this.getInputOrTextarea().setSelectionRange(start, end, direction);
527
+ }
528
+ /**
529
+ * Shows the browser picker for an input element of type "date", "time", etc.
530
+ *
531
+ * For a full list of supported types, see:
532
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker#browser_compatibility
533
+ *
534
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
535
+ */
536
+ showPicker() {
537
+ const input = this.getInput();
538
+ if (!input) {
539
+ return;
540
+ }
541
+ input.showPicker();
542
+ }
543
+ /**
544
+ * Decrements the value of a numeric type text field by `step` or `n` `step`
545
+ * number of times.
546
+ *
547
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepDown
548
+ *
549
+ * @param stepDecrement The number of steps to decrement, defaults to 1.
550
+ */
551
+ stepDown(stepDecrement) {
552
+ const input = this.getInput();
553
+ if (!input) {
554
+ return;
555
+ }
556
+ input.stepDown(stepDecrement);
557
+ this.value = input.value;
558
+ }
559
+ /**
560
+ * Increments the value of a numeric type text field by `step` or `n` `step`
561
+ * number of times.
562
+ *
563
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepUp
564
+ *
565
+ * @param stepIncrement The number of steps to increment, defaults to 1.
566
+ */
567
+ stepUp(stepIncrement) {
568
+ const input = this.getInput();
569
+ if (!input) {
570
+ return;
571
+ }
572
+ input.stepUp(stepIncrement);
573
+ this.value = input.value;
574
+ }
575
+ /**
576
+ * Reset the text field to its default value.
577
+ */
578
+ reset() {
579
+ this.dirty = false;
580
+ this.value = this.getAttribute('value') ?? '';
581
+ this.nativeError = false;
582
+ this.nativeErrorText = '';
583
+ }
584
+ attributeChangedCallback(attribute, newValue, oldValue) {
585
+ if (attribute === 'value' && this.dirty) {
586
+ // After user input, changing the value attribute no longer updates the
587
+ // text field's value (until reset). This matches native <input> behavior.
588
+ return;
589
+ }
590
+ super.attributeChangedCallback(attribute, newValue, oldValue);
591
+ }
592
+ render() {
593
+ const classes = {
594
+ 'disabled': this.disabled,
595
+ 'error': !this.disabled && this.hasError,
596
+ 'textarea': this.type === 'textarea',
597
+ 'no-spinner': this.noSpinner
598
+ };
599
+ return b`
600
+ <span class="text-field ${e$2(classes)}">
601
+ ${this.renderField()}
602
+ </span>
603
+ `;
604
+ }
605
+ updated(changedProperties) {
606
+ // Keep changedProperties arg so that subclasses may call it
607
+ // If a property such as `type` changes and causes the internal <input>
608
+ // value to change without dispatching an event, re-sync it.
609
+ const value = this.getInputOrTextarea().value;
610
+ if (this.value !== value) {
611
+ // Note this is typically inefficient in updated() since it schedules
612
+ // another update. However, it is needed for the <input> to fully render
613
+ // before checking its value.
614
+ this.value = value;
615
+ }
616
+ }
617
+ renderField() {
618
+ return u`<${this.fieldTag}
619
+ class="field"
620
+ count=${this.value.length}
621
+ ?disabled=${this.disabled}
622
+ ?error=${this.hasError}
623
+ error-text=${this.getErrorText()}
624
+ ?focused=${this.focused}
625
+ ?has-end=${this.hasTrailingIcon}
626
+ ?has-start=${this.hasLeadingIcon}
627
+ label=${this.label}
628
+ ?no-asterisk=${this.noAsterisk}
629
+ max=${this.maxLength}
630
+ ?populated=${!!this.value}
631
+ ?required=${this.required}
632
+ ?resizable=${this.type === 'textarea'}
633
+ supporting-text=${this.supportingText}
634
+ >
635
+ ${this.renderLeadingIcon()}
636
+ ${this.renderInputOrTextarea()}
637
+ ${this.renderTrailingIcon()}
638
+ <div id="description" slot="aria-describedby"></div>
639
+ <slot name="container" slot="container"></slot>
640
+ </${this.fieldTag}>`;
641
+ }
642
+ renderLeadingIcon() {
643
+ return b`
644
+ <span class="icon leading" slot="start">
645
+ <slot name="leading-icon" @slotchange=${this.handleIconChange}></slot>
646
+ </span>
647
+ `;
648
+ }
649
+ renderTrailingIcon() {
650
+ return b`
651
+ <span class="icon trailing" slot="end">
652
+ <slot name="trailing-icon" @slotchange=${this.handleIconChange}></slot>
653
+ </span>
654
+ `;
655
+ }
656
+ renderInputOrTextarea() {
657
+ const style = {
658
+ 'direction': this.textDirection
659
+ };
660
+ const ariaLabel = this.ariaLabel || this.label || A;
661
+ // lit-anaylzer `autocomplete` types are too strict
662
+ // tslint:disable-next-line:no-any
663
+ const autocomplete = this.autocomplete;
664
+ // These properties may be set to null if the attribute is removed, and
665
+ // `null > -1` is incorrectly `true`.
666
+ const hasMaxLength = (this.maxLength ?? -1) > -1;
667
+ const hasMinLength = (this.minLength ?? -1) > -1;
668
+ if (this.type === 'textarea') {
669
+ return b`
670
+ <textarea
671
+ class="input"
672
+ style=${o$1(style)}
673
+ aria-describedby="description"
674
+ aria-invalid=${this.hasError}
675
+ aria-label=${ariaLabel}
676
+ autocomplete=${autocomplete || A}
677
+ name=${this.name || A}
678
+ ?disabled=${this.disabled}
679
+ maxlength=${hasMaxLength ? this.maxLength : A}
680
+ minlength=${hasMinLength ? this.minLength : A}
681
+ placeholder=${this.placeholder || A}
682
+ ?readonly=${this.readOnly}
683
+ ?required=${this.required}
684
+ rows=${this.rows}
685
+ cols=${this.cols}
686
+ .value=${l(this.value)}
687
+ @change=${this.redispatchEvent}
688
+ @focus=${this.handleFocusChange}
689
+ @blur=${this.handleFocusChange}
690
+ @input=${this.handleInput}
691
+ @select=${this.redispatchEvent}></textarea>
692
+ `;
693
+ }
694
+ const prefix = this.renderPrefix();
695
+ const suffix = this.renderSuffix();
696
+ // TODO(b/243805848): remove `as unknown as number` and `as any` once lit
697
+ // analyzer is fixed
698
+ // tslint:disable-next-line:no-any
699
+ const inputMode = this.inputMode;
700
+ return b`
701
+ <div class="input-wrapper">
702
+ ${prefix}
703
+ <input
704
+ class="input"
705
+ style=${o$1(style)}
706
+ aria-describedby="description"
707
+ aria-invalid=${this.hasError}
708
+ aria-label=${ariaLabel}
709
+ autocomplete=${autocomplete || A}
710
+ name=${this.name || A}
711
+ ?disabled=${this.disabled}
712
+ inputmode=${inputMode || A}
713
+ max=${this.max || A}
714
+ maxlength=${hasMaxLength ? this.maxLength : A}
715
+ min=${this.min || A}
716
+ minlength=${hasMinLength ? this.minLength : A}
717
+ pattern=${this.pattern || A}
718
+ placeholder=${this.placeholder || A}
719
+ ?readonly=${this.readOnly}
720
+ ?required=${this.required}
721
+ ?multiple=${this.multiple}
722
+ step=${this.step || A}
723
+ type=${this.type}
724
+ .value=${l(this.value)}
725
+ @change=${this.redispatchEvent}
726
+ @focus=${this.handleFocusChange}
727
+ @blur=${this.handleFocusChange}
728
+ @input=${this.handleInput}
729
+ @select=${this.redispatchEvent} />
730
+ ${suffix}
731
+ </div>
732
+ `;
733
+ }
734
+ renderPrefix() {
735
+ return this.renderAffix(this.prefixText, /* isSuffix */false);
736
+ }
737
+ renderSuffix() {
738
+ return this.renderAffix(this.suffixText, /* isSuffix */true);
739
+ }
740
+ renderAffix(text, isSuffix) {
741
+ if (!text) {
742
+ return A;
743
+ }
744
+ const classes = {
745
+ 'suffix': isSuffix,
746
+ 'prefix': !isSuffix
747
+ };
748
+ return b`<span class="${e$2(classes)}">${text}</span>`;
749
+ }
750
+ getErrorText() {
751
+ return this.error ? this.errorText : this.nativeErrorText;
752
+ }
753
+ handleFocusChange() {
754
+ var _this$inputOrTextarea;
755
+ // When calling focus() or reportValidity() during change, it's possible
756
+ // for blur to be called after the new focus event. Rather than set
757
+ // `this.focused` to true/false on focus/blur, we always set it to whether
758
+ // or not the input itself is focused.
759
+ this.focused = ((_this$inputOrTextarea = this.inputOrTextarea) === null || _this$inputOrTextarea === void 0 ? void 0 : _this$inputOrTextarea.matches(':focus')) ?? false;
760
+ }
761
+ handleInput(event) {
762
+ this.dirty = true;
763
+ this.value = event.target.value;
764
+ }
765
+ redispatchEvent(event) {
766
+ redispatchEvent(this, event);
767
+ }
768
+ getInputOrTextarea() {
769
+ if (!this.inputOrTextarea) {
770
+ // If the input is not yet defined, synchronously render.
771
+ // e.g.
772
+ // const textField = document.createElement('md-outlined-text-field');
773
+ // document.body.appendChild(textField);
774
+ // textField.focus(); // synchronously render
775
+ this.connectedCallback();
776
+ this.scheduleUpdate();
777
+ }
778
+ if (this.isUpdatePending) {
779
+ // If there are pending updates, synchronously perform them. This ensures
780
+ // that constraint validation properties (like `required`) are synced
781
+ // before interacting with input APIs that depend on them.
782
+ this.scheduleUpdate();
783
+ }
784
+ return this.inputOrTextarea;
785
+ }
786
+ getInput() {
787
+ if (this.type === 'textarea') {
788
+ return null;
789
+ }
790
+ return this.getInputOrTextarea();
791
+ }
792
+ handleIconChange() {
793
+ this.hasLeadingIcon = this.leadingIcons.length > 0;
794
+ this.hasTrailingIcon = this.trailingIcons.length > 0;
795
+ }
796
+ [getFormValue]() {
797
+ return this.value;
798
+ }
799
+ formResetCallback() {
800
+ this.reset();
801
+ }
802
+ formStateRestoreCallback(state) {
803
+ this.value = state;
804
+ }
805
+ focus() {
806
+ // Required for the case that the user slots a focusable element into the
807
+ // leading icon slot such as an iconbutton due to how delegatesFocus works.
808
+ this.getInputOrTextarea().focus();
809
+ }
810
+ [createValidator]() {
811
+ return new TextFieldValidator(() => ({
812
+ state: this,
813
+ renderedControl: this.inputOrTextarea
814
+ }));
815
+ }
816
+ [getValidityAnchor]() {
817
+ return this.inputOrTextarea;
818
+ }
819
+ [onReportValidity](invalidEvent) {
820
+ // Prevent default pop-up behavior.
821
+ invalidEvent === null || invalidEvent === void 0 || invalidEvent.preventDefault();
822
+ const prevMessage = this.getErrorText();
823
+ this.nativeError = !!invalidEvent;
824
+ this.nativeErrorText = this.validationMessage;
825
+ if (prevMessage === this.getErrorText()) {
826
+ var _this$field;
827
+ (_this$field = this.field) === null || _this$field === void 0 || _this$field.reannounceError();
828
+ }
829
+ }
830
+ }
831
+ /** @nocollapse */
832
+ TextField.shadowRootOptions = {
833
+ ...i$2.shadowRootOptions,
834
+ delegatesFocus: true
835
+ };
836
+ __decorate([n({
837
+ type: Boolean,
838
+ reflect: true
839
+ })], TextField.prototype, "error", void 0);
840
+ __decorate([n({
841
+ attribute: 'error-text'
842
+ })], TextField.prototype, "errorText", void 0);
843
+ __decorate([n()], TextField.prototype, "label", void 0);
844
+ __decorate([n({
845
+ type: Boolean,
846
+ attribute: 'no-asterisk'
847
+ })], TextField.prototype, "noAsterisk", void 0);
848
+ __decorate([n({
849
+ type: Boolean,
850
+ reflect: true
851
+ })], TextField.prototype, "required", void 0);
852
+ __decorate([n()], TextField.prototype, "value", void 0);
853
+ __decorate([n({
854
+ attribute: 'prefix-text'
855
+ })], TextField.prototype, "prefixText", void 0);
856
+ __decorate([n({
857
+ attribute: 'suffix-text'
858
+ })], TextField.prototype, "suffixText", void 0);
859
+ __decorate([n({
860
+ type: Boolean,
861
+ attribute: 'has-leading-icon'
862
+ })], TextField.prototype, "hasLeadingIcon", void 0);
863
+ __decorate([n({
864
+ type: Boolean,
865
+ attribute: 'has-trailing-icon'
866
+ })], TextField.prototype, "hasTrailingIcon", void 0);
867
+ __decorate([n({
868
+ attribute: 'supporting-text'
869
+ })], TextField.prototype, "supportingText", void 0);
870
+ __decorate([n({
871
+ attribute: 'text-direction'
872
+ })], TextField.prototype, "textDirection", void 0);
873
+ __decorate([n({
874
+ type: Number
875
+ })], TextField.prototype, "rows", void 0);
876
+ __decorate([n({
877
+ type: Number
878
+ })], TextField.prototype, "cols", void 0);
879
+ __decorate([n({
880
+ reflect: true
881
+ })], TextField.prototype, "inputMode", void 0);
882
+ __decorate([n()], TextField.prototype, "max", void 0);
883
+ __decorate([n({
884
+ type: Number
885
+ })], TextField.prototype, "maxLength", void 0);
886
+ __decorate([n()], TextField.prototype, "min", void 0);
887
+ __decorate([n({
888
+ type: Number
889
+ })], TextField.prototype, "minLength", void 0);
890
+ __decorate([n({
891
+ type: Boolean,
892
+ attribute: 'no-spinner'
893
+ })], TextField.prototype, "noSpinner", void 0);
894
+ __decorate([n()], TextField.prototype, "pattern", void 0);
895
+ __decorate([n({
896
+ reflect: true,
897
+ converter: stringConverter
898
+ })], TextField.prototype, "placeholder", void 0);
899
+ __decorate([n({
900
+ type: Boolean,
901
+ reflect: true
902
+ })], TextField.prototype, "readOnly", void 0);
903
+ __decorate([n({
904
+ type: Boolean,
905
+ reflect: true
906
+ })], TextField.prototype, "multiple", void 0);
907
+ __decorate([n()], TextField.prototype, "step", void 0);
908
+ __decorate([n({
909
+ reflect: true
910
+ })], TextField.prototype, "type", void 0);
911
+ __decorate([n({
912
+ reflect: true
913
+ })], TextField.prototype, "autocomplete", void 0);
914
+ __decorate([r$1()], TextField.prototype, "dirty", void 0);
915
+ __decorate([r$1()], TextField.prototype, "focused", void 0);
916
+ __decorate([r$1()], TextField.prototype, "nativeError", void 0);
917
+ __decorate([r$1()], TextField.prototype, "nativeErrorText", void 0);
918
+ __decorate([e$1('.input')], TextField.prototype, "inputOrTextarea", void 0);
919
+ __decorate([e$1('.field')], TextField.prototype, "field", void 0);
920
+ __decorate([o({
921
+ slot: 'leading-icon'
922
+ })], TextField.prototype, "leadingIcons", void 0);
923
+ __decorate([o({
924
+ slot: 'trailing-icon'
925
+ })], TextField.prototype, "trailingIcons", void 0);
926
+
927
+ /**
928
+ * @license
929
+ * Copyright 2021 Google LLC
930
+ * SPDX-License-Identifier: Apache-2.0
931
+ */
932
+ /**
933
+ * An outlined text field component
934
+ */
935
+ class OutlinedTextField extends TextField {
936
+ constructor() {
937
+ super(...arguments);
938
+ this.fieldTag = i$3`md-outlined-field`;
939
+ }
940
+ }
941
+
942
+ /**
943
+ * @license
944
+ * Copyright 2024 Google LLC
945
+ * SPDX-License-Identifier: Apache-2.0
946
+ */
947
+ // Generated stylesheet for ./textfield/internal/shared-styles.css.
948
+ const styles = i`:host{display:inline-flex;outline:none;resize:both;text-align:start;-webkit-tap-highlight-color:rgba(0,0,0,0)}.text-field,.field{width:100%}.text-field{display:inline-flex}.field{cursor:text}.disabled .field{cursor:default}.text-field,.textarea .field{resize:inherit}slot[name=container]{border-radius:inherit}.icon{color:currentColor;display:flex;align-items:center;justify-content:center;fill:currentColor;position:relative}.icon ::slotted(*){display:flex;position:absolute}[has-start] .icon.leading{font-size:var(--_leading-icon-size);height:var(--_leading-icon-size);width:var(--_leading-icon-size)}[has-end] .icon.trailing{font-size:var(--_trailing-icon-size);height:var(--_trailing-icon-size);width:var(--_trailing-icon-size)}.input-wrapper{display:flex}.input-wrapper>*{all:inherit;padding:0}.input{caret-color:var(--_caret-color);overflow-x:hidden;text-align:inherit}.input::placeholder{color:currentColor;opacity:1}.input::-webkit-calendar-picker-indicator{display:none}.input::-webkit-search-decoration,.input::-webkit-search-cancel-button{display:none}@media(forced-colors: active){.input{background:none}}.no-spinner .input::-webkit-inner-spin-button,.no-spinner .input::-webkit-outer-spin-button{display:none}.no-spinner .input[type=number]{-moz-appearance:textfield}:focus-within .input{caret-color:var(--_focus-caret-color)}.error:focus-within .input{caret-color:var(--_error-focus-caret-color)}.text-field:not(.disabled) .prefix{color:var(--_input-text-prefix-color)}.text-field:not(.disabled) .suffix{color:var(--_input-text-suffix-color)}.text-field:not(.disabled) .input::placeholder{color:var(--_input-text-placeholder-color)}.prefix,.suffix{text-wrap:nowrap;width:min-content}.prefix{padding-inline-end:var(--_input-text-prefix-trailing-space)}.suffix{padding-inline-start:var(--_input-text-suffix-leading-space)}
949
+ `;
950
+
951
+ /**
952
+ * @license
953
+ * Copyright 2021 Google LLC
954
+ * SPDX-License-Identifier: Apache-2.0
955
+ */
956
+ /**
957
+ * TODO(b/228525797): Add docs
958
+ * @final
959
+ * @suppress {visibility}
960
+ */
961
+ let MdOutlinedTextField = class MdOutlinedTextField extends OutlinedTextField {
962
+ constructor() {
963
+ super(...arguments);
964
+ this.fieldTag = i$3`md-outlined-field`;
965
+ }
966
+ };
967
+ MdOutlinedTextField.styles = [styles, styles$1];
968
+ MdOutlinedTextField = __decorate([t$1('md-outlined-text-field')], MdOutlinedTextField);