@vaadin/date-picker 24.3.0-alpha1 → 24.3.0-alpha10
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/package.json +13 -13
- package/src/vaadin-date-picker-light.d.ts +0 -8
- package/src/vaadin-date-picker-mixin.js +81 -54
- package/src/vaadin-date-picker.d.ts +24 -8
- package/src/vaadin-date-picker.js +17 -0
- package/theme/lumo/vaadin-date-picker-styles.js +1 -0
- package/theme/lumo/vaadin-date-picker.js +0 -1
- package/theme/lumo/vaadin-month-calendar-styles.js +9 -5
- package/theme/material/vaadin-date-picker-styles.js +1 -0
- package/theme/material/vaadin-date-picker.js +0 -1
- package/web-types.json +2 -54
- package/web-types.lit.json +2 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "24.3.0-
|
|
3
|
+
"version": "24.3.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"!src/vaadin-lit-date-picker-overlay-content.js",
|
|
25
25
|
"!src/vaadin-lit-date-picker-overlay.js",
|
|
26
|
-
"!src/vaadin-lit-month-calendar.js",
|
|
27
26
|
"!src/vaadin-lit-date-picker.js",
|
|
27
|
+
"!src/vaadin-lit-month-calendar.js",
|
|
28
28
|
"theme",
|
|
29
29
|
"vaadin-*.d.ts",
|
|
30
30
|
"vaadin-*.js",
|
|
@@ -40,24 +40,24 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
42
|
"@polymer/polymer": "^3.2.0",
|
|
43
|
-
"@vaadin/a11y-base": "24.3.0-
|
|
44
|
-
"@vaadin/button": "24.3.0-
|
|
45
|
-
"@vaadin/component-base": "24.3.0-
|
|
46
|
-
"@vaadin/field-base": "24.3.0-
|
|
47
|
-
"@vaadin/input-container": "24.3.0-
|
|
48
|
-
"@vaadin/overlay": "24.3.0-
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "24.3.0-
|
|
50
|
-
"@vaadin/vaadin-material-styles": "24.3.0-
|
|
51
|
-
"@vaadin/vaadin-themable-mixin": "24.3.0-
|
|
43
|
+
"@vaadin/a11y-base": "24.3.0-alpha10",
|
|
44
|
+
"@vaadin/button": "24.3.0-alpha10",
|
|
45
|
+
"@vaadin/component-base": "24.3.0-alpha10",
|
|
46
|
+
"@vaadin/field-base": "24.3.0-alpha10",
|
|
47
|
+
"@vaadin/input-container": "24.3.0-alpha10",
|
|
48
|
+
"@vaadin/overlay": "24.3.0-alpha10",
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha10",
|
|
50
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha10",
|
|
51
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha10"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@esm-bundle/chai": "^4.3.4",
|
|
55
|
-
"@vaadin/testing-helpers": "^0.
|
|
55
|
+
"@vaadin/testing-helpers": "^0.6.0",
|
|
56
56
|
"sinon": "^13.0.2"
|
|
57
57
|
},
|
|
58
58
|
"web-types": [
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0271523d93fe5df0425ff64206886614f3c6f401"
|
|
63
63
|
}
|
|
@@ -25,11 +25,6 @@ export type DatePickerLightOpenedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
|
25
25
|
*/
|
|
26
26
|
export type DatePickerLightInvalidChangedEvent = CustomEvent<{ value: boolean }>;
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Fired when the `dirty` property changes.
|
|
30
|
-
*/
|
|
31
|
-
export type DatePickerLightDirtyChangedEvent = CustomEvent<{ value: boolean }>;
|
|
32
|
-
|
|
33
28
|
/**
|
|
34
29
|
* Fired when the `value` property changes.
|
|
35
30
|
*/
|
|
@@ -45,8 +40,6 @@ export interface DatePickerLightCustomEventMap {
|
|
|
45
40
|
|
|
46
41
|
'invalid-changed': DatePickerLightInvalidChangedEvent;
|
|
47
42
|
|
|
48
|
-
'dirty-changed': DatePickerLightDirtyChangedEvent;
|
|
49
|
-
|
|
50
43
|
'value-changed': DatePickerLightValueChangedEvent;
|
|
51
44
|
|
|
52
45
|
validated: DatePickerLightValidatedEvent;
|
|
@@ -87,7 +80,6 @@ export interface DatePickerLightEventMap extends HTMLElementEventMap, DatePicker
|
|
|
87
80
|
*
|
|
88
81
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
89
82
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
90
|
-
* @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
|
|
91
83
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
92
84
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
93
85
|
*/
|
|
@@ -427,6 +427,20 @@ export const DatePickerMixin = (subclass) =>
|
|
|
427
427
|
return null;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
/**
|
|
431
|
+
* The input element's value when it cannot be parsed as a date, and an empty string otherwise.
|
|
432
|
+
*
|
|
433
|
+
* @return {string}
|
|
434
|
+
* @private
|
|
435
|
+
*/
|
|
436
|
+
get __unparsableValue() {
|
|
437
|
+
if (!this._inputElementValue || this.__parseDate(this._inputElementValue)) {
|
|
438
|
+
return '';
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
return this._inputElementValue;
|
|
442
|
+
}
|
|
443
|
+
|
|
430
444
|
/**
|
|
431
445
|
* Override an event listener from `DelegateFocusMixin`
|
|
432
446
|
* @protected
|
|
@@ -447,7 +461,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
447
461
|
super._onBlur(event);
|
|
448
462
|
|
|
449
463
|
if (!this.opened) {
|
|
450
|
-
this.
|
|
464
|
+
this.__commitParsedOrFocusedDate();
|
|
451
465
|
|
|
452
466
|
// Do not validate when focusout is caused by document
|
|
453
467
|
// losing focus, which happens on browser tab switch.
|
|
@@ -523,19 +537,14 @@ export const DatePickerMixin = (subclass) =>
|
|
|
523
537
|
|
|
524
538
|
// User confirmed selected date by clicking the calendar.
|
|
525
539
|
content.addEventListener('date-tap', (e) => {
|
|
526
|
-
this.
|
|
527
|
-
|
|
528
|
-
this._selectDate(e.detail.date);
|
|
540
|
+
this.__commitDate(e.detail.date);
|
|
529
541
|
|
|
530
542
|
this._close();
|
|
531
543
|
});
|
|
532
544
|
|
|
533
545
|
// User confirmed selected date by pressing Enter, Space, or Today.
|
|
534
546
|
content.addEventListener('date-selected', (e) => {
|
|
535
|
-
|
|
536
|
-
this.__userConfirmedDate = !!e.detail.date;
|
|
537
|
-
|
|
538
|
-
this._selectDate(e.detail.date);
|
|
547
|
+
this.__commitDate(e.detail.date);
|
|
539
548
|
});
|
|
540
549
|
|
|
541
550
|
// Set focus-ring attribute when moving focus to the overlay
|
|
@@ -650,28 +659,52 @@ export const DatePickerMixin = (subclass) =>
|
|
|
650
659
|
this._shouldKeepFocusRing = focused && this._keyboardActive;
|
|
651
660
|
}
|
|
652
661
|
|
|
653
|
-
/** @private */
|
|
654
|
-
__dispatchChange() {
|
|
655
|
-
this.validate();
|
|
656
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
657
|
-
}
|
|
658
|
-
|
|
659
662
|
/**
|
|
660
|
-
*
|
|
661
|
-
*
|
|
663
|
+
* Depending on the nature of the value change that has occurred since
|
|
664
|
+
* the last commit attempt, triggers validation and fires an event:
|
|
662
665
|
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
666
|
+
* Value change | Event
|
|
667
|
+
* :------------------------|:------------------
|
|
668
|
+
* empty => parsable | change
|
|
669
|
+
* empty => unparsable | unparsable-change
|
|
670
|
+
* parsable => empty | change
|
|
671
|
+
* parsable => parsable | change
|
|
672
|
+
* parsable => unparsable | change
|
|
673
|
+
* unparsable => empty | unparsable-change
|
|
674
|
+
* unparsable => parsable | change
|
|
675
|
+
* unparsable => unparsable | unparsable-change
|
|
676
|
+
*
|
|
677
|
+
* @private
|
|
665
678
|
*/
|
|
666
|
-
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
this._selectedDate = dateToSelect;
|
|
679
|
+
__commitValueChange() {
|
|
680
|
+
const unparsableValue = this.__unparsableValue;
|
|
670
681
|
|
|
671
|
-
if (
|
|
672
|
-
this.
|
|
673
|
-
this.
|
|
682
|
+
if (this.__committedValue !== this.value) {
|
|
683
|
+
this.validate();
|
|
684
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
685
|
+
} else if (this.__committedUnparsableValue !== unparsableValue) {
|
|
686
|
+
this.validate();
|
|
687
|
+
this.dispatchEvent(new CustomEvent('unparsable-change'));
|
|
674
688
|
}
|
|
689
|
+
|
|
690
|
+
this.__committedValue = this.value;
|
|
691
|
+
this.__committedUnparsableValue = unparsableValue;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Sets the given date as the value and commits it.
|
|
696
|
+
*
|
|
697
|
+
* @param {Date} date
|
|
698
|
+
* @private
|
|
699
|
+
*/
|
|
700
|
+
__commitDate(date) {
|
|
701
|
+
// Prevent the value observer from treating the following value change
|
|
702
|
+
// as initiated programmatically by the developer, and therefore
|
|
703
|
+
// from automatically committing it without a change event.
|
|
704
|
+
this.__keepCommittedValue = true;
|
|
705
|
+
this._selectedDate = date;
|
|
706
|
+
this.__keepCommittedValue = false;
|
|
707
|
+
this.__commitValueChange();
|
|
675
708
|
}
|
|
676
709
|
|
|
677
710
|
/** @private */
|
|
@@ -807,6 +840,11 @@ export const DatePickerMixin = (subclass) =>
|
|
|
807
840
|
this._selectedDate = null;
|
|
808
841
|
}
|
|
809
842
|
|
|
843
|
+
if (!this.__keepCommittedValue) {
|
|
844
|
+
this.__committedValue = this.value;
|
|
845
|
+
this.__committedUnparsableValue = '';
|
|
846
|
+
}
|
|
847
|
+
|
|
810
848
|
this._toggleHasValue(this._hasValue);
|
|
811
849
|
}
|
|
812
850
|
|
|
@@ -897,8 +935,15 @@ export const DatePickerMixin = (subclass) =>
|
|
|
897
935
|
: getClosestDate(initialPosition, [this._minDate, this._maxDate]);
|
|
898
936
|
}
|
|
899
937
|
|
|
900
|
-
/**
|
|
901
|
-
|
|
938
|
+
/**
|
|
939
|
+
* Tries to parse the input element's value as a date. If the input value
|
|
940
|
+
* is parsable, commits the resulting date as the value. Otherwise, commits
|
|
941
|
+
* an empty string as the value. If no i18n parser is provided, commits
|
|
942
|
+
* the focused date as the value.
|
|
943
|
+
*
|
|
944
|
+
* @private
|
|
945
|
+
*/
|
|
946
|
+
__commitParsedOrFocusedDate() {
|
|
902
947
|
// Select the parsed input or focused date
|
|
903
948
|
this._ignoreFocusedDateChange = true;
|
|
904
949
|
if (this.i18n.parseDate) {
|
|
@@ -906,15 +951,14 @@ export const DatePickerMixin = (subclass) =>
|
|
|
906
951
|
const parsedDate = this.__parseDate(inputValue);
|
|
907
952
|
|
|
908
953
|
if (parsedDate) {
|
|
909
|
-
this.
|
|
954
|
+
this.__commitDate(parsedDate);
|
|
910
955
|
} else {
|
|
911
956
|
this.__keepInputValue = true;
|
|
912
|
-
this.
|
|
913
|
-
this._selectedDate = null;
|
|
957
|
+
this.__commitDate(null);
|
|
914
958
|
this.__keepInputValue = false;
|
|
915
959
|
}
|
|
916
960
|
} else if (this._focusedDate) {
|
|
917
|
-
this.
|
|
961
|
+
this.__commitDate(this._focusedDate);
|
|
918
962
|
}
|
|
919
963
|
this._ignoreFocusedDateChange = false;
|
|
920
964
|
}
|
|
@@ -926,15 +970,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
926
970
|
this.__showOthers();
|
|
927
971
|
this.__showOthers = null;
|
|
928
972
|
}
|
|
929
|
-
|
|
930
973
|
window.removeEventListener('scroll', this._boundOnScroll, true);
|
|
931
974
|
|
|
932
|
-
|
|
933
|
-
if (this.__userConfirmedDate) {
|
|
934
|
-
this.__userConfirmedDate = false;
|
|
935
|
-
} else {
|
|
936
|
-
this._selectParsedOrFocusedDate();
|
|
937
|
-
}
|
|
975
|
+
this.__commitParsedOrFocusedDate();
|
|
938
976
|
|
|
939
977
|
if (this._nativeInput && this._nativeInput.selectionStart) {
|
|
940
978
|
this._nativeInput.selectionStart = this._nativeInput.selectionEnd;
|
|
@@ -1020,10 +1058,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1020
1058
|
*/
|
|
1021
1059
|
_onClearButtonClick(event) {
|
|
1022
1060
|
event.preventDefault();
|
|
1023
|
-
this.
|
|
1024
|
-
this._inputElementValue = '';
|
|
1025
|
-
this.value = '';
|
|
1026
|
-
this.__dispatchChange();
|
|
1061
|
+
this.__commitDate(null);
|
|
1027
1062
|
}
|
|
1028
1063
|
|
|
1029
1064
|
/**
|
|
@@ -1087,15 +1122,11 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1087
1122
|
* @override
|
|
1088
1123
|
*/
|
|
1089
1124
|
_onEnter(_event) {
|
|
1090
|
-
const oldValue = this.value;
|
|
1091
1125
|
if (this.opened) {
|
|
1092
1126
|
// Closing will implicitly select parsed or focused date
|
|
1093
1127
|
this.close();
|
|
1094
1128
|
} else {
|
|
1095
|
-
this.
|
|
1096
|
-
}
|
|
1097
|
-
if (oldValue === this.value) {
|
|
1098
|
-
this.validate();
|
|
1129
|
+
this.__commitParsedOrFocusedDate();
|
|
1099
1130
|
}
|
|
1100
1131
|
}
|
|
1101
1132
|
|
|
@@ -1122,15 +1153,11 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1122
1153
|
return;
|
|
1123
1154
|
}
|
|
1124
1155
|
|
|
1125
|
-
if (this.
|
|
1156
|
+
if (this.inputElement.value === '') {
|
|
1126
1157
|
// Do not restore selected date if Esc was pressed after clearing input field
|
|
1127
|
-
|
|
1128
|
-
this._selectDate(null);
|
|
1129
|
-
}
|
|
1130
|
-
this._applyInputValue(this._selectedDate);
|
|
1158
|
+
this.__commitDate(null);
|
|
1131
1159
|
} else {
|
|
1132
|
-
this.
|
|
1133
|
-
this._selectParsedOrFocusedDate();
|
|
1160
|
+
this._applyInputValue(this._selectedDate);
|
|
1134
1161
|
}
|
|
1135
1162
|
}
|
|
1136
1163
|
|
|
@@ -16,6 +16,11 @@ export type DatePickerChangeEvent = Event & {
|
|
|
16
16
|
target: DatePicker;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Fired when the user commits an unparsable value change and there is no change event.
|
|
21
|
+
*/
|
|
22
|
+
export type DatePickerUnparsableChangeEvent = CustomEvent;
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
* Fired when the `opened` property changes.
|
|
21
26
|
*/
|
|
@@ -26,11 +31,6 @@ export type DatePickerOpenedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
|
26
31
|
*/
|
|
27
32
|
export type DatePickerInvalidChangedEvent = CustomEvent<{ value: boolean }>;
|
|
28
33
|
|
|
29
|
-
/**
|
|
30
|
-
* Fired when the `dirty` property changes.
|
|
31
|
-
*/
|
|
32
|
-
export type DatePickerDirtyChangedEvent = CustomEvent<{ value: boolean }>;
|
|
33
|
-
|
|
34
34
|
/**
|
|
35
35
|
* Fired when the `value` property changes.
|
|
36
36
|
*/
|
|
@@ -46,10 +46,10 @@ export interface DatePickerCustomEventMap {
|
|
|
46
46
|
|
|
47
47
|
'invalid-changed': DatePickerInvalidChangedEvent;
|
|
48
48
|
|
|
49
|
-
'dirty-changed': DatePickerDirtyChangedEvent;
|
|
50
|
-
|
|
51
49
|
'value-changed': DatePickerValueChangedEvent;
|
|
52
50
|
|
|
51
|
+
'unparsable-change': DatePickerUnparsableChangeEvent;
|
|
52
|
+
|
|
53
53
|
validated: DatePickerValidatedEvent;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -155,10 +155,26 @@ export interface DatePickerEventMap extends HTMLElementEventMap, DatePickerCusto
|
|
|
155
155
|
*
|
|
156
156
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
157
157
|
*
|
|
158
|
+
* ### Change events
|
|
159
|
+
*
|
|
160
|
+
* Depending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,
|
|
161
|
+
* the component can fire either a `change` event or an `unparsable-change` event:
|
|
162
|
+
*
|
|
163
|
+
* Value change | Event
|
|
164
|
+
* :------------------------|:------------------
|
|
165
|
+
* empty => parsable | change
|
|
166
|
+
* empty => unparsable | unparsable-change
|
|
167
|
+
* parsable => empty | change
|
|
168
|
+
* parsable => parsable | change
|
|
169
|
+
* parsable => unparsable | change
|
|
170
|
+
* unparsable => empty | unparsable-change
|
|
171
|
+
* unparsable => parsable | change
|
|
172
|
+
* unparsable => unparsable | unparsable-change
|
|
173
|
+
*
|
|
158
174
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
175
|
+
* @fires {Event} unparsable-change Fired when the user commits an unparsable value change and there is no change event.
|
|
159
176
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
160
177
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
161
|
-
* @fires {CustomEvent} dirty-changed - Fired when the `dirty` property changes.
|
|
162
178
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
163
179
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
164
180
|
*/
|
|
@@ -118,7 +118,24 @@ registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { mod
|
|
|
118
118
|
*
|
|
119
119
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
120
120
|
*
|
|
121
|
+
* ### Change events
|
|
122
|
+
*
|
|
123
|
+
* Depending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,
|
|
124
|
+
* the component can fire either a `change` event or an `unparsable-change` event:
|
|
125
|
+
*
|
|
126
|
+
* Value change | Event
|
|
127
|
+
* :------------------------|:------------------
|
|
128
|
+
* empty => parsable | change
|
|
129
|
+
* empty => unparsable | unparsable-change
|
|
130
|
+
* parsable => empty | change
|
|
131
|
+
* parsable => parsable | change
|
|
132
|
+
* parsable => unparsable | change
|
|
133
|
+
* unparsable => empty | unparsable-change
|
|
134
|
+
* unparsable => parsable | change
|
|
135
|
+
* unparsable => unparsable | unparsable-change
|
|
136
|
+
*
|
|
121
137
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
138
|
+
* @fires {Event} unparsable-change Fired when the user commits an unparsable value change and there is no change event.
|
|
122
139
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
123
140
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
124
141
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
|
|
1
2
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
2
3
|
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
3
4
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -17,6 +17,10 @@ registerStyles(
|
|
|
17
17
|
color: var(--lumo-body-text-color);
|
|
18
18
|
text-align: center;
|
|
19
19
|
padding: 0 var(--lumo-space-xs);
|
|
20
|
+
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
|
|
21
|
+
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
|
|
22
|
+
--_selection-color: var(--vaadin-selection-color, var(--lumo-primary-color));
|
|
23
|
+
--_selection-color-text: var(--vaadin-selection-color-text, var(--lumo-primary-text-color));
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/* Month header */
|
|
@@ -76,7 +80,7 @@ registerStyles(
|
|
|
76
80
|
/* Today date */
|
|
77
81
|
|
|
78
82
|
[part~='date'][part~='today'] {
|
|
79
|
-
color: var(--
|
|
83
|
+
color: var(--_selection-color-text);
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
/* Focused date */
|
|
@@ -98,7 +102,7 @@ registerStyles(
|
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
[part~='date'][part~='focused']::before {
|
|
101
|
-
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0
|
|
105
|
+
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 calc(var(--_focus-ring-width) + 1px) var(--_focus-ring-color);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
:host(:not([focused])) [part~='date'][part~='focused']::before {
|
|
@@ -107,7 +111,7 @@ registerStyles(
|
|
|
107
111
|
|
|
108
112
|
@keyframes vaadin-date-picker-month-calendar-focus-date {
|
|
109
113
|
50% {
|
|
110
|
-
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0
|
|
114
|
+
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 calc(var(--_focus-ring-width) + 1px) transparent;
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
|
|
@@ -120,7 +124,7 @@ registerStyles(
|
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
[part~='date'][part~='selected']::before {
|
|
123
|
-
background-color: var(--
|
|
127
|
+
background-color: var(--_selection-color);
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
[part~='date'][part~='disabled'] {
|
|
@@ -157,7 +161,7 @@ template.innerHTML = `
|
|
|
157
161
|
<style>
|
|
158
162
|
@keyframes vaadin-date-picker-month-calendar-focus-date {
|
|
159
163
|
50% {
|
|
160
|
-
box-shadow: 0 0 0
|
|
164
|
+
box-shadow: 0 0 0 var(--_focus-ring-width) transparent;
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
</style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
|
|
1
2
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
3
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
3
4
|
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/date-picker",
|
|
4
|
-
"version": "24.3.0-
|
|
4
|
+
"version": "24.3.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -41,17 +41,6 @@
|
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
{
|
|
45
|
-
"name": "dirty",
|
|
46
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
47
|
-
"value": {
|
|
48
|
-
"type": [
|
|
49
|
-
"boolean",
|
|
50
|
-
"null",
|
|
51
|
-
"undefined"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
44
|
{
|
|
56
45
|
"name": "invalid",
|
|
57
46
|
"description": "Set to true when the field is invalid.",
|
|
@@ -203,17 +192,6 @@
|
|
|
203
192
|
]
|
|
204
193
|
}
|
|
205
194
|
},
|
|
206
|
-
{
|
|
207
|
-
"name": "dirty",
|
|
208
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
209
|
-
"value": {
|
|
210
|
-
"type": [
|
|
211
|
-
"boolean",
|
|
212
|
-
"null",
|
|
213
|
-
"undefined"
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
195
|
{
|
|
218
196
|
"name": "invalid",
|
|
219
197
|
"description": "Set to true when the field is invalid.",
|
|
@@ -347,10 +325,6 @@
|
|
|
347
325
|
"name": "value-changed",
|
|
348
326
|
"description": "Fired when `value` property value changes."
|
|
349
327
|
},
|
|
350
|
-
{
|
|
351
|
-
"name": "dirty-changed",
|
|
352
|
-
"description": "Fired when the `dirty` property changes."
|
|
353
|
-
},
|
|
354
328
|
{
|
|
355
329
|
"name": "invalid-changed",
|
|
356
330
|
"description": "Fired when the `invalid` property changes."
|
|
@@ -360,7 +334,7 @@
|
|
|
360
334
|
},
|
|
361
335
|
{
|
|
362
336
|
"name": "vaadin-date-picker",
|
|
363
|
-
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-
|
|
337
|
+
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n`disabled` | Disabled date element\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\n\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
364
338
|
"attributes": [
|
|
365
339
|
{
|
|
366
340
|
"name": "disabled",
|
|
@@ -470,17 +444,6 @@
|
|
|
470
444
|
]
|
|
471
445
|
}
|
|
472
446
|
},
|
|
473
|
-
{
|
|
474
|
-
"name": "dirty",
|
|
475
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
476
|
-
"value": {
|
|
477
|
-
"type": [
|
|
478
|
-
"boolean",
|
|
479
|
-
"null",
|
|
480
|
-
"undefined"
|
|
481
|
-
]
|
|
482
|
-
}
|
|
483
|
-
},
|
|
484
447
|
{
|
|
485
448
|
"name": "clear-button-visible",
|
|
486
449
|
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
@@ -755,17 +718,6 @@
|
|
|
755
718
|
]
|
|
756
719
|
}
|
|
757
720
|
},
|
|
758
|
-
{
|
|
759
|
-
"name": "dirty",
|
|
760
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
761
|
-
"value": {
|
|
762
|
-
"type": [
|
|
763
|
-
"boolean",
|
|
764
|
-
"null",
|
|
765
|
-
"undefined"
|
|
766
|
-
]
|
|
767
|
-
}
|
|
768
|
-
},
|
|
769
721
|
{
|
|
770
722
|
"name": "clearButtonVisible",
|
|
771
723
|
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
@@ -952,10 +904,6 @@
|
|
|
952
904
|
{
|
|
953
905
|
"name": "invalid-changed",
|
|
954
906
|
"description": "Fired when the `invalid` property changes."
|
|
955
|
-
},
|
|
956
|
-
{
|
|
957
|
-
"name": "dirty-changed",
|
|
958
|
-
"description": "Fired when the `dirty` property changes."
|
|
959
907
|
}
|
|
960
908
|
]
|
|
961
909
|
}
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/date-picker",
|
|
4
|
-
"version": "24.3.0-
|
|
4
|
+
"version": "24.3.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -33,13 +33,6 @@
|
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
{
|
|
37
|
-
"name": "?dirty",
|
|
38
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
39
|
-
"value": {
|
|
40
|
-
"kind": "expression"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
36
|
{
|
|
44
37
|
"name": "?invalid",
|
|
45
38
|
"description": "Set to true when the field is invalid.",
|
|
@@ -152,13 +145,6 @@
|
|
|
152
145
|
"kind": "expression"
|
|
153
146
|
}
|
|
154
147
|
},
|
|
155
|
-
{
|
|
156
|
-
"name": "@dirty-changed",
|
|
157
|
-
"description": "Fired when the `dirty` property changes.",
|
|
158
|
-
"value": {
|
|
159
|
-
"kind": "expression"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
148
|
{
|
|
163
149
|
"name": "@invalid-changed",
|
|
164
150
|
"description": "Fired when the `invalid` property changes.",
|
|
@@ -170,7 +156,7 @@
|
|
|
170
156
|
},
|
|
171
157
|
{
|
|
172
158
|
"name": "vaadin-date-picker",
|
|
173
|
-
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-
|
|
159
|
+
"description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n`disabled` | Disabled date element\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\n\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
174
160
|
"extension": true,
|
|
175
161
|
"attributes": [
|
|
176
162
|
{
|
|
@@ -201,13 +187,6 @@
|
|
|
201
187
|
"kind": "expression"
|
|
202
188
|
}
|
|
203
189
|
},
|
|
204
|
-
{
|
|
205
|
-
"name": "?dirty",
|
|
206
|
-
"description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
|
|
207
|
-
"value": {
|
|
208
|
-
"kind": "expression"
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
190
|
{
|
|
212
191
|
"name": "?clearButtonVisible",
|
|
213
192
|
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
@@ -396,13 +375,6 @@
|
|
|
396
375
|
"value": {
|
|
397
376
|
"kind": "expression"
|
|
398
377
|
}
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
"name": "@dirty-changed",
|
|
402
|
-
"description": "Fired when the `dirty` property changes.",
|
|
403
|
-
"value": {
|
|
404
|
-
"kind": "expression"
|
|
405
|
-
}
|
|
406
378
|
}
|
|
407
379
|
]
|
|
408
380
|
}
|