@vaadin/field-base 22.0.0-alpha3 → 22.0.0-alpha7

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 (77) hide show
  1. package/index.d.ts +9 -14
  2. package/index.js +9 -14
  3. package/package.json +24 -18
  4. package/src/aria-label-controller.d.ts +11 -0
  5. package/src/aria-label-controller.js +53 -0
  6. package/src/checked-mixin.d.ts +21 -0
  7. package/src/checked-mixin.js +54 -0
  8. package/src/delegate-focus-mixin.d.ts +2 -2
  9. package/src/delegate-focus-mixin.js +150 -133
  10. package/src/delegate-state-mixin.d.ts +23 -0
  11. package/src/delegate-state-mixin.js +125 -0
  12. package/src/field-mixin.d.ts +39 -0
  13. package/src/field-mixin.js +317 -0
  14. package/src/input-constraints-mixin.d.ts +2 -1
  15. package/src/input-constraints-mixin.js +105 -53
  16. package/src/input-control-mixin.d.ts +52 -0
  17. package/src/input-control-mixin.js +170 -0
  18. package/src/input-controller.d.ts +11 -0
  19. package/src/input-controller.js +35 -0
  20. package/src/input-field-mixin.d.ts +2 -16
  21. package/src/input-field-mixin.js +20 -97
  22. package/src/input-mixin.d.ts +1 -1
  23. package/src/input-mixin.js +156 -145
  24. package/src/label-mixin.d.ts +2 -2
  25. package/src/label-mixin.js +73 -60
  26. package/src/pattern-mixin.d.ts +2 -2
  27. package/src/pattern-mixin.js +13 -13
  28. package/src/shadow-focus-mixin.d.ts +21 -0
  29. package/src/shadow-focus-mixin.js +87 -0
  30. package/src/slot-controller.d.ts +8 -0
  31. package/src/slot-controller.js +36 -0
  32. package/src/slot-label-mixin.d.ts +20 -0
  33. package/src/slot-label-mixin.js +38 -0
  34. package/src/slot-styles-mixin.d.ts +24 -0
  35. package/src/slot-styles-mixin.js +76 -0
  36. package/src/slot-target-mixin.d.ts +32 -0
  37. package/src/slot-target-mixin.js +110 -0
  38. package/src/styles/clear-button-styles.d.ts +8 -0
  39. package/src/styles/clear-button-styles.js +21 -0
  40. package/src/styles/field-shared-styles.d.ts +8 -0
  41. package/src/styles/field-shared-styles.js +29 -0
  42. package/src/styles/input-field-container-styles.d.ts +8 -0
  43. package/src/styles/input-field-container-styles.js +16 -0
  44. package/src/styles/input-field-shared-styles.d.ts +8 -0
  45. package/src/styles/input-field-shared-styles.js +10 -0
  46. package/src/text-area-controller.d.ts +11 -0
  47. package/src/text-area-controller.js +38 -0
  48. package/src/validate-mixin.d.ts +1 -9
  49. package/src/validate-mixin.js +43 -118
  50. package/src/active-mixin.d.ts +0 -25
  51. package/src/active-mixin.js +0 -84
  52. package/src/aria-label-mixin.d.ts +0 -20
  53. package/src/aria-label-mixin.js +0 -71
  54. package/src/char-length-mixin.d.ts +0 -30
  55. package/src/char-length-mixin.js +0 -42
  56. package/src/clear-button-mixin.d.ts +0 -27
  57. package/src/clear-button-mixin.js +0 -80
  58. package/src/disabled-mixin.d.ts +0 -23
  59. package/src/disabled-mixin.js +0 -48
  60. package/src/field-aria-mixin.d.ts +0 -24
  61. package/src/field-aria-mixin.js +0 -61
  62. package/src/focus-mixin.d.ts +0 -33
  63. package/src/focus-mixin.js +0 -104
  64. package/src/forward-input-props-mixin.d.ts +0 -41
  65. package/src/forward-input-props-mixin.js +0 -110
  66. package/src/helper-text-mixin.d.ts +0 -24
  67. package/src/helper-text-mixin.js +0 -109
  68. package/src/input-slot-mixin.d.ts +0 -26
  69. package/src/input-slot-mixin.js +0 -71
  70. package/src/slot-mixin.d.ts +0 -23
  71. package/src/slot-mixin.js +0 -55
  72. package/src/tabindex-mixin.d.ts +0 -29
  73. package/src/tabindex-mixin.js +0 -78
  74. package/src/text-area-slot-mixin.d.ts +0 -21
  75. package/src/text-area-slot-mixin.js +0 -56
  76. package/src/text-field-mixin.d.ts +0 -21
  77. package/src/text-field-mixin.js +0 -17
@@ -1,78 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
7
- import { DisabledMixin } from './disabled-mixin.js';
8
-
9
- const TabindexMixinImplementation = (superclass) =>
10
- class TabindexMixinClass extends DisabledMixin(superclass) {
11
- static get properties() {
12
- return {
13
- /**
14
- * Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
15
- */
16
- tabindex: {
17
- type: Number,
18
- value: 0,
19
- reflectToAttribute: true,
20
- observer: '_tabindexChanged'
21
- },
22
-
23
- /**
24
- * Stores the last known tabindex since the element has been disabled.
25
- *
26
- * @private
27
- */
28
- __lastTabIndex: {
29
- type: Number,
30
- value: 0
31
- }
32
- };
33
- }
34
-
35
- /**
36
- * When the element gets disabled, the observer saves the last known tabindex
37
- * and makes the element not focusable by setting tabindex to -1.
38
- * As soon as the element gets enabled, the observer restores the last known tabindex
39
- * so that the element can be focusable again.
40
- *
41
- * @protected
42
- * @override
43
- */
44
- _disabledChanged(disabled) {
45
- super._disabledChanged(disabled);
46
-
47
- if (disabled) {
48
- this.__lastTabIndex = this.tabindex;
49
- this.tabindex = -1;
50
- } else {
51
- this.tabindex = this.__lastTabIndex;
52
- }
53
- }
54
-
55
- /**
56
- * When the user has changed tabindex while the element is disabled,
57
- * the observer reverts tabindex to -1 and rather saves the new tabindex value to apply it later.
58
- * The new value will be applied as soon as the element becomes enabled.
59
- *
60
- * @protected
61
- */
62
- _tabindexChanged(tabindex) {
63
- if (this.disabled && tabindex !== -1) {
64
- this.__lastTabIndex = tabindex;
65
- this.tabindex = -1;
66
- }
67
- }
68
- };
69
-
70
- /**
71
- * A mixin to provide the `tabindex` attribute.
72
- *
73
- * By default, the attribute is set to 0 that makes the element focusable.
74
- *
75
- * The attribute is removed whenever the user disables the element
76
- * and restored with the last known value once the element is enabled.
77
- */
78
- export const TabindexMixin = dedupingMixin(TabindexMixinImplementation);
@@ -1,21 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { DelegatesFocusMixin } from './delegate-focus-mixin.js';
7
- import { SlotMixin } from './slot-mixin.js';
8
- import { InputMixin } from './input-mixin.js';
9
-
10
- /**
11
- * A mixin to add `<textarea>` element to the corresponding named slot.
12
- */
13
- declare function TextAreaSlotMixin<T extends new (...args: any[]) => {}>(base: T): T & TextAreaSlotMixinConstructor;
14
-
15
- interface TextAreaSlotMixinConstructor {
16
- new (...args: any[]): TextAreaSlotMixin;
17
- }
18
-
19
- interface TextAreaSlotMixin extends DelegatesFocusMixin, InputMixin, SlotMixin {}
20
-
21
- export { TextAreaSlotMixinConstructor, TextAreaSlotMixin };
@@ -1,56 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
7
- import { DelegateFocusMixin } from './delegate-focus-mixin.js';
8
- import { InputMixin } from './input-mixin.js';
9
- import { SlotMixin } from './slot-mixin.js';
10
-
11
- const TextAreaSlotMixinImplementation = (superclass) =>
12
- class TextAreaSlotMixinClass extends DelegateFocusMixin(InputMixin(SlotMixin(superclass))) {
13
- get slots() {
14
- return {
15
- ...super.slots,
16
- textarea: () => {
17
- const native = document.createElement('textarea');
18
- const value = this.getAttribute('value');
19
- if (value) {
20
- native.value = value;
21
- }
22
- const name = this.getAttribute('name');
23
- if (name) {
24
- native.setAttribute('name', name);
25
- }
26
- return native;
27
- }
28
- };
29
- }
30
-
31
- constructor() {
32
- super();
33
-
34
- // Ensure every instance has unique ID
35
- const uniqueId = (TextAreaSlotMixinClass._uniqueId = 1 + TextAreaSlotMixinClass._uniqueId || 0);
36
- this._textareaId = `${this.localName}-${uniqueId}`;
37
- }
38
-
39
- /** @protected */
40
- connectedCallback() {
41
- super.connectedCallback();
42
-
43
- const textArea = this._getDirectSlotChild('textarea');
44
- if (textArea) {
45
- textArea.id = this._textareaId;
46
-
47
- this._setInputElement(textArea);
48
- this._setFocusElement(textArea);
49
- }
50
- }
51
- };
52
-
53
- /**
54
- * A mixin to add `<textarea>` element to the corresponding named slot.
55
- */
56
- export const TextAreaSlotMixin = dedupingMixin(TextAreaSlotMixinImplementation);
@@ -1,21 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { CharLengthMixin } from './char-length-mixin.js';
7
- import { InputFieldMixin } from './input-field-mixin.js';
8
- import { PatternMixin } from './pattern-mixin.js';
9
-
10
- /**
11
- * A mixin to provide validation constraints for vaadin-text-field and related components.
12
- */
13
- declare function TextFieldMixin<T extends new (...args: any[]) => {}>(base: T): T & TextFieldMixinConstructor;
14
-
15
- interface TextFieldMixinConstructor {
16
- new (...args: any[]): TextFieldMixin;
17
- }
18
-
19
- interface TextFieldMixin extends CharLengthMixin, InputFieldMixin, PatternMixin {}
20
-
21
- export { TextFieldMixin, TextFieldMixinConstructor };
@@ -1,17 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
7
- import { CharLengthMixin } from './char-length-mixin.js';
8
- import { InputFieldMixin } from './input-field-mixin.js';
9
- import { PatternMixin } from './pattern-mixin.js';
10
-
11
- const TextFieldMixinImplementation = (superclass) =>
12
- class TextFieldMixinClass extends InputFieldMixin(CharLengthMixin(PatternMixin(superclass))) {};
13
-
14
- /**
15
- * A mixin to provide validation constraints for vaadin-text-field and related components.
16
- */
17
- export const TextFieldMixin = dedupingMixin(TextFieldMixinImplementation);