@3mo/date-time-fields 0.10.3 → 0.11.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/FieldDateTime.d.ts +3 -3
  2. package/dist/FieldDateTime.d.ts.map +1 -1
  3. package/dist/FieldDateTime.js +7 -12
  4. package/dist/FieldDateTimeBase.d.ts +13 -14
  5. package/dist/FieldDateTimeBase.d.ts.map +1 -1
  6. package/dist/FieldDateTimeBase.js +28 -39
  7. package/dist/FieldDateTimeRange.d.ts +3 -3
  8. package/dist/FieldDateTimeRange.d.ts.map +1 -1
  9. package/dist/FieldDateTimeRange.js +9 -15
  10. package/dist/custom-elements.json +75 -282
  11. package/dist/selection/Calendar.d.ts +38 -0
  12. package/dist/selection/Calendar.d.ts.map +1 -0
  13. package/dist/selection/Calendar.js +347 -0
  14. package/dist/selection/CalendarDatesController.d.ts +22 -0
  15. package/dist/selection/CalendarDatesController.d.ts.map +1 -0
  16. package/dist/selection/CalendarDatesController.js +76 -0
  17. package/dist/selection/DateList.d.ts +2 -2
  18. package/dist/selection/DateList.d.ts.map +1 -1
  19. package/dist/selection/DateList.js +10 -6
  20. package/dist/selection/HourList.js +3 -3
  21. package/dist/selection/MinuteList.js +2 -2
  22. package/dist/selection/SecondList.js +2 -2
  23. package/dist/selection/index.d.ts +1 -3
  24. package/dist/selection/index.d.ts.map +1 -1
  25. package/dist/selection/index.js +1 -3
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +2 -2
  28. package/dist/selection/MonthList.d.ts +0 -12
  29. package/dist/selection/MonthList.d.ts.map +0 -1
  30. package/dist/selection/MonthList.js +0 -36
  31. package/dist/selection/YearList.d.ts +0 -12
  32. package/dist/selection/YearList.d.ts.map +0 -1
  33. package/dist/selection/YearList.js +0 -28
  34. package/dist/selection/calendar/Calendar.d.ts +0 -24
  35. package/dist/selection/calendar/Calendar.d.ts.map +0 -1
  36. package/dist/selection/calendar/Calendar.js +0 -160
  37. package/dist/selection/calendar/SelectableCalendar.d.ts +0 -20
  38. package/dist/selection/calendar/SelectableCalendar.d.ts.map +0 -1
  39. package/dist/selection/calendar/SelectableCalendar.js +0 -76
  40. package/dist/selection/calendar/index.d.ts +0 -3
  41. package/dist/selection/calendar/index.d.ts.map +0 -1
  42. package/dist/selection/calendar/index.js +0 -2
@@ -0,0 +1,347 @@
1
+ var Calendar_1;
2
+ import { __decorate } from "tslib";
3
+ import { Component, css, component, html, property, event, repeat, state, unsafeCSS } from '@a11d/lit';
4
+ import { CalendarDatesController } from './CalendarDatesController.js';
5
+ import { FieldDateTimePrecision } from '../FieldDateTimePrecision.js';
6
+ /**
7
+ * @fires dateClick - Dispatched when a date is clicked, with the clicked date as detail.
8
+ */
9
+ let Calendar = Calendar_1 = class Calendar extends Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.includeWeek = false;
13
+ this.view = FieldDateTimePrecision.Day;
14
+ this.datesController = new CalendarDatesController(this);
15
+ this.handleItemClick = (date, precision) => {
16
+ return () => {
17
+ if (this.precision === precision) {
18
+ this.dateClick.dispatch(date);
19
+ this.setNavigatingValue(date, 'smooth');
20
+ }
21
+ else {
22
+ const nextView = this.view !== precision
23
+ ? precision
24
+ : this.view === FieldDateTimePrecision.Year
25
+ ? FieldDateTimePrecision.Month
26
+ : this.view === FieldDateTimePrecision.Month
27
+ ? FieldDateTimePrecision.Day
28
+ : this.view;
29
+ this.setView(nextView, date);
30
+ }
31
+ };
32
+ };
33
+ }
34
+ get navigationDate() { return this.datesController.navigationDate; }
35
+ async setNavigatingValue(date, behavior = 'instant') {
36
+ this.datesController.disableObservers = true;
37
+ this.datesController.navigationDate = date;
38
+ await this.updateComplete;
39
+ await new Promise(r => setTimeout(r, 10));
40
+ this.renderRoot.querySelector(`.${this.view}[data-navigating]`)
41
+ ?.scrollIntoView({ block: 'center', behavior });
42
+ await new Promise(r => setTimeout(r, behavior === 'instant' ? 10 : 100));
43
+ this.datesController.disableObservers = false;
44
+ }
45
+ setView(view, navigationDate = this.datesController.navigationDate) {
46
+ this.view = view;
47
+ this.setNavigatingValue(navigationDate);
48
+ }
49
+ static get styles() {
50
+ const year = unsafeCSS(FieldDateTimePrecision.Year.key);
51
+ const month = unsafeCSS(FieldDateTimePrecision.Month.key);
52
+ const day = unsafeCSS(FieldDateTimePrecision.Day.key);
53
+ return css `
54
+ :host {
55
+ --mo-calendar-item-size: 2.25rem;
56
+ flex: 1;
57
+ }
58
+
59
+ .scroller {
60
+ height: min(450px, 100vh);
61
+
62
+ display: grid;
63
+ position: relative;
64
+ scrollbar-width: none;
65
+ overflow-x: hidden;
66
+ scroll-behavior: smooth;
67
+
68
+ &[data-view=${day}] {
69
+ grid-template-columns: repeat(1, 1fr);
70
+ }
71
+
72
+ &[data-view=${month}] {
73
+ grid-template-columns: repeat(3, 1fr);
74
+ }
75
+
76
+ &[data-view=${year}] {
77
+ grid-template-columns: repeat(5, 1fr);
78
+ }
79
+ }
80
+
81
+ .year, .month, .day {
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ text-align: center;
86
+ transition: 0.2s;
87
+
88
+ user-select: none;
89
+
90
+ font-weight: 500;
91
+
92
+ border-radius: var(--mo-border-radius);
93
+
94
+ &:hover {
95
+ background: var(--mo-color-transparent-gray-3);
96
+ }
97
+
98
+ &[data-now] {
99
+ outline: 2px dashed var(--mo-color-gray-transparent);
100
+ }
101
+
102
+ &[data-start], &[data-end] {
103
+ background: var(--mo-color-accent-transparent);
104
+ opacity: 1;
105
+ color: color-mix(in srgb, var(--mo-color-accent), var(--mo-color-foreground)) !important;
106
+ }
107
+
108
+ &[data-in-range] {
109
+ background: color-mix(in srgb, var(--mo-color-accent), transparent 92%);
110
+ }
111
+ }
112
+
113
+ /* Headings */
114
+ .year[data-view=${month}], .month[data-view=${day}] {
115
+ font-size: 1.125rem;
116
+ font-weight: 500;
117
+ height: 2rem;
118
+ padding: 0.5rem;
119
+ }
120
+
121
+ /* Selection */
122
+ .year[data-view=${year}], .month[data-view=${month}], .day {
123
+ opacity: 0.875;
124
+ font-size: 0.94rem;
125
+ cursor: pointer;
126
+ height: var(--mo-calendar-item-size);
127
+ }
128
+
129
+ .year {
130
+ &[data-view=${day}] {
131
+ display: none;
132
+ }
133
+ &:not([data-view=${year}]) {
134
+ grid-column: -1 / 1;
135
+ border-block-start: 1px solid var(--mo-color-transparent-gray-3);
136
+ }
137
+ padding-inline: 0.5rem;
138
+ }
139
+
140
+ .month-container {
141
+ width: 100%;
142
+ position: relative;
143
+ &[data-view=${day}] {
144
+ &::before {
145
+ content: ' ';
146
+ position: absolute;
147
+ display: inline-block;
148
+ width: 1px;
149
+ height: 100%;
150
+ inset-block: 0;
151
+ background: var(--mo-color-transparent-gray-3);
152
+ }
153
+ &::after {
154
+ content: ' ';
155
+ position: absolute;
156
+ display: inline-block;
157
+ height: 1px;
158
+ width: 100%;
159
+ inset-inline: 0;
160
+ background: var(--mo-color-transparent-gray-3);
161
+ }
162
+ }
163
+
164
+ & > mo-grid {
165
+ padding-inline: 0.5rem;
166
+ padding-block-end: 0.5rem;
167
+ margin-block-start: -0.375rem;
168
+ }
169
+
170
+ &[data-view=${month}] {
171
+ & > mo-grid {
172
+ display: none;
173
+ }
174
+ }
175
+ }
176
+
177
+ .weekdays {
178
+ text-align: center;
179
+ opacity: 0.5;
180
+ font-size: 0.75rem;
181
+ font-weight: 500;
182
+ grid-column: -1 / 1;
183
+ user-select: none;
184
+ span {
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ }
189
+ }
190
+
191
+ .month {
192
+ padding-inline: 0.5rem;
193
+ }
194
+
195
+ .week {
196
+ opacity: 0.5;
197
+ }
198
+
199
+ .day {
200
+ width: var(--mo-calendar-item-size);
201
+ height: var(--mo-calendar-item-size);
202
+ }
203
+ `;
204
+ }
205
+ get columns() {
206
+ return [
207
+ !this.includeWeek ? undefined : '[week] var(--mo-calendar-item-size)',
208
+ ...CalendarDatesController.sampleWeek.map(day => `[${this.getColumnName(day)}] var(--mo-calendar-item-size)`),
209
+ ].join(' ');
210
+ }
211
+ getColumnName(date) {
212
+ return `day-${date.dayOfWeek}`;
213
+ }
214
+ get template() {
215
+ return html `
216
+ <div class='scroller' data-view=${this.view.key}>
217
+ ${repeat(this.datesController.data, d => d.toString(), d => html `
218
+ ${this.getYearTemplate(d)}
219
+ ${this.getMonthTemplate(d)}
220
+ `)}
221
+ </div>
222
+ `;
223
+ }
224
+ getYearTemplate(date) {
225
+ return date.dayOfYear !== 1 ? html.nothing : html `
226
+ <div class='year' role='button'
227
+ data-view=${this.view.key}
228
+ ?data-navigating=${this.isNavigating(date, FieldDateTimePrecision.Year)}
229
+ ?data-now=${this.isNow(date, FieldDateTimePrecision.Year)}
230
+ ?data-start=${this.isStart(date, FieldDateTimePrecision.Year)}
231
+ ?data-end=${this.isEnd(date, FieldDateTimePrecision.Year)}
232
+ ?data-in-range=${this.isInRange(date, FieldDateTimePrecision.Year)}
233
+ @click=${this.handleItemClick(date, FieldDateTimePrecision.Year)}
234
+ ${this.datesController.observerIntersectionNavigation(date, FieldDateTimePrecision.Month, FieldDateTimePrecision.Year)}
235
+ >
236
+ ${date.format({ year: 'numeric' })}
237
+ </div>
238
+ `;
239
+ }
240
+ static get weekDaysTemplate() {
241
+ return html `
242
+ <mo-grid class='weekdays' columns='subgrid'>
243
+ ${CalendarDatesController.sampleWeek.map((day, index) => {
244
+ const { narrow, short, long } = {
245
+ narrow: day.format({ weekday: 'narrow' }),
246
+ short: day.format({ weekday: 'short' }),
247
+ long: day.format({ weekday: 'long' }),
248
+ };
249
+ return html `
250
+ <span style='grid-column: day-${index + 1}' title=${long}>
251
+ ${long === short ? narrow : short}
252
+ </span>
253
+ `;
254
+ })}
255
+ </mo-grid>
256
+ `;
257
+ }
258
+ getMonthTemplate(date) {
259
+ return this.view === FieldDateTimePrecision.Year || date.day !== 1 ? html.nothing : html `
260
+ <mo-flex class='month-container' data-view=${this.view.key}>
261
+ <div class='month' role='button'
262
+ data-view=${this.view.key}
263
+ ?data-navigating=${this.isNavigating(date, FieldDateTimePrecision.Month)}
264
+ ?data-now=${this.isNow(date, FieldDateTimePrecision.Month)}
265
+ ?data-start=${this.isStart(date, FieldDateTimePrecision.Month)}
266
+ ?data-end=${this.isEnd(date, FieldDateTimePrecision.Month)}
267
+ ?data-in-range=${this.isInRange(date, FieldDateTimePrecision.Month)}
268
+ @click=${this.handleItemClick(date, FieldDateTimePrecision.Month)}
269
+ ${this.datesController.observerIntersectionNavigation(date, FieldDateTimePrecision.Day)}
270
+ >
271
+ ${this.view === FieldDateTimePrecision.Day ? date.format({ year: 'numeric', month: 'long' }) : date.format({ month: 'long' })}
272
+ </div>
273
+ <mo-grid justifyContent='center' autoRows='var(--mo-calendar-item-size)' columns=${this.view === FieldDateTimePrecision.Day ? this.columns : 'auto'}>
274
+ ${this.view !== FieldDateTimePrecision.Day ? html.nothing : Calendar_1.weekDaysTemplate}
275
+ ${this.datesController.data.filter(d => d.year === date.year && d.month === date.month).map(day => this.getDayTemplate(day))}
276
+ </mo-grid>
277
+ </mo-flex>
278
+ `;
279
+ }
280
+ getDayTemplate(day) {
281
+ return this.view === FieldDateTimePrecision.Month ? html.nothing : html `
282
+ ${this.includeWeek === false || day.dayOfWeek !== 1 ? html.nothing : html `
283
+ <div class='week' style='grid-column: week'>${day.weekOfYear}</div>
284
+ `}
285
+ <div tabindex='0' role='button' class='day'
286
+ style='grid-column: ${this.getColumnName(day)}'
287
+ ?data-navigating=${this.isNavigating(day, FieldDateTimePrecision.Day)}
288
+ ?data-now=${this.isNow(day, FieldDateTimePrecision.Day)}
289
+ ?data-start=${this.isStart(day, FieldDateTimePrecision.Day)}
290
+ ?data-end=${this.isEnd(day, FieldDateTimePrecision.Day)}
291
+ ?data-in-range=${this.isInRange(day, FieldDateTimePrecision.Day)}
292
+ @click=${this.handleItemClick(day, FieldDateTimePrecision.Day)}
293
+ >
294
+ ${day.format({ day: 'numeric' })}
295
+ </div>
296
+ `;
297
+ }
298
+ isNavigating(date, precision) {
299
+ return this.view === precision
300
+ && this.navigationDate.year === date.year
301
+ && (precision === FieldDateTimePrecision.Year || this.navigationDate.month === date.month)
302
+ && (precision !== FieldDateTimePrecision.Day || this.navigationDate.day === date.day);
303
+ }
304
+ isEqual(precision, left, right) {
305
+ return left.year === right.year
306
+ && (precision === FieldDateTimePrecision.Year || left.month === right.month)
307
+ && (precision !== FieldDateTimePrecision.Day || left.day === right.day);
308
+ }
309
+ isLower(precision, left, right) {
310
+ return left.year < right.year
311
+ || (precision !== FieldDateTimePrecision.Year && left.year === right.year && left.month < right.month)
312
+ || (precision === FieldDateTimePrecision.Day && left.year === right.year && left.month === right.month && left.day < right.day);
313
+ }
314
+ isNow(date, precision) {
315
+ return this.view === precision && this.isEqual(precision, date, CalendarDatesController.today);
316
+ }
317
+ isStart(date, precision) {
318
+ return precision === this.precision && !!this.value?.start && this.isEqual(precision, date, this.value?.start);
319
+ }
320
+ isEnd(date, precision) {
321
+ return precision === this.precision && !!this.value?.end && this.isEqual(precision, date, this.value?.end);
322
+ }
323
+ isInRange(date, precision) {
324
+ return precision === this.precision && !!this.value?.start && !!this.value?.end
325
+ && this.isLower(precision, this.value.start, date)
326
+ && this.isLower(precision, date, this.value.end);
327
+ }
328
+ };
329
+ __decorate([
330
+ event()
331
+ ], Calendar.prototype, "dateClick", void 0);
332
+ __decorate([
333
+ property({ type: Object })
334
+ ], Calendar.prototype, "value", void 0);
335
+ __decorate([
336
+ property({ type: Object, updated() { this.setView(this.precision); } })
337
+ ], Calendar.prototype, "precision", void 0);
338
+ __decorate([
339
+ property({ type: Boolean, reflect: true })
340
+ ], Calendar.prototype, "includeWeek", void 0);
341
+ __decorate([
342
+ state()
343
+ ], Calendar.prototype, "view", void 0);
344
+ Calendar = Calendar_1 = __decorate([
345
+ component('mo-calendar')
346
+ ], Calendar);
347
+ export { Calendar };
@@ -0,0 +1,22 @@
1
+ import { Controller, type DirectiveResult } from '@a11d/lit';
2
+ import type { Calendar } from './Calendar.js';
3
+ import { FieldDateTimePrecision } from '../FieldDateTimePrecision.js';
4
+ export declare class CalendarDatesController extends Controller {
5
+ readonly host: Calendar;
6
+ static get today(): import("@3mo/date-time/DateTime.js").DateTime;
7
+ private static generate;
8
+ private static _sampleWeek;
9
+ static get sampleWeek(): ReadonlyArray<DateTime>;
10
+ private static generateWeek;
11
+ disableObservers: boolean;
12
+ observerIntersectionNavigation(date: DateTime, ...views: Array<FieldDateTimePrecision>): DirectiveResult<any>;
13
+ constructor(host: Calendar);
14
+ private days;
15
+ private months;
16
+ private years;
17
+ get data(): import("@3mo/date-time/DateTime.js").DateTime[];
18
+ private _navigationDate;
19
+ get navigationDate(): import("@3mo/date-time/DateTime.js").DateTime;
20
+ set navigationDate(value: import("@3mo/date-time/DateTime.js").DateTime);
21
+ }
22
+ //# sourceMappingURL=CalendarDatesController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalendarDatesController.d.ts","sourceRoot":"","sources":["../../selection/CalendarDatesController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAGlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE,qBAAa,uBAAwB,SAAQ,UAAU;aAkCxB,IAAI,EAAE,QAAQ;IAhC5C,MAAM,KAAK,KAAK,kDAAqC;IAErD,OAAO,CAAC,MAAM,CAAE,QAAQ;IAMxB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAwB;IAClD,MAAM,KAAK,UAAU,IAAgC,aAAa,CAAC,QAAQ,CAAC,CAAE;IAE9E,OAAO,CAAC,MAAM,CAAC,YAAY;IAW3B,gBAAgB,UAAQ;IAExB,8BAA8B,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KAAK,CAAC,sBAAsB,CAAC;gBAQxD,IAAI,EAAE,QAAQ;IAK5C,OAAO,CAAC,IAAI,CAAwB;IACpC,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,KAAK,CAAwB;IAErC,IAAI,IAAI,oDASP;IAED,OAAO,CAAC,eAAe,CAAW;IAClC,IAAI,cAAc,kDAAkC;IACpD,IAAI,cAAc,CAAC,KAAK,+CAAA,EAsCvB;CACD"}
@@ -0,0 +1,76 @@
1
+ import { __decorate } from "tslib";
2
+ import { Controller, html } from '@a11d/lit';
3
+ import { observeIntersection } from '@3mo/intersection-observer';
4
+ import { MemoizeExpiring as memoizeExpiring } from 'typescript-memoize';
5
+ import { FieldDateTimePrecision } from '../FieldDateTimePrecision.js';
6
+ export class CalendarDatesController extends Controller {
7
+ static get today() { return new DateTime().dayStart; }
8
+ static *generate(start, count, step) {
9
+ for (let i = 0; i < count; i++) {
10
+ yield start.add({ [step]: i });
11
+ }
12
+ }
13
+ static get sampleWeek() { return this._sampleWeek; }
14
+ static generateWeek() {
15
+ const sample = [...CalendarDatesController.generate(CalendarDatesController.today, CalendarDatesController.today.daysInWeek * 2, 'days')];
16
+ const indexOfFirstWeekStart = sample.findIndex(d => d.dayOfWeek === 1);
17
+ const daysInWeek = sample[0].daysInWeek;
18
+ CalendarDatesController._sampleWeek = sample.slice(indexOfFirstWeekStart, indexOfFirstWeekStart + daysInWeek).map(d => d.dayStart);
19
+ }
20
+ observerIntersectionNavigation(date, ...views) {
21
+ return !views.includes(this.host.view) ? html.nothing : observeIntersection(data => {
22
+ if (!this.disableObservers && data.some(entry => entry.isIntersecting)) {
23
+ this.navigationDate = date;
24
+ }
25
+ });
26
+ }
27
+ constructor(host) {
28
+ super(host);
29
+ this.host = host;
30
+ this.disableObservers = false;
31
+ this.days = new Array();
32
+ this.months = new Array();
33
+ this.years = new Array();
34
+ this.navigationDate = CalendarDatesController.today;
35
+ }
36
+ get data() {
37
+ switch (this.host.view) {
38
+ case FieldDateTimePrecision.Year:
39
+ return this.years;
40
+ case FieldDateTimePrecision.Month:
41
+ return this.months;
42
+ default:
43
+ return this.days;
44
+ }
45
+ }
46
+ get navigationDate() { return this._navigationDate; }
47
+ set navigationDate(value) {
48
+ let changed = false;
49
+ const daysOffset = 75;
50
+ if (this.host.view === FieldDateTimePrecision.Day && (!this.days.length || value.isBefore(this.days.at(daysOffset)) || value.isAfter(this.days.at(-daysOffset)))) {
51
+ this.days = [...CalendarDatesController.generate(value.yearStart.add({ years: -1 }), value.daysInYear * 3, 'days')];
52
+ changed = true;
53
+ }
54
+ const monthsOffset = 25;
55
+ if (this.host.view === FieldDateTimePrecision.Month && (!this.months.length || value.isBefore(this.months.at(monthsOffset)) || value.isAfter(this.months.at(-monthsOffset)))) {
56
+ this.months = [...CalendarDatesController.generate(value.yearStart.add({ years: -10 }), value.monthsInYear * 20, 'months')];
57
+ changed = true;
58
+ }
59
+ const yearsOffset = 15;
60
+ if (this.host.view === FieldDateTimePrecision.Year && (!this.years.length || value.isBefore(this.years.at(yearsOffset)) || value.isAfter(this.years.at(-yearsOffset)))) {
61
+ this.years = [...CalendarDatesController.generate(value.yearStart.add({ years: -100 }), 200, 'years')];
62
+ changed = true;
63
+ }
64
+ if (changed) {
65
+ this.host.requestUpdate();
66
+ }
67
+ this._navigationDate = value.dayStart;
68
+ }
69
+ }
70
+ CalendarDatesController._sampleWeek = new Array();
71
+ (() => {
72
+ CalendarDatesController.generateWeek();
73
+ })();
74
+ __decorate([
75
+ memoizeExpiring(60000)
76
+ ], CalendarDatesController, "today", null);
@@ -2,7 +2,7 @@ import { Component, type HTMLTemplateResult } from '@a11d/lit';
2
2
  export declare abstract class DateList extends Component {
3
3
  readonly change: EventDispatcher<DateTime>;
4
4
  readonly navigate: EventDispatcher<DateTime>;
5
- navigatingValue: DateTime;
5
+ navigationDate: DateTime;
6
6
  value?: DateTime;
7
7
  private readonly selector;
8
8
  private readonly items;
@@ -16,7 +16,7 @@ export declare abstract class DateList extends Component {
16
16
  private _navigateOnScroll;
17
17
  get navigateOnScroll(): boolean;
18
18
  set navigateOnScroll(value: boolean);
19
- protected handleScroll(): void;
19
+ protected handleScroll(e: Event): void;
20
20
  protected abstract get listItemsTemplate(): HTMLTemplateResult;
21
21
  }
22
22
  //# sourceMappingURL=DateList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateList.d.ts","sourceRoot":"","sources":["../../selection/DateList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAA6D,MAAM,WAAW,CAAA;AAGzH,8BAAsB,QAAS,SAAQ,SAAS;IACtC,QAAQ,CAAC,MAAM,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC3C,QAAQ,CAAC,QAAQ,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAEP,eAAe,EAAG,QAAQ,CAAA;IAC7C,KAAK,CAAC,EAAE,QAAQ,CAAA;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAoB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAoB;IAE9F,IAAI,IAAI,WAAe;IAEvB,WAAoB,MAAM,kCA+BzB;cAEkB,SAAS;IAI5B,cAAuB,QAAQ,uBAiB9B;YAEa,cAAc;IAM5B,OAAO,CAAC,iBAAiB,CAAQ;IACjC,IAAI,gBAAgB,YAAoC;IACxD,IAAI,gBAAgB,CAAC,KAAK,SAAA,EAMzB;IAID,SAAS,CAAC,YAAY;IAYtB,SAAS,CAAC,QAAQ,KAAK,iBAAiB,IAAI,kBAAkB,CAAA;CAC9D"}
1
+ {"version":3,"file":"DateList.d.ts","sourceRoot":"","sources":["../../selection/DateList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAA6D,MAAM,WAAW,CAAA;AAGzH,8BAAsB,QAAS,SAAQ,SAAS;IACtC,QAAQ,CAAC,MAAM,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC3C,QAAQ,CAAC,QAAQ,EAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAEP,cAAc,EAAG,QAAQ,CAAA;IAC5C,KAAK,CAAC,EAAE,QAAQ,CAAA;IAExB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAoB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAoB;IAE9F,IAAI,IAAI,WAAe;IAEvB,WAAoB,MAAM,kCA+BzB;cAEkB,SAAS;IAI5B,cAAuB,QAAQ,uBAkB9B;YAEa,cAAc;IAM5B,OAAO,CAAC,iBAAiB,CAAQ;IACjC,IAAI,gBAAgB,YAAoC;IACxD,IAAI,gBAAgB,CAAC,KAAK,SAAA,EAMzB;IAID,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK;IAe/B,SAAS,CAAC,QAAQ,KAAK,iBAAiB,IAAI,kBAAkB,CAAA;CAC9D"}
@@ -13,7 +13,8 @@ export class DateList extends Component {
13
13
  }
14
14
 
15
15
  mo-scroller {
16
- min-width: 70px;
16
+ min-width: 50px;
17
+ scrollbar-width: none;
17
18
  }
18
19
 
19
20
  .selector {
@@ -27,14 +28,13 @@ export class DateList extends Component {
27
28
  }
28
29
 
29
30
  .pad {
30
- height: 130px;
31
+ height: 200px;
31
32
  }
32
33
 
33
34
  mo-selectable-list-item {
34
35
  min-height: 32px;
35
36
  padding-block: 8px;
36
37
  scroll-snap-align: center;
37
- scroll-snap-stop: always;
38
38
  }
39
39
  `;
40
40
  }
@@ -42,10 +42,11 @@ export class DateList extends Component {
42
42
  this.scrollIntoItem('navigating', 'instant');
43
43
  }
44
44
  get template() {
45
- return this.navigatingValue === undefined ? html.nothing : html `
45
+ return this.navigationDate === undefined ? html.nothing : html `
46
46
  <div class='selector'></div>
47
47
  <mo-scroller snapType='y mandatory'
48
48
  @scroll=${this.handleScroll}
49
+ @scrollend=${this.handleScroll}
49
50
  @mouseenter=${() => this.navigateOnScroll = true}
50
51
  @mouseleave=${() => this.navigateOnScroll = false}
51
52
  @touchstart=${() => this.navigateOnScroll = true}
@@ -73,7 +74,10 @@ export class DateList extends Component {
73
74
  setTimeout(() => this._navigateOnScroll = value, 100);
74
75
  }
75
76
  }
76
- handleScroll() {
77
+ handleScroll(e) {
78
+ if (e.type === 'scroll' && 'onscrollend' in HTMLElement.prototype) {
79
+ return;
80
+ }
77
81
  if (!this.navigateOnScroll) {
78
82
  return;
79
83
  }
@@ -93,7 +97,7 @@ __decorate([
93
97
  ], DateList.prototype, "navigate", void 0);
94
98
  __decorate([
95
99
  property({ type: Object, event: 'navigate' })
96
- ], DateList.prototype, "navigatingValue", void 0);
100
+ ], DateList.prototype, "navigationDate", void 0);
97
101
  __decorate([
98
102
  property({ type: Object })
99
103
  ], DateList.prototype, "value", void 0);
@@ -4,11 +4,11 @@ import { DateList } from './DateList.js';
4
4
  let HourList = class HourList extends DateList {
5
5
  get listItemsTemplate() {
6
6
  return html `
7
- ${[...range(0, this.navigatingValue.hoursInDay)].map(hour => html `
7
+ ${[...range(0, this.navigationDate.hoursInDay)].map(hour => html `
8
8
  <mo-selectable-list-item
9
9
  ?selected=${this.value?.hour === hour}
10
- ?data-navigating=${this.navigatingValue.hour === hour}
11
- @navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ hour }))}
10
+ ?data-navigating=${this.navigationDate.hour === hour}
11
+ @navigate=${() => this.navigate.dispatch(this.navigationDate.with({ hour }))}
12
12
  @change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ hour }))}
13
13
  >${hour.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
14
14
  `)}
@@ -7,8 +7,8 @@ let MinuteList = class MinuteList extends DateList {
7
7
  ${[...range(0, 60)].map(minute => html `
8
8
  <mo-selectable-list-item
9
9
  ?selected=${this.value?.minute === minute}
10
- ?data-navigating=${this.navigatingValue.minute === minute}
11
- @navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ minute }))}
10
+ ?data-navigating=${this.navigationDate.minute === minute}
11
+ @navigate=${() => this.navigate.dispatch(this.navigationDate.with({ minute }))}
12
12
  @change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ minute }))}
13
13
  >${minute.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
14
14
  `)}
@@ -7,8 +7,8 @@ let SecondList = class SecondList extends DateList {
7
7
  ${[...range(0, 60)].map(second => html `
8
8
  <mo-selectable-list-item
9
9
  ?selected=${this.value?.second === second}
10
- ?data-navigating=${this.navigatingValue.second === second}
11
- @navigate=${() => this.navigate.dispatch(this.navigatingValue.with({ second }))}
10
+ ?data-navigating=${this.navigationDate.second === second}
11
+ @navigate=${() => this.navigate.dispatch(this.navigationDate.with({ second }))}
12
12
  @change=${(e) => !e.selected ? void 0 : this.change.dispatch((this.value ?? new DateTime).with({ second }))}
13
13
  >${second.format().padStart(2, this.zero.format())}</mo-selectable-list-item>
14
14
  `)}
@@ -1,7 +1,5 @@
1
- export * from './MonthList.js';
2
- export * from './YearList.js';
1
+ export * from './Calendar.js';
3
2
  export * from './HourList.js';
4
3
  export * from './MinuteList.js';
5
4
  export * from './SecondList.js';
6
- export * from './calendar/index.js';
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../selection/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
@@ -1,6 +1,4 @@
1
- export * from './MonthList.js';
2
- export * from './YearList.js';
1
+ export * from './Calendar.js';
3
2
  export * from './HourList.js';
4
3
  export * from './MinuteList.js';
5
4
  export * from './SecondList.js';
6
- export * from './calendar/index.js';