@egose/shadcn-theme-ng-tw 0.0.28 → 0.2.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 +376 -34
- package/accordion/fesm2022/accordion.mjs +20 -20
- package/alert/README.md +343 -34
- package/alert/fesm2022/alert.mjs +18 -18
- package/alert-dialog/README.md +471 -5
- package/alert-dialog/fesm2022/alert-dialog.mjs +48 -48
- package/alert-dialog/types/alert-dialog.d.ts +1 -1
- package/aspect-ratio/README.md +272 -5
- package/aspect-ratio/fesm2022/aspect-ratio.mjs +9 -9
- package/autocomplete/README.md +473 -34
- package/autocomplete/fesm2022/autocomplete.mjs +54 -54
- package/autocomplete/types/autocomplete.d.ts +1 -1
- package/avatar/README.md +357 -5
- package/avatar/fesm2022/avatar.mjs +32 -32
- package/badge/README.md +289 -34
- package/badge/fesm2022/badge.mjs +4 -4
- package/basic-alert/README.md +324 -34
- package/basic-alert/fesm2022/basic-alert.mjs +4 -4
- package/basic-alert/types/basic-alert.d.ts +1 -1
- package/breadcrumb/README.md +406 -5
- package/breadcrumb/fesm2022/breadcrumb.mjs +34 -34
- package/button/README.md +453 -34
- package/button/fesm2022/button.mjs +96 -118
- package/button/types/button.d.ts +7 -10
- package/button-group/README.md +318 -5
- package/button-group/fesm2022/button-group.mjs +20 -20
- package/calendar/README.md +328 -34
- package/calendar/fesm2022/calendar.mjs +154 -154
- package/card/README.md +331 -5
- package/card/fesm2022/card.mjs +33 -33
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +47 -44
- package/carousel/types/carousel.d.ts +1 -1
- package/checkbox/README.md +291 -34
- package/checkbox/fesm2022/checkbox.mjs +22 -20
- package/checkbox/types/checkbox.d.ts +5 -4
- package/collapsible/README.md +332 -5
- package/collapsible/fesm2022/collapsible.mjs +15 -15
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +95 -92
- package/combobox/types/combobox.d.ts +1 -1
- package/command/README.md +435 -5
- package/command/fesm2022/command.mjs +56 -56
- package/confirmation-dialog/README.md +272 -34
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +13 -12
- package/confirmation-dialog/types/confirmation-dialog.d.ts +9 -5
- package/context-menu/README.md +366 -5
- package/context-menu/fesm2022/context-menu.mjs +9 -9
- package/date-picker/README.md +436 -34
- package/date-picker/fesm2022/date-picker.mjs +79 -68
- package/date-picker/types/date-picker.d.ts +8 -4
- package/dialog/README.md +419 -34
- package/dialog/fesm2022/dialog.mjs +48 -48
- package/drawer/README.md +395 -5
- package/drawer/fesm2022/drawer.mjs +45 -45
- package/dropdown-menu/README.md +417 -5
- package/dropdown-menu/fesm2022/dropdown-menu.mjs +85 -73
- package/dropdown-menu/types/dropdown-menu.d.ts +4 -0
- package/empty/README.md +329 -5
- package/empty/fesm2022/empty.mjs +31 -31
- package/field/README.md +385 -5
- package/field/fesm2022/field.mjs +59 -59
- package/field/types/field.d.ts +1 -1
- package/form-checkbox/README.md +283 -34
- package/form-checkbox/fesm2022/form-checkbox.mjs +37 -19
- package/form-checkbox/types/form-checkbox.d.ts +7 -1
- package/form-date-picker/README.md +293 -34
- package/form-date-picker/fesm2022/form-date-picker.mjs +59 -24
- package/form-date-picker/types/form-date-picker.d.ts +7 -1
- package/form-field/README.md +327 -34
- package/form-field/fesm2022/form-field.mjs +30 -16
- package/form-field/types/form-field.d.ts +28 -20
- package/form-field-simple/README.md +311 -34
- package/form-field-simple/fesm2022/form-field-simple.mjs +4 -4
- package/form-searchable-multiselect/README.md +332 -34
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +41 -21
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +8 -2
- package/form-select/README.md +321 -34
- package/form-select/fesm2022/form-select.mjs +62 -29
- package/form-select/types/form-select.d.ts +7 -1
- package/form-text-input/README.md +342 -34
- package/form-text-input/fesm2022/form-text-input.mjs +43 -55
- package/form-text-input/types/form-text-input.d.ts +9 -12
- package/form-textarea/README.md +318 -34
- package/form-textarea/fesm2022/form-textarea.mjs +42 -23
- package/form-textarea/types/form-textarea.d.ts +8 -1
- package/hover-card/README.md +256 -5
- package/hover-card/fesm2022/hover-card.mjs +19 -19
- package/icon/README.md +210 -34
- package/icon/fesm2022/icon.mjs +8 -8
- package/input/README.md +240 -34
- package/input/fesm2022/input.mjs +17 -12
- package/input/types/input.d.ts +2 -1
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +37 -37
- package/input-group/types/input-group.d.ts +3 -3
- package/input-otp/README.md +375 -5
- package/input-otp/fesm2022/input-otp.mjs +27 -27
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +54 -54
- package/kbd/README.md +291 -5
- package/kbd/fesm2022/kbd.mjs +13 -13
- package/label/README.md +243 -34
- package/label/fesm2022/label.mjs +9 -9
- package/label/types/label.d.ts +1 -1
- package/layout-simple/README.md +174 -44
- package/layout-simple/fesm2022/layout-simple.mjs +917 -398
- package/layout-simple/types/layout-simple.d.ts +180 -129
- package/menu/README.md +418 -0
- package/menu/fesm2022/menu.mjs +461 -0
- package/menu/package.json +24 -0
- package/menu/types/menu.d.ts +137 -0
- package/menubar/README.md +343 -5
- package/menubar/fesm2022/menubar.mjs +13 -13
- package/native-select/README.md +323 -5
- package/native-select/fesm2022/native-select.mjs +19 -19
- package/navigation-menu/README.md +369 -5
- package/navigation-menu/fesm2022/navigation-menu.mjs +37 -37
- package/package.json +183 -154
- package/pagination/README.md +388 -5
- package/pagination/fesm2022/pagination.mjs +63 -63
- package/popover/README.md +302 -34
- package/popover/fesm2022/popover.mjs +30 -30
- package/progress/README.md +311 -5
- package/progress/fesm2022/progress.mjs +13 -13
- package/radio-group/README.md +335 -34
- package/radio-group/fesm2022/radio-group.mjs +26 -19
- package/resizable/README.md +269 -5
- package/resizable/fesm2022/resizable.mjs +19 -19
- package/scroll-area/README.md +233 -5
- package/scroll-area/fesm2022/scroll-area.mjs +9 -9
- package/searchable-multiselect/README.md +294 -34
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +63 -16
- package/searchable-multiselect/types/searchable-multiselect.d.ts +8 -2
- package/select/README.md +408 -34
- package/select/fesm2022/select.mjs +80 -72
- package/select/types/select.d.ts +3 -1
- package/separator/README.md +193 -34
- package/separator/fesm2022/separator.mjs +9 -9
- package/separator/types/separator.d.ts +1 -1
- package/sheet/README.md +282 -34
- package/sheet/fesm2022/sheet.mjs +30 -30
- package/sidebar/README.md +457 -5
- package/sidebar/fesm2022/sidebar.mjs +136 -134
- package/sidebar/types/sidebar.d.ts +3 -3
- package/skeleton/README.md +217 -5
- package/skeleton/fesm2022/skeleton.mjs +9 -9
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +29 -25
- package/sonner/README.md +317 -34
- package/sonner/fesm2022/sonner.mjs +9 -9
- package/spinner/README.md +255 -34
- package/spinner/fesm2022/spinner.mjs +8 -8
- package/switch/README.md +281 -34
- package/switch/fesm2022/switch.mjs +12 -14
- package/table/README.md +423 -5
- package/table/fesm2022/table.mjs +41 -41
- package/tabs/README.md +382 -34
- package/tabs/fesm2022/tabs.mjs +48 -38
- package/textarea/README.md +282 -5
- package/textarea/fesm2022/textarea.mjs +9 -9
- package/toggle/README.md +270 -5
- package/toggle/fesm2022/toggle.mjs +14 -14
- package/toggle-group/README.md +340 -5
- package/toggle-group/fesm2022/toggle-group.mjs +13 -13
- package/toggle-group/types/toggle-group.d.ts +13 -7
- package/tooltip/README.md +240 -34
- package/tooltip/fesm2022/tooltip.mjs +14 -14
- package/typography/README.md +271 -5
- package/typography/fesm2022/typography.mjs +53 -53
- package/typography/types/typography.d.ts +12 -12
- package/utils/README.md +274 -34
- package/utils/fesm2022/utils.mjs +68 -44
- package/accordion/fesm2022/accordion.mjs.map +0 -1
- package/alert/fesm2022/alert.mjs.map +0 -1
- package/alert-dialog/fesm2022/alert-dialog.mjs.map +0 -1
- package/aspect-ratio/fesm2022/aspect-ratio.mjs.map +0 -1
- package/autocomplete/fesm2022/autocomplete.mjs.map +0 -1
- package/avatar/fesm2022/avatar.mjs.map +0 -1
- package/badge/fesm2022/badge.mjs.map +0 -1
- package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
- package/breadcrumb/fesm2022/breadcrumb.mjs.map +0 -1
- package/button/fesm2022/button.mjs.map +0 -1
- package/button-group/fesm2022/button-group.mjs.map +0 -1
- package/calendar/fesm2022/calendar.mjs.map +0 -1
- package/card/fesm2022/card.mjs.map +0 -1
- package/carousel/fesm2022/carousel.mjs.map +0 -1
- package/checkbox/fesm2022/checkbox.mjs.map +0 -1
- package/collapsible/fesm2022/collapsible.mjs.map +0 -1
- package/combobox/fesm2022/combobox.mjs.map +0 -1
- package/command/fesm2022/command.mjs.map +0 -1
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +0 -1
- package/context-menu/fesm2022/context-menu.mjs.map +0 -1
- package/date-picker/fesm2022/date-picker.mjs.map +0 -1
- package/dialog/fesm2022/dialog.mjs.map +0 -1
- package/drawer/fesm2022/drawer.mjs.map +0 -1
- package/dropdown-menu/fesm2022/dropdown-menu.mjs.map +0 -1
- package/empty/fesm2022/empty.mjs.map +0 -1
- package/field/fesm2022/field.mjs.map +0 -1
- package/form-checkbox/fesm2022/form-checkbox.mjs.map +0 -1
- 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-simple/fesm2022/form-field-simple.mjs.map +0 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.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/hover-card/fesm2022/hover-card.mjs.map +0 -1
- package/icon/fesm2022/icon.mjs.map +0 -1
- package/input/fesm2022/input.mjs.map +0 -1
- package/input-group/fesm2022/input-group.mjs.map +0 -1
- package/input-otp/fesm2022/input-otp.mjs.map +0 -1
- package/item/fesm2022/item.mjs.map +0 -1
- package/kbd/fesm2022/kbd.mjs.map +0 -1
- package/label/fesm2022/label.mjs.map +0 -1
- package/layout-simple/fesm2022/layout-simple.mjs.map +0 -1
- package/menubar/fesm2022/menubar.mjs.map +0 -1
- package/native-select/fesm2022/native-select.mjs.map +0 -1
- package/navigation-menu/fesm2022/navigation-menu.mjs.map +0 -1
- package/pagination/fesm2022/pagination.mjs.map +0 -1
- package/popover/fesm2022/popover.mjs.map +0 -1
- package/progress/fesm2022/progress.mjs.map +0 -1
- package/radio-group/fesm2022/radio-group.mjs.map +0 -1
- package/resizable/fesm2022/resizable.mjs.map +0 -1
- package/scroll-area/fesm2022/scroll-area.mjs.map +0 -1
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs.map +0 -1
- package/select/fesm2022/select.mjs.map +0 -1
- package/separator/fesm2022/separator.mjs.map +0 -1
- package/sheet/fesm2022/sheet.mjs.map +0 -1
- package/sidebar/fesm2022/sidebar.mjs.map +0 -1
- package/skeleton/fesm2022/skeleton.mjs.map +0 -1
- package/slider/fesm2022/slider.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/table/fesm2022/table.mjs.map +0 -1
- package/tabs/fesm2022/tabs.mjs.map +0 -1
- package/textarea/fesm2022/textarea.mjs.map +0 -1
- package/toggle/fesm2022/toggle.mjs.map +0 -1
- package/toggle-group/fesm2022/toggle-group.mjs.map +0 -1
- package/tooltip/fesm2022/tooltip.mjs.map +0 -1
- package/typography/fesm2022/typography.mjs.map +0 -1
- package/utils/fesm2022/utils.mjs.map +0 -1
package/calendar/README.md
CHANGED
|
@@ -1,64 +1,358 @@
|
|
|
1
|
-
# Calendar
|
|
1
|
+
# Calendar (`@egose/shadcn-theme-ng/calendar`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A shadcn/ui-style calendar month grid for single-date, multi-date, range, and month/year picking — the Angular port of shadcn/ui `Calendar`. Four standalone components share one visual language (ghost icon day cells, `--cell-size`/`--cell-radius` tokens, optional month/year dropdown caption): `hlm-calendar` (single date), `hlm-calendar-multi` (multi-select), `hlm-calendar-range` (start/end range), and `hlm-month-year-calendar` (year→month stepping). Behavior comes from `@spartan-ng/brain/calendar` host directives (`BrnCalendar`, `BrnCalendarMulti`, `BrnCalendarRange`, `BrnMonthYearCalendar`) plus `@spartan-ng/brain/date-time` adapters and i18n; the header dropdowns are composed from this repo's own `hlm-select` subpath.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Ships as `@egose/shadcn-theme-ng/calendar` and `@egose/shadcn-theme-ng-tw/calendar` (the `tw:`-prefixed variant). See the [package README](../../README.md) for install, peer dependencies, and Tailwind setup. Do not publish this project directory independently — it is consumed via the published subpath only.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
# Plain Tailwind (no prefix):
|
|
11
|
+
npm install @egose/shadcn-theme-ng
|
|
12
|
+
|
|
13
|
+
# Or the tw:-prefixed variant:
|
|
14
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Peers are listed in the [package README](../../README.md). This subpath declares `@angular/common` and `@angular/core` as peers (see `projects/calendar/package.json`); at runtime it also imports `@egose/shadcn-theme-ng/button` and `@egose/shadcn-theme-ng/select`, so install the whole package, not the directory.
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
HlmCalendar,
|
|
24
|
+
HlmCalendarMulti,
|
|
25
|
+
HlmCalendarRange,
|
|
26
|
+
HlmMonthYearCalendar,
|
|
27
|
+
HlmCalendarImports,
|
|
28
|
+
HlmCalendarModule,
|
|
29
|
+
} from '@egose/shadcn-theme-ng/calendar';
|
|
30
|
+
// tw variant:
|
|
31
|
+
// import { ... } from '@egose/shadcn-theme-ng-tw/calendar';
|
|
17
32
|
```
|
|
18
33
|
|
|
19
|
-
|
|
34
|
+
Standalone:
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
```ts
|
|
37
|
+
import { Component } from '@angular/core';
|
|
38
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
22
39
|
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
@Component({
|
|
41
|
+
selector: 'app-demo',
|
|
42
|
+
standalone: true,
|
|
43
|
+
imports: [...HlmCalendarImports],
|
|
44
|
+
template: `<hlm-calendar />`,
|
|
45
|
+
})
|
|
46
|
+
export class DemoComponent {}
|
|
25
47
|
```
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
NgModule:
|
|
28
50
|
|
|
29
|
-
|
|
51
|
+
```ts
|
|
52
|
+
import { NgModule } from '@angular/core';
|
|
53
|
+
import { HlmCalendarModule } from '@egose/shadcn-theme-ng/calendar';
|
|
30
54
|
|
|
31
|
-
|
|
55
|
+
@NgModule({ imports: [HlmCalendarModule] })
|
|
56
|
+
export class DemoModule {}
|
|
57
|
+
```
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
> Requires a date adapter provider from `@spartan-ng/brain/date-time` (e.g. native-JS-date adapter) and, for localized names, the calendar i18n provider — see the examples below.
|
|
34
60
|
|
|
35
|
-
|
|
36
|
-
cd dist/calendar
|
|
37
|
-
```
|
|
61
|
+
## Anatomy / Structure
|
|
38
62
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
```html
|
|
64
|
+
<!-- Single date -->
|
|
65
|
+
<hlm-calendar
|
|
66
|
+
captionLayout="dropdown"
|
|
67
|
+
[date]="selected"
|
|
68
|
+
[min]="minDate"
|
|
69
|
+
[max]="maxDate"
|
|
70
|
+
[disabled]="isDisabled"
|
|
71
|
+
[weekStartsOn]="1"
|
|
72
|
+
(dateChange)="selected = $event"
|
|
73
|
+
/>
|
|
43
74
|
|
|
44
|
-
|
|
75
|
+
<!-- Multi date -->
|
|
76
|
+
<hlm-calendar-multi [date]="[d1, d2]" [minSelection]="1" [maxSelection]="5" (dateChange)="dates = $event" />
|
|
45
77
|
|
|
46
|
-
|
|
78
|
+
<!-- Range -->
|
|
79
|
+
<hlm-calendar-range
|
|
80
|
+
[startDate]="start"
|
|
81
|
+
[endDate]="end"
|
|
82
|
+
(startDateChange)="start = $event"
|
|
83
|
+
(endDateChange)="end = $event"
|
|
84
|
+
/>
|
|
47
85
|
|
|
48
|
-
|
|
49
|
-
|
|
86
|
+
<!-- Month/year stepper -->
|
|
87
|
+
<hlm-month-year-calendar [date]="picked" view="month" (dateChange)="picked = $event" />
|
|
50
88
|
```
|
|
51
89
|
|
|
52
|
-
|
|
90
|
+
Real selectors: `hlm-calendar`, `hlm-calendar-multi`, `hlm-calendar-range`, `hlm-month-year-calendar` (element selectors only). Internally each template composes `brnCalendarPreviousButton` / `brnCalendarNextButton` / `brnCalendarHeader` / `brnCalendarGrid` / `brnCalendarCellButton` structural directives and `brnCalendarMonthSelect` / `brnCalendarYearSelect` selects; you do not write those yourself.
|
|
53
91
|
|
|
54
|
-
|
|
92
|
+
## API reference
|
|
55
93
|
|
|
56
|
-
|
|
57
|
-
|
|
94
|
+
All date types are generic `<T>` (whatever your date adapter uses — usually native `Date`).
|
|
95
|
+
|
|
96
|
+
### `HlmCalendar` (`hlm-calendar`)
|
|
97
|
+
|
|
98
|
+
| Input (own) | Type | Default | Description |
|
|
99
|
+
| --------------- | ---------------------------------------------------------------- | --------- | -------------------------------------------------------------- |
|
|
100
|
+
| `captionLayout` | `'dropdown' \| 'label' \| 'dropdown-months' \| 'dropdown-years'` | `'label'` | Header mode: plain label vs month/year `hlm-select` dropdowns. |
|
|
101
|
+
|
|
102
|
+
| Brain input (via `BrnCalendar`) | Description |
|
|
103
|
+
| ------------------------------- | ------------------------------------------------------------- |
|
|
104
|
+
| `min` | Minimum selectable date. |
|
|
105
|
+
| `max` | Maximum selectable date. |
|
|
106
|
+
| `disabled` | Disables the whole calendar. |
|
|
107
|
+
| `date` | Currently selected date. |
|
|
108
|
+
| `dateDisabled` | Predicate `(date: T) => boolean` disabling individual days. |
|
|
109
|
+
| `weekStartsOn` | First weekday (`0` = Sunday … `6` = Saturday). |
|
|
110
|
+
| `highlightDays` | Dates/dots predicate for the `data-[highlighted]` dot marker. |
|
|
111
|
+
| `defaultFocusedDate` | Initially focused date when `date` is unset. |
|
|
112
|
+
|
|
113
|
+
| Output | Payload | Description |
|
|
114
|
+
| ------------ | ----------------------------------------- | --------------------------------------- |
|
|
115
|
+
| `dateChange` | `T \| null/undefined` (adapter-dependent) | Emitted on day click / keyboard select. |
|
|
116
|
+
|
|
117
|
+
### `HlmCalendarMulti` (`hlm-calendar-multi`)
|
|
118
|
+
|
|
119
|
+
Own `captionLayout` input identical to above. Brain inputs via `BrnCalendarMulti`: `min`, `max`, `minSelection`, `maxSelection`, `disabled`, `date` (array), `dateDisabled`, `weekStartsOn`, `highlightDays`, `defaultFocusedDate`. Output: `dateChange` (selected-dates array).
|
|
120
|
+
|
|
121
|
+
### `HlmCalendarRange` (`hlm-calendar-range`)
|
|
122
|
+
|
|
123
|
+
Own `captionLayout` input identical to above. Brain inputs via `BrnCalendarRange`: `min`, `max`, `disabled`, `startDate`, `endDate`, `dateDisabled`, `weekStartsOn`, `highlightDays`, `defaultFocusedDate`. Outputs: `startDateChange`, `endDateChange`.
|
|
124
|
+
|
|
125
|
+
### `HlmMonthYearCalendar` (`hlm-month-year-calendar`)
|
|
126
|
+
|
|
127
|
+
No `captionLayout`. Brain inputs via `BrnMonthYearCalendar`: `min`, `max`, `disabled`, `date`, `defaultFocusedDate`, `view` (`'month' | 'year'`). Output: `dateChange`. The header button (`brnMonthYearCalendarHeader`) toggles year↔month views; the grid renders `brnMonthYearCalendarYearButton` / `brnMonthYearCalendarMonthButton` cells.
|
|
128
|
+
|
|
129
|
+
## Examples
|
|
130
|
+
|
|
131
|
+
### 1. Basic single-date calendar (two-way style)
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { Component, signal } from '@angular/core';
|
|
135
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
136
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
selector: 'app-basic-calendar',
|
|
140
|
+
standalone: true,
|
|
141
|
+
imports: [...HlmCalendarImports],
|
|
142
|
+
providers: [provideNativeDateAdapter()],
|
|
143
|
+
template: `
|
|
144
|
+
<hlm-calendar [date]="date()" (dateChange)="date.set($event)" />
|
|
145
|
+
<p class="mt-2 text-sm">Picked: {{ date()?.toDateString() ?? 'none' }}</p>
|
|
146
|
+
`,
|
|
147
|
+
})
|
|
148
|
+
export class BasicCalendarComponent {
|
|
149
|
+
readonly date = signal<Date | undefined>(new Date());
|
|
150
|
+
}
|
|
58
151
|
```
|
|
59
152
|
|
|
60
|
-
|
|
153
|
+
### 2. Caption variants (dropdown navigation)
|
|
154
|
+
|
|
155
|
+
All three single/multi/range calendars accept `captionLayout`.
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { Component, signal } from '@angular/core';
|
|
159
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
160
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
161
|
+
|
|
162
|
+
@Component({
|
|
163
|
+
selector: 'app-caption-layouts',
|
|
164
|
+
standalone: true,
|
|
165
|
+
imports: [...HlmCalendarImports],
|
|
166
|
+
providers: [provideNativeDateAdapter()],
|
|
167
|
+
template: `
|
|
168
|
+
<div class="flex flex-wrap gap-6">
|
|
169
|
+
<div>
|
|
170
|
+
<h3 class="mb-2 text-sm font-medium">dropdown</h3>
|
|
171
|
+
<hlm-calendar captionLayout="dropdown" [date]="a()" (dateChange)="a.set($event)" />
|
|
172
|
+
</div>
|
|
173
|
+
<div>
|
|
174
|
+
<h3 class="mb-2 text-sm font-medium">dropdown-months</h3>
|
|
175
|
+
<hlm-calendar captionLayout="dropdown-months" [date]="b()" (dateChange)="b.set($event)" />
|
|
176
|
+
</div>
|
|
177
|
+
<div>
|
|
178
|
+
<h3 class="mb-2 text-sm font-medium">dropdown-years</h3>
|
|
179
|
+
<hlm-calendar captionLayout="dropdown-years" [date]="c()" (dateChange)="c.set($event)" />
|
|
180
|
+
</div>
|
|
181
|
+
<div>
|
|
182
|
+
<h3 class="mb-2 text-sm font-medium">label (default)</h3>
|
|
183
|
+
<hlm-calendar captionLayout="label" [date]="d()" (dateChange)="d.set($event)" />
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
`,
|
|
187
|
+
})
|
|
188
|
+
export class CaptionLayoutsComponent {
|
|
189
|
+
readonly a = signal<Date | undefined>(new Date());
|
|
190
|
+
readonly b = signal<Date | undefined>(new Date());
|
|
191
|
+
readonly c = signal<Date | undefined>(new Date());
|
|
192
|
+
readonly d = signal<Date | undefined>(new Date());
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 3. Min/max, disabled dates, week start, highlight dots
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
import { Component, signal } from '@angular/core';
|
|
200
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
201
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
202
|
+
|
|
203
|
+
@Component({
|
|
204
|
+
selector: 'app-constrained-calendar',
|
|
205
|
+
standalone: true,
|
|
206
|
+
imports: [...HlmCalendarImports],
|
|
207
|
+
providers: [provideNativeDateAdapter()],
|
|
208
|
+
template: `
|
|
209
|
+
<hlm-calendar
|
|
210
|
+
[date]="date()"
|
|
211
|
+
[min]="min"
|
|
212
|
+
[max]="max"
|
|
213
|
+
[dateDisabled]="isWeekend"
|
|
214
|
+
[weekStartsOn]="1"
|
|
215
|
+
[highlightDays]="isPayday"
|
|
216
|
+
(dateChange)="date.set($event)"
|
|
217
|
+
/>
|
|
218
|
+
`,
|
|
219
|
+
})
|
|
220
|
+
export class ConstrainedCalendarComponent {
|
|
221
|
+
readonly date = signal<Date | undefined>(new Date());
|
|
222
|
+
readonly min = new Date(2026, 0, 1);
|
|
223
|
+
readonly max = new Date(2026, 11, 31);
|
|
224
|
+
|
|
225
|
+
// Disable weekends:
|
|
226
|
+
readonly isWeekend = (d: Date) => d.getDay() === 0 || d.getDay() === 6;
|
|
227
|
+
// Red dot under the 15th of any month:
|
|
228
|
+
readonly isPayday = (d: Date) => d.getDate() === 15;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 4. Multi-date selection with selection limits
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import { Component, signal } from '@angular/core';
|
|
236
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
237
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
238
|
+
|
|
239
|
+
@Component({
|
|
240
|
+
selector: 'app-multi-calendar',
|
|
241
|
+
standalone: true,
|
|
242
|
+
imports: [...HlmCalendarImports],
|
|
243
|
+
providers: [provideNativeDateAdapter()],
|
|
244
|
+
template: `
|
|
245
|
+
<hlm-calendar-multi
|
|
246
|
+
captionLayout="dropdown"
|
|
247
|
+
[date]="dates()"
|
|
248
|
+
[minSelection]="1"
|
|
249
|
+
[maxSelection]="3"
|
|
250
|
+
(dateChange)="dates.set($event ?? [])"
|
|
251
|
+
/>
|
|
252
|
+
<p class="mt-2 text-sm">{{ dates().length }} / 3 selected</p>
|
|
253
|
+
<ul class="text-sm">
|
|
254
|
+
@for (d of dates(); track d.getTime()) {
|
|
255
|
+
<li>{{ d.toDateString() }}</li>
|
|
256
|
+
}
|
|
257
|
+
</ul>
|
|
258
|
+
`,
|
|
259
|
+
})
|
|
260
|
+
export class MultiCalendarComponent {
|
|
261
|
+
readonly dates = signal<Date[]>([new Date()]);
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 5. Date range with reactive-form-friendly signals
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
import { Component, computed, signal } from '@angular/core';
|
|
269
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
270
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
271
|
+
|
|
272
|
+
@Component({
|
|
273
|
+
selector: 'app-range-calendar',
|
|
274
|
+
standalone: true,
|
|
275
|
+
imports: [...HlmCalendarImports],
|
|
276
|
+
providers: [provideNativeDateAdapter()],
|
|
277
|
+
template: `
|
|
278
|
+
<hlm-calendar-range
|
|
279
|
+
[startDate]="start()"
|
|
280
|
+
[endDate]="end()"
|
|
281
|
+
[disabled]="locked()"
|
|
282
|
+
(startDateChange)="start.set($event)"
|
|
283
|
+
(endDateChange)="end.set($event)"
|
|
284
|
+
/>
|
|
285
|
+
<p class="mt-2 text-sm">{{ summary() }}</p>
|
|
286
|
+
<button type="button" (click)="locked.set(!locked())">
|
|
287
|
+
{{ locked() ? 'Unlock' : 'Lock' }}
|
|
288
|
+
</button>
|
|
289
|
+
<button type="button" (click)="clear()">Clear</button>
|
|
290
|
+
`,
|
|
291
|
+
})
|
|
292
|
+
export class RangeCalendarComponent {
|
|
293
|
+
readonly start = signal<Date | undefined>(new Date(2026, 8, 1));
|
|
294
|
+
readonly end = signal<Date | undefined>(new Date(2026, 8, 7));
|
|
295
|
+
readonly locked = signal(false);
|
|
296
|
+
readonly summary = computed(() =>
|
|
297
|
+
this.start() && this.end()
|
|
298
|
+
? `${this.start()!.toDateString()} → ${this.end()!.toDateString()}`
|
|
299
|
+
: 'Pick a start and end date',
|
|
300
|
+
);
|
|
301
|
+
clear() {
|
|
302
|
+
this.start.set(undefined);
|
|
303
|
+
this.end.set(undefined);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 6. Month/year picker + composition inside card/popover
|
|
309
|
+
|
|
310
|
+
`hlm-month-year-calendar` steps through year grids then month grids — ideal for expiry / birth-month fields. Calendars are transparent inside `card-content` / `popover-content` slots by design (`in-data-[slot=...]:bg-transparent`).
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { Component, signal } from '@angular/core';
|
|
314
|
+
import { HlmCalendarImports } from '@egose/shadcn-theme-ng/calendar';
|
|
315
|
+
import { HlmCardImports } from '@egose/shadcn-theme-ng/card';
|
|
316
|
+
import { provideNativeDateAdapter } from '@spartan-ng/brain/date-time';
|
|
317
|
+
|
|
318
|
+
@Component({
|
|
319
|
+
selector: 'app-card-calendar',
|
|
320
|
+
standalone: true,
|
|
321
|
+
imports: [...HlmCalendarImports, ...HlmCardImports],
|
|
322
|
+
providers: [provideNativeDateAdapter()],
|
|
323
|
+
template: `
|
|
324
|
+
<div hlmCard class="w-80">
|
|
325
|
+
<div hlmCardHeader>
|
|
326
|
+
<h3 hlmCardTitle>Expiry month</h3>
|
|
327
|
+
<p hlmCardDescription>Month/year only — no day grid.</p>
|
|
328
|
+
</div>
|
|
329
|
+
<div hlmCardContent>
|
|
330
|
+
<hlm-month-year-calendar view="year" [date]="picked()" (dateChange)="picked.set($event)" />
|
|
331
|
+
<p class="mt-2 text-sm">Value: {{ picked()?.toDateString() ?? 'none' }}</p>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
`,
|
|
335
|
+
})
|
|
336
|
+
export class CardCalendarComponent {
|
|
337
|
+
readonly picked = signal<Date | undefined>(undefined);
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Accessibility notes
|
|
342
|
+
|
|
343
|
+
- Day grids use a real `<table>` with `brnCalendarGrid`, weekday `<th scope="col">` headers (`aria-hidden` visual row plus `aria-label` weekday names), and `role="rowgroup"` body — screen readers announce weeks correctly.
|
|
344
|
+
- Prev/next month buttons expose chevron icons with ghost-button styling and `aria-disabled` states; keep them focusable and do not hide them with CSS.
|
|
345
|
+
- Keyboard: arrows move the focused day (brain directive), Enter/Space selects. The `data-[focused=true]` ring (`group-data-[focused=true]/day`) is the visible focus indicator — do not remove it.
|
|
346
|
+
- `hlm-carousel`-style `aria-roledescription` is not used here; the calendar relies on native table semantics plus dialog/popover labeling when composed — always label the surrounding popover/dialog title.
|
|
347
|
+
|
|
348
|
+
## Theming / CSS variables
|
|
349
|
+
|
|
350
|
+
- `--cell-size` (default `--spacing(8)`) and `--cell-radius` (default `var(--radius-md)`) control day-cell geometry; override per instance: `<hlm-calendar class="[--cell-size:--spacing(10)]">`.
|
|
351
|
+
- Selected/range/today/highlight states are `data-*` driven (`data-[selected-single]`, `data-[range-start/middle/end]`, `data-[today]`, `data-[highlighted]`, `data-[outside]`) using `bg-primary`, `bg-muted`, and `bg-destructive` dot tokens — they follow the app theme automatically.
|
|
61
352
|
|
|
62
|
-
##
|
|
353
|
+
## Related subpaths
|
|
63
354
|
|
|
64
|
-
|
|
355
|
+
- `@egose/shadcn-theme-ng/button` — `hlmBtn` prev/next buttons and day-cell `buttonVariants`.
|
|
356
|
+
- `@egose/shadcn-theme-ng/select` — month/year dropdown caption selects.
|
|
357
|
+
- `@egose/shadcn-theme-ng/card` / `popover` — common calendar hosts (transparent-slot styling built in).
|
|
358
|
+
- `@egose/shadcn-theme-ng/date-picker` — input + popover composition that emits `Date` via `dateChange`.
|