@egose/shadcn-theme-ng 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 +148 -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 +58 -53
- 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 +391 -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 +69 -63
- package/badge/package.json +25 -0
- package/basic-alert/README.md +2 -63
- package/basic-alert/fesm2022/basic-alert.mjs +14 -22
- package/basic-alert/package.json +24 -0
- package/breadcrumb/README.md +11 -0
- package/breadcrumb/fesm2022/breadcrumb.mjs +218 -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 +201 -177
- 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 +178 -570
- 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 +267 -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 +113 -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 +547 -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 +301 -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 +79 -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 +1104 -352
- 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 +281 -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 +261 -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 +351 -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 +94 -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 +74 -120
- 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 +98 -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 +85 -141
- 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 +86 -171
- 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 +77 -128
- 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 +388 -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 +455 -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 +194 -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 +522 -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 +103 -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 +136 -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 +340 -198
- 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 +56 -61
- package/sheet/package.json +24 -0
- package/sidebar/README.md +11 -0
- package/sidebar/fesm2022/sidebar.mjs +846 -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 +74 -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 +34 -39
- package/sonner/package.json +25 -0
- package/spinner/README.md +2 -63
- package/spinner/fesm2022/spinner.mjs +20 -16
- package/spinner/package.json +25 -0
- package/switch/README.md +2 -63
- package/switch/fesm2022/switch.mjs +28 -27
- 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 +210 -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/basic-alert/{index.d.ts → types/basic-alert.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,235 @@
|
|
|
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/button';
|
|
10
|
+
import { buttonVariants, HlmButtonImports } from '@egose/shadcn-theme-ng/button';
|
|
11
|
+
import * as i2 from '@egose/shadcn-theme-ng/select';
|
|
12
|
+
import { HlmSelectImports } from '@egose/shadcn-theme-ng/select';
|
|
13
|
+
import { hlm, classes } from '@egose/shadcn-theme-ng/utils';
|
|
10
14
|
|
|
11
15
|
class HlmCalendar {
|
|
12
|
-
calendarClass = input('', ...(ngDevMode ? [{ debugName: "calendarClass" }] : []));
|
|
13
|
-
_computedCalenderClass = computed(() => hlm('rounded-md border 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
|
-
<div class="inline-flex flex-col space-y-4">
|
|
57
|
-
<!-- Header -->
|
|
58
|
-
<div class="space-y-4">
|
|
59
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
60
|
-
<div brnCalendarHeader class="text-sm font-medium">
|
|
61
|
-
{{ _heading() }}
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="flex items-center space-x-1">
|
|
65
|
-
<button
|
|
66
|
-
brnCalendarPreviousButton
|
|
67
|
-
class="focus-visible:ring-ring hover:bg-secondary hover:text-secondary-foreground text-popover-foreground absolute left-1 inline-flex size-8 items-center justify-center whitespace-nowrap rounded-md bg-transparent p-0 text-sm font-medium transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
68
|
-
>
|
|
69
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
70
|
-
</button>
|
|
71
|
-
|
|
72
|
-
<button
|
|
73
|
-
brnCalendarNextButton
|
|
74
|
-
class="focus-visible:ring-ring hover:bg-secondary hover:text-secondary-foreground text-popover-foreground absolute right-1 inline-flex size-8 items-center justify-center whitespace-nowrap rounded-md bg-transparent p-0 text-sm font-medium transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
75
|
-
>
|
|
76
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
77
|
-
</button>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
83
|
-
<thead>
|
|
84
|
-
<tr class="flex">
|
|
85
|
-
<th
|
|
86
|
-
*brnCalendarWeekday="let weekday"
|
|
87
|
-
scope="col"
|
|
88
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
89
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
90
|
-
>
|
|
91
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
92
|
-
</th>
|
|
93
|
-
</tr>
|
|
94
|
-
</thead>
|
|
95
|
-
|
|
96
|
-
<tbody role="rowgroup">
|
|
97
|
-
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
98
|
-
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
99
|
-
<td
|
|
100
|
-
brnCalendarCell
|
|
101
|
-
class="data-[selected]:data-[outside]:bg-secondary/50 data-[selected]:bg-secondary relative size-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
102
|
-
>
|
|
103
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
104
|
-
{{ _dateAdapter.getDate(date) }}
|
|
105
|
-
</button>
|
|
106
|
-
</td>
|
|
107
|
-
}
|
|
108
|
-
</tr>
|
|
109
|
-
</tbody>
|
|
110
|
-
</table>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: BrnCalendar, selector: "[brnCalendar]", inputs: ["min", "max", "disabled", "date", "dateDisabled", "weekStartsOn", "defaultFocusedDate"], outputs: ["dateChange"] }, { kind: "directive", type: BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
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' }), "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");
|
|
37
|
+
_selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
38
|
+
constructor() {
|
|
39
|
+
classes(() => "p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent 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: "\n <div class=\"inline-flex flex-col gap-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse space-y-1\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ", 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
43
|
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendar, decorators: [{
|
|
116
45
|
type: Component,
|
|
117
46
|
args: [{
|
|
118
47
|
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
|
-
],
|
|
48
|
+
imports: [BrnCalendarImports, NgIcon, HlmSelectImports, NgTemplateOutlet, HlmButtonImports],
|
|
132
49
|
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
133
|
-
template: `
|
|
134
|
-
<div
|
|
135
|
-
brnCalendar
|
|
136
|
-
[min]="min()"
|
|
137
|
-
[max]="max()"
|
|
138
|
-
[disabled]="disabled()"
|
|
139
|
-
[(date)]="date"
|
|
140
|
-
[dateDisabled]="dateDisabled()"
|
|
141
|
-
[weekStartsOn]="weekStartsOn()"
|
|
142
|
-
[defaultFocusedDate]="defaultFocusedDate()"
|
|
143
|
-
[class]="_computedCalenderClass()"
|
|
144
|
-
>
|
|
145
|
-
<div class="inline-flex flex-col space-y-4">
|
|
146
|
-
<!-- Header -->
|
|
147
|
-
<div class="space-y-4">
|
|
148
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
149
|
-
<div brnCalendarHeader class="text-sm font-medium">
|
|
150
|
-
{{ _heading() }}
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div class="flex items-center space-x-1">
|
|
154
|
-
<button
|
|
155
|
-
brnCalendarPreviousButton
|
|
156
|
-
class="focus-visible:ring-ring hover:bg-secondary hover:text-secondary-foreground text-popover-foreground absolute left-1 inline-flex size-8 items-center justify-center whitespace-nowrap rounded-md bg-transparent p-0 text-sm font-medium transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
157
|
-
>
|
|
158
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
159
|
-
</button>
|
|
160
|
-
|
|
161
|
-
<button
|
|
162
|
-
brnCalendarNextButton
|
|
163
|
-
class="focus-visible:ring-ring hover:bg-secondary hover:text-secondary-foreground text-popover-foreground absolute right-1 inline-flex size-8 items-center justify-center whitespace-nowrap rounded-md bg-transparent p-0 text-sm font-medium transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
164
|
-
>
|
|
165
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
166
|
-
</button>
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
172
|
-
<thead>
|
|
173
|
-
<tr class="flex">
|
|
174
|
-
<th
|
|
175
|
-
*brnCalendarWeekday="let weekday"
|
|
176
|
-
scope="col"
|
|
177
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
178
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
179
|
-
>
|
|
180
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
181
|
-
</th>
|
|
182
|
-
</tr>
|
|
183
|
-
</thead>
|
|
184
|
-
|
|
185
|
-
<tbody role="rowgroup">
|
|
186
|
-
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
187
|
-
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
188
|
-
<td
|
|
189
|
-
brnCalendarCell
|
|
190
|
-
class="data-[selected]:data-[outside]:bg-secondary/50 data-[selected]:bg-secondary relative size-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
191
|
-
>
|
|
192
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
193
|
-
{{ _dateAdapter.getDate(date) }}
|
|
194
|
-
</button>
|
|
195
|
-
</td>
|
|
196
|
-
}
|
|
197
|
-
</tr>
|
|
198
|
-
</tbody>
|
|
199
|
-
</table>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
`,
|
|
203
50
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
51
|
+
hostDirectives: [
|
|
52
|
+
{
|
|
53
|
+
directive: BrnCalendar,
|
|
54
|
+
inputs: ['min', 'max', 'disabled', 'date', 'dateDisabled', 'weekStartsOn', 'highlightDays', 'defaultFocusedDate'],
|
|
55
|
+
outputs: ['dateChange'],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
host: { 'data-slot': 'calendar' },
|
|
59
|
+
template: "\n <div class=\"inline-flex flex-col gap-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse space-y-1\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ",
|
|
204
60
|
}]
|
|
205
|
-
}],
|
|
61
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
206
62
|
|
|
207
63
|
class HlmCalendarMulti {
|
|
208
|
-
|
|
209
|
-
|
|
64
|
+
/** Show dropdowns to navigate between months or years. */
|
|
65
|
+
captionLayout = input('label', /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
210
67
|
/** Access the calendar i18n */
|
|
211
68
|
_i18n = injectBrnCalendarI18n();
|
|
212
69
|
/** Access the date time adapter */
|
|
213
70
|
_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
71
|
/** Access the calendar directive */
|
|
241
|
-
_calendar =
|
|
72
|
+
_calendar = inject(BrnCalendarMulti);
|
|
242
73
|
/** 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
|
-
[class]="_computedCalenderClass()"
|
|
261
|
-
>
|
|
262
|
-
<div class="inline-flex flex-col space-y-4">
|
|
263
|
-
<!-- Header -->
|
|
264
|
-
<div class="space-y-4">
|
|
265
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
266
|
-
<div brnCalendarHeader class="text-sm font-medium">
|
|
267
|
-
{{ _heading() }}
|
|
268
|
-
</div>
|
|
269
|
-
|
|
270
|
-
<div class="flex items-center space-x-1">
|
|
271
|
-
<button
|
|
272
|
-
brnCalendarPreviousButton
|
|
273
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute left-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
274
|
-
>
|
|
275
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
276
|
-
</button>
|
|
277
|
-
|
|
278
|
-
<button
|
|
279
|
-
brnCalendarNextButton
|
|
280
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute right-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
281
|
-
>
|
|
282
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
283
|
-
</button>
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
|
|
288
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
289
|
-
<thead>
|
|
290
|
-
<tr class="flex">
|
|
291
|
-
<th
|
|
292
|
-
*brnCalendarWeekday="let weekday"
|
|
293
|
-
scope="col"
|
|
294
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
295
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
296
|
-
>
|
|
297
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
298
|
-
</th>
|
|
299
|
-
</tr>
|
|
300
|
-
</thead>
|
|
301
|
-
|
|
302
|
-
<tbody role="rowgroup">
|
|
303
|
-
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
304
|
-
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
305
|
-
<td
|
|
306
|
-
brnCalendarCell
|
|
307
|
-
class="data-[selected]:data-[outside]:bg-accent/50 data-[selected]:bg-accent relative h-8 w-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
308
|
-
>
|
|
309
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
310
|
-
{{ _dateAdapter.getDate(date) }}
|
|
311
|
-
</button>
|
|
312
|
-
</td>
|
|
313
|
-
}
|
|
314
|
-
</tr>
|
|
315
|
-
</tbody>
|
|
316
|
-
</table>
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: BrnCalendarMulti, selector: "[brnCalendarMulti]", inputs: ["min", "max", "minSelection", "maxSelection", "disabled", "date", "dateDisabled", "weekStartsOn", "defaultFocusedDate"], outputs: ["dateChange"] }, { kind: "directive", type: BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
74
|
+
_heading = computed(() => {
|
|
75
|
+
const config = this._i18n.config();
|
|
76
|
+
const date = this._calendar.focusedDate();
|
|
77
|
+
return {
|
|
78
|
+
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
79
|
+
month: config.formatMonth(this._dateAdapter.getMonth(date)),
|
|
80
|
+
year: config.formatYear(this._dateAdapter.getYear(date)),
|
|
81
|
+
};
|
|
82
|
+
}, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
84
|
+
_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");
|
|
85
|
+
_selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
86
|
+
constructor() {
|
|
87
|
+
classes(() => "p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent");
|
|
88
|
+
}
|
|
89
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarMulti, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
90
|
+
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: "\n <div class=\"inline-flex flex-col space-y-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ", 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
91
|
}
|
|
321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarMulti, decorators: [{
|
|
322
93
|
type: Component,
|
|
323
94
|
args: [{
|
|
324
95
|
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
|
-
],
|
|
96
|
+
imports: [BrnCalendarImports, NgIcon, NgTemplateOutlet, HlmSelectImports, HlmButtonImports],
|
|
338
97
|
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
339
|
-
template: `
|
|
340
|
-
<div
|
|
341
|
-
brnCalendarMulti
|
|
342
|
-
[min]="min()"
|
|
343
|
-
[max]="max()"
|
|
344
|
-
[minSelection]="minSelection()"
|
|
345
|
-
[maxSelection]="maxSelection()"
|
|
346
|
-
[disabled]="disabled()"
|
|
347
|
-
[(date)]="date"
|
|
348
|
-
[dateDisabled]="dateDisabled()"
|
|
349
|
-
[weekStartsOn]="weekStartsOn()"
|
|
350
|
-
[defaultFocusedDate]="defaultFocusedDate()"
|
|
351
|
-
[class]="_computedCalenderClass()"
|
|
352
|
-
>
|
|
353
|
-
<div class="inline-flex flex-col space-y-4">
|
|
354
|
-
<!-- Header -->
|
|
355
|
-
<div class="space-y-4">
|
|
356
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
357
|
-
<div brnCalendarHeader class="text-sm font-medium">
|
|
358
|
-
{{ _heading() }}
|
|
359
|
-
</div>
|
|
360
|
-
|
|
361
|
-
<div class="flex items-center space-x-1">
|
|
362
|
-
<button
|
|
363
|
-
brnCalendarPreviousButton
|
|
364
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute left-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
365
|
-
>
|
|
366
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
367
|
-
</button>
|
|
368
|
-
|
|
369
|
-
<button
|
|
370
|
-
brnCalendarNextButton
|
|
371
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute right-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
372
|
-
>
|
|
373
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
374
|
-
</button>
|
|
375
|
-
</div>
|
|
376
|
-
</div>
|
|
377
|
-
</div>
|
|
378
|
-
|
|
379
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
380
|
-
<thead>
|
|
381
|
-
<tr class="flex">
|
|
382
|
-
<th
|
|
383
|
-
*brnCalendarWeekday="let weekday"
|
|
384
|
-
scope="col"
|
|
385
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
386
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
387
|
-
>
|
|
388
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
389
|
-
</th>
|
|
390
|
-
</tr>
|
|
391
|
-
</thead>
|
|
392
|
-
|
|
393
|
-
<tbody role="rowgroup">
|
|
394
|
-
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
395
|
-
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
396
|
-
<td
|
|
397
|
-
brnCalendarCell
|
|
398
|
-
class="data-[selected]:data-[outside]:bg-accent/50 data-[selected]:bg-accent relative h-8 w-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
399
|
-
>
|
|
400
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
401
|
-
{{ _dateAdapter.getDate(date) }}
|
|
402
|
-
</button>
|
|
403
|
-
</td>
|
|
404
|
-
}
|
|
405
|
-
</tr>
|
|
406
|
-
</tbody>
|
|
407
|
-
</table>
|
|
408
|
-
</div>
|
|
409
|
-
</div>
|
|
410
|
-
`,
|
|
411
98
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
99
|
+
hostDirectives: [
|
|
100
|
+
{
|
|
101
|
+
directive: BrnCalendarMulti,
|
|
102
|
+
inputs: [
|
|
103
|
+
'min',
|
|
104
|
+
'max',
|
|
105
|
+
'minSelection',
|
|
106
|
+
'maxSelection',
|
|
107
|
+
'disabled',
|
|
108
|
+
'date',
|
|
109
|
+
'dateDisabled',
|
|
110
|
+
'weekStartsOn',
|
|
111
|
+
'highlightDays',
|
|
112
|
+
'defaultFocusedDate',
|
|
113
|
+
],
|
|
114
|
+
outputs: ['dateChange'],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
host: { 'data-slot': 'calendar' },
|
|
118
|
+
template: "\n <div class=\"inline-flex flex-col space-y-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ",
|
|
412
119
|
}]
|
|
413
|
-
}],
|
|
120
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
414
121
|
|
|
415
122
|
class HlmCalendarRange {
|
|
416
|
-
|
|
417
|
-
|
|
123
|
+
/** Show dropdowns to navigate between months or years. */
|
|
124
|
+
captionLayout = input('label', /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "captionLayout" }] : /* istanbul ignore next */ []));
|
|
418
126
|
/** Access the calendar i18n */
|
|
419
127
|
_i18n = injectBrnCalendarI18n();
|
|
420
128
|
/** Access the date time adapter */
|
|
421
129
|
_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
130
|
/** Access the calendar directive */
|
|
443
|
-
_calendar =
|
|
131
|
+
_calendar = inject(BrnCalendarRange);
|
|
444
132
|
/** 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
|
-
[class]="
|
|
462
|
-
>
|
|
463
|
-
<div class="inline-flex flex-col space-y-4">
|
|
464
|
-
<!-- Header -->
|
|
465
|
-
<div class="space-y-4">
|
|
466
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
467
|
-
<div brnCalendarHeader class="text-sm font-medium">
|
|
468
|
-
{{ _heading() }}
|
|
469
|
-
</div>
|
|
470
|
-
|
|
471
|
-
<div class="flex items-center space-x-1">
|
|
472
|
-
<button
|
|
473
|
-
brnCalendarPreviousButton
|
|
474
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute left-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
475
|
-
>
|
|
476
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
477
|
-
</button>
|
|
478
|
-
|
|
479
|
-
<button
|
|
480
|
-
brnCalendarNextButton
|
|
481
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute right-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
482
|
-
>
|
|
483
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
484
|
-
</button>
|
|
485
|
-
</div>
|
|
486
|
-
</div>
|
|
487
|
-
</div>
|
|
488
|
-
|
|
489
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
490
|
-
<thead>
|
|
491
|
-
<tr class="flex">
|
|
492
|
-
<th
|
|
493
|
-
*brnCalendarWeekday="let weekday"
|
|
494
|
-
scope="col"
|
|
495
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
496
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
497
|
-
>
|
|
498
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
499
|
-
</th>
|
|
500
|
-
</tr>
|
|
501
|
-
</thead>
|
|
502
|
-
|
|
503
|
-
<tbody role="rowgroup">
|
|
504
|
-
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
505
|
-
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
506
|
-
<td
|
|
507
|
-
brnCalendarCell
|
|
508
|
-
class="data-[selected]:data-[outside]:bg-accent/50 data-[selected]:bg-accent relative h-8 w-8 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
509
|
-
>
|
|
510
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
511
|
-
{{ _dateAdapter.getDate(date) }}
|
|
512
|
-
</button>
|
|
513
|
-
</td>
|
|
514
|
-
}
|
|
515
|
-
</tr>
|
|
516
|
-
</tbody>
|
|
517
|
-
</table>
|
|
518
|
-
</div>
|
|
519
|
-
</div>
|
|
520
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: BrnCalendarHeader, selector: "[brnCalendarHeader]", inputs: ["id"] }, { kind: "directive", type: BrnCalendarNextButton, selector: "[brnCalendarNextButton]" }, { kind: "directive", type: BrnCalendarPreviousButton, selector: "[brnCalendarPreviousButton]" }, { kind: "directive", type: BrnCalendarWeekday, selector: "[brnCalendarWeekday]" }, { kind: "directive", type: BrnCalendarWeek, selector: "[brnCalendarWeek]" }, { kind: "directive", type: BrnCalendarCellButton, selector: "button[brnCalendarCellButton]", inputs: ["date"] }, { kind: "directive", type: BrnCalendarCell, selector: "[brnCalendarCell]" }, { kind: "directive", type: BrnCalendarGrid, selector: "[brnCalendarGrid]" }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }, { kind: "directive", type: HlmIcon, selector: "ng-icon[hlm]", inputs: ["size"] }, { kind: "directive", type: BrnCalendarRange, selector: "[brnCalendarRange]", inputs: ["min", "max", "disabled", "dateDisabled", "weekStartsOn", "defaultFocusedDate", "startDate", "endDate"], outputs: ["startDateChange", "endDateChange"] }], viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
133
|
+
_heading = computed(() => {
|
|
134
|
+
const config = this._i18n.config();
|
|
135
|
+
const date = this._calendar.focusedDate();
|
|
136
|
+
return {
|
|
137
|
+
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
138
|
+
month: config.formatMonth(this._dateAdapter.getMonth(date)),
|
|
139
|
+
year: config.formatYear(this._dateAdapter.getYear(date)),
|
|
140
|
+
};
|
|
141
|
+
}, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
143
|
+
_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");
|
|
144
|
+
_selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
145
|
+
constructor() {
|
|
146
|
+
classes(() => "p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent");
|
|
147
|
+
}
|
|
148
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarRange, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
149
|
+
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: "\n <div class=\"inline-flex flex-col space-y-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse space-y-1\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ", 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
150
|
}
|
|
522
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarRange, decorators: [{
|
|
523
152
|
type: Component,
|
|
524
153
|
args: [{
|
|
525
154
|
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
|
-
],
|
|
155
|
+
imports: [BrnCalendarImports, NgIcon, HlmSelectImports, NgTemplateOutlet, HlmButtonImports],
|
|
539
156
|
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
</div>
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
<button
|
|
563
|
-
brnCalendarPreviousButton
|
|
564
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute left-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
565
|
-
>
|
|
566
|
-
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
567
|
-
</button>
|
|
568
|
-
|
|
569
|
-
<button
|
|
570
|
-
brnCalendarNextButton
|
|
571
|
-
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute right-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
572
|
-
>
|
|
573
|
-
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
574
|
-
</button>
|
|
575
|
-
</div>
|
|
576
|
-
</div>
|
|
577
|
-
</div>
|
|
578
|
-
|
|
579
|
-
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
580
|
-
<thead>
|
|
581
|
-
<tr class="flex">
|
|
582
|
-
<th
|
|
583
|
-
*brnCalendarWeekday="let weekday"
|
|
584
|
-
scope="col"
|
|
585
|
-
class="text-muted-foreground w-8 rounded-md text-[0.8rem] font-normal"
|
|
586
|
-
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
587
|
-
>
|
|
588
|
-
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
589
|
-
</th>
|
|
590
|
-
</tr>
|
|
591
|
-
</thead>
|
|
157
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
158
|
+
hostDirectives: [
|
|
159
|
+
{
|
|
160
|
+
directive: BrnCalendarRange,
|
|
161
|
+
inputs: [
|
|
162
|
+
'min',
|
|
163
|
+
'max',
|
|
164
|
+
'disabled',
|
|
165
|
+
'startDate',
|
|
166
|
+
'endDate',
|
|
167
|
+
'dateDisabled',
|
|
168
|
+
'weekStartsOn',
|
|
169
|
+
'highlightDays',
|
|
170
|
+
'defaultFocusedDate',
|
|
171
|
+
],
|
|
172
|
+
outputs: ['endDateChange', 'startDateChange'],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
host: { 'data-slot': 'calendar' },
|
|
176
|
+
template: "\n <div class=\"inline-flex flex-col space-y-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <ng-template #month>\n <hlm-select brnCalendarMonthSelect class=\"order-1\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (month of _i18n.config().months(); track month) {\n <hlm-select-item [value]=\"month\">{{ month }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n <ng-template #year>\n <hlm-select brnCalendarYearSelect class=\"order-3\">\n <hlm-select-trigger size=\"sm\" [class]=\"_selectClass\">\n <hlm-select-value />\n </hlm-select-trigger>\n <hlm-select-content *hlmSelectPortal class=\"max-h-80\">\n <hlm-select-group>\n @for (year of _i18n.config().years(); track year) {\n <hlm-select-item [value]=\"year\">{{ year }}</hlm-select-item>\n }\n </hlm-select-group>\n </hlm-select-content>\n </hlm-select>\n </ng-template>\n @let heading = _heading();\n\n <button\n brnCalendarPreviousButton\n variant=\"ghost\"\n hlmBtn\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n @switch (captionLayout()) {\n @case ('dropdown') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('dropdown-months') {\n <ng-container [ngTemplateOutlet]=\"month\" />\n <div brnCalendarHeader class=\"order-4 text-sm font-medium\">{{ heading.year }}</div>\n }\n @case ('dropdown-years') {\n <div brnCalendarHeader class=\"order-2 text-sm font-medium\">{{ heading.month }}</div>\n <ng-container [ngTemplateOutlet]=\"year\" />\n }\n @case ('label') {\n <div brnCalendarHeader class=\"order-5 text-sm font-medium\">{{ heading.header }}</div>\n }\n }\n\n <button\n brnCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <table class=\"w-full border-collapse space-y-1\" brnCalendarGrid>\n <thead aria-hidden=\"true\">\n <tr class=\"flex\">\n <th\n *brnCalendarWeekday=\"let weekday\"\n scope=\"col\"\n class=\"text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none\"\n [attr.aria-label]=\"_i18n.config().labelWeekday(weekday)\"\n >\n {{ _i18n.config().formatWeekdayName(weekday) }}\n </th>\n </tr>\n </thead>\n\n <tbody role=\"rowgroup\">\n <tr *brnCalendarWeek=\"let week\" class=\"mt-2 flex w-full\">\n @for (date of week; track _dateAdapter.getTime(date)) {\n <td\n brnCalendarCell\n 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)\"\n >\n <button brnCalendarCellButton [date]=\"date\" [class]=\"_btnClass\">\n {{ _dateAdapter.getDate(date) }}\n </button>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </div>\n ",
|
|
177
|
+
}]
|
|
178
|
+
}], ctorParameters: () => [], propDecorators: { captionLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionLayout", required: false }] }] } });
|
|
592
179
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
180
|
+
class HlmMonthYearCalendar {
|
|
181
|
+
/** Access the calendar i18n */
|
|
182
|
+
_i18n = injectBrnCalendarI18n();
|
|
183
|
+
/** Access the date adapter */
|
|
184
|
+
_dateAdapter = injectDateAdapter();
|
|
185
|
+
/** Access the picker directive */
|
|
186
|
+
_picker = inject((BrnMonthYearCalendar));
|
|
187
|
+
/** The heading for the current view. */
|
|
188
|
+
_heading = computed(() => {
|
|
189
|
+
const config = this._i18n.config();
|
|
190
|
+
if (this._picker.view() === 'month') {
|
|
191
|
+
return config.formatYear(this._dateAdapter.getYear(this._picker.focusedDate()));
|
|
192
|
+
}
|
|
193
|
+
const { start, end } = this._picker.yearRange();
|
|
194
|
+
return `${config.formatYear(start)} – ${config.formatYear(end)}`;
|
|
195
|
+
}, /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "_heading" }] : /* istanbul ignore next */ []));
|
|
197
|
+
_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)");
|
|
198
|
+
constructor() {
|
|
199
|
+
classes(() => "p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent");
|
|
200
|
+
}
|
|
201
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
202
|
+
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: "\n <div class=\"flex flex-col gap-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <button\n brnMonthYearCalendarPreviousButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n <button\n hlmBtn\n variant=\"ghost\"\n class=\"h-(--cell-size) py-0 select-none aria-disabled:opacity-50\"\n brnMonthYearCalendarHeader\n >\n {{ _heading() }}\n </button>\n\n <button\n brnMonthYearCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <!-- Grid -->\n @switch (_picker.view()) {\n @case ('year') {\n <div brnMonthYearCalendarGrid class=\"grid grid-cols-4 gap-2\">\n @for (year of _picker.years(); track _dateAdapter.getYear(year)) {\n <button brnMonthYearCalendarYearButton [date]=\"year\" [class]=\"_btnClass\">\n {{ _i18n.config().formatYear(_dateAdapter.getYear(year)) }}\n </button>\n }\n </div>\n }\n @case ('month') {\n <div brnMonthYearCalendarGrid class=\"grid grid-cols-4 gap-2\">\n @for (month of _picker.months(); track _dateAdapter.getMonth(month)) {\n <button brnMonthYearCalendarMonthButton [date]=\"month\" [class]=\"_btnClass\">\n {{ _i18n.config().months()[_dateAdapter.getMonth(month)] }}\n </button>\n }\n </div>\n }\n }\n </div>\n ", 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 });
|
|
203
|
+
}
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmMonthYearCalendar, decorators: [{
|
|
205
|
+
type: Component,
|
|
206
|
+
args: [{
|
|
207
|
+
selector: 'hlm-month-year-calendar',
|
|
208
|
+
imports: [BrnCalendarImports, NgIcon, HlmButtonImports],
|
|
209
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
611
210
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
211
|
+
hostDirectives: [
|
|
212
|
+
{
|
|
213
|
+
directive: BrnMonthYearCalendar,
|
|
214
|
+
inputs: ['min', 'max', 'disabled', 'date', 'defaultFocusedDate', 'view'],
|
|
215
|
+
outputs: ['dateChange'],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
host: { 'data-slot': 'month-year-calendar' },
|
|
219
|
+
template: "\n <div class=\"flex flex-col gap-4\">\n <!-- Header -->\n <div class=\"flex w-full items-center justify-between gap-1.5\">\n <button\n brnMonthYearCalendarPreviousButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronLeft\" class=\"rtl:rotate-180\" />\n </button>\n\n <button\n hlmBtn\n variant=\"ghost\"\n class=\"h-(--cell-size) py-0 select-none aria-disabled:opacity-50\"\n brnMonthYearCalendarHeader\n >\n {{ _heading() }}\n </button>\n\n <button\n brnMonthYearCalendarNextButton\n hlmBtn\n variant=\"ghost\"\n class=\"order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50\"\n >\n <ng-icon name=\"lucideChevronRight\" class=\"rtl:rotate-180\" />\n </button>\n </div>\n\n <!-- Grid -->\n @switch (_picker.view()) {\n @case ('year') {\n <div brnMonthYearCalendarGrid class=\"grid grid-cols-4 gap-2\">\n @for (year of _picker.years(); track _dateAdapter.getYear(year)) {\n <button brnMonthYearCalendarYearButton [date]=\"year\" [class]=\"_btnClass\">\n {{ _i18n.config().formatYear(_dateAdapter.getYear(year)) }}\n </button>\n }\n </div>\n }\n @case ('month') {\n <div brnMonthYearCalendarGrid class=\"grid grid-cols-4 gap-2\">\n @for (month of _picker.months(); track _dateAdapter.getMonth(month)) {\n <button brnMonthYearCalendarMonthButton [date]=\"month\" [class]=\"_btnClass\">\n {{ _i18n.config().months()[_dateAdapter.getMonth(month)] }}\n </button>\n }\n </div>\n }\n }\n </div>\n ",
|
|
612
220
|
}]
|
|
613
|
-
}],
|
|
221
|
+
}], ctorParameters: () => [] });
|
|
614
222
|
|
|
615
223
|
/*
|
|
616
224
|
* Public API Surface of calendar
|
|
617
225
|
*/
|
|
618
|
-
const HlmCalendarImports = [HlmCalendar, HlmCalendarMulti, HlmCalendarRange];
|
|
226
|
+
const HlmCalendarImports = [HlmCalendar, HlmCalendarMulti, HlmCalendarRange, HlmMonthYearCalendar];
|
|
619
227
|
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: "
|
|
228
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
229
|
+
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] });
|
|
230
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarModule, imports: [HlmCalendarImports] });
|
|
623
231
|
}
|
|
624
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmCalendarModule, decorators: [{
|
|
625
233
|
type: NgModule,
|
|
626
234
|
args: [{
|
|
627
235
|
imports: [...HlmCalendarImports],
|
|
@@ -633,5 +241,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
633
241
|
* Generated bundle index. Do not edit.
|
|
634
242
|
*/
|
|
635
243
|
|
|
636
|
-
export { HlmCalendar, HlmCalendarImports, HlmCalendarModule, HlmCalendarMulti, HlmCalendarRange };
|
|
637
|
-
|
|
244
|
+
export { HlmCalendar, HlmCalendarImports, HlmCalendarModule, HlmCalendarMulti, HlmCalendarRange, HlmMonthYearCalendar };
|
|
245
|
+
|