@spartan-ng/cli 0.0.1-alpha.716 → 0.0.1-alpha.718
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/package.json +1 -1
- package/src/generators/base/generator.d.ts +1 -0
- package/src/generators/base/generator.js +66 -0
- package/src/generators/base/generator.js.map +1 -1
- package/src/generators/healthcheck/healthchecks/version.js +5 -1
- package/src/generators/healthcheck/healthchecks/version.js.map +1 -1
- package/src/generators/migrate-helm-libraries/generator.js +26 -7
- package/src/generators/migrate-helm-libraries/generator.js.map +1 -1
- package/src/generators/migrate-icon/generator.js +1 -1
- package/src/generators/migrate-icon/generator.js.map +1 -1
- package/src/generators/migrate-scroll-area/generator.js +1 -1
- package/src/generators/migrate-scroll-area/generator.js.map +1 -1
- package/src/generators/ui/libs/alert-dialog/files/lib/hlm-alert-dialog-cancel.ts.template +1 -4
- package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete-search.ts.template +3 -15
- package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete.ts.template +3 -15
- package/src/generators/ui/libs/calendar/files/lib/hlm-calendar-multi.ts.template +134 -183
- package/src/generators/ui/libs/calendar/files/lib/hlm-calendar-range.ts.template +133 -176
- package/src/generators/ui/libs/calendar/files/lib/hlm-calendar.ts.template +121 -169
- package/src/generators/ui/libs/combobox/files/lib/hlm-combobox-multiple.ts.template +3 -15
- package/src/generators/ui/libs/combobox/files/lib/hlm-combobox.ts.template +3 -15
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker-anchor.ts.template +5 -12
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker-multi.ts.template +3 -3
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker.ts.template +3 -4
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-range-picker.ts.template +3 -3
- package/src/generators/ui/libs/dialog/files/lib/hlm-dialog-close.ts.template +1 -1
- package/src/generators/ui/libs/dialog/files/lib/hlm-dialog-content.ts.template +8 -1
- package/src/generators/ui/libs/drawer/files/lib/hlm-drawer-close.ts.template +1 -1
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-content.ts.template +10 -3
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-item.ts.template +4 -1
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-link.ts.template +4 -4
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-list.ts.template +4 -1
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-trigger.ts.template +15 -4
- package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu.ts.template +6 -1
- package/src/generators/ui/libs/popover/files/index.ts.template +15 -1
- package/src/generators/ui/libs/popover/files/lib/hlm-popover-description.ts.template +12 -0
- package/src/generators/ui/libs/popover/files/lib/hlm-popover-header.ts.template +12 -0
- package/src/generators/ui/libs/popover/files/lib/hlm-popover-title.ts.template +12 -0
- package/src/generators/ui/libs/popover/files/lib/hlm-popover-trigger.ts.template +1 -3
- package/src/generators/ui/libs/popover/files/lib/hlm-popover.ts.template +1 -11
- package/src/generators/ui/libs/select/files/lib/hlm-select-multiple.ts.template +3 -15
- package/src/generators/ui/libs/select/files/lib/hlm-select.ts.template +3 -15
- package/src/generators/ui/libs/sheet/files/lib/hlm-sheet-close.ts.template +1 -1
- package/src/generators/ui/libs/utils/files/index.ts.template +1 -0
- package/src/generators/ui/libs/utils/files/lib/provide-spartan-hlm.ts.template +34 -0
- package/src/generators/ui/style-luma.css +2 -46
- package/src/generators/ui/style-lyra.css +2 -46
- package/src/generators/ui/style-maia.css +2 -46
- package/src/generators/ui/style-mira.css +2 -46
- package/src/generators/ui/style-nova.css +2 -46
- package/src/generators/ui/style-vega.css +2 -46
- package/src/generators/ui/supported-ui-libraries.json +47 -45
- package/src/utils/string-change.d.ts +26 -0
- package/src/utils/string-change.js +84 -0
- package/src/utils/string-change.js.map +1 -0
|
@@ -1,197 +1,146 @@
|
|
|
1
|
-
import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
booleanAttribute,
|
|
5
|
-
ChangeDetectionStrategy,
|
|
6
|
-
Component,
|
|
7
|
-
computed,
|
|
8
|
-
input,
|
|
9
|
-
model,
|
|
10
|
-
numberAttribute,
|
|
11
|
-
viewChild,
|
|
12
|
-
} from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
13
3
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
14
4
|
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
|
|
15
|
-
import { BrnCalendar, BrnCalendarImports, injectBrnCalendarI18n
|
|
5
|
+
import { BrnCalendar, BrnCalendarImports, injectBrnCalendarI18n } from '@spartan-ng/brain/calendar';
|
|
16
6
|
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
17
|
-
import { buttonVariants } from '<%- importAlias %>/button';
|
|
18
|
-
import { HlmIcon } from '<%- importAlias %>/icon';
|
|
7
|
+
import { buttonVariants, HlmButtonImports } from '<%- importAlias %>/button';
|
|
19
8
|
import { HlmSelectImports } from '<%- importAlias %>/select';
|
|
20
|
-
import { hlm } from '<%- importAlias %>/utils';
|
|
21
|
-
import type { ClassValue } from 'clsx';
|
|
9
|
+
import { classes, hlm } from '<%- importAlias %>/utils';
|
|
22
10
|
|
|
23
11
|
@Component({
|
|
24
12
|
selector: 'hlm-calendar',
|
|
25
|
-
imports: [BrnCalendarImports, NgIcon,
|
|
13
|
+
imports: [BrnCalendarImports, NgIcon, HlmSelectImports, NgTemplateOutlet, HlmButtonImports],
|
|
26
14
|
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
27
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
hostDirectives: [
|
|
17
|
+
{
|
|
18
|
+
directive: BrnCalendar,
|
|
19
|
+
inputs: ['min', 'max', 'disabled', 'date', 'dateDisabled', 'weekStartsOn', 'highlightDays', 'defaultFocusedDate'],
|
|
20
|
+
outputs: ['dateChange'],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
28
23
|
host: { 'data-slot': 'calendar' },
|
|
29
24
|
template: `
|
|
30
|
-
<div
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<div class="inline-flex flex-col space-y-4">
|
|
43
|
-
<!-- Header -->
|
|
44
|
-
<div class="space-y-4">
|
|
45
|
-
<div class="relative flex items-center justify-center pt-1">
|
|
46
|
-
<div class="flex w-full items-center justify-center gap-1.5">
|
|
47
|
-
<ng-template #month>
|
|
48
|
-
<hlm-select brnCalendarMonthSelect>
|
|
49
|
-
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
50
|
-
<hlm-select-value />
|
|
51
|
-
</hlm-select-trigger>
|
|
52
|
-
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
53
|
-
<hlm-select-group>
|
|
54
|
-
@for (month of _i18n.config().months(); track month) {
|
|
55
|
-
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
56
|
-
}
|
|
57
|
-
</hlm-select-group>
|
|
58
|
-
</hlm-select-content>
|
|
59
|
-
</hlm-select>
|
|
60
|
-
</ng-template>
|
|
61
|
-
<ng-template #year>
|
|
62
|
-
<hlm-select brnCalendarYearSelect>
|
|
63
|
-
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
64
|
-
<hlm-select-value />
|
|
65
|
-
</hlm-select-trigger>
|
|
66
|
-
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
67
|
-
<hlm-select-group>
|
|
68
|
-
@for (year of _i18n.config().years(); track year) {
|
|
69
|
-
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
70
|
-
}
|
|
71
|
-
</hlm-select-group>
|
|
72
|
-
</hlm-select-content>
|
|
73
|
-
</hlm-select>
|
|
74
|
-
</ng-template>
|
|
75
|
-
@let heading = _heading();
|
|
76
|
-
@switch (captionLayout()) {
|
|
77
|
-
@case ('dropdown') {
|
|
78
|
-
<ng-container [ngTemplateOutlet]="month" />
|
|
79
|
-
<ng-container [ngTemplateOutlet]="year" />
|
|
25
|
+
<div class="inline-flex flex-col gap-4">
|
|
26
|
+
<!-- Header -->
|
|
27
|
+
<div class="flex w-full items-center justify-between gap-1.5">
|
|
28
|
+
<ng-template #month>
|
|
29
|
+
<hlm-select brnCalendarMonthSelect class="order-1">
|
|
30
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
31
|
+
<hlm-select-value />
|
|
32
|
+
</hlm-select-trigger>
|
|
33
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
34
|
+
<hlm-select-group>
|
|
35
|
+
@for (month of _i18n.config().months(); track month) {
|
|
36
|
+
<hlm-select-item [value]="month">{{ month }}</hlm-select-item>
|
|
80
37
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
38
|
+
</hlm-select-group>
|
|
39
|
+
</hlm-select-content>
|
|
40
|
+
</hlm-select>
|
|
41
|
+
</ng-template>
|
|
42
|
+
<ng-template #year>
|
|
43
|
+
<hlm-select brnCalendarYearSelect class="order-3">
|
|
44
|
+
<hlm-select-trigger size="sm" [class]="_selectClass">
|
|
45
|
+
<hlm-select-value />
|
|
46
|
+
</hlm-select-trigger>
|
|
47
|
+
<hlm-select-content *hlmSelectPortal class="max-h-80">
|
|
48
|
+
<hlm-select-group>
|
|
49
|
+
@for (year of _i18n.config().years(); track year) {
|
|
50
|
+
<hlm-select-item [value]="year">{{ year }}</hlm-select-item>
|
|
84
51
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
52
|
+
</hlm-select-group>
|
|
53
|
+
</hlm-select-content>
|
|
54
|
+
</hlm-select>
|
|
55
|
+
</ng-template>
|
|
56
|
+
@let heading = _heading();
|
|
57
|
+
|
|
58
|
+
<button
|
|
59
|
+
brnCalendarPreviousButton
|
|
60
|
+
variant="ghost"
|
|
61
|
+
hlmBtn
|
|
62
|
+
class="order-first size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
63
|
+
>
|
|
64
|
+
<ng-icon name="lucideChevronLeft" class="rtl:rotate-180" />
|
|
65
|
+
</button>
|
|
66
|
+
|
|
67
|
+
@switch (captionLayout()) {
|
|
68
|
+
@case ('dropdown') {
|
|
69
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
70
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
71
|
+
}
|
|
72
|
+
@case ('dropdown-months') {
|
|
73
|
+
<ng-container [ngTemplateOutlet]="month" />
|
|
74
|
+
<div brnCalendarHeader class="order-4 text-sm font-medium">{{ heading.year }}</div>
|
|
75
|
+
}
|
|
76
|
+
@case ('dropdown-years') {
|
|
77
|
+
<div brnCalendarHeader class="order-2 text-sm font-medium">{{ heading.month }}</div>
|
|
78
|
+
<ng-container [ngTemplateOutlet]="year" />
|
|
79
|
+
}
|
|
80
|
+
@case ('label') {
|
|
81
|
+
<div brnCalendarHeader class="order-5 text-sm font-medium">{{ heading.header }}</div>
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
<button
|
|
86
|
+
brnCalendarNextButton
|
|
87
|
+
hlmBtn
|
|
88
|
+
variant="ghost"
|
|
89
|
+
class="order-last size-(--cell-size) p-0 select-none aria-disabled:opacity-50"
|
|
90
|
+
>
|
|
91
|
+
<ng-icon name="lucideChevronRight" class="rtl:rotate-180" />
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
112
94
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
95
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
96
|
+
<thead aria-hidden="true">
|
|
97
|
+
<tr class="flex">
|
|
98
|
+
<th
|
|
99
|
+
*brnCalendarWeekday="let weekday"
|
|
100
|
+
scope="col"
|
|
101
|
+
class="text-muted-foreground flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal select-none"
|
|
102
|
+
[attr.aria-label]="_i18n.config().labelWeekday(weekday)"
|
|
103
|
+
>
|
|
104
|
+
{{ _i18n.config().formatWeekdayName(weekday) }}
|
|
105
|
+
</th>
|
|
106
|
+
</tr>
|
|
107
|
+
</thead>
|
|
108
|
+
|
|
109
|
+
<tbody role="rowgroup">
|
|
110
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
111
|
+
@for (date of week; track _dateAdapter.getTime(date)) {
|
|
112
|
+
<td
|
|
113
|
+
brnCalendarCell
|
|
114
|
+
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)"
|
|
121
115
|
>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<td
|
|
131
|
-
brnCalendarCell
|
|
132
|
-
class="data-[selected]:data-[outside]:bg-accent/50 data-[selected]:bg-accent 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"
|
|
133
|
-
>
|
|
134
|
-
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
135
|
-
{{ _dateAdapter.getDate(date) }}
|
|
136
|
-
</button>
|
|
137
|
-
</td>
|
|
138
|
-
}
|
|
139
|
-
</tr>
|
|
140
|
-
</tbody>
|
|
141
|
-
</table>
|
|
142
|
-
</div>
|
|
116
|
+
<button brnCalendarCellButton [date]="date" [class]="_btnClass">
|
|
117
|
+
{{ _dateAdapter.getDate(date) }}
|
|
118
|
+
</button>
|
|
119
|
+
</td>
|
|
120
|
+
}
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|
|
143
124
|
</div>
|
|
144
125
|
`,
|
|
145
126
|
})
|
|
146
127
|
export class HlmCalendar<T> {
|
|
147
|
-
public readonly calendarClass = input<ClassValue>('');
|
|
148
|
-
|
|
149
|
-
protected readonly _computedCalenderClass = computed(() => hlm('rounded-md border p-3', this.calendarClass()));
|
|
150
|
-
|
|
151
128
|
/** Access the calendar i18n */
|
|
152
129
|
protected readonly _i18n = injectBrnCalendarI18n();
|
|
153
130
|
|
|
154
131
|
/** Access the date time adapter */
|
|
155
132
|
protected readonly _dateAdapter = injectDateAdapter<T>();
|
|
156
133
|
|
|
157
|
-
/** The days to highlight. */
|
|
158
|
-
public readonly highlightDays = input<T[]>([]);
|
|
159
|
-
|
|
160
|
-
/** The minimum date that can be selected.*/
|
|
161
|
-
public readonly min = input<T>();
|
|
162
|
-
|
|
163
|
-
/** The maximum date that can be selected. */
|
|
164
|
-
public readonly max = input<T>();
|
|
165
|
-
|
|
166
134
|
/** Show dropdowns to navigate between months or years. */
|
|
167
135
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
168
136
|
|
|
169
|
-
/** Determine if the date picker is disabled. */
|
|
170
|
-
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
171
|
-
transform: booleanAttribute,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
/** The selected value. */
|
|
175
|
-
public readonly date = model<T>();
|
|
176
|
-
|
|
177
|
-
/** Whether a specific date is disabled. */
|
|
178
|
-
public readonly dateDisabled = input<(date: T) => boolean>(() => false);
|
|
179
|
-
|
|
180
|
-
/** The day the week starts on */
|
|
181
|
-
public readonly weekStartsOn = input<Weekday, NumberInput>(undefined, {
|
|
182
|
-
transform: (v: unknown) => numberAttribute(v) as Weekday,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
/** The default focused date. */
|
|
186
|
-
public readonly defaultFocusedDate = input<T>();
|
|
187
|
-
|
|
188
137
|
/** Access the calendar directive */
|
|
189
|
-
private readonly _calendar =
|
|
138
|
+
private readonly _calendar = inject(BrnCalendar);
|
|
190
139
|
|
|
191
140
|
/** Get the heading for the current month and year */
|
|
192
141
|
protected readonly _heading = computed(() => {
|
|
193
142
|
const config = this._i18n.config();
|
|
194
|
-
const date = this._calendar
|
|
143
|
+
const date = this._calendar.focusedDate();
|
|
195
144
|
|
|
196
145
|
return {
|
|
197
146
|
header: config.formatHeader(this._dateAdapter.getMonth(date), this._dateAdapter.getYear(date)),
|
|
@@ -201,17 +150,13 @@ export class HlmCalendar<T> {
|
|
|
201
150
|
});
|
|
202
151
|
|
|
203
152
|
protected readonly _btnClass = hlm(
|
|
204
|
-
buttonVariants({ variant: 'ghost' }),
|
|
205
|
-
'size-
|
|
206
|
-
'data-[outside]:
|
|
207
|
-
'data-[today]:bg-accent data-[today]:text-accent-foreground',
|
|
208
|
-
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:hover:bg-primary dark:hover:text-accent-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground',
|
|
209
|
-
'data-[disabled]:text-muted-foreground data-[disabled]:opacity-50',
|
|
210
|
-
'dark:hover:text-accent-foreground',
|
|
153
|
+
buttonVariants({ variant: 'ghost', size: 'icon' }),
|
|
154
|
+
'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: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',
|
|
155
|
+
'data-[outside=true]:opacity-50',
|
|
211
156
|
"data-[highlighted]:before:content-['']",
|
|
212
157
|
'data-[highlighted]:before:absolute',
|
|
213
158
|
'data-[highlighted]:before:bottom-1',
|
|
214
|
-
'data-[highlighted]:before:
|
|
159
|
+
'data-[highlighted]:before:start-1/2',
|
|
215
160
|
'data-[highlighted]:before:h-1',
|
|
216
161
|
'data-[highlighted]:before:w-1',
|
|
217
162
|
'data-[highlighted]:before:-translate-x-1/2',
|
|
@@ -219,5 +164,12 @@ export class HlmCalendar<T> {
|
|
|
219
164
|
'data-[highlighted]:before:bg-destructive',
|
|
220
165
|
);
|
|
221
166
|
|
|
222
|
-
protected readonly _selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:
|
|
167
|
+
protected readonly _selectClass = 'gap-0 px-1.5 py-2 [&>ng-icon]:ms-1';
|
|
168
|
+
|
|
169
|
+
constructor() {
|
|
170
|
+
classes(
|
|
171
|
+
() =>
|
|
172
|
+
'spartan-calendar group/calendar bg-background block in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',
|
|
173
|
+
);
|
|
174
|
+
}
|
|
223
175
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Directive } from '@angular/core';
|
|
2
2
|
import { BrnComboboxMultiple } from '@spartan-ng/brain/combobox';
|
|
3
|
-
import {
|
|
4
|
-
import { BrnPopover, provideBrnPopoverConfig } from '@spartan-ng/brain/popover';
|
|
3
|
+
import { BrnPopover, provideBrnPopoverConfig, provideBrnPopoverDefaultOptions } from '@spartan-ng/brain/popover';
|
|
5
4
|
import { classes } from '<%- importAlias %>/utils';
|
|
6
5
|
|
|
7
6
|
@Directive({
|
|
@@ -11,9 +10,7 @@ import { classes } from '<%- importAlias %>/utils';
|
|
|
11
10
|
align: 'start',
|
|
12
11
|
sideOffset: 6,
|
|
13
12
|
}),
|
|
14
|
-
|
|
15
|
-
autoFocus: 'first-heading',
|
|
16
|
-
}),
|
|
13
|
+
provideBrnPopoverDefaultOptions({ role: null }),
|
|
17
14
|
],
|
|
18
15
|
hostDirectives: [
|
|
19
16
|
{
|
|
@@ -32,16 +29,7 @@ import { classes } from '<%- importAlias %>/utils';
|
|
|
32
29
|
},
|
|
33
30
|
{
|
|
34
31
|
directive: BrnPopover,
|
|
35
|
-
inputs: [
|
|
36
|
-
'align',
|
|
37
|
-
'autoFocus',
|
|
38
|
-
'closeDelay',
|
|
39
|
-
'closeOnOutsidePointerEvents',
|
|
40
|
-
'sideOffset',
|
|
41
|
-
'state',
|
|
42
|
-
'offsetX',
|
|
43
|
-
'restoreFocus',
|
|
44
|
-
],
|
|
32
|
+
inputs: ['align', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
|
|
45
33
|
outputs: ['stateChanged', 'closed'],
|
|
46
34
|
},
|
|
47
35
|
],
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Directive } from '@angular/core';
|
|
2
2
|
import { BrnCombobox } from '@spartan-ng/brain/combobox';
|
|
3
|
-
import {
|
|
4
|
-
import { BrnPopover, provideBrnPopoverConfig } from '@spartan-ng/brain/popover';
|
|
3
|
+
import { BrnPopover, provideBrnPopoverConfig, provideBrnPopoverDefaultOptions } from '@spartan-ng/brain/popover';
|
|
5
4
|
import { classes } from '<%- importAlias %>/utils';
|
|
6
5
|
|
|
7
6
|
@Directive({
|
|
@@ -11,9 +10,7 @@ import { classes } from '<%- importAlias %>/utils';
|
|
|
11
10
|
align: 'start',
|
|
12
11
|
sideOffset: 6,
|
|
13
12
|
}),
|
|
14
|
-
|
|
15
|
-
autoFocus: 'first-heading',
|
|
16
|
-
}),
|
|
13
|
+
provideBrnPopoverDefaultOptions({ role: null }),
|
|
17
14
|
],
|
|
18
15
|
hostDirectives: [
|
|
19
16
|
{
|
|
@@ -32,16 +29,7 @@ import { classes } from '<%- importAlias %>/utils';
|
|
|
32
29
|
},
|
|
33
30
|
{
|
|
34
31
|
directive: BrnPopover,
|
|
35
|
-
inputs: [
|
|
36
|
-
'align',
|
|
37
|
-
'autoFocus',
|
|
38
|
-
'closeDelay',
|
|
39
|
-
'closeOnOutsidePointerEvents',
|
|
40
|
-
'sideOffset',
|
|
41
|
-
'state',
|
|
42
|
-
'offsetX',
|
|
43
|
-
'restoreFocus',
|
|
44
|
-
],
|
|
32
|
+
inputs: ['align', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
|
|
45
33
|
outputs: ['stateChanged', 'closed'],
|
|
46
34
|
},
|
|
47
35
|
],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Directive, effect, ElementRef, inject, input
|
|
2
|
-
import {
|
|
1
|
+
import { Directive, effect, ElementRef, inject, input } from '@angular/core';
|
|
2
|
+
import { BrnOverlay } from '@spartan-ng/brain/overlay';
|
|
3
3
|
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
4
4
|
|
|
5
5
|
@Directive({ selector: '[hlmDatePickerAnchor]' })
|
|
6
6
|
export class HlmDatePickerAnchor {
|
|
7
7
|
private readonly _host = inject(ElementRef, { host: true });
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly _brnOverlay = inject(BrnOverlay, { optional: true });
|
|
9
9
|
|
|
10
10
|
public readonly hlmDatePickerAnchorFor = input<BrnPopover | undefined>(undefined, {
|
|
11
11
|
alias: 'hlmDatePickerAnchorFor',
|
|
@@ -13,16 +13,9 @@ export class HlmDatePickerAnchor {
|
|
|
13
13
|
|
|
14
14
|
constructor() {
|
|
15
15
|
effect(() => {
|
|
16
|
-
|
|
17
|
-
untracked(() => {
|
|
18
|
-
if (!brnDialog) return;
|
|
19
|
-
brnDialog.mutableAttachTo.set(this._host.nativeElement);
|
|
20
|
-
brnDialog.mutableCloseOnOutsidePointerEvents.set(true);
|
|
21
|
-
});
|
|
16
|
+
this.hlmDatePickerAnchorFor()?.setOrigin(this._host.nativeElement);
|
|
22
17
|
});
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
this._brnDialog.mutableAttachTo.set(this._host.nativeElement);
|
|
26
|
-
this._brnDialog.mutableCloseOnOutsidePointerEvents.set(true);
|
|
19
|
+
this._brnOverlay?.setOrigin(this._host.nativeElement);
|
|
27
20
|
}
|
|
28
21
|
}
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
viewChild,
|
|
15
15
|
} from '@angular/core';
|
|
16
16
|
import { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
|
-
import type { BrnDialogState } from '@spartan-ng/brain/dialog';
|
|
18
17
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
19
18
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
19
|
+
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
20
20
|
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
21
21
|
import { HlmCalendarMulti } from '<%- importAlias %>/calendar';
|
|
22
22
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
@@ -53,7 +53,7 @@ export const HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR = {
|
|
|
53
53
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
54
54
|
<ng-content select="[hlmDatePickerHeader]" />
|
|
55
55
|
<hlm-calendar-multi
|
|
56
|
-
|
|
56
|
+
class="rounded-none border-0"
|
|
57
57
|
[date]="_mutableDate()"
|
|
58
58
|
[captionLayout]="captionLayout()"
|
|
59
59
|
[min]="min()"
|
|
@@ -115,7 +115,7 @@ export class HlmDatePickerMulti<T> implements HlmDatePickerBase<T>, ControlValue
|
|
|
115
115
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
116
116
|
public readonly transformDates = input<(date: T[]) => T[]>(this._config.transformDates);
|
|
117
117
|
|
|
118
|
-
protected readonly _popoverState = signal<
|
|
118
|
+
protected readonly _popoverState = signal<BrnOverlayState | null>(null);
|
|
119
119
|
|
|
120
120
|
protected readonly _disabled = linkedSignal(this.disabled);
|
|
121
121
|
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
viewChild,
|
|
14
14
|
} from '@angular/core';
|
|
15
15
|
import { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
16
|
-
import type { BrnDialogState } from '@spartan-ng/brain/dialog';
|
|
17
16
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
18
17
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
18
|
+
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
19
19
|
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
20
20
|
import { HlmCalendar } from '<%- importAlias %>/calendar';
|
|
21
21
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
@@ -38,7 +38,6 @@ export const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
|
38
38
|
template: `
|
|
39
39
|
<hlm-popover
|
|
40
40
|
sideOffset="5"
|
|
41
|
-
autoFocus="first-heading"
|
|
42
41
|
[state]="_popoverState()"
|
|
43
42
|
(stateChanged)="_popoverState.set($event)"
|
|
44
43
|
(closed)="_onTouched?.()"
|
|
@@ -48,7 +47,7 @@ export const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
|
48
47
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
49
48
|
<ng-content select="[hlmDatePickerHeader]" />
|
|
50
49
|
<hlm-calendar
|
|
51
|
-
|
|
50
|
+
class="rounded-none border-0"
|
|
52
51
|
[captionLayout]="captionLayout()"
|
|
53
52
|
[date]="_mutableDate()"
|
|
54
53
|
[defaultFocusedDate]="_mutableDate() ?? defaultFocusedDate()"
|
|
@@ -102,7 +101,7 @@ export class HlmDatePicker<T> implements HlmDatePickerBase<T>, ControlValueAcces
|
|
|
102
101
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
103
102
|
public readonly transformDate = input<(date: T) => T>(this._config.transformDate);
|
|
104
103
|
|
|
105
|
-
protected readonly _popoverState = signal<
|
|
104
|
+
protected readonly _popoverState = signal<BrnOverlayState | null>(null);
|
|
106
105
|
|
|
107
106
|
protected readonly _disabled = linkedSignal(this.disabled);
|
|
108
107
|
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
viewChild,
|
|
15
15
|
} from '@angular/core';
|
|
16
16
|
import { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
|
-
import type { BrnDialogState } from '@spartan-ng/brain/dialog';
|
|
18
17
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
19
18
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
19
|
+
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
20
20
|
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
21
21
|
import { HlmCalendarRange } from '<%- importAlias %>/calendar';
|
|
22
22
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
@@ -53,7 +53,7 @@ export const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
|
53
53
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
54
54
|
<ng-content select="[hlmDatePickerHeader]" />
|
|
55
55
|
<hlm-calendar-range
|
|
56
|
-
|
|
56
|
+
class="rounded-none border-0"
|
|
57
57
|
[startDate]="_start()"
|
|
58
58
|
[captionLayout]="captionLayout()"
|
|
59
59
|
[endDate]="_end()"
|
|
@@ -108,7 +108,7 @@ export class HlmDateRangePicker<T> implements HlmDatePickerBase<T>, ControlValue
|
|
|
108
108
|
/** Defines how the date should be transformed before saving to model/form. */
|
|
109
109
|
public readonly transformDates = input<(date: [T, T]) => [T, T]>(this._config.transformDates);
|
|
110
110
|
|
|
111
|
-
protected readonly _popoverState = signal<
|
|
111
|
+
protected readonly _popoverState = signal<BrnOverlayState | null>(null);
|
|
112
112
|
|
|
113
113
|
protected readonly _disabled = linkedSignal(this.disabled);
|
|
114
114
|
|
|
@@ -3,7 +3,7 @@ import { BrnDialogClose } from '@spartan-ng/brain/dialog';
|
|
|
3
3
|
|
|
4
4
|
@Directive({
|
|
5
5
|
selector: 'button[hlmDialogClose]',
|
|
6
|
-
hostDirectives: [
|
|
6
|
+
hostDirectives: [BrnDialogClose],
|
|
7
7
|
host: { 'data-slot': 'dialog-close' },
|
|
8
8
|
})
|
|
9
9
|
export class HlmDialogClose {}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import type { ComponentType } from '@angular/cdk/portal';
|
|
2
3
|
import { NgComponentOutlet } from '@angular/common';
|
|
3
4
|
import { booleanAttribute, ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
4
5
|
import { provideIcons } from '@ng-icons/core';
|
|
@@ -9,6 +10,12 @@ import { HlmIconImports } from '<%- importAlias %>/icon';
|
|
|
9
10
|
import { classes } from '<%- importAlias %>/utils';
|
|
10
11
|
import { HlmDialogClose } from './hlm-dialog-close';
|
|
11
12
|
|
|
13
|
+
type HlmDialogContentContext = {
|
|
14
|
+
$component?: ComponentType<unknown>;
|
|
15
|
+
$dynamicComponentClass?: string;
|
|
16
|
+
$showCloseButton?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
12
19
|
@Component({
|
|
13
20
|
selector: 'hlm-dialog-content',
|
|
14
21
|
imports: [NgComponentOutlet, HlmIconImports, HlmButton, HlmDialogClose],
|
|
@@ -35,7 +42,7 @@ import { HlmDialogClose } from './hlm-dialog-close';
|
|
|
35
42
|
})
|
|
36
43
|
export class HlmDialogContent {
|
|
37
44
|
private readonly _dialogRef = inject(BrnDialogRef);
|
|
38
|
-
private readonly _dialogContext = injectBrnDialogContext({ optional: true });
|
|
45
|
+
private readonly _dialogContext = injectBrnDialogContext<HlmDialogContentContext | null>({ optional: true });
|
|
39
46
|
|
|
40
47
|
public readonly showCloseButton = input<boolean, BooleanInput>(this._dialogContext?.$showCloseButton ?? true, {
|
|
41
48
|
transform: booleanAttribute,
|
|
@@ -3,7 +3,7 @@ import { BrnDrawerClose } from '@spartan-ng/brain/drawer';
|
|
|
3
3
|
|
|
4
4
|
@Directive({
|
|
5
5
|
selector: 'button[hlmDrawerClose]',
|
|
6
|
-
hostDirectives: [
|
|
6
|
+
hostDirectives: [BrnDrawerClose],
|
|
7
7
|
host: { 'data-slot': 'drawer-close' },
|
|
8
8
|
})
|
|
9
9
|
export class HlmDrawerClose {}
|
package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-content.ts.template
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { Directive, input, numberAttribute } from '@angular/core';
|
|
2
3
|
import { classes } from '<%- importAlias %>/utils';
|
|
3
4
|
|
|
4
5
|
@Directive({
|
|
5
6
|
selector: '[hlmNavigationMenuContent],hlm-navigation-menu-content',
|
|
6
|
-
host: {
|
|
7
|
+
host: {
|
|
8
|
+
'data-slot': 'navigation-menu-content',
|
|
9
|
+
'[style.--nav-offset]': 'navOffset()',
|
|
10
|
+
},
|
|
7
11
|
})
|
|
8
12
|
export class HlmNavigationMenuContent {
|
|
13
|
+
public readonly navOffset = input<number, NumberInput>(1.5, { transform: numberAttribute });
|
|
14
|
+
|
|
9
15
|
constructor() {
|
|
10
16
|
classes(() => [
|
|
11
17
|
'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out top-0 left-0 w-full p-2 pr-2.5 md:w-auto',
|
|
12
18
|
'data-[orientation=horizontal]:data-[motion=from-end]:slide-in-from-right-52 data-[orientation=horizontal]:data-[motion=from-start]:slide-in-from-left-52 data-[orientation=horizontal]:data-[motion=to-end]:slide-out-to-right-52 data-[orientation=horizontal]:data-[motion=to-start]:slide-out-to-left-52',
|
|
13
19
|
'data-[orientation=vertical]:data-[motion=from-end]:slide-in-from-bottom-52 data-[orientation=vertical]:data-[motion=from-start]:slide-in-from-top-52 data-[orientation=vertical]:data-[motion=to-end]:slide-out-to-bottom-52 data-[orientation=vertical]:data-[motion=to-start]:slide-out-to-top-52',
|
|
14
|
-
'
|
|
20
|
+
'data-[orientation=horizontal]:mt-[--spacing(var(--nav-offset))] data-[orientation=vertical]:mx-[--spacing(var(--nav-offset))]',
|
|
21
|
+
'spartan-navigation-menu-popup block',
|
|
15
22
|
]);
|
|
16
23
|
}
|
|
17
24
|
}
|
package/src/generators/ui/libs/navigation-menu/files/lib/hlm-navigation-menu-item.ts.template
CHANGED
|
@@ -5,9 +5,12 @@ import { classes } from '<%- importAlias %>/utils';
|
|
|
5
5
|
@Directive({
|
|
6
6
|
selector: 'li[hlmNavigationMenuItem]',
|
|
7
7
|
hostDirectives: [{ directive: BrnNavigationMenuItem, inputs: ['id'] }],
|
|
8
|
+
host: {
|
|
9
|
+
'data-slot': 'navigation-menu-item',
|
|
10
|
+
},
|
|
8
11
|
})
|
|
9
12
|
export class HlmNavigationMenuItem {
|
|
10
13
|
constructor() {
|
|
11
|
-
classes(() => 'relative');
|
|
14
|
+
classes(() => 'relative has-[:focus]:z-10 data-active:z-10');
|
|
12
15
|
}
|
|
13
16
|
}
|