{"version":3,"file":"edsis-component-calendar.mjs","sources":["../../../library/component/calendar/calendar.component.ts","../../../library/component/calendar/edsis-component-calendar.ts"],"sourcesContent":["import {\n  Component,\n  ElementRef,\n  LOCALE_ID,\n  computed,\n  forwardRef,\n  inject,\n  input,\n  linkedSignal,\n  model,\n  signal,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { cn } from '@edsis/component/class';\nimport { uniqueId } from '@edsis/component/id';\n\nexport type CalendarStartView = 'month' | 'year' | 'multi-year';\nexport type CalendarDateFilter = (date: Date | null) => boolean;\n\nconst MULTI_YEAR_PAGE = 24;\n\ninterface CalendarDayCell {\n  readonly date: Date;\n  readonly label: number;\n  readonly inMonth: boolean;\n  readonly disabled: boolean;\n  readonly selected: boolean;\n  readonly today: boolean;\n  readonly active: boolean;\n}\n\nfunction startOfDay(date: Date): Date {\n  return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\nfunction sameDay(a: Date | null, b: Date | null): boolean {\n  return (\n    !!a &&\n    !!b &&\n    a.getFullYear() === b.getFullYear() &&\n    a.getMonth() === b.getMonth() &&\n    a.getDate() === b.getDate()\n  );\n}\n\n/** Tambah bulan dengan clamp tanggal ke akhir bulan tujuan (31 Jan + 1 bln = 28/29 Feb). */\nfunction addMonths(date: Date, amount: number): Date {\n  const day = date.getDate();\n  const target = new Date(date.getFullYear(), date.getMonth() + amount, 1);\n  const lastDay = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate();\n  target.setDate(Math.min(day, lastDay));\n  return target;\n}\n\nfunction addDays(date: Date, amount: number): Date {\n  const next = new Date(date);\n  next.setDate(next.getDate() + amount);\n  return next;\n}\n\n/**\n * Kalender inline native (tanpa Angular Material): grid bulan dengan navigasi\n * keyboard penuh, plus tampilan pilih tahun (multi-year) dan pilih bulan (year)\n * mengikuti siklus Material — label periode di-klik untuk berpindah tampilan.\n * Two-way `value`, ControlValueAccessor untuk ngModel/reactive forms.\n */\n@Component({\n  selector: 'Calendar',\n  host: {\n    '[class]': 'classes()',\n    '[attr.aria-disabled]': 'isDisabled() ? \"true\" : null',\n    '[attr.inert]': 'isDisabled() ? \"\" : null',\n  },\n  providers: [\n    { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendarComponent), multi: true },\n  ],\n  template: `\n    <div class=\"flex items-center justify-between gap-1 pb-2\">\n      <button\n        type=\"button\"\n        class=\"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n        [attr.aria-label]=\"previousLabel()\"\n        (click)=\"previous()\"\n      >\n        <svg\n          aria-hidden=\"true\"\n          class=\"h-4 w-4\"\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          stroke-width=\"2\"\n          stroke-linecap=\"round\"\n          stroke-linejoin=\"round\"\n        >\n          <polyline points=\"15 18 9 12 15 6\" />\n        </svg>\n      </button>\n\n      <button\n        type=\"button\"\n        data-calendar-period=\"true\"\n        class=\"inline-flex h-7 items-center gap-1 rounded-md px-2 text-[0.8125rem] font-semibold tracking-[-0.01em] transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n        [attr.aria-label]=\"'Change view, current: ' + periodLabel()\"\n        (click)=\"togglePeriodView()\"\n      >\n        {{ periodLabel() }}\n        <svg\n          aria-hidden=\"true\"\n          class=\"h-3.5 w-3.5 text-muted-foreground\"\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          stroke-width=\"2\"\n          stroke-linecap=\"round\"\n          stroke-linejoin=\"round\"\n        >\n          <polyline points=\"6 9 12 15 18 9\" />\n        </svg>\n      </button>\n\n      <button\n        type=\"button\"\n        class=\"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n        [attr.aria-label]=\"nextLabel()\"\n        (click)=\"next()\"\n      >\n        <svg\n          aria-hidden=\"true\"\n          class=\"h-4 w-4\"\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          stroke-width=\"2\"\n          stroke-linecap=\"round\"\n          stroke-linejoin=\"round\"\n        >\n          <polyline points=\"9 18 15 12 9 6\" />\n        </svg>\n      </button>\n    </div>\n\n    @switch (view()) {\n      @case ('month') {\n        <div role=\"grid\" [attr.aria-label]=\"periodLabel()\" (keydown)=\"onGridKeydown($event)\">\n          <div class=\"flex\" role=\"row\">\n            @for (weekday of weekdayLabels(); track $index) {\n              <span\n                role=\"columnheader\"\n                class=\"inline-flex h-8 w-8 items-center justify-center text-[0.6875rem] font-medium text-muted-foreground\"\n                [attr.aria-label]=\"weekday.long\"\n                >{{ weekday.narrow }}</span\n              >\n            }\n          </div>\n\n          @for (week of monthGrid(); track $index) {\n            <div class=\"flex\" role=\"row\">\n              @for (cell of week; track cell.date.getTime()) {\n                <button\n                  type=\"button\"\n                  role=\"gridcell\"\n                  [id]=\"cell.active ? activeCellId : null\"\n                  [tabindex]=\"cell.active ? 0 : -1\"\n                  [attr.data-active]=\"cell.active ? 'true' : null\"\n                  [attr.aria-selected]=\"cell.selected\"\n                  [attr.aria-current]=\"cell.today ? 'date' : null\"\n                  [attr.aria-label]=\"dayAriaLabel(cell.date)\"\n                  [disabled]=\"cell.disabled || null\"\n                  [class]=\"dayClasses(cell)\"\n                  (click)=\"selectDate(cell)\"\n                >\n                  {{ cell.label }}\n                </button>\n              }\n            </div>\n          }\n        </div>\n      }\n\n      @case ('year') {\n        <div class=\"grid grid-cols-3 gap-1\" role=\"listbox\" [attr.aria-label]=\"periodLabel()\">\n          @for (month of monthOptions(); track month.index) {\n            <button\n              type=\"button\"\n              role=\"option\"\n              [attr.aria-selected]=\"month.selected\"\n              [class]=\"periodOptionClasses(month.selected, month.current)\"\n              (click)=\"selectMonth(month.index)\"\n            >\n              {{ month.label }}\n            </button>\n          }\n        </div>\n      }\n\n      @case ('multi-year') {\n        <div class=\"grid grid-cols-4 gap-1\" role=\"listbox\" [attr.aria-label]=\"periodLabel()\">\n          @for (year of yearOptions(); track year.value) {\n            <button\n              type=\"button\"\n              role=\"option\"\n              [attr.aria-selected]=\"year.selected\"\n              [class]=\"periodOptionClasses(year.selected, year.current)\"\n              (click)=\"selectYear(year.value)\"\n            >\n              {{ year.value }}\n            </button>\n          }\n        </div>\n      }\n    }\n  `,\n})\nexport class CalendarComponent implements ControlValueAccessor {\n  private readonly locale = inject(LOCALE_ID);\n  private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n  readonly value = model<Date | null>(null);\n  readonly min = input<Date | null>(null);\n  readonly max = input<Date | null>(null);\n  readonly startAt = input<Date | null>(null);\n  readonly startView = input<CalendarStartView>('month');\n  readonly dateFilter = input<CalendarDateFilter | null>(null);\n  readonly disabled = model<boolean>(false);\n  readonly class = input<string>('');\n\n  /** Disabled state pushed by the Forms API; kept separate so it never clobbers the `disabled` binding. */\n  private readonly cvaDisabled = signal(false);\n  protected readonly isDisabled = computed(() => this.disabled() || this.cvaDisabled());\n\n  protected readonly activeCellId = uniqueId('CalendarDay');\n\n  /**\n   * Tanggal jangkar tampilan + fokus keyboard (roving tabindex). linkedSignal:\n   * mengikuti value/startAt yang ter-bind belakangan, tapi tetap bisa ditulis\n   * lokal oleh navigasi prev/next/keyboard.\n   */\n  protected readonly activeDate = linkedSignal(() =>\n    startOfDay(this.value() ?? this.startAt() ?? new Date()),\n  );\n  protected readonly view = linkedSignal<CalendarStartView>(() => this.startView());\n\n  protected readonly classes = computed(() =>\n    cn(\n      'block w-fit rounded-md border bg-background p-3 text-foreground',\n      this.isDisabled() && 'pointer-events-none opacity-50',\n      this.class(),\n    ),\n  );\n\n  private readonly monthYearFormat = computed(\n    () => new Intl.DateTimeFormat(this.locale, { month: 'long', year: 'numeric' }),\n  );\n  private readonly dayFormat = computed(\n    () =>\n      new Intl.DateTimeFormat(this.locale, {\n        weekday: 'long',\n        day: 'numeric',\n        month: 'long',\n        year: 'numeric',\n      }),\n  );\n\n  protected readonly weekdayLabels = computed(() => {\n    const narrow = new Intl.DateTimeFormat(this.locale, { weekday: 'narrow' });\n    const long = new Intl.DateTimeFormat(this.locale, { weekday: 'long' });\n    // 4 Jan 1970 = Minggu; minggu dimulai hari Minggu (paritas native date adapter).\n    return Array.from({ length: 7 }, (_, day) => {\n      const date = new Date(1970, 0, 4 + day);\n      return { narrow: narrow.format(date), long: long.format(date) };\n    });\n  });\n\n  protected readonly periodLabel = computed(() => {\n    const active = this.activeDate();\n    switch (this.view()) {\n      case 'month':\n        return this.monthYearFormat().format(active);\n      case 'year':\n        return String(active.getFullYear());\n      default: {\n        const start = this.multiYearStart();\n        return `${start} – ${start + MULTI_YEAR_PAGE - 1}`;\n      }\n    }\n  });\n\n  protected readonly previousLabel = computed(() =>\n    this.view() === 'month'\n      ? 'Previous month'\n      : this.view() === 'year'\n        ? 'Previous year'\n        : 'Previous years',\n  );\n  protected readonly nextLabel = computed(() =>\n    this.view() === 'month' ? 'Next month' : this.view() === 'year' ? 'Next year' : 'Next years',\n  );\n\n  protected readonly monthGrid = computed<CalendarDayCell[][]>(() => {\n    const active = this.activeDate();\n    const selected = this.value();\n    const today = startOfDay(new Date());\n    const firstOfMonth = new Date(active.getFullYear(), active.getMonth(), 1);\n    const gridStart = addDays(firstOfMonth, -firstOfMonth.getDay());\n\n    const weeks: CalendarDayCell[][] = [];\n    for (let week = 0; week < 6; week++) {\n      const row: CalendarDayCell[] = [];\n      for (let day = 0; day < 7; day++) {\n        const date = addDays(gridStart, week * 7 + day);\n        row.push({\n          date,\n          label: date.getDate(),\n          inMonth: date.getMonth() === active.getMonth(),\n          disabled: this.isDateDisabled(date),\n          selected: sameDay(date, selected),\n          today: sameDay(date, today),\n          active: sameDay(date, active),\n        });\n      }\n      weeks.push(row);\n    }\n    return weeks;\n  });\n\n  private readonly multiYearStart = computed(() => {\n    const year = this.activeDate().getFullYear();\n    return year - (year % MULTI_YEAR_PAGE);\n  });\n\n  protected readonly monthOptions = computed(() => {\n    const active = this.activeDate();\n    const selected = this.value();\n    const now = new Date();\n    const format = new Intl.DateTimeFormat(this.locale, { month: 'short' });\n    return Array.from({ length: 12 }, (_, index) => ({\n      index,\n      label: format.format(new Date(active.getFullYear(), index, 1)),\n      selected:\n        !!selected &&\n        selected.getFullYear() === active.getFullYear() &&\n        selected.getMonth() === index,\n      current: now.getFullYear() === active.getFullYear() && now.getMonth() === index,\n    }));\n  });\n\n  protected readonly yearOptions = computed(() => {\n    const start = this.multiYearStart();\n    const selected = this.value();\n    const currentYear = new Date().getFullYear();\n    return Array.from({ length: MULTI_YEAR_PAGE }, (_, offset) => {\n      const value = start + offset;\n      return {\n        value,\n        selected: !!selected && selected.getFullYear() === value,\n        current: value === currentYear,\n      };\n    });\n  });\n\n  private onChangeFn: (v: Date | null) => void = () => {};\n  private onTouchedFn: () => void = () => {};\n\n  protected dayAriaLabel(date: Date): string {\n    return this.dayFormat().format(date);\n  }\n\n  protected dayClasses(cell: CalendarDayCell): string {\n    return cn(\n      'inline-flex h-8 w-8 items-center justify-center rounded-md text-[0.8125rem] font-normal transition-colors',\n      'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n      cell.selected\n        ? 'bg-primary font-medium text-primary-foreground hover:bg-primary'\n        : cn(\n            'hover:bg-accent hover:text-accent-foreground',\n            cell.inMonth ? 'text-foreground' : 'text-muted-foreground/50',\n            cell.today && 'font-semibold text-primary',\n          ),\n      cell.disabled && 'pointer-events-none text-muted-foreground/30',\n    );\n  }\n\n  protected periodOptionClasses(selected: boolean, current: boolean): string {\n    return cn(\n      'inline-flex h-9 items-center justify-center rounded-md text-[0.8125rem] transition-colors',\n      'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n      selected\n        ? 'bg-primary font-medium text-primary-foreground hover:bg-primary'\n        : cn(\n            'hover:bg-accent hover:text-accent-foreground',\n            current && 'font-semibold text-primary',\n          ),\n    );\n  }\n\n  protected previous(): void {\n    this.shiftPeriod(-1);\n  }\n\n  protected next(): void {\n    this.shiftPeriod(1);\n  }\n\n  private shiftPeriod(direction: 1 | -1): void {\n    const active = this.activeDate();\n    switch (this.view()) {\n      case 'month':\n        this.activeDate.set(addMonths(active, direction));\n        break;\n      case 'year':\n        this.activeDate.set(addMonths(active, direction * 12));\n        break;\n      default:\n        this.activeDate.set(addMonths(active, direction * 12 * MULTI_YEAR_PAGE));\n    }\n  }\n\n  protected togglePeriodView(): void {\n    this.view.set(this.view() === 'month' ? 'multi-year' : 'month');\n  }\n\n  protected selectMonth(month: number): void {\n    const active = this.activeDate();\n    this.activeDate.set(new Date(active.getFullYear(), month, Math.min(active.getDate(), 28)));\n    this.view.set('month');\n  }\n\n  protected selectYear(year: number): void {\n    const active = this.activeDate();\n    this.activeDate.set(new Date(year, active.getMonth(), Math.min(active.getDate(), 28)));\n    this.view.set('year');\n  }\n\n  protected selectDate(cell: CalendarDayCell): void {\n    if (cell.disabled) {\n      return;\n    }\n\n    this.activeDate.set(cell.date);\n    this.value.set(cell.date);\n    this.onChangeFn(cell.date);\n    this.onTouchedFn();\n  }\n\n  protected onGridKeydown(event: KeyboardEvent): void {\n    const active = this.activeDate();\n    let next: Date | null = null;\n\n    switch (event.key) {\n      case 'ArrowLeft':\n        next = addDays(active, -1);\n        break;\n      case 'ArrowRight':\n        next = addDays(active, 1);\n        break;\n      case 'ArrowUp':\n        next = addDays(active, -7);\n        break;\n      case 'ArrowDown':\n        next = addDays(active, 7);\n        break;\n      case 'Home':\n        next = new Date(active.getFullYear(), active.getMonth(), 1);\n        break;\n      case 'End':\n        next = new Date(active.getFullYear(), active.getMonth() + 1, 0);\n        break;\n      case 'PageUp':\n        next = addMonths(active, event.shiftKey ? -12 : -1);\n        break;\n      case 'PageDown':\n        next = addMonths(active, event.shiftKey ? 12 : 1);\n        break;\n      case 'Enter':\n      case ' ': {\n        event.preventDefault();\n        const cell = this.monthGrid()\n          .flat()\n          .find((candidate) => candidate.active);\n        if (cell) {\n          this.selectDate(cell);\n        }\n        return;\n      }\n      default:\n        return;\n    }\n\n    event.preventDefault();\n    this.activeDate.set(startOfDay(next));\n    // Roving tabindex: pindahkan fokus DOM ke sel aktif baru setelah render.\n    queueMicrotask(() => {\n      this.host.nativeElement.querySelector<HTMLButtonElement>('[data-active=\"true\"]')?.focus();\n    });\n  }\n\n  private isDateDisabled(date: Date): boolean {\n    const min = this.min();\n    const max = this.max();\n\n    if (min && startOfDay(date) < startOfDay(min)) {\n      return true;\n    }\n\n    if (max && startOfDay(date) > startOfDay(max)) {\n      return true;\n    }\n\n    return this.dateFilter()?.(date) === false;\n  }\n\n  writeValue(v: Date | null): void {\n    this.value.set(v);\n  }\n\n  registerOnChange(fn: (v: Date | null) => void): void {\n    this.onChangeFn = fn;\n  }\n\n  registerOnTouched(fn: () => void): void {\n    this.onTouchedFn = fn;\n  }\n\n  setDisabledState(state: boolean): void {\n    this.cvaDisabled.set(state);\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,eAAe,GAAG,EAAE;AAY1B,SAAS,UAAU,CAAC,IAAU,EAAA;AAC5B,IAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;AACtE;AAEA,SAAS,OAAO,CAAC,CAAc,EAAE,CAAc,EAAA;IAC7C,QACE,CAAC,CAAC,CAAC;AACH,QAAA,CAAC,CAAC,CAAC;AACH,QAAA,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;AACnC,QAAA,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE;AA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