@spartan-ng/cli 1.1.2 → 1.2.0-beta.2
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 +20 -0
- package/package.json +1 -1
- package/src/generators/healthcheck/generator.js +4 -0
- package/src/generators/healthcheck/generator.js.map +1 -1
- package/src/generators/healthcheck/healthchecks/brn-input-otp-max-length-rename.d.ts +2 -0
- package/src/generators/healthcheck/healthchecks/brn-input-otp-max-length-rename.js +31 -0
- package/src/generators/healthcheck/healthchecks/brn-input-otp-max-length-rename.js.map +1 -0
- 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-brn-input-otp-max-length/compat.d.ts +2 -0
- package/src/generators/migrate-brn-input-otp-max-length/compat.js +7 -0
- package/src/generators/migrate-brn-input-otp-max-length/compat.js.map +1 -0
- package/src/generators/migrate-brn-input-otp-max-length/generator.d.ts +4 -0
- package/src/generators/migrate-brn-input-otp-max-length/generator.js +31 -0
- package/src/generators/migrate-brn-input-otp-max-length/generator.js.map +1 -0
- package/src/generators/migrate-brn-input-otp-max-length/schema.d.ts +3 -0
- package/src/generators/migrate-brn-input-otp-max-length/schema.json +14 -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/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 +8 -6
- package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker.ts.template +9 -7
- 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 +8 -6
- 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 +8 -6
- package/src/generators/ui/libs/input-otp/files/lib/hlm-input-otp-slot.ts.template +6 -3
- package/src/generators/ui/style-luma.css +1 -1
- package/src/generators/ui/style-lyra.css +2 -2
- package/src/generators/ui/style-maia.css +2 -2
- package/src/generators/ui/style-mira.css +2 -2
- package/src/generators/ui/style-nova.css +2 -2
- package/src/generators/ui/style-vega.css +2 -2
- package/src/generators/ui/supported-ui-libraries.json +41 -41
|
@@ -18,7 +18,7 @@ import { type BrnDatePickerBase, BrnDatePickerTriggerToken, provideBrnDatePicker
|
|
|
18
18
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
19
19
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
20
20
|
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
21
|
-
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
21
|
+
import { BrnPopover, type BrnPopoverAlign } from '@spartan-ng/brain/popover';
|
|
22
22
|
import { HlmCalendarMulti } from '<%- importAlias %>/calendar';
|
|
23
23
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
24
24
|
import { injectHlmDatePickerMultiConfig } from './hlm-date-picker-multi.token';
|
|
@@ -41,7 +41,7 @@ export const HLM_DATE_PICKER_MUTLI_VALUE_ACCESSOR = {
|
|
|
41
41
|
hostDirectives: [BrnFieldControl],
|
|
42
42
|
host: { class: 'block' },
|
|
43
43
|
template: `
|
|
44
|
-
<hlm-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
44
|
+
<hlm-popover [align]="align()" sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
45
45
|
<ng-content />
|
|
46
46
|
|
|
47
47
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
@@ -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()"
|
|
@@ -69,14 +69,16 @@ export class HlmDatePickerMulti<T> implements BrnDatePickerBase<T[]>, ControlVal
|
|
|
69
69
|
|
|
70
70
|
private readonly _trigger = contentChild(BrnDatePickerTriggerToken);
|
|
71
71
|
|
|
72
|
+
public readonly align = input<BrnPopoverAlign>('center');
|
|
73
|
+
|
|
72
74
|
/** Show dropdowns to navigate between months or years. */
|
|
73
75
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
74
76
|
|
|
75
77
|
/** The minimum date that can be selected.*/
|
|
76
|
-
public readonly
|
|
78
|
+
public readonly minDate = input<T>();
|
|
77
79
|
|
|
78
80
|
/** The maximum date that can be selected. */
|
|
79
|
-
public readonly
|
|
81
|
+
public readonly maxDate = input<T>();
|
|
80
82
|
|
|
81
83
|
/** The minimum selectable dates. */
|
|
82
84
|
public readonly minSelection = input<number, NumberInput>(undefined, {
|
|
@@ -17,7 +17,7 @@ import { type BrnDatePickerBase, BrnDatePickerTriggerToken, provideBrnDatePicker
|
|
|
17
17
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
18
18
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
19
19
|
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
20
|
-
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
20
|
+
import { BrnPopover, type BrnPopoverAlign } from '@spartan-ng/brain/popover';
|
|
21
21
|
import { HlmCalendar } from '<%- importAlias %>/calendar';
|
|
22
22
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
23
23
|
import { injectHlmDatePickerConfig } from './hlm-date-picker.token';
|
|
@@ -36,7 +36,7 @@ export const HLM_DATE_PICKER_VALUE_ACCESSOR = {
|
|
|
36
36
|
hostDirectives: [BrnFieldControl],
|
|
37
37
|
host: { class: 'block' },
|
|
38
38
|
template: `
|
|
39
|
-
<hlm-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
39
|
+
<hlm-popover [align]="align()" sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
40
40
|
<ng-content />
|
|
41
41
|
|
|
42
42
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
@@ -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
|
/>
|
|
@@ -63,14 +63,16 @@ export class HlmDatePicker<T> implements BrnDatePickerBase<T>, ControlValueAcces
|
|
|
63
63
|
|
|
64
64
|
private readonly _trigger = contentChild(BrnDatePickerTriggerToken);
|
|
65
65
|
|
|
66
|
+
public readonly align = input<BrnPopoverAlign>('center');
|
|
67
|
+
|
|
66
68
|
/** Show dropdowns to navigate between months or years. */
|
|
67
69
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
68
70
|
|
|
69
|
-
/** The minimum date that can be selected
|
|
70
|
-
public readonly
|
|
71
|
+
/** The minimum date that can be selected. */
|
|
72
|
+
public readonly minDate = input<T>();
|
|
71
73
|
|
|
72
74
|
/** The maximum date that can be selected. */
|
|
73
|
-
public readonly
|
|
75
|
+
public readonly maxDate = input<T>();
|
|
74
76
|
|
|
75
77
|
/** Determine if the date picker is disabled. */
|
|
76
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
|
|
@@ -18,7 +18,7 @@ import { type BrnDatePickerBase, BrnDatePickerTriggerToken, provideBrnDatePicker
|
|
|
18
18
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
19
19
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
20
20
|
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
21
|
-
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
21
|
+
import { BrnPopover, type BrnPopoverAlign } from '@spartan-ng/brain/popover';
|
|
22
22
|
import { HlmCalendarRange } from '<%- importAlias %>/calendar';
|
|
23
23
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
24
24
|
import { injectHlmDateRangePickerConfig } from './hlm-date-range-picker.token';
|
|
@@ -41,7 +41,7 @@ export const HLM_DATE_RANGE_PICKER_VALUE_ACCESSOR = {
|
|
|
41
41
|
hostDirectives: [BrnFieldControl],
|
|
42
42
|
host: { class: 'block' },
|
|
43
43
|
template: `
|
|
44
|
-
<hlm-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
44
|
+
<hlm-popover [align]="align()" sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
45
45
|
<ng-content />
|
|
46
46
|
|
|
47
47
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
@@ -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)"
|
|
@@ -69,14 +69,16 @@ export class HlmDateRangePicker<T> implements BrnDatePickerBase<[T, T]>, Control
|
|
|
69
69
|
|
|
70
70
|
private readonly _trigger = contentChild(BrnDatePickerTriggerToken);
|
|
71
71
|
|
|
72
|
+
public readonly align = input<BrnPopoverAlign>('center');
|
|
73
|
+
|
|
72
74
|
/** Show dropdowns to navigate between months or years. */
|
|
73
75
|
public readonly captionLayout = input<'dropdown' | 'label' | 'dropdown-months' | 'dropdown-years'>('label');
|
|
74
76
|
|
|
75
77
|
/** The minimum date that can be selected.*/
|
|
76
|
-
public readonly
|
|
78
|
+
public readonly minDate = input<T>();
|
|
77
79
|
|
|
78
80
|
/** The maximum date that can be selected. */
|
|
79
|
-
public readonly
|
|
81
|
+
public readonly maxDate = input<T>();
|
|
80
82
|
|
|
81
83
|
/** Determine if the date picker is disabled. */
|
|
82
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
|
|
@@ -17,7 +17,7 @@ import { type BrnDatePickerBase, BrnDatePickerTriggerToken, provideBrnDatePicker
|
|
|
17
17
|
import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
|
|
18
18
|
import type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
19
19
|
import type { BrnOverlayState } from '@spartan-ng/brain/overlay';
|
|
20
|
-
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
20
|
+
import { BrnPopover, type BrnPopoverAlign } from '@spartan-ng/brain/popover';
|
|
21
21
|
import { HlmCalendarImports } from '<%- importAlias %>/calendar';
|
|
22
22
|
import { HlmPopoverImports } from '<%- importAlias %>/popover';
|
|
23
23
|
import { injectHlmMonthYearPickerConfig } from './hlm-month-year-picker.token';
|
|
@@ -39,7 +39,7 @@ export const HLM_MONTH_YEAR_PICKER_VALUE_ACCESSOR = {
|
|
|
39
39
|
hostDirectives: [BrnFieldControl],
|
|
40
40
|
host: { class: 'block' },
|
|
41
41
|
template: `
|
|
42
|
-
<hlm-popover sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
42
|
+
<hlm-popover [align]="align()" sideOffset="5" [state]="_popoverState()" (stateChanged)="_onStateChange($event)">
|
|
43
43
|
<ng-content />
|
|
44
44
|
|
|
45
45
|
<hlm-popover-content class="w-fit p-0" *hlmPopoverPortal="let ctx">
|
|
@@ -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
|
/>
|
|
@@ -65,11 +65,13 @@ export class HlmMonthYearPicker<T> implements BrnDatePickerBase<T>, ControlValue
|
|
|
65
65
|
|
|
66
66
|
private readonly _trigger = contentChild(BrnDatePickerTriggerToken);
|
|
67
67
|
|
|
68
|
+
public readonly align = input<BrnPopoverAlign>('center');
|
|
69
|
+
|
|
68
70
|
/** The minimum date that can be selected.*/
|
|
69
|
-
public readonly
|
|
71
|
+
public readonly minDate = input<T>();
|
|
70
72
|
|
|
71
73
|
/** The maximum date that can be selected. */
|
|
72
|
-
public readonly
|
|
74
|
+
public readonly maxDate = input<T>();
|
|
73
75
|
|
|
74
76
|
/** Determine if the date picker is disabled. */
|
|
75
77
|
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NumberInput } from '@angular/cdk/coercion';
|
|
2
|
-
import { ChangeDetectionStrategy, Component, input, numberAttribute } from '@angular/core';
|
|
1
|
+
import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, input, numberAttribute } from '@angular/core';
|
|
3
3
|
import { BrnInputOtpSlot } from '@spartan-ng/brain/input-otp';
|
|
4
4
|
import { classes } from '<%- importAlias %>/utils';
|
|
5
5
|
import { HlmInputOtpFakeCaret } from './hlm-input-otp-fake-caret';
|
|
@@ -10,7 +10,7 @@ import { HlmInputOtpFakeCaret } from './hlm-input-otp-fake-caret';
|
|
|
10
10
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
11
|
host: { 'data-slot': 'input-otp-slot' },
|
|
12
12
|
template: `
|
|
13
|
-
<brn-input-otp-slot [index]="index()">
|
|
13
|
+
<brn-input-otp-slot [index]="index()" [forceInvalid]="forceInvalid()">
|
|
14
14
|
<hlm-input-otp-fake-caret />
|
|
15
15
|
</brn-input-otp-slot>
|
|
16
16
|
`,
|
|
@@ -19,6 +19,9 @@ export class HlmInputOtpSlot {
|
|
|
19
19
|
/** The index of the slot to render the char or a fake caret */
|
|
20
20
|
public readonly index = input.required<number, NumberInput>({ transform: numberAttribute });
|
|
21
21
|
|
|
22
|
+
/** Whether to force the input into an invalid state. */
|
|
23
|
+
public readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
24
|
+
|
|
22
25
|
constructor() {
|
|
23
26
|
classes(
|
|
24
27
|
() =>
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
.spartan-input-otp-slot {
|
|
357
|
-
@apply bg-input/50 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/30 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm transition-all outline-none first:rounded-s-3xl first:border-s last:rounded-e-3xl has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
357
|
+
@apply bg-input/50 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/30 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm transition-all outline-none first:rounded-s-3xl first:border-s last:rounded-e-3xl has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
.spartan-input-otp-caret-line {
|
|
@@ -603,11 +603,11 @@
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
.spartan-input-otp-group {
|
|
606
|
-
@apply data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive rounded-none data-[matches-spartan-invalid=true]:ring-1;
|
|
606
|
+
@apply has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive rounded-none has-data-[matches-spartan-invalid=true]:ring-1;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
.spartan-input-otp-slot {
|
|
610
|
-
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:border-destructive size-8 border-y border-e text-xs transition-all outline-none first:rounded-none first:border-s last:rounded-none has-[brn-input-otp-slot[data-active="true"]]:ring-1;
|
|
610
|
+
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:border-destructive size-8 border-y border-e text-xs transition-all outline-none first:rounded-none first:border-s last:rounded-none has-[brn-input-otp-slot[data-active="true"]]:ring-1;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
.spartan-input-otp-caret-line {
|
|
@@ -625,11 +625,11 @@
|
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
.spartan-input-otp-group {
|
|
628
|
-
@apply data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive rounded-4xl data-[matches-spartan-invalid=true]:ring-[3px];
|
|
628
|
+
@apply has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive rounded-4xl has-data-[matches-spartan-invalid=true]:ring-[3px];
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
.spartan-input-otp-slot {
|
|
632
|
-
@apply bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm transition-all outline-none first:rounded-s-4xl first:border-s last:rounded-e-4xl has-[brn-input-otp-slot[data-active="true"]]:ring-[3px];
|
|
632
|
+
@apply bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm transition-all outline-none first:rounded-s-4xl first:border-s last:rounded-e-4xl has-[brn-input-otp-slot[data-active="true"]]:ring-[3px];
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
.spartan-input-otp-caret-line {
|
|
@@ -625,11 +625,11 @@
|
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
.spartan-input-otp-group {
|
|
628
|
-
@apply data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive rounded-md data-[matches-spartan-invalid=true]:ring-2;
|
|
628
|
+
@apply has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive rounded-md has-data-[matches-spartan-invalid=true]:ring-2;
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
.spartan-input-otp-slot {
|
|
632
|
-
@apply bg-input/20 dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/30 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:border-destructive size-7 border-y border-e text-xs/relaxed transition-all outline-none first:rounded-s-md first:border-s last:rounded-e-md has-[brn-input-otp-slot[data-active="true"]]:ring-2;
|
|
632
|
+
@apply bg-input/20 dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/30 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:border-destructive size-7 border-y border-e text-xs/relaxed transition-all outline-none first:rounded-s-md first:border-s last:rounded-e-md has-[brn-input-otp-slot[data-active="true"]]:ring-2;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
.spartan-input-otp-caret-line {
|
|
@@ -655,11 +655,11 @@
|
|
|
655
655
|
}
|
|
656
656
|
|
|
657
657
|
.spartan-input-otp-group {
|
|
658
|
-
@apply data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive rounded-lg data-[matches-spartan-invalid=true]:ring-3;
|
|
658
|
+
@apply has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive rounded-lg has-data-[matches-spartan-invalid=true]:ring-3;
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
.spartan-input-otp-slot {
|
|
662
|
-
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:border-destructive size-8 border-y border-e text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
662
|
+
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:border-destructive size-8 border-y border-e text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
.spartan-input-otp-caret-line {
|
|
@@ -683,11 +683,11 @@
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
.spartan-input-otp-group {
|
|
686
|
-
@apply data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive rounded-md data-[matches-spartan-invalid=true]:ring-3;
|
|
686
|
+
@apply has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive rounded-md has-data-[matches-spartan-invalid=true]:ring-3;
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
.spartan-input-otp-slot {
|
|
690
|
-
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm shadow-xs transition-all outline-none first:rounded-s-md first:border-s last:rounded-e-md has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
690
|
+
@apply dark:bg-input/30 border-input has-[brn-input-otp-slot[data-active="true"]]:border-ring has-[brn-input-otp-slot[data-active="true"]]:ring-ring/50 has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/20 dark:has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:ring-destructive/40 has-data-[matches-spartan-invalid=true]:border-destructive has-[brn-input-otp-slot[data-active="true"]]:has-data-[matches-spartan-invalid=true]:border-destructive size-9 border-y border-e text-sm shadow-xs transition-all outline-none first:rounded-s-md first:border-s last:rounded-e-md has-[brn-input-otp-slot[data-active="true"]]:ring-3;
|
|
691
691
|
}
|
|
692
692
|
|
|
693
693
|
.spartan-input-otp-caret-line {
|