@spartan-ng/cli 1.2.0-beta.1 → 1.2.0-beta.3
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 +1 -0
- package/generators.json +10 -0
- package/package.json +1 -1
- package/src/generators/healthcheck/generator.js +2 -0
- package/src/generators/healthcheck/generator.js.map +1 -1
- package/src/generators/healthcheck/healthchecks/hlm-date-picker-min-max.d.ts +2 -0
- package/src/generators/healthcheck/healthchecks/hlm-date-picker-min-max.js +37 -0
- package/src/generators/healthcheck/healthchecks/hlm-date-picker-min-max.js.map +1 -0
- package/src/generators/migrate-date-picker-min-max/compat.d.ts +5 -0
- package/src/generators/migrate-date-picker-min-max/compat.js +7 -0
- package/src/generators/migrate-date-picker-min-max/compat.js.map +1 -0
- package/src/generators/migrate-date-picker-min-max/generator.d.ts +4 -0
- package/src/generators/migrate-date-picker-min-max/generator.js +52 -0
- package/src/generators/migrate-date-picker-min-max/generator.js.map +1 -0
- package/src/generators/migrate-date-picker-min-max/schema.d.ts +4 -0
- package/src/generators/migrate-date-picker-min-max/schema.json +18 -0
- package/src/generators/migrate-helm-libraries/generator.js +31 -24
- package/src/generators/migrate-helm-libraries/generator.js.map +1 -1
- package/src/generators/migrate-helm-libraries/schema.d.ts +2 -0
- package/src/generators/migrate-helm-libraries/schema.json +7 -0
- package/src/generators/ui/libs/attachment/files/index.ts.template +31 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-action.ts.template +15 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-actions.ts.template +15 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-content.ts.template +12 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-description.ts.template +15 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-group.ts.template +15 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-media.ts.template +35 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-title.ts.template +15 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment-trigger.ts.template +23 -0
- package/src/generators/ui/libs/attachment/files/lib/hlm-attachment.ts.template +47 -0
- package/src/generators/ui/libs/attachment/generator.d.ts +3 -0
- package/src/generators/ui/libs/attachment/generator.js +9 -0
- package/src/generators/ui/libs/attachment/generator.js.map +1 -0
- package/src/generators/ui/libs/bubble/files/index.ts.template +11 -0
- package/src/generators/ui/libs/bubble/files/lib/hlm-bubble-content.ts.template +15 -0
- package/src/generators/ui/libs/bubble/files/lib/hlm-bubble-group.ts.template +12 -0
- package/src/generators/ui/libs/bubble/files/lib/hlm-bubble-reactions.ts.template +43 -0
- package/src/generators/ui/libs/bubble/files/lib/hlm-bubble.ts.template +46 -0
- package/src/generators/ui/libs/bubble/generator.d.ts +3 -0
- package/src/generators/ui/libs/bubble/generator.js +9 -0
- package/src/generators/ui/libs/bubble/generator.js.map +1 -0
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-multi-input.ts.template +15 -1
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker-input.ts.template +15 -1
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker-multi.ts.template +4 -4
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker.ts.template +5 -5
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-range-input.ts.template +15 -1
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-range-picker.ts.template +4 -4
- package/src/generators/ui/libs/date-picker/files/lib/hlm-month-year-input.ts.template +15 -1
- package/src/generators/ui/libs/date-picker/files/lib/hlm-month-year-picker.ts.template +4 -4
- package/src/generators/ui/libs/marker/files/index.ts.template +9 -0
- package/src/generators/ui/libs/marker/files/lib/hlm-marker-content.ts.template +15 -0
- package/src/generators/ui/libs/marker/files/lib/hlm-marker-icon.ts.template +15 -0
- package/src/generators/ui/libs/marker/files/lib/hlm-marker.ts.template +36 -0
- package/src/generators/ui/libs/marker/generator.d.ts +3 -0
- package/src/generators/ui/libs/marker/generator.js +9 -0
- package/src/generators/ui/libs/marker/generator.js.map +1 -0
- package/src/generators/ui/libs/message/files/index.ts.template +22 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message-avatar.ts.template +15 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message-content.ts.template +15 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message-footer.ts.template +15 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message-group.ts.template +12 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message-header.ts.template +14 -0
- package/src/generators/ui/libs/message/files/lib/hlm-message.ts.template +21 -0
- package/src/generators/ui/libs/message/generator.d.ts +3 -0
- package/src/generators/ui/libs/message/generator.js +9 -0
- package/src/generators/ui/libs/message/generator.js.map +1 -0
- package/src/generators/ui/libs/spinner/files/lib/hlm-spinner.ts.template +1 -0
- package/src/generators/ui/primitive-deps.js +4 -0
- package/src/generators/ui/primitive-deps.js.map +1 -1
- package/src/generators/ui/primitives.d.ts +1 -1
- package/src/generators/ui/style-luma.css +152 -0
- package/src/generators/ui/style-lyra.css +152 -0
- package/src/generators/ui/style-maia.css +152 -0
- package/src/generators/ui/style-mira.css +152 -0
- package/src/generators/ui/style-nova.css +152 -0
- package/src/generators/ui/style-vega.css +152 -0
- package/src/generators/ui/supported-ui-libraries.json +68 -41
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmBubbleContent],hlm-bubble-content',
|
|
6
|
+
host: { 'data-slot': 'bubble-content' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmBubbleContent {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'spartan-bubble-content [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-ring/50 w-fit max-w-full min-w-0 overflow-hidden border border-transparent wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-start [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:ring-3',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmBubbleGroup],hlm-bubble-group',
|
|
6
|
+
host: { 'data-slot': 'bubble-group' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmBubbleGroup {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(() => 'spartan-bubble-group flex min-w-0 flex-col');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
const bubbleReactionsVariants = cva(
|
|
6
|
+
'spartan-bubble-reactions absolute z-10 flex w-fit shrink-0 items-center justify-center has-[button]:p-0',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
side: {
|
|
10
|
+
top: 'top-0 -translate-y-3/4',
|
|
11
|
+
bottom: 'bottom-0 translate-y-3/4',
|
|
12
|
+
},
|
|
13
|
+
align: {
|
|
14
|
+
start: 'start-3',
|
|
15
|
+
end: 'end-3',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
side: 'bottom',
|
|
20
|
+
align: 'end',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type BubbleReactionsVariants = VariantProps<typeof bubbleReactionsVariants>;
|
|
26
|
+
|
|
27
|
+
@Directive({
|
|
28
|
+
selector: '[hlmBubbleReactions],hlm-bubble-reactions',
|
|
29
|
+
host: {
|
|
30
|
+
'data-slot': 'bubble-reactions',
|
|
31
|
+
'[attr.data-align]': 'align()',
|
|
32
|
+
'[attr.data-side]': 'side()',
|
|
33
|
+
'[attr.align]': 'null',
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
export class HlmBubbleReactions {
|
|
37
|
+
public readonly side = input<BubbleReactionsVariants['side']>('bottom');
|
|
38
|
+
public readonly align = input<BubbleReactionsVariants['align']>('end');
|
|
39
|
+
|
|
40
|
+
constructor() {
|
|
41
|
+
classes(() => bubbleReactionsVariants({ side: this.side(), align: this.align() }));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
const bubbleVariants = cva(
|
|
6
|
+
'spartan-bubble group/bubble relative flex w-fit min-w-0 flex-col group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full',
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'spartan-bubble-variant-default',
|
|
11
|
+
secondary: 'spartan-bubble-variant-secondary',
|
|
12
|
+
muted: 'spartan-bubble-variant-muted',
|
|
13
|
+
tinted: 'spartan-bubble-variant-tinted',
|
|
14
|
+
outline: 'spartan-bubble-variant-outline',
|
|
15
|
+
ghost: 'spartan-bubble-variant-ghost',
|
|
16
|
+
destructive: 'spartan-bubble-variant-destructive',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: 'default',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type BubbleVariants = VariantProps<typeof bubbleVariants>;
|
|
26
|
+
export type BubbleAlign = 'start' | 'end';
|
|
27
|
+
|
|
28
|
+
@Directive({
|
|
29
|
+
selector: '[hlmBubble],hlm-bubble',
|
|
30
|
+
host: {
|
|
31
|
+
'data-slot': 'bubble',
|
|
32
|
+
'[attr.data-variant]': 'variant()',
|
|
33
|
+
'[attr.data-align]': 'align()',
|
|
34
|
+
// Prevent the legacy HTML `align` attribute (from `align="end"` bindings) from
|
|
35
|
+
// forcing text-align on the bubble content.
|
|
36
|
+
'[attr.align]': 'null',
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
export class HlmBubble {
|
|
40
|
+
public readonly variant = input<BubbleVariants['variant']>('default');
|
|
41
|
+
public readonly align = input<BubbleAlign>('start');
|
|
42
|
+
|
|
43
|
+
constructor() {
|
|
44
|
+
classes(() => bubbleVariants({ variant: this.variant() }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generator = generator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("../../../base/generator"));
|
|
6
|
+
async function generator(tree, options) {
|
|
7
|
+
return await (0, generator_1.default)(tree, { ...options, name: 'bubble' });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/bubble/generator.ts"],"names":[],"mappings":";;AAIA,8BAEC;;AALD,gFAAuD;AAGhD,KAAK,UAAU,SAAS,CAAC,IAAU,EAAE,OAA+B;IAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
2
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
3
|
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type BrnDatePickerTriggerBase,
|
|
7
7
|
provideBrnDatePickerTrigger,
|
|
8
8
|
} from '@spartan-ng/brain/date-picker';
|
|
9
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
9
10
|
import { HlmInputGroup, HlmInputGroupImports } from '<%- importAlias %>/input-group';
|
|
10
11
|
import { injectHlmDatePickerMultiConfig } from './hlm-date-picker-multi.token';
|
|
11
12
|
|
|
@@ -24,6 +25,11 @@ import { injectHlmDatePickerMultiConfig } from './hlm-date-picker-multi.token';
|
|
|
24
25
|
[placeholder]="placeholder()"
|
|
25
26
|
[disabled]="_disabled()"
|
|
26
27
|
[forceInvalid]="forceInvalid()"
|
|
28
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
29
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
30
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
31
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
32
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
27
33
|
(click)="_handleClick()"
|
|
28
34
|
(keydown.arrowDown)="_open()"
|
|
29
35
|
(keydown.enter)="_handleEnter($event)"
|
|
@@ -58,6 +64,14 @@ import { injectHlmDatePickerMultiConfig } from './hlm-date-picker-multi.token';
|
|
|
58
64
|
})
|
|
59
65
|
export class HlmDateMultiInput<T> extends BrnDateInput<T[]> implements BrnDatePickerTriggerBase {
|
|
60
66
|
private readonly _config = injectHlmDatePickerMultiConfig<T>();
|
|
67
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
68
|
+
|
|
69
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
70
|
+
protected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());
|
|
71
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
72
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
73
|
+
|
|
74
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
61
75
|
/**
|
|
62
76
|
* Parses input text into dates. Return `null` for invalid input - the
|
|
63
77
|
* picker's dates are cleared while the text is preserved so the user can
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
2
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
3
|
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type BrnDatePickerTriggerBase,
|
|
7
7
|
provideBrnDatePickerTrigger,
|
|
8
8
|
} from '@spartan-ng/brain/date-picker';
|
|
9
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
9
10
|
import { HlmInputGroup, HlmInputGroupImports } from '<%- importAlias %>/input-group';
|
|
10
11
|
import { injectHlmDatePickerConfig } from './hlm-date-picker.token';
|
|
11
12
|
|
|
@@ -24,6 +25,11 @@ import { injectHlmDatePickerConfig } from './hlm-date-picker.token';
|
|
|
24
25
|
[placeholder]="placeholder()"
|
|
25
26
|
[disabled]="_disabled()"
|
|
26
27
|
[forceInvalid]="forceInvalid()"
|
|
28
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
29
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
30
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
31
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
32
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
27
33
|
(click)="_handleClick()"
|
|
28
34
|
(keydown.arrowDown)="_open()"
|
|
29
35
|
(keydown.enter)="_handleEnter($event)"
|
|
@@ -58,6 +64,14 @@ import { injectHlmDatePickerConfig } from './hlm-date-picker.token';
|
|
|
58
64
|
})
|
|
59
65
|
export class HlmDatePickerInput<T> extends BrnDateInput<T> implements BrnDatePickerTriggerBase {
|
|
60
66
|
private readonly _config = injectHlmDatePickerConfig<T>();
|
|
67
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
68
|
+
|
|
69
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
70
|
+
protected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());
|
|
71
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
72
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
73
|
+
|
|
74
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
61
75
|
|
|
62
76
|
/**
|
|
63
77
|
* Parses input text into a date value. Return `null` for invalid
|
|
@@ -50,8 +50,8 @@ export const HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR = {
|
|
|
50
50
|
class="rounded-none border-0"
|
|
51
51
|
[date]="_mutableDate()"
|
|
52
52
|
[captionLayout]="captionLayout()"
|
|
53
|
-
[min]="
|
|
54
|
-
[max]="
|
|
53
|
+
[min]="minDate()"
|
|
54
|
+
[max]="maxDate()"
|
|
55
55
|
[minSelection]="minSelection()"
|
|
56
56
|
[maxSelection]="maxSelection()"
|
|
57
57
|
[disabled]="_disabled()"
|
|
@@ -75,10 +75,10 @@ export class HlmDatePickerMulti<T> implements BrnDatePickerBase<T[]>, ControlVal
|
|
|
75
75
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
76
76
|
|
|
77
77
|
/** The minimum date that can be selected.*/
|
|
78
|
-
public readonly
|
|
78
|
+
public readonly minDate = input<T>();
|
|
79
79
|
|
|
80
80
|
/** The maximum date that can be selected. */
|
|
81
|
-
public readonly
|
|
81
|
+
public readonly maxDate = input<T>();
|
|
82
82
|
|
|
83
83
|
/** The minimum selectable dates. */
|
|
84
84
|
public readonly minSelection = input<number, NumberInput>(undefined, {
|
|
@@ -46,8 +46,8 @@ export const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
|
46
46
|
[captionLayout]="captionLayout()"
|
|
47
47
|
[date]="_mutableDate()"
|
|
48
48
|
[defaultFocusedDate]="_mutableDate() ?? defaultFocusedDate()"
|
|
49
|
-
[min]="
|
|
50
|
-
[max]="
|
|
49
|
+
[min]="minDate()"
|
|
50
|
+
[max]="maxDate()"
|
|
51
51
|
[disabled]="_disabled()"
|
|
52
52
|
(dateChange)="_handleChange($event)"
|
|
53
53
|
/>
|
|
@@ -68,11 +68,11 @@ export class HlmDatePicker<T> implements BrnDatePickerBase<T>, ControlValueAcces
|
|
|
68
68
|
/** Show dropdowns to navigate between months or years. */
|
|
69
69
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
70
70
|
|
|
71
|
-
/** The minimum date that can be selected
|
|
72
|
-
public readonly
|
|
71
|
+
/** The minimum date that can be selected. */
|
|
72
|
+
public readonly minDate = input<T>();
|
|
73
73
|
|
|
74
74
|
/** The maximum date that can be selected. */
|
|
75
|
-
public readonly
|
|
75
|
+
public readonly maxDate = input<T>();
|
|
76
76
|
|
|
77
77
|
/** Determine if the date picker is disabled. */
|
|
78
78
|
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
2
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
3
|
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type BrnDatePickerTriggerBase,
|
|
7
7
|
provideBrnDatePickerTrigger,
|
|
8
8
|
} from '@spartan-ng/brain/date-picker';
|
|
9
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
9
10
|
import { HlmInputGroup, HlmInputGroupImports } from '<%- importAlias %>/input-group';
|
|
10
11
|
import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
11
12
|
|
|
@@ -24,6 +25,11 @@ import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
|
24
25
|
[placeholder]="placeholder()"
|
|
25
26
|
[disabled]="_disabled()"
|
|
26
27
|
[forceInvalid]="forceInvalid()"
|
|
28
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
29
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
30
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
31
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
32
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
27
33
|
(click)="_handleClick()"
|
|
28
34
|
(keydown.arrowDown)="_open()"
|
|
29
35
|
(keydown.enter)="_handleEnter($event)"
|
|
@@ -58,6 +64,14 @@ import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
|
58
64
|
})
|
|
59
65
|
export class HlmDateRangeInput<T> extends BrnDateInput<[T, T]> implements BrnDatePickerTriggerBase {
|
|
60
66
|
private readonly _config = injectHlmDateRangePickerConfig<T>();
|
|
67
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
68
|
+
|
|
69
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
70
|
+
protected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());
|
|
71
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
72
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
73
|
+
|
|
74
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
61
75
|
|
|
62
76
|
/**
|
|
63
77
|
* Parses input text into a date range. Return `null` for invalid
|
|
@@ -51,8 +51,8 @@ export const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
|
51
51
|
[startDate]="_start()"
|
|
52
52
|
[captionLayout]="captionLayout()"
|
|
53
53
|
[endDate]="_end()"
|
|
54
|
-
[min]="
|
|
55
|
-
[max]="
|
|
54
|
+
[min]="minDate()"
|
|
55
|
+
[max]="maxDate()"
|
|
56
56
|
[disabled]="_disabled()"
|
|
57
57
|
(startDateChange)="_handleStartDayChange($event)"
|
|
58
58
|
(endDateChange)="_handleEndDateChange($event)"
|
|
@@ -75,10 +75,10 @@ export class HlmDateRangePicker<T> implements BrnDatePickerBase<[T, T]>, Control
|
|
|
75
75
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
76
76
|
|
|
77
77
|
/** The minimum date that can be selected.*/
|
|
78
|
-
public readonly
|
|
78
|
+
public readonly minDate = input<T>();
|
|
79
79
|
|
|
80
80
|
/** The maximum date that can be selected. */
|
|
81
|
-
public readonly
|
|
81
|
+
public readonly maxDate = input<T>();
|
|
82
82
|
|
|
83
83
|
/** Determine if the date picker is disabled. */
|
|
84
84
|
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
2
2
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
3
|
import { lucideCalendar, lucideX } from '@ng-icons/lucide';
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type BrnDatePickerTriggerBase,
|
|
7
7
|
provideBrnDatePickerTrigger,
|
|
8
8
|
} from '@spartan-ng/brain/date-picker';
|
|
9
|
+
import { BrnFieldControl } from '@spartan-ng/brain/field';
|
|
9
10
|
import { HlmInputGroup, HlmInputGroupImports } from '<%- importAlias %>/input-group';
|
|
10
11
|
import { injectHlmMonthYearPickerConfig } from './hlm-month-year-picker.token';
|
|
11
12
|
|
|
@@ -24,6 +25,11 @@ import { injectHlmMonthYearPickerConfig } from './hlm-month-year-picker.token';
|
|
|
24
25
|
[placeholder]="placeholder()"
|
|
25
26
|
[disabled]="_disabled()"
|
|
26
27
|
[forceInvalid]="forceInvalid()"
|
|
28
|
+
[attr.aria-invalid]="_ariaInvalid()"
|
|
29
|
+
[attr.data-invalid]="_ariaInvalid()"
|
|
30
|
+
[attr.data-touched]="_touched?.() ? 'true' : null"
|
|
31
|
+
[attr.data-dirty]="_dirty?.() ? 'true' : null"
|
|
32
|
+
[attr.data-matches-spartan-invalid]="_spartanInvalid() ? 'true' : null"
|
|
27
33
|
(click)="_handleClick()"
|
|
28
34
|
(keydown.arrowDown)="_open()"
|
|
29
35
|
(keydown.enter)="_handleEnter($event)"
|
|
@@ -58,6 +64,14 @@ import { injectHlmMonthYearPickerConfig } from './hlm-month-year-picker.token';
|
|
|
58
64
|
})
|
|
59
65
|
export class HlmMonthYearInput<T> extends BrnDateInput<T> implements BrnDatePickerTriggerBase {
|
|
60
66
|
private readonly _config = injectHlmMonthYearPickerConfig<T>();
|
|
67
|
+
private readonly _fieldControl = inject(BrnFieldControl, { optional: true });
|
|
68
|
+
|
|
69
|
+
private readonly _invalid = this._fieldControl?.invalid;
|
|
70
|
+
protected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());
|
|
71
|
+
protected readonly _dirty = this._fieldControl?.dirty;
|
|
72
|
+
protected readonly _touched = this._fieldControl?.touched;
|
|
73
|
+
|
|
74
|
+
protected readonly _ariaInvalid = computed(() => (this._invalid?.() ? 'true' : null));
|
|
61
75
|
|
|
62
76
|
/**
|
|
63
77
|
* Parses input text into a date value. Return `null` for invalid
|
|
@@ -48,8 +48,8 @@ export const HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR = {
|
|
|
48
48
|
class="rounded-none border-0"
|
|
49
49
|
[date]="_mutableDate()"
|
|
50
50
|
[defaultFocusedDate]="_mutableDate() ?? defaultFocusedDate()"
|
|
51
|
-
[min]="
|
|
52
|
-
[max]="
|
|
51
|
+
[min]="minDate()"
|
|
52
|
+
[max]="maxDate()"
|
|
53
53
|
[disabled]="_disabled()"
|
|
54
54
|
(dateChange)="_handleChange($event)"
|
|
55
55
|
/>
|
|
@@ -68,10 +68,10 @@ export class HlmMonthYearPicker<T> implements BrnDatePickerBase<T>, ControlValue
|
|
|
68
68
|
public readonly align = input<BrnPopoverAlign>('center');
|
|
69
69
|
|
|
70
70
|
/** The minimum date that can be selected.*/
|
|
71
|
-
public readonly
|
|
71
|
+
public readonly minDate = input<T>();
|
|
72
72
|
|
|
73
73
|
/** The maximum date that can be selected. */
|
|
74
|
-
public readonly
|
|
74
|
+
public readonly maxDate = input<T>();
|
|
75
75
|
|
|
76
76
|
/** Determine if the date picker is disabled. */
|
|
77
77
|
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HlmMarker } from './lib/hlm-marker';
|
|
2
|
+
import { HlmMarkerContent } from './lib/hlm-marker-content';
|
|
3
|
+
import { HlmMarkerIcon } from './lib/hlm-marker-icon';
|
|
4
|
+
|
|
5
|
+
export * from './lib/hlm-marker';
|
|
6
|
+
export * from './lib/hlm-marker-content';
|
|
7
|
+
export * from './lib/hlm-marker-icon';
|
|
8
|
+
|
|
9
|
+
export const HlmMarkerImports = [HlmMarker, HlmMarkerContent, HlmMarkerIcon] as const;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMarkerContent],hlm-marker-content',
|
|
6
|
+
host: { 'data-slot': 'marker-content' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMarkerContent {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'spartan-marker-content *:[a]:hover:text-foreground wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMarkerIcon],hlm-marker-icon',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'marker-icon',
|
|
8
|
+
'aria-hidden': 'true',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmMarkerIcon {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => "spartan-marker-icon [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)]");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
const markerVariants = cva(
|
|
6
|
+
"spartan-marker group/marker [a]:hover:text-foreground relative flex min-h-4 w-full items-center text-start text-sm [&_ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] [a]:underline [a]:underline-offset-3",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'spartan-marker-variant-default',
|
|
11
|
+
separator: 'spartan-marker-variant-separator',
|
|
12
|
+
border: 'spartan-marker-variant-border',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: 'default',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export type MarkerVariants = VariantProps<typeof markerVariants>;
|
|
22
|
+
|
|
23
|
+
@Directive({
|
|
24
|
+
selector: '[hlmMarker],hlm-marker',
|
|
25
|
+
host: {
|
|
26
|
+
'data-slot': 'marker',
|
|
27
|
+
'[attr.data-variant]': 'variant()',
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
export class HlmMarker {
|
|
31
|
+
public readonly variant = input<MarkerVariants['variant']>('default');
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
classes(() => markerVariants({ variant: this.variant() }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generator = generator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("../../../base/generator"));
|
|
6
|
+
async function generator(tree, options) {
|
|
7
|
+
return await (0, generator_1.default)(tree, { ...options, name: 'marker' });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/marker/generator.ts"],"names":[],"mappings":";;AAIA,8BAEC;;AALD,gFAAuD;AAGhD,KAAK,UAAU,SAAS,CAAC,IAAU,EAAE,OAA+B;IAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HlmMessage } from './lib/hlm-message';
|
|
2
|
+
import { HlmMessageAvatar } from './lib/hlm-message-avatar';
|
|
3
|
+
import { HlmMessageContent } from './lib/hlm-message-content';
|
|
4
|
+
import { HlmMessageFooter } from './lib/hlm-message-footer';
|
|
5
|
+
import { HlmMessageGroup } from './lib/hlm-message-group';
|
|
6
|
+
import { HlmMessageHeader } from './lib/hlm-message-header';
|
|
7
|
+
|
|
8
|
+
export * from './lib/hlm-message';
|
|
9
|
+
export * from './lib/hlm-message-avatar';
|
|
10
|
+
export * from './lib/hlm-message-content';
|
|
11
|
+
export * from './lib/hlm-message-footer';
|
|
12
|
+
export * from './lib/hlm-message-group';
|
|
13
|
+
export * from './lib/hlm-message-header';
|
|
14
|
+
|
|
15
|
+
export const HlmMessageImports = [
|
|
16
|
+
HlmMessage,
|
|
17
|
+
HlmMessageAvatar,
|
|
18
|
+
HlmMessageContent,
|
|
19
|
+
HlmMessageFooter,
|
|
20
|
+
HlmMessageGroup,
|
|
21
|
+
HlmMessageHeader,
|
|
22
|
+
] as const;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMessageAvatar],hlm-message-avatar',
|
|
6
|
+
host: { 'data-slot': 'message-avatar' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMessageAvatar {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'spartan-message-avatar flex w-fit shrink-0 items-center justify-center self-end overflow-hidden group-has-data-[slot=message-footer]/message:-translate-y-8',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMessageContent],hlm-message-content',
|
|
6
|
+
host: { 'data-slot': 'message-content' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMessageContent {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'spartan-message-content flex w-full min-w-0 flex-col wrap-break-word group-data-[align=end]/message:*:data-slot:self-end',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMessageFooter],hlm-message-footer',
|
|
6
|
+
host: { 'data-slot': 'message-footer' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMessageFooter {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'spartan-message-footer flex max-w-full min-w-0 items-center group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMessageGroup],hlm-message-group',
|
|
6
|
+
host: { 'data-slot': 'message-group' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMessageGroup {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(() => 'spartan-message-group flex min-w-0 flex-col');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmMessageHeader],hlm-message-header',
|
|
6
|
+
host: { 'data-slot': 'message-header' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmMessageHeader {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() => 'spartan-message-header flex max-w-full min-w-0 items-center group-has-data-[variant=ghost]/message:px-0',
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
|
+
import { classes } from '<%- importAlias %>/utils';
|
|
3
|
+
|
|
4
|
+
export type MessageAlign = 'start' | 'end';
|
|
5
|
+
|
|
6
|
+
@Directive({
|
|
7
|
+
selector: '[hlmMessage],hlm-message',
|
|
8
|
+
host: {
|
|
9
|
+
'data-slot': 'message',
|
|
10
|
+
'[attr.data-align]': 'align()',
|
|
11
|
+
// Prevent the legacy HTML `align` attribute from forcing text-align.
|
|
12
|
+
'[attr.align]': 'null',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
export class HlmMessage {
|
|
16
|
+
public readonly align = input<MessageAlign>('start');
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
classes(() => 'spartan-message group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generator = generator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("../../../base/generator"));
|
|
6
|
+
async function generator(tree, options) {
|
|
7
|
+
return await (0, generator_1.default)(tree, { ...options, name: 'message' });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../../libs/cli/src/generators/ui/libs/message/generator.ts"],"names":[],"mappings":";;AAIA,8BAEC;;AALD,gFAAuD;AAGhD,KAAK,UAAU,SAAS,CAAC,IAAU,EAAE,OAA+B;IAC1E,OAAO,MAAM,IAAA,mBAAgB,EAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AACtE,CAAC"}
|