@vaadin/field-base 24.0.0-alpha1 → 24.0.0-alpha11

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 (55) hide show
  1. package/index.d.ts +0 -3
  2. package/index.js +0 -3
  3. package/package.json +3 -3
  4. package/src/checked-mixin.d.ts +2 -2
  5. package/src/checked-mixin.js +2 -2
  6. package/src/error-controller.d.ts +3 -8
  7. package/src/error-controller.js +54 -66
  8. package/src/field-aria-controller.d.ts +1 -1
  9. package/src/field-aria-controller.js +11 -11
  10. package/src/field-mixin.d.ts +1 -1
  11. package/src/field-mixin.js +24 -28
  12. package/src/helper-controller.d.ts +3 -5
  13. package/src/helper-controller.js +47 -147
  14. package/src/input-constraints-mixin.d.ts +2 -4
  15. package/src/input-constraints-mixin.js +2 -2
  16. package/src/input-control-mixin.d.ts +3 -3
  17. package/src/input-control-mixin.js +4 -4
  18. package/src/input-controller.d.ts +1 -1
  19. package/src/input-controller.js +5 -8
  20. package/src/input-field-mixin.d.ts +3 -3
  21. package/src/input-field-mixin.js +11 -10
  22. package/src/input-mixin.d.ts +3 -1
  23. package/src/input-mixin.js +26 -10
  24. package/src/label-controller.d.ts +3 -8
  25. package/src/label-controller.js +45 -149
  26. package/src/label-mixin.d.ts +1 -1
  27. package/src/label-mixin.js +14 -9
  28. package/src/labelled-input-controller.d.ts +1 -1
  29. package/src/labelled-input-controller.js +2 -2
  30. package/src/pattern-mixin.d.ts +3 -13
  31. package/src/pattern-mixin.js +2 -50
  32. package/src/slot-styles-mixin.d.ts +1 -1
  33. package/src/slot-styles-mixin.js +1 -1
  34. package/src/styles/clear-button-styles.d.ts +1 -1
  35. package/src/styles/clear-button-styles.js +1 -1
  36. package/src/styles/field-shared-styles.d.ts +1 -1
  37. package/src/styles/field-shared-styles.js +1 -1
  38. package/src/styles/input-field-container-styles.d.ts +1 -1
  39. package/src/styles/input-field-container-styles.js +1 -1
  40. package/src/styles/input-field-shared-styles.d.ts +1 -1
  41. package/src/styles/input-field-shared-styles.js +1 -1
  42. package/src/text-area-controller.d.ts +1 -1
  43. package/src/text-area-controller.js +5 -8
  44. package/src/validate-mixin.d.ts +1 -1
  45. package/src/validate-mixin.js +1 -1
  46. package/src/virtual-keyboard-controller.d.ts +1 -1
  47. package/src/virtual-keyboard-controller.js +1 -1
  48. package/src/delegate-focus-mixin.d.ts +0 -48
  49. package/src/delegate-focus-mixin.js +0 -228
  50. package/src/delegate-state-mixin.d.ts +0 -20
  51. package/src/delegate-state-mixin.js +0 -125
  52. package/src/shadow-focus-mixin.d.ts +0 -23
  53. package/src/shadow-focus-mixin.js +0 -97
  54. package/src/slot-target-controller.d.ts +0 -31
  55. package/src/slot-target-controller.js +0 -123
@@ -1,77 +1,16 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
6
+ import { SlotChildObserveController } from '@vaadin/component-base/src/slot-child-observe-controller.js';
7
7
 
8
8
  /**
9
9
  * A controller to manage the label element.
10
10
  */
11
- export class LabelController extends SlotController {
11
+ export class LabelController extends SlotChildObserveController {
12
12
  constructor(host) {
13
- super(
14
- host,
15
- 'label',
16
- () => document.createElement('label'),
17
- (_host, node) => {
18
- // Set ID attribute or use the existing one.
19
- this.__updateLabelId(node);
20
-
21
- // Set text content for the default label.
22
- this.__updateDefaultLabel(this.label);
23
-
24
- this.__observeLabel(node);
25
- },
26
- true,
27
- );
28
- }
29
-
30
- /**
31
- * @return {string}
32
- */
33
- get labelId() {
34
- return this.node.id;
35
- }
36
-
37
- /**
38
- * Override to initialize the newly added custom label.
39
- *
40
- * @param {Node} labelNode
41
- * @protected
42
- * @override
43
- */
44
- initCustomNode(labelNode) {
45
- this.__updateLabelId(labelNode);
46
-
47
- const hasLabel = this.__hasLabel(labelNode);
48
- this.__toggleHasLabel(hasLabel);
49
- }
50
-
51
- /**
52
- * Override to cleanup label node when it's removed.
53
- *
54
- * @param {Node} node
55
- * @protected
56
- * @override
57
- */
58
- teardownNode(node) {
59
- if (this.__labelObserver) {
60
- this.__labelObserver.disconnect();
61
- }
62
-
63
- let labelNode = this.getSlotChild();
64
-
65
- // If custom label was removed, restore the default one.
66
- if (!labelNode && node !== this.defaultNode) {
67
- labelNode = this.attachDefaultNode();
68
-
69
- // Run initializer to update default label and ID.
70
- this.initNode(labelNode);
71
- }
72
-
73
- const hasLabel = this.__hasLabel(labelNode);
74
- this.__toggleHasLabel(hasLabel);
13
+ super(host, 'label', 'label');
75
14
  }
76
15
 
77
16
  /**
@@ -82,108 +21,65 @@ export class LabelController extends SlotController {
82
21
  setLabel(label) {
83
22
  this.label = label;
84
23
 
85
- this.__updateDefaultLabel(label);
86
- }
87
-
88
- /**
89
- * @param {HTMLElement} labelNode
90
- * @return {boolean}
91
- * @private
92
- */
93
- __hasLabel(labelNode) {
24
+ // Restore the default label, if needed.
25
+ const labelNode = this.getSlotChild();
94
26
  if (!labelNode) {
95
- return false;
27
+ this.restoreDefaultNode();
96
28
  }
97
29
 
98
- return labelNode.children.length > 0 || this.__isNotEmpty(labelNode.textContent);
99
- }
100
-
101
- /**
102
- * @param {string} label
103
- * @private
104
- */
105
- __isNotEmpty(label) {
106
- return Boolean(label && label.trim() !== '');
30
+ // When default label is used, update it.
31
+ if (this.node === this.defaultNode) {
32
+ this.updateDefaultNode(this.node);
33
+ }
107
34
  }
108
35
 
109
36
  /**
110
- * @param {HTMLElement} labelNode
111
- * @private
37
+ * Override method inherited from `SlotChildObserveController`
38
+ * to restore and observe the default label element.
39
+ *
40
+ * @protected
41
+ * @override
112
42
  */
113
- __observeLabel(labelNode) {
114
- this.__labelObserver = new MutationObserver((mutations) => {
115
- mutations.forEach((mutation) => {
116
- const target = mutation.target;
43
+ restoreDefaultNode() {
44
+ const { label } = this;
117
45
 
118
- // Ensure the mutation target is the currently connected label
119
- // to ignore async mutations dispatched for removed element.
120
- const isLabelMutation = target === this.node;
46
+ // Restore the default label.
47
+ if (label && label.trim() !== '') {
48
+ const labelNode = this.attachDefaultNode();
121
49
 
122
- if (mutation.type === 'attributes') {
123
- // We use attributeFilter to only observe ID mutation,
124
- // no need to check for attribute name separately.
125
- if (isLabelMutation && target.id !== this.defaultId) {
126
- this.__updateLabelId(target);
127
- }
128
- } else if (isLabelMutation || target.parentElement === this.node) {
129
- // Update has-label when textContent changes
130
- const hasLabel = this.__hasLabel(this.node);
131
- this.__toggleHasLabel(hasLabel);
132
- }
133
- });
134
- });
135
-
136
- // Observe changes to label ID attribute, text content and children.
137
- this.__labelObserver.observe(labelNode, {
138
- attributes: true,
139
- attributeFilter: ['id'],
140
- childList: true,
141
- subtree: true,
142
- characterData: true,
143
- });
50
+ // Observe the default label.
51
+ this.observeNode(labelNode);
52
+ }
144
53
  }
145
54
 
146
55
  /**
147
- * @param {boolean} hasLabel
148
- * @private
56
+ * Override method inherited from `SlotChildObserveController`
57
+ * to update the default label element text content.
58
+ *
59
+ * @param {Node | undefined} node
60
+ * @protected
61
+ * @override
149
62
  */
150
- __toggleHasLabel(hasLabel) {
151
- this.host.toggleAttribute('has-label', hasLabel);
63
+ updateDefaultNode(node) {
64
+ if (node) {
65
+ node.textContent = this.label;
66
+ }
152
67
 
153
- // Make it possible for other mixins to observe change
154
- this.dispatchEvent(
155
- new CustomEvent('label-changed', {
156
- detail: {
157
- hasLabel,
158
- node: this.node,
159
- },
160
- }),
161
- );
68
+ // Notify the host after update.
69
+ super.updateDefaultNode(node);
162
70
  }
163
71
 
164
72
  /**
165
- * @param {string} label
166
- * @private
73
+ * Override to observe the newly added custom node.
74
+ *
75
+ * @param {Node} node
76
+ * @protected
77
+ * @override
167
78
  */
168
- __updateDefaultLabel(label) {
169
- if (this.defaultNode) {
170
- this.defaultNode.textContent = label;
171
-
172
- // Update has-label if default label is used
173
- if (this.defaultNode === this.node) {
174
- const hasLabel = this.__isNotEmpty(label);
175
- this.__toggleHasLabel(hasLabel);
176
- }
177
- }
178
- }
79
+ initCustomNode(node) {
80
+ // Notify the host about adding a custom node.
81
+ super.initCustomNode(node);
179
82
 
180
- /**
181
- * @param {HTMLElement} labelNode
182
- * @private
183
- */
184
- __updateLabelId(labelNode) {
185
- if (!labelNode.id) {
186
- labelNode.id = this.defaultId;
187
- }
83
+ this.observeNode(node);
188
84
  }
189
85
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
@@ -11,7 +11,7 @@ import { LabelController } from './label-controller.js';
11
11
  * A mixin to provide label via corresponding property or named slot.
12
12
  *
13
13
  * @polymerMixin
14
- * @mixes SlotMixin
14
+ * @mixes ControllerMixin
15
15
  */
16
16
  export const LabelMixin = dedupingMixin(
17
17
  (superclass) =>
@@ -29,9 +29,20 @@ export const LabelMixin = dedupingMixin(
29
29
  };
30
30
  }
31
31
 
32
+ constructor() {
33
+ super();
34
+
35
+ this._labelController = new LabelController(this);
36
+
37
+ this._labelController.addEventListener('slot-content-changed', (event) => {
38
+ this.toggleAttribute('has-label', event.detail.hasContent);
39
+ });
40
+ }
41
+
32
42
  /** @protected */
33
43
  get _labelId() {
34
- return this._labelController.labelId;
44
+ const node = this._labelNode;
45
+ return node && node.id;
35
46
  }
36
47
 
37
48
  /** @protected */
@@ -39,12 +50,6 @@ export const LabelMixin = dedupingMixin(
39
50
  return this._labelController.node;
40
51
  }
41
52
 
42
- constructor() {
43
- super();
44
-
45
- this._labelController = new LabelController(this);
46
- }
47
-
48
53
  /** @protected */
49
54
  ready() {
50
55
  super.ready();
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { ReactiveController } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -12,7 +12,7 @@ export class LabelledInputController {
12
12
  this.input = input;
13
13
  this.__preventDuplicateLabelClick = this.__preventDuplicateLabelClick.bind(this);
14
14
 
15
- labelController.addEventListener('label-changed', (event) => {
15
+ labelController.addEventListener('slot-content-changed', (event) => {
16
16
  this.__initLabel(event.detail.node);
17
17
  });
18
18
 
@@ -1,22 +1,20 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
- import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
8
- import type { DelegateStateMixinClass } from './delegate-state-mixin.js';
7
+ import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
9
8
  import type { InputConstraintsMixinClass } from './input-constraints-mixin.js';
10
9
  import type { InputMixinClass } from './input-mixin.js';
11
10
  import type { ValidateMixinClass } from './validate-mixin.js';
12
11
 
13
12
  /**
14
- * A mixin to provide `pattern` and `preventInvalidInput` properties.
13
+ * A mixin to provide `pattern` property.
15
14
  */
16
15
  export declare function PatternMixin<T extends Constructor<HTMLElement>>(
17
16
  base: T,
18
17
  ): Constructor<DelegateStateMixinClass> &
19
- Constructor<DisabledMixinClass> &
20
18
  Constructor<InputConstraintsMixinClass> &
21
19
  Constructor<InputMixinClass> &
22
20
  Constructor<PatternMixinClass> &
@@ -29,12 +27,4 @@ export declare class PatternMixinClass {
29
27
  * The pattern must match the entire value, not just some subset.
30
28
  */
31
29
  pattern: string;
32
-
33
- /**
34
- * When set to true, user is prevented from typing a value that
35
- * conflicts with the given `pattern`.
36
- * @attr {boolean} prevent-invalid-input
37
- * @deprecated Please use `allowedCharPattern` instead.
38
- */
39
- preventInvalidInput: boolean | null | undefined;
40
30
  }
@@ -1,14 +1,12 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { timeOut } from '@vaadin/component-base/src/async.js';
7
- import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
6
  import { InputConstraintsMixin } from './input-constraints-mixin.js';
9
7
 
10
8
  /**
11
- * A mixin to provide `pattern` and `preventInvalidInput` properties.
9
+ * A mixin to provide `pattern` property.
12
10
  *
13
11
  * @polymerMixin
14
12
  * @mixes InputConstraintsMixin
@@ -24,17 +22,6 @@ export const PatternMixin = (superclass) =>
24
22
  pattern: {
25
23
  type: String,
26
24
  },
27
-
28
- /**
29
- * When set to true, user is prevented from typing a value that
30
- * conflicts with the given `pattern`.
31
- * @attr {boolean} prevent-invalid-input
32
- * @deprecated Please use `allowedCharPattern` instead.
33
- */
34
- preventInvalidInput: {
35
- type: Boolean,
36
- observer: '_preventInvalidInputChanged',
37
- },
38
25
  };
39
26
  }
40
27
 
@@ -45,39 +32,4 @@ export const PatternMixin = (superclass) =>
45
32
  static get constraints() {
46
33
  return [...super.constraints, 'pattern'];
47
34
  }
48
-
49
- /** @private */
50
- _checkInputValue() {
51
- if (this.preventInvalidInput) {
52
- const input = this.inputElement;
53
- if (input && input.value.length > 0 && !this.checkValidity()) {
54
- input.value = this.value || '';
55
- // Add input-prevented attribute for 200ms
56
- this.setAttribute('input-prevented', '');
57
- this._inputDebouncer = Debouncer.debounce(this._inputDebouncer, timeOut.after(200), () => {
58
- this.removeAttribute('input-prevented');
59
- });
60
- }
61
- }
62
- }
63
-
64
- /**
65
- * @param {Event} event
66
- * @protected
67
- * @override
68
- */
69
- _onInput(event) {
70
- this._checkInputValue();
71
-
72
- super._onInput(event);
73
- }
74
-
75
- /** @private */
76
- _preventInvalidInputChanged(preventInvalidInput) {
77
- if (preventInvalidInput) {
78
- console.warn(
79
- `WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
80
- );
81
- }
82
- }
83
35
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd..
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { clearButton } from './clear-button-styles.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
@@ -10,11 +10,8 @@ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
10
10
  */
11
11
  export class TextAreaController extends SlotController {
12
12
  constructor(host, callback) {
13
- super(
14
- host,
15
- 'textarea',
16
- () => document.createElement('textarea'),
17
- (host, node) => {
13
+ super(host, 'textarea', 'textarea', {
14
+ initializer: (node, host) => {
18
15
  const value = host.getAttribute('value');
19
16
  if (value) {
20
17
  node.value = value;
@@ -31,7 +28,7 @@ export class TextAreaController extends SlotController {
31
28
  callback(node);
32
29
  }
33
30
  },
34
- true,
35
- );
31
+ useUniqueId: true,
32
+ });
36
33
  }
37
34
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { ReactiveController } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,48 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import type { Constructor } from '@open-wc/dedupe-mixin';
7
- import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
8
- import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
9
- import type { TabindexMixinClass } from '@vaadin/component-base/src/tabindex-mixin.js';
10
-
11
- /**
12
- * A mixin to forward focus to an element in the light DOM.
13
- */
14
- export declare function DelegateFocusMixin<T extends Constructor<HTMLElement>>(
15
- base: T,
16
- ): Constructor<DelegateFocusMixinClass> &
17
- Constructor<DisabledMixinClass> &
18
- Constructor<FocusMixinClass> &
19
- Constructor<TabindexMixinClass> &
20
- T;
21
-
22
- export declare class DelegateFocusMixinClass {
23
- /**
24
- * Specify that this control should have input focus when the page loads.
25
- */
26
- autofocus: boolean;
27
-
28
- /**
29
- * A reference to the focusable element controlled by the mixin.
30
- * It can be an input, textarea, button or any element with tabindex > -1.
31
- *
32
- * Any component implementing this mixin is expected to provide it
33
- * by using `this._setFocusElement(input)` Polymer API.
34
- */
35
- readonly focusElement: HTMLElement | null | undefined;
36
-
37
- protected _addFocusListeners(element: HTMLElement): void;
38
-
39
- protected _removeFocusListeners(element: HTMLElement): void;
40
-
41
- protected _focusElementChanged(element: HTMLElement, oldElement: HTMLElement): void;
42
-
43
- protected _onBlur(event: FocusEvent): void;
44
-
45
- protected _onFocus(event: FocusEvent): void;
46
-
47
- protected _setFocusElement(element: HTMLElement): void;
48
- }