@vonage/vivid 3.39.0 → 3.41.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 +7 -5
- package/audio-player/index.js +33 -0
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +9 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +5 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +4 -3
- package/checkbox/index.js +3 -3
- package/combobox/index.js +9 -7
- package/custom-elements.json +809 -5
- package/data-grid/index.js +3 -2
- package/date-picker/index.js +11 -9
- package/date-range-picker/index.js +11 -9
- package/dialog/index.js +10 -6
- 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 +6 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +60 -55
- package/layout/index.js +1 -1
- package/lib/alert/alert.d.ts +3 -1
- package/lib/alert/locale.d.ts +3 -0
- package/lib/audio-player/audio-player.d.ts +17 -0
- package/lib/audio-player/audio-player.template.d.ts +4 -0
- package/lib/audio-player/definition.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +5 -0
- package/lib/banner/banner.d.ts +3 -1
- package/lib/banner/locale.d.ts +3 -0
- package/lib/card/card.d.ts +3 -0
- package/lib/card/card.template.d.ts +1 -1
- package/lib/card/definition.d.ts +1 -0
- package/lib/checkbox/checkbox.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dialog/dialog.d.ts +4 -0
- package/lib/dialog/locale.d.ts +3 -0
- package/lib/enums.d.ts +2 -1
- package/lib/menu/menu.d.ts +1 -0
- package/lib/number-field/locale.d.ts +4 -0
- package/lib/number-field/number-field.d.ts +4 -2
- package/lib/progress/progress.d.ts +1 -0
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/radio/radio.d.ts +1 -0
- package/lib/selectable-box/definition.d.ts +3 -0
- package/lib/selectable-box/selectable-box.d.ts +12 -0
- package/lib/selectable-box/selectable-box.template.d.ts +4 -0
- package/lib/slider/definition.d.ts +1 -0
- package/lib/slider/slider.d.ts +5 -0
- package/lib/split-button/locale.d.ts +3 -0
- package/lib/split-button/split-button.d.ts +3 -1
- package/lib/text-area/text-area.d.ts +3 -0
- package/lib/text-field/text-field.d.ts +5 -2
- package/listbox/index.js +5 -4
- package/locales/en-GB.js +21 -0
- package/locales/en-US.js +21 -0
- package/locales/ja-JP.js +21 -0
- package/locales/zh-CN.js +21 -0
- package/menu/index.js +9 -8
- 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 +8 -6
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +6 -5
- package/popup/index.js +7 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +2 -2
- package/select/index.js +10 -8
- package/selectable-box/index.js +23 -0
- package/shared/Reflector.js +65 -0
- package/shared/date-picker/calendar/segment.d.ts +21 -0
- package/shared/date-picker/date-picker-base.d.ts +1 -0
- package/shared/definition.js +3 -3
- package/shared/definition10.js +89 -227
- package/shared/definition11.js +151 -29
- package/shared/definition12.js +37 -766
- package/shared/definition13.js +747 -106
- package/shared/definition14.js +122 -192
- package/shared/definition15.js +156 -664
- package/shared/definition16.js +576 -1123
- package/shared/definition17.js +1278 -143
- package/shared/definition18.js +64 -298
- package/shared/definition19.js +358 -211
- package/shared/definition2.js +2 -2
- package/shared/definition20.js +259 -67
- package/shared/definition21.js +66 -58
- package/shared/definition22.js +43 -84
- package/shared/definition23.js +76 -2352
- package/shared/definition24.js +2362 -45
- package/shared/definition25.js +63 -27
- package/shared/definition26.js +24 -51
- package/shared/definition27.js +36 -813
- package/shared/definition28.js +837 -49
- package/shared/definition29.js +52 -89
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +88 -24
- package/shared/definition31.js +25 -12
- package/shared/definition32.js +12 -52
- package/shared/definition33.js +28 -487
- package/shared/definition34.js +442 -197
- package/shared/definition35.js +260 -185
- package/shared/definition36.js +188 -69
- package/shared/definition37.js +72 -52
- package/shared/definition38.js +65 -421
- package/shared/definition39.js +435 -35
- package/shared/definition4.js +44 -16
- package/shared/definition40.js +32 -680
- package/shared/definition41.js +661 -77
- package/shared/definition42.js +103 -555
- package/shared/definition43.js +76 -103
- package/shared/definition44.js +522 -87
- package/shared/definition45.js +133 -22
- package/shared/definition46.js +131 -58
- package/shared/definition47.js +16 -501
- package/shared/definition48.js +69 -23
- package/shared/definition49.js +477 -108
- package/shared/definition5.js +160 -44
- package/shared/definition50.js +25 -271
- package/shared/definition51.js +103 -122
- package/shared/definition52.js +277 -122
- package/shared/definition53.js +274 -103
- package/shared/definition54.js +126 -71
- package/shared/definition55.js +128 -294
- package/shared/definition56.js +91 -13
- package/shared/definition57.js +298 -39
- package/shared/definition58.js +11 -175
- package/shared/definition59.js +47 -0
- package/shared/definition6.js +43 -33
- package/shared/definition60.js +181 -0
- package/shared/definition7.js +39 -105
- package/shared/definition8.js +122 -38
- package/shared/definition9.js +56 -89
- package/shared/enums.js +72 -0
- package/shared/icon.js +2 -2
- package/shared/index2.js +28 -1
- package/shared/key-codes.js +1 -1
- package/shared/key-codes2.js +9 -0
- package/shared/listbox.js +3 -8
- package/shared/localization/Locale.d.ts +12 -0
- package/shared/patterns/form-elements/form-elements.d.ts +6 -6
- package/shared/presentationDate.js +196 -143
- package/shared/radio.js +7 -0
- package/shared/text-field.js +1 -1
- package/shared/utils/Reflector.d.ts +8 -0
- package/shared/utils/randomId.d.ts +1 -0
- package/side-drawer/index.js +1 -1
- package/slider/index.js +3 -3
- package/split-button/index.js +6 -3
- package/style.css +889 -722
- 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 +4 -3
- package/text-field/index.js +4 -3
- package/toggletip/index.js +8 -7
- package/tooltip/index.js +8 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +392 -0
package/shared/definition19.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 './definition11.js';
|
|
3
|
+
import { p as popupRegistries } from './definition60.js';
|
|
4
|
+
import { a as textFieldRegistries } from './definition53.js';
|
|
5
|
+
import { f as focusRegistries } from './definition58.js';
|
|
6
|
+
import { a as dividerRegistries } from './definition21.js';
|
|
7
|
+
import { f as formatPresentationDate, p as parsePresentationDate, D as DatePickerBase, i as isValidDateStr, c as compareDateStr, 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,376 @@ 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
|
-
this
|
|
51
|
-
|
|
55
|
+
this._numCalendars = 2;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
this._hideDatesOutsideMonth = true;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
this._textFieldSize = "30";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
initialStartChanged() {
|
|
69
|
+
if (!this.dirtyValue) {
|
|
70
|
+
this.start = this.initialStart;
|
|
71
|
+
this.dirtyValue = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
initialEndChanged() {
|
|
78
|
+
if (!this.dirtyValue) {
|
|
79
|
+
this.end = this.initialEnd;
|
|
80
|
+
this.dirtyValue = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
#isInternalValueUpdate;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
startChanged() {
|
|
88
|
+
if (this.start && !isValidDateStr(this.start)) {
|
|
89
|
+
this.start = "";
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.currentStart = this.start;
|
|
93
|
+
this.dirtyValue = true;
|
|
94
|
+
if (!this.#isInternalValueUpdate) {
|
|
95
|
+
this.#handleChangedValues();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
endChanged() {
|
|
102
|
+
if (this.end && !isValidDateStr(this.end)) {
|
|
103
|
+
this.end = "";
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.currentEnd = this.end;
|
|
107
|
+
this.dirtyValue = true;
|
|
108
|
+
if (!this.#isInternalValueUpdate) {
|
|
109
|
+
this.#handleChangedValues();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
currentStartChanged() {
|
|
116
|
+
this.start = this.currentStart;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
currentEndChanged() {
|
|
122
|
+
this.end = this.currentEnd;
|
|
123
|
+
}
|
|
124
|
+
#updateValues(range) {
|
|
125
|
+
this.#isInternalValueUpdate = true;
|
|
126
|
+
if (range.start !== void 0) {
|
|
127
|
+
this.start = range.start;
|
|
128
|
+
this.$emit("input:start");
|
|
129
|
+
}
|
|
130
|
+
if (range.end !== void 0) {
|
|
131
|
+
this.end = range.end;
|
|
132
|
+
this.$emit("input:end");
|
|
133
|
+
}
|
|
134
|
+
this.#isInternalValueUpdate = false;
|
|
135
|
+
this.$emit("input");
|
|
136
|
+
this.$emit("change");
|
|
137
|
+
this.#handleChangedValues();
|
|
138
|
+
}
|
|
139
|
+
#handleChangedValues() {
|
|
140
|
+
if (this.start && this.end) {
|
|
141
|
+
if (compareDateStr(this.start, this.end) > 0) {
|
|
142
|
+
this.#updateValues({ start: this.end, end: this.start });
|
|
52
143
|
return;
|
|
53
144
|
}
|
|
54
|
-
this.
|
|
55
|
-
|
|
145
|
+
this._presentationValue = formatPresentationDateRange(
|
|
146
|
+
{
|
|
147
|
+
start: this.start,
|
|
148
|
+
end: this.end
|
|
149
|
+
},
|
|
150
|
+
this.locale.datePicker
|
|
151
|
+
);
|
|
152
|
+
this.value = formatRange(this.start, this.end);
|
|
153
|
+
} else {
|
|
154
|
+
this.value = "";
|
|
155
|
+
this._presentationValue = "";
|
|
156
|
+
}
|
|
157
|
+
const dateToEnsureVisibilityOf = this.start || this.end;
|
|
158
|
+
if (dateToEnsureVisibilityOf) {
|
|
159
|
+
this._adjustSelectedMonthToEnsureVisibilityOf(dateToEnsureVisibilityOf);
|
|
160
|
+
}
|
|
161
|
+
this.#updateFormValue();
|
|
56
162
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
163
|
+
/**
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
nameChanged(previous, next) {
|
|
167
|
+
super.nameChanged(previous, next);
|
|
168
|
+
this.#updateFormValue();
|
|
60
169
|
}
|
|
61
|
-
|
|
62
|
-
|
|
170
|
+
#updateFormValue() {
|
|
171
|
+
if (!this.name || !this.start || !this.end) {
|
|
172
|
+
this.setFormValue(null);
|
|
173
|
+
} else {
|
|
174
|
+
const formData = new FormData();
|
|
175
|
+
formData.append(this.name, this.start);
|
|
176
|
+
formData.append(this.name, this.end);
|
|
177
|
+
this.setFormValue(formData);
|
|
178
|
+
}
|
|
63
179
|
}
|
|
64
|
-
|
|
65
|
-
|
|
180
|
+
connectedCallback() {
|
|
181
|
+
super.connectedCallback();
|
|
182
|
+
if (!this.start) {
|
|
183
|
+
this.start = this.initialStart;
|
|
184
|
+
}
|
|
185
|
+
if (!this.end) {
|
|
186
|
+
this.end = this.initialEnd;
|
|
187
|
+
}
|
|
66
188
|
}
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.#dialogElement.open = this.open;
|
|
73
|
-
if (dialogPolyfill) {
|
|
74
|
-
dialogPolyfill.registerDialog(this.#dialogElement);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
189
|
+
#getVisibleRange() {
|
|
190
|
+
const candidates = [this.start, this.end].filter(isDefined);
|
|
191
|
+
const isPartialRange = candidates.length === 1;
|
|
192
|
+
if (this._hoverDate && isPartialRange) {
|
|
193
|
+
candidates.push(this._hoverDate);
|
|
77
194
|
}
|
|
78
|
-
|
|
195
|
+
const [start, end] = candidates.sort(compareDateStr);
|
|
196
|
+
return { start, end };
|
|
79
197
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
198
|
+
/**
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
_isDateAriaSelected(date) {
|
|
202
|
+
return date === this.start || date === this.end;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @internal
|
|
206
|
+
*/
|
|
207
|
+
_isDateInSelectedRange(date) {
|
|
208
|
+
const { start, end } = this.#getVisibleRange();
|
|
209
|
+
if (start && end) {
|
|
210
|
+
return compareDateStr(date, start) >= 0 && compareDateStr(date, end) <= 0;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
_isDateRangeStart(date) {
|
|
218
|
+
return date === this.#getVisibleRange().start;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
_isDateRangeEnd(date) {
|
|
224
|
+
return date === this.#getVisibleRange().end;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @internal
|
|
228
|
+
*/
|
|
229
|
+
_getSelectedDates() {
|
|
230
|
+
const dates = [];
|
|
231
|
+
if (this.start) {
|
|
232
|
+
dates.push(this.start);
|
|
83
233
|
}
|
|
84
|
-
if (
|
|
85
|
-
this.
|
|
234
|
+
if (this.end) {
|
|
235
|
+
dates.push(this.end);
|
|
236
|
+
}
|
|
237
|
+
return dates;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @internal
|
|
241
|
+
*/
|
|
242
|
+
_onDateClick(date) {
|
|
243
|
+
if (this.start && this.end) {
|
|
244
|
+
this.#updateValues({ start: date, end: "" });
|
|
245
|
+
} else if (this.start) {
|
|
246
|
+
this.#updateValues({ end: date });
|
|
247
|
+
this._closePopup();
|
|
248
|
+
} else if (this.end) {
|
|
249
|
+
this.#updateValues({ start: date });
|
|
250
|
+
this._closePopup();
|
|
86
251
|
} else {
|
|
87
|
-
|
|
88
|
-
this.#dialog.open = true;
|
|
89
|
-
}
|
|
252
|
+
this.#updateValues({ start: date });
|
|
90
253
|
}
|
|
91
254
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this
|
|
255
|
+
/**
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
get _textFieldPlaceholder() {
|
|
259
|
+
return formatRange(
|
|
260
|
+
this.locale.datePicker.dateFormatPlaceholder,
|
|
261
|
+
this.locale.datePicker.dateFormatPlaceholder
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @internal
|
|
266
|
+
*/
|
|
267
|
+
_onTextFieldChange() {
|
|
268
|
+
if (this._presentationValue === "") {
|
|
269
|
+
this.#updateValues({ start: "", end: "" });
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
const { start, end } = parsePresentationDateRange(
|
|
274
|
+
this._presentationValue,
|
|
275
|
+
this.locale.datePicker
|
|
276
|
+
);
|
|
277
|
+
this.#updateValues({ start, end });
|
|
278
|
+
} catch (_) {
|
|
279
|
+
return;
|
|
98
280
|
}
|
|
99
|
-
this.open = false;
|
|
100
|
-
this.#handleModal(false);
|
|
101
281
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
282
|
+
/**
|
|
283
|
+
* @internal
|
|
284
|
+
*/
|
|
285
|
+
_onDateMouseEnter(date) {
|
|
286
|
+
this._hoverDate = date;
|
|
106
287
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
288
|
+
/**
|
|
289
|
+
* @internal
|
|
290
|
+
*/
|
|
291
|
+
_onDateMouseLeave() {
|
|
292
|
+
this._hoverDate = void 0;
|
|
110
293
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
294
|
+
/**
|
|
295
|
+
* @internal
|
|
296
|
+
*/
|
|
297
|
+
_getCustomValidationError() {
|
|
298
|
+
if (this._isPresentationValueInvalid()) {
|
|
299
|
+
return this.locale.datePicker.invalidDateRangeError;
|
|
300
|
+
}
|
|
301
|
+
if (this.min && this.start && compareDateStr(this.start, this.min) < 0) {
|
|
302
|
+
return this.locale.datePicker.startDateAfterMinDateError(
|
|
303
|
+
formatPresentationDate(this.min, this.locale.datePicker)
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
if (this.max && this.end && compareDateStr(this.end, this.max) > 0) {
|
|
307
|
+
return this.locale.datePicker.endDateBeforeMaxDateError(
|
|
308
|
+
formatPresentationDate(this.max, this.locale.datePicker)
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
115
312
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
313
|
+
/**
|
|
314
|
+
* @internal
|
|
315
|
+
*/
|
|
316
|
+
_isPresentationValueInvalid() {
|
|
317
|
+
if (this._presentationValue === "") {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
parsePresentationDateRange(
|
|
322
|
+
this._presentationValue,
|
|
323
|
+
this.locale.datePicker
|
|
324
|
+
);
|
|
325
|
+
return false;
|
|
326
|
+
} catch (_) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
120
329
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
330
|
+
/**
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
_onClearClick() {
|
|
334
|
+
this.#updateValues({ start: "", end: "" });
|
|
335
|
+
super._onClearClick();
|
|
125
336
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
337
|
+
/**
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
formResetCallback() {
|
|
341
|
+
this.#updateValues({ start: this.initialStart, end: this.initialEnd });
|
|
342
|
+
super.formResetCallback();
|
|
343
|
+
}
|
|
344
|
+
get _calendarButtonLabel() {
|
|
345
|
+
if (this.start && this.end) {
|
|
346
|
+
return this.locale.datePicker.changeDatesLabel(
|
|
347
|
+
formatPresentationDateRange(
|
|
348
|
+
{
|
|
349
|
+
start: this.start,
|
|
350
|
+
end: this.end
|
|
351
|
+
},
|
|
352
|
+
this.locale.datePicker
|
|
353
|
+
)
|
|
354
|
+
);
|
|
355
|
+
} else {
|
|
356
|
+
return this.locale.datePicker.chooseDatesLabel;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
136
360
|
__decorateClass([
|
|
137
|
-
attr
|
|
138
|
-
],
|
|
361
|
+
attr({ mode: "fromView", attribute: "start" })
|
|
362
|
+
], DateRangePicker.prototype, "initialStart", 2);
|
|
139
363
|
__decorateClass([
|
|
140
|
-
attr
|
|
141
|
-
],
|
|
364
|
+
attr({ mode: "fromView", attribute: "end" })
|
|
365
|
+
], DateRangePicker.prototype, "initialEnd", 2);
|
|
142
366
|
__decorateClass([
|
|
143
|
-
|
|
144
|
-
],
|
|
367
|
+
observable
|
|
368
|
+
], DateRangePicker.prototype, "start", 2);
|
|
145
369
|
__decorateClass([
|
|
146
|
-
|
|
147
|
-
],
|
|
370
|
+
observable
|
|
371
|
+
], DateRangePicker.prototype, "end", 2);
|
|
148
372
|
__decorateClass([
|
|
149
|
-
attr({ attribute: "
|
|
150
|
-
],
|
|
373
|
+
attr({ attribute: "current-start" })
|
|
374
|
+
], DateRangePicker.prototype, "currentStart", 2);
|
|
151
375
|
__decorateClass([
|
|
152
|
-
attr({ attribute: "
|
|
153
|
-
],
|
|
376
|
+
attr({ attribute: "current-end" })
|
|
377
|
+
], DateRangePicker.prototype, "currentEnd", 2);
|
|
154
378
|
__decorateClass([
|
|
155
379
|
observable
|
|
156
|
-
],
|
|
380
|
+
], DateRangePicker.prototype, "_numCalendars", 2);
|
|
157
381
|
__decorateClass([
|
|
158
382
|
observable
|
|
159
|
-
],
|
|
383
|
+
], DateRangePicker.prototype, "_hoverDate", 2);
|
|
160
384
|
__decorateClass([
|
|
161
|
-
|
|
162
|
-
],
|
|
385
|
+
volatile
|
|
386
|
+
], DateRangePicker.prototype, "_calendarButtonLabel", 1);
|
|
387
|
+
DateRangePicker = __decorateClass([
|
|
388
|
+
errorText,
|
|
389
|
+
formElements
|
|
390
|
+
], DateRangePicker);
|
|
163
391
|
|
|
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]
|
|
392
|
+
const dateRangePickerDefinition = DateRangePicker.compose({
|
|
393
|
+
baseName: "date-range-picker",
|
|
394
|
+
template: DatePickerBaseTemplate,
|
|
395
|
+
styles
|
|
258
396
|
});
|
|
259
|
-
const
|
|
260
|
-
|
|
397
|
+
const dateRangePickerRegistries = [
|
|
398
|
+
dateRangePickerDefinition(),
|
|
399
|
+
...buttonRegistries,
|
|
400
|
+
...popupRegistries,
|
|
401
|
+
...textFieldRegistries,
|
|
402
|
+
...focusRegistries,
|
|
403
|
+
...dividerRegistries
|
|
404
|
+
];
|
|
405
|
+
const registerDateRangePicker = registerFactory(
|
|
406
|
+
dateRangePickerRegistries
|
|
407
|
+
);
|
|
261
408
|
|
|
262
|
-
export {
|
|
409
|
+
export { dateRangePickerRegistries as a, dateRangePickerDefinition as d, registerDateRangePicker as r };
|
package/shared/definition2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { A as AccordionItem$1, b as accordionItemRegistries } from './definition.js';
|
|
3
|
-
import {
|
|
3
|
+
import { d as keyEnd, g as keyHome, f as keyArrowDown, e as keyArrowUp } from './key-codes.js';
|
|
4
4
|
import { w as wrapInBounds } from './numbers.js';
|
|
5
5
|
import { s as slotted, e as elements } from './slotted.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
|
@@ -186,7 +186,7 @@ __decorate([
|
|
|
186
186
|
observable
|
|
187
187
|
], Accordion$1.prototype, "accordionItems", void 0);
|
|
188
188
|
|
|
189
|
-
const styles = "/**\n * Do not edit directly\n * Generated on
|
|
189
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 GMT\n */\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n::slotted(:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
|
|
190
190
|
|
|
191
191
|
class Accordion extends Accordion$1 {
|
|
192
192
|
constructor() {
|