@sixbell-telco/sdk 1.2.0 → 1.3.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +183 -70
  3. package/_index.css +132 -53
  4. package/components/data-table/expandable/expandable.component.d.ts +129 -0
  5. package/components/data-table/index.d.ts +5 -0
  6. package/components/data-table/public-api.d.ts +7 -0
  7. package/components/data-table/selection/selection.component.d.ts +41 -0
  8. package/components/data-table/sortable-header/sortable-header.component.d.ts +61 -0
  9. package/components/data-table/src/data-table-context.service.d.ts +18 -0
  10. package/components/data-table/src/data-table.component.d.ts +158 -0
  11. package/components/data-table/src/models.d.ts +58 -0
  12. package/components/data-table/sub-component-toggle/index.d.ts +1 -0
  13. package/components/data-table/sub-component-toggle/sub-component-toggle.component.d.ts +12 -0
  14. package/components/dialog/dialog-title/dialog-title.component.d.ts +4 -0
  15. package/components/dialog/src/dialog.component.d.ts +22 -8
  16. package/components/dropdown/dropdown-group/dropdown-group.component.d.ts +1 -1
  17. package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +2 -2
  18. package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +2 -2
  19. package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +2 -2
  20. package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +2 -2
  21. package/components/forms/datepicker/constants/datepicker.constants.d.ts +5 -0
  22. package/components/forms/datepicker/public-api.d.ts +2 -1
  23. package/components/forms/datepicker/src/datepicker.component.d.ts +155 -44
  24. package/components/forms/datepicker/types/datepicker.types.d.ts +7 -0
  25. package/components/overlay/index.d.ts +5 -0
  26. package/components/overlay/overlay-content/overlay-content.component.d.ts +23 -0
  27. package/components/overlay/overlay-trigger/overlay-trigger.component.d.ts +48 -0
  28. package/components/overlay/public-api.d.ts +3 -0
  29. package/components/overlay/src/overlay.component.d.ts +158 -0
  30. package/components/paginator/components/pagination-item/pagination-item.component.d.ts +8 -3
  31. package/components/paginator/pipes/pagination.pipe.d.ts +40 -0
  32. package/components/paginator/public-api.d.ts +1 -0
  33. package/components/paginator/src/paginator.component.d.ts +14 -12
  34. package/components/table/src/table.component.d.ts +9 -6
  35. package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs +103 -0
  36. package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs.map +1 -0
  37. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +1091 -0
  38. package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -0
  39. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +63 -12
  40. package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -1
  41. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +6 -6
  42. package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -1
  43. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +12 -10
  44. package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
  45. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +4 -5
  46. package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
  47. package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +439 -164
  48. package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
  49. package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +2 -2
  50. package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
  51. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +3 -3
  52. package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
  53. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs +408 -0
  54. package/fesm2022/sixbell-telco-sdk-components-overlay.mjs.map +1 -0
  55. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +150 -35
  56. package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
  57. package/fesm2022/sixbell-telco-sdk-components-table.mjs +15 -6
  58. package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
  59. package/fesm2022/sixbell-telco-sdk-utils-date.mjs +154 -0
  60. package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -0
  61. package/fesm2022/sixbell-telco-sdk-utils-sync.mjs +84 -0
  62. package/fesm2022/sixbell-telco-sdk-utils-sync.mjs.map +1 -0
  63. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs +3 -4
  64. package/fesm2022/sixbell-telco-sdk-utils-translation.mjs.map +1 -1
  65. package/package.json +51 -30
  66. package/utils/date/index.d.ts +5 -0
  67. package/utils/date/public-api.d.ts +1 -0
  68. package/utils/date/src/date-utils.d.ts +81 -0
  69. package/utils/sync/index.d.ts +5 -0
  70. package/utils/sync/public-api.d.ts +1 -0
  71. package/utils/sync/src/sync.d.ts +37 -0
  72. package/utils/translation/public-api.d.ts +3 -4
  73. package/components/forms/datepicker/src/datepicker-format-month.pipe.d.ts +0 -10
  74. package/sixbell-telco-sdk-1.2.0.tgz +0 -0
@@ -1,212 +1,487 @@
1
- import * as i0 from '@angular/core';
2
- import { Pipe, input, computed, model, output, effect, Component } from '@angular/core';
3
- import 'dayjs/locale/es';
4
- import 'dayjs/locale/pt';
5
- import * as i1 from '@angular/common';
6
1
  import { CommonModule } from '@angular/common';
7
- import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { InputComponent } from '@sixbell-telco/sdk/components/forms/input';
9
- import { IconComponent } from '@sixbell-telco/sdk/components/icon';
10
- import { matKeyboardArrowLeftOutline, matKeyboardArrowRightOutline } from '@sixbell-telco/sdk/components/icon/material/outline';
2
+ import * as i0 from '@angular/core';
3
+ import { signal, viewChild, input, output, computed, forwardRef, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { matChevronLeft, matChevronRight } from '@ng-icons/material-icons/baseline';
6
+ import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
7
+ import { OverlayComponent, OverlayTriggerComponent, OverlayContentComponent } from '@sixbell-telco/sdk/components/overlay';
8
+ import { DateUtils } from '@sixbell-telco/sdk/utils/date';
9
+ import { SyncUtils } from '@sixbell-telco/sdk/utils/sync';
10
+ import { TranslatePipe } from '@sixbell-telco/sdk/utils/translation';
11
+ import 'cally';
11
12
  import dayjs from 'dayjs';
12
- import customParseFormat from 'dayjs/plugin/customParseFormat';
13
- import isBetween from 'dayjs/plugin/isBetween';
14
- import isoWeek from 'dayjs/plugin/isoWeek';
15
13
 
16
- class DatepickerFormatMonthPipe {
17
- transform(value, language = 'es') {
18
- // capitalize the first letter of the month
19
- return value.locale(language).format('MMMM').charAt(0).toUpperCase() + value.format('MMMM YYYY').slice(1);
20
- }
21
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerFormatMonthPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
22
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.0", ngImport: i0, type: DatepickerFormatMonthPipe, isStandalone: true, name: "datepickerFormatMonth" });
23
- }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerFormatMonthPipe, decorators: [{
25
- type: Pipe,
26
- args: [{
27
- name: 'datepickerFormatMonth',
28
- standalone: true,
29
- }]
30
- }] });
14
+ /**
15
+ * Supported locales (BCP 47) for the date picker.
16
+ * These map directly to the underlying calendar web component locale attribute.
17
+ */
18
+ const SUPPORTED_LOCALES = [
19
+ 'en-US', // English (United States)
20
+ 'en-GB', // English (United Kingdom)
21
+ 'es-ES', // Spanish (Spain)
22
+ 'es-MX', // Spanish (Mexico)
23
+ 'fr-FR', // French (France)
24
+ 'de-DE', // German (Germany)
25
+ 'it-IT', // Italian (Italy)
26
+ 'pt-BR', // Portuguese (Brazil)
27
+ 'pt-PT', // Portuguese (Portugal)
28
+ 'ja-JP', // Japanese (Japan)
29
+ 'ko-KR', // Korean (Korea)
30
+ 'zh-CN', // Chinese (Simplified)
31
+ 'zh-TW', // Chinese (Traditional)
32
+ 'ru-RU', // Russian (Russia)
33
+ 'ar-SA', // Arabic (Saudi Arabia)
34
+ 'hi-IN', // Hindi (India)
35
+ 'nl-NL', // Dutch (Netherlands)
36
+ 'sv-SE', // Swedish (Sweden)
37
+ 'da-DK', // Danish (Denmark)
38
+ 'no-NO', // Norwegian (Norway)
39
+ 'fi-FI', // Finnish (Finland)
40
+ 'pl-PL', // Polish (Poland)
41
+ 'tr-TR', // Turkish (Turkey)
42
+ 'he-IL', // Hebrew (Israel)
43
+ 'th-TH', // Thai (Thailand)
44
+ 'vi-VN', // Vietnamese (Vietnam)
45
+ ];
31
46
 
32
- /* eslint-disable @typescript-eslint/no-explicit-any */
47
+ /**
48
+ * DatePicker Component following SOLID principles
49
+ *
50
+ * Responsibilities:
51
+ * - Single Responsibility: Manages date/range selection UI
52
+ * - Open/Closed: Extensible through inputs without modification
53
+ * - Liskov Substitution: Implements ControlValueAccessor contract
54
+ * - Interface Segregation: Focused public API
55
+ * - Dependency Inversion: Uses DateService for date operations
56
+ */
33
57
  class DatepickerComponent {
34
- iconArrowLeft = matKeyboardArrowLeftOutline;
35
- iconArrowRight = matKeyboardArrowRightOutline;
36
- format = input('DD/MM/YYYY');
37
- language = input('es');
38
- weekFromLanguage = computed(() => {
39
- if (this.language() === 'en') {
40
- return ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
41
- }
42
- else if (this.language() === 'pt') {
43
- return ['Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'];
44
- }
45
- else {
46
- return ['Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb', 'Dom'];
47
- }
48
- });
58
+ // ==================== STATE MANAGEMENT ====================
59
+ /** Internal state for single date (ISO format) */
60
+ _selectedDateValue = signal('');
61
+ /** Internal state for date range (ISO format) */
62
+ _selectedRangeValue = signal(null);
63
+ /** Disabled state */
64
+ _disabled = signal(false);
65
+ /** Flag to prevent concurrent range updates */
66
+ isUpdatingRange = false;
67
+ // ==================== FORM INTEGRATION ====================
68
+ /** Form change callback */
69
+ onControlChange = () => { };
70
+ /** Form touch callback */
71
+ onControlTouch = () => { };
72
+ // ==================== COMPONENT REFERENCES ====================
73
+ /** Overlay reference for controlling calendar popup */
74
+ datePickerOverlay = viewChild('datePickerOverlay');
75
+ // ==================== INPUTS ====================
76
+ /** Label displayed above the fieldset legend */
49
77
  label = input('');
50
- range = input(null); // example: [1, 'month']
78
+ /** Picker mode (single date or date range) */
79
+ mode = input('single');
80
+ /** Display / parse format */
81
+ format = input('DD/MM/YYYY');
82
+ /** Locale used by the calendar web component */
83
+ language = input('en-US');
84
+ /** Optional minimum selectable date */
51
85
  minDate = input(null);
86
+ /** Optional maximum selectable date */
52
87
  maxDate = input(null);
53
- disableUntil = input('');
54
- disableFrom = input('');
55
- current = model(dayjs().locale(this.language()).format(this.format()));
56
- dateUpdated = output();
57
- synchronizedPickersEffect = effect(() => {
58
- if (this.minDate() || this.maxDate()) {
59
- this.refresh();
60
- }
61
- });
62
- daysOfMonth = [];
63
- monthAndYearLabel = dayjs().locale(this.language());
64
- isOpen = false;
65
- // Form control properties
88
+ /** Single date value (external binding) */
89
+ value = input('');
90
+ /** Date range value (external binding) */
91
+ rangeValue = input(null);
92
+ /** Name attribute for associated input */
93
+ name = input('');
94
+ /** Number of calendars to show in range mode (1 or 2) */
95
+ rangeCalendars = input(2);
96
+ /** Whether to show quick action presets in range mode */
97
+ showQuickActions = input(true);
98
+ /** Parent reactive form group (optional) */
66
99
  parentForm = input(null);
100
+ /** Name of the form control inside the parent form (optional) */
67
101
  formControlName = input('');
68
- get formField() {
69
- if (!this.parentForm())
102
+ // ==================== OUTPUTS ====================
103
+ /** Emits formatted single date when it changes */
104
+ dateUpdated = output();
105
+ /** Emits formatted date range when both start & end are selected */
106
+ rangeUpdated = output();
107
+ /** Emits formatted single date (alias) */
108
+ valueChanged = output();
109
+ /** Emits formatted date range (alias) */
110
+ rangeValueChanged = output();
111
+ // ==================== COMPUTED PROPERTIES ====================
112
+ /** Effective minimum date (input or default 10 years ago) */
113
+ effectiveMinDate = computed(() => {
114
+ const inputMin = this.minDate();
115
+ return inputMin ? DateUtils.toISODate(inputMin) : dayjs().subtract(10, 'year').format('YYYY-MM-DD');
116
+ });
117
+ /** Effective maximum date (input or default 10 years ahead) */
118
+ effectiveMaxDate = computed(() => {
119
+ const inputMax = this.maxDate();
120
+ return inputMax ? DateUtils.toISODate(inputMax) : dayjs().add(10, 'year').format('YYYY-MM-DD');
121
+ });
122
+ /** Locale for calendar components */
123
+ calendarLocale = computed(() => this.language() || 'en-US');
124
+ /** Computed form field reference */
125
+ formField = computed(() => {
126
+ const form = this.parentForm();
127
+ const controlName = this.formControlName();
128
+ if (!form || !controlName)
70
129
  return null;
71
- return this.parentForm()?.get(this.formControlName());
72
- }
73
- // ControlValueAccessor attributes
74
- onControlChange = () => { };
75
- onControlTouch = () => { };
76
- disabled = model(false);
77
- // ControlValueAccessor methods
78
- writeValue(obj) {
79
- this.current.set(obj);
130
+ return form.get(controlName);
131
+ });
132
+ /** Formatted display value for single date */
133
+ selectedDate = computed(() => {
134
+ const isoValue = this._selectedDateValue();
135
+ return isoValue ? DateUtils.toDisplayDate(isoValue, this.format()) : '';
136
+ });
137
+ /** Formatted display value for date range */
138
+ selectedRange = computed(() => {
139
+ const isoRange = this._selectedRangeValue();
140
+ if (!isoRange?.start || !isoRange?.end)
141
+ return null;
142
+ return {
143
+ start: DateUtils.toDisplayDate(isoRange.start, this.format()),
144
+ end: DateUtils.toDisplayDate(isoRange.end, this.format()),
145
+ };
146
+ });
147
+ /** Value for calendar-range component (ISO/ISO format) */
148
+ rangeCalendarValue = computed(() => {
149
+ return DateUtils.toRangeValue(this._selectedRangeValue());
150
+ });
151
+ /** Unified display value for triggers */
152
+ displayValue = computed(() => {
153
+ if (this.mode() === 'range') {
154
+ const range = this.selectedRange();
155
+ return range ? `${range.start} - ${range.end}` : '';
156
+ }
157
+ return this.selectedDate();
158
+ });
159
+ /** Exposed selected date value (ISO format) for template access */
160
+ selectedDateValue = computed(() => this._selectedDateValue());
161
+ // ==================== COMPONENT LIFECYCLE ====================
162
+ constructor() {
163
+ // Initialize with default values if none provided
164
+ this.initializeValues();
80
165
  }
81
- registerOnChange(fn) {
82
- this.onControlChange = fn;
166
+ // ==================== PRIVATE METHODS ====================
167
+ /**
168
+ * Initialize component values based on inputs
169
+ */
170
+ initializeValues() {
171
+ if (this.mode() === 'range') {
172
+ // Only set a range if one is provided, otherwise leave empty
173
+ const inputRange = this.rangeValue();
174
+ if (inputRange?.start && inputRange?.end) {
175
+ const isoRange = {
176
+ start: DateUtils.toISODate(inputRange.start, this.format()),
177
+ end: DateUtils.toISODate(inputRange.end, this.format()),
178
+ };
179
+ this._selectedRangeValue.set(isoRange);
180
+ }
181
+ else {
182
+ this._selectedRangeValue.set(null);
183
+ }
184
+ }
185
+ else {
186
+ // Only set a date if one is provided, otherwise leave empty
187
+ const inputValue = this.value();
188
+ if (inputValue) {
189
+ const isoDate = DateUtils.toISODate(inputValue, this.format());
190
+ this._selectedDateValue.set(isoDate);
191
+ }
192
+ else {
193
+ this._selectedDateValue.set('');
194
+ }
195
+ }
83
196
  }
84
- registerOnTouched(fn) {
85
- this.onControlTouch = fn;
197
+ /**
198
+ * Set single date value programmatically
199
+ */
200
+ async setSingleDateValue(isoDate) {
201
+ this._selectedDateValue.set(isoDate);
202
+ const displayDate = this.selectedDate();
203
+ this.emitChanges(displayDate);
204
+ // Wait for next frame to ensure proper synchronization
205
+ await SyncUtils.nextFrame();
206
+ this.closeOverlay();
86
207
  }
87
- setDisabledState(isDisabled) {
88
- this.disabled.set(isDisabled);
208
+ // ==================== PRIVATE HELPER METHODS ====================
209
+ /**
210
+ * Emit change events and notify form controls
211
+ */
212
+ emitChanges(value) {
213
+ if (this.mode() === 'range') {
214
+ const rangeValue = value;
215
+ this.rangeUpdated.emit(rangeValue);
216
+ this.rangeValueChanged.emit(rangeValue);
217
+ }
218
+ else {
219
+ const dateValue = value;
220
+ this.dateUpdated.emit(dateValue);
221
+ this.valueChanged.emit(dateValue);
222
+ }
223
+ // For form controls, emit null for empty values to trigger validation properly
224
+ const formValue = value || null;
225
+ this.onControlChange(formValue);
226
+ this.onControlTouch();
89
227
  }
90
- constructor() {
91
- dayjs.extend(isoWeek);
92
- dayjs.extend(customParseFormat);
93
- dayjs.extend(isBetween);
228
+ /**
229
+ * Close overlay if available
230
+ */
231
+ closeOverlay() {
232
+ this.datePickerOverlay()?.close();
94
233
  }
95
- ngOnInit() {
96
- if (this.current()) {
97
- this.getDaysFromDate(dayjs(this.current(), this.format()).locale(this.language()).month() + 1, dayjs(this.current(), this.format()).locale(this.language()).year());
234
+ // ==================== PUBLIC API ====================
235
+ /**
236
+ * Handle calendar change events from Cally components
237
+ */
238
+ onCalendarChange(calendarElement) {
239
+ if (this.mode() === 'range') {
240
+ // Fire and forget async operation
241
+ this.handleRangeCalendarChange(calendarElement).catch(console.error);
98
242
  }
99
243
  else {
100
- const d = new Date();
101
- this.getDaysFromDate(d.getMonth() + 1, d.getFullYear());
244
+ this.handleSingleCalendarChange(calendarElement).catch(console.error);
102
245
  }
103
246
  }
104
- toggleDatepicker() {
105
- if (this.range()) {
106
- this.refresh();
247
+ /**
248
+ * Apply a predefined quick range preset
249
+ */
250
+ async selectQuickRange(preset) {
251
+ if (this.mode() !== 'range')
252
+ return;
253
+ try {
254
+ const quickRange = DateUtils.generateQuickRange(preset);
255
+ // Prevent rapid consecutive clicks by adding a flag
256
+ if (this.isUpdatingRange)
257
+ return;
258
+ this.isUpdatingRange = true;
259
+ // Use microtask to ensure proper state synchronization with Cally
260
+ await SyncUtils.nextTick();
261
+ await this.setRangeValue(quickRange);
262
+ // Wait before allowing next update
263
+ await SyncUtils.nextFrame();
264
+ this.isUpdatingRange = false;
107
265
  }
108
- this.isOpen = !this.isOpen;
109
- this.onControlTouch();
266
+ catch (error) {
267
+ console.error('Error applying quick range:', error);
268
+ this.isUpdatingRange = false;
269
+ }
270
+ }
271
+ /**
272
+ * Clear the current range selection
273
+ */
274
+ async clearRange() {
275
+ if (this.mode() !== 'range')
276
+ return;
277
+ // Prevent rapid consecutive clicks
278
+ if (this.isUpdatingRange)
279
+ return;
280
+ this.isUpdatingRange = true;
281
+ // Use microtask to ensure proper state synchronization with Cally
282
+ await SyncUtils.nextTick();
283
+ await this.setRangeValue(null);
284
+ // Wait before allowing next update
285
+ await SyncUtils.nextFrame();
286
+ this.isUpdatingRange = false;
110
287
  }
111
- getDaysFromDate(month, year) {
112
- const startDate = dayjs(`${year}/${month}/01`).locale(this.language());
113
- const endDate = startDate.clone().endOf('month');
114
- this.monthAndYearLabel = startDate;
115
- const diffDays = endDate.diff(startDate, 'days', true);
116
- const numberDays = Math.round(diffDays);
117
- const days = Object.keys([...Array(numberDays)]).map((a) => {
118
- const d = parseInt(a) + 1;
119
- const day = dayjs(`${year}-${month}-${d}`).locale(this.language());
120
- const range = this.range();
121
- const dateRange = this.minDate() ?? this.maxDate() ?? '';
122
- return {
123
- name: day.format('dddd'),
124
- value: d, // Change the value to a number
125
- indexWeek: day.isoWeekday(),
126
- disabled: range ? this.shouldDisableDayByRange(day, dateRange, range[0], range[1]) : this.shouldDisableDay(day),
127
- date: day.format(this.format()),
128
- };
129
- });
130
- this.daysOfMonth = days;
131
- }
132
- shouldDisableDayByRange(day, from, quantity, unit) {
133
- if (!from) {
134
- return false;
135
- }
136
- if (this.maxDate()) {
137
- // If maxDate is true, disables all dates AFTER 'from' date
138
- return !day.isBetween(dayjs(from, this.format()).locale(this.language()).subtract(quantity, unit), dayjs(from, this.format()).locale(this.language()), null, '[]');
139
- }
140
- if (this.minDate()) {
141
- // If minDate is true, disables all dates BEFORE 'from' date
142
- return !day.isBetween(dayjs(from, this.format()).locale(this.language()), dayjs(from, this.format()).locale(this.language()).add(quantity, unit), null, '[]');
143
- }
144
- // Disables all dates BEFORE and AFTER 'from' date
145
- return !day.isBetween(dayjs(from, this.format()).locale(this.language()).subtract(quantity, unit), dayjs(from, this.format()).locale(this.language()).add(quantity, unit), null, '[]');
146
- }
147
- shouldDisableDay(day) {
148
- if (this.disableUntil() && this.disableFrom()) {
149
- return !day.isBetween(dayjs(this.disableUntil(), this.format()).locale(this.language()).subtract(1, 'day'), dayjs(this.disableFrom(), this.format()).locale(this.language()).add(1, 'day'));
150
- }
151
- if (this.disableUntil() && !this.disableFrom()) {
152
- return day.isBefore(dayjs(this.disableUntil(), this.format()).locale(this.language()));
153
- }
154
- if (this.disableFrom() && !this.disableUntil()) {
155
- return day.isAfter(dayjs(this.disableFrom(), this.format()).locale(this.language()));
156
- }
157
- return false;
158
- }
159
- refresh() {
160
- // Used to force a refresh on the calendar
161
- this.changeMonth(true);
162
- this.changeMonth(false);
163
- }
164
- changeMonth(flag) {
165
- if (flag) {
166
- const prevDate = this.monthAndYearLabel.clone().subtract(1, 'month');
167
- this.getDaysFromDate(prevDate.format('MM'), prevDate.format('YYYY'));
288
+ /**
289
+ * Clear the current single date selection
290
+ */
291
+ clearDate() {
292
+ if (this.mode() !== 'single')
293
+ return;
294
+ this._selectedDateValue.set('');
295
+ this.emitChanges(null);
296
+ this.closeOverlay();
297
+ }
298
+ /**
299
+ * Set range value programmatically
300
+ */
301
+ async setRangeValue(range) {
302
+ // Store the range in internal state first
303
+ this._selectedRangeValue.set(range);
304
+ // Update the calendar element value immediately to sync with Cally
305
+ await this.updateCalendarElementValue(range);
306
+ // Emit changes to form and outputs
307
+ if (range && DateUtils.isValidRange(range)) {
308
+ const displayRange = this.selectedRange();
309
+ if (displayRange) {
310
+ this.emitChanges(displayRange);
311
+ }
168
312
  }
169
313
  else {
170
- const nextDate = this.monthAndYearLabel.clone().add(1, 'month');
171
- this.getDaysFromDate(nextDate.format('MM'), nextDate.format('YYYY'));
314
+ // Handle clear case - emit null for proper form validation
315
+ this.emitChanges(null);
172
316
  }
317
+ // Close overlay after state is synchronized
318
+ await SyncUtils.nextFrame();
319
+ this.closeOverlay();
173
320
  }
174
- handleSelectDay(day) {
175
- if (day.disabled)
321
+ /**
322
+ * Update calendar element value to ensure Cally.js synchronization
323
+ */
324
+ async updateCalendarElementValue(range) {
325
+ // Wait for calendar element to be available
326
+ const calendarElement = await SyncUtils.waitForElement('calendar-range');
327
+ if (calendarElement) {
328
+ const typedElement = calendarElement;
329
+ const rangeValue = DateUtils.toRangeValue(range);
330
+ // Set the value property directly on the calendar element
331
+ typedElement.value = rangeValue;
332
+ // Also trigger a property update to ensure Cally.js internal state sync
333
+ if (range?.start && range?.end) {
334
+ typedElement.setAttribute('start', range.start);
335
+ typedElement.setAttribute('end', range.end);
336
+ }
337
+ else {
338
+ typedElement.removeAttribute('start');
339
+ typedElement.removeAttribute('end');
340
+ }
341
+ // Dispatch a change event to notify Cally.js of the programmatic update
342
+ typedElement.dispatchEvent(new Event('change', { bubbles: true }));
343
+ }
344
+ }
345
+ // ==================== CALENDAR EVENT HANDLERS ====================
346
+ /**
347
+ * Handle single date calendar change
348
+ */
349
+ async handleSingleCalendarChange(calendarElement) {
350
+ const dateValue = this.extractDateValue(calendarElement);
351
+ if (dateValue && dayjs(dateValue).isValid()) {
352
+ await this.setSingleDateValue(dateValue);
353
+ }
354
+ }
355
+ /**
356
+ * Handle range calendar change
357
+ */
358
+ async handleRangeCalendarChange(calendarElement) {
359
+ const rangeValue = this.extractRangeValue(calendarElement);
360
+ if (rangeValue && DateUtils.isValidRange(rangeValue)) {
361
+ // Update internal state immediately
362
+ this._selectedRangeValue.set(rangeValue);
363
+ // Only emit and close when a complete range is selected (different start and end)
364
+ if (rangeValue.start !== rangeValue.end) {
365
+ const displayRange = this.selectedRange();
366
+ if (displayRange) {
367
+ this.emitChanges(displayRange);
368
+ // Wait for proper synchronization before closing
369
+ await SyncUtils.nextFrame();
370
+ this.closeOverlay();
371
+ }
372
+ }
373
+ }
374
+ }
375
+ /**
376
+ * Extract date value from calendar element
377
+ */
378
+ extractDateValue(element) {
379
+ const elementWithValue = element;
380
+ return elementWithValue.value || element.getAttribute('value') || elementWithValue._value || elementWithValue.__value || '';
381
+ }
382
+ /**
383
+ * Extract range value from calendar element
384
+ */
385
+ extractRangeValue(element) {
386
+ const elementWithValue = element;
387
+ // Handle string format (ISO/ISO)
388
+ if (typeof elementWithValue.value === 'string') {
389
+ return DateUtils.parseRangeValue(elementWithValue.value);
390
+ }
391
+ // Handle object format
392
+ if (elementWithValue.value && typeof elementWithValue.value === 'object') {
393
+ return elementWithValue.value;
394
+ }
395
+ // Handle attributes
396
+ const start = element.getAttribute('start');
397
+ const end = element.getAttribute('end');
398
+ if (start && end) {
399
+ return { start, end };
400
+ }
401
+ return null;
402
+ }
403
+ // ==================== CONTROL VALUE ACCESSOR ====================
404
+ /**
405
+ * Write external model value into the component
406
+ */
407
+ writeValue(obj) {
408
+ // Prevent writeValue during internal updates to avoid circular updates
409
+ if (this.isUpdatingRange)
176
410
  return;
177
- const monthYear = this.monthAndYearLabel.format('YYYY-MM');
178
- const parsedDay = `${monthYear}-${day.value}`;
179
- const date = dayjs(parsedDay).locale(this.language()).format(this.format());
180
- this.current.set(date);
181
- this.dateUpdated.emit(date);
182
- this.onControlChange(date);
183
- if (!this.range()) {
184
- this.toggleDatepicker();
411
+ if (this.mode() === 'range') {
412
+ const rangeObj = obj;
413
+ if (rangeObj?.start && rangeObj?.end) {
414
+ // Convert display format to ISO if needed
415
+ const isoRange = {
416
+ start: DateUtils.toISODate(rangeObj.start, this.format()),
417
+ end: DateUtils.toISODate(rangeObj.end, this.format()),
418
+ };
419
+ this._selectedRangeValue.set(isoRange);
420
+ // Update calendar element to sync with Cally.js
421
+ this.updateCalendarElementValue(isoRange);
422
+ }
423
+ else {
424
+ this._selectedRangeValue.set(null);
425
+ // Update calendar element to sync with Cally.js
426
+ this.updateCalendarElementValue(null);
427
+ }
185
428
  }
429
+ else {
430
+ const dateStr = obj;
431
+ if (dateStr) {
432
+ const isoDate = DateUtils.toISODate(dateStr, this.format());
433
+ this._selectedDateValue.set(isoDate);
434
+ }
435
+ else {
436
+ this._selectedDateValue.set('');
437
+ }
438
+ }
439
+ }
440
+ /**
441
+ * Register form change callback
442
+ */
443
+ registerOnChange(fn) {
444
+ this.onControlChange = fn;
445
+ }
446
+ /**
447
+ * Register form touched callback
448
+ */
449
+ registerOnTouched(fn) {
450
+ this.onControlTouch = fn;
451
+ }
452
+ /**
453
+ * Update disabled state from Angular forms
454
+ */
455
+ setDisabledState(isDisabled) {
456
+ this._disabled.set(isDisabled);
186
457
  }
458
+ // ==================== TEMPLATE ACCESS ====================
459
+ /** Icons for navigation buttons */
460
+ iconChevronLeft = matChevronLeft;
461
+ iconChevronRight = matChevronRight;
187
462
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
188
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DatepickerComponent, isStandalone: true, selector: "st-datepicker", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, disableUntil: { classPropertyName: "disableUntil", publicName: "disableUntil", isSignal: true, isRequired: false, transformFunction: null }, disableFrom: { classPropertyName: "disableFrom", publicName: "disableFrom", isSignal: true, isRequired: false, transformFunction: null }, current: { classPropertyName: "current", publicName: "current", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { current: "currentChange", dateUpdated: "dateUpdated", disabled: "disabledChange" }, providers: [
463
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DatepickerComponent, isStandalone: true, selector: "st-datepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rangeValue: { classPropertyName: "rangeValue", publicName: "rangeValue", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, rangeCalendars: { classPropertyName: "rangeCalendars", publicName: "rangeCalendars", isSignal: true, isRequired: false, transformFunction: null }, showQuickActions: { classPropertyName: "showQuickActions", publicName: "showQuickActions", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateUpdated: "dateUpdated", rangeUpdated: "rangeUpdated", valueChanged: "valueChanged", rangeValueChanged: "rangeValueChanged" }, providers: [
189
464
  {
190
465
  provide: NG_VALUE_ACCESSOR,
191
- useExisting: DatepickerComponent,
466
+ useExisting: forwardRef(() => DatepickerComponent),
192
467
  multi: true,
193
468
  },
194
- ], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<st-input (click)=\"toggleDatepicker()\" [(value)]=\"current\" [readonly]=\"true\" [label]=\"label()\" />\n<div class=\"datepicker-container\">\n\t<div [class]=\"isOpen ? 'calendar-wrapper active' : 'calendar-wrapper inactive'\">\n\t\t<div class=\"calendar-header\">\n\t\t\t<button (click)=\"changeMonth(true)\" class=\"btn-prev\">\n\t\t\t\t<!-- <img src=\"assets/icons/calendar/left.svg\" /> -->\n\t\t\t\t<st-icon class=\"text-secondary-content\" [icon]=\"iconArrowLeft\" color=\"inherit\">></st-icon>\n\t\t\t</button>\n\t\t\t<h1>{{ monthAndYearLabel | datepickerFormatMonth: language() }}</h1>\n\t\t\t<button (click)=\"changeMonth(false)\" class=\"btn-next\">\n\t\t\t\t<!-- <img src=\"assets/icons/calendar/right.svg\" /> -->\n\t\t\t\t<st-icon class=\"text-secondary-content\" [icon]=\"iconArrowRight\" color=\"inherit\"></st-icon>\n\t\t\t</button>\n\t\t</div>\n\t\t<ol class=\"days\">\n\t\t\t@for (day of weekFromLanguage(); track day) {\n\t\t\t\t<li class=\"day-name\">{{ day | slice: 0 : 1 }}</li>\n\t\t\t}\n\n\t\t\t@for (day of daysOfMonth; track day.value) {\n\t\t\t\t<li\n\t\t\t\t\tclass=\"day\"\n\t\t\t\t\t(click)=\"handleSelectDay(day)\"\n\t\t\t\t\t[ngClass]=\"{ active: day.date === current(), disabled: day.disabled }\"\n\t\t\t\t\t[style.gridColumnStart]=\"$first ? day.indexWeek : 'auto'\"\n\t\t\t\t>\n\t\t\t\t\t<span>{{ day.value }}</span>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ol>\n\t</div>\n</div>\n", styles: [".datepicker-container{position:relative}.calendar-wrapper{padding:20px;border:solid 1px #eaeaea;background:#fff;box-shadow:0 4px 15px #0000001a;border-radius:15px;position:absolute;top:5px;left:0;z-index:9999;max-width:280px}.calendar-wrapper.active{display:block}.calendar-wrapper.inactive{display:none}.calendar-header{display:flex;width:100%;justify-content:space-between;align-items:center;align-content:center;padding:10px 0 0;margin-bottom:10px}.calendar-header h1{width:100%;font-style:normal;font-weight:500;font-size:15px;line-height:18px;color:#777675;text-align:center;font-family:Roboto,sans-serif}.calendar-header button{cursor:pointer;background-color:transparent;border:0;width:40px;display:flex;justify-content:center;align-items:center}.days{list-style:none;display:grid;grid-template-columns:repeat(7,34px);margin:0;padding:0;gap:0}.days .day-name{font-weight:700;margin-bottom:2px;padding:4px;text-align:center;font-style:normal;font-size:15px;color:#4dd6ed;margin-top:10px}.days .day{display:flex;justify-content:center;align-items:center;width:100%;height:34px;padding:.25rem;font-size:15px;cursor:pointer;color:#636363}.days .day:hover{font-weight:600;background:#4dd6ed;border-radius:50%;color:#fff}.days .day.disabled{color:#ccc}.days .day.active{font-weight:600;background:#4dd6ed;border-radius:50%;color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i1.SlicePipe, name: "slice" }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: InputComponent, selector: "st-input", inputs: ["variant", "size", "label", "type", "name", "placeholder", "readonly", "focus", "justNumbers", "ghost", "value", "parentForm", "formControlName", "disabled", "debounceTime"], outputs: ["valueChange", "disabledChange", "enterPressed", "blurred", "valueDebounced"] }, { kind: "pipe", type: DatepickerFormatMonthPipe, name: "datepickerFormatMonth" }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }] });
469
+ ], viewQueries: [{ propertyName: "datePickerOverlay", first: true, predicate: ["datePickerOverlay"], descendants: true, isSignal: true }], exportAs: ["stDatepicker"], ngImport: i0, template: "<fieldset class=\"fieldset p-0\">\n\t@if (label()) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label() }}</legend>\n\t}\n\n\t<!-- Calendar overlay -->\n\t<st-overlay #datePickerOverlay=\"stOverlay\">\n\t\t<st-overlay-trigger>\n\t\t\t<!-- Projected trigger content (input, button, etc.) -->\n\t\t\t<ng-content></ng-content>\n\t\t</st-overlay-trigger>\n\t\t<st-overlay-content>\n\t\t\t<div class=\"bg-base-200 border-neutral rounded-box shadow-main border p-4\">\n\t\t\t\t@if (mode() === 'range') {\n\t\t\t\t\t<div class=\"flex gap-4\">\n\t\t\t\t\t\t@if (showQuickActions()) {\n\t\t\t\t\t\t\t<!-- Quick Options Sidebar -->\n\t\t\t\t\t\t\t<div class=\"flex flex-col gap-2\">\n\t\t\t\t\t\t\t\t<h4 class=\"mb-2 text-sm font-medium\">{{ 'sdk.datePicker.quickActions.title' | translate }}</h4>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last30Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last6Months')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('lastYear')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"clearRange()\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.clear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"divider divider-horizontal m-0 w-0\"></div>\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<!-- Calendar -->\n\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<div class=\"flex flex-wrap justify-center gap-6\">\n\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"1\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<!-- Single Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t} @else {\n\t\t\t\t\t<calendar-date\n\t\t\t\t\t\t#singleCalendar\n\t\t\t\t\t\t[value]=\"selectedDateValue() || ''\"\n\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t(change)=\"onCalendarChange(singleCalendar)\"\n\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t<st-button variant=\"base\" [square]=\"true\" [icon]=\"iconChevronRight\" size=\"xs\" [ghost]=\"true\" aria-label=\"Next\" slot=\"next\"></st-button>\n\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t</calendar-date>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</st-overlay-content>\n\t</st-overlay>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label() }}</label>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: OverlayComponent, selector: "st-overlay", inputs: ["offsetX", "offsetY", "originX", "originY", "overlayX", "overlayY", "fallbacks", "syncWidth"], outputs: ["opened", "closed"], exportAs: ["stOverlay"] }, { kind: "component", type: OverlayTriggerComponent, selector: "st-overlay-trigger" }, { kind: "component", type: OverlayContentComponent, selector: "st-overlay-content" }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
195
470
  }
196
471
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DatepickerComponent, decorators: [{
197
472
  type: Component,
198
- args: [{ selector: 'st-datepicker', imports: [CommonModule, FormsModule, InputComponent, DatepickerFormatMonthPipe, IconComponent], providers: [
473
+ args: [{ selector: 'st-datepicker', imports: [CommonModule, OverlayComponent, OverlayTriggerComponent, OverlayContentComponent, ButtonComponent, TranslatePipe], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'stDatepicker', providers: [
199
474
  {
200
475
  provide: NG_VALUE_ACCESSOR,
201
- useExisting: DatepickerComponent,
476
+ useExisting: forwardRef(() => DatepickerComponent),
202
477
  multi: true,
203
478
  },
204
- ], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<st-input (click)=\"toggleDatepicker()\" [(value)]=\"current\" [readonly]=\"true\" [label]=\"label()\" />\n<div class=\"datepicker-container\">\n\t<div [class]=\"isOpen ? 'calendar-wrapper active' : 'calendar-wrapper inactive'\">\n\t\t<div class=\"calendar-header\">\n\t\t\t<button (click)=\"changeMonth(true)\" class=\"btn-prev\">\n\t\t\t\t<!-- <img src=\"assets/icons/calendar/left.svg\" /> -->\n\t\t\t\t<st-icon class=\"text-secondary-content\" [icon]=\"iconArrowLeft\" color=\"inherit\">></st-icon>\n\t\t\t</button>\n\t\t\t<h1>{{ monthAndYearLabel | datepickerFormatMonth: language() }}</h1>\n\t\t\t<button (click)=\"changeMonth(false)\" class=\"btn-next\">\n\t\t\t\t<!-- <img src=\"assets/icons/calendar/right.svg\" /> -->\n\t\t\t\t<st-icon class=\"text-secondary-content\" [icon]=\"iconArrowRight\" color=\"inherit\"></st-icon>\n\t\t\t</button>\n\t\t</div>\n\t\t<ol class=\"days\">\n\t\t\t@for (day of weekFromLanguage(); track day) {\n\t\t\t\t<li class=\"day-name\">{{ day | slice: 0 : 1 }}</li>\n\t\t\t}\n\n\t\t\t@for (day of daysOfMonth; track day.value) {\n\t\t\t\t<li\n\t\t\t\t\tclass=\"day\"\n\t\t\t\t\t(click)=\"handleSelectDay(day)\"\n\t\t\t\t\t[ngClass]=\"{ active: day.date === current(), disabled: day.disabled }\"\n\t\t\t\t\t[style.gridColumnStart]=\"$first ? day.indexWeek : 'auto'\"\n\t\t\t\t>\n\t\t\t\t\t<span>{{ day.value }}</span>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ol>\n\t</div>\n</div>\n", styles: [".datepicker-container{position:relative}.calendar-wrapper{padding:20px;border:solid 1px #eaeaea;background:#fff;box-shadow:0 4px 15px #0000001a;border-radius:15px;position:absolute;top:5px;left:0;z-index:9999;max-width:280px}.calendar-wrapper.active{display:block}.calendar-wrapper.inactive{display:none}.calendar-header{display:flex;width:100%;justify-content:space-between;align-items:center;align-content:center;padding:10px 0 0;margin-bottom:10px}.calendar-header h1{width:100%;font-style:normal;font-weight:500;font-size:15px;line-height:18px;color:#777675;text-align:center;font-family:Roboto,sans-serif}.calendar-header button{cursor:pointer;background-color:transparent;border:0;width:40px;display:flex;justify-content:center;align-items:center}.days{list-style:none;display:grid;grid-template-columns:repeat(7,34px);margin:0;padding:0;gap:0}.days .day-name{font-weight:700;margin-bottom:2px;padding:4px;text-align:center;font-style:normal;font-size:15px;color:#4dd6ed;margin-top:10px}.days .day{display:flex;justify-content:center;align-items:center;width:100%;height:34px;padding:.25rem;font-size:15px;cursor:pointer;color:#636363}.days .day:hover{font-weight:600;background:#4dd6ed;border-radius:50%;color:#fff}.days .day.disabled{color:#ccc}.days .day.active{font-weight:600;background:#4dd6ed;border-radius:50%;color:#fff}\n"] }]
479
+ ], template: "<fieldset class=\"fieldset p-0\">\n\t@if (label()) {\n\t\t<legend class=\"fieldset-legend font-body pt-0 text-pretty\">{{ label() }}</legend>\n\t}\n\n\t<!-- Calendar overlay -->\n\t<st-overlay #datePickerOverlay=\"stOverlay\">\n\t\t<st-overlay-trigger>\n\t\t\t<!-- Projected trigger content (input, button, etc.) -->\n\t\t\t<ng-content></ng-content>\n\t\t</st-overlay-trigger>\n\t\t<st-overlay-content>\n\t\t\t<div class=\"bg-base-200 border-neutral rounded-box shadow-main border p-4\">\n\t\t\t\t@if (mode() === 'range') {\n\t\t\t\t\t<div class=\"flex gap-4\">\n\t\t\t\t\t\t@if (showQuickActions()) {\n\t\t\t\t\t\t\t<!-- Quick Options Sidebar -->\n\t\t\t\t\t\t\t<div class=\"flex flex-col gap-2\">\n\t\t\t\t\t\t\t\t<h4 class=\"mb-2 text-sm font-medium\">{{ 'sdk.datePicker.quickActions.title' | translate }}</h4>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last7Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last7Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last30Days')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last30Days' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('last6Months')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.last6Months' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"selectQuickRange('lastYear')\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.lastYear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<div class=\"divider my-2\"></div>\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-ghost justify-start text-left\" (click)=\"clearRange()\">\n\t\t\t\t\t\t\t\t\t{{ 'sdk.datePicker.quickActions.clear' | translate }}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div class=\"divider divider-horizontal m-0 w-0\"></div>\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<!-- Calendar -->\n\t\t\t\t\t\t<div class=\"flex-1\">\n\t\t\t\t\t\t\t@if (rangeCalendars() === 2) {\n\t\t\t\t\t\t\t\t<!-- Two Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"2\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<div class=\"flex flex-wrap justify-center gap-6\">\n\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"0\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t\t<calendar-month offset=\"1\" [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<!-- Single Calendar View -->\n\t\t\t\t\t\t\t\t<calendar-range\n\t\t\t\t\t\t\t\t\t#rangeCalendar\n\t\t\t\t\t\t\t\t\tmonths=\"1\"\n\t\t\t\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t\t\t\t[value]=\"rangeCalendarValue() || ''\"\n\t\t\t\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t\t\t\t(change)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\t(rangeend)=\"onCalendarChange(rangeCalendar)\"\n\t\t\t\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\t\t[icon]=\"iconChevronRight\"\n\t\t\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t\t\taria-label=\"Next\"\n\t\t\t\t\t\t\t\t\t\tslot=\"next\"\n\t\t\t\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t\t\t\t</calendar-range>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t} @else {\n\t\t\t\t\t<calendar-date\n\t\t\t\t\t\t#singleCalendar\n\t\t\t\t\t\t[value]=\"selectedDateValue() || ''\"\n\t\t\t\t\t\t[locale]=\"calendarLocale()\"\n\t\t\t\t\t\t[min]=\"effectiveMinDate()\"\n\t\t\t\t\t\t[max]=\"effectiveMaxDate()\"\n\t\t\t\t\t\t(change)=\"onCalendarChange(singleCalendar)\"\n\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\tvariant=\"base\"\n\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t[icon]=\"iconChevronLeft\"\n\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\taria-label=\"Previous\"\n\t\t\t\t\t\t\tslot=\"previous\"\n\t\t\t\t\t\t></st-button>\n\t\t\t\t\t\t<st-button variant=\"base\" [square]=\"true\" [icon]=\"iconChevronRight\" size=\"xs\" [ghost]=\"true\" aria-label=\"Next\" slot=\"next\"></st-button>\n\t\t\t\t\t\t<calendar-month [min]=\"effectiveMinDate()\" [max]=\"effectiveMaxDate()\"></calendar-month>\n\t\t\t\t\t</calendar-date>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</st-overlay-content>\n\t</st-overlay>\n\n\t<!-- Hidden label for accessibility -->\n\t<label class=\"sr-only\" [for]=\"name()\">{{ label() }}</label>\n</fieldset>\n" }]
205
480
  }], ctorParameters: () => [] });
206
481
 
207
482
  /**
208
483
  * Generated bundle index. Do not edit.
209
484
  */
210
485
 
211
- export { DatepickerComponent, DatepickerFormatMonthPipe };
486
+ export { DatepickerComponent, SUPPORTED_LOCALES };
212
487
  //# sourceMappingURL=sixbell-telco-sdk-components-forms-datepicker.mjs.map