yukit-web 0.0.1
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.
- package/.npm/_logs/2026-08-20T08_40_55_706Z-debug-0.log +38 -0
- package/.npm/_logs/2026-08-20T08_40_56_280Z-debug-0.log +14 -0
- package/README.md +1465 -0
- package/fesm2022/yukit-web-helm-accordion.mjs +141 -0
- package/fesm2022/yukit-web-helm-accordion.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-alert-dialog.mjs +250 -0
- package/fesm2022/yukit-web-helm-alert-dialog.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-alert.mjs +94 -0
- package/fesm2022/yukit-web-helm-alert.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-aspect-ratio.mjs +47 -0
- package/fesm2022/yukit-web-helm-aspect-ratio.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-attachment.mjs +211 -0
- package/fesm2022/yukit-web-helm-attachment.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-autocomplete.mjs +361 -0
- package/fesm2022/yukit-web-helm-autocomplete.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-avatar.mjs +152 -0
- package/fesm2022/yukit-web-helm-avatar.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-badge.mjs +47 -0
- package/fesm2022/yukit-web-helm-badge.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-breadcrumb.mjs +196 -0
- package/fesm2022/yukit-web-helm-breadcrumb.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-bubble.mjs +121 -0
- package/fesm2022/yukit-web-helm-bubble.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-button-group.mjs +86 -0
- package/fesm2022/yukit-web-helm-button-group.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-button.mjs +77 -0
- package/fesm2022/yukit-web-helm-button.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-calendar.mjs +937 -0
- package/fesm2022/yukit-web-helm-calendar.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-card.mjs +141 -0
- package/fesm2022/yukit-web-helm-card.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-carousel.mjs +270 -0
- package/fesm2022/yukit-web-helm-carousel.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-checkbox.mjs +147 -0
- package/fesm2022/yukit-web-helm-checkbox.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-collapsible.mjs +62 -0
- package/fesm2022/yukit-web-helm-collapsible.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-combobox.mjs +624 -0
- package/fesm2022/yukit-web-helm-combobox.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-command.mjs +315 -0
- package/fesm2022/yukit-web-helm-command.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-context-menu.mjs +71 -0
- package/fesm2022/yukit-web-helm-context-menu.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-date-picker.mjs +1517 -0
- package/fesm2022/yukit-web-helm-date-picker.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-dialog.mjs +271 -0
- package/fesm2022/yukit-web-helm-dialog.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-drawer.mjs +233 -0
- package/fesm2022/yukit-web-helm-drawer.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-dropdown-menu.mjs +508 -0
- package/fesm2022/yukit-web-helm-dropdown-menu.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-empty.mjs +125 -0
- package/fesm2022/yukit-web-helm-empty.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-field.mjs +325 -0
- package/fesm2022/yukit-web-helm-field.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-hover-card.mjs +102 -0
- package/fesm2022/yukit-web-helm-hover-card.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-input-group.mjs +171 -0
- package/fesm2022/yukit-web-helm-input-group.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-input-otp.mjs +127 -0
- package/fesm2022/yukit-web-helm-input-otp.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-input.mjs +32 -0
- package/fesm2022/yukit-web-helm-input.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-item.mjs +242 -0
- package/fesm2022/yukit-web-helm-item.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-kbd.mjs +46 -0
- package/fesm2022/yukit-web-helm-kbd.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-label.mjs +30 -0
- package/fesm2022/yukit-web-helm-label.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-marker.mjs +77 -0
- package/fesm2022/yukit-web-helm-marker.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-menubar.mjs +90 -0
- package/fesm2022/yukit-web-helm-menubar.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-message.mjs +115 -0
- package/fesm2022/yukit-web-helm-message.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-native-select.mjs +180 -0
- package/fesm2022/yukit-web-helm-native-select.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-navigation-menu.mjs +173 -0
- package/fesm2022/yukit-web-helm-navigation-menu.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-pagination.mjs +745 -0
- package/fesm2022/yukit-web-helm-pagination.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-popover.mjs +136 -0
- package/fesm2022/yukit-web-helm-popover.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-progress.mjs +60 -0
- package/fesm2022/yukit-web-helm-progress.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-radio-group.mjs +185 -0
- package/fesm2022/yukit-web-helm-radio-group.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-resizable.mjs +98 -0
- package/fesm2022/yukit-web-helm-resizable.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-scroll-area.mjs +36 -0
- package/fesm2022/yukit-web-helm-scroll-area.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-select.mjs +412 -0
- package/fesm2022/yukit-web-helm-select.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-separator.mjs +33 -0
- package/fesm2022/yukit-web-helm-separator.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-sheet.mjs +254 -0
- package/fesm2022/yukit-web-helm-sheet.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-sidebar.mjs +857 -0
- package/fesm2022/yukit-web-helm-sidebar.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-skeleton.mjs +29 -0
- package/fesm2022/yukit-web-helm-skeleton.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-slider.mjs +123 -0
- package/fesm2022/yukit-web-helm-slider.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-sonner.mjs +126 -0
- package/fesm2022/yukit-web-helm-sonner.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-spinner.mjs +48 -0
- package/fesm2022/yukit-web-helm-spinner.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-switch.mjs +126 -0
- package/fesm2022/yukit-web-helm-switch.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-table.mjs +180 -0
- package/fesm2022/yukit-web-helm-table.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-tabs.mjs +251 -0
- package/fesm2022/yukit-web-helm-tabs.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-textarea.mjs +32 -0
- package/fesm2022/yukit-web-helm-textarea.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-toggle-group.mjs +95 -0
- package/fesm2022/yukit-web-helm-toggle-group.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-toggle.mjs +61 -0
- package/fesm2022/yukit-web-helm-toggle.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-tooltip.mjs +57 -0
- package/fesm2022/yukit-web-helm-tooltip.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-typography.mjs +205 -0
- package/fesm2022/yukit-web-helm-typography.mjs.map +1 -0
- package/fesm2022/yukit-web-helm-utils.mjs +272 -0
- package/fesm2022/yukit-web-helm-utils.mjs.map +1 -0
- package/fesm2022/yukit-web.mjs +3592 -0
- package/fesm2022/yukit-web.mjs.map +1 -0
- package/package.json +291 -0
- package/src/lib/theme/spartan-overwrites/accordion.css +4 -0
- package/src/lib/theme/theme.css +161 -0
- package/src/lib/theme/tokens/color.css +356 -0
- package/src/lib/theme/tokens/component-colors.css +167 -0
- package/src/lib/theme/tokens/radius.css +18 -0
- package/src/lib/theme/tokens/typography.css +201 -0
- package/types/yukit-web-helm-accordion.d.ts +32 -0
- package/types/yukit-web-helm-alert-dialog.d.ts +85 -0
- package/types/yukit-web-helm-alert.d.ts +37 -0
- package/types/yukit-web-helm-aspect-ratio.d.ts +16 -0
- package/types/yukit-web-helm-attachment.d.ts +80 -0
- package/types/yukit-web-helm-autocomplete.d.ts +91 -0
- package/types/yukit-web-helm-avatar.d.ts +45 -0
- package/types/yukit-web-helm-badge.d.ts +19 -0
- package/types/yukit-web-helm-breadcrumb.d.ts +52 -0
- package/types/yukit-web-helm-bubble.d.ts +46 -0
- package/types/yukit-web-helm-button-group.d.ts +25 -0
- package/types/yukit-web-helm-button.d.ts +33 -0
- package/types/yukit-web-helm-calendar.d.ts +89 -0
- package/types/yukit-web-helm-card.d.ts +49 -0
- package/types/yukit-web-helm-carousel.d.ts +79 -0
- package/types/yukit-web-helm-checkbox.d.ts +60 -0
- package/types/yukit-web-helm-collapsible.d.ts +22 -0
- package/types/yukit-web-helm-combobox.d.ts +150 -0
- package/types/yukit-web-helm-command.d.ts +84 -0
- package/types/yukit-web-helm-context-menu.d.ts +29 -0
- package/types/yukit-web-helm-date-picker.d.ts +574 -0
- package/types/yukit-web-helm-dialog.d.ts +90 -0
- package/types/yukit-web-helm-drawer.d.ts +71 -0
- package/types/yukit-web-helm-dropdown-menu.d.ts +171 -0
- package/types/yukit-web-helm-empty.d.ts +49 -0
- package/types/yukit-web-helm-field.d.ts +102 -0
- package/types/yukit-web-helm-hover-card.d.ts +31 -0
- package/types/yukit-web-helm-input-group.d.ts +47 -0
- package/types/yukit-web-helm-input-otp.d.ts +40 -0
- package/types/yukit-web-helm-input.d.ts +13 -0
- package/types/yukit-web-helm-item.d.ts +96 -0
- package/types/yukit-web-helm-kbd.d.ts +17 -0
- package/types/yukit-web-helm-label.d.ts +12 -0
- package/types/yukit-web-helm-marker.d.ts +31 -0
- package/types/yukit-web-helm-menubar.d.ts +35 -0
- package/types/yukit-web-helm-message.d.ts +44 -0
- package/types/yukit-web-helm-native-select.d.ts +65 -0
- package/types/yukit-web-helm-navigation-menu.d.ts +49 -0
- package/types/yukit-web-helm-pagination.d.ts +187 -0
- package/types/yukit-web-helm-popover.d.ts +49 -0
- package/types/yukit-web-helm-progress.d.ts +22 -0
- package/types/yukit-web-helm-radio-group.d.ts +66 -0
- package/types/yukit-web-helm-resizable.d.ts +27 -0
- package/types/yukit-web-helm-scroll-area.d.ts +11 -0
- package/types/yukit-web-helm-select.d.ts +114 -0
- package/types/yukit-web-helm-separator.d.ts +13 -0
- package/types/yukit-web-helm-sheet.d.ts +75 -0
- package/types/yukit-web-helm-sidebar.d.ts +232 -0
- package/types/yukit-web-helm-skeleton.d.ts +11 -0
- package/types/yukit-web-helm-slider.d.ts +14 -0
- package/types/yukit-web-helm-sonner.d.ts +52 -0
- package/types/yukit-web-helm-spinner.d.ts +18 -0
- package/types/yukit-web-helm-switch.d.ts +54 -0
- package/types/yukit-web-helm-table.d.ts +82 -0
- package/types/yukit-web-helm-tabs.d.ts +66 -0
- package/types/yukit-web-helm-textarea.d.ts +13 -0
- package/types/yukit-web-helm-toggle-group.d.ts +34 -0
- package/types/yukit-web-helm-toggle.d.ts +22 -0
- package/types/yukit-web-helm-tooltip.d.ts +17 -0
- package/types/yukit-web-helm-typography.d.ts +89 -0
- package/types/yukit-web-helm-utils.d.ts +44 -0
- package/types/yukit-web.d.ts +2426 -0
|
@@ -0,0 +1,937 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, inject, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { provideIcons, NgIcon } from '@ng-icons/core';
|
|
5
|
+
import { lucideChevronRight, lucideChevronLeft } from '@ng-icons/lucide';
|
|
6
|
+
import * as i1 from '@spartan-ng/brain/calendar';
|
|
7
|
+
import { injectBrnCalendarI18n, BrnCalendar, BrnCalendarImports, BrnCalendarMulti, BrnCalendarRange, BrnMonthYearCalendar } from '@spartan-ng/brain/calendar';
|
|
8
|
+
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
9
|
+
import * as i3 from 'yukit-web/helm/button';
|
|
10
|
+
import { buttonVariants, HlmButtonImports } from 'yukit-web/helm/button';
|
|
11
|
+
import * as i2 from 'yukit-web/helm/select';
|
|
12
|
+
import { HlmSelectImports } from 'yukit-web/helm/select';
|
|
13
|
+
import { hlm, classes } from 'yukit-web/helm/utils';
|
|
14
|
+
|
|
15
|
+
class HlmCalendar {
|
|
16
|
+
constructor() {
|
|
17
|
+
/** Access the calendar i18n */
|
|
18
|
+
this._i18n = injectBrnCalendarI18n();
|
|
19
|
+
/** Access the date time adapter */
|
|
20
|
+
this._dateAdapter = injectDateAdapter();
|
|
21
|
+
/** Show dropdowns to navigate between months or years. */
|
|
22
|
+
this.captionLayout = input('label', ...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
23
|
+
/** Access the calendar directive */
|
|
24
|
+
this._calendar = inject(BrnCalendar);
|
|
25
|
+
/** Get the heading for the current month and year */
|
|
26
|
+
this._heading = computed(() => {
|
|
27
|
+
const config = this._i18n.config();
|
|
28
|
+
const date = this._calendar.focusedDate();
|
|
29
|
+
return {
|
|
30
|
+
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
31
|
+
month: config.formatMonth(this._dateAdapter.getMonth(date)),
|
|
32
|
+
year: config.formatYear(this._dateAdapter.getYear(date)),
|
|
33
|
+
};
|
|
34
|
+
}, ...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this._btnClass = hlm(buttonVariants({ variant: 'ghost', size: 'icon' }), 'data-[today=true]:bg-muted group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:bg-muted/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70', 'data-[outside=true]:opacity-50', "data-[highlighted]:before:content-['']", 'data-[highlighted]:before:absolute', 'data-[highlighted]:before:bottom-1', 'data-[highlighted]:before:start-1/2', 'data-[highlighted]:before:h-1', 'data-[highlighted]:before:w-1', 'data-[highlighted]:before:-translate-x-1/2', 'data-[highlighted]:before:rounded-full', 'data-[highlighted]:before:bg-destructive');
|
|
36
|
+
this._selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
37
|
+
classes(() => 'p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent');
|
|
38
|
+
}
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
40
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: HlmCalendar, isStandalone: true, selector: "hlm-calendar", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "calendar" } }, hostDirectives: [{ directive: i1.BrnCalendar, inputs: ["min", "min", "max", "max", "disabled", "disabled", "date", "date", "dateDisabled", "dateDisabled", "weekStartsOn", "weekStartsOn", "highlightDays", "highlightDays", "defaultFocusedDate", "defaultFocusedDate"], outputs: ["dateChange", "dateChange"] }], ngImport: i0, template: `
|
|
41
|
+
<div class="inline-flex flex-col gap-4">
|
|
42
|
+
<!-- Header -->
|
|
43
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
44
|
+
<ng-template #month>
|
|
45
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
46
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
47
|
+
<hlm-select-value />
|
|
48
|
+
</hlm-select-trigger>
|
|
49
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
50
|
+
<hlm-select-group>
|
|
51
|
+
@for (month of _i18n.config().months(); track month) {
|
|
52
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
53
|
+
}
|
|
54
|
+
</hlm-select-group>
|
|
55
|
+
</hlm-select-content>
|
|
56
|
+
</hlm-select>
|
|
57
|
+
</ng-template>
|
|
58
|
+
<ng-template #year>
|
|
59
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
60
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
61
|
+
<hlm-select-value />
|
|
62
|
+
</hlm-select-trigger>
|
|
63
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
64
|
+
<hlm-select-group>
|
|
65
|
+
@for (year of _i18n.config().years(); track year) {
|
|
66
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
67
|
+
}
|
|
68
|
+
</hlm-select-group>
|
|
69
|
+
</hlm-select-content>
|
|
70
|
+
</hlm-select>
|
|
71
|
+
</ng-template>
|
|
72
|
+
@let heading = _heading();
|
|
73
|
+
|
|
74
|
+
<button
|
|
75
|
+
brnCalendarPreviousButton
|
|
76
|
+
variant="ghost"
|
|
77
|
+
hlmBtn
|
|
78
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
79
|
+
>
|
|
80
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
81
|
+
</button>
|
|
82
|
+
|
|
83
|
+
@switch (captionLayout()) {
|
|
84
|
+
@case ('dropdown') {
|
|
85
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
86
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
87
|
+
}
|
|
88
|
+
@case ('dropdown-months') {
|
|
89
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
90
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
91
|
+
}
|
|
92
|
+
@case ('dropdown-years') {
|
|
93
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
94
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
95
|
+
}
|
|
96
|
+
@case ('label') {
|
|
97
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
<button
|
|
102
|
+
brnCalendarNextButton
|
|
103
|
+
hlmBtn
|
|
104
|
+
variant="ghost"
|
|
105
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
106
|
+
>
|
|
107
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
112
|
+
<thead aria-hidden="true">
|
|
113
|
+
<tr class="flex">
|
|
114
|
+
<th
|
|
115
|
+
*brnCalendarWeekday="let weekday"
|
|
116
|
+
scope="col"
|
|
117
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
118
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
119
|
+
>
|
|
120
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
121
|
+
</th>
|
|
122
|
+
</tr>
|
|
123
|
+
</thead>
|
|
124
|
+
|
|
125
|
+
<tbody role="rowgroup">
|
|
126
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
127
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
128
|
+
<td
|
|
129
|
+
brnCalendarCell
|
|
130
|
+
class="group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
131
|
+
>
|
|
132
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
133
|
+
{{ _dateAdapter.getDate(date) }}
|
|
134
|
+
</button>
|
|
135
|
+
</td>
|
|
136
|
+
}
|
|
137
|
+
</tr>
|
|
138
|
+
</tbody>
|
|
139
|
+
</table>
|
|
140
|
+
</div>
|
|
141
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: i1.BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "directive", type: i1.BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: i1.BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: i1.BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: i1.BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: i1.BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: i1.BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: i1.BrnCalendarMonthSelect, selector: "brnSelect[brnCalendarMonthSelect],hlm-select[brnCalendarMonthSelect]" }, { kind: "directive", type: i1.BrnCalendarYearSelect, selector: "brnSelect[brnCalendarYearSelect],hlm-select[brnCalendarYearSelect]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "directive", type: i2.HlmSelectGroup, selector: "[hlmSelectGroup],hlm-select-group" }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.HlmButton, selector: "button[hlmBtn], a[hlmBtn]", inputs: ["variant", "size"], exportAs: ["hlmBtn"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
142
|
+
}
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendar, decorators: [{
|
|
144
|
+
type: Component,
|
|
145
|
+
args: [{
|
|
146
|
+
selector: 'hlm-calendar',
|
|
147
|
+
imports: [BrnCalendarImports, NgIcon, HlmSelectImports, NgTemplateOutlet, HlmButtonImports],
|
|
148
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
149
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
150
|
+
hostDirectives: [
|
|
151
|
+
{
|
|
152
|
+
directive: BrnCalendar,
|
|
153
|
+
inputs: ['min', 'max', 'disabled', 'date', 'dateDisabled', 'weekStartsOn', 'highlightDays', 'defaultFocusedDate'],
|
|
154
|
+
outputs: ['dateChange'],
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
host: { 'data-slot': 'calendar' },
|
|
158
|
+
template: `
|
|
159
|
+
<div class="inline-flex flex-col gap-4">
|
|
160
|
+
<!-- Header -->
|
|
161
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
162
|
+
<ng-template #month>
|
|
163
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
164
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
165
|
+
<hlm-select-value />
|
|
166
|
+
</hlm-select-trigger>
|
|
167
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
168
|
+
<hlm-select-group>
|
|
169
|
+
@for (month of _i18n.config().months(); track month) {
|
|
170
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
171
|
+
}
|
|
172
|
+
</hlm-select-group>
|
|
173
|
+
</hlm-select-content>
|
|
174
|
+
</hlm-select>
|
|
175
|
+
</ng-template>
|
|
176
|
+
<ng-template #year>
|
|
177
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
178
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
179
|
+
<hlm-select-value />
|
|
180
|
+
</hlm-select-trigger>
|
|
181
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
182
|
+
<hlm-select-group>
|
|
183
|
+
@for (year of _i18n.config().years(); track year) {
|
|
184
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
185
|
+
}
|
|
186
|
+
</hlm-select-group>
|
|
187
|
+
</hlm-select-content>
|
|
188
|
+
</hlm-select>
|
|
189
|
+
</ng-template>
|
|
190
|
+
@let heading = _heading();
|
|
191
|
+
|
|
192
|
+
<button
|
|
193
|
+
brnCalendarPreviousButton
|
|
194
|
+
variant="ghost"
|
|
195
|
+
hlmBtn
|
|
196
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
197
|
+
>
|
|
198
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
199
|
+
</button>
|
|
200
|
+
|
|
201
|
+
@switch (captionLayout()) {
|
|
202
|
+
@case ('dropdown') {
|
|
203
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
204
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
205
|
+
}
|
|
206
|
+
@case ('dropdown-months') {
|
|
207
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
208
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
209
|
+
}
|
|
210
|
+
@case ('dropdown-years') {
|
|
211
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
212
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
213
|
+
}
|
|
214
|
+
@case ('label') {
|
|
215
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
<button
|
|
220
|
+
brnCalendarNextButton
|
|
221
|
+
hlmBtn
|
|
222
|
+
variant="ghost"
|
|
223
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
224
|
+
>
|
|
225
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
226
|
+
</button>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
230
|
+
<thead aria-hidden="true">
|
|
231
|
+
<tr class="flex">
|
|
232
|
+
<th
|
|
233
|
+
*brnCalendarWeekday="let weekday"
|
|
234
|
+
scope="col"
|
|
235
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
236
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
237
|
+
>
|
|
238
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
239
|
+
</th>
|
|
240
|
+
</tr>
|
|
241
|
+
</thead>
|
|
242
|
+
|
|
243
|
+
<tbody role="rowgroup">
|
|
244
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
245
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
246
|
+
<td
|
|
247
|
+
brnCalendarCell
|
|
248
|
+
class="group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
249
|
+
>
|
|
250
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
251
|
+
{{ _dateAdapter.getDate(date) }}
|
|
252
|
+
</button>
|
|
253
|
+
</td>
|
|
254
|
+
}
|
|
255
|
+
</tr>
|
|
256
|
+
</tbody>
|
|
257
|
+
</table>
|
|
258
|
+
</div>
|
|
259
|
+
`,
|
|
260
|
+
}]
|
|
261
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
262
|
+
|
|
263
|
+
class HlmCalendarMulti {
|
|
264
|
+
constructor() {
|
|
265
|
+
/** Show dropdowns to navigate between months or years. */
|
|
266
|
+
this.captionLayout = input('label', ...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
267
|
+
/** Access the calendar i18n */
|
|
268
|
+
this._i18n = injectBrnCalendarI18n();
|
|
269
|
+
/** Access the date time adapter */
|
|
270
|
+
this._dateAdapter = injectDateAdapter();
|
|
271
|
+
/** Access the calendar directive */
|
|
272
|
+
this._calendar = inject(BrnCalendarMulti);
|
|
273
|
+
/** Get the heading for the current month and year */
|
|
274
|
+
this._heading = computed(() => {
|
|
275
|
+
const config = this._i18n.config();
|
|
276
|
+
const date = this._calendar.focusedDate();
|
|
277
|
+
return {
|
|
278
|
+
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
279
|
+
month: config.formatMonth(this._dateAdapter.getMonth(date)),
|
|
280
|
+
year: config.formatYear(this._dateAdapter.getYear(date)),
|
|
281
|
+
};
|
|
282
|
+
}, ...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
283
|
+
this._btnClass = hlm(buttonVariants({ variant: 'ghost', size: 'icon' }), 'data-[today=true]:bg-muted group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:bg-muted/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70', 'data-[outside=true]:opacity-50', "data-[highlighted]:before:content-['']", 'data-[highlighted]:before:absolute', 'data-[highlighted]:before:bottom-1', 'data-[highlighted]:before:start-1/2', 'data-[highlighted]:before:h-1', 'data-[highlighted]:before:w-1', 'data-[highlighted]:before:-translate-x-1/2', 'data-[highlighted]:before:rounded-full', 'data-[highlighted]:before:bg-destructive');
|
|
284
|
+
this._selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
285
|
+
classes(() => 'p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent');
|
|
286
|
+
}
|
|
287
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendarMulti, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
288
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: HlmCalendarMulti, isStandalone: true, selector: "hlm-calendar-multi", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "calendar" } }, hostDirectives: [{ directive: i1.BrnCalendarMulti, inputs: ["min", "min", "max", "max", "minSelection", "minSelection", "maxSelection", "maxSelection", "disabled", "disabled", "date", "date", "dateDisabled", "dateDisabled", "weekStartsOn", "weekStartsOn", "highlightDays", "highlightDays", "defaultFocusedDate", "defaultFocusedDate"], outputs: ["dateChange", "dateChange"] }], ngImport: i0, template: `
|
|
289
|
+
<div class="inline-flex flex-col space-y-4">
|
|
290
|
+
<!-- Header -->
|
|
291
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
292
|
+
<ng-template #month>
|
|
293
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
294
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
295
|
+
<hlm-select-value />
|
|
296
|
+
</hlm-select-trigger>
|
|
297
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
298
|
+
<hlm-select-group>
|
|
299
|
+
@for (month of _i18n.config().months(); track month) {
|
|
300
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
301
|
+
}
|
|
302
|
+
</hlm-select-group>
|
|
303
|
+
</hlm-select-content>
|
|
304
|
+
</hlm-select>
|
|
305
|
+
</ng-template>
|
|
306
|
+
<ng-template #year>
|
|
307
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
308
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
309
|
+
<hlm-select-value />
|
|
310
|
+
</hlm-select-trigger>
|
|
311
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
312
|
+
<hlm-select-group>
|
|
313
|
+
@for (year of _i18n.config().years(); track year) {
|
|
314
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
315
|
+
}
|
|
316
|
+
</hlm-select-group>
|
|
317
|
+
</hlm-select-content>
|
|
318
|
+
</hlm-select>
|
|
319
|
+
</ng-template>
|
|
320
|
+
@let heading = _heading();
|
|
321
|
+
|
|
322
|
+
<button
|
|
323
|
+
brnCalendarPreviousButton
|
|
324
|
+
variant="ghost"
|
|
325
|
+
hlmBtn
|
|
326
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
327
|
+
>
|
|
328
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
329
|
+
</button>
|
|
330
|
+
|
|
331
|
+
@switch (captionLayout()) {
|
|
332
|
+
@case ('dropdown') {
|
|
333
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
334
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
335
|
+
}
|
|
336
|
+
@case ('dropdown-months') {
|
|
337
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
338
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
339
|
+
}
|
|
340
|
+
@case ('dropdown-years') {
|
|
341
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
342
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
343
|
+
}
|
|
344
|
+
@case ('label') {
|
|
345
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
<button
|
|
350
|
+
brnCalendarNextButton
|
|
351
|
+
hlmBtn
|
|
352
|
+
variant="ghost"
|
|
353
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
354
|
+
>
|
|
355
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
356
|
+
</button>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<table class="w-full border-collapse" brnCalendarGrid>
|
|
360
|
+
<thead aria-hidden="true">
|
|
361
|
+
<tr class="flex">
|
|
362
|
+
<th
|
|
363
|
+
*brnCalendarWeekday="let weekday"
|
|
364
|
+
scope="col"
|
|
365
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
366
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
367
|
+
>
|
|
368
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
369
|
+
</th>
|
|
370
|
+
</tr>
|
|
371
|
+
</thead>
|
|
372
|
+
|
|
373
|
+
<tbody role="rowgroup">
|
|
374
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
375
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
376
|
+
<td
|
|
377
|
+
brnCalendarCell
|
|
378
|
+
class="group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
379
|
+
>
|
|
380
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
381
|
+
{{ _dateAdapter.getDate(date) }}
|
|
382
|
+
</button>
|
|
383
|
+
</td>
|
|
384
|
+
}
|
|
385
|
+
</tr>
|
|
386
|
+
</tbody>
|
|
387
|
+
</table>
|
|
388
|
+
</div>
|
|
389
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: i1.BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "directive", type: i1.BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: i1.BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: i1.BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: i1.BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: i1.BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: i1.BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: i1.BrnCalendarMonthSelect, selector: "brnSelect[brnCalendarMonthSelect],hlm-select[brnCalendarMonthSelect]" }, { kind: "directive", type: i1.BrnCalendarYearSelect, selector: "brnSelect[brnCalendarYearSelect],hlm-select[brnCalendarYearSelect]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "directive", type: i2.HlmSelectGroup, selector: "[hlmSelectGroup],hlm-select-group" }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "directive", type: i3.HlmButton, selector: "button[hlmBtn], a[hlmBtn]", inputs: ["variant", "size"], exportAs: ["hlmBtn"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
390
|
+
}
|
|
391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendarMulti, decorators: [{
|
|
392
|
+
type: Component,
|
|
393
|
+
args: [{
|
|
394
|
+
selector: 'hlm-calendar-multi',
|
|
395
|
+
imports: [BrnCalendarImports, NgIcon, NgTemplateOutlet, HlmSelectImports, HlmButtonImports],
|
|
396
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
397
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
398
|
+
hostDirectives: [
|
|
399
|
+
{
|
|
400
|
+
directive: BrnCalendarMulti,
|
|
401
|
+
inputs: [
|
|
402
|
+
'min',
|
|
403
|
+
'max',
|
|
404
|
+
'minSelection',
|
|
405
|
+
'maxSelection',
|
|
406
|
+
'disabled',
|
|
407
|
+
'date',
|
|
408
|
+
'dateDisabled',
|
|
409
|
+
'weekStartsOn',
|
|
410
|
+
'highlightDays',
|
|
411
|
+
'defaultFocusedDate',
|
|
412
|
+
],
|
|
413
|
+
outputs: ['dateChange'],
|
|
414
|
+
},
|
|
415
|
+
],
|
|
416
|
+
host: { 'data-slot': 'calendar' },
|
|
417
|
+
template: `
|
|
418
|
+
<div class="inline-flex flex-col space-y-4">
|
|
419
|
+
<!-- Header -->
|
|
420
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
421
|
+
<ng-template #month>
|
|
422
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
423
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
424
|
+
<hlm-select-value />
|
|
425
|
+
</hlm-select-trigger>
|
|
426
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
427
|
+
<hlm-select-group>
|
|
428
|
+
@for (month of _i18n.config().months(); track month) {
|
|
429
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
430
|
+
}
|
|
431
|
+
</hlm-select-group>
|
|
432
|
+
</hlm-select-content>
|
|
433
|
+
</hlm-select>
|
|
434
|
+
</ng-template>
|
|
435
|
+
<ng-template #year>
|
|
436
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
437
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
438
|
+
<hlm-select-value />
|
|
439
|
+
</hlm-select-trigger>
|
|
440
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
441
|
+
<hlm-select-group>
|
|
442
|
+
@for (year of _i18n.config().years(); track year) {
|
|
443
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
444
|
+
}
|
|
445
|
+
</hlm-select-group>
|
|
446
|
+
</hlm-select-content>
|
|
447
|
+
</hlm-select>
|
|
448
|
+
</ng-template>
|
|
449
|
+
@let heading = _heading();
|
|
450
|
+
|
|
451
|
+
<button
|
|
452
|
+
brnCalendarPreviousButton
|
|
453
|
+
variant="ghost"
|
|
454
|
+
hlmBtn
|
|
455
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
456
|
+
>
|
|
457
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
458
|
+
</button>
|
|
459
|
+
|
|
460
|
+
@switch (captionLayout()) {
|
|
461
|
+
@case ('dropdown') {
|
|
462
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
463
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
464
|
+
}
|
|
465
|
+
@case ('dropdown-months') {
|
|
466
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
467
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
468
|
+
}
|
|
469
|
+
@case ('dropdown-years') {
|
|
470
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
471
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
472
|
+
}
|
|
473
|
+
@case ('label') {
|
|
474
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
<button
|
|
479
|
+
brnCalendarNextButton
|
|
480
|
+
hlmBtn
|
|
481
|
+
variant="ghost"
|
|
482
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
483
|
+
>
|
|
484
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
485
|
+
</button>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<table class="w-full border-collapse" brnCalendarGrid>
|
|
489
|
+
<thead aria-hidden="true">
|
|
490
|
+
<tr class="flex">
|
|
491
|
+
<th
|
|
492
|
+
*brnCalendarWeekday="let weekday"
|
|
493
|
+
scope="col"
|
|
494
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
495
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
496
|
+
>
|
|
497
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
498
|
+
</th>
|
|
499
|
+
</tr>
|
|
500
|
+
</thead>
|
|
501
|
+
|
|
502
|
+
<tbody role="rowgroup">
|
|
503
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
504
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
505
|
+
<td
|
|
506
|
+
brnCalendarCell
|
|
507
|
+
class="group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
508
|
+
>
|
|
509
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
510
|
+
{{ _dateAdapter.getDate(date) }}
|
|
511
|
+
</button>
|
|
512
|
+
</td>
|
|
513
|
+
}
|
|
514
|
+
</tr>
|
|
515
|
+
</tbody>
|
|
516
|
+
</table>
|
|
517
|
+
</div>
|
|
518
|
+
`,
|
|
519
|
+
}]
|
|
520
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
521
|
+
|
|
522
|
+
class HlmCalendarRange {
|
|
523
|
+
constructor() {
|
|
524
|
+
/** Show dropdowns to navigate between months or years. */
|
|
525
|
+
this.captionLayout = input('label', ...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
526
|
+
/** Access the calendar i18n */
|
|
527
|
+
this._i18n = injectBrnCalendarI18n();
|
|
528
|
+
/** Access the date time adapter */
|
|
529
|
+
this._dateAdapter = injectDateAdapter();
|
|
530
|
+
/** Access the calendar directive */
|
|
531
|
+
this._calendar = inject(BrnCalendarRange);
|
|
532
|
+
/** Get the heading for the current month and year */
|
|
533
|
+
this._heading = computed(() => {
|
|
534
|
+
const config = this._i18n.config();
|
|
535
|
+
const date = this._calendar.focusedDate();
|
|
536
|
+
return {
|
|
537
|
+
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
538
|
+
month: config.formatMonth(this._dateAdapter.getMonth(date)),
|
|
539
|
+
year: config.formatYear(this._dateAdapter.getYear(date)),
|
|
540
|
+
};
|
|
541
|
+
}, ...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
542
|
+
this._btnClass = hlm(buttonVariants({ variant: 'ghost', size: 'icon' }), 'data-[today=true]:bg-muted group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:bg-muted/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-e-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-s-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70', 'data-[outside=true]:opacity-50', "data-[highlighted]:before:content-['']", 'data-[highlighted]:before:absolute', 'data-[highlighted]:before:bottom-1', 'data-[highlighted]:before:start-1/2', 'data-[highlighted]:before:h-1', 'data-[highlighted]:before:w-1', 'data-[highlighted]:before:-translate-x-1/2', 'data-[highlighted]:before:rounded-full', 'data-[highlighted]:before:bg-destructive');
|
|
543
|
+
this._selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
544
|
+
classes(() => 'p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent');
|
|
545
|
+
}
|
|
546
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendarRange, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
547
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: HlmCalendarRange, isStandalone: true, selector: "hlm-calendar-range", inputs: { captionLayout: { classPropertyName: "captionLayout", publicName: "captionLayout", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "calendar" } }, hostDirectives: [{ directive: i1.BrnCalendarRange, inputs: ["min", "min", "max", "max", "disabled", "disabled", "startDate", "startDate", "endDate", "endDate", "dateDisabled", "dateDisabled", "weekStartsOn", "weekStartsOn", "highlightDays", "highlightDays", "defaultFocusedDate", "defaultFocusedDate"], outputs: ["endDateChange", "endDateChange", "startDateChange", "startDateChange"] }], ngImport: i0, template: `
|
|
548
|
+
<div class="inline-flex flex-col space-y-4">
|
|
549
|
+
<!-- Header -->
|
|
550
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
551
|
+
<ng-template #month>
|
|
552
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
553
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
554
|
+
<hlm-select-value />
|
|
555
|
+
</hlm-select-trigger>
|
|
556
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
557
|
+
<hlm-select-group>
|
|
558
|
+
@for (month of _i18n.config().months(); track month) {
|
|
559
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
560
|
+
}
|
|
561
|
+
</hlm-select-group>
|
|
562
|
+
</hlm-select-content>
|
|
563
|
+
</hlm-select>
|
|
564
|
+
</ng-template>
|
|
565
|
+
<ng-template #year>
|
|
566
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
567
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
568
|
+
<hlm-select-value />
|
|
569
|
+
</hlm-select-trigger>
|
|
570
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
571
|
+
<hlm-select-group>
|
|
572
|
+
@for (year of _i18n.config().years(); track year) {
|
|
573
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
574
|
+
}
|
|
575
|
+
</hlm-select-group>
|
|
576
|
+
</hlm-select-content>
|
|
577
|
+
</hlm-select>
|
|
578
|
+
</ng-template>
|
|
579
|
+
@let heading = _heading();
|
|
580
|
+
|
|
581
|
+
<button
|
|
582
|
+
brnCalendarPreviousButton
|
|
583
|
+
variant="ghost"
|
|
584
|
+
hlmBtn
|
|
585
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
586
|
+
>
|
|
587
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
588
|
+
</button>
|
|
589
|
+
|
|
590
|
+
@switch (captionLayout()) {
|
|
591
|
+
@case ('dropdown') {
|
|
592
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
593
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
594
|
+
}
|
|
595
|
+
@case ('dropdown-months') {
|
|
596
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
597
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
598
|
+
}
|
|
599
|
+
@case ('dropdown-years') {
|
|
600
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
601
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
602
|
+
}
|
|
603
|
+
@case ('label') {
|
|
604
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
<button
|
|
609
|
+
brnCalendarNextButton
|
|
610
|
+
hlmBtn
|
|
611
|
+
variant="ghost"
|
|
612
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
613
|
+
>
|
|
614
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
615
|
+
</button>
|
|
616
|
+
</div>
|
|
617
|
+
|
|
618
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
619
|
+
<thead aria-hidden="true">
|
|
620
|
+
<tr class="flex">
|
|
621
|
+
<th
|
|
622
|
+
*brnCalendarWeekday="let weekday"
|
|
623
|
+
scope="col"
|
|
624
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
625
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
626
|
+
>
|
|
627
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
628
|
+
</th>
|
|
629
|
+
</tr>
|
|
630
|
+
</thead>
|
|
631
|
+
|
|
632
|
+
<tbody role="rowgroup">
|
|
633
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
634
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
635
|
+
<td
|
|
636
|
+
brnCalendarCell
|
|
637
|
+
class="group/day has-[button[data-range-start=true]]:bg-muted has-[button[data-range-start=true]]:after:bg-muted has-[button[data-range-end=true]]:bg-muted has-[button[data-range-end=true]]:after:bg-muted relative isolate z-0 aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none has-[button[data-range-end=true]]:rounded-e-(--cell-radius) has-[button[data-range-end=true]]:after:absolute has-[button[data-range-end=true]]:after:inset-y-0 has-[button[data-range-end=true]]:after:start-0 has-[button[data-range-end=true]]:after:w-4 has-[button[data-range-start=true]]:rounded-s-(--cell-radius) has-[button[data-range-start=true]]:after:absolute has-[button[data-range-start=true]]:after:inset-y-0 has-[button[data-range-start=true]]:after:end-0 has-[button[data-range-start=true]]:after:w-4 [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
638
|
+
>
|
|
639
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
640
|
+
{{ _dateAdapter.getDate(date) }}
|
|
641
|
+
</button>
|
|
642
|
+
</td>
|
|
643
|
+
}
|
|
644
|
+
</tr>
|
|
645
|
+
</tbody>
|
|
646
|
+
</table>
|
|
647
|
+
</div>
|
|
648
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: i1.BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "directive", type: i1.BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: i1.BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: i1.BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: i1.BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: i1.BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: i1.BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: i1.BrnCalendarMonthSelect, selector: "brnSelect[brnCalendarMonthSelect],hlm-select[brnCalendarMonthSelect]" }, { kind: "directive", type: i1.BrnCalendarYearSelect, selector: "brnSelect[brnCalendarYearSelect],hlm-select[brnCalendarYearSelect]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "directive", type: i2.HlmSelectGroup, selector: "[hlmSelectGroup],hlm-select-group" }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.HlmButton, selector: "button[hlmBtn], a[hlmBtn]", inputs: ["variant", "size"], exportAs: ["hlmBtn"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
649
|
+
}
|
|
650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmCalendarRange, decorators: [{
|
|
651
|
+
type: Component,
|
|
652
|
+
args: [{
|
|
653
|
+
selector: 'hlm-calendar-range',
|
|
654
|
+
imports: [BrnCalendarImports, NgIcon, HlmSelectImports, NgTemplateOutlet, HlmButtonImports],
|
|
655
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
656
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
657
|
+
hostDirectives: [
|
|
658
|
+
{
|
|
659
|
+
directive: BrnCalendarRange,
|
|
660
|
+
inputs: [
|
|
661
|
+
'min',
|
|
662
|
+
'max',
|
|
663
|
+
'disabled',
|
|
664
|
+
'startDate',
|
|
665
|
+
'endDate',
|
|
666
|
+
'dateDisabled',
|
|
667
|
+
'weekStartsOn',
|
|
668
|
+
'highlightDays',
|
|
669
|
+
'defaultFocusedDate',
|
|
670
|
+
],
|
|
671
|
+
outputs: ['endDateChange', 'startDateChange'],
|
|
672
|
+
},
|
|
673
|
+
],
|
|
674
|
+
host: { 'data-slot': 'calendar' },
|
|
675
|
+
template: `
|
|
676
|
+
<div class="inline-flex flex-col space-y-4">
|
|
677
|
+
<!-- Header -->
|
|
678
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
679
|
+
<ng-template #month>
|
|
680
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
681
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
682
|
+
<hlm-select-value />
|
|
683
|
+
</hlm-select-trigger>
|
|
684
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
685
|
+
<hlm-select-group>
|
|
686
|
+
@for (month of _i18n.config().months(); track month) {
|
|
687
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
688
|
+
}
|
|
689
|
+
</hlm-select-group>
|
|
690
|
+
</hlm-select-content>
|
|
691
|
+
</hlm-select>
|
|
692
|
+
</ng-template>
|
|
693
|
+
<ng-template #year>
|
|
694
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
695
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
696
|
+
<hlm-select-value />
|
|
697
|
+
</hlm-select-trigger>
|
|
698
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
699
|
+
<hlm-select-group>
|
|
700
|
+
@for (year of _i18n.config().years(); track year) {
|
|
701
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
702
|
+
}
|
|
703
|
+
</hlm-select-group>
|
|
704
|
+
</hlm-select-content>
|
|
705
|
+
</hlm-select>
|
|
706
|
+
</ng-template>
|
|
707
|
+
@let heading = _heading();
|
|
708
|
+
|
|
709
|
+
<button
|
|
710
|
+
brnCalendarPreviousButton
|
|
711
|
+
variant="ghost"
|
|
712
|
+
hlmBtn
|
|
713
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
714
|
+
>
|
|
715
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
716
|
+
</button>
|
|
717
|
+
|
|
718
|
+
@switch (captionLayout()) {
|
|
719
|
+
@case ('dropdown') {
|
|
720
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
721
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
722
|
+
}
|
|
723
|
+
@case ('dropdown-months') {
|
|
724
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
725
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
726
|
+
}
|
|
727
|
+
@case ('dropdown-years') {
|
|
728
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
729
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
730
|
+
}
|
|
731
|
+
@case ('label') {
|
|
732
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
<button
|
|
737
|
+
brnCalendarNextButton
|
|
738
|
+
hlmBtn
|
|
739
|
+
variant="ghost"
|
|
740
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
741
|
+
>
|
|
742
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
743
|
+
</button>
|
|
744
|
+
</div>
|
|
745
|
+
|
|
746
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
747
|
+
<thead aria-hidden="true">
|
|
748
|
+
<tr class="flex">
|
|
749
|
+
<th
|
|
750
|
+
*brnCalendarWeekday="let weekday"
|
|
751
|
+
scope="col"
|
|
752
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
753
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
754
|
+
>
|
|
755
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
756
|
+
</th>
|
|
757
|
+
</tr>
|
|
758
|
+
</thead>
|
|
759
|
+
|
|
760
|
+
<tbody role="rowgroup">
|
|
761
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
762
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
763
|
+
<td
|
|
764
|
+
brnCalendarCell
|
|
765
|
+
class="group/day has-[button[data-range-start=true]]:bg-muted has-[button[data-range-start=true]]:after:bg-muted has-[button[data-range-end=true]]:bg-muted has-[button[data-range-end=true]]:after:bg-muted relative isolate z-0 aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none has-[button[data-range-end=true]]:rounded-e-(--cell-radius) has-[button[data-range-end=true]]:after:absolute has-[button[data-range-end=true]]:after:inset-y-0 has-[button[data-range-end=true]]:after:start-0 has-[button[data-range-end=true]]:after:w-4 has-[button[data-range-start=true]]:rounded-s-(--cell-radius) has-[button[data-range-start=true]]:after:absolute has-[button[data-range-start=true]]:after:inset-y-0 has-[button[data-range-start=true]]:after:end-0 has-[button[data-range-start=true]]:after:w-4 [&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius) [&:last-child[data-selected=true]_button]:rounded-e-(--cell-radius)"
|
|
766
|
+
>
|
|
767
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
768
|
+
{{ _dateAdapter.getDate(date) }}
|
|
769
|
+
</button>
|
|
770
|
+
</td>
|
|
771
|
+
}
|
|
772
|
+
</tr>
|
|
773
|
+
</tbody>
|
|
774
|
+
</table>
|
|
775
|
+
</div>
|
|
776
|
+
`,
|
|
777
|
+
}]
|
|
778
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
779
|
+
|
|
780
|
+
class HlmMonthYearCalendar {
|
|
781
|
+
constructor() {
|
|
782
|
+
/** Access the calendar i18n */
|
|
783
|
+
this._i18n = injectBrnCalendarI18n();
|
|
784
|
+
/** Access the date adapter */
|
|
785
|
+
this._dateAdapter = injectDateAdapter();
|
|
786
|
+
/** Access the picker directive */
|
|
787
|
+
this._picker = inject((BrnMonthYearCalendar));
|
|
788
|
+
/** The heading for the current view. */
|
|
789
|
+
this._heading = computed(() => {
|
|
790
|
+
const config = this._i18n.config();
|
|
791
|
+
if (this._picker.view() === 'month') {
|
|
792
|
+
return config.formatYear(this._dateAdapter.getYear(this._picker.focusedDate()));
|
|
793
|
+
}
|
|
794
|
+
const { start, end } = this._picker.yearRange();
|
|
795
|
+
return `${config.formatYear(start)} – ${config.formatYear(end)}`;
|
|
796
|
+
}, ...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
797
|
+
this._btnClass = hlm(buttonVariants({ variant: 'ghost' }), 'data-[today=true]:bg-muted', 'data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground data-[selected=true]:hover:bg-primary data-[selected=true]:hover:text-primary-foreground', 'data-[focused=true]:border-ring data-[focused=true]:ring-ring/50 data-[focused=true]:ring-[3px]', 'aria-disabled:pointer-events-none aria-disabled:opacity-50', 'h-(--cell-size)');
|
|
798
|
+
classes(() => 'p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent');
|
|
799
|
+
}
|
|
800
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmMonthYearCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
801
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: HlmMonthYearCalendar, isStandalone: true, selector: "hlm-month-year-calendar", host: { attributes: { "data-slot": "month-year-calendar" } }, hostDirectives: [{ directive: i1.BrnMonthYearCalendar, inputs: ["min", "min", "max", "max", "disabled", "disabled", "date", "date", "defaultFocusedDate", "defaultFocusedDate", "view", "view"], outputs: ["dateChange", "dateChange"] }], ngImport: i0, template: `
|
|
802
|
+
<div class="flex flex-col gap-4">
|
|
803
|
+
<!-- Header -->
|
|
804
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
805
|
+
<button
|
|
806
|
+
brnMonthYearCalendarPreviousButton
|
|
807
|
+
hlmBtn
|
|
808
|
+
variant="ghost"
|
|
809
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
810
|
+
>
|
|
811
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
812
|
+
</button>
|
|
813
|
+
|
|
814
|
+
<button
|
|
815
|
+
hlmBtn
|
|
816
|
+
variant="ghost"
|
|
817
|
+
class="h-(--cell-size) py-0 select-none aria-disabled:opacity-50"
|
|
818
|
+
brnMonthYearCalendarHeader
|
|
819
|
+
>
|
|
820
|
+
{{ _heading() }}
|
|
821
|
+
</button>
|
|
822
|
+
|
|
823
|
+
<button
|
|
824
|
+
brnMonthYearCalendarNextButton
|
|
825
|
+
hlmBtn
|
|
826
|
+
variant="ghost"
|
|
827
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
828
|
+
>
|
|
829
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
830
|
+
</button>
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
<!-- Grid -->
|
|
834
|
+
@switch (_picker.view()) {
|
|
835
|
+
@case ('year') {
|
|
836
|
+
<div brnMonthYearCalendarGrid class="grid grid-cols-4 gap-2">
|
|
837
|
+
@for (year of _picker.years(); track _dateAdapter.getYear(year)) {
|
|
838
|
+
<button brnMonthYearCalendarYearButton [date]="year" [class]="_btnClass">
|
|
839
|
+
{{ _i18n.config().formatYear(_dateAdapter.getYear(year)) }}
|
|
840
|
+
</button>
|
|
841
|
+
}
|
|
842
|
+
</div>
|
|
843
|
+
}
|
|
844
|
+
@case ('month') {
|
|
845
|
+
<div brnMonthYearCalendarGrid class="grid grid-cols-4 gap-2">
|
|
846
|
+
@for (month of _picker.months(); track _dateAdapter.getMonth(month)) {
|
|
847
|
+
<button brnMonthYearCalendarMonthButton [date]="month" [class]="_btnClass">
|
|
848
|
+
{{ _i18n.config().months()[_dateAdapter.getMonth(month)] }}
|
|
849
|
+
</button>
|
|
850
|
+
}
|
|
851
|
+
</div>
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
</div>
|
|
855
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.BrnMonthYearCalendarGrid, selector: "[brnMonthYearCalendarGrid]" }, { kind: "directive", type: i1.BrnMonthYearCalendarHeader, selector: "button[brnMonthYearCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: i1.BrnMonthYearCalendarMonthButton, selector: "button[brnMonthYearCalendarMonthButton]", inputs: ["date"] }, { kind: "directive", type: i1.BrnMonthYearCalendarNextButton, selector: "button[brnMonthYearCalendarNextButton]" }, { kind: "directive", type: i1.BrnMonthYearCalendarPreviousButton, selector: "button[brnMonthYearCalendarPreviousButton]" }, { kind: "directive", type: i1.BrnMonthYearCalendarYearButton, selector: "button[brnMonthYearCalendarYearButton]", inputs: ["date"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: i3.HlmButton, selector: "button[hlmBtn], a[hlmBtn]", inputs: ["variant", "size"], exportAs: ["hlmBtn"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
856
|
+
}
|
|
857
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: HlmMonthYearCalendar, decorators: [{
|
|
858
|
+
type: Component,
|
|
859
|
+
args: [{
|
|
860
|
+
selector: 'hlm-month-year-calendar',
|
|
861
|
+
imports: [BrnCalendarImports, NgIcon, HlmButtonImports],
|
|
862
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
863
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
864
|
+
hostDirectives: [
|
|
865
|
+
{
|
|
866
|
+
directive: BrnMonthYearCalendar,
|
|
867
|
+
inputs: ['min', 'max', 'disabled', 'date', 'defaultFocusedDate', 'view'],
|
|
868
|
+
outputs: ['dateChange'],
|
|
869
|
+
},
|
|
870
|
+
],
|
|
871
|
+
host: { 'data-slot': 'month-year-calendar' },
|
|
872
|
+
template: `
|
|
873
|
+
<div class="flex flex-col gap-4">
|
|
874
|
+
<!-- Header -->
|
|
875
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
876
|
+
<button
|
|
877
|
+
brnMonthYearCalendarPreviousButton
|
|
878
|
+
hlmBtn
|
|
879
|
+
variant="ghost"
|
|
880
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
881
|
+
>
|
|
882
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
883
|
+
</button>
|
|
884
|
+
|
|
885
|
+
<button
|
|
886
|
+
hlmBtn
|
|
887
|
+
variant="ghost"
|
|
888
|
+
class="h-(--cell-size) py-0 select-none aria-disabled:opacity-50"
|
|
889
|
+
brnMonthYearCalendarHeader
|
|
890
|
+
>
|
|
891
|
+
{{ _heading() }}
|
|
892
|
+
</button>
|
|
893
|
+
|
|
894
|
+
<button
|
|
895
|
+
brnMonthYearCalendarNextButton
|
|
896
|
+
hlmBtn
|
|
897
|
+
variant="ghost"
|
|
898
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
899
|
+
>
|
|
900
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
901
|
+
</button>
|
|
902
|
+
</div>
|
|
903
|
+
|
|
904
|
+
<!-- Grid -->
|
|
905
|
+
@switch (_picker.view()) {
|
|
906
|
+
@case ('year') {
|
|
907
|
+
<div brnMonthYearCalendarGrid class="grid grid-cols-4 gap-2">
|
|
908
|
+
@for (year of _picker.years(); track _dateAdapter.getYear(year)) {
|
|
909
|
+
<button brnMonthYearCalendarYearButton [date]="year" [class]="_btnClass">
|
|
910
|
+
{{ _i18n.config().formatYear(_dateAdapter.getYear(year)) }}
|
|
911
|
+
</button>
|
|
912
|
+
}
|
|
913
|
+
</div>
|
|
914
|
+
}
|
|
915
|
+
@case ('month') {
|
|
916
|
+
<div brnMonthYearCalendarGrid class="grid grid-cols-4 gap-2">
|
|
917
|
+
@for (month of _picker.months(); track _dateAdapter.getMonth(month)) {
|
|
918
|
+
<button brnMonthYearCalendarMonthButton [date]="month" [class]="_btnClass">
|
|
919
|
+
{{ _i18n.config().months()[_dateAdapter.getMonth(month)] }}
|
|
920
|
+
</button>
|
|
921
|
+
}
|
|
922
|
+
</div>
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
</div>
|
|
926
|
+
`,
|
|
927
|
+
}]
|
|
928
|
+
}], ctorParameters: () => [] });
|
|
929
|
+
|
|
930
|
+
const HlmCalendarImports = [HlmCalendar, HlmCalendarMulti, HlmCalendarRange, HlmMonthYearCalendar];
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Generated bundle index. Do not edit.
|
|
934
|
+
*/
|
|
935
|
+
|
|
936
|
+
export { HlmCalendar, HlmCalendarImports, HlmCalendarMulti, HlmCalendarRange, HlmMonthYearCalendar };
|
|
937
|
+
//# sourceMappingURL=yukit-web-helm-calendar.mjs.map
|