@aquera/nile-elements 1.2.1-beta-1.5 → 1.2.1-beta-1.7

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 (43) hide show
  1. package/demo/index.html +83 -100
  2. package/demo/variables.css +2 -3
  3. package/dist/index.js +369 -657
  4. package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
  5. package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
  6. package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
  7. package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
  8. package/dist/nile-calendar/nile-calendar.css.esm.js +38 -221
  9. package/dist/nile-calendar/nile-calendar.esm.js +98 -204
  10. package/dist/nile-select/nile-select.cjs.js +1 -1
  11. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  12. package/dist/nile-select/nile-select.esm.js +4 -4
  13. package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
  14. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  15. package/dist/nile-select/virtual-scroll-helper.esm.js +1 -0
  16. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  17. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  18. package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
  19. package/dist/src/nile-calendar/nile-calendar.css.js +36 -219
  20. package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  21. package/dist/src/nile-calendar/nile-calendar.d.ts +0 -15
  22. package/dist/src/nile-calendar/nile-calendar.js +93 -318
  23. package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  24. package/dist/src/nile-rich-text-editor/utils.d.ts +0 -13
  25. package/dist/src/nile-rich-text-editor/utils.js +1 -537
  26. package/dist/src/nile-rich-text-editor/utils.js.map +1 -1
  27. package/dist/src/nile-select/nile-select.d.ts +1 -0
  28. package/dist/src/nile-select/nile-select.js +30 -9
  29. package/dist/src/nile-select/nile-select.js.map +1 -1
  30. package/dist/src/nile-select/virtual-scroll-helper.js +1 -0
  31. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  32. package/dist/src/nile-virtual-select/nile-virtual-select.js +1 -0
  33. package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
  34. package/dist/src/version.js +1 -1
  35. package/dist/src/version.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/nile-calendar/nile-calendar.css.ts +36 -219
  39. package/src/nile-calendar/nile-calendar.ts +106 -343
  40. package/src/nile-select/nile-select.ts +25 -15
  41. package/src/nile-select/virtual-scroll-helper.ts +2 -0
  42. package/src/nile-virtual-select/nile-virtual-select.ts +1 -0
  43. package/vscode-html-custom-data.json +17 -41
@@ -60,16 +60,6 @@ export class NileCalendar extends NileElement {
60
60
 
61
61
  @property({ type: Boolean}) showManualInputs :boolean=false;
62
62
 
63
- @property({ type: Number , attribute: true, reflect: true }) startYear?: number;
64
-
65
- @property({ type: Number , attribute: true, reflect: true }) endYear?: number;
66
-
67
- @property({ type: Boolean, attribute:true, reflect: true}) showMonthDropdown = false;
68
- @property({ type: Boolean, attribute:true, reflect: true}) showYearDropdown = false;
69
-
70
- @property({ type: String, reflect: true, attribute: true}) dateFormat: string = 'MM/DD/YYYY';
71
-
72
-
73
63
  @state() startDate: Date | null = null;
74
64
 
75
65
  @state() endDate: Date | null = null;
@@ -117,34 +107,6 @@ export class NileCalendar extends NileElement {
117
107
  }
118
108
  }
119
109
 
120
- private get monthNames() {
121
- return Array.from({ length: 12 }, (_, i) =>
122
- new Date(0, i).toLocaleString('default', { month: 'long' })
123
- );
124
- }
125
-
126
- private get yearOptions(): number[] {
127
- const fallbackStart = 2000;
128
- const fallbackEnd = 2050;
129
-
130
- const start = this.startYear ?? fallbackStart;
131
- const end = this.endYear ?? fallbackEnd;
132
-
133
- if (start > end) return [];
134
-
135
- return Array.from({ length: end - start + 1 }, (_, i) => start + i);
136
- }
137
-
138
- private onMonthSelected(monthIndex: number) {
139
- this.currentMonth = monthIndex;
140
- this.emit('nile-month-change', { month: monthIndex });
141
- }
142
-
143
- private onYearSelected(year: number) {
144
- this.currentYear = year;
145
- this.emit('nile-year-change', { year });
146
- }
147
-
148
110
  @watch('allowedDates')
149
111
  checkValidAllowedDate() {
150
112
  let newDateRange: NileCalendarDateRange | null;
@@ -169,84 +131,6 @@ export class NileCalendar extends NileElement {
169
131
  this.allowedDatesLocal=newDateRange;
170
132
  }
171
133
  }
172
-
173
- private isPrevDisabled(): boolean {
174
- return (
175
- this.currentMonth === 0 &&
176
- this.startYear !== undefined &&
177
- this.currentYear <= this.startYear
178
- );
179
- }
180
-
181
- private isNextDisabled(): boolean {
182
- return (
183
- this.currentMonth === 11 &&
184
- this.endYear !== undefined &&
185
- this.currentYear >= this.endYear
186
- );
187
- }
188
-
189
- private formatDate(date: Date | null): string {
190
- if (!date) return '';
191
-
192
- const yyyy = date.getFullYear();
193
- const mm = String(date.getMonth() + 1).padStart(2, '0');
194
- const dd = String(date.getDate()).padStart(2, '0');
195
-
196
- let formatted = this.dateFormat;
197
- formatted = formatted.replace(/YYYY/g, String(yyyy));
198
- formatted = formatted.replace(/MM/g, mm);
199
- formatted = formatted.replace(/DD/g, dd);
200
- formatted = formatted.replace(/YY/g, String(yyyy).slice(-2));
201
-
202
- return formatted;
203
- }
204
-
205
-
206
- private parseDate(input: string, existingDate?: Date | null): Date | null {
207
- if (!input || !this.dateFormat) return null;
208
- const formatPattern = this.dateFormat
209
- .replace(/YYYY/, '(?<year>\\d{4})')
210
- .replace(/YY/, '(?<year>\\d{2})')
211
- .replace(/MM/, '(?<month>\\d{1,2})')
212
- .replace(/DD/, '(?<day>\\d{1,2})');
213
-
214
- const regex = new RegExp(`^${formatPattern}$`);
215
- const match = input.match(regex);
216
- if (!match || !match.groups) return null;
217
-
218
- const year = match.groups.year.length === 2 ? Number(`20${match.groups.year}`) : Number(match.groups.year);
219
- const month = Number(match.groups.month) - 1;
220
- const day = Number(match.groups.day);
221
-
222
- const date = new Date(existingDate || new Date());
223
- date.setFullYear(year, month, day);
224
- return isNaN(date.getTime()) ? null : date;
225
- }
226
-
227
-
228
- private handleStartDateInput(event: CustomEvent): void {
229
- event.stopPropagation();
230
- const newDate = this.parseDate(event.detail.value, this.startDate);
231
- if (newDate) {
232
- this.startDate = newDate;
233
- this.currentMonth = newDate.getMonth();
234
- this.currentYear = newDate.getFullYear();
235
- this.requestUpdate();
236
- }
237
- }
238
-
239
- private handleEndDateInput(event: CustomEvent): void {
240
- event.stopPropagation();
241
- const newDate = this.parseDate(event.detail.value, this.endDate);
242
- if (newDate) {
243
- this.endDate = newDate;
244
- this.currentMonth = newDate.getMonth();
245
- this.currentYear = newDate.getFullYear();
246
- this.requestUpdate();
247
- }
248
- }
249
-
250
134
 
251
135
 
252
136
  /**
@@ -259,16 +143,15 @@ private handleEndDateInput(event: CustomEvent): void {
259
143
  base:true,
260
144
  base__range:this.range,
261
145
  })}
262
- part="calendar-container"
263
146
  >
264
147
  <div class=${classMap({
265
148
  "calendar-config":true,
266
149
  "hidden": !this.range || (this.range && this.hideTypes)
267
150
  })}>
268
- <div class="calendar-switcher" part="calendar-switcher">
151
+ <div class="calendar-switcher">
269
152
  <nile-tab-group centered @nile-tab-show="${this.onTypeChange}" value="${this.type}">
270
- <nile-tab slot="nav" panel="absolute" tabindex="0">Absolute</nile-tab>
271
- <nile-tab slot="nav" panel="relative" tabindex="0">Relative</nile-tab>
153
+ <nile-tab slot="nav" panel="absolute">Absolute</nile-tab>
154
+ <nile-tab slot="nav" panel="relative">Relative</nile-tab>
272
155
  </nile-tab-group>
273
156
  </div>
274
157
  </div>
@@ -277,24 +160,20 @@ private handleEndDateInput(event: CustomEvent): void {
277
160
  ${this.type == 'absolute' ? this.renderAbsoluteCalendar():''}
278
161
 
279
162
  ${!this.range?'':html`
280
- <div class="button-container" part="button-container">
163
+ <div class="button-container">
281
164
  ${this.allowClear?
282
165
  html`
283
166
  <nile-button
284
167
  class="clear-button"
285
168
  variant="secondary"
286
- role="button"
287
169
  ?disabled="${ !this.startDate || !this.endDate }"
288
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.clearDate();}}"
289
170
  @click="${this.clearDate}"
290
-
291
- > Reset</nile-button>`:nothing
171
+ > Clear</nile-button>`:nothing
292
172
  }
293
173
  <nile-button
294
174
  class="apply-button"
295
175
  ?disabled="${ !this.startDate || !this.endDate }"
296
176
  @click="${this.confimRange}"
297
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.confimRange();}}"
298
177
  > Apply</nile-button>
299
178
  </div>
300
179
  `}
@@ -307,8 +186,8 @@ private handleEndDateInput(event: CustomEvent): void {
307
186
  */
308
187
  renderAbsoluteCalendar(){
309
188
  return html`
310
- <div class="calendar-wrapper" part="calendar-wrapper">
311
- <div class="calendar-container" >
189
+ <div class="calendar-wrapper">
190
+ <div class="calendar-container">
312
191
  ${this.renderMonth(
313
192
  this.currentYear,
314
193
  this.currentMonth,
@@ -319,38 +198,22 @@ private handleEndDateInput(event: CustomEvent): void {
319
198
  ${this.range ? html`
320
199
  <div class="calender-input ${this.showManualInputs ? '' : 'hidden'}" >
321
200
  <div class="from">
322
- <nile-input
323
- label="From"
324
- class="manual-input date-input"
325
- placeholder="${this.dateFormat}"
326
- value="${this.formatDate(this.startDate)}"
327
- @nile-change="${this.handleStartDateInput}"
328
- ></nile-input>
329
-
330
- <nile-input
331
- class="manual-input time-input"
332
- placeholder="HH:MM:SS"
333
- value="${this.formatTime(this.startDate)}"
334
- @nile-change="${this.handleStartTimeInput}"
335
- ></nile-input>
336
- </div>
201
+ <nile-input
202
+ label="From"
203
+ class="manual-input"
204
+ value="${this.formatTime(this.startDate)}"
205
+ placeholder="HH:MM:SS" @nile-change="${this.handleStartTimeInput}"
206
+ > </nile-input>
207
+ </div>
337
208
 
338
- <div class="from">
339
- <nile-input
340
- label="To"
341
- class="manual-input date-input"
342
- placeholder="${this.dateFormat}"
343
- value="${this.formatDate(this.endDate)}"
344
- @nile-change="${this.handleEndDateInput}"
345
- ></nile-input>
346
-
347
- <nile-input
348
- class="manual-input time-input"
349
- placeholder="HH:MM:SS"
350
- value="${this.formatTime(this.endDate)}"
351
- @nile-change="${this.handleEndTimeInput}"
352
- ></nile-input>
353
- </div>
209
+ <div class="from">
210
+ <nile-input
211
+ label="To"
212
+ class="manual-input"
213
+ value="${this.formatTime(this.endDate)}"
214
+ placeholder="HH:MM:SS" @nile-change="${this.handleEndTimeInput}"
215
+ > </nile-input>
216
+ </div>
354
217
  </div>
355
218
  `:''}
356
219
  `
@@ -359,90 +222,77 @@ private handleEndDateInput(event: CustomEvent): void {
359
222
  /**
360
223
  * @returns HTML content for relative calendar
361
224
  */
362
- renderRelativeCalendar() {
225
+ renderRelativeCalendar(){
363
226
  return html`
364
- <div class="units-wrapper">
365
- <div class="unit-container">
366
-
367
- ${this.hideDurationFields?.includes('minutes') ? '' : html`
368
- <div class="unit-group">
369
- <div class="duration-name">Minutes</div>
370
- <div class="duration-units">
371
- ${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
372
- </div>
373
- </div>
374
- `}
375
-
376
- ${this.hideDurationFields?.includes('hours') ? '' : html`
377
- <div class="unit-group">
378
- <div class="duration-name">Hours</div>
379
- <div class="duration-units">
380
- ${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
381
- </div>
382
- </div>
383
- `}
384
-
385
- ${this.hideDurationFields?.includes('days') ? '' : html`
386
- <div class="unit-group">
387
- <div class="duration-name">Days</div>
388
- <div class="duration-units">
389
- ${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
390
- </div>
391
- </div>
392
- `}
393
-
394
- ${this.hideDurationFields?.includes('weeks') ? '' : html`
395
- <div class="unit-group">
396
- <div class="duration-name">Weeks</div>
397
- <div class="duration-units">
398
- ${this.renderTimeValues('weeks', [1, 2, 4, 6])}
399
- </div>
400
- </div>
401
- `}
402
-
403
- ${this.hideDurationFields?.includes('months') ? '' : html`
404
- <div class="unit-group">
405
- <div class="duration-name">Months</div>
406
- <div class="duration-units">
407
- ${this.renderTimeValues('months', [3, 6, 12, 15])}
408
- </div>
409
- </div>
410
- `}
227
+ <div class="units-wrapper">
228
+ <div class="unit-container">
229
+ ${this.hideDurationFields?.includes('minutes')?'':html`
230
+ <div class="duration-name">Minutes</div>
231
+ <div class="duration-units">
232
+ ${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
411
233
  </div>
412
- </div>
413
-
414
- ${this.range ? html`
415
- <div>
416
- <div class="unit-input-container">
417
- <nile-input
418
- class="manual-input duration-input"
419
- label="Duration"
420
- inputmode="numeric"
421
- type="number"
422
- value="${this.selectedValue}"
423
- @nile-change="${this.handleDurationChange}"
424
- placeholder="Enter Value"
425
- ></nile-input>
426
-
427
- <nile-select
428
- class="manual-input time-input"
429
- label="Unit of time"
430
- value="${this.selectedUnit}"
431
- @nile-change="${this.handleUnitChange}"
432
- >
433
- <nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}">Minutes</nile-option>
434
- <nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}">Hours</nile-option>
435
- <nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}">Days</nile-option>
436
- <nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}">Weeks</nile-option>
437
- <nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}">Months</nile-option>
438
- </nile-select>
234
+ `}
235
+
236
+ ${this.hideDurationFields?.includes('hours')?'':html`
237
+ <div class="duration-name">Hours</div>
238
+ <div class="duration-units">
239
+ ${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
240
+ </div>
241
+ `}
242
+
243
+ ${this.hideDurationFields?.includes('days')?'':html`
244
+ <div class="duration-name">Days</div>
245
+ <div class="duration-units">
246
+ ${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
247
+ </div>
248
+ `}
249
+
250
+ ${this.hideDurationFields?.includes('weeks')?'':html`
251
+ <div class="duration-name">Weeks</div>
252
+ <div class="duration-units">
253
+ ${this.renderTimeValues('weeks', [1, 2, 4, 6])}
254
+ </div>
255
+ `}
256
+
257
+ ${this.hideDurationFields?.includes('months')?'':html`
258
+ <div class="duration-name">Months</div>
259
+ <div class="duration-units">
260
+ ${this.renderTimeValues('months', [3, 6, 12, 15])}
439
261
  </div>
262
+ `}
440
263
  </div>
441
- ` : ''}
442
- `;
264
+ </div>
265
+
266
+ ${this.range ? html`
267
+ <div>
268
+ <div class="unit-input-container">
269
+ <nile-input
270
+ class="manual-input duration-input"
271
+ label="Duration"
272
+ inputmode="numeric"
273
+ type="number"
274
+ value="${this.selectedValue}"
275
+ @nile-change="${this.handleDurationChange}"
276
+ placeholder="Enter Value"
277
+ ></nile-input>
278
+
279
+ <nile-select class="manual-input time-input"
280
+ label="Unit of time"
281
+ value="${ this.selectedUnit }"
282
+ @nile-change="${this.handleUnitChange}"
283
+ >
284
+ <nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes')?'hidden':''}">Minutes</nile-option>
285
+ <nile-option value="hours" class="${this.hideDurationFields?.includes('hours')?'hidden':''}"> Hours </nile-option>
286
+ <nile-option value="days" class="${this.hideDurationFields?.includes('days')?'hidden':''}">Days</nile-option>
287
+ <nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks')?'hidden':''}">Weeks</nile-option>
288
+ <nile-option value="months" class="${this.hideDurationFields?.includes('months')?'hidden':''}"> Months </nile-option>
289
+ </nile-select>
290
+ </div>
291
+ </div>
292
+ `:''}
293
+ `
443
294
  }
444
295
 
445
-
446
296
  /**
447
297
  *
448
298
  * @param unit
@@ -456,7 +306,6 @@ private handleEndDateInput(event: CustomEvent): void {
456
306
  <div
457
307
  class="duration__value ${this.selectedUnit === unit && this.selectedValue === value ? 'duration__value--selected':''}"
458
308
  @click=${(e: any) => this.handleTimeValueClick(unit, value, e)}
459
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.handleTimeValueClick(unit, value, e);}}"
460
309
  >${value}
461
310
  </div>`
462
311
  );
@@ -551,91 +400,20 @@ private handleEndDateInput(event: CustomEvent): void {
551
400
  name="var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))"
552
401
  method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
553
402
  color="black"
554
- role="button"
555
- tabindex="${this.isPrevDisabled() ? '-1' : '0'}"
556
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.prevMonth();}}"
557
403
  @click="${this.prevMonth}"
558
404
  >
559
405
  </nile-icon>
560
- <div class="calendar-header__center">
561
-
562
- ${this.showMonthDropdown || this.showYearDropdown ? html`
563
- ${this.showMonthDropdown ? html`
564
- <nile-dropdown class="month-dropdown">
565
- <span
566
- slot="trigger"
567
- class="calendar-header__trigger month-trigger"
568
- role="button"
569
- >
570
- ${new Date(year, month).toLocaleString('default', { month: 'long' })}
571
- <nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
572
- </span>
573
- <nile-menu>
574
- <div class="month-scroll-wrapper">
575
- ${this.monthNames.map((m, idx) => html`
576
- <nile-menu-item
577
- class="month-menu-item"
578
- ?selected="${idx === month}"
579
- @click="${() => this.onMonthSelected(idx)}"
580
- >
581
- ${m}
582
- </nile-menu-item>
583
- `)}
584
- </div>
585
- </nile-menu>
586
- </nile-dropdown>
587
- ` : html`
588
- <span
589
- >${new Date(year, month).toLocaleString('default', { month: 'long' })}</span
590
- >
591
- `}
592
- ${this.showYearDropdown ? html`
593
- <nile-dropdown class="year-dropdown">
594
- <span
595
- slot="trigger"
596
- class="calendar-header__trigger"
597
- role="button"
598
- >
599
- ${year}
600
- <nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
601
- </span>
602
- <nile-menu>
603
- <div class="year-scroll-wrapper">
604
- ${this.yearOptions.map(
605
- y => html`
606
- <nile-menu-item
607
- class="year-menu-item"
608
- ?selected="${y === year}"
609
- @click="${() => this.onYearSelected(y)}"
610
- >
611
- ${y}
612
- </nile-menu-item>
613
- `
614
- )}
615
- </div>
616
- </nile-menu>
617
- </nile-dropdown>
618
- ` : html`
619
- <span>${year}</span>
620
- `}
621
- ` : html`
622
- <span
623
- >${new Date(year, month).toLocaleString('default', {
624
- month: 'long',
625
- })}
626
- ${year}</span
627
- >
628
- `}
629
- </div>
630
-
406
+ <span
407
+ >${new Date(year, month).toLocaleString('default', {
408
+ month: 'long',
409
+ })}
410
+ ${year}</span
411
+ >
631
412
  <nile-icon
632
413
  class="calendar-header__month-navigation"
633
414
  name="var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))"
634
415
  method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
635
416
  color="black"
636
- role="button"
637
- tabindex="${this.isNextDisabled() ? '-1' : '0'}"
638
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.nextMonth();}}"
639
417
  @click="${this.nextMonth}"
640
418
  >
641
419
  </nile-icon>
@@ -664,15 +442,12 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
664
442
 
665
443
  return html`
666
444
  <div
667
- part="calendar-day-${day}"
668
445
  class=${classMap(classMapObj)}
669
- tabindex="${isCurrentMonth && this.isAllowedDate(day, month, year) ? '0' : '-1'}"
670
- @keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.selectDate(day, month, year);}}"
671
446
  @click="${() => { if (isCurrentMonth) this.selectDate(day, month, year)}}"
672
447
  >
673
448
  <span style="position:relative;">
674
449
  ${day}
675
- ${isCurrentDate(day, month, year) && isCurrentMonth?html`<div class="current__date__dot" part="current-date-dot"></div>`:nothing}
450
+ ${isCurrentDate(day, month, year) && isCurrentMonth?html`<div class="current__date__dot"></div>`:nothing}
676
451
  </span>
677
452
  </div>`;
678
453
  })}
@@ -700,25 +475,17 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
700
475
  return isWithinRange;
701
476
  }
702
477
 
703
- clearDate() {
704
- if (this.range) {
705
- this.valueAttribute = '';
706
- this.startDate = null;
707
- this.endDate = null;
708
- this.selectedUnit = undefined!;
709
- this.selectedValue = undefined!;
710
- if (this.range && this.type === 'relative') {
711
- this.selectedUnit = undefined!;
712
- this.selectedValue = undefined!;
713
- }
714
- } else {
715
- this.value = null;
478
+ clearDate(){
479
+ if(this.range){
480
+ this.valueAttribute='';
481
+ this.startDate=null;
482
+ this.endDate=null;
716
483
  }
717
-
718
- this.requestUpdate();
719
- this.emit('nile-clear');
484
+ else{
485
+ this.value=null;
486
+ }
487
+ this.emit('nile-clear')
720
488
  }
721
-
722
489
 
723
490
  /**
724
491
  * @function handle_date-click/select
@@ -921,10 +688,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
921
688
 
922
689
  private nextMonth(): void {
923
690
  if (this.currentMonth === 11) {
924
- const newYear = this.currentYear + 1;
925
- if(this.endYear !== undefined && newYear > this.endYear) return;
926
691
  this.currentMonth = 0;
927
- this.currentYear = newYear;
692
+ this.currentYear++;
928
693
  } else {
929
694
  this.currentMonth++;
930
695
  }
@@ -932,10 +697,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
932
697
 
933
698
  private prevMonth(): void {
934
699
  if (this.currentMonth === 0) {
935
- const newYear = this.currentYear - 1;
936
- if(this.startYear !== undefined && newYear < this.startYear) return;
937
700
  this.currentMonth = 11;
938
- this.currentYear = newYear;
701
+ this.currentYear--;
939
702
  } else {
940
703
  this.currentMonth--;
941
704
  }
@@ -964,7 +727,7 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
964
727
  }
965
728
 
966
729
  emitChangedData(data:{startDate:Date,endDate:Date}|{value:any}|null){
967
- this.emit('nile-changed',data); // deprecated. Use nile-change instead
730
+ this.emit('nile-changed',data);
968
731
  this.emit('nile-change',data)
969
732
  }
970
733
 
@@ -420,6 +420,11 @@ export class NileSelect extends NileElement implements NileFormControl{
420
420
  }
421
421
  }
422
422
 
423
+ private handleVirtualSelectOpenChange(e: CustomEvent) {
424
+ this.open = e.detail.open;
425
+ }
426
+
427
+
423
428
  /**
424
429
  * Handles the click event on the footer.
425
430
  * @param event - The click event.
@@ -1055,12 +1060,22 @@ export class NileSelect extends NileElement implements NileFormControl{
1055
1060
 
1056
1061
  @watch('open', { waitUntilFirstUpdate: true })
1057
1062
  async handleOpenChange() {
1063
+ if (this.enableVirtualScroll) {
1064
+ if (this.open && !this.disabled) {
1065
+ this.emit('nile-show', { value: this.value, name: this.name });
1066
+ this.emit('nile-after-show', { value: this.value, name: this.name });
1067
+ if (this.autoFocusSearch) {
1068
+ this.handleInputAfterInit();
1069
+ }
1070
+ } else {
1071
+ this.emit('nile-hide', { value: this.value, name: this.name });
1072
+ this.emit('nile-after-hide', { value: this.value, name: this.name });
1073
+ }
1074
+ return;
1075
+ }
1058
1076
  if (this.open && !this.disabled) {
1059
- // Reset the current option
1060
1077
  this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption());
1061
-
1062
1078
  this.emit('nile-show', { value: this.value, name: this.name });
1063
-
1064
1079
  if(this.enableGroupHeader) {
1065
1080
  this.getAllGroupAttributes().forEach((el: GroupAttributes) => {
1066
1081
  el.element.classList.remove('nile-group-hidden');
@@ -1072,21 +1087,17 @@ export class NileSelect extends NileElement implements NileFormControl{
1072
1087
  this.showNoResults = !this.getAllOptions()?.length;
1073
1088
 
1074
1089
  await stopAnimations(this);
1075
- this.listbox.hidden = false;
1076
- this.popup.active = true;
1077
-
1090
+ if (this.listbox) this.listbox.hidden = false;
1091
+ if (this.popup) this.popup.active = true;
1078
1092
  // Select the appropriate option based on value after the listbox opens
1079
1093
  requestAnimationFrame(() => {
1080
1094
  this.setCurrentOption(this.currentOption);
1081
1095
  });
1082
-
1083
1096
  const { keyframes, options } = getAnimation(this, 'select.show', {
1084
1097
  dir: 'ltr',
1085
1098
  });
1086
- await animateTo(this.popup.popup, keyframes, options);
1087
-
1088
- // Make sure the current option is scrolled into view (required for Safari)
1089
- if (this.currentOption) {
1099
+ if (this.popup?.popup) await animateTo(this.popup.popup, keyframes, options);
1100
+ if (this.currentOption && this.listbox) {
1090
1101
  scrollIntoView(this.currentOption, this.listbox, 'vertical', 'auto');
1091
1102
  }
1092
1103
  this.searchValue = '';
@@ -1110,10 +1121,9 @@ export class NileSelect extends NileElement implements NileFormControl{
1110
1121
  const { keyframes, options } = getAnimation(this, 'select.hide', {
1111
1122
  dir: 'ltr',
1112
1123
  });
1113
- await animateTo(this.popup.popup, keyframes, options);
1114
- this.listbox.hidden = true;
1115
- this.popup.active = false;
1116
-
1124
+ if (this.popup?.popup) await animateTo(this.popup.popup, keyframes, options);
1125
+ if (this.listbox) this.listbox.hidden = true;
1126
+ if (this.popup) this.popup.active = false;
1117
1127
  if (this.portal) {
1118
1128
  this.portalManager.cleanupPortalAppend();
1119
1129
  }
@@ -49,6 +49,8 @@ export class VirtualScrollHelper {
49
49
  .maxOptionsVisible=${component.maxOptionsVisible}
50
50
  .data=${component.data}
51
51
  .open=${component.open}
52
+ @nile-open-change=${(e: CustomEvent) => (component as any).handleOpenChange(e)
53
+ }
52
54
  .loading=${component.loading}
53
55
  .portal=${component.portal}
54
56
  exportparts="