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