@aquera/nile-elements 0.0.15 → 0.0.17

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 (89) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +1 -0
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +1 -0
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js +117 -3
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.d.ts +16 -1
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js +225 -20
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/timezones.d.ts +1 -0
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/timezones.js +350 -0
  11. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/timezones.js.map +1 -0
  12. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/index.d.ts +1 -0
  13. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/index.js +2 -0
  14. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/index.js.map +1 -0
  15. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.css.d.ts +12 -0
  16. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.css.js +37 -0
  17. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -0
  18. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.d.ts +32 -0
  19. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.js +60 -0
  20. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-notification/nile-error-notification.js.map +1 -0
  21. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.css.js +1 -0
  22. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.css.js.map +1 -1
  23. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js +2 -3
  24. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js.map +1 -1
  25. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  26. package/dist/index.cjs.js +1 -1
  27. package/dist/index.esm.js +1 -1
  28. package/dist/index.iife.js +425 -165
  29. package/dist/nile-calendar/index.cjs.js +1 -1
  30. package/dist/nile-calendar/index.esm.js +1 -1
  31. package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
  32. package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
  33. package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
  34. package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
  35. package/dist/nile-calendar/nile-calendar.css.esm.js +119 -5
  36. package/dist/nile-calendar/nile-calendar.esm.js +130 -19
  37. package/dist/nile-calendar/timezones.cjs.js +2 -0
  38. package/dist/nile-calendar/timezones.cjs.js.map +1 -0
  39. package/dist/nile-calendar/timezones.esm.js +1 -0
  40. package/dist/nile-error-notification/index.cjs.js +2 -0
  41. package/dist/nile-error-notification/index.cjs.js.map +1 -0
  42. package/dist/nile-error-notification/index.esm.js +1 -0
  43. package/dist/nile-error-notification/nile-error-notification.cjs.js +2 -0
  44. package/dist/nile-error-notification/nile-error-notification.cjs.js.map +1 -0
  45. package/dist/nile-error-notification/nile-error-notification.css.cjs.js +2 -0
  46. package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -0
  47. package/dist/nile-error-notification/nile-error-notification.css.esm.js +25 -0
  48. package/dist/nile-error-notification/nile-error-notification.esm.js +12 -0
  49. package/dist/nile-option/nile-option.css.cjs.js +1 -1
  50. package/dist/nile-option/nile-option.css.cjs.js.map +1 -1
  51. package/dist/nile-option/nile-option.css.esm.js +3 -2
  52. package/dist/nile-select/nile-select.cjs.js +1 -1
  53. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  54. package/dist/nile-select/nile-select.esm.js +1 -2
  55. package/dist/src/index.d.ts +1 -0
  56. package/dist/src/index.js +1 -0
  57. package/dist/src/index.js.map +1 -1
  58. package/dist/src/nile-calendar/nile-calendar.css.js +117 -3
  59. package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  60. package/dist/src/nile-calendar/nile-calendar.d.ts +16 -1
  61. package/dist/src/nile-calendar/nile-calendar.js +225 -20
  62. package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  63. package/dist/src/nile-calendar/timezones.d.ts +1 -0
  64. package/dist/src/nile-calendar/timezones.js +350 -0
  65. package/dist/src/nile-calendar/timezones.js.map +1 -0
  66. package/dist/src/nile-error-notification/index.d.ts +1 -0
  67. package/dist/src/nile-error-notification/index.js +2 -0
  68. package/dist/src/nile-error-notification/index.js.map +1 -0
  69. package/dist/src/nile-error-notification/nile-error-notification.css.d.ts +12 -0
  70. package/dist/src/nile-error-notification/nile-error-notification.css.js +37 -0
  71. package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -0
  72. package/dist/src/nile-error-notification/nile-error-notification.d.ts +32 -0
  73. package/dist/src/nile-error-notification/nile-error-notification.js +60 -0
  74. package/dist/src/nile-error-notification/nile-error-notification.js.map +1 -0
  75. package/dist/src/nile-option/nile-option.css.js +1 -0
  76. package/dist/src/nile-option/nile-option.css.js.map +1 -1
  77. package/dist/src/nile-select/nile-select.js +2 -3
  78. package/dist/src/nile-select/nile-select.js.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +1 -1
  81. package/src/index.ts +1 -0
  82. package/src/nile-calendar/nile-calendar.css.ts +117 -3
  83. package/src/nile-calendar/nile-calendar.ts +321 -83
  84. package/src/nile-calendar/timezones.ts +348 -0
  85. package/src/nile-error-notification/index.ts +1 -0
  86. package/src/nile-error-notification/nile-error-notification.css.ts +39 -0
  87. package/src/nile-error-notification/nile-error-notification.ts +70 -0
  88. package/src/nile-option/nile-option.css.ts +1 -0
  89. package/src/nile-select/nile-select.ts +2 -3
@@ -32,6 +32,7 @@ import type { NileMenu } from '../nile-menu';
32
32
  import type { NilePopup } from '../nile-popup';
33
33
  import '../nile-popup';
34
34
  import { NileDropdown } from '../nile-dropdown';
35
+ import { TIMEZONES } from './timezones';
35
36
 
36
37
  /**
37
38
  * Nile icon component.
@@ -50,15 +51,16 @@ export class NileCalendar extends NileElement {
50
51
  }
51
52
 
52
53
  private currentMonth: number = new Date().getMonth();
54
+
53
55
  private currentYear: number = new Date().getFullYear();
54
56
 
55
57
  @query('nile-dropdown') dropdown: NileDropdown;
56
58
 
57
59
  @property({ type: Boolean, reflect: true }) dropDownOpened = false;
58
60
 
59
- @property({ type: Object }) value : any;
61
+ @property({ type: Object }) value: any;
60
62
 
61
- @property({ type: Object }) rangeValue : any;
63
+ @property({ type: Object }) rangeValue: any;
62
64
 
63
65
  @property({ type: String, attribute: 'value' }) valueAttribute:
64
66
  | string
@@ -68,14 +70,23 @@ export class NileCalendar extends NileElement {
68
70
  null;
69
71
 
70
72
  @property({ type: Object }) startDate: Date | null = null;
73
+
71
74
  @property({ type: Object }) endDate: Date | null = null;
72
- @property({ type: Boolean }) isSelectingStart = true; // flag to indicate what we're selecting
75
+
76
+ @property({ type: Boolean }) isSelectingStart = true;
73
77
 
74
78
  @property({ type: Boolean }) range = false;
75
79
 
80
+ @property({ type: String }) type = 'absolute';
81
+
82
+ @property({ type: String }) selectedUnit: string;
83
+
84
+ @property({ type: Number }) selectedValue: number;
85
+
86
+ @property({ type: String }) selectedTimeZone: string = 'local';
87
+
76
88
  @watch('value')
77
89
  valueChanged() {
78
-
79
90
  if (this.range && this.value) {
80
91
  this.rangeValue = this.value;
81
92
  this.value = null;
@@ -98,7 +109,6 @@ export class NileCalendar extends NileElement {
98
109
  }
99
110
  }
100
111
 
101
-
102
112
  updated(changedProperties: PropertyValues) {
103
113
  super.updated(changedProperties);
104
114
 
@@ -164,10 +174,6 @@ export class NileCalendar extends NileElement {
164
174
  this.requestUpdate();
165
175
  }
166
176
 
167
-
168
-
169
-
170
-
171
177
  connectedCallback() {
172
178
  super.connectedCallback();
173
179
  this.initializeValue();
@@ -194,7 +200,6 @@ export class NileCalendar extends NileElement {
194
200
  }
195
201
 
196
202
  private nextMonth(): void {
197
-
198
203
  if (this.currentMonth === 11) {
199
204
  this.currentMonth = 0;
200
205
  this.currentYear++;
@@ -205,7 +210,6 @@ export class NileCalendar extends NileElement {
205
210
  }
206
211
 
207
212
  private prevMonth(): void {
208
-
209
213
  if (this.currentMonth === 0) {
210
214
  this.currentMonth = 11;
211
215
  this.currentYear--;
@@ -254,6 +258,11 @@ export class NileCalendar extends NileElement {
254
258
 
255
259
  private confimRange() {
256
260
  if (this.startDate && this.endDate) {
261
+ if (this.selectedTimeZone !== 'local') {
262
+ this.startDate = this.convertTZ(this.startDate, this.selectedTimeZone);
263
+ this.endDate = this.convertTZ(this.endDate, this.selectedTimeZone);
264
+ }
265
+
257
266
  this.emit('nile-changed', {
258
267
  startDate: this.startDate,
259
268
  endDate: this.endDate,
@@ -269,6 +278,24 @@ export class NileCalendar extends NileElement {
269
278
  }
270
279
  }
271
280
 
281
+ convertTZ(date: Date, tzString: any) {
282
+ return new Date(
283
+ (typeof date === 'string' ? new Date(date) : date).toLocaleString(
284
+ 'en-US',
285
+ { timeZone: tzString }
286
+ )
287
+ );
288
+ }
289
+
290
+ isCurrentDate(day: number, month: number, year: number) {
291
+ const today = new Date();
292
+ return (
293
+ day === today.getDate() &&
294
+ month + 1 === today.getMonth() + 1 &&
295
+ year === today.getFullYear()
296
+ );
297
+ }
298
+
272
299
  private renderMonth(
273
300
  year: number,
274
301
  month: number,
@@ -337,7 +364,12 @@ export class NileCalendar extends NileElement {
337
364
  return html`
338
365
  <div class="calendar">
339
366
  <div class="calendar-header">
340
- <nile-icon class="calendar-header__month-navigation" name="arrowleft" color="black" @click="${this.prevMonth}">
367
+ <nile-icon
368
+ class="calendar-header__month-navigation"
369
+ name="arrowleft"
370
+ color="black"
371
+ @click="${this.prevMonth}"
372
+ >
341
373
  </nile-icon>
342
374
  <span
343
375
  >${new Date(year, month).toLocaleString('default', {
@@ -345,7 +377,12 @@ export class NileCalendar extends NileElement {
345
377
  })}
346
378
  ${year}</span
347
379
  >
348
- <nile-icon class="calendar-header__month-navigation" name="arrowright" color="black" @click="${this.nextMonth}">
380
+ <nile-icon
381
+ class="calendar-header__month-navigation"
382
+ name="arrowright"
383
+ color="black"
384
+ @click="${this.nextMonth}"
385
+ >
349
386
  </nile-icon>
350
387
  </div>
351
388
  <div class="day-names">
@@ -370,7 +407,11 @@ export class NileCalendar extends NileElement {
370
407
  isCurrentMonth
371
408
  )} ${isInRange(day, month, year, isCurrentMonth)
372
409
  ? 'in-range'
373
- : ''} ${!isCurrentMonth ? 'filler' : ''}"
410
+ : ''} ${!isCurrentMonth ? 'filler' : ''}
411
+ ${this.isCurrentDate(day, month, year) && isCurrentMonth
412
+ ? 'current-date'
413
+ : ''}
414
+ "
374
415
  @click="${() => {
375
416
  if (isCurrentMonth) {
376
417
  this.selectDate(day, month, year);
@@ -393,12 +434,17 @@ export class NileCalendar extends NileElement {
393
434
  return `${day}/${month}/${year}`;
394
435
  }
395
436
 
396
- private formatDateRange(value: { startDate: Date | null, endDate: Date | null }): string {
397
- if(!value){
437
+ private formatDateRange(value: {
438
+ startDate: Date | null;
439
+ endDate: Date | null;
440
+ }): string {
441
+ if (!value) {
398
442
  return value;
399
443
  }
400
444
  if (!value.startDate || !value.endDate) return '';
401
- return `${this.formatDate(value.startDate)} - ${this.formatDate(value.endDate)}`;
445
+ return `${this.formatDate(value.startDate)} - ${this.formatDate(
446
+ value.endDate
447
+ )}`;
402
448
  }
403
449
 
404
450
  private handleStartDateInput(event: CustomEvent): void {
@@ -424,7 +470,6 @@ export class NileCalendar extends NileElement {
424
470
  this.endDate = date;
425
471
  } else {
426
472
  this.endDate = null;
427
-
428
473
  }
429
474
  this.requestUpdate();
430
475
  }
@@ -454,56 +499,133 @@ export class NileCalendar extends NileElement {
454
499
  return regex.test(input);
455
500
  }
456
501
 
457
- // Parse time string to a Date object
458
- private parseTime(input: string, date: Date): Date | null {
459
- if (!this.isValidTimeInput(input)) {
460
- return null;
502
+ // Parse time string to a Date object
503
+ private parseTime(input: string, date: Date): Date | null {
504
+ if (!this.isValidTimeInput(input)) {
505
+ return null;
506
+ }
507
+ const [hour, minute, second] = input.split(':').map(Number);
508
+ const newDate = new Date(date.getTime());
509
+ newDate.setHours(hour, minute, second);
510
+ return newDate;
461
511
  }
462
- const [hour, minute, second] = input.split(':').map(Number);
463
- const newDate = new Date(date.getTime());
464
- newDate.setHours(hour, minute, second);
465
- return newDate;
466
- }
467
512
 
468
- private handleStartTimeInput(event: CustomEvent): void {
469
- if (!this.startDate) {
470
- this.startDate = null;
471
- return;
513
+ private handleStartTimeInput(event: CustomEvent): void {
514
+ if (!this.startDate) {
515
+ this.startDate = null;
516
+ return;
517
+ }
518
+ const time = this.parseTime(event.detail.value, this.startDate);
519
+ if (time) {
520
+ this.startDate = time;
521
+ } else {
522
+ this.startDate.setHours(0, 0, 0);
523
+ }
524
+ this.requestUpdate();
472
525
  }
473
- const time = this.parseTime(event.detail.value, this.startDate);
474
- if (time) {
475
- this.startDate = time;
476
- } else {
477
- this.startDate.setHours(0, 0, 0);
526
+
527
+ private handleEndTimeInput(event: CustomEvent): void {
528
+ if (!this.endDate) {
529
+ this.endDate = null;
530
+ return;
531
+ }
532
+ const time = this.parseTime(event.detail.value, this.endDate);
533
+ if (time) {
534
+ this.endDate = time;
535
+ } else {
536
+ this.endDate.setHours(0, 0, 0);
537
+ }
538
+ this.requestUpdate();
478
539
  }
479
- this.requestUpdate();
480
- }
481
540
 
482
- private handleEndTimeInput(event: CustomEvent): void {
483
- if (!this.endDate) {
484
- this.endDate = null;
485
- return;
541
+ setType(newType: string) {
542
+ this.type = newType;
486
543
  }
487
- const time = this.parseTime(event.detail.value, this.endDate);
488
- if (time) {
489
- this.endDate = time;
490
- } else {
491
- this.endDate.setHours(0, 0, 0);
544
+
545
+ createRelativePeriod(unit: String, value: number) {
546
+ const endTime = new Date();
547
+ const startTime = new Date();
548
+
549
+ switch (unit) {
550
+ case 'minutes':
551
+ startTime.setMinutes(startTime.getMinutes() - value);
552
+ break;
553
+ case 'hours':
554
+ startTime.setHours(startTime.getHours() - value);
555
+ break;
556
+ case 'days':
557
+ startTime.setDate(startTime.getDate() - value);
558
+ break;
559
+ case 'weeks':
560
+ startTime.setDate(startTime.getDate() - 7 * value); // Subtract weeks as days
561
+ break;
562
+ case 'months':
563
+ startTime.setMonth(startTime.getMonth() - value);
564
+ break;
565
+ }
566
+
567
+ this.startDate = new Date(startTime.getTime());
568
+ this.endDate = new Date(endTime.getTime());
569
+
570
+ this.requestUpdate();
571
+
572
+ return {
573
+ startDate: this.startDate,
574
+ endDate: this.endDate,
575
+ };
576
+ }
577
+
578
+ handleTimeValueClick(unit: string, value: number, event: any) {
579
+ const timestamps = this.createRelativePeriod(unit, value);
580
+
581
+ this.selectedUnit = unit;
582
+ this.selectedValue = value;
583
+
584
+ this.requestUpdate();
492
585
  }
493
- this.requestUpdate();
494
- }
495
586
 
587
+ renderTimeValues(unit: string, values: any[]) {
588
+ return values.map(
589
+ value =>
590
+ html`
591
+ <div
592
+ class="time-value ${this.selectedUnit === unit &&
593
+ this.selectedValue === value
594
+ ? 'time-value--selected'
595
+ : ''}"
596
+ @click=${(e: any) => this.handleTimeValueClick(unit, value, e)}
597
+ >
598
+ ${value}
599
+ </div>
600
+ `
601
+ );
602
+ }
496
603
 
604
+ handleDurationChange(event: any) {
605
+ this.selectedValue = Number(event.detail.value);
606
+ if (this.selectedUnit && this.selectedValue) {
607
+ this.handleTimeValueClick(this.selectedUnit, this.selectedValue, event);
608
+ }
609
+ }
497
610
 
498
- /* #endregion */
611
+ handleUnitChange(event: any) {
612
+ this.selectedUnit = event.detail.value;
613
+ if (this.selectedUnit && this.selectedValue) {
614
+ this.handleTimeValueClick(this.selectedUnit, this.selectedValue, event);
615
+ }
616
+ }
499
617
 
500
- /* #region Methods */
618
+ handleTimeZoneChange(event: any) {
619
+ this.selectedTimeZone = event.detail.value;
620
+ this.requestUpdate();
621
+ }
501
622
 
502
623
  /**
503
624
  * Render method
504
- * @slot This is a slot test
505
625
  */
506
626
  render(): TemplateResult {
627
+ const timeZones: string[] = TIMEZONES;
628
+
507
629
  const daysArray = this.getDaysArray(this.currentYear, this.currentMonth);
508
630
  const nextMonth = (this.currentMonth + 1) % 12;
509
631
  const nextYear =
@@ -511,59 +633,175 @@ private handleEndTimeInput(event: CustomEvent): void {
511
633
  const nextMonthDaysArray = this.getDaysArray(nextYear, nextMonth);
512
634
 
513
635
  return html`
636
+ <div
637
+ class="base ${this.range ? 'base__range' : ''} ${this.type ===
638
+ 'relative'
639
+ ? 'base__relative'
640
+ : ''}"
641
+ >
642
+ <div class="calendar-config ${!this.range ? 'hidden' : ''}">
643
+ <div class="calendar-switcher">
644
+ <div
645
+ class="calendar-switch${this.type === 'absolute'
646
+ ? '__active'
647
+ : ''}"
648
+ @click="${() => this.setType('absolute')}"
649
+ >
650
+ Absolute
651
+ </div>
652
+ <div
653
+ class="calendar-switch${this.type === 'relative'
654
+ ? '__active'
655
+ : ''}"
656
+ @click="${() => this.setType('relative')}"
657
+ >
658
+ Relative
659
+ </div>
660
+ </div>
514
661
 
515
- <div class="base ${this.range ? 'base__range' : ''}">
516
- <div class="calendar-wrapper" >
517
- <div class="calendar-container ${this.range ? 'with-margin' : ''}">
518
- ${this.renderMonth(
519
- this.currentYear,
520
- this.currentMonth,
521
- this.getDaysArray(this.currentYear, this.currentMonth)
662
+ <div class="calendar-timezone">
663
+ <nile-select
664
+ searchEnabled
665
+ hoist
666
+ value=${this.selectedTimeZone}
667
+ @nile-change=${this.handleTimeZoneChange}
668
+ >
669
+ <nile-option value="local">Local Time Zone</nile-option>
670
+ ${timeZones.map(
671
+ timeZone => html`
672
+ <nile-option value="${timeZone}">${timeZone}</nile-option>
673
+ `
522
674
  )}
675
+ </nile-select>
676
+ </div>
677
+ </div>
678
+
679
+ <div
680
+ class="calendar-wrapper ${this.type !== 'absolute' ? 'hidden' : ''}"
681
+ >
682
+ <div class="calendar-container ${this.range ? 'with-margin' : ''}">
683
+ ${this.renderMonth(
684
+ this.currentYear,
685
+ this.currentMonth,
686
+ this.getDaysArray(this.currentYear, this.currentMonth)
687
+ )}
688
+ </div>
689
+ </div>
690
+
691
+ <div class="unit-container ${this.type !== 'relative' ? 'hidden' : ''}">
692
+ <div class="time-unit-group">
693
+ <div class="time-unit-name"><span>Minutes</span></div>
694
+ <div class="time-unit-value">
695
+ ${this.renderTimeValues('minutes', [1, 3, 5, 15, 30, 45])}
523
696
  </div>
524
- <!-- ${this.range
525
- ? html`
526
- <div class="calendar-container">
527
- ${this.renderMonth(
528
- this.currentYear,
529
- (this.currentMonth + 1) % 12,
530
- this.getDaysArray(
531
- this.currentYear,
532
- (this.currentMonth + 1) % 12
533
- )
534
- )}
535
- </div>
536
- `
537
- : ''} -->
697
+ </div>
698
+
699
+ <div class="time-unit-group">
700
+ <div class="time-unit-name"><span>Hours</span></div>
701
+ <div class="time-unit-value">
702
+ ${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
703
+ </div>
704
+ </div>
705
+
706
+ <div class="time-unit-group">
707
+ <div class="time-unit-name"><span>Days</span></div>
708
+ <div class="time-unit-value">
709
+ ${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
710
+ </div>
711
+ </div>
538
712
 
713
+ <div class="time-unit-group">
714
+ <div class="time-unit-name"><span>Weeks</span></div>
715
+ <div class="time-unit-value">
716
+ ${this.renderTimeValues('weeks', [1, 2, 4, 6])}
717
+ </div>
718
+ </div>
719
+
720
+ <div class="time-unit-group">
721
+ <div class="time-unit-name"><span>Months:</span></div>
722
+ <div class="time-unit-value">
723
+ ${this.renderTimeValues('months', [3, 6, 12, 15])}
724
+ </div>
539
725
  </div>
540
- ${this.range
541
- ? html`
726
+ </div>
727
+
728
+ ${this.range && this.type === 'relative'
729
+ ? html`
730
+ <div class="calender-input calender-input--relative">
731
+ <div class="from">
732
+ <nile-input class="manual-input" label="Duration" value="${
733
+ this.selectedValue
734
+ }"
735
+ @nile-input="${this.handleDurationChange}"
736
+ placeholder="Enter Value" ></nile-input>
737
+ <nile-select class="manual-input" label="Unit" value="${
738
+ this.selectedUnit
739
+ }"
740
+ @nile-change="${this.handleUnitChange}"
741
+ >
742
+ <nile-option value="minutes"> Minutes </nile-option>
743
+ <nile-option value="hours"> Hours </nile-option>
744
+ <nile-option value="days"> Days </nile-option>
745
+ <nile-option value="weeks"> Weeks </nile-option>
746
+ <nile-option value="months"> Months </nile-option>
747
+ </nile-select>
748
+
749
+ </div>
750
+
751
+ <div class="button-contaner">
752
+ <nile-button class="apply-button" ?disabled="${
753
+ !this.startDate || !this.endDate
754
+ }" @click="${this.confimRange}"> Apply</nile-button>
755
+ </div>
756
+
757
+
758
+ </div>
759
+ </div>
760
+ `
761
+ : ''}
762
+ ${this.range && this.type === 'absolute'
763
+ ? html`
542
764
  <div class="calender-input">
543
765
  <span class="manual-input-label">From </span>
544
766
  <div class="from">
545
- <nile-input class="manual-input" value="${this.formatDate(this.startDate)}" placeholder="DD/MM/YYYY" @nile-change="${this.handleStartDateInput}"></nile-input>
546
- <nile-input class="manual-input" value="${this.formatTime(this.startDate)}" placeholder="HH:MM:SS" @nile-change="${this.handleStartTimeInput}"> </nile-input>
767
+ <nile-input class="manual-input" value="${this.formatDate(
768
+ this.startDate
769
+ )}" placeholder="DD/MM/YYYY" @nile-change="${
770
+ this.handleStartDateInput
771
+ }"></nile-input>
772
+ <nile-input class="manual-input" value="${this.formatTime(
773
+ this.startDate
774
+ )}" placeholder="HH:MM:SS" @nile-change="${
775
+ this.handleStartTimeInput
776
+ }"> </nile-input>
547
777
 
548
778
  </div>
549
779
  <br>
550
780
  <span class="manual-input-label">To </span>
551
781
  <div class="from">
552
- <nile-input class="manual-input" value="${this.formatDate(this.endDate)}" placeholder="DD/MM/YYYY" @nile-change="${this.handleEndDateInput}"></nile-input>
553
- <nile-input class="manual-input" value="${this.formatTime(this.endDate)}" placeholder="HH:MM:SS" @nile-change="${this.handleEndTimeInput}"> </nile-input>
782
+ <nile-input class="manual-input" value="${this.formatDate(
783
+ this.endDate
784
+ )}" placeholder="DD/MM/YYYY" @nile-change="${
785
+ this.handleEndDateInput
786
+ }"></nile-input>
787
+ <nile-input class="manual-input" value="${this.formatTime(
788
+ this.endDate
789
+ )}" placeholder="HH:MM:SS" @nile-change="${
790
+ this.handleEndTimeInput
791
+ }"> </nile-input>
554
792
  </div>
555
793
  <div class="button-contaner">
556
794
  <nile-button class="apply-button" ?disabled="${
557
- !this.startDate || !this.endDate
558
- }" @click="${this.confimRange}"> Apply</nile-button>
795
+ !this.startDate || !this.endDate
796
+ }" @click="${this.confimRange}"> Apply</nile-button>
559
797
  </div>
560
798
 
561
799
 
562
800
  </div>
563
801
  </div>
564
802
  `
565
- : ''}
566
- </div>
803
+ : ''}
804
+ </div>
567
805
  `;
568
806
  }
569
807
  }