@egose/shadcn-theme-ng 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/combobox/fesm2022/combobox.mjs +1 -1
- package/date-picker/README.md +15 -11
- package/date-picker/fesm2022/date-picker.mjs +148 -30
- package/date-picker/types/date-picker.d.ts +102 -9
- package/form-autocomplete/README.md +177 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +125 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
- package/form-checkbox/README.md +13 -3
- package/form-checkbox/fesm2022/form-checkbox.mjs +22 -9
- package/form-checkbox/types/form-checkbox.d.ts +23 -4
- package/form-combobox/README.md +202 -0
- package/form-combobox/fesm2022/form-combobox.mjs +147 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +73 -0
- package/form-date-picker/README.md +48 -22
- package/form-date-picker/fesm2022/form-date-picker.mjs +38 -12
- package/form-date-picker/types/form-date-picker.d.ts +17 -1
- package/form-date-picker-multi/README.md +191 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +129 -0
- package/form-date-picker-multi/package.json +24 -0
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +58 -0
- package/form-date-range-picker/README.md +253 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +130 -0
- package/form-date-range-picker/package.json +24 -0
- package/form-date-range-picker/types/form-date-range-picker.d.ts +55 -0
- package/form-input-otp/README.md +194 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +106 -0
- package/form-input-otp/package.json +24 -0
- package/form-input-otp/types/form-input-otp.d.ts +58 -0
- package/form-month-year-picker/README.md +188 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +125 -0
- package/form-month-year-picker/package.json +24 -0
- package/form-month-year-picker/types/form-month-year-picker.d.ts +53 -0
- package/form-native-select/README.md +205 -0
- package/form-native-select/fesm2022/form-native-select.mjs +103 -0
- package/form-native-select/package.json +24 -0
- package/form-native-select/types/form-native-select.d.ts +57 -0
- package/form-phone-input/README.md +188 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +113 -0
- package/form-phone-input/package.json +24 -0
- package/form-phone-input/types/form-phone-input.d.ts +58 -0
- package/form-radio-group/README.md +198 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +111 -0
- package/form-radio-group/package.json +24 -0
- package/form-radio-group/types/form-radio-group.d.ts +63 -0
- package/form-searchable-multiselect/README.md +11 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +19 -10
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +18 -1
- package/form-select/README.md +10 -0
- package/form-select/fesm2022/form-select.mjs +20 -11
- package/form-select/types/form-select.d.ts +18 -1
- package/form-slider/README.md +182 -0
- package/form-slider/fesm2022/form-slider.mjs +106 -0
- package/form-slider/package.json +24 -0
- package/form-slider/types/form-slider.d.ts +60 -0
- package/form-switch/README.md +173 -0
- package/form-switch/fesm2022/form-switch.mjs +100 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +50 -0
- package/form-text-input/README.md +10 -0
- package/form-text-input/fesm2022/form-text-input.mjs +19 -10
- package/form-text-input/types/form-text-input.d.ts +18 -1
- package/form-textarea/README.md +11 -1
- package/form-textarea/fesm2022/form-textarea.mjs +19 -10
- package/form-textarea/types/form-textarea.d.ts +18 -1
- package/form-toggle/README.md +186 -0
- package/form-toggle/fesm2022/form-toggle.mjs +159 -0
- package/form-toggle/package.json +24 -0
- package/form-toggle/types/form-toggle.d.ts +82 -0
- package/form-toggle-group/README.md +176 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +116 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
- package/input-group/fesm2022/input-group.mjs +19 -9
- package/input-group/types/input-group.d.ts +4 -1
- package/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/package.json +57 -1
- package/phone-input/README.md +114 -0
- package/phone-input/fesm2022/phone-input.mjs +191 -0
- package/phone-input/package.json +24 -0
- package/phone-input/types/phone-input.d.ts +67 -0
- package/radio-group/types/radio-group.d.ts +1 -1
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
- package/typography/types/typography.d.ts +8 -8
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
7
|
+
import { HlmNativeSelect } from '@egose/shadcn-theme-ng/native-select';
|
|
8
|
+
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
9
|
+
|
|
10
|
+
const EgFormNativeSelectConfigToken = new InjectionToken('EgFormNativeSelectConfig');
|
|
11
|
+
function provideEgFormNativeSelectConfig(config) {
|
|
12
|
+
return { provide: EgFormNativeSelectConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormNativeSelectConfig() {
|
|
15
|
+
return inject(EgFormNativeSelectConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class EgFormNativeSelect {
|
|
19
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
20
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-native-select');
|
|
21
|
+
_config = injectEgFormNativeSelectConfig();
|
|
22
|
+
label = input(undefined, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
24
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
26
|
+
controlName = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
28
|
+
error = input(undefined, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
30
|
+
hint = input(undefined, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
32
|
+
id = input(undefined, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
34
|
+
name = input(undefined, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
36
|
+
disabled = input(false, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
38
|
+
required = input(false, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
40
|
+
options = input([], /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
42
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
44
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
46
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
48
|
+
describedBy() {
|
|
49
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
50
|
+
return this.error() && control?.invalid && (control.dirty || control.touched)
|
|
51
|
+
? this.errorId()
|
|
52
|
+
: this.hint()
|
|
53
|
+
? this.hintId()
|
|
54
|
+
: null;
|
|
55
|
+
}
|
|
56
|
+
// Styling
|
|
57
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
58
|
+
labelClass = input('', /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
60
|
+
selectClass = input('', /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "selectClass" }] : /* istanbul ignore next */ []));
|
|
62
|
+
errorClass = input('', /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
64
|
+
hintClass = input('', /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
66
|
+
// Computed classes (library base < global config < per-instance)
|
|
67
|
+
$userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
69
|
+
$labelClass = computed(() => hlm("mb-1 gap-0", this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
71
|
+
$selectClass = computed(() => hlm("w-full", this._config.selectClass, this.selectClass()), /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "$selectClass" }] : /* istanbul ignore next */ []));
|
|
73
|
+
$errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
75
|
+
$hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
77
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormNativeSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
78
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormNativeSelect, isStandalone: true, selector: "eg-form-native-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, selectClass: { classPropertyName: "selectClass", publicName: "selectClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-native-select\n [selectId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [ariaDescribedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [selectClass]=\"$selectClass()\"\n >\n @for (option of options(); track option.value) {\n <option class=\"bg-[Canvas] text-[CanvasText]\" [value]=\"option.value\" [disabled]=\"option.disabled ?? false\">{{ option.label }}</option>\n }\n </hlm-native-select>\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "component", type: HlmNativeSelect, selector: "hlm-native-select", inputs: ["selectId", "name", "ariaDescribedby", "selectClass", "selectIconClass", "size", "disabled", "forceInvalid", "aria-invalid", "value"], outputs: ["valueChange"] }] });
|
|
79
|
+
}
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormNativeSelect, decorators: [{
|
|
81
|
+
type: Component,
|
|
82
|
+
args: [{
|
|
83
|
+
selector: 'eg-form-native-select',
|
|
84
|
+
standalone: true,
|
|
85
|
+
host: {
|
|
86
|
+
'[class]': '$userClass()',
|
|
87
|
+
},
|
|
88
|
+
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmNativeSelect],
|
|
89
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
90
|
+
template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-native-select\n [selectId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [ariaDescribedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [selectClass]=\"$selectClass()\"\n >\n @for (option of options(); track option.value) {\n <option class=\"bg-[Canvas] text-[CanvasText]\" [value]=\"option.value\" [disabled]=\"option.disabled ?? false\">{{ option.label }}</option>\n }\n </hlm-native-select>\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
|
|
91
|
+
}]
|
|
92
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], selectClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* Public API Surface of form-native-select
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Generated bundle index. Do not edit.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
export { EgFormNativeSelect, injectEgFormNativeSelectConfig, provideEgFormNativeSelectConfig };
|
|
103
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-native-select",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0 || ^22.0.0",
|
|
6
|
+
"@angular/core": "^20.3.0 || ^22.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/form-native-select.mjs",
|
|
13
|
+
"typings": "types/form-native-select.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-native-select.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-native-select.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
interface NativeSelectOption {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class EgFormNativeSelect {
|
|
11
|
+
private readonly formGroupDirective;
|
|
12
|
+
private readonly generatedId;
|
|
13
|
+
private readonly _config;
|
|
14
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
16
|
+
controlName: _angular_core.InputSignal<string>;
|
|
17
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
18
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
19
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
20
|
+
name: _angular_core.InputSignal<string | undefined>;
|
|
21
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
22
|
+
required: _angular_core.InputSignal<boolean>;
|
|
23
|
+
options: _angular_core.InputSignal<NativeSelectOption[]>;
|
|
24
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
25
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
26
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
27
|
+
describedBy(): string | null;
|
|
28
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
29
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
30
|
+
selectClass: _angular_core.InputSignal<string>;
|
|
31
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
32
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
33
|
+
$userClass: _angular_core.Signal<string>;
|
|
34
|
+
$labelClass: _angular_core.Signal<string>;
|
|
35
|
+
$selectClass: _angular_core.Signal<string>;
|
|
36
|
+
$errorClass: _angular_core.Signal<string>;
|
|
37
|
+
$hintClass: _angular_core.Signal<string>;
|
|
38
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormNativeSelect, never>;
|
|
39
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormNativeSelect, "eg-form-native-select", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "selectClass": { "alias": "selectClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface EgFormNativeSelectConfig {
|
|
43
|
+
/**
|
|
44
|
+
* Global class defaults for `eg-form-native-select` styling slots.
|
|
45
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
46
|
+
* (library base < global config < per-instance).
|
|
47
|
+
*/
|
|
48
|
+
labelClass?: string;
|
|
49
|
+
selectClass?: string;
|
|
50
|
+
errorClass?: string;
|
|
51
|
+
hintClass?: string;
|
|
52
|
+
}
|
|
53
|
+
declare function provideEgFormNativeSelectConfig(config: Partial<EgFormNativeSelectConfig>): ValueProvider;
|
|
54
|
+
declare function injectEgFormNativeSelectConfig(): EgFormNativeSelectConfig;
|
|
55
|
+
|
|
56
|
+
export { EgFormNativeSelect, injectEgFormNativeSelectConfig, provideEgFormNativeSelectConfig };
|
|
57
|
+
export type { EgFormNativeSelectConfig };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Form Phone Input (`@egose/shadcn-theme-ng/form-phone-input`)
|
|
2
|
+
|
|
3
|
+
A ready-made reactive-form phone field: label + `hlm-phone-input` + validation error/hint display in one tag. The model holds raw digits; the visible text is masked.
|
|
4
|
+
|
|
5
|
+
The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and `HlmPhoneInput` from `@egose/shadcn-theme-ng/phone-input`. The inner input is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the digit string. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
|
|
6
|
+
|
|
7
|
+
> **Ships as:** `@egose/shadcn-theme-ng/form-phone-input` and `@egose/shadcn-theme-ng-tw/form-phone-input`
|
|
8
|
+
> (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
|
|
9
|
+
> emitted Tailwind class strings differ. See the [package README](../../README.md) for install
|
|
10
|
+
> steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Plain Tailwind (no prefix)
|
|
16
|
+
npm install @egose/shadcn-theme-ng
|
|
17
|
+
|
|
18
|
+
# tw:-prefixed Tailwind variant
|
|
19
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Peer dependencies (Angular, `@spartan-ng/brain`, `rxjs`, …) are documented in the
|
|
23
|
+
[package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
|
|
24
|
+
`@egose/shadcn-theme-ng/phone-input`, `@egose/shadcn-theme-ng/form-field`, and
|
|
25
|
+
`@egose/shadcn-theme-ng/label`.
|
|
26
|
+
|
|
27
|
+
## Imports
|
|
28
|
+
|
|
29
|
+
Exported from the subpath root (`projects/form-phone-input/src/public-api.ts`):
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { EgFormPhoneInput, provideEgFormPhoneInputConfig } from '@egose/shadcn-theme-ng/form-phone-input';
|
|
33
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/form-phone-input'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Standalone usage:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Component } from '@angular/core';
|
|
40
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
41
|
+
import { EgFormPhoneInput } from '@egose/shadcn-theme-ng/form-phone-input';
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
selector: 'app-demo',
|
|
45
|
+
standalone: true,
|
|
46
|
+
imports: [ReactiveFormsModule, EgFormPhoneInput],
|
|
47
|
+
template: `...`,
|
|
48
|
+
})
|
|
49
|
+
export class DemoComponent {}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
NgModule-based consumer: add `EgFormPhoneInput` (and `ReactiveFormsModule`) to the module's
|
|
53
|
+
`imports` — it is a standalone component, not a module.
|
|
54
|
+
|
|
55
|
+
`ControlValueAccessor` behavior: `eg-form-phone-input` itself is not a `ControlValueAccessor`; the
|
|
56
|
+
inner `hlm-phone-input` is (bound via `formControlName`), so `formControlName`/`formGroup` handling,
|
|
57
|
+
`Validators`, and `disabled` state from the control all flow through the parent form. Validate
|
|
58
|
+
against digit length (`Validators.minLength(10)`) since the model holds raw digits.
|
|
59
|
+
|
|
60
|
+
## Anatomy / Structure
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<form [formGroup]="form">
|
|
64
|
+
<eg-form-phone-input controlName="phone" label="Phone" [required]="true" error="Enter a 10-digit number." />
|
|
65
|
+
</form>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Selector (from source): `eg-form-phone-input` (standalone component, host `tw:w-full`).
|
|
69
|
+
|
|
70
|
+
## API reference
|
|
71
|
+
|
|
72
|
+
### `EgFormPhoneInput` — `eg-form-phone-input`
|
|
73
|
+
|
|
74
|
+
| Input | Type | Default | Description |
|
|
75
|
+
| ------------------- | ---------------------------- | ----------------------- | ------------------------------------------------------------------ |
|
|
76
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
77
|
+
| `label` | `string \| undefined` | — | Label text (hidden when omitted). |
|
|
78
|
+
| `error` | `string \| undefined` | — | Error text shown when invalid. |
|
|
79
|
+
| `hint` | `string \| undefined` | — | Hint text shown otherwise. |
|
|
80
|
+
| `controlId` | `string \| undefined` | — | Explicit id (first priority for `effectiveId`). |
|
|
81
|
+
| `id` | `string \| undefined` | — | Fallback id (second priority). |
|
|
82
|
+
| `name` | `string \| undefined` | — | Native `name` forwarded to the inner input (`controlName` wins). |
|
|
83
|
+
| `placeholder` | `string` | `'(555) 123-4567'` | Input placeholder. |
|
|
84
|
+
| `autocomplete` | `string` | `'tel'` | Native autocomplete token. |
|
|
85
|
+
| `readonly` | `boolean` | `false` | Native `readonly` forwarded to the inner input. |
|
|
86
|
+
| `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
|
|
87
|
+
| `required` | `boolean` | `false` | Shows a red `*` next to the label. |
|
|
88
|
+
| `maxDigits` | `number` | `10` | Maximum digit count kept in the model. |
|
|
89
|
+
| `modelFormat` | `'digits' \| 'formatted'` | `'digits'` | Model shape: raw digits or formatted display text. |
|
|
90
|
+
| `formatPhoneNumber` | `(digits: string) => string` | `formatNanpPhoneNumber` | Display formatter forwarded to the input. |
|
|
91
|
+
| `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
|
|
92
|
+
| `labelClass` | `string` | `''` | Extra label classes (base `tw:mb-1 tw:gap-0`). |
|
|
93
|
+
| `inputClass` | `string` | `''` | Extra inner-input classes. |
|
|
94
|
+
| `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
|
|
95
|
+
| `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
|
|
96
|
+
|
|
97
|
+
| Member | Description |
|
|
98
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| `effectiveId` | `controlId() \|\| id() \|\| generated` — wired to input `inputId` and label `for`. |
|
|
100
|
+
| `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
|
|
101
|
+
| `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to input `ariaDescribedby`. |
|
|
102
|
+
|
|
103
|
+
Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
|
|
104
|
+
|
|
105
|
+
## Examples
|
|
106
|
+
|
|
107
|
+
### 1. Required US number
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { Component, inject } from '@angular/core';
|
|
111
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
112
|
+
import { EgFormPhoneInput } from '@egose/shadcn-theme-ng/form-phone-input';
|
|
113
|
+
|
|
114
|
+
@Component({
|
|
115
|
+
selector: 'app-callback',
|
|
116
|
+
standalone: true,
|
|
117
|
+
imports: [ReactiveFormsModule, EgFormPhoneInput],
|
|
118
|
+
template: `
|
|
119
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
120
|
+
<eg-form-phone-input
|
|
121
|
+
controlName="phone"
|
|
122
|
+
label="Callback number"
|
|
123
|
+
[required]="true"
|
|
124
|
+
error="Enter a 10-digit number."
|
|
125
|
+
/>
|
|
126
|
+
<button type="submit" [disabled]="form.invalid">Request callback</button>
|
|
127
|
+
</form>
|
|
128
|
+
`,
|
|
129
|
+
})
|
|
130
|
+
export class CallbackComponent {
|
|
131
|
+
private readonly fb = inject(FormBuilder);
|
|
132
|
+
readonly form = this.fb.group({ phone: [null as string | null, [Validators.required, Validators.minLength(10)]] });
|
|
133
|
+
submit() {
|
|
134
|
+
console.log(this.form.value.phone); // raw digits, e.g. "4155552671"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 2. Optional with hint
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { Component, inject } from '@angular/core';
|
|
143
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
144
|
+
import { EgFormPhoneInput } from '@egose/shadcn-theme-ng/form-phone-input';
|
|
145
|
+
|
|
146
|
+
@Component({
|
|
147
|
+
selector: 'app-profile-phone',
|
|
148
|
+
standalone: true,
|
|
149
|
+
imports: [ReactiveFormsModule, EgFormPhoneInput],
|
|
150
|
+
template: `
|
|
151
|
+
<form [formGroup]="form">
|
|
152
|
+
<eg-form-phone-input controlName="mobile" label="Mobile (optional)" hint="US format, digits only in storage." />
|
|
153
|
+
</form>
|
|
154
|
+
`,
|
|
155
|
+
})
|
|
156
|
+
export class ProfilePhoneComponent {
|
|
157
|
+
private readonly fb = inject(FormBuilder);
|
|
158
|
+
readonly form = this.fb.group({ mobile: [null as string | null] });
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Accessibility notes
|
|
163
|
+
|
|
164
|
+
- Label `for` ↔ input `inputId` wiring is automatic via `effectiveId`; the input also receives `name`, `autocomplete="tel"`, and `ariaDescribedby` — always pass a `label`.
|
|
165
|
+
- The required `*` is visual; pair with `Validators.required` (plus `minLength`) so assistive tech and validation agree.
|
|
166
|
+
|
|
167
|
+
## Theming / CSS variables
|
|
168
|
+
|
|
169
|
+
No component-specific CSS variables; the inner input carries the shared `HlmInput` base. Style per-instance via `class` / `labelClass` / `inputClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
|
|
170
|
+
|
|
171
|
+
Global defaults per styling slot via the wrapper config:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
import { provideEgFormPhoneInputConfig } from '@egose/shadcn-theme-ng/form-phone-input';
|
|
175
|
+
|
|
176
|
+
await bootstrapApplication(App, {
|
|
177
|
+
providers: [provideEgFormPhoneInputConfig({ inputClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The host keeps `tw:w-full`; constrain width with `class` (e.g. `tw:max-w-xs`) or a wrapping container.
|
|
182
|
+
|
|
183
|
+
## Related subpaths
|
|
184
|
+
|
|
185
|
+
- `@egose/shadcn-theme-ng/phone-input` — raw `hlm-phone-input` + `formatNanpPhoneNumber` for custom layouts.
|
|
186
|
+
- `@egose/shadcn-theme-ng/form-text-input` — the plain-text counterpart (`eg-form-text-input`).
|
|
187
|
+
- `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
|
|
188
|
+
- `@egose/shadcn-theme-ng/form-field-simple` — alternative minimal wrapper when you compose controls by hand.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
7
|
+
import { formatNanpPhoneNumber, HlmPhoneInput } from '@egose/shadcn-theme-ng/phone-input';
|
|
8
|
+
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
9
|
+
|
|
10
|
+
const EgFormPhoneInputConfigToken = new InjectionToken('EgFormPhoneInputConfig');
|
|
11
|
+
function provideEgFormPhoneInputConfig(config) {
|
|
12
|
+
return { provide: EgFormPhoneInputConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormPhoneInputConfig() {
|
|
15
|
+
return inject(EgFormPhoneInputConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class EgFormPhoneInput {
|
|
19
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
20
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-phone-input');
|
|
21
|
+
_config = injectEgFormPhoneInputConfig();
|
|
22
|
+
label = input(undefined, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
24
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
26
|
+
controlName = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
28
|
+
error = input(undefined, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
30
|
+
hint = input(undefined, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
32
|
+
id = input(undefined, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
34
|
+
name = input(undefined, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
36
|
+
placeholder = input('(555) 123-4567', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
38
|
+
autocomplete = input('tel', /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
40
|
+
readonly = input(false, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
42
|
+
disabled = input(false, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
44
|
+
required = input(false, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
46
|
+
maxDigits = input(10, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "maxDigits" }] : /* istanbul ignore next */ []));
|
|
48
|
+
formatPhoneNumber = input(formatNanpPhoneNumber, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "formatPhoneNumber" }] : /* istanbul ignore next */ []));
|
|
50
|
+
modelFormat = input('digits', /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "modelFormat" }] : /* istanbul ignore next */ []));
|
|
52
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
54
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
56
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
58
|
+
describedBy() {
|
|
59
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
60
|
+
return this.error() && control?.invalid && (control.dirty || control.touched)
|
|
61
|
+
? this.errorId()
|
|
62
|
+
: this.hint()
|
|
63
|
+
? this.hintId()
|
|
64
|
+
: null;
|
|
65
|
+
}
|
|
66
|
+
// Styling
|
|
67
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
68
|
+
labelClass = input('', /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
70
|
+
inputClass = input('', /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
|
|
72
|
+
errorClass = input('', /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
74
|
+
hintClass = input('', /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
76
|
+
// Computed classes (library base < global config < per-instance)
|
|
77
|
+
$userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
79
|
+
$labelClass = computed(() => hlm("mb-1 gap-0", this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
81
|
+
$inputClass = computed(() => hlm("mb-1", this._config.inputClass, this.inputClass()), /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
|
|
83
|
+
$errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
85
|
+
$hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
87
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormPhoneInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
88
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormPhoneInput, isStandalone: true, selector: "eg-form-phone-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, maxDigits: { classPropertyName: "maxDigits", publicName: "maxDigits", isSignal: true, isRequired: false, transformFunction: null }, formatPhoneNumber: { classPropertyName: "formatPhoneNumber", publicName: "formatPhoneNumber", isSignal: true, isRequired: false, transformFunction: null }, modelFormat: { classPropertyName: "modelFormat", publicName: "modelFormat", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-phone-input\n [inputId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"lbl\"\n [ariaDescribedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [autocomplete]=\"autocomplete()\"\n [maxDigits]=\"maxDigits()\"\n [formatPhoneNumber]=\"formatPhoneNumber()\"\n [modelFormat]=\"modelFormat()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [class]=\"$inputClass()\"\n />\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "component", type: HlmPhoneInput, selector: "hlm-phone-input", inputs: ["inputId", "name", "ariaLabel", "ariaDescribedby", "placeholder", "autocomplete", "readonly", "disabled", "forceInvalid", "maxDigits", "modelFormat", "formatPhoneNumber", "class", "inputClass"] }] });
|
|
89
|
+
}
|
|
90
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormPhoneInput, decorators: [{
|
|
91
|
+
type: Component,
|
|
92
|
+
args: [{
|
|
93
|
+
selector: 'eg-form-phone-input',
|
|
94
|
+
standalone: true,
|
|
95
|
+
host: {
|
|
96
|
+
'[class]': '$userClass()',
|
|
97
|
+
},
|
|
98
|
+
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmPhoneInput],
|
|
99
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
100
|
+
template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-phone-input\n [inputId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"lbl\"\n [ariaDescribedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [autocomplete]=\"autocomplete()\"\n [maxDigits]=\"maxDigits()\"\n [formatPhoneNumber]=\"formatPhoneNumber()\"\n [modelFormat]=\"modelFormat()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [class]=\"$inputClass()\"\n />\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
|
|
101
|
+
}]
|
|
102
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], maxDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDigits", required: false }] }], formatPhoneNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatPhoneNumber", required: false }] }], modelFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "modelFormat", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
* Public API Surface of form-phone-input
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Generated bundle index. Do not edit.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
export { EgFormPhoneInput, injectEgFormPhoneInputConfig, provideEgFormPhoneInputConfig };
|
|
113
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-phone-input",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0 || ^22.0.0",
|
|
6
|
+
"@angular/core": "^20.3.0 || ^22.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/form-phone-input.mjs",
|
|
13
|
+
"typings": "types/form-phone-input.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-phone-input.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-phone-input.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { PhoneNumberFormatter } from '@egose/shadcn-theme-ng/phone-input';
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
|
|
6
|
+
declare class EgFormPhoneInput {
|
|
7
|
+
private readonly formGroupDirective;
|
|
8
|
+
private readonly generatedId;
|
|
9
|
+
private readonly _config;
|
|
10
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
11
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
12
|
+
controlName: _angular_core.InputSignal<string>;
|
|
13
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
14
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
16
|
+
name: _angular_core.InputSignal<string | undefined>;
|
|
17
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
18
|
+
autocomplete: _angular_core.InputSignal<string>;
|
|
19
|
+
readonly: _angular_core.InputSignal<boolean>;
|
|
20
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
21
|
+
required: _angular_core.InputSignal<boolean>;
|
|
22
|
+
maxDigits: _angular_core.InputSignal<number>;
|
|
23
|
+
formatPhoneNumber: _angular_core.InputSignal<PhoneNumberFormatter>;
|
|
24
|
+
modelFormat: _angular_core.InputSignal<"digits" | "formatted">;
|
|
25
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
26
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
27
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
28
|
+
describedBy(): string | null;
|
|
29
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
30
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
31
|
+
inputClass: _angular_core.InputSignal<string>;
|
|
32
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
33
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
34
|
+
$userClass: _angular_core.Signal<string>;
|
|
35
|
+
$labelClass: _angular_core.Signal<string>;
|
|
36
|
+
$inputClass: _angular_core.Signal<string>;
|
|
37
|
+
$errorClass: _angular_core.Signal<string>;
|
|
38
|
+
$hintClass: _angular_core.Signal<string>;
|
|
39
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormPhoneInput, never>;
|
|
40
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormPhoneInput, "eg-form-phone-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "maxDigits": { "alias": "maxDigits"; "required": false; "isSignal": true; }; "formatPhoneNumber": { "alias": "formatPhoneNumber"; "required": false; "isSignal": true; }; "modelFormat": { "alias": "modelFormat"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface EgFormPhoneInputConfig {
|
|
44
|
+
/**
|
|
45
|
+
* Global class defaults for `eg-form-phone-input` styling slots.
|
|
46
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
47
|
+
* (library base < global config < per-instance).
|
|
48
|
+
*/
|
|
49
|
+
labelClass?: string;
|
|
50
|
+
inputClass?: string;
|
|
51
|
+
errorClass?: string;
|
|
52
|
+
hintClass?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function provideEgFormPhoneInputConfig(config: Partial<EgFormPhoneInputConfig>): ValueProvider;
|
|
55
|
+
declare function injectEgFormPhoneInputConfig(): EgFormPhoneInputConfig;
|
|
56
|
+
|
|
57
|
+
export { EgFormPhoneInput, injectEgFormPhoneInputConfig, provideEgFormPhoneInputConfig };
|
|
58
|
+
export type { EgFormPhoneInputConfig };
|