@tabworthy/components 0.2.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/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-C15oswCE.js +2148 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/moment-CdViwxPQ.js +5681 -0
- package/dist/cjs/tabworthy-components.cjs.js +25 -0
- package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +884 -0
- package/dist/cjs/tabworthy-dates.cjs.entry.js +10906 -0
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +181 -0
- package/dist/cjs/tabworthy-times.cjs.entry.js +242 -0
- package/dist/cjs/utils-y5Vtky2t.js +214 -0
- package/dist/collection/collection-manifest.json +16 -0
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.css +10 -0
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +1197 -0
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.css +10 -0
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +986 -0
- package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.css +14 -0
- package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.js +237 -0
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +832 -0
- package/dist/collection/components/tabworthy-times-picker/tabworthy-times-picker.js +356 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/moment.js +8 -0
- package/dist/components/tabworthy-dates-calendar.d.ts +11 -0
- package/dist/components/tabworthy-dates-calendar.js +1 -0
- package/dist/components/tabworthy-dates-calendar2.js +1 -0
- package/dist/components/tabworthy-dates-modal.d.ts +11 -0
- package/dist/components/tabworthy-dates-modal.js +1 -0
- package/dist/components/tabworthy-dates-modal2.js +1 -0
- package/dist/components/tabworthy-dates.d.ts +11 -0
- package/dist/components/tabworthy-dates.js +1 -0
- package/dist/components/tabworthy-times-picker.d.ts +11 -0
- package/dist/components/tabworthy-times-picker.js +1 -0
- package/dist/components/tabworthy-times-picker2.js +1 -0
- package/dist/components/tabworthy-times.d.ts +11 -0
- package/dist/components/tabworthy-times.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-BusoZVTR.js +2139 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/moment-Mki5YqAR.js +5679 -0
- package/dist/esm/tabworthy-components.js +21 -0
- package/dist/esm/tabworthy-dates-calendar_2.entry.js +881 -0
- package/dist/esm/tabworthy-dates.entry.js +10904 -0
- package/dist/esm/tabworthy-times-picker.entry.js +179 -0
- package/dist/esm/tabworthy-times.entry.js +240 -0
- package/dist/esm/utils-BVHu5CWV.js +188 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +1 -0
- package/dist/loader/index.js +2 -0
- package/dist/shared/utils/chrono-parser/chrono-parser.js +146 -0
- package/dist/shared/utils/chrono-parser/chrono-parser.type.js +1 -0
- package/dist/shared/utils/utils.js +186 -0
- package/dist/tabworthy-components/index.esm.js +0 -0
- package/dist/tabworthy-components/p-170bc6ca.entry.js +1 -0
- package/dist/tabworthy-components/p-3ce9a767.entry.js +1 -0
- package/dist/tabworthy-components/p-77bd1bd4.entry.js +1 -0
- package/dist/tabworthy-components/p-BVHu5CWV.js +1 -0
- package/dist/tabworthy-components/p-BusoZVTR.js +2 -0
- package/dist/tabworthy-components/p-DQuL1Twl.js +1 -0
- package/dist/tabworthy-components/p-Mki5YqAR.js +8 -0
- package/dist/tabworthy-components/p-ebbb4c46.entry.js +1 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -0
- package/dist/themes/dark.css +1 -0
- package/dist/themes/light.css +1 -0
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.d.ts +3 -0
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.type.d.ts +40 -0
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/utils.d.ts +28 -0
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +80 -0
- package/dist/types/components/tabworthy-dates-calendar/tabworthy-dates-calendar.d.ts +89 -0
- package/dist/types/components/tabworthy-modal/tabworthy-dates-modal.d.ts +29 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +65 -0
- package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +46 -0
- package/dist/types/components.d.ts +879 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1858 -0
- package/package.json +132 -0
|
@@ -0,0 +1,1197 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { announce } from "@react-aria/live-announcer";
|
|
3
|
+
import moment from "moment";
|
|
4
|
+
import { getISODateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
|
|
5
|
+
import { chronoParseDate, chronoParseRange } from "../../../../shared/utils/chrono-parser/chrono-parser";
|
|
6
|
+
const defaultLabels = {
|
|
7
|
+
selected: "selected",
|
|
8
|
+
openCalendar: "Open calendar",
|
|
9
|
+
calendar: "calendar",
|
|
10
|
+
invalidDateError: "We could not find a matching date",
|
|
11
|
+
minDateError: `Please fill in a date after `,
|
|
12
|
+
maxDateError: `Please fill in a date before `,
|
|
13
|
+
rangeOutOfBoundsError: `Please enter a valid range of dates`,
|
|
14
|
+
disabledDateError: `Please choose an available date`,
|
|
15
|
+
to: "to",
|
|
16
|
+
startDate: "Start date"
|
|
17
|
+
};
|
|
18
|
+
export class TabworthyDates {
|
|
19
|
+
constructor() {
|
|
20
|
+
// Enable or disable range mode
|
|
21
|
+
this.range = false;
|
|
22
|
+
// A label for the text field
|
|
23
|
+
this.label = this.range
|
|
24
|
+
? "Choose a date range (any way you like)"
|
|
25
|
+
: "Choose a date (any way you like)";
|
|
26
|
+
// A placeholder for the text field
|
|
27
|
+
this.placeholder = this.range
|
|
28
|
+
? `Try "June 8 to 12"`
|
|
29
|
+
: `Try "tomorrrow" or "in ten days"`;
|
|
30
|
+
// Locale used for internal translations and date parsing
|
|
31
|
+
this.locale = (navigator === null || navigator === void 0 ? void 0 : navigator.language) || "en-US";
|
|
32
|
+
// If the datepicker is disabled
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
// Which date to be displayed when calendar is first opened
|
|
35
|
+
this.startDate = getISODateString(new Date());
|
|
36
|
+
// Reference date used for Chrono date parsing. Equals "today"
|
|
37
|
+
this.referenceDate = getISODateString(new Date());
|
|
38
|
+
// Enable or disable strict Chrono date parsing
|
|
39
|
+
this.useStrictDateParsing = false;
|
|
40
|
+
// Labels used for internal translations
|
|
41
|
+
this.datesLabels = defaultLabels;
|
|
42
|
+
// Prevent hiding the calendar
|
|
43
|
+
this.inline = false;
|
|
44
|
+
// Current error state of the input field
|
|
45
|
+
this.hasError = false;
|
|
46
|
+
// Show or hide the next/previous year buttons
|
|
47
|
+
this.showYearStepper = false;
|
|
48
|
+
// Show or hide the next/previous month buttons
|
|
49
|
+
this.showMonthStepper = true;
|
|
50
|
+
// Show or hide the clear button
|
|
51
|
+
this.showClearButton = true;
|
|
52
|
+
// Show or hide the today button
|
|
53
|
+
this.showTodayButton = true;
|
|
54
|
+
// Enable or disable input field formatting for accepted dates (eg. "Tuesday May 2, 2021" instead of "2021-05-02")
|
|
55
|
+
this.formatInputOnAccept = true;
|
|
56
|
+
// Show or hide the keyboard hints
|
|
57
|
+
this.showKeyboardHint = false;
|
|
58
|
+
// Function to disable individual dates
|
|
59
|
+
this.disableDate = () => false;
|
|
60
|
+
// Component name used to generate CSS classes
|
|
61
|
+
this.elementClassName = "tabworthy-dates";
|
|
62
|
+
// Which day that should start the week (0 is sunday, 1 is monday)
|
|
63
|
+
this.firstDayOfWeek = 1; // Monday
|
|
64
|
+
// Format for the value prop (input/output format). Defaults to ISO format (YYYY-MM-DD). Uses moment.js format tokens.
|
|
65
|
+
this.format = "YYYY-MM-DD";
|
|
66
|
+
// Quick buttons with dates displayed under the text field
|
|
67
|
+
this.quickButtons = this.range
|
|
68
|
+
? ["Monday to Wednesday", "July 5 to 10"]
|
|
69
|
+
: ["Yesterday", "Today", "Tomorrow", "In 10 days"];
|
|
70
|
+
// Show or hide the quick buttons
|
|
71
|
+
this.showQuickButtons = true;
|
|
72
|
+
this.errorState = this.hasError;
|
|
73
|
+
this.disabledState = this.disabled;
|
|
74
|
+
this.chronoSupportedLocale = ["en", "ja", "fr", "nl", "ru", "pt"].includes(this.locale.slice(0, 2));
|
|
75
|
+
this.errorMessage = "";
|
|
76
|
+
this.handleCalendarButtonClick = async () => {
|
|
77
|
+
var _a, _b, _c, _d, _e;
|
|
78
|
+
await customElements.whenDefined("tabworthy-dates-modal");
|
|
79
|
+
this.calendarButtonRef && await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.calendarButtonRef));
|
|
80
|
+
if ((await ((_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.getState())) === false)
|
|
81
|
+
await ((_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.open());
|
|
82
|
+
else if ((await ((_d = this.modalRef) === null || _d === void 0 ? void 0 : _d.getState())) === true)
|
|
83
|
+
await ((_e = this.modalRef) === null || _e === void 0 ? void 0 : _e.close());
|
|
84
|
+
};
|
|
85
|
+
this.handleQuickButtonClick = async (event) => {
|
|
86
|
+
var _a;
|
|
87
|
+
const parser = this.range ? chronoParseRange : chronoParseDate;
|
|
88
|
+
const parsedDate = await parser(event.target.innerText, {
|
|
89
|
+
locale: this.locale.slice(0, 2),
|
|
90
|
+
minDate: this.minDate,
|
|
91
|
+
maxDate: this.maxDate,
|
|
92
|
+
referenceDate: removeTimezoneOffset(new Date(this.referenceDate))
|
|
93
|
+
});
|
|
94
|
+
if (parsedDate) {
|
|
95
|
+
// Single date
|
|
96
|
+
if (parsedDate.value instanceof Date) {
|
|
97
|
+
this.updateValue(parsedDate.value);
|
|
98
|
+
if (document.activeElement !== this.inputRef) {
|
|
99
|
+
this.formatInput(true, false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Date range
|
|
104
|
+
const newValue = [];
|
|
105
|
+
if (((_a = parsedDate.value) === null || _a === void 0 ? void 0 : _a.start) instanceof Date) {
|
|
106
|
+
newValue.push(parsedDate.value.start);
|
|
107
|
+
}
|
|
108
|
+
if (parsedDate.value && parsedDate.value.end instanceof Date)
|
|
109
|
+
newValue.push(parsedDate.value.end);
|
|
110
|
+
this.updateValue(newValue);
|
|
111
|
+
this.formatInput(true, false);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
this.handleChangedMonths = (newMonth) => {
|
|
116
|
+
announce(`${Intl.DateTimeFormat(this.locale, {
|
|
117
|
+
month: "long",
|
|
118
|
+
year: "numeric"
|
|
119
|
+
}).format(removeTimezoneOffset(new Date(`${newMonth.year}-${newMonth.month}`)))}`, "assertive");
|
|
120
|
+
};
|
|
121
|
+
this.handleYearChange = (yearDetail) => {
|
|
122
|
+
var _a;
|
|
123
|
+
(_a = this.changeYear) === null || _a === void 0 ? void 0 : _a.emit(yearDetail);
|
|
124
|
+
};
|
|
125
|
+
this.handleChange = async (event) => {
|
|
126
|
+
if (this.range) {
|
|
127
|
+
this.errorState = false;
|
|
128
|
+
if (event.target.value.length === 0) {
|
|
129
|
+
this.internalValue = "";
|
|
130
|
+
if (this.pickerRef) {
|
|
131
|
+
this.pickerRef.value = null;
|
|
132
|
+
}
|
|
133
|
+
return this.selectDate.emit(this.internalValue);
|
|
134
|
+
}
|
|
135
|
+
const parsedRange = await chronoParseRange(event.target.value, {
|
|
136
|
+
locale: this.locale.slice(0, 2),
|
|
137
|
+
minDate: this.minDate,
|
|
138
|
+
maxDate: this.maxDate,
|
|
139
|
+
referenceDate: removeTimezoneOffset(new Date(this.referenceDate))
|
|
140
|
+
});
|
|
141
|
+
const newValue = [];
|
|
142
|
+
if ((parsedRange === null || parsedRange === void 0 ? void 0 : parsedRange.value) && parsedRange.value.start instanceof Date)
|
|
143
|
+
newValue.push(parsedRange.value.start);
|
|
144
|
+
if ((parsedRange === null || parsedRange === void 0 ? void 0 : parsedRange.value) && parsedRange.value.end instanceof Date)
|
|
145
|
+
newValue.push(parsedRange.value.end);
|
|
146
|
+
this.updateValue(newValue);
|
|
147
|
+
this.formatInput(true, false);
|
|
148
|
+
if (newValue.length === 0) {
|
|
149
|
+
this.errorState = true;
|
|
150
|
+
if (!!(parsedRange === null || parsedRange === void 0 ? void 0 : parsedRange.reason)) {
|
|
151
|
+
this.errorMessage = {
|
|
152
|
+
invalid: this.datesLabels.invalidDateError,
|
|
153
|
+
rangeOutOfBounds: this.datesLabels.rangeOutOfBoundsError,
|
|
154
|
+
minDate: '',
|
|
155
|
+
maxDate: '',
|
|
156
|
+
}[parsedRange.reason];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this.errorState = false;
|
|
162
|
+
if (event.target.value.length === 0) {
|
|
163
|
+
this.internalValue = "";
|
|
164
|
+
if (this.pickerRef) {
|
|
165
|
+
this.pickerRef.value = null;
|
|
166
|
+
}
|
|
167
|
+
return this.selectDate.emit(this.internalValue);
|
|
168
|
+
}
|
|
169
|
+
const parsedDate = await chronoParseDate(event.target.value, {
|
|
170
|
+
locale: this.locale.slice(0, 2),
|
|
171
|
+
minDate: this.minDate,
|
|
172
|
+
maxDate: this.maxDate,
|
|
173
|
+
referenceDate: removeTimezoneOffset(new Date(this.referenceDate))
|
|
174
|
+
});
|
|
175
|
+
if (parsedDate && parsedDate.value instanceof Date) {
|
|
176
|
+
if (this.disableDate(parsedDate.value)) {
|
|
177
|
+
this.errorState = true;
|
|
178
|
+
this.errorMessage = this.datesLabels.disabledDateError;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.updateValue(parsedDate.value);
|
|
182
|
+
this.formatInput(true, false);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else if (parsedDate) {
|
|
186
|
+
this.errorState = true;
|
|
187
|
+
this.internalValue = null;
|
|
188
|
+
let maxDate = undefined;
|
|
189
|
+
let minDate = undefined;
|
|
190
|
+
if (this.maxDate) {
|
|
191
|
+
maxDate = this.maxDate
|
|
192
|
+
? removeTimezoneOffset(new Date(this.maxDate))
|
|
193
|
+
: undefined;
|
|
194
|
+
maxDate === null || maxDate === void 0 ? void 0 : maxDate.setDate(maxDate.getDate() + 1);
|
|
195
|
+
}
|
|
196
|
+
if (this.minDate) {
|
|
197
|
+
minDate = this.minDate
|
|
198
|
+
? removeTimezoneOffset(new Date(this.minDate))
|
|
199
|
+
: undefined;
|
|
200
|
+
minDate === null || minDate === void 0 ? void 0 : minDate.setDate(minDate.getDate() - 1);
|
|
201
|
+
}
|
|
202
|
+
if (!!parsedDate.reason) {
|
|
203
|
+
this.errorMessage = parsedDate.reason;
|
|
204
|
+
this.errorMessage = {
|
|
205
|
+
// TODO: Add locale date formatting to these messages
|
|
206
|
+
minDate: minDate
|
|
207
|
+
? `${this.datesLabels.minDateError} ${getISODateString(minDate)}`
|
|
208
|
+
: "",
|
|
209
|
+
maxDate: maxDate
|
|
210
|
+
? `${this.datesLabels.maxDateError} ${getISODateString(maxDate)}`
|
|
211
|
+
: "",
|
|
212
|
+
invalid: this.datesLabels.invalidDateError
|
|
213
|
+
}[parsedDate.reason];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
componentDidLoad() {
|
|
220
|
+
this.syncFromValueProp();
|
|
221
|
+
this.componentReady.emit();
|
|
222
|
+
if (!this.id) {
|
|
223
|
+
console.error('tabworthy-dates: The "id" prop is required for accessibility');
|
|
224
|
+
}
|
|
225
|
+
if (!this.chronoSupportedLocale)
|
|
226
|
+
console.warn(`tabworthy-dates: The chosen locale "${this.locale}" is not supported by Chrono.js. Date parsing has been disabled`);
|
|
227
|
+
}
|
|
228
|
+
// External method to parse text string using Chrono.js and (optionally) set as value.
|
|
229
|
+
async parseDate(text, shouldSetValue = true, chronoOptions = undefined) {
|
|
230
|
+
const parsedDate = await chronoParseDate(text, Object.assign({ locale: this.locale.slice(0, 2), minDate: this.minDate, maxDate: this.minDate, referenceDate: removeTimezoneOffset(new Date(this.referenceDate)) }, chronoOptions));
|
|
231
|
+
if (shouldSetValue) {
|
|
232
|
+
if (parsedDate && parsedDate.value instanceof Date) {
|
|
233
|
+
this.updateValue(parsedDate.value);
|
|
234
|
+
}
|
|
235
|
+
else
|
|
236
|
+
this.errorState = true;
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
value: parsedDate && parsedDate.value instanceof Date
|
|
240
|
+
? moment(parsedDate.value).format(this.format)
|
|
241
|
+
: undefined,
|
|
242
|
+
reason: parsedDate && parsedDate.reason ? parsedDate.reason : undefined
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
isRangeValue(value) {
|
|
247
|
+
if (Array.isArray(value) &&
|
|
248
|
+
new Date(value[0]) instanceof Date &&
|
|
249
|
+
new Date(value[1]) instanceof Date)
|
|
250
|
+
return !!this.range;
|
|
251
|
+
}
|
|
252
|
+
updateValue(newValue) {
|
|
253
|
+
// Range
|
|
254
|
+
if (Array.isArray(newValue)) {
|
|
255
|
+
this.internalValue = newValue.map((date) => moment(date).format(this.format));
|
|
256
|
+
}
|
|
257
|
+
// Single
|
|
258
|
+
else {
|
|
259
|
+
this.internalValue = moment(newValue).format(this.format);
|
|
260
|
+
}
|
|
261
|
+
if (this.pickerRef) {
|
|
262
|
+
this.pickerRef.value = newValue;
|
|
263
|
+
}
|
|
264
|
+
this.errorState = false;
|
|
265
|
+
this.selectDate.emit(this.internalValue);
|
|
266
|
+
this.announceDateChange(this.internalValue);
|
|
267
|
+
}
|
|
268
|
+
formatInput(enabled, useInputValue = true) {
|
|
269
|
+
if (this.formatInputOnAccept === false || enabled === false) {
|
|
270
|
+
if (this.internalValue) {
|
|
271
|
+
if (this.internalValue.length === 0)
|
|
272
|
+
return;
|
|
273
|
+
this.inputRef.value = this.internalValue
|
|
274
|
+
.toString()
|
|
275
|
+
.replace(",", ` ${this.datesLabels.to} `);
|
|
276
|
+
}
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (this.internalValue &&
|
|
280
|
+
this.formatInputOnAccept === true &&
|
|
281
|
+
this.errorState === false) {
|
|
282
|
+
if (Array.isArray(this.internalValue)) {
|
|
283
|
+
if (this.internalValue.length === 0)
|
|
284
|
+
return; // Range date is invalid, leave the text field as is
|
|
285
|
+
let output = "";
|
|
286
|
+
this.internalValue.forEach((value, index) => {
|
|
287
|
+
const parsedDate = moment(useInputValue ? this.inputRef.value : value, this.format, true);
|
|
288
|
+
const dateToFormat = parsedDate.isValid()
|
|
289
|
+
? parsedDate.toDate()
|
|
290
|
+
: removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : value));
|
|
291
|
+
return (output += `${index === 1 ? ` ${this.datesLabels.to} ` : ""}${Intl.DateTimeFormat(this.locale, {
|
|
292
|
+
day: "numeric",
|
|
293
|
+
month: "short",
|
|
294
|
+
year: "numeric"
|
|
295
|
+
}).format(dateToFormat)}`);
|
|
296
|
+
});
|
|
297
|
+
this.inputRef.value = output;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
const parsedDate = moment(useInputValue ? this.inputRef.value : this.internalValue, this.format, true);
|
|
301
|
+
const dateToFormat = parsedDate.isValid()
|
|
302
|
+
? parsedDate.toDate()
|
|
303
|
+
: removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : this.internalValue));
|
|
304
|
+
this.inputRef.value = Intl.DateTimeFormat(this.locale, {
|
|
305
|
+
weekday: "long",
|
|
306
|
+
day: "numeric",
|
|
307
|
+
month: "long",
|
|
308
|
+
year: "numeric"
|
|
309
|
+
}).format(dateToFormat);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else if (this.internalValue &&
|
|
313
|
+
this.internalValue.length > 0 &&
|
|
314
|
+
this.errorState === false)
|
|
315
|
+
this.inputRef.value = this.internalValue.toString();
|
|
316
|
+
}
|
|
317
|
+
handlePickerSelection(newValue) {
|
|
318
|
+
var _a, _b;
|
|
319
|
+
if (this.isRangeValue(newValue)) {
|
|
320
|
+
if (newValue.length === 2)
|
|
321
|
+
(_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
322
|
+
this.internalValue = newValue;
|
|
323
|
+
this.errorState = false;
|
|
324
|
+
if (document.activeElement !== this.inputRef) {
|
|
325
|
+
this.formatInput(true, false);
|
|
326
|
+
}
|
|
327
|
+
this.announceDateChange(this.internalValue);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
(_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
|
|
331
|
+
this.inputRef.value = newValue;
|
|
332
|
+
this.internalValue = newValue;
|
|
333
|
+
this.errorState = false;
|
|
334
|
+
if (document.activeElement !== this.inputRef) {
|
|
335
|
+
this.formatInput(true, false);
|
|
336
|
+
}
|
|
337
|
+
this.announceDateChange(this.internalValue);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
announceDateChange(newValue) {
|
|
341
|
+
let content = "";
|
|
342
|
+
if (Array.isArray(newValue)) {
|
|
343
|
+
if (newValue.length === 1) {
|
|
344
|
+
content += `${this.datesLabels.startDate} `;
|
|
345
|
+
}
|
|
346
|
+
newValue.forEach((value, index) => (content += `${index === 1 ? ` ${this.datesLabels.to} ` : ""}${Intl.DateTimeFormat(this.locale, {
|
|
347
|
+
weekday: "long",
|
|
348
|
+
day: "numeric",
|
|
349
|
+
month: "long",
|
|
350
|
+
year: "numeric"
|
|
351
|
+
}).format(removeTimezoneOffset(new Date(value)))}`));
|
|
352
|
+
}
|
|
353
|
+
else
|
|
354
|
+
content = Intl.DateTimeFormat(this.locale, {
|
|
355
|
+
weekday: "long",
|
|
356
|
+
day: "numeric",
|
|
357
|
+
month: "long",
|
|
358
|
+
year: "numeric"
|
|
359
|
+
}).format(removeTimezoneOffset(new Date(newValue)));
|
|
360
|
+
if (content.length === 0)
|
|
361
|
+
return;
|
|
362
|
+
content += ` ${this.datesLabels.selected}`;
|
|
363
|
+
const contentNoCommas = content.replace(/\,/g, "");
|
|
364
|
+
announce(contentNoCommas, "polite");
|
|
365
|
+
}
|
|
366
|
+
watchDisabled(newValue) {
|
|
367
|
+
this.disabledState = newValue;
|
|
368
|
+
}
|
|
369
|
+
watchValue(newValue) {
|
|
370
|
+
this.syncFromValueProp(newValue);
|
|
371
|
+
}
|
|
372
|
+
getClassName(element) {
|
|
373
|
+
return Boolean(element)
|
|
374
|
+
? `${this.elementClassName}__${element}`
|
|
375
|
+
: this.elementClassName;
|
|
376
|
+
}
|
|
377
|
+
syncFromValueProp(value = this.value) {
|
|
378
|
+
if (!value)
|
|
379
|
+
return;
|
|
380
|
+
// store
|
|
381
|
+
this.internalValue = value;
|
|
382
|
+
// update calendar (expects Date or Date[])
|
|
383
|
+
if (this.pickerRef) {
|
|
384
|
+
if (Array.isArray(value)) {
|
|
385
|
+
const dates = value.reduce((acc, v) => {
|
|
386
|
+
const d = moment(v, this.format, true);
|
|
387
|
+
if (d.isValid())
|
|
388
|
+
acc.push(d.toDate());
|
|
389
|
+
return acc;
|
|
390
|
+
}, []);
|
|
391
|
+
this.pickerRef.value = dates.length ? dates : null;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
const parsedDate = moment(this.value, this.format, true);
|
|
395
|
+
if (parsedDate.isValid()) {
|
|
396
|
+
this.pickerRef.value = parsedDate.toDate();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// update text input (useInputValue=false so it formats from internalValue, not from input's current text)
|
|
401
|
+
if (this.inputRef) {
|
|
402
|
+
this.formatInput(true, false);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
render() {
|
|
406
|
+
var _a;
|
|
407
|
+
return (h(Host, { key: '387a0514db30efb043e294c44dc0c6233ab9315a' }, h("label", { key: '6cc8ef1337dc74cf0c2138457c82c4c61dcc63d1', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: 'b4429fef1d80e792e8ab0580d683b42ca924d0d8' }), h("div", { key: 'ecf6c67ac4e65b41768a593d7c5d4ee330fda3f3', class: this.getClassName("input-container") }, h("input", { key: '6eea6c4e22af4bba65d4358c9b560f2a271b0a23', disabled: this.disabledState, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: this.getClassName("input"), ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: 'f3bf0a8ece36a1abc36f3462dfe44ca951ec510f', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '2b6e45c861606661810ce4026487d90fb7bf0c5f', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
408
|
+
if (!this.pickerRef)
|
|
409
|
+
return;
|
|
410
|
+
this.pickerRef.modalIsOpen = true;
|
|
411
|
+
}, onClosed: () => {
|
|
412
|
+
if (!this.pickerRef)
|
|
413
|
+
return;
|
|
414
|
+
this.pickerRef.modalIsOpen = false;
|
|
415
|
+
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: 'b25c45f9b819509c98afafd21835c00f9188c9e0', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), labels: this.datesCalendarLabels
|
|
416
|
+
? this.datesCalendarLabels
|
|
417
|
+
: undefined, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showKeyboardHint: this.showKeyboardHint, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline })), this.showQuickButtons &&
|
|
418
|
+
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
419
|
+
this.chronoSupportedLocale && (h("div", { key: 'ea05f20cff3cbaff23adb64992b65b0b9760d3c5', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
420
|
+
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
421
|
+
}))), this.errorState && (h("div", { key: 'a472eceba69c53cbcadcd358672b7eca12b105bf', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
422
|
+
}
|
|
423
|
+
static get is() { return "tabworthy-dates"; }
|
|
424
|
+
static get encapsulation() { return "scoped"; }
|
|
425
|
+
static get originalStyleUrls() {
|
|
426
|
+
return {
|
|
427
|
+
"$": ["tabworthy-dates.css"]
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
static get styleUrls() {
|
|
431
|
+
return {
|
|
432
|
+
"$": ["tabworthy-dates.css"]
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
static get properties() {
|
|
436
|
+
return {
|
|
437
|
+
"id": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"mutable": false,
|
|
440
|
+
"complexType": {
|
|
441
|
+
"original": "string",
|
|
442
|
+
"resolved": "string",
|
|
443
|
+
"references": {}
|
|
444
|
+
},
|
|
445
|
+
"required": true,
|
|
446
|
+
"optional": false,
|
|
447
|
+
"docs": {
|
|
448
|
+
"tags": [],
|
|
449
|
+
"text": ""
|
|
450
|
+
},
|
|
451
|
+
"getter": false,
|
|
452
|
+
"setter": false,
|
|
453
|
+
"reflect": true,
|
|
454
|
+
"attribute": "id"
|
|
455
|
+
},
|
|
456
|
+
"value": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"mutable": true,
|
|
459
|
+
"complexType": {
|
|
460
|
+
"original": "string | string[]",
|
|
461
|
+
"resolved": "string | string[]",
|
|
462
|
+
"references": {}
|
|
463
|
+
},
|
|
464
|
+
"required": false,
|
|
465
|
+
"optional": true,
|
|
466
|
+
"docs": {
|
|
467
|
+
"tags": [],
|
|
468
|
+
"text": ""
|
|
469
|
+
},
|
|
470
|
+
"getter": false,
|
|
471
|
+
"setter": false,
|
|
472
|
+
"reflect": false,
|
|
473
|
+
"attribute": "value"
|
|
474
|
+
},
|
|
475
|
+
"range": {
|
|
476
|
+
"type": "boolean",
|
|
477
|
+
"mutable": false,
|
|
478
|
+
"complexType": {
|
|
479
|
+
"original": "boolean",
|
|
480
|
+
"resolved": "boolean",
|
|
481
|
+
"references": {}
|
|
482
|
+
},
|
|
483
|
+
"required": false,
|
|
484
|
+
"optional": true,
|
|
485
|
+
"docs": {
|
|
486
|
+
"tags": [],
|
|
487
|
+
"text": ""
|
|
488
|
+
},
|
|
489
|
+
"getter": false,
|
|
490
|
+
"setter": false,
|
|
491
|
+
"reflect": false,
|
|
492
|
+
"attribute": "range",
|
|
493
|
+
"defaultValue": "false"
|
|
494
|
+
},
|
|
495
|
+
"label": {
|
|
496
|
+
"type": "string",
|
|
497
|
+
"mutable": false,
|
|
498
|
+
"complexType": {
|
|
499
|
+
"original": "string",
|
|
500
|
+
"resolved": "string",
|
|
501
|
+
"references": {}
|
|
502
|
+
},
|
|
503
|
+
"required": false,
|
|
504
|
+
"optional": false,
|
|
505
|
+
"docs": {
|
|
506
|
+
"tags": [],
|
|
507
|
+
"text": ""
|
|
508
|
+
},
|
|
509
|
+
"getter": false,
|
|
510
|
+
"setter": false,
|
|
511
|
+
"reflect": false,
|
|
512
|
+
"attribute": "label",
|
|
513
|
+
"defaultValue": "this.range\n ? \"Choose a date range (any way you like)\"\n : \"Choose a date (any way you like)\""
|
|
514
|
+
},
|
|
515
|
+
"placeholder": {
|
|
516
|
+
"type": "string",
|
|
517
|
+
"mutable": false,
|
|
518
|
+
"complexType": {
|
|
519
|
+
"original": "string",
|
|
520
|
+
"resolved": "string",
|
|
521
|
+
"references": {}
|
|
522
|
+
},
|
|
523
|
+
"required": false,
|
|
524
|
+
"optional": false,
|
|
525
|
+
"docs": {
|
|
526
|
+
"tags": [],
|
|
527
|
+
"text": ""
|
|
528
|
+
},
|
|
529
|
+
"getter": false,
|
|
530
|
+
"setter": false,
|
|
531
|
+
"reflect": false,
|
|
532
|
+
"attribute": "placeholder",
|
|
533
|
+
"defaultValue": "this.range\n ? `Try \"June 8 to 12\"`\n : `Try \"tomorrrow\" or \"in ten days\"`"
|
|
534
|
+
},
|
|
535
|
+
"locale": {
|
|
536
|
+
"type": "string",
|
|
537
|
+
"mutable": false,
|
|
538
|
+
"complexType": {
|
|
539
|
+
"original": "string",
|
|
540
|
+
"resolved": "string",
|
|
541
|
+
"references": {}
|
|
542
|
+
},
|
|
543
|
+
"required": false,
|
|
544
|
+
"optional": false,
|
|
545
|
+
"docs": {
|
|
546
|
+
"tags": [],
|
|
547
|
+
"text": ""
|
|
548
|
+
},
|
|
549
|
+
"getter": false,
|
|
550
|
+
"setter": false,
|
|
551
|
+
"reflect": false,
|
|
552
|
+
"attribute": "locale",
|
|
553
|
+
"defaultValue": "navigator?.language || \"en-US\""
|
|
554
|
+
},
|
|
555
|
+
"disabled": {
|
|
556
|
+
"type": "boolean",
|
|
557
|
+
"mutable": false,
|
|
558
|
+
"complexType": {
|
|
559
|
+
"original": "boolean",
|
|
560
|
+
"resolved": "boolean",
|
|
561
|
+
"references": {}
|
|
562
|
+
},
|
|
563
|
+
"required": false,
|
|
564
|
+
"optional": false,
|
|
565
|
+
"docs": {
|
|
566
|
+
"tags": [],
|
|
567
|
+
"text": ""
|
|
568
|
+
},
|
|
569
|
+
"getter": false,
|
|
570
|
+
"setter": false,
|
|
571
|
+
"reflect": false,
|
|
572
|
+
"attribute": "disabled",
|
|
573
|
+
"defaultValue": "false"
|
|
574
|
+
},
|
|
575
|
+
"minDate": {
|
|
576
|
+
"type": "string",
|
|
577
|
+
"mutable": false,
|
|
578
|
+
"complexType": {
|
|
579
|
+
"original": "string",
|
|
580
|
+
"resolved": "string",
|
|
581
|
+
"references": {}
|
|
582
|
+
},
|
|
583
|
+
"required": false,
|
|
584
|
+
"optional": true,
|
|
585
|
+
"docs": {
|
|
586
|
+
"tags": [],
|
|
587
|
+
"text": ""
|
|
588
|
+
},
|
|
589
|
+
"getter": false,
|
|
590
|
+
"setter": false,
|
|
591
|
+
"reflect": false,
|
|
592
|
+
"attribute": "min-date"
|
|
593
|
+
},
|
|
594
|
+
"maxDate": {
|
|
595
|
+
"type": "string",
|
|
596
|
+
"mutable": false,
|
|
597
|
+
"complexType": {
|
|
598
|
+
"original": "string",
|
|
599
|
+
"resolved": "string",
|
|
600
|
+
"references": {}
|
|
601
|
+
},
|
|
602
|
+
"required": false,
|
|
603
|
+
"optional": true,
|
|
604
|
+
"docs": {
|
|
605
|
+
"tags": [],
|
|
606
|
+
"text": ""
|
|
607
|
+
},
|
|
608
|
+
"getter": false,
|
|
609
|
+
"setter": false,
|
|
610
|
+
"reflect": false,
|
|
611
|
+
"attribute": "max-date"
|
|
612
|
+
},
|
|
613
|
+
"startDate": {
|
|
614
|
+
"type": "string",
|
|
615
|
+
"mutable": false,
|
|
616
|
+
"complexType": {
|
|
617
|
+
"original": "string",
|
|
618
|
+
"resolved": "string",
|
|
619
|
+
"references": {}
|
|
620
|
+
},
|
|
621
|
+
"required": false,
|
|
622
|
+
"optional": false,
|
|
623
|
+
"docs": {
|
|
624
|
+
"tags": [],
|
|
625
|
+
"text": ""
|
|
626
|
+
},
|
|
627
|
+
"getter": false,
|
|
628
|
+
"setter": false,
|
|
629
|
+
"reflect": false,
|
|
630
|
+
"attribute": "start-date",
|
|
631
|
+
"defaultValue": "getISODateString(new Date())"
|
|
632
|
+
},
|
|
633
|
+
"referenceDate": {
|
|
634
|
+
"type": "string",
|
|
635
|
+
"mutable": false,
|
|
636
|
+
"complexType": {
|
|
637
|
+
"original": "string",
|
|
638
|
+
"resolved": "string",
|
|
639
|
+
"references": {}
|
|
640
|
+
},
|
|
641
|
+
"required": false,
|
|
642
|
+
"optional": false,
|
|
643
|
+
"docs": {
|
|
644
|
+
"tags": [],
|
|
645
|
+
"text": ""
|
|
646
|
+
},
|
|
647
|
+
"getter": false,
|
|
648
|
+
"setter": false,
|
|
649
|
+
"reflect": false,
|
|
650
|
+
"attribute": "reference-date",
|
|
651
|
+
"defaultValue": "getISODateString(new Date())"
|
|
652
|
+
},
|
|
653
|
+
"useStrictDateParsing": {
|
|
654
|
+
"type": "boolean",
|
|
655
|
+
"mutable": false,
|
|
656
|
+
"complexType": {
|
|
657
|
+
"original": "boolean",
|
|
658
|
+
"resolved": "boolean",
|
|
659
|
+
"references": {}
|
|
660
|
+
},
|
|
661
|
+
"required": false,
|
|
662
|
+
"optional": false,
|
|
663
|
+
"docs": {
|
|
664
|
+
"tags": [],
|
|
665
|
+
"text": ""
|
|
666
|
+
},
|
|
667
|
+
"getter": false,
|
|
668
|
+
"setter": false,
|
|
669
|
+
"reflect": false,
|
|
670
|
+
"attribute": "use-strict-date-parsing",
|
|
671
|
+
"defaultValue": "false"
|
|
672
|
+
},
|
|
673
|
+
"datesLabels": {
|
|
674
|
+
"type": "unknown",
|
|
675
|
+
"mutable": false,
|
|
676
|
+
"complexType": {
|
|
677
|
+
"original": "DatesLabels",
|
|
678
|
+
"resolved": "DatesLabels",
|
|
679
|
+
"references": {
|
|
680
|
+
"DatesLabels": {
|
|
681
|
+
"location": "local",
|
|
682
|
+
"path": "/Users/damirbogdanov_1/work/tabworthy-components/src/components/tabworthy-dates/tabworthy-dates.tsx",
|
|
683
|
+
"id": "src/components/tabworthy-dates/tabworthy-dates.tsx::DatesLabels"
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
"required": false,
|
|
688
|
+
"optional": false,
|
|
689
|
+
"docs": {
|
|
690
|
+
"tags": [],
|
|
691
|
+
"text": ""
|
|
692
|
+
},
|
|
693
|
+
"getter": false,
|
|
694
|
+
"setter": false,
|
|
695
|
+
"defaultValue": "defaultLabels"
|
|
696
|
+
},
|
|
697
|
+
"datesCalendarLabels": {
|
|
698
|
+
"type": "unknown",
|
|
699
|
+
"mutable": false,
|
|
700
|
+
"complexType": {
|
|
701
|
+
"original": "DatesCalendarLabels",
|
|
702
|
+
"resolved": "{ clearButton: string; monthSelect: string; nextMonthButton: string; nextYearButton: string; picker: string; previousMonthButton: string; previousYearButton: string; todayButton: string; yearSelect: string; keyboardHint: string; selected: string; chooseAsStartDate: string; chooseAsEndDate: string; }",
|
|
703
|
+
"references": {
|
|
704
|
+
"DatesCalendarLabels": {
|
|
705
|
+
"location": "import",
|
|
706
|
+
"path": "../tabworthy-dates-calendar/tabworthy-dates-calendar",
|
|
707
|
+
"id": "src/components/tabworthy-dates-calendar/tabworthy-dates-calendar.tsx::DatesCalendarLabels",
|
|
708
|
+
"referenceLocation": "DatesCalendarLabels"
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
"required": false,
|
|
713
|
+
"optional": true,
|
|
714
|
+
"docs": {
|
|
715
|
+
"tags": [],
|
|
716
|
+
"text": ""
|
|
717
|
+
},
|
|
718
|
+
"getter": false,
|
|
719
|
+
"setter": false
|
|
720
|
+
},
|
|
721
|
+
"inline": {
|
|
722
|
+
"type": "boolean",
|
|
723
|
+
"mutable": false,
|
|
724
|
+
"complexType": {
|
|
725
|
+
"original": "boolean",
|
|
726
|
+
"resolved": "boolean",
|
|
727
|
+
"references": {}
|
|
728
|
+
},
|
|
729
|
+
"required": false,
|
|
730
|
+
"optional": false,
|
|
731
|
+
"docs": {
|
|
732
|
+
"tags": [],
|
|
733
|
+
"text": ""
|
|
734
|
+
},
|
|
735
|
+
"getter": false,
|
|
736
|
+
"setter": false,
|
|
737
|
+
"reflect": false,
|
|
738
|
+
"attribute": "inline",
|
|
739
|
+
"defaultValue": "false"
|
|
740
|
+
},
|
|
741
|
+
"hasError": {
|
|
742
|
+
"type": "boolean",
|
|
743
|
+
"mutable": true,
|
|
744
|
+
"complexType": {
|
|
745
|
+
"original": "boolean",
|
|
746
|
+
"resolved": "boolean",
|
|
747
|
+
"references": {}
|
|
748
|
+
},
|
|
749
|
+
"required": false,
|
|
750
|
+
"optional": false,
|
|
751
|
+
"docs": {
|
|
752
|
+
"tags": [],
|
|
753
|
+
"text": ""
|
|
754
|
+
},
|
|
755
|
+
"getter": false,
|
|
756
|
+
"setter": false,
|
|
757
|
+
"reflect": false,
|
|
758
|
+
"attribute": "has-error",
|
|
759
|
+
"defaultValue": "false"
|
|
760
|
+
},
|
|
761
|
+
"nextMonthButtonContent": {
|
|
762
|
+
"type": "string",
|
|
763
|
+
"mutable": false,
|
|
764
|
+
"complexType": {
|
|
765
|
+
"original": "string",
|
|
766
|
+
"resolved": "string",
|
|
767
|
+
"references": {}
|
|
768
|
+
},
|
|
769
|
+
"required": false,
|
|
770
|
+
"optional": true,
|
|
771
|
+
"docs": {
|
|
772
|
+
"tags": [],
|
|
773
|
+
"text": ""
|
|
774
|
+
},
|
|
775
|
+
"getter": false,
|
|
776
|
+
"setter": false,
|
|
777
|
+
"reflect": false,
|
|
778
|
+
"attribute": "next-month-button-content"
|
|
779
|
+
},
|
|
780
|
+
"nextYearButtonContent": {
|
|
781
|
+
"type": "string",
|
|
782
|
+
"mutable": false,
|
|
783
|
+
"complexType": {
|
|
784
|
+
"original": "string",
|
|
785
|
+
"resolved": "string",
|
|
786
|
+
"references": {}
|
|
787
|
+
},
|
|
788
|
+
"required": false,
|
|
789
|
+
"optional": true,
|
|
790
|
+
"docs": {
|
|
791
|
+
"tags": [],
|
|
792
|
+
"text": ""
|
|
793
|
+
},
|
|
794
|
+
"getter": false,
|
|
795
|
+
"setter": false,
|
|
796
|
+
"reflect": false,
|
|
797
|
+
"attribute": "next-year-button-content"
|
|
798
|
+
},
|
|
799
|
+
"showYearStepper": {
|
|
800
|
+
"type": "boolean",
|
|
801
|
+
"mutable": false,
|
|
802
|
+
"complexType": {
|
|
803
|
+
"original": "boolean",
|
|
804
|
+
"resolved": "boolean",
|
|
805
|
+
"references": {}
|
|
806
|
+
},
|
|
807
|
+
"required": false,
|
|
808
|
+
"optional": false,
|
|
809
|
+
"docs": {
|
|
810
|
+
"tags": [],
|
|
811
|
+
"text": ""
|
|
812
|
+
},
|
|
813
|
+
"getter": false,
|
|
814
|
+
"setter": false,
|
|
815
|
+
"reflect": false,
|
|
816
|
+
"attribute": "show-year-stepper",
|
|
817
|
+
"defaultValue": "false"
|
|
818
|
+
},
|
|
819
|
+
"showMonthStepper": {
|
|
820
|
+
"type": "boolean",
|
|
821
|
+
"mutable": false,
|
|
822
|
+
"complexType": {
|
|
823
|
+
"original": "boolean",
|
|
824
|
+
"resolved": "boolean",
|
|
825
|
+
"references": {}
|
|
826
|
+
},
|
|
827
|
+
"required": false,
|
|
828
|
+
"optional": false,
|
|
829
|
+
"docs": {
|
|
830
|
+
"tags": [],
|
|
831
|
+
"text": ""
|
|
832
|
+
},
|
|
833
|
+
"getter": false,
|
|
834
|
+
"setter": false,
|
|
835
|
+
"reflect": false,
|
|
836
|
+
"attribute": "show-month-stepper",
|
|
837
|
+
"defaultValue": "true"
|
|
838
|
+
},
|
|
839
|
+
"showClearButton": {
|
|
840
|
+
"type": "boolean",
|
|
841
|
+
"mutable": false,
|
|
842
|
+
"complexType": {
|
|
843
|
+
"original": "boolean",
|
|
844
|
+
"resolved": "boolean",
|
|
845
|
+
"references": {}
|
|
846
|
+
},
|
|
847
|
+
"required": false,
|
|
848
|
+
"optional": false,
|
|
849
|
+
"docs": {
|
|
850
|
+
"tags": [],
|
|
851
|
+
"text": ""
|
|
852
|
+
},
|
|
853
|
+
"getter": false,
|
|
854
|
+
"setter": false,
|
|
855
|
+
"reflect": false,
|
|
856
|
+
"attribute": "show-clear-button",
|
|
857
|
+
"defaultValue": "true"
|
|
858
|
+
},
|
|
859
|
+
"showTodayButton": {
|
|
860
|
+
"type": "boolean",
|
|
861
|
+
"mutable": false,
|
|
862
|
+
"complexType": {
|
|
863
|
+
"original": "boolean",
|
|
864
|
+
"resolved": "boolean",
|
|
865
|
+
"references": {}
|
|
866
|
+
},
|
|
867
|
+
"required": false,
|
|
868
|
+
"optional": false,
|
|
869
|
+
"docs": {
|
|
870
|
+
"tags": [],
|
|
871
|
+
"text": ""
|
|
872
|
+
},
|
|
873
|
+
"getter": false,
|
|
874
|
+
"setter": false,
|
|
875
|
+
"reflect": false,
|
|
876
|
+
"attribute": "show-today-button",
|
|
877
|
+
"defaultValue": "true"
|
|
878
|
+
},
|
|
879
|
+
"formatInputOnAccept": {
|
|
880
|
+
"type": "boolean",
|
|
881
|
+
"mutable": false,
|
|
882
|
+
"complexType": {
|
|
883
|
+
"original": "boolean",
|
|
884
|
+
"resolved": "boolean",
|
|
885
|
+
"references": {}
|
|
886
|
+
},
|
|
887
|
+
"required": false,
|
|
888
|
+
"optional": true,
|
|
889
|
+
"docs": {
|
|
890
|
+
"tags": [],
|
|
891
|
+
"text": ""
|
|
892
|
+
},
|
|
893
|
+
"getter": false,
|
|
894
|
+
"setter": false,
|
|
895
|
+
"reflect": false,
|
|
896
|
+
"attribute": "input-should-format",
|
|
897
|
+
"defaultValue": "true"
|
|
898
|
+
},
|
|
899
|
+
"showKeyboardHint": {
|
|
900
|
+
"type": "boolean",
|
|
901
|
+
"mutable": false,
|
|
902
|
+
"complexType": {
|
|
903
|
+
"original": "boolean",
|
|
904
|
+
"resolved": "boolean",
|
|
905
|
+
"references": {}
|
|
906
|
+
},
|
|
907
|
+
"required": false,
|
|
908
|
+
"optional": false,
|
|
909
|
+
"docs": {
|
|
910
|
+
"tags": [],
|
|
911
|
+
"text": ""
|
|
912
|
+
},
|
|
913
|
+
"getter": false,
|
|
914
|
+
"setter": false,
|
|
915
|
+
"reflect": false,
|
|
916
|
+
"attribute": "show-keyboard-hint",
|
|
917
|
+
"defaultValue": "false"
|
|
918
|
+
},
|
|
919
|
+
"disableDate": {
|
|
920
|
+
"type": "unknown",
|
|
921
|
+
"mutable": false,
|
|
922
|
+
"complexType": {
|
|
923
|
+
"original": "HTMLTabworthyDatesCalendarElement[\"disableDate\"]",
|
|
924
|
+
"resolved": "(date: Date) => boolean",
|
|
925
|
+
"references": {
|
|
926
|
+
"HTMLTabworthyDatesCalendarElement": {
|
|
927
|
+
"location": "global",
|
|
928
|
+
"id": "global::HTMLTabworthyDatesCalendarElement"
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
"required": false,
|
|
933
|
+
"optional": false,
|
|
934
|
+
"docs": {
|
|
935
|
+
"tags": [],
|
|
936
|
+
"text": ""
|
|
937
|
+
},
|
|
938
|
+
"getter": false,
|
|
939
|
+
"setter": false,
|
|
940
|
+
"defaultValue": "() =>\n false"
|
|
941
|
+
},
|
|
942
|
+
"elementClassName": {
|
|
943
|
+
"type": "string",
|
|
944
|
+
"mutable": false,
|
|
945
|
+
"complexType": {
|
|
946
|
+
"original": "string",
|
|
947
|
+
"resolved": "string",
|
|
948
|
+
"references": {}
|
|
949
|
+
},
|
|
950
|
+
"required": false,
|
|
951
|
+
"optional": true,
|
|
952
|
+
"docs": {
|
|
953
|
+
"tags": [],
|
|
954
|
+
"text": ""
|
|
955
|
+
},
|
|
956
|
+
"getter": false,
|
|
957
|
+
"setter": false,
|
|
958
|
+
"reflect": false,
|
|
959
|
+
"attribute": "element-class-name",
|
|
960
|
+
"defaultValue": "\"tabworthy-dates\""
|
|
961
|
+
},
|
|
962
|
+
"firstDayOfWeek": {
|
|
963
|
+
"type": "number",
|
|
964
|
+
"mutable": false,
|
|
965
|
+
"complexType": {
|
|
966
|
+
"original": "number",
|
|
967
|
+
"resolved": "number",
|
|
968
|
+
"references": {}
|
|
969
|
+
},
|
|
970
|
+
"required": false,
|
|
971
|
+
"optional": true,
|
|
972
|
+
"docs": {
|
|
973
|
+
"tags": [],
|
|
974
|
+
"text": ""
|
|
975
|
+
},
|
|
976
|
+
"getter": false,
|
|
977
|
+
"setter": false,
|
|
978
|
+
"reflect": false,
|
|
979
|
+
"attribute": "first-day-of-week",
|
|
980
|
+
"defaultValue": "1"
|
|
981
|
+
},
|
|
982
|
+
"format": {
|
|
983
|
+
"type": "string",
|
|
984
|
+
"mutable": false,
|
|
985
|
+
"complexType": {
|
|
986
|
+
"original": "string",
|
|
987
|
+
"resolved": "string",
|
|
988
|
+
"references": {}
|
|
989
|
+
},
|
|
990
|
+
"required": false,
|
|
991
|
+
"optional": false,
|
|
992
|
+
"docs": {
|
|
993
|
+
"tags": [],
|
|
994
|
+
"text": ""
|
|
995
|
+
},
|
|
996
|
+
"getter": false,
|
|
997
|
+
"setter": false,
|
|
998
|
+
"reflect": false,
|
|
999
|
+
"attribute": "format",
|
|
1000
|
+
"defaultValue": "\"YYYY-MM-DD\""
|
|
1001
|
+
},
|
|
1002
|
+
"quickButtons": {
|
|
1003
|
+
"type": "unknown",
|
|
1004
|
+
"mutable": false,
|
|
1005
|
+
"complexType": {
|
|
1006
|
+
"original": "string[]",
|
|
1007
|
+
"resolved": "string[]",
|
|
1008
|
+
"references": {}
|
|
1009
|
+
},
|
|
1010
|
+
"required": false,
|
|
1011
|
+
"optional": false,
|
|
1012
|
+
"docs": {
|
|
1013
|
+
"tags": [],
|
|
1014
|
+
"text": ""
|
|
1015
|
+
},
|
|
1016
|
+
"getter": false,
|
|
1017
|
+
"setter": false,
|
|
1018
|
+
"defaultValue": "this.range\n ? [\"Monday to Wednesday\", \"July 5 to 10\"]\n : [\"Yesterday\", \"Today\", \"Tomorrow\", \"In 10 days\"]"
|
|
1019
|
+
},
|
|
1020
|
+
"todayButtonContent": {
|
|
1021
|
+
"type": "string",
|
|
1022
|
+
"mutable": false,
|
|
1023
|
+
"complexType": {
|
|
1024
|
+
"original": "string",
|
|
1025
|
+
"resolved": "string",
|
|
1026
|
+
"references": {}
|
|
1027
|
+
},
|
|
1028
|
+
"required": false,
|
|
1029
|
+
"optional": true,
|
|
1030
|
+
"docs": {
|
|
1031
|
+
"tags": [],
|
|
1032
|
+
"text": ""
|
|
1033
|
+
},
|
|
1034
|
+
"getter": false,
|
|
1035
|
+
"setter": false,
|
|
1036
|
+
"reflect": false,
|
|
1037
|
+
"attribute": "today-button-content"
|
|
1038
|
+
},
|
|
1039
|
+
"calendarButtonContent": {
|
|
1040
|
+
"type": "string",
|
|
1041
|
+
"mutable": false,
|
|
1042
|
+
"complexType": {
|
|
1043
|
+
"original": "string",
|
|
1044
|
+
"resolved": "string",
|
|
1045
|
+
"references": {}
|
|
1046
|
+
},
|
|
1047
|
+
"required": false,
|
|
1048
|
+
"optional": true,
|
|
1049
|
+
"docs": {
|
|
1050
|
+
"tags": [],
|
|
1051
|
+
"text": ""
|
|
1052
|
+
},
|
|
1053
|
+
"getter": false,
|
|
1054
|
+
"setter": false,
|
|
1055
|
+
"reflect": false,
|
|
1056
|
+
"attribute": "calendar-button-content"
|
|
1057
|
+
},
|
|
1058
|
+
"showQuickButtons": {
|
|
1059
|
+
"type": "boolean",
|
|
1060
|
+
"mutable": false,
|
|
1061
|
+
"complexType": {
|
|
1062
|
+
"original": "boolean",
|
|
1063
|
+
"resolved": "boolean",
|
|
1064
|
+
"references": {}
|
|
1065
|
+
},
|
|
1066
|
+
"required": false,
|
|
1067
|
+
"optional": false,
|
|
1068
|
+
"docs": {
|
|
1069
|
+
"tags": [],
|
|
1070
|
+
"text": ""
|
|
1071
|
+
},
|
|
1072
|
+
"getter": false,
|
|
1073
|
+
"setter": false,
|
|
1074
|
+
"reflect": false,
|
|
1075
|
+
"attribute": "show-quick-buttons",
|
|
1076
|
+
"defaultValue": "true"
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
static get states() {
|
|
1081
|
+
return {
|
|
1082
|
+
"internalValue": {},
|
|
1083
|
+
"errorState": {},
|
|
1084
|
+
"disabledState": {}
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
static get events() {
|
|
1088
|
+
return [{
|
|
1089
|
+
"method": "selectDate",
|
|
1090
|
+
"name": "selectDate",
|
|
1091
|
+
"bubbles": true,
|
|
1092
|
+
"cancelable": true,
|
|
1093
|
+
"composed": true,
|
|
1094
|
+
"docs": {
|
|
1095
|
+
"tags": [],
|
|
1096
|
+
"text": ""
|
|
1097
|
+
},
|
|
1098
|
+
"complexType": {
|
|
1099
|
+
"original": "string | string[] | undefined",
|
|
1100
|
+
"resolved": "string | string[]",
|
|
1101
|
+
"references": {}
|
|
1102
|
+
}
|
|
1103
|
+
}, {
|
|
1104
|
+
"method": "changeYear",
|
|
1105
|
+
"name": "changeYear",
|
|
1106
|
+
"bubbles": true,
|
|
1107
|
+
"cancelable": true,
|
|
1108
|
+
"composed": true,
|
|
1109
|
+
"docs": {
|
|
1110
|
+
"tags": [],
|
|
1111
|
+
"text": ""
|
|
1112
|
+
},
|
|
1113
|
+
"complexType": {
|
|
1114
|
+
"original": "YearChangedEventDetails",
|
|
1115
|
+
"resolved": "YearChangedEventDetails",
|
|
1116
|
+
"references": {
|
|
1117
|
+
"YearChangedEventDetails": {
|
|
1118
|
+
"location": "import",
|
|
1119
|
+
"path": "../tabworthy-dates-calendar/tabworthy-dates-calendar",
|
|
1120
|
+
"id": "src/components/tabworthy-dates-calendar/tabworthy-dates-calendar.tsx::YearChangedEventDetails",
|
|
1121
|
+
"referenceLocation": "YearChangedEventDetails"
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}, {
|
|
1126
|
+
"method": "componentReady",
|
|
1127
|
+
"name": "componentReady",
|
|
1128
|
+
"bubbles": true,
|
|
1129
|
+
"cancelable": true,
|
|
1130
|
+
"composed": true,
|
|
1131
|
+
"docs": {
|
|
1132
|
+
"tags": [],
|
|
1133
|
+
"text": ""
|
|
1134
|
+
},
|
|
1135
|
+
"complexType": {
|
|
1136
|
+
"original": "void",
|
|
1137
|
+
"resolved": "void",
|
|
1138
|
+
"references": {}
|
|
1139
|
+
}
|
|
1140
|
+
}];
|
|
1141
|
+
}
|
|
1142
|
+
static get methods() {
|
|
1143
|
+
return {
|
|
1144
|
+
"parseDate": {
|
|
1145
|
+
"complexType": {
|
|
1146
|
+
"signature": "(text: string, shouldSetValue?: boolean, chronoOptions?: ChronoOptions | undefined) => Promise<ChronoParsedDateString>",
|
|
1147
|
+
"parameters": [{
|
|
1148
|
+
"name": "text",
|
|
1149
|
+
"type": "string",
|
|
1150
|
+
"docs": ""
|
|
1151
|
+
}, {
|
|
1152
|
+
"name": "shouldSetValue",
|
|
1153
|
+
"type": "boolean",
|
|
1154
|
+
"docs": ""
|
|
1155
|
+
}, {
|
|
1156
|
+
"name": "chronoOptions",
|
|
1157
|
+
"type": "ChronoOptions",
|
|
1158
|
+
"docs": ""
|
|
1159
|
+
}],
|
|
1160
|
+
"references": {
|
|
1161
|
+
"Promise": {
|
|
1162
|
+
"location": "global",
|
|
1163
|
+
"id": "global::Promise"
|
|
1164
|
+
},
|
|
1165
|
+
"ChronoParsedDateString": {
|
|
1166
|
+
"location": "import",
|
|
1167
|
+
"path": "@shared/utils/chrono-parser/chrono-parser.type",
|
|
1168
|
+
"id": "shared/utils/chrono-parser/chrono-parser.type.ts::ChronoParsedDateString",
|
|
1169
|
+
"referenceLocation": "ChronoParsedDateString"
|
|
1170
|
+
},
|
|
1171
|
+
"ChronoOptions": {
|
|
1172
|
+
"location": "import",
|
|
1173
|
+
"path": "@shared/utils/chrono-parser/chrono-parser.type",
|
|
1174
|
+
"id": "shared/utils/chrono-parser/chrono-parser.type.ts::ChronoOptions",
|
|
1175
|
+
"referenceLocation": "ChronoOptions"
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
"return": "Promise<ChronoParsedDateString>"
|
|
1179
|
+
},
|
|
1180
|
+
"docs": {
|
|
1181
|
+
"text": "",
|
|
1182
|
+
"tags": []
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
static get elementRef() { return "el"; }
|
|
1188
|
+
static get watchers() {
|
|
1189
|
+
return [{
|
|
1190
|
+
"propName": "disabled",
|
|
1191
|
+
"methodName": "watchDisabled"
|
|
1192
|
+
}, {
|
|
1193
|
+
"propName": "value",
|
|
1194
|
+
"methodName": "watchValue"
|
|
1195
|
+
}];
|
|
1196
|
+
}
|
|
1197
|
+
}
|