@taiga-ui/addon-mobile 4.52.0-canary.932d3ef → 4.52.0-canary.9471234

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 (91) hide show
  1. package/README.md +2 -2
  2. package/components/bottom-sheet/bottom-sheet.component.d.ts +3 -3
  3. package/components/index.d.ts +0 -1
  4. package/components/mobile-calendar/calendar-date-stream.d.ts +6 -0
  5. package/components/mobile-calendar/index.d.ts +1 -0
  6. package/components/mobile-calendar/mobile-calendar.component.d.ts +20 -22
  7. package/components/mobile-calendar/mobile-calendar.strategy.d.ts +3 -7
  8. package/components/mobile-calendar-dropdown/mobile-calendar-dropdown.component.d.ts +10 -12
  9. package/components/mobile-calendar-dropdown/mobile-calendar-dropdown.directive.d.ts +6 -6
  10. package/components/pull-to-refresh/pull-to-refresh.component.d.ts +8 -7
  11. package/components/sheet-dialog/sheet-dialog.component.d.ts +2 -2
  12. package/components/sheet-dialog/sheet-dialog.directive.d.ts +4 -3
  13. package/components/sheet-dialog/sheet-dialog.options.d.ts +4 -10
  14. package/components/sheet-dialog/sheet-dialog.service.d.ts +9 -4
  15. package/components/swipe-action/swipe-actions-auto-close.directive.d.ts +2 -2
  16. package/components/tab-bar/tab-bar-item.component.d.ts +3 -3
  17. package/components/tab-bar/tab-bar.component.d.ts +4 -7
  18. package/directives/dropdown-mobile/dropdown-mobile.component.d.ts +10 -14
  19. package/directives/dropdown-mobile/dropdown-mobile.directive.d.ts +1 -2
  20. package/directives/dropdown-sheet/dropdown-sheet.component.d.ts +14 -0
  21. package/directives/dropdown-sheet/dropdown-sheet.directive.d.ts +6 -0
  22. package/directives/dropdown-sheet/index.d.ts +2 -0
  23. package/directives/elastic-sticky/elastic-sticky.directive.d.ts +1 -2
  24. package/directives/index.d.ts +1 -1
  25. package/directives/responsive-dialog/responsive-dialog.directive.d.ts +5 -4
  26. package/directives/responsive-dialog/responsive-dialog.service.d.ts +4 -7
  27. package/directives/ripple/ripple.directive.d.ts +3 -3
  28. package/directives/touchable/touchable.directive.d.ts +5 -5
  29. package/fesm2022/taiga-ui-addon-mobile-components-bottom-sheet.mjs +14 -21
  30. package/fesm2022/taiga-ui-addon-mobile-components-bottom-sheet.mjs.map +1 -1
  31. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-dropdown.mjs +35 -57
  32. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-dropdown.mjs.map +1 -1
  33. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-sheet.mjs +9 -12
  34. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar-sheet.mjs.map +1 -1
  35. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs +128 -161
  36. package/fesm2022/taiga-ui-addon-mobile-components-mobile-calendar.mjs.map +1 -1
  37. package/fesm2022/taiga-ui-addon-mobile-components-pull-to-refresh.mjs +46 -57
  38. package/fesm2022/taiga-ui-addon-mobile-components-pull-to-refresh.mjs.map +1 -1
  39. package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs +62 -60
  40. package/fesm2022/taiga-ui-addon-mobile-components-sheet-dialog.mjs.map +1 -1
  41. package/fesm2022/taiga-ui-addon-mobile-components-swipe-action.mjs +12 -20
  42. package/fesm2022/taiga-ui-addon-mobile-components-swipe-action.mjs.map +1 -1
  43. package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs +31 -51
  44. package/fesm2022/taiga-ui-addon-mobile-components-tab-bar.mjs.map +1 -1
  45. package/fesm2022/taiga-ui-addon-mobile-components.mjs +0 -1
  46. package/fesm2022/taiga-ui-addon-mobile-components.mjs.map +1 -1
  47. package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs +65 -88
  48. package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-mobile.mjs.map +1 -1
  49. package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-sheet.mjs +83 -0
  50. package/fesm2022/taiga-ui-addon-mobile-directives-dropdown-sheet.mjs.map +1 -0
  51. package/fesm2022/taiga-ui-addon-mobile-directives-elastic-sticky.mjs +11 -15
  52. package/fesm2022/taiga-ui-addon-mobile-directives-elastic-sticky.mjs.map +1 -1
  53. package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs +46 -29
  54. package/fesm2022/taiga-ui-addon-mobile-directives-responsive-dialog.mjs.map +1 -1
  55. package/fesm2022/taiga-ui-addon-mobile-directives-ripple.mjs +21 -44
  56. package/fesm2022/taiga-ui-addon-mobile-directives-ripple.mjs.map +1 -1
  57. package/fesm2022/taiga-ui-addon-mobile-directives-touchable.mjs +20 -27
  58. package/fesm2022/taiga-ui-addon-mobile-directives-touchable.mjs.map +1 -1
  59. package/fesm2022/taiga-ui-addon-mobile-directives.mjs +1 -1
  60. package/fesm2022/taiga-ui-addon-mobile-services.mjs +36 -7
  61. package/fesm2022/taiga-ui-addon-mobile-services.mjs.map +1 -1
  62. package/package.json +20 -20
  63. package/services/index.d.ts +1 -0
  64. package/services/theme-color.service.d.ts +18 -0
  65. package/styles/android/app-bar.less +5 -1
  66. package/styles/android/switch.less +1 -0
  67. package/styles/common/badge-notification.less +1 -1
  68. package/styles/common/badge.less +2 -3
  69. package/styles/common/block-status.less +1 -1
  70. package/styles/common/button.less +1 -1
  71. package/styles/common/card-large.less +4 -0
  72. package/styles/common/chip.less +0 -21
  73. package/styles/common/header.less +1 -1
  74. package/styles/common/message.less +1 -1
  75. package/styles/common/segmented.less +1 -1
  76. package/styles/common/title.less +0 -1
  77. package/styles/common/toast.less +21 -0
  78. package/styles/ios/switch.less +50 -1
  79. package/styles/taiga-ui-mobile.less +14 -0
  80. package/components/mobile-dialog/index.d.ts +0 -3
  81. package/components/mobile-dialog/mobile-dialog.component.d.ts +0 -10
  82. package/components/mobile-dialog/mobile-dialog.options.d.ts +0 -12
  83. package/components/mobile-dialog/mobile-dialog.service.d.ts +0 -10
  84. package/directives/sidebar/index.d.ts +0 -3
  85. package/directives/sidebar/sidebar.component.d.ts +0 -21
  86. package/directives/sidebar/sidebar.d.ts +0 -6
  87. package/directives/sidebar/sidebar.directive.d.ts +0 -22
  88. package/fesm2022/taiga-ui-addon-mobile-components-mobile-dialog.mjs +0 -64
  89. package/fesm2022/taiga-ui-addon-mobile-components-mobile-dialog.mjs.map +0 -1
  90. package/fesm2022/taiga-ui-addon-mobile-directives-sidebar.mjs +0 -114
  91. package/fesm2022/taiga-ui-addon-mobile-directives-sidebar.mjs.map +0 -1
@@ -1,28 +1,41 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Optional, Self, inject, viewChild, DestroyRef, NgZone, computed, input, output, model, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
4
+ import { tuiControlValue, tuiWatch, tuiZonefreeScheduler, tuiZonefree, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
5
+ import { of, map, Subject, distinctUntilChanged, EMPTY, timer, identity, delay, take, windowToggle, mergeMap, filter, switchMap, race, debounceTime, takeUntil } from 'rxjs';
1
6
  import { VIRTUAL_SCROLL_STRATEGY, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
2
7
  import { DOCUMENT, AsyncPipe } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { InjectionToken, Optional, inject, DestroyRef, NgZone, EventEmitter, Input, Output, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
5
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
+ import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
9
+ import { WA_IS_IOS, WA_IS_E2E } from '@ng-web-apis/platform';
6
10
  import { TuiMobileCalendarSheet } from '@taiga-ui/addon-mobile/components/mobile-calendar-sheet';
7
- import { TuiRipple, TuiTouchable } from '@taiga-ui/addon-mobile/directives';
11
+ import { TuiRipple } from '@taiga-ui/addon-mobile/directives/ripple';
12
+ import { TuiTouchable } from '@taiga-ui/addon-mobile/directives/touchable';
8
13
  import { TUI_FALSE_HANDLER } from '@taiga-ui/cdk/constants';
9
- import { MONTHS_IN_YEAR, TuiDay, TuiMonth, TUI_FIRST_DAY, TUI_LAST_DAY, TuiDayRange } from '@taiga-ui/cdk/date-time';
10
- import { tuiWatch, tuiZonefreeScheduler, tuiZonefree, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
14
+ import { MONTHS_IN_YEAR, TuiDay, TuiDayRange, TuiMonth, TUI_FIRST_DAY, TUI_LAST_DAY } from '@taiga-ui/cdk/date-time';
11
15
  import { TuiMapperPipe } from '@taiga-ui/cdk/pipes/mapper';
12
- import { TUI_IS_IOS, TUI_IS_E2E } from '@taiga-ui/cdk/tokens';
13
16
  import { TuiButton } from '@taiga-ui/core/components/button';
14
- import { TUI_CALENDAR_SHEET_OPTIONS } from '@taiga-ui/core/components/calendar';
17
+ import { TUI_CALENDAR_SHEET_OPTIONS, TuiOrderWeekDaysPipe } from '@taiga-ui/core/components/calendar';
15
18
  import { TuiLink } from '@taiga-ui/core/components/link';
16
- import { TuiMonthPipe } from '@taiga-ui/core/pipes/month';
17
- import { TuiOrderWeekDaysPipe } from '@taiga-ui/core/pipes/order-week-days';
18
- import { TUI_ANIMATIONS_SPEED, TUI_COMMON_ICONS, TUI_CLOSE_WORD, TUI_SHORT_WEEK_DAYS } from '@taiga-ui/core/tokens';
19
+ import { TUI_ANIMATIONS_SPEED, TUI_COMMON_ICONS, TUI_CLOSE_WORD, TUI_MONTHS, TUI_SHORT_WEEK_DAYS } from '@taiga-ui/core/tokens';
19
20
  import { tuiGetDuration } from '@taiga-ui/core/utils/miscellaneous';
20
- import { TUI_CALENDAR_DATE_STREAM, TUI_CANCEL_WORD, TUI_DONE_WORD, TUI_CHOOSE_DAY_OR_RANGE_TEXTS } from '@taiga-ui/kit/tokens';
21
- import { tuiToggleDay } from '@taiga-ui/kit/utils';
22
- import { Subject, distinctUntilChanged, takeUntil, EMPTY, BehaviorSubject, skip, map, timer, identity, delay, take, windowToggle, mergeMap, filter, switchMap, race, debounceTime } from 'rxjs';
23
- import { TuiScrollService } from '@taiga-ui/cdk/services';
24
- import { __decorate } from 'tslib';
25
- import { tuiPure } from '@taiga-ui/cdk/utils/miscellaneous';
21
+ import { TUI_CANCEL_WORD, TUI_DONE_WORD, TUI_CHOOSE_DAY_OR_RANGE_TEXTS } from '@taiga-ui/kit/tokens';
22
+
23
+ const TUI_CALENDAR_DATE_STREAM = new InjectionToken(ngDevMode ? 'TUI_CALENDAR_DATE_STREAM' : '');
24
+ function tuiDateStreamWithTransformer(transformer) {
25
+ return {
26
+ provide: TUI_CALENDAR_DATE_STREAM,
27
+ deps: [
28
+ [new Optional(), new Self(), NgControl],
29
+ [new Optional(), transformer],
30
+ ],
31
+ useFactory: tuiControlValueFactory,
32
+ };
33
+ }
34
+ function tuiControlValueFactory(control, transformer) {
35
+ return control
36
+ ? tuiControlValue(control).pipe(map((value) => transformer ? transformer?.fromControlValue(value) : value))
37
+ : of(null);
38
+ }
26
39
 
27
40
  function getCycle(options) {
28
41
  return Array.from({ length: options.yearCycle }, (_, i) => Array.from({ length: MONTHS_IN_YEAR }, (_, month) => options.label +
@@ -70,20 +83,17 @@ function reduceCycle(cycle, lastYear = 28, lastMonth = 12) {
70
83
  : total, 0);
71
84
  }
72
85
  /**
73
- * This scroll strategy is hard wired with styles for iOS and Android.
86
+ * This scroll strategy is hard-wired with styles for iOS and Android.
74
87
  * It is dependent on month height on those platforms and is designed to
75
88
  * work for {@link TuiMobileCalendar} with years 1906 to 2102
76
89
  */
77
90
  class TuiMobileCalendarStrategy {
78
- constructor(isIOS, scrollService) {
79
- this.isIOS = isIOS;
80
- this.scrollService = scrollService;
91
+ constructor() {
92
+ this.isIOS = inject(WA_IS_IOS);
93
+ this.destroy$ = new Subject();
81
94
  this.index$ = new Subject();
82
95
  this.viewport = null;
83
- this.destroy$ = new Subject();
84
- }
85
- get scrolledIndexChange() {
86
- return this.index$.pipe(distinctUntilChanged());
96
+ this.scrolledIndexChange = this.index$.pipe(distinctUntilChanged());
87
97
  }
88
98
  attach(viewport) {
89
99
  const cycle = this.isIOS ? IOS_CYCLE_HEIGHT : ANDROID_CYCLE_HEIGHT;
@@ -107,18 +117,7 @@ class TuiMobileCalendarStrategy {
107
117
  onContentRendered() { }
108
118
  onRenderedOffsetChanged() { }
109
119
  scrollToIndex(index, behavior) {
110
- if (!this.viewport) {
111
- return;
112
- }
113
- const scrollTop = this.getOffsetForIndex(index);
114
- if (behavior !== 'smooth') {
115
- this.viewport.scrollToOffset(scrollTop, behavior);
116
- return;
117
- }
118
- this.scrollService
119
- .scroll$(this.viewport.elementRef.nativeElement, scrollTop)
120
- .pipe(takeUntil(this.destroy$))
121
- .subscribe();
120
+ this.viewport?.scrollToOffset(this.getOffsetForIndex(index), behavior);
122
121
  }
123
122
  getOffsetForIndex(index) {
124
123
  const month = index % MONTHS_IN_YEAR;
@@ -175,19 +174,14 @@ class TuiMobileCalendarStrategy {
175
174
  this.index$.next(firstVisibleIndex);
176
175
  }
177
176
  }
178
- __decorate([
179
- tuiPure
180
- ], TuiMobileCalendarStrategy.prototype, "scrolledIndexChange", null);
181
177
 
182
178
  /**
183
179
  * Stream for updating value
184
180
  */
185
181
  const TUI_VALUE_STREAM = new InjectionToken(ngDevMode ? 'TUI_VALUE_STREAM' : '');
186
182
  const TUI_MOBILE_CALENDAR_PROVIDERS = [
187
- TuiScrollService,
188
183
  {
189
184
  provide: VIRTUAL_SCROLL_STRATEGY,
190
- deps: [TUI_IS_IOS, TuiScrollService],
191
185
  useClass: TuiMobileCalendarStrategy,
192
186
  },
193
187
  {
@@ -199,7 +193,8 @@ const TUI_MOBILE_CALENDAR_PROVIDERS = [
199
193
 
200
194
  class TuiMobileCalendar {
201
195
  constructor() {
202
- this.value$ = new BehaviorSubject(null);
196
+ this.yearsScroll = viewChild('yearsScroll');
197
+ this.monthsScroll = viewChild('monthsScroll');
203
198
  this.today = TuiDay.currentLocal();
204
199
  this.activeYear = 0;
205
200
  this.activeMonth = 0;
@@ -207,15 +202,42 @@ class TuiMobileCalendar {
207
202
  this.doc = inject(DOCUMENT);
208
203
  this.speed = inject(TUI_ANIMATIONS_SPEED);
209
204
  this.ngZone = inject(NgZone);
205
+ this.getYearsViewportSize = computed(() => this.yearsScroll()?.getViewportSize() || 0);
206
+ this.initialYear = computed((value = this.value()) => {
207
+ if (!value) {
208
+ return this.today.year;
209
+ }
210
+ if (value instanceof TuiDay) {
211
+ return value.year;
212
+ }
213
+ if (!(value instanceof TuiDayRange)) {
214
+ return value?.[0]?.year ?? this.today.year;
215
+ }
216
+ return value.to.year;
217
+ });
218
+ this.initialMonth = computed((value = this.value()) => {
219
+ if (!value) {
220
+ return this.today.month + (this.today.year - STARTING_YEAR) * MONTHS_IN_YEAR;
221
+ }
222
+ if (value instanceof TuiDay) {
223
+ return value.month + (value.year - STARTING_YEAR) * MONTHS_IN_YEAR;
224
+ }
225
+ if (!(value instanceof TuiDayRange)) {
226
+ return ((value?.[0]?.month ?? this.today.month) +
227
+ ((value?.[0]?.year ?? this.today.year) - STARTING_YEAR) * MONTHS_IN_YEAR);
228
+ }
229
+ return value.to.month + (value.to.year - STARTING_YEAR) * MONTHS_IN_YEAR;
230
+ });
210
231
  this.initialized = false;
211
- this.isIOS = inject(TUI_IS_IOS);
212
- this.isE2E = inject(TUI_IS_E2E);
232
+ this.isIOS = inject(WA_IS_IOS);
233
+ this.isE2E = inject(WA_IS_E2E);
213
234
  this.icons = inject(TUI_COMMON_ICONS);
214
- this.closeWord$ = inject(TUI_CLOSE_WORD);
215
- this.cancelWord$ = inject(TUI_CANCEL_WORD);
216
- this.doneWord$ = inject(TUI_DONE_WORD);
217
- this.unorderedWeekDays$ = inject(TUI_SHORT_WEEK_DAYS);
218
- this.chooseDayOrRangeTexts$ = inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS, {
235
+ this.closeWord = inject(TUI_CLOSE_WORD);
236
+ this.cancelWord = inject(TUI_CANCEL_WORD);
237
+ this.doneWord = inject(TUI_DONE_WORD);
238
+ this.monthNames = inject(TUI_MONTHS);
239
+ this.unorderedWeekDays$ = toObservable(inject(TUI_SHORT_WEEK_DAYS));
240
+ this.chooseDayOrRangeTexts = inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS, {
219
241
  optional: true,
220
242
  });
221
243
  this.years = Array.from({ length: RANGE }, (_, i) => i + STARTING_YEAR);
@@ -227,34 +249,26 @@ class TuiMobileCalendar {
227
249
  * ```
228
250
  * TODO(v5): delete it
229
251
  */
230
- this.single = !inject(TUI_CALENDAR_SHEET_OPTIONS).rangeMode;
231
- this.multi = false;
232
- this.min = TUI_FIRST_DAY;
233
- this.max = TUI_LAST_DAY;
234
- this.disabledItemHandler = TUI_FALSE_HANDLER;
235
- this.cancel = new EventEmitter();
236
- this.confirm = new EventEmitter();
237
- this.valueChange = this.value$.pipe(skip(1), distinctUntilChanged((a, b) => a?.toString() === b?.toString()), map((x) => (!this.single && x instanceof TuiDay ? new TuiDayRange(x, x) : x)));
252
+ this.single = input(!inject(TUI_CALENDAR_SHEET_OPTIONS).rangeMode);
253
+ this.multi = input(false);
254
+ this.min = input(TUI_FIRST_DAY);
255
+ this.max = input(TUI_LAST_DAY);
256
+ this.disabledItemHandler = input(TUI_FALSE_HANDLER);
257
+ this.cancel = output();
258
+ this.confirm = output();
259
+ this.value = model(null);
238
260
  this.disabledItemHandlerMapper = (disabledItemHandler, min, max) => (item) => item.dayBefore(min) ||
239
261
  (max !== null && item.dayAfter(max)) ||
240
262
  disabledItemHandler(item);
241
263
  inject(TUI_VALUE_STREAM)
242
264
  .pipe(takeUntilDestroyed())
243
265
  .subscribe((value) => {
244
- this.value = value;
266
+ this.value.set(value);
245
267
  });
246
268
  }
247
- set value(value) {
248
- if (value !== undefined) {
249
- this.value$.next(value);
250
- }
251
- }
252
- get value() {
253
- return this.value$.value;
254
- }
255
269
  ngAfterViewInit() {
256
- this.activeYear = this.initialYear;
257
- this.activeMonth = this.initialMonth;
270
+ this.activeYear = this.initialYear();
271
+ this.activeMonth = this.initialMonth();
258
272
  // Virtual scroll has not yet rendered items even in ngAfterViewInit
259
273
  this.waitScrolledChange();
260
274
  }
@@ -276,28 +290,30 @@ class TuiMobileCalendar {
276
290
  this.cancel.emit();
277
291
  }
278
292
  onConfirm() {
279
- if (this.value) {
280
- this.confirm.emit(this.value);
293
+ const value = this.value();
294
+ if (value) {
295
+ this.confirm.emit(value);
281
296
  }
282
297
  else {
283
298
  this.cancel.emit();
284
299
  }
285
300
  }
286
301
  onDayClick(day) {
287
- if (this.single) {
288
- this.value = day;
302
+ const value = this.value();
303
+ if (this.single()) {
304
+ this.value.set(day);
289
305
  }
290
- else if (this.isMultiValue(this.value)) {
291
- this.value = tuiToggleDay(this.value, day);
306
+ else if (this.isMultiValue(value)) {
307
+ this.value.set(toggleDay(value, day));
292
308
  }
293
- else if (this.value instanceof TuiDay) {
294
- this.value = TuiDayRange.sort(this.value, day);
309
+ else if (value instanceof TuiDay) {
310
+ this.value.set(TuiDayRange.sort(value, day));
295
311
  }
296
- else if (this.value instanceof TuiDayRange) {
297
- this.value = day;
312
+ else if (value instanceof TuiDayRange) {
313
+ this.value.set(day);
298
314
  }
299
- else if (!this.value) {
300
- this.value = day;
315
+ else if (!value) {
316
+ this.value.set(day);
301
317
  }
302
318
  }
303
319
  getState(index) {
@@ -322,49 +338,20 @@ class TuiMobileCalendar {
322
338
  this.activeYear = activeYear;
323
339
  this.scrollToActiveYear();
324
340
  }
325
- get initialYear() {
326
- if (!this.value) {
327
- return this.today.year;
328
- }
329
- if (this.value instanceof TuiDay) {
330
- return this.value.year;
331
- }
332
- if (!(this.value instanceof TuiDayRange)) {
333
- return this.value?.[0]?.year ?? this.today.year;
334
- }
335
- return this.value.to.year;
336
- }
337
- get initialMonth() {
338
- if (!this.value) {
339
- return this.today.month + (this.today.year - STARTING_YEAR) * MONTHS_IN_YEAR;
340
- }
341
- if (this.value instanceof TuiDay) {
342
- return this.value.month + (this.value.year - STARTING_YEAR) * MONTHS_IN_YEAR;
343
- }
344
- if (!(this.value instanceof TuiDayRange)) {
345
- return ((this.value?.[0]?.month ?? this.today.month) +
346
- ((this.value?.[0]?.year ?? this.today.year) - STARTING_YEAR) *
347
- MONTHS_IN_YEAR);
348
- }
349
- return (this.value.to.month + (this.value.to.year - STARTING_YEAR) * MONTHS_IN_YEAR);
350
- }
351
341
  isMultiValue(day) {
352
- return !(day instanceof TuiDay) && !(day instanceof TuiDayRange) && this.multi;
353
- }
354
- getYearsViewportSize() {
355
- return this.yearsScrollRef?.getViewportSize() || 0;
342
+ return !(day instanceof TuiDay) && !(day instanceof TuiDayRange) && this.multi();
356
343
  }
357
344
  updateViewportDimension() {
358
- this.yearsScrollRef?.checkViewportSize();
359
- this.monthsScrollRef?.checkViewportSize();
345
+ this.yearsScroll()?.checkViewportSize();
346
+ this.monthsScroll()?.checkViewportSize();
360
347
  }
361
348
  lateInit() {
362
349
  return this.getYearsViewportSize() > 0 ? identity : delay(200);
363
350
  }
364
351
  waitScrolledChange() {
365
352
  this.updateViewportDimension();
366
- this.monthsScrollRef?.scrolledIndexChange
367
- .pipe(delay(tuiGetDuration(this.speed)), this.lateInit(), take(1), takeUntilDestroyed(this.destroyRef))
353
+ this.monthsScroll()
354
+ ?.scrolledIndexChange.pipe(delay(tuiGetDuration(this.speed)), this.lateInit(), take(1), takeUntilDestroyed(this.destroyRef))
368
355
  .subscribe(() => {
369
356
  this.initialized = true;
370
357
  this.updateViewportDimension();
@@ -375,21 +362,21 @@ class TuiMobileCalendar {
375
362
  });
376
363
  }
377
364
  initYearScroll() {
378
- const { yearsScrollRef } = this;
379
- if (!yearsScrollRef) {
365
+ const yearsScroll = this.yearsScroll();
366
+ if (!yearsScroll) {
380
367
  return;
381
368
  }
382
- const touchstart$ = tuiTypedFromEvent(yearsScrollRef.elementRef.nativeElement, 'touchstart', { passive: true });
383
- const touchend$ = tuiTypedFromEvent(yearsScrollRef.elementRef.nativeElement, 'touchend', { passive: true });
384
- const click$ = tuiTypedFromEvent(yearsScrollRef.elementRef.nativeElement, 'click');
369
+ const touchstart$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'touchstart', { passive: true });
370
+ const touchend$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'touchend', { passive: true });
371
+ const click$ = tuiTypedFromEvent(yearsScroll.elementRef.nativeElement, 'click');
385
372
  // Refresh activeYear
386
- yearsScrollRef
373
+ yearsScroll
387
374
  .elementScrolled()
388
375
  .pipe(
389
376
  // Ignore smooth scroll resulting from click on the exact year
390
377
  windowToggle(touchstart$, () => click$), mergeMap((x) => x),
391
378
  // Delay is required to run months scroll in the next frame to prevent flicker
392
- delay(0), map(() => Math.round(yearsScrollRef.measureScrollOffset() / this.yearWidth) +
379
+ delay(0), map(() => Math.round(yearsScroll.measureScrollOffset() / this.yearWidth) +
393
380
  Math.floor(YEARS_IN_ROW / 2) +
394
381
  STARTING_YEAR), filter((activeYear) => activeYear !== this.activeYear), takeUntilDestroyed(this.destroyRef))
395
382
  .subscribe((activeYear) => {
@@ -399,26 +386,26 @@ class TuiMobileCalendar {
399
386
  });
400
387
  // Smooth scroll to activeYear after scrolling is done
401
388
  touchstart$
402
- .pipe(switchMap(() => touchend$), switchMap(() => race(yearsScrollRef.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
389
+ .pipe(switchMap(() => touchend$), switchMap(() => race(yearsScroll.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
403
390
  .subscribe(() => this.scrollToActiveYear('smooth'));
404
391
  }
405
392
  initMonthScroll() {
406
- const { monthsScrollRef } = this;
407
- if (!monthsScrollRef) {
393
+ const monthsScroll = this.monthsScroll();
394
+ if (!monthsScroll) {
408
395
  return;
409
396
  }
410
- const touchstart$ = tuiTypedFromEvent(monthsScrollRef.elementRef.nativeElement, 'touchstart', { passive: true });
411
- const touchend$ = tuiTypedFromEvent(monthsScrollRef.elementRef.nativeElement, 'touchend', { passive: true });
397
+ const touchstart$ = tuiTypedFromEvent(monthsScroll.elementRef.nativeElement, 'touchstart', { passive: true });
398
+ const touchend$ = tuiTypedFromEvent(monthsScroll.elementRef.nativeElement, 'touchend', { passive: true });
412
399
  // Smooth scroll to the closest month after scrolling is done
413
400
  touchstart$
414
- .pipe(switchMap(() => touchend$), switchMap(() => race(monthsScrollRef.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
401
+ .pipe(switchMap(() => touchend$), switchMap(() => race(monthsScroll.elementScrolled(), timer(SCROLL_DEBOUNCE_TIME, tuiZonefreeScheduler(this.ngZone))).pipe(debounceTime(SCROLL_DEBOUNCE_TIME * 2, tuiZonefreeScheduler(this.ngZone)), take(1), takeUntil(touchstart$))), takeUntilDestroyed(this.destroyRef))
415
402
  .subscribe(() => this.scrollToActiveMonth('smooth'));
416
403
  }
417
404
  scrollToActiveYear(behavior = 'auto') {
418
- this.yearsScrollRef?.scrollToIndex(Math.max(this.activeYear - STARTING_YEAR - 2, 0), this.isE2E ? 'auto' : behavior);
405
+ this.yearsScroll()?.scrollToIndex(Math.max(this.activeYear - STARTING_YEAR - 2, 0), this.isE2E ? 'auto' : behavior);
419
406
  }
420
407
  scrollToActiveMonth(behavior = 'auto') {
421
- this.monthsScrollRef?.scrollToIndex(this.activeMonth, this.isE2E ? 'auto' : behavior);
408
+ this.monthsScroll()?.scrollToIndex(this.activeMonth, this.isE2E ? 'auto' : behavior);
422
409
  }
423
410
  isYearActive(index) {
424
411
  return index === this.activeYear;
@@ -429,10 +416,10 @@ class TuiMobileCalendar {
429
416
  getMonthOffset(year) {
430
417
  return (year - this.activeYear) * MONTHS_IN_YEAR;
431
418
  }
432
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiMobileCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
433
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiMobileCalendar, isStandalone: true, selector: "tui-mobile-calendar", inputs: { single: "single", multi: "multi", min: "min", max: "max", disabledItemHandler: "disabledItemHandler", value: "value" }, outputs: { cancel: "cancel", confirm: "confirm", valueChange: "valueChange" }, host: { listeners: { "mousedown.prevent": "0" }, properties: { "class._ios": "isIOS", "class._initialized": "initialized" } }, providers: TUI_MOBILE_CALENDAR_PROVIDERS, viewQueries: [{ propertyName: "yearsScrollRef", first: true, predicate: ["yearsScrollRef"], descendants: true }, { propertyName: "monthsScrollRef", first: true, predicate: ["monthsScrollRef"], descendants: true }], ngImport: i0, template: "@if (chooseDayOrRangeTexts$ | async; as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord$ | async }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord$ | async }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single ? texts[0] : multi ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord$ | async }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScrollRef\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScrollRef\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ month | tuiMonth | async }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min : max\"\n [month]=\"month\"\n [single]=\"single\"\n [value]=\"value\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;font-family:-apple-system,BlinkMacSystemFont,Roboto,sans-serif;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "directive", type: TuiLink, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo"] }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }, { kind: "component", type: TuiMobileCalendarSheet, selector: "tui-mobile-calendar-sheet" }, { kind: "pipe", type: TuiMonthPipe, name: "tuiMonth" }, { kind: "pipe", type: TuiOrderWeekDaysPipe, name: "tuiOrderWeekDays" }, { kind: "directive", type: TuiRipple, selector: "[tuiRipple]", inputs: ["tuiRipple"] }, { kind: "directive", type: TuiTouchable, selector: "[tuiTouchable]", inputs: ["tuiTouchable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiMobileCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
420
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiMobileCalendar, isStandalone: true, selector: "tui-mobile-calendar", inputs: { single: { classPropertyName: "single", publicName: "single", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabledItemHandler: { classPropertyName: "disabledItemHandler", publicName: "disabledItemHandler", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cancel: "cancel", confirm: "confirm", value: "valueChange" }, host: { listeners: { "mousedown.prevent": "0" }, properties: { "class._ios": "isIOS", "class._initialized": "initialized" } }, providers: TUI_MOBILE_CALENDAR_PROVIDERS, viewQueries: [{ propertyName: "yearsScroll", first: true, predicate: ["yearsScroll"], descendants: true, isSignal: true }, { propertyName: "monthsScroll", first: true, predicate: ["monthsScroll"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (chooseDayOrRangeTexts?.(); as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord() }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord() }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single() ? texts[0] : multi() ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord() }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScroll\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScroll\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ monthNames()[month.month] }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler() | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [month]=\"month\"\n [single]=\"single()\"\n [value]=\"value()\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "directive", type: TuiLink, selector: "a[tuiLink], button[tuiLink]" }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }, { kind: "component", type: TuiMobileCalendarSheet, selector: "tui-mobile-calendar-sheet" }, { kind: "pipe", type: TuiOrderWeekDaysPipe, name: "tuiOrderWeekDays" }, { kind: "directive", type: TuiRipple, selector: "[tuiRipple]", inputs: ["tuiRipple"] }, { kind: "directive", type: TuiTouchable, selector: "[tuiTouchable]", inputs: ["tuiTouchable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
434
421
  }
435
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiMobileCalendar, decorators: [{
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiMobileCalendar, decorators: [{
436
423
  type: Component,
437
424
  args: [{ selector: 'tui-mobile-calendar', imports: [
438
425
  AsyncPipe,
@@ -443,7 +430,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
443
430
  TuiLink,
444
431
  TuiMapperPipe,
445
432
  TuiMobileCalendarSheet,
446
- TuiMonthPipe,
447
433
  TuiOrderWeekDaysPipe,
448
434
  TuiRipple,
449
435
  TuiTouchable,
@@ -451,36 +437,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
451
437
  '[class._ios]': 'isIOS',
452
438
  '[class._initialized]': 'initialized',
453
439
  '(mousedown.prevent)': '0',
454
- }, template: "@if (chooseDayOrRangeTexts$ | async; as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord$ | async }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord$ | async }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single ? texts[0] : multi ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord$ | async }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScrollRef\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScrollRef\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ month | tuiMonth | async }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler | tuiMapper: disabledItemHandlerMapper : min : max\"\n [month]=\"month\"\n [single]=\"single\"\n [value]=\"value\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;font-family:-apple-system,BlinkMacSystemFont,Roboto,sans-serif;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"] }]
455
- }], ctorParameters: () => [], propDecorators: { yearsScrollRef: [{
456
- type: ViewChild,
457
- args: ['yearsScrollRef']
458
- }], monthsScrollRef: [{
459
- type: ViewChild,
460
- args: ['monthsScrollRef']
461
- }], single: [{
462
- type: Input
463
- }], multi: [{
464
- type: Input
465
- }], min: [{
466
- type: Input
467
- }], max: [{
468
- type: Input
469
- }], disabledItemHandler: [{
470
- type: Input
471
- }], cancel: [{
472
- type: Output
473
- }], confirm: [{
474
- type: Output
475
- }], valueChange: [{
476
- type: Output
477
- }], value: [{
478
- type: Input
479
- }] } });
440
+ }, template: "@if (chooseDayOrRangeTexts?.(); as texts) {\n <header class=\"t-header\">\n <button\n appearance=\"\"\n automation-id=\"tui-mobile-calendar__cancel\"\n tuiIconButton\n tuiRipple\n type=\"button\"\n class=\"t-close\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"onClose()\"\n >\n {{ closeWord() }}\n </button>\n <button\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link t-link_close\"\n (click)=\"onClose()\"\n >\n {{ cancelWord() }}\n </button>\n <h2\n automation-id=\"tui-mobile-calendar__label\"\n class=\"t-label\"\n >\n {{ single() ? texts[0] : multi() ? texts[2] : texts[1] }}\n </h2>\n <button\n automation-id=\"tui-mobile-calendar__confirm\"\n tuiLink\n tuiTouchable=\"opacity\"\n type=\"button\"\n class=\"t-link\"\n (click)=\"onConfirm()\"\n >\n {{ doneWord() }}\n </button>\n </header>\n}\n<cdk-virtual-scroll-viewport\n #yearsScroll\n orientation=\"horizontal\"\n class=\"t-years\"\n [itemSize]=\"yearWidth\"\n>\n <div class=\"t-years-wrapper\">\n <button\n *cdkVirtualFor=\"let index of years\"\n type=\"button\"\n class=\"t-year\"\n [attr.data-state]=\"getState(index)\"\n (click)=\"setYear(index)\"\n >\n {{ index }}\n </button>\n </div>\n</cdk-virtual-scroll-viewport>\n<div class=\"t-week\">\n @for (day of unorderedWeekDays$ | tuiOrderWeekDays | async; track day) {\n <div class=\"t-day\">\n {{ day }}\n </div>\n }\n</div>\n<cdk-virtual-scroll-viewport\n #monthsScroll\n itemSize=\"354\"\n maxBufferPx=\"5000\"\n minBufferPx=\"0\"\n class=\"t-months\"\n (scrolledIndexChange)=\"onMonthChange($event)\"\n>\n <section\n *cdkVirtualFor=\"let month of months; templateCacheSize: 10\"\n class=\"t-month-wrapper\"\n >\n <h2 class=\"t-month\">{{ monthNames()[month.month] }}</h2>\n <tui-mobile-calendar-sheet\n class=\"t-calendar\"\n [disabledItemHandler]=\"disabledItemHandler() | tuiMapper: disabledItemHandlerMapper : min() : max()\"\n [month]=\"month\"\n [single]=\"single()\"\n [value]=\"value()\"\n (dayClick)=\"onDayClick($event)\"\n />\n </section>\n</cdk-virtual-scroll-viewport>\n", styles: [":host{display:block;block-size:100%;color:var(--tui-text-primary);overscroll-behavior:none;-webkit-tap-highlight-color:transparent}:host ::ng-deep .t-cell:before,:host ::ng-deep .t-cell:after{transform:translateZ(1px)}.t-header{position:relative;display:flex;align-items:center;block-size:3.5rem;padding:0 1rem;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-header{block-size:2.75rem;border-block-end:none}.t-close{inline-size:1.5rem;block-size:1.5rem;margin-inline-end:2rem}:host._ios .t-close{display:none}.t-link{margin-inline-start:auto;flex-shrink:0;font-size:.875rem;line-height:1rem;font-weight:500;text-transform:uppercase;color:var(--tui-text-action)}.t-link_close{display:none}:host._ios .t-link{min-inline-size:3.75rem;text-align:end;font-size:.9375rem;line-height:1.125rem;font-weight:400;letter-spacing:.018125rem;text-transform:none}:host._ios .t-link_close{display:block;margin:0 auto 0 0;text-align:start}.t-label{flex-grow:1;margin:0;font-size:1.25rem;line-height:3.5rem;font-weight:500;letter-spacing:-.0125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-label+.t-link{padding-inline-start:1rem}:host._ios .t-label{font-size:1.0625rem;font-weight:600;letter-spacing:-.025625rem;text-align:center}.t-years{scrollbar-width:none;-ms-overflow-style:none;block-size:4.0625rem;background-color:var(--tui-background-base);box-shadow:0 .5px var(--tui-border-normal)}.t-years::-webkit-scrollbar,.t-years::-webkit-scrollbar-thumb{display:none}:host._ios .t-years{background-color:transparent}.t-years-wrapper{display:flex;block-size:4.0625rem}.t-year{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;outline:none;inline-size:20vw;flex-shrink:0;font-size:.9375rem;font-weight:700;letter-spacing:.015625rem;cursor:pointer;opacity:.1;transform:scale(.73);transition:color,opacity,transform .2s}.t-year[data-state=adjacent]{transform:scale(.86);opacity:.3}.t-year[data-state=active]{color:var(--tui-text-action);opacity:1;transform:scale(1)}.t-week{display:flex;align-items:center;block-size:1.875rem;inline-size:20.75rem;max-inline-size:100%;margin:0 auto;font-size:.75rem}:host._ios .t-week{inline-size:22.625rem;font-size:.6875rem;font-weight:500;color:var(--tui-text-secondary)}.t-day{flex:1;text-align:center}.t-months{scrollbar-width:none;-ms-overflow-style:none;block-size:calc(100% - 9.5rem);box-shadow:0 -1px var(--tui-border-normal);overflow-x:hidden}.t-months::-webkit-scrollbar,.t-months::-webkit-scrollbar-thumb{display:none}:host._ios .t-months{block-size:calc(100% - 8.75rem)}.t-month-wrapper{display:flex;margin:.625rem 0 -.625rem;block-size:22.125rem;flex-direction:column}.t-month{block-size:2.75rem;inline-size:100%;line-height:2.75rem;padding-inline-start:1rem;font-size:.875rem;font-weight:500;text-transform:uppercase;margin:0 0 1.25rem;box-sizing:border-box;border-block-end:.5px solid var(--tui-border-normal)}:host._ios .t-month{block-size:3.125rem;margin:0;border-block-end:none;text-transform:none;font-size:1.375rem;line-height:3.125rem;letter-spacing:.02rem;font-weight:700}.t-calendar{margin:0 auto;transition:opacity .2s}.t-week,.t-years,.t-months{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}:host(._initialized) .t-week,:host(._initialized) .t-years,:host(._initialized) .t-months{opacity:1}\n"] }]
441
+ }], ctorParameters: () => [] });
442
+ function toggleDay(days, day) {
443
+ return ((days?.find((item) => item.daySame(day))
444
+ ? days.filter((item) => !item.daySame(day))
445
+ : days?.concat(day)) || []);
446
+ }
480
447
 
481
448
  /**
482
449
  * Generated bundle index. Do not edit.
483
450
  */
484
451
 
485
- export { ANDROID_CYCLE, ANDROID_LABEL, ANDROID_WEEK, BUFFER, IOS_CYCLE, IOS_LABEL, IOS_WEEK, RANGE, SCROLL_DEBOUNCE_TIME, STARTING_YEAR, TUI_MOBILE_CALENDAR_PROVIDERS, TUI_VALUE_STREAM, TuiMobileCalendar, TuiMobileCalendarStrategy, YEARLY_CYCLE, YEARS_IN_ROW };
452
+ export { ANDROID_CYCLE, ANDROID_LABEL, ANDROID_WEEK, BUFFER, IOS_CYCLE, IOS_LABEL, IOS_WEEK, RANGE, SCROLL_DEBOUNCE_TIME, STARTING_YEAR, TUI_CALENDAR_DATE_STREAM, TUI_MOBILE_CALENDAR_PROVIDERS, TUI_VALUE_STREAM, TuiMobileCalendar, TuiMobileCalendarStrategy, YEARLY_CYCLE, YEARS_IN_ROW, tuiDateStreamWithTransformer };
486
453
  //# sourceMappingURL=taiga-ui-addon-mobile-components-mobile-calendar.mjs.map