@vonage/vivid 3.37.0 → 3.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +4 -4
- package/avatar/index.js +1 -1
- package/badge/index.js +1 -1
- package/banner/index.js +3 -3
- package/breadcrumb-item/index.js +2 -2
- package/button/index.js +3 -3
- package/card/index.js +2 -2
- package/checkbox/index.js +2 -2
- package/combobox/index.js +6 -6
- package/custom-elements.json +304 -767
- package/data-grid/index.js +1 -1
- package/date-picker/index.js +9 -7
- package/date-range-picker/index.js +36 -0
- package/dialog/index.js +5 -5
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +5 -4
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +43 -40
- package/layout/index.js +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +4 -14
- package/lib/date-range-picker/date-range-picker.d.ts +16 -0
- package/lib/date-range-picker/definition.d.ts +3 -0
- package/lib/file-picker/file-picker.d.ts +8 -5
- package/lib/file-picker/file-picker.form-associated.d.ts +10 -0
- package/lib/file-picker/locale.d.ts +6 -0
- package/lib/tag-group/tag-group.d.ts +1 -0
- package/listbox/index.js +4 -4
- package/locales/en-GB.js +27 -3
- package/locales/en-US.js +27 -3
- package/locales/ja-JP.js +25 -1
- package/locales/zh-CN.js +25 -1
- package/menu/index.js +7 -7
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +5 -5
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +4 -4
- package/popup/index.js +5 -5
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +7 -7
- package/shared/date-picker/calendar/dateRange.d.ts +5 -0
- package/shared/date-picker/calendar/presentationDateRange.d.ts +5 -0
- package/shared/date-picker/date-picker-base.d.ts +20 -0
- package/shared/date-picker/date-picker-base.form-associated.d.ts +10 -0
- package/shared/date-picker/date-picker-base.template.d.ts +4 -0
- package/{lib → shared}/date-picker/locale.d.ts +6 -0
- package/shared/definition.js +4 -4
- package/shared/definition10.js +9 -14
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +3 -3
- package/shared/definition14.js +3 -3
- package/shared/definition15.js +5 -5
- package/shared/definition16.js +3 -3
- package/shared/definition17.js +44 -6055
- package/shared/definition18.js +350 -213
- package/shared/definition19.js +251 -67
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +66 -58
- package/shared/definition21.js +43 -84
- package/shared/definition22.js +75 -2298
- package/shared/definition23.js +2361 -45
- package/shared/definition24.js +63 -27
- package/shared/definition25.js +24 -51
- package/shared/definition26.js +36 -805
- package/shared/definition27.js +820 -49
- package/shared/definition28.js +52 -89
- package/shared/definition29.js +88 -24
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +25 -12
- package/shared/definition31.js +12 -53
- package/shared/definition32.js +28 -487
- package/shared/definition33.js +427 -197
- package/shared/definition34.js +260 -174
- package/shared/definition35.js +187 -69
- package/shared/definition36.js +68 -55
- package/shared/definition37.js +61 -421
- package/shared/definition38.js +435 -35
- package/shared/definition39.js +30 -679
- package/shared/definition4.js +3 -3
- package/shared/definition40.js +661 -77
- package/shared/definition41.js +77 -557
- package/shared/definition42.js +559 -106
- package/shared/definition43.js +105 -136
- package/shared/definition44.js +153 -17
- package/shared/definition45.js +16 -79
- package/shared/definition46.js +53 -475
- package/shared/definition47.js +506 -20
- package/shared/definition48.js +22 -121
- package/shared/definition49.js +115 -262
- package/shared/definition5.js +2 -2
- package/shared/definition50.js +248 -120
- package/shared/definition51.js +139 -123
- package/shared/definition52.js +84 -74
- package/shared/definition53.js +114 -69
- package/shared/definition54.js +81 -292
- package/shared/definition55.js +302 -13
- package/shared/definition56.js +11 -41
- package/shared/definition57.js +20 -154
- package/shared/definition58.js +181 -0
- package/shared/definition6.js +2 -2
- package/shared/definition7.js +2 -2
- package/shared/definition8.js +3 -3
- package/shared/index2.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +3 -1
- package/shared/localized.js +9 -0
- package/shared/presentationDate.js +6133 -0
- package/shared/text-anchor.template.js +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +246 -183
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +6 -6
- package/tooltip/index.js +6 -6
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +105 -0
- package/lib/date-picker/date-picker.form-associated.d.ts +0 -11
- package/lib/date-picker/date-picker.template.d.ts +0 -4
- /package/{lib → shared}/date-picker/calendar/calendarGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/dateStr.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/month.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/monthPickerGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/presentationDate.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/year.d.ts +0 -0
package/shared/definition18.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import { a as attr,
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { s as
|
|
8
|
-
import
|
|
1
|
+
import { a as attr, o as observable, v as volatile, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as buttonRegistries } from './definition10.js';
|
|
3
|
+
import { p as popupRegistries } from './definition58.js';
|
|
4
|
+
import { a as textFieldRegistries } from './definition51.js';
|
|
5
|
+
import { f as focusRegistries } from './definition56.js';
|
|
6
|
+
import { a as dividerRegistries } from './definition20.js';
|
|
7
|
+
import { f as formatPresentationDate, p as parsePresentationDate, D as DatePickerBase, i as isValidDateStr, c as compareDateStr, m as monthOfDate, a as DatePickerBaseTemplate, s as styles } from './presentationDate.js';
|
|
8
|
+
import './affix.js';
|
|
9
|
+
import { e as errorText, f as formElements } from './index2.js';
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const formatRange = (from, to) => {
|
|
12
|
+
return `${from} – ${to}`;
|
|
13
|
+
};
|
|
14
|
+
const formatPresentationDateRange = (dateRange, locale) => {
|
|
15
|
+
return formatRange(formatPresentationDate(dateRange.start, locale), formatPresentationDate(dateRange.end, locale));
|
|
16
|
+
};
|
|
17
|
+
const parsePresentationDateRange = (presentationDateRange, locale) => {
|
|
18
|
+
const fragments = presentationDateRange.trim().split(/[\s—–-]+/);
|
|
19
|
+
if (fragments.length !== 2) {
|
|
20
|
+
throw new Error(`Invalid date range: ${presentationDateRange}`);
|
|
21
|
+
}
|
|
22
|
+
const [start, end] = fragments.map((fragment) => parsePresentationDate(fragment, locale));
|
|
23
|
+
return { start, end };
|
|
24
|
+
};
|
|
13
25
|
|
|
14
26
|
var __defProp = Object.defineProperty;
|
|
15
27
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -22,241 +34,366 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
22
34
|
__defProp(target, key, result);
|
|
23
35
|
return result;
|
|
24
36
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
dialogPolyfill = await import('./dialog-polyfill.esm.js');
|
|
31
|
-
}
|
|
32
|
-
})();
|
|
33
|
-
class Dialog extends FoundationElement {
|
|
37
|
+
const isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
38
|
+
function isDefined(value) {
|
|
39
|
+
return !!value;
|
|
40
|
+
}
|
|
41
|
+
let DateRangePicker = class extends DatePickerBase {
|
|
34
42
|
constructor() {
|
|
35
43
|
super(...arguments);
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this
|
|
42
|
-
|
|
43
|
-
if (event.target !== this.#dialog) {
|
|
44
|
+
this.initialStart = "";
|
|
45
|
+
this.initialEnd = "";
|
|
46
|
+
this.#isInternalValueUpdate = false;
|
|
47
|
+
this.start = "";
|
|
48
|
+
this.end = "";
|
|
49
|
+
this.setFormValue = (value, state) => {
|
|
50
|
+
if (isFormAssociatedTryingToSetFormValue(value)) {
|
|
44
51
|
return;
|
|
45
52
|
}
|
|
46
|
-
|
|
47
|
-
const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
|
|
48
|
-
this.open = clickedInDialog;
|
|
53
|
+
super.setFormValue(value, state);
|
|
49
54
|
};
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
this._textFieldSize = "30";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
initialStartChanged() {
|
|
64
|
+
if (!this.dirtyValue) {
|
|
65
|
+
this.start = this.initialStart;
|
|
66
|
+
this.dirtyValue = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
initialEndChanged() {
|
|
73
|
+
if (!this.dirtyValue) {
|
|
74
|
+
this.end = this.initialEnd;
|
|
75
|
+
this.dirtyValue = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
#isInternalValueUpdate;
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
startChanged() {
|
|
83
|
+
if (this.start && !isValidDateStr(this.start)) {
|
|
84
|
+
this.start = "";
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.currentStart = this.start;
|
|
88
|
+
this.dirtyValue = true;
|
|
89
|
+
if (!this.#isInternalValueUpdate) {
|
|
90
|
+
this.#handleChangedValues();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
endChanged() {
|
|
97
|
+
if (this.end && !isValidDateStr(this.end)) {
|
|
98
|
+
this.end = "";
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.currentEnd = this.end;
|
|
102
|
+
this.dirtyValue = true;
|
|
103
|
+
if (!this.#isInternalValueUpdate) {
|
|
104
|
+
this.#handleChangedValues();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
currentStartChanged() {
|
|
111
|
+
this.start = this.currentStart;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
currentEndChanged() {
|
|
117
|
+
this.end = this.currentEnd;
|
|
118
|
+
}
|
|
119
|
+
#updateValues(range) {
|
|
120
|
+
this.#isInternalValueUpdate = true;
|
|
121
|
+
if (range.start !== void 0) {
|
|
122
|
+
this.start = range.start;
|
|
123
|
+
this.$emit("input:start");
|
|
124
|
+
}
|
|
125
|
+
if (range.end !== void 0) {
|
|
126
|
+
this.end = range.end;
|
|
127
|
+
this.$emit("input:end");
|
|
128
|
+
}
|
|
129
|
+
this.#isInternalValueUpdate = false;
|
|
130
|
+
this.$emit("input");
|
|
131
|
+
this.$emit("change");
|
|
132
|
+
this.#handleChangedValues();
|
|
133
|
+
}
|
|
134
|
+
#handleChangedValues() {
|
|
135
|
+
if (this.start && this.end) {
|
|
136
|
+
if (compareDateStr(this.start, this.end) > 0) {
|
|
137
|
+
this.#updateValues({ start: this.end, end: this.start });
|
|
52
138
|
return;
|
|
53
139
|
}
|
|
54
|
-
this.
|
|
55
|
-
|
|
140
|
+
this._presentationValue = formatPresentationDateRange(
|
|
141
|
+
{
|
|
142
|
+
start: this.start,
|
|
143
|
+
end: this.end
|
|
144
|
+
},
|
|
145
|
+
this.locale.datePicker
|
|
146
|
+
);
|
|
147
|
+
this.value = formatRange(this.start, this.end);
|
|
148
|
+
} else {
|
|
149
|
+
this.value = "";
|
|
150
|
+
this._presentationValue = "";
|
|
151
|
+
}
|
|
152
|
+
if (this.start) {
|
|
153
|
+
this._selectedMonth = monthOfDate(this.start);
|
|
154
|
+
} else if (this.end) {
|
|
155
|
+
this._selectedMonth = monthOfDate(this.end);
|
|
156
|
+
}
|
|
157
|
+
this.#updateFormValue();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
nameChanged(previous, next) {
|
|
163
|
+
super.nameChanged(previous, next);
|
|
164
|
+
this.#updateFormValue();
|
|
56
165
|
}
|
|
57
|
-
#
|
|
58
|
-
|
|
59
|
-
|
|
166
|
+
#updateFormValue() {
|
|
167
|
+
if (!this.name || !this.start || !this.end) {
|
|
168
|
+
this.setFormValue(null);
|
|
169
|
+
} else {
|
|
170
|
+
const formData = new FormData();
|
|
171
|
+
formData.append(this.name, this.start);
|
|
172
|
+
formData.append(this.name, this.end);
|
|
173
|
+
this.setFormValue(formData);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
connectedCallback() {
|
|
177
|
+
super.connectedCallback();
|
|
178
|
+
if (!this.start) {
|
|
179
|
+
this.start = this.initialStart;
|
|
180
|
+
}
|
|
181
|
+
if (!this.end) {
|
|
182
|
+
this.end = this.initialEnd;
|
|
183
|
+
}
|
|
60
184
|
}
|
|
61
|
-
|
|
62
|
-
|
|
185
|
+
#getVisibleRange() {
|
|
186
|
+
const candidates = [this.start, this.end].filter(isDefined);
|
|
187
|
+
const isPartialRange = candidates.length === 1;
|
|
188
|
+
if (this._hoverDate && isPartialRange) {
|
|
189
|
+
candidates.push(this._hoverDate);
|
|
190
|
+
}
|
|
191
|
+
const [start, end] = candidates.sort(compareDateStr);
|
|
192
|
+
return { start, end };
|
|
63
193
|
}
|
|
64
|
-
|
|
65
|
-
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
_isDateAriaSelected(date) {
|
|
198
|
+
return date === this.start || date === this.end;
|
|
66
199
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
dialogPolyfill.registerDialog(this.#dialogElement);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
200
|
+
/**
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
_isDateInSelectedRange(date) {
|
|
204
|
+
const { start, end } = this.#getVisibleRange();
|
|
205
|
+
if (start && end) {
|
|
206
|
+
return compareDateStr(date, start) >= 0 && compareDateStr(date, end) <= 0;
|
|
77
207
|
}
|
|
78
|
-
return
|
|
208
|
+
return false;
|
|
79
209
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
210
|
+
/**
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
_isDateRangeStart(date) {
|
|
214
|
+
return date === this.#getVisibleRange().start;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @internal
|
|
218
|
+
*/
|
|
219
|
+
_isDateRangeEnd(date) {
|
|
220
|
+
return date === this.#getVisibleRange().end;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
_getSelectedDates() {
|
|
226
|
+
const dates = [];
|
|
227
|
+
if (this.start) {
|
|
228
|
+
dates.push(this.start);
|
|
229
|
+
}
|
|
230
|
+
if (this.end) {
|
|
231
|
+
dates.push(this.end);
|
|
83
232
|
}
|
|
84
|
-
|
|
85
|
-
|
|
233
|
+
return dates;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
_onDateClick(date) {
|
|
239
|
+
if (this.start && this.end) {
|
|
240
|
+
this.#updateValues({ start: date, end: "" });
|
|
241
|
+
} else if (this.start) {
|
|
242
|
+
this.#updateValues({ end: date });
|
|
243
|
+
this._closePopup();
|
|
244
|
+
} else if (this.end) {
|
|
245
|
+
this.#updateValues({ start: date });
|
|
246
|
+
this._closePopup();
|
|
86
247
|
} else {
|
|
87
|
-
|
|
88
|
-
this.#dialog.open = true;
|
|
89
|
-
}
|
|
248
|
+
this.#updateValues({ start: date });
|
|
90
249
|
}
|
|
91
250
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this
|
|
251
|
+
/**
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
get _textFieldPlaceholder() {
|
|
255
|
+
return formatRange(
|
|
256
|
+
this.locale.datePicker.dateFormatPlaceholder,
|
|
257
|
+
this.locale.datePicker.dateFormatPlaceholder
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @internal
|
|
262
|
+
*/
|
|
263
|
+
_onTextFieldChange() {
|
|
264
|
+
if (this._presentationValue === "") {
|
|
265
|
+
this.#updateValues({ start: "", end: "" });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
const { start, end } = parsePresentationDateRange(
|
|
270
|
+
this._presentationValue,
|
|
271
|
+
this.locale.datePicker
|
|
272
|
+
);
|
|
273
|
+
this.#updateValues({ start, end });
|
|
274
|
+
} catch (_) {
|
|
275
|
+
return;
|
|
98
276
|
}
|
|
99
|
-
this.open = false;
|
|
100
|
-
this.#handleModal(false);
|
|
101
277
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
278
|
+
/**
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
_onDateMouseEnter(date) {
|
|
282
|
+
this._hoverDate = date;
|
|
106
283
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
284
|
+
/**
|
|
285
|
+
* @internal
|
|
286
|
+
*/
|
|
287
|
+
_onDateMouseLeave() {
|
|
288
|
+
this._hoverDate = void 0;
|
|
110
289
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
290
|
+
/**
|
|
291
|
+
* @internal
|
|
292
|
+
*/
|
|
293
|
+
_getCustomValidationError() {
|
|
294
|
+
if (this._isPresentationValueInvalid()) {
|
|
295
|
+
return this.locale.datePicker.invalidDateRangeError;
|
|
296
|
+
}
|
|
297
|
+
if (this.min && this.start && compareDateStr(this.start, this.min) < 0) {
|
|
298
|
+
return this.locale.datePicker.startDateAfterMinDateError(
|
|
299
|
+
formatPresentationDate(this.min, this.locale.datePicker)
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
if (this.max && this.end && compareDateStr(this.end, this.max) > 0) {
|
|
303
|
+
return this.locale.datePicker.endDateBeforeMaxDateError(
|
|
304
|
+
formatPresentationDate(this.max, this.locale.datePicker)
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
115
308
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
309
|
+
/**
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
_isPresentationValueInvalid() {
|
|
313
|
+
if (this._presentationValue === "") {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
try {
|
|
317
|
+
parsePresentationDateRange(
|
|
318
|
+
this._presentationValue,
|
|
319
|
+
this.locale.datePicker
|
|
320
|
+
);
|
|
321
|
+
return false;
|
|
322
|
+
} catch (_) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
120
325
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
326
|
+
/**
|
|
327
|
+
* @internal
|
|
328
|
+
*/
|
|
329
|
+
_onClearClick() {
|
|
330
|
+
this.#updateValues({ start: "", end: "" });
|
|
331
|
+
super._onClearClick();
|
|
125
332
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
333
|
+
formResetCallback() {
|
|
334
|
+
this.#updateValues({ start: this.initialStart, end: this.initialEnd });
|
|
335
|
+
super.formResetCallback();
|
|
336
|
+
}
|
|
337
|
+
get _calendarButtonLabel() {
|
|
338
|
+
if (this.start && this.end) {
|
|
339
|
+
return this.locale.datePicker.changeDatesLabel(
|
|
340
|
+
formatPresentationDateRange(
|
|
341
|
+
{
|
|
342
|
+
start: this.start,
|
|
343
|
+
end: this.end
|
|
344
|
+
},
|
|
345
|
+
this.locale.datePicker
|
|
346
|
+
)
|
|
347
|
+
);
|
|
348
|
+
} else {
|
|
349
|
+
return this.locale.datePicker.chooseDatesLabel;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
139
353
|
__decorateClass([
|
|
140
|
-
attr
|
|
141
|
-
],
|
|
354
|
+
attr({ mode: "fromView", attribute: "start" })
|
|
355
|
+
], DateRangePicker.prototype, "initialStart", 2);
|
|
142
356
|
__decorateClass([
|
|
143
|
-
attr({
|
|
144
|
-
],
|
|
357
|
+
attr({ mode: "fromView", attribute: "end" })
|
|
358
|
+
], DateRangePicker.prototype, "initialEnd", 2);
|
|
145
359
|
__decorateClass([
|
|
146
|
-
|
|
147
|
-
],
|
|
360
|
+
observable
|
|
361
|
+
], DateRangePicker.prototype, "start", 2);
|
|
148
362
|
__decorateClass([
|
|
149
|
-
|
|
150
|
-
],
|
|
363
|
+
observable
|
|
364
|
+
], DateRangePicker.prototype, "end", 2);
|
|
151
365
|
__decorateClass([
|
|
152
|
-
attr({ attribute: "
|
|
153
|
-
],
|
|
366
|
+
attr({ attribute: "current-start" })
|
|
367
|
+
], DateRangePicker.prototype, "currentStart", 2);
|
|
154
368
|
__decorateClass([
|
|
155
|
-
|
|
156
|
-
],
|
|
369
|
+
attr({ attribute: "current-end" })
|
|
370
|
+
], DateRangePicker.prototype, "currentEnd", 2);
|
|
157
371
|
__decorateClass([
|
|
158
372
|
observable
|
|
159
|
-
],
|
|
373
|
+
], DateRangePicker.prototype, "_hoverDate", 2);
|
|
160
374
|
__decorateClass([
|
|
161
|
-
|
|
162
|
-
],
|
|
375
|
+
volatile
|
|
376
|
+
], DateRangePicker.prototype, "_calendarButtonLabel", 1);
|
|
377
|
+
DateRangePicker = __decorateClass([
|
|
378
|
+
errorText,
|
|
379
|
+
formElements
|
|
380
|
+
], DateRangePicker);
|
|
163
381
|
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
actionItemsSlottedContent
|
|
169
|
-
}) => classNames(
|
|
170
|
-
"base",
|
|
171
|
-
[`icon-placement-${iconPlacement}`, Boolean(iconPlacement)],
|
|
172
|
-
["hide-body", !bodySlottedContent?.length],
|
|
173
|
-
[
|
|
174
|
-
"hide-footer",
|
|
175
|
-
!(footerSlottedContent?.length || actionItemsSlottedContent?.length)
|
|
176
|
-
]
|
|
177
|
-
);
|
|
178
|
-
function icon(iconTag) {
|
|
179
|
-
return html`
|
|
180
|
-
<${iconTag} class="icon" name="${(x) => x.icon}"></${iconTag}>
|
|
181
|
-
`;
|
|
182
|
-
}
|
|
183
|
-
function headline() {
|
|
184
|
-
return html`
|
|
185
|
-
<div class="headline">
|
|
186
|
-
${(x) => x.headline}
|
|
187
|
-
</div>
|
|
188
|
-
`;
|
|
189
|
-
}
|
|
190
|
-
function subtitle() {
|
|
191
|
-
return html`
|
|
192
|
-
<div class="subtitle">
|
|
193
|
-
${(x) => x.subtitle}
|
|
194
|
-
</div>
|
|
195
|
-
`;
|
|
196
|
-
}
|
|
197
|
-
function renderDismissButton(buttonTag) {
|
|
198
|
-
return html`
|
|
199
|
-
<${buttonTag}
|
|
200
|
-
size="condensed"
|
|
201
|
-
class="dismiss-button"
|
|
202
|
-
icon="close-line"
|
|
203
|
-
@click="${(x) => {
|
|
204
|
-
x.open = false;
|
|
205
|
-
}}">
|
|
206
|
-
</${buttonTag}>`;
|
|
207
|
-
}
|
|
208
|
-
function handleEscapeKey(dialog, event) {
|
|
209
|
-
if (event.key === "Escape" && dialog.modal) {
|
|
210
|
-
dialog.open = false;
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
const DialogTemplate = (context) => {
|
|
215
|
-
const elevationTag = context.tagFor(Elevation);
|
|
216
|
-
const iconTag = context.tagFor(Icon);
|
|
217
|
-
const buttonTag = context.tagFor(Button);
|
|
218
|
-
return html`
|
|
219
|
-
<${elevationTag} dp="8">
|
|
220
|
-
<dialog class="${getClasses}"
|
|
221
|
-
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
222
|
-
returnValue="${(x) => x.returnValue}"
|
|
223
|
-
aria-labelledby="${(x) => x.ariaLabelledBy}"
|
|
224
|
-
aria-label="${(x) => x.ariaLabel}"
|
|
225
|
-
aria-describedby="${(x) => x.ariaDescribedBy}"
|
|
226
|
-
>
|
|
227
|
-
<slot name="main">
|
|
228
|
-
<div class="main-wrapper">
|
|
229
|
-
<div class="header ${(x) => x.subtitle ? "border" : ""}">
|
|
230
|
-
<slot name="graphic">
|
|
231
|
-
${when((x) => x.icon, icon(iconTag))}
|
|
232
|
-
</slot>
|
|
233
|
-
${when((x) => x.headline, headline())}
|
|
234
|
-
${when((x) => x.subtitle, subtitle())}
|
|
235
|
-
${renderDismissButton(buttonTag)}
|
|
236
|
-
</div>
|
|
237
|
-
<div class="body ${(x) => x.fullWidthBody ? "full-width" : ""}" >
|
|
238
|
-
<slot name="body" ${slotted("bodySlottedContent")}></slot>
|
|
239
|
-
</div>
|
|
240
|
-
<div class="footer">
|
|
241
|
-
<div>
|
|
242
|
-
<slot name="footer" ${slotted("footerSlottedContent")}></slot>
|
|
243
|
-
</div>
|
|
244
|
-
<div class="actions">
|
|
245
|
-
<slot name="action-items" ${slotted("actionItemsSlottedContent")}></slot>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
</slot>
|
|
250
|
-
</dialog>
|
|
251
|
-
</${elevationTag}>`;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const dialogDefinition = Dialog.compose({
|
|
255
|
-
baseName: "dialog",
|
|
256
|
-
template: DialogTemplate,
|
|
257
|
-
styles: isDialogSupported ? [styles] : [styles, dialogPolyfillStyles]
|
|
382
|
+
const dateRangePickerDefinition = DateRangePicker.compose({
|
|
383
|
+
baseName: "date-range-picker",
|
|
384
|
+
template: DatePickerBaseTemplate,
|
|
385
|
+
styles
|
|
258
386
|
});
|
|
259
|
-
const
|
|
260
|
-
|
|
387
|
+
const dateRangePickerRegistries = [
|
|
388
|
+
dateRangePickerDefinition(),
|
|
389
|
+
...buttonRegistries,
|
|
390
|
+
...popupRegistries,
|
|
391
|
+
...textFieldRegistries,
|
|
392
|
+
...focusRegistries,
|
|
393
|
+
...dividerRegistries
|
|
394
|
+
];
|
|
395
|
+
const registerDateRangePicker = registerFactory(
|
|
396
|
+
dateRangePickerRegistries
|
|
397
|
+
);
|
|
261
398
|
|
|
262
|
-
export {
|
|
399
|
+
export { dateRangePickerRegistries as a, dateRangePickerDefinition as d, registerDateRangePicker as r };
|