@latitude-ui/widgets 0.0.26 → 0.0.27

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { forwardRef, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
- import { HTMLInputDirective } from '@latitude-ui/widgets/input';
3
+ import { HTMLFormControl } from '@latitude-ui/widgets/core';
4
4
  import { IconComponent } from '@latitude-ui/widgets/icons';
5
5
 
6
- class CheckBoxComponent extends HTMLInputDirective {
6
+ class CheckBoxComponent extends HTMLFormControl {
7
7
  toggle() {
8
8
  if (!this.disabled()) {
9
9
  const value = this.value() ?? false;
@@ -13,10 +13,10 @@ class CheckBoxComponent extends HTMLInputDirective {
13
13
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CheckBoxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
14
14
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: CheckBoxComponent, isStandalone: true, selector: "lat-checkbox", host: { listeners: { "click": "toggle()" } }, providers: [
15
15
  {
16
- provide: HTMLInputDirective,
16
+ provide: HTMLFormControl,
17
17
  useExisting: forwardRef(() => CheckBoxComponent),
18
18
  },
19
- ], exportAs: ["latCheckBox"], usesInheritance: true, ngImport: i0, template: "<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"inputId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n", dependencies: [{ kind: "component", type: IconComponent, selector: "lat-icon", inputs: ["url", "name"], exportAs: ["latIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
19
+ ], exportAs: ["latCheckBox"], usesInheritance: true, ngImport: i0, template: "<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"computedId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n", dependencies: [{ kind: "component", type: IconComponent, selector: "lat-icon", inputs: ["url", "name"], exportAs: ["latIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
20
20
  }
21
21
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: CheckBoxComponent, decorators: [{
22
22
  type: Component,
@@ -24,12 +24,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
24
24
  IconComponent
25
25
  ], exportAs: 'latCheckBox', selector: 'lat-checkbox', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
26
26
  {
27
- provide: HTMLInputDirective,
27
+ provide: HTMLFormControl,
28
28
  useExisting: forwardRef(() => CheckBoxComponent),
29
29
  },
30
30
  ], host: {
31
31
  '(click)': 'toggle()',
32
- }, template: "<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"inputId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n" }]
32
+ }, template: "<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"computedId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n" }]
33
33
  }] });
34
34
 
35
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"latitude-ui-widgets-checkbox.mjs","sources":["../../../../packages/widgets/checkbox/lib/checkbox.component.ts","../../../../packages/widgets/checkbox/lib/checkbox.component.html","../../../../packages/widgets/checkbox/latitude-ui-widgets-checkbox.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, forwardRef, ViewEncapsulation } from '@angular/core';\nimport { HTMLInputDirective } from '@latitude-ui/widgets/input';\nimport { IconComponent } from '@latitude-ui/widgets/icons';\n\n@Component({\n imports: [\n IconComponent\n ],\n exportAs: 'latCheckBox',\n selector: 'lat-checkbox',\n templateUrl: './checkbox.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: HTMLInputDirective,\n useExisting: forwardRef(() => CheckBoxComponent),\n },\n ],\n host: {\n '(click)': 'toggle()',\n },\n})\nexport class CheckBoxComponent extends HTMLInputDirective<boolean> {\n toggle() {\n if (!this.disabled()) {\n const value = this.value() ?? false;\n\n this.writeValue(!value);\n }\n }\n}\n","<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"inputId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAuBM,MAAO,iBAAkB,SAAQ,kBAA2B,CAAA;IAChE,MAAM,GAAA;AACJ,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,KAAK;AAEnC,YAAA,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAA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AAA,IAAA,EACK;AACJ,wBAAA,SAAS,EAAE,UAAU;AACtB,qBAAA,EAAA,QAAA,EAAA,oUAAA,EAAA;;;AErBH;;AAEG;;;;"}
1
+ {"version":3,"file":"latitude-ui-widgets-checkbox.mjs","sources":["../../../../packages/widgets/checkbox/lib/checkbox.component.ts","../../../../packages/widgets/checkbox/lib/checkbox.component.html","../../../../packages/widgets/checkbox/latitude-ui-widgets-checkbox.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, forwardRef, ViewEncapsulation } from '@angular/core';\r\nimport { HTMLFormControl } from '@latitude-ui/widgets/core';\r\nimport { IconComponent } from '@latitude-ui/widgets/icons';\r\n\r\n@Component({\r\n imports: [\r\n IconComponent\r\n ],\r\n exportAs: 'latCheckBox',\r\n selector: 'lat-checkbox',\r\n templateUrl: './checkbox.component.html',\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n providers: [\r\n {\r\n provide: HTMLFormControl,\r\n useExisting: forwardRef(() => CheckBoxComponent),\r\n },\r\n ],\r\n host: {\r\n '(click)': 'toggle()',\r\n },\r\n})\r\nexport class CheckBoxComponent extends HTMLFormControl<boolean> {\r\n toggle() {\r\n if (!this.disabled()) {\r\n const value = this.value() ?? false;\r\n\r\n this.writeValue(!value);\r\n }\r\n }\r\n}\r\n","<button\n type=\"button\"\n role=\"checkbox\"\n [attr.id]=\"computedId()\"\n [attr.value]=\"value() ? 'on' : 'off'\"\n [attr.tabindex]=\"disabled() ? -1 : tabindex()\"\n [attr.disabled]=\"disabled() || undefined\"\n [attr.aria-checked]=\"value() || false\"\n>\n <lat-icon name=\"check\" />\n</button>\n<ng-content/>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAuBM,MAAO,iBAAkB,SAAQ,eAAwB,CAAA;IAC7D,MAAM,GAAA;AACJ,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YACpB,MA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4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,WAAW,EAAE,UAAU,CAAC,uBAAuB,CAAC;AACjD,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,SAAS,EAAE,UAAU;AACtB,qBAAA,EAAA,QAAA,EAAA,uUAAA,EAAA;;;AErBH;;AAEG;;;;"}
@@ -1,22 +1,180 @@
1
- import { InjectionToken } from '@angular/core';
2
-
3
- const LAT_ASSETS_PATH = new InjectionToken(ngDevMode ? 'LAT_ASSETS_PATH' : '', {
4
- factory: () => {
5
- return 'assets/latlng';
6
- }
7
- });
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, input, contentChild, computed, Directive, inject, numberAttribute, booleanAttribute, linkedSignal, signal } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
8
4
 
9
5
  function noop() {
10
6
  //
11
7
  }
12
8
 
9
+ const ARIA_LABELLEDBY = new InjectionToken('ARIA_LABELLEDBY');
10
+ const ARIA_ERRORMESSAGE = new InjectionToken('ARIA_ERRORMESSAGE');
11
+
13
12
  function uid() {
14
13
  return `${Math.random().toString(36).slice(2, 11)}`;
15
14
  }
16
15
 
16
+ class HTMLFormControlContainer {
17
+ id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
18
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
19
+ variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : []));
20
+ control = contentChild.required((HTMLFormControl));
21
+ htmlId = computed(() => this.id() ?? uid(), ...(ngDevMode ? [{ debugName: "htmlId" }] : []));
22
+ controlId = computed(() => `lat-control-${this.htmlId()}`, ...(ngDevMode ? [{ debugName: "controlId" }] : []));
23
+ value = computed(() => this.control().value(), ...(ngDevMode ? [{ debugName: "value" }] : []));
24
+ valueAsString = computed(() => this.control().valueAsString(), ...(ngDevMode ? [{ debugName: "valueAsString" }] : []));
25
+ status = computed(() => this.control().status(), ...(ngDevMode ? [{ debugName: "status" }] : []));
26
+ touched = computed(() => this.control().touched(), ...(ngDevMode ? [{ debugName: "touched" }] : []));
27
+ dirty = computed(() => this.control().dirty(), ...(ngDevMode ? [{ debugName: "dirty" }] : []));
28
+ valid = computed(() => this.control().valid(), ...(ngDevMode ? [{ debugName: "valid" }] : []));
29
+ errors = computed(() => this.control().errors(), ...(ngDevMode ? [{ debugName: "errors" }] : []));
30
+ invalid = computed(() => this.control().invalid(), ...(ngDevMode ? [{ debugName: "invalid" }] : []));
31
+ pending = computed(() => this.control().pending(), ...(ngDevMode ? [{ debugName: "pending" }] : []));
32
+ pristine = computed(() => this.control().pristine(), ...(ngDevMode ? [{ debugName: "pristine" }] : []));
33
+ disabled = computed(() => this.control().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
34
+ readonly = computed(() => this.control().readonly(), ...(ngDevMode ? [{ debugName: "readonly" }] : []));
35
+ required = computed(() => this.control().required(), ...(ngDevMode ? [{ debugName: "required" }] : []));
36
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLFormControlContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
37
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.1.3", type: HTMLFormControlContainer, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "htmlId()", "attr.size": "size()", "attr.variant": "variant()" } }, queries: [{ propertyName: "control", first: true, predicate: (HTMLFormControl), descendants: true, isSignal: true }], ngImport: i0 });
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLFormControlContainer, decorators: [{
40
+ type: Directive,
41
+ args: [{
42
+ host: {
43
+ '[attr.id]': 'htmlId()',
44
+ '[attr.size]': 'size()',
45
+ '[attr.variant]': 'variant()',
46
+ }
47
+ }]
48
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HTMLFormControl), { isSignal: true }] }] } });
49
+
50
+ class HTMLFormControl {
51
+ dir = inject(NgControl, { self: true });
52
+ ownerCt = inject(HTMLFormControlContainer, { host: true, optional: true });
53
+ labelledby = inject(ARIA_LABELLEDBY, { host: true, optional: true });
54
+ errormessage = inject(ARIA_ERRORMESSAGE, { host: true, optional: true });
55
+ id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
56
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
57
+ variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : []));
58
+ tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : {}), transform: numberAttribute });
59
+ readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
60
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
61
+ autofocus = input(false, { ...(ngDevMode ? { debugName: "autofocus" } : {}), transform: booleanAttribute });
62
+ placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
63
+ value = computed(() => this._value(), ...(ngDevMode ? [{ debugName: "value" }] : []));
64
+ control = computed(() => this._control(), ...(ngDevMode ? [{ debugName: "control" }] : []));
65
+ valueAsString = linkedSignal({ ...(ngDevMode ? { debugName: "valueAsString" } : {}), source: () => this._value(),
66
+ computation: (value) => this.valueStringify(value) });
67
+ status = computed(() => this._control()?.['statusReactive'](), ...(ngDevMode ? [{ debugName: "status" }] : []));
68
+ touched = computed(() => this._control()?.['touchedReactive'](), ...(ngDevMode ? [{ debugName: "touched" }] : []));
69
+ pristine = computed(() => this._control()?.['pristineReactive'](), ...(ngDevMode ? [{ debugName: "pristine" }] : []));
70
+ valid = computed(() => this.status() === 'VALID', ...(ngDevMode ? [{ debugName: "valid" }] : []));
71
+ invalid = computed(() => this.status() === 'INVALID', ...(ngDevMode ? [{ debugName: "invalid" }] : []));
72
+ pending = computed(() => this.status() === 'PENDING', ...(ngDevMode ? [{ debugName: "pending" }] : []));
73
+ disabled = computed(() => this.status() === 'DISABLED', ...(ngDevMode ? [{ debugName: "disabled" }] : []));
74
+ dirty = computed(() => !this.pristine(), ...(ngDevMode ? [{ debugName: "dirty" }] : []));
75
+ errors = computed(() => {
76
+ this.value();
77
+ this.status();
78
+ const control = this.control();
79
+ return control ? control.errors : null;
80
+ }, ...(ngDevMode ? [{ debugName: "errors" }] : []));
81
+ computedId = computed(() => this.ownerCt ? this.ownerCt.controlId() : this.id(), ...(ngDevMode ? [{ debugName: "computedId" }] : []));
82
+ computedSize = computed(() => this.ownerCt ? this.ownerCt.size() : this.size(), ...(ngDevMode ? [{ debugName: "computedSize" }] : []));
83
+ computedVariant = computed(() => this.ownerCt ? this.ownerCt.variant() : this.variant(), ...(ngDevMode ? [{ debugName: "computedVariant" }] : []));
84
+ /** @internal */
85
+ _value = signal(this.dir.value, ...(ngDevMode ? [{ debugName: "_value" }] : []));
86
+ /** @internal */
87
+ _control = signal(null, ...(ngDevMode ? [{ debugName: "_control" }] : []));
88
+ constructor() {
89
+ this.dir.valueAccessor = {
90
+ writeValue: (value) => {
91
+ this._writeValue(value);
92
+ },
93
+ registerOnChange: (callback) => {
94
+ this._markAsChanged = () => callback(this._value());
95
+ // FIXME: while FromControlNameDirective not register, underline control is undefined
96
+ Promise.resolve().then(() => {
97
+ this._control.update(() => this.dir.control);
98
+ });
99
+ },
100
+ registerOnTouched: (callback) => {
101
+ this._markAsTouched = () => callback();
102
+ }
103
+ };
104
+ }
105
+ /**
106
+ * Sets the "value" property on the input element.
107
+ */
108
+ writeValue(value) {
109
+ if (this._writeValue(value)) {
110
+ this._markAsChanged();
111
+ }
112
+ }
113
+ /**
114
+ * Marks the control as `dirty`.
115
+ */
116
+ markAsChanged() {
117
+ this._markAsChanged();
118
+ }
119
+ /**
120
+ * Marks the control as `touched`.
121
+ */
122
+ markAsTouched() {
123
+ this._markAsTouched();
124
+ }
125
+ /** @internal */
126
+ valueEquality(value0, value1) {
127
+ return Object.is(value0, value1);
128
+ }
129
+ /** @internal */
130
+ valueStringify(value) {
131
+ return value !== null && value !== undefined ? value.toString() : '';
132
+ }
133
+ /** @internal */
134
+ _writeValue(input) {
135
+ const value = this._value();
136
+ if (this.valueEquality(value, input)) {
137
+ return false;
138
+ }
139
+ this._value.set(input);
140
+ return true;
141
+ }
142
+ /** @internal */
143
+ _markAsTouched = noop;
144
+ /** @internal */
145
+ _markAsChanged = noop;
146
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLFormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
147
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.3", type: HTMLFormControl, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.size": "computedSize() || undefined", "attr.variant": "computedVariant() || undefined", "attr.data-id": "computedId() || undefined", "attr.data-dirty": "dirty() || undefined", "attr.data-invalid": "invalid() || undefined", "attr.data-pristine": "pristine() || undefined", "attr.data-disabled": "disabled() || undefined", "attr.data-readonly": "readonly() || undefined", "attr.data-required": "required() || undefined" } }, ngImport: i0 });
148
+ }
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLFormControl, decorators: [{
150
+ type: Directive,
151
+ args: [{
152
+ host: {
153
+ '[attr.size]': 'computedSize() || undefined',
154
+ '[attr.variant]': 'computedVariant() || undefined',
155
+ '[attr.data-id]': 'computedId() || undefined',
156
+ '[attr.data-dirty]': 'dirty() || undefined',
157
+ '[attr.data-invalid]': 'invalid() || undefined',
158
+ '[attr.data-pristine]': 'pristine() || undefined',
159
+ '[attr.data-disabled]': 'disabled() || undefined',
160
+ '[attr.data-readonly]': 'readonly() || undefined',
161
+ '[attr.data-required]': 'required() || undefined'
162
+ }
163
+ }]
164
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
165
+
166
+ const VARIANT_PATTERN = new InjectionToken('VARIANT_PATTERN');
167
+ const BOX_SIZE_PATTERN = new InjectionToken('BOX_SIZE_PATTERN');
168
+
169
+ const LAT_ASSETS_PATH = new InjectionToken(ngDevMode ? 'LAT_ASSETS_PATH' : '', {
170
+ factory: () => {
171
+ return 'assets/latlng';
172
+ }
173
+ });
174
+
17
175
  /**
18
176
  * Generated bundle index. Do not edit.
19
177
  */
20
178
 
21
- export { LAT_ASSETS_PATH, noop, uid };
179
+ export { ARIA_ERRORMESSAGE, ARIA_LABELLEDBY, BOX_SIZE_PATTERN, HTMLFormControl, HTMLFormControlContainer, LAT_ASSETS_PATH, VARIANT_PATTERN, noop, uid };
22
180
  //# sourceMappingURL=latitude-ui-widgets-core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"latitude-ui-widgets-core.mjs","sources":["../../../../packages/widgets/core/lib/assets.ts","../../../../packages/widgets/core/lib/noop.ts","../../../../packages/widgets/core/lib/uid.ts","../../../../packages/widgets/core/latitude-ui-widgets-core.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\n\r\nexport const LAT_ASSETS_PATH = new InjectionToken(\r\n ngDevMode ? 'LAT_ASSETS_PATH' : '',\r\n {\r\n factory: () => {\r\n return 'assets/latlng';\r\n }\r\n }\r\n);\r\n","\r\n\r\nexport function noop() {\r\n //\r\n}\r\n","export function uid(): string {\r\n return `${Math.random().toString(36).slice(2, 11)}`;\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAGO,MAAM,eAAe,GAAG,IAAI,cAAc,CAC/C,SAAS,GAAG,iBAAiB,GAAG,EAAE,EAClC;IACE,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,eAAe;IACxB;AACD,CAAA;;SCPa,IAAI,GAAA;;AAEpB;;SCJgB,GAAG,GAAA;AACjB,IAAA,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;AACrD;;ACFA;;AAEG;;;;"}
1
+ {"version":3,"file":"latitude-ui-widgets-core.mjs","sources":["../../../../packages/widgets/core/lib/noop.ts","../../../../packages/widgets/core/lib/forms/control-aria.ts","../../../../packages/widgets/core/lib/uid.ts","../../../../packages/widgets/core/lib/forms/control-container.ts","../../../../packages/widgets/core/lib/forms/control.ts","../../../../packages/widgets/core/lib/appearance.ts","../../../../packages/widgets/core/lib/assets.ts","../../../../packages/widgets/core/latitude-ui-widgets-core.ts"],"sourcesContent":["\r\n\r\nexport function noop() {\r\n //\r\n}\r\n","import { InjectionToken, Signal } from '@angular/core';\r\n\r\n\r\nexport const ARIA_LABELLEDBY = new InjectionToken<Signal<string>>('ARIA_LABELLEDBY');\r\nexport const ARIA_ERRORMESSAGE = new InjectionToken<Signal<string>>('ARIA_ERRORMESSAGE');\r\n","export function uid(): string {\r\n return `${Math.random().toString(36).slice(2, 11)}`;\r\n}\r\n","import { computed, contentChild, Directive, input } from '@angular/core';\r\n\r\nimport { uid } from '../uid';\r\nimport { HTMLFormControlSize, HTMLFormControlVariant, HTMLFormControl } from './control';\r\n\r\n\r\n@Directive({\r\n host: {\r\n '[attr.id]': 'htmlId()',\r\n '[attr.size]': 'size()',\r\n '[attr.variant]': 'variant()',\r\n }\r\n})\r\nexport class HTMLFormControlContainer<T> {\r\n readonly id = input<string>();\r\n readonly size = input<HTMLFormControlSize>('md');\r\n readonly variant = input<HTMLFormControlVariant>('default');\r\n\r\n readonly control = contentChild.required(HTMLFormControl<T>);\r\n\r\n readonly htmlId = computed(() => this.id() ?? uid());\r\n readonly controlId = computed(() => `lat-control-${this.htmlId()}`);\r\n\r\n readonly value = computed(() => this.control().value());\r\n readonly valueAsString = computed(() => this.control().valueAsString());\r\n\r\n readonly status = computed(() => this.control().status());\r\n readonly touched = computed(() => this.control().touched());\r\n\r\n readonly dirty = computed(() => this.control().dirty());\r\n readonly valid = computed(() => this.control().valid());\r\n readonly errors = computed(() => this.control().errors());\r\n readonly invalid = computed(() => this.control().invalid());\r\n readonly pending = computed(() => this.control().pending());\r\n readonly pristine = computed(() => this.control().pristine());\r\n readonly disabled = computed(() => this.control().disabled());\r\n readonly readonly = computed(() => this.control().readonly());\r\n readonly required = computed(() => this.control().required());\r\n}\r\n","import {\r\n booleanAttribute,\r\n computed,\r\n Directive,\r\n inject,\r\n input,\r\n linkedSignal,\r\n numberAttribute,\r\n signal\r\n} from '@angular/core';\r\nimport { AbstractControl, FormControlStatus, NgControl } from '@angular/forms';\r\n\r\nimport { BoxSize } from '../appearance';\r\nimport { noop } from '../noop';\r\n\r\nimport { ARIA_ERRORMESSAGE, ARIA_LABELLEDBY } from './control-aria';\r\nimport { HTMLFormControlContainer } from './control-container';\r\n\r\nexport type HTMLFormControlSize = BoxSize;\r\nexport type HTMLFormControlVariant = 'default' | 'inherit' | ({} & string);\r\n\r\n@Directive({\r\n host: {\r\n '[attr.size]': 'computedSize() || undefined',\r\n '[attr.variant]': 'computedVariant() || undefined',\r\n '[attr.data-id]': 'computedId() || undefined',\r\n '[attr.data-dirty]': 'dirty() || undefined',\r\n '[attr.data-invalid]': 'invalid() || undefined',\r\n '[attr.data-pristine]': 'pristine() || undefined',\r\n '[attr.data-disabled]': 'disabled() || undefined',\r\n '[attr.data-readonly]': 'readonly() || undefined',\r\n '[attr.data-required]': 'required() || undefined'\r\n }\r\n})\r\nexport class HTMLFormControl<T> {\r\n readonly dir = inject(NgControl, { self: true });\r\n readonly ownerCt = inject(HTMLFormControlContainer, { host: true, optional: true });\r\n\r\n readonly labelledby = inject(ARIA_LABELLEDBY,{ host: true, optional: true });\r\n readonly errormessage = inject(ARIA_ERRORMESSAGE, { host: true, optional: true });\r\n\r\n readonly id = input<string>();\r\n readonly size = input<HTMLFormControlSize>('md');\r\n readonly variant = input<HTMLFormControlVariant>('default');\r\n readonly tabindex = input<number, unknown>(0, { transform: numberAttribute });\r\n readonly readonly = input<boolean, unknown>(false, { transform: booleanAttribute });\r\n readonly required = input<boolean, unknown>(false, { transform: booleanAttribute });\r\n readonly autofocus = input<boolean, unknown>(false, { transform: booleanAttribute });\r\n readonly placeholder = input<string>();\r\n\r\n readonly value = computed(() => this._value());\r\n readonly control = computed(() => this._control());\r\n\r\n readonly valueAsString = linkedSignal({\r\n source: () => this._value(),\r\n computation: (value) => this.valueStringify(value)\r\n });\r\n\r\n readonly status = computed(() => this._control()?.['statusReactive']() as FormControlStatus);\r\n readonly touched = computed(() => this._control()?.['touchedReactive']() as boolean);\r\n readonly pristine = computed(() => this._control()?.['pristineReactive']() as boolean);\r\n\r\n readonly valid = computed(() => this.status() === 'VALID');\r\n readonly invalid = computed(() => this.status() === 'INVALID');\r\n readonly pending = computed(() => this.status() === 'PENDING');\r\n readonly disabled = computed(() => this.status() === 'DISABLED');\r\n\r\n readonly dirty = computed(() => !this.pristine());\r\n readonly errors = computed(() => {\r\n this.value();\r\n this.status();\r\n\r\n const control = this.control();\r\n\r\n return control ? control.errors : null;\r\n });\r\n\r\n readonly computedId = computed(() => this.ownerCt ? this.ownerCt.controlId() : this.id());\r\n readonly computedSize = computed(() => this.ownerCt ? this.ownerCt.size() : this.size());\r\n readonly computedVariant = computed(() => this.ownerCt ? this.ownerCt.variant() : this.variant());\r\n\r\n /** @internal */\r\n readonly _value = signal<T | null>(this.dir.value);\r\n\r\n /** @internal */\r\n readonly _control = signal<AbstractControl | null>(null);\r\n\r\n constructor() {\r\n this.dir.valueAccessor = {\r\n writeValue: (value: T | null) => {\r\n this._writeValue(value);\r\n },\r\n registerOnChange: (callback: (value: T | null) => void) => {\r\n this._markAsChanged = () => callback(this._value());\r\n\r\n // FIXME: while FromControlNameDirective not register, underline control is undefined\r\n Promise.resolve().then(() => {\r\n this._control.update(() => this.dir.control);\r\n });\r\n },\r\n registerOnTouched: (callback: () => void) => {\r\n this._markAsTouched = () => callback();\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Sets the \"value\" property on the input element.\r\n */\r\n writeValue(value: T | null): void {\r\n if (this._writeValue(value)) {\r\n this._markAsChanged();\r\n }\r\n }\r\n\r\n /**\r\n * Marks the control as `dirty`.\r\n */\r\n markAsChanged(): void {\r\n this._markAsChanged();\r\n }\r\n\r\n /**\r\n * Marks the control as `touched`.\r\n */\r\n markAsTouched(): void {\r\n this._markAsTouched();\r\n }\r\n\r\n /** @internal */\r\n valueEquality(value0: T | null, value1: unknown): boolean {\r\n return Object.is(value0, value1);\r\n }\r\n\r\n /** @internal */\r\n valueStringify(value: unknown): string {\r\n return value !== null && value !== undefined ? value.toString() : '';\r\n }\r\n\r\n /** @internal */\r\n _writeValue(input: T | null): boolean {\r\n const value = this._value();\r\n\r\n if (this.valueEquality(value, input)) {\r\n return false;\r\n }\r\n\r\n this._value.set(input);\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n _markAsTouched: VoidFunction = noop;\r\n\r\n /** @internal */\r\n _markAsChanged: VoidFunction = noop;\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\n\r\n\r\nexport type BoxSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'inherit';\r\n\r\nexport const VARIANT_PATTERN = new InjectionToken<string>('VARIANT_PATTERN');\r\nexport const BOX_SIZE_PATTERN = new InjectionToken<BoxSize>('BOX_SIZE_PATTERN');\r\n","import { InjectionToken } from '@angular/core';\r\n\r\n\r\nexport const LAT_ASSETS_PATH = new InjectionToken(\r\n ngDevMode ? 'LAT_ASSETS_PATH' : '',\r\n {\r\n factory: () => {\r\n return 'assets/latlng';\r\n }\r\n }\r\n);\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;SAEgB,IAAI,GAAA;;AAEpB;;MCDa,eAAe,GAAG,IAAI,cAAc,CAAiB,iBAAiB;MACtE,iBAAiB,GAAG,IAAI,cAAc,CAAiB,mBAAmB;;SCJvE,GAAG,GAAA;AACjB,IAAA,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;AACrD;;MCWa,wBAAwB,CAAA;IAC1B,EAAE,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,I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E,wBAAwB;AAC/C,wBAAA,sBAAsB,EAAE,yBAAyB;AACjD,wBAAA,sBAAsB,EAAE,yBAAyB;AACjD,wBAAA,sBAAsB,EAAE,yBAAyB;AACjD,wBAAA,sBAAsB,EAAE;AACzB;AACF,iBAAA;;;MC5BY,eAAe,GAAG,IAAI,cAAc,CAAS,iBAAiB;MAC9D,gBAAgB,GAAG,IAAI,cAAc,CAAU,kBAAkB;;ACHvE,MAAM,eAAe,GAAG,IAAI,cAAc,CAC/C,SAAS,GAAG,iBAAiB,GAAG,EAAE,EAClC;IACE,OAAO,EAAE,MAAK;AACZ,QAAA,OAAO,eAAe;IACxB;AACD,CAAA;;ACTH;;AAEG;;;;"}
@@ -1,186 +1,40 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, numberAttribute, booleanAttribute, computed, linkedSignal, signal, Directive, contentChild, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
- import { noop, uid } from '@latitude-ui/widgets/core';
4
- import { NgControl } from '@angular/forms';
2
+ import { computed, inject, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
+ import { HTMLFormControlContainer, ARIA_LABELLEDBY, ARIA_ERRORMESSAGE } from '@latitude-ui/widgets/core';
5
4
 
6
- const INPUT_OPTIONS = new InjectionToken(ngDevMode ? 'INPUT_OPTIONS' : '', {
7
- factory: () => {
8
- return {
9
- size: 'md',
10
- variant: 'default',
11
- };
12
- }
13
- });
14
-
15
- class HTMLInputDirective {
16
- options = inject(INPUT_OPTIONS);
17
- dir = inject(NgControl, { self: true });
18
- input = inject((InputComponent), { host: true, optional: true });
19
- id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
20
- size = input(this.options.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
21
- variant = input(this.options.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
22
- tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : {}), transform: numberAttribute });
23
- readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
24
- required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
25
- autofocus = input(undefined, { ...(ngDevMode ? { debugName: "autofocus" } : {}), transform: booleanAttribute });
26
- placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
27
- value = computed(() => this._value(), ...(ngDevMode ? [{ debugName: "value" }] : []));
28
- control = computed(() => this._control(), ...(ngDevMode ? [{ debugName: "control" }] : []));
29
- valueAsString = linkedSignal({ ...(ngDevMode ? { debugName: "valueAsString" } : {}), source: () => this._value(),
30
- computation: (value) => this.valueStringify(value) });
31
- status = computed(() => this._control()?.['statusReactive'](), ...(ngDevMode ? [{ debugName: "status" }] : []));
32
- touched = computed(() => this._control()?.['touchedReactive'](), ...(ngDevMode ? [{ debugName: "touched" }] : []));
33
- pristine = computed(() => this._control()?.['pristineReactive'](), ...(ngDevMode ? [{ debugName: "pristine" }] : []));
34
- valid = computed(() => this.status() === 'VALID', ...(ngDevMode ? [{ debugName: "valid" }] : []));
35
- invalid = computed(() => this.status() === 'INVALID', ...(ngDevMode ? [{ debugName: "invalid" }] : []));
36
- pending = computed(() => this.status() === 'PENDING', ...(ngDevMode ? [{ debugName: "pending" }] : []));
37
- disabled = computed(() => this.status() === 'DISABLED', ...(ngDevMode ? [{ debugName: "disabled" }] : []));
38
- dirty = computed(() => !this.pristine(), ...(ngDevMode ? [{ debugName: "dirty" }] : []));
39
- errors = computed(() => {
40
- this.value();
41
- this.status();
42
- const control = this.control();
43
- return control ? control.errors : null;
44
- }, ...(ngDevMode ? [{ debugName: "errors" }] : []));
45
- labelId = computed(() => this.input ? this.input.labelId() : undefined, ...(ngDevMode ? [{ debugName: "labelId" }] : []));
46
- inputId = computed(() => this.input ? this.input.inputId() : this.id(), ...(ngDevMode ? [{ debugName: "inputId" }] : []));
47
- inputSize = computed(() => this.input ? this.input.size() : this.size(), ...(ngDevMode ? [{ debugName: "inputSize" }] : []));
48
- inputVariant = computed(() => this.input ? this.input.variant() : this.variant(), ...(ngDevMode ? [{ debugName: "inputVariant" }] : []));
49
- outputId = computed(() => this.input ? this.input.outputId() : undefined, ...(ngDevMode ? [{ debugName: "outputId" }] : []));
50
- /** @internal */
51
- _value = signal(this.dir.value, ...(ngDevMode ? [{ debugName: "_value" }] : []));
52
- /** @internal */
53
- _control = signal(null, ...(ngDevMode ? [{ debugName: "_control" }] : []));
54
- constructor() {
55
- this.dir.valueAccessor = {
56
- writeValue: (value) => {
57
- this._writeValue(value);
58
- },
59
- registerOnChange: (callback) => {
60
- this._markAsChanged = () => callback(this._value());
61
- // FIXME: while FromControlNameDirective not register, underline control is undefined
62
- Promise.resolve().then(() => {
63
- this._control.update(() => this.dir.control);
64
- });
65
- },
66
- registerOnTouched: (callback) => {
67
- this._markAsTouched = () => callback();
68
- }
69
- };
70
- }
71
- /**
72
- * Sets the "value" property on the input element.
73
- */
74
- writeValue(value) {
75
- if (this._writeValue(value)) {
76
- this._markAsChanged();
77
- }
78
- }
79
- /**
80
- * Marks the control as `dirty`.
81
- */
82
- markAsChanged() {
83
- this._markAsChanged();
84
- }
85
- /**
86
- * Marks the control as `touched`.
87
- */
88
- markAsTouched() {
89
- this._markAsTouched();
90
- }
91
- /** @internal */
92
- valueEquality(value0, value1) {
93
- return Object.is(value0, value1);
94
- }
95
- /** @internal */
96
- valueStringify(value) {
97
- return value !== null && value !== undefined ? value.toString() : '';
98
- }
99
- /** @internal */
100
- _writeValue(input) {
101
- const value = this._value();
102
- if (this.valueEquality(value, input)) {
103
- return false;
104
- }
105
- this._value.set(input);
106
- return true;
107
- }
108
- /** @internal */
109
- _markAsTouched = noop;
110
- /** @internal */
111
- _markAsChanged = noop;
112
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
113
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.3", type: HTMLInputDirective, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, properties: { "attr.size": "inputSize() || undefined", "attr.variant": "inputVariant() || undefined", "attr.data-id": "inputId() || undefined", "attr.data-label": "labelId() || undefined", "attr.data-output": "outputId() || undefined", "attr.data-dirty": "dirty() || undefined", "attr.data-invalid": "invalid() || undefined", "attr.data-pristine": "pristine() || undefined", "attr.data-disabled": "disabled() || undefined", "attr.data-readonly": "readonly() || undefined", "attr.data-required": "required() || undefined" } }, ngImport: i0 });
114
- }
115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: HTMLInputDirective, decorators: [{
116
- type: Directive,
117
- args: [{
118
- host: {
119
- role: 'presentation',
120
- '[attr.size]': 'inputSize() || undefined',
121
- '[attr.variant]': 'inputVariant() || undefined',
122
- '[attr.data-id]': 'inputId() || undefined',
123
- '[attr.data-label]': 'labelId() || undefined',
124
- '[attr.data-output]': 'outputId() || undefined',
125
- '[attr.data-dirty]': 'dirty() || undefined',
126
- '[attr.data-invalid]': 'invalid() || undefined',
127
- '[attr.data-pristine]': 'pristine() || undefined',
128
- '[attr.data-disabled]': 'disabled() || undefined',
129
- '[attr.data-readonly]': 'readonly() || undefined',
130
- '[attr.data-required]': 'required() || undefined'
131
- }
132
- }]
133
- }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
134
-
135
- class InputComponent {
136
- options = inject(INPUT_OPTIONS);
137
- id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
138
- size = input(this.options.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
139
- variant = input(this.options.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
140
- input = contentChild.required((HTMLInputDirective));
141
- htmlId = computed(() => this.id() ?? uid(), ...(ngDevMode ? [{ debugName: "htmlId" }] : []));
5
+ class InputComponent extends HTMLFormControlContainer {
142
6
  labelId = computed(() => `lat-label-${this.htmlId()}`, ...(ngDevMode ? [{ debugName: "labelId" }] : []));
143
- inputId = computed(() => `lat-input-${this.htmlId()}`, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
144
7
  outputId = computed(() => `lat-output-${this.htmlId()}`, ...(ngDevMode ? [{ debugName: "outputId" }] : []));
145
- value = computed(() => this.input().value(), ...(ngDevMode ? [{ debugName: "value" }] : []));
146
- valueAsString = computed(() => this.input().valueAsString(), ...(ngDevMode ? [{ debugName: "valueAsString" }] : []));
147
- status = computed(() => this.input().status(), ...(ngDevMode ? [{ debugName: "status" }] : []));
148
- touched = computed(() => this.input().touched(), ...(ngDevMode ? [{ debugName: "touched" }] : []));
149
- dirty = computed(() => this.input().dirty(), ...(ngDevMode ? [{ debugName: "dirty" }] : []));
150
- valid = computed(() => this.input().valid(), ...(ngDevMode ? [{ debugName: "valid" }] : []));
151
- errors = computed(() => this.input().errors(), ...(ngDevMode ? [{ debugName: "errors" }] : []));
152
- invalid = computed(() => this.input().invalid(), ...(ngDevMode ? [{ debugName: "invalid" }] : []));
153
- pending = computed(() => this.input().pending(), ...(ngDevMode ? [{ debugName: "pending" }] : []));
154
- pristine = computed(() => this.input().pristine(), ...(ngDevMode ? [{ debugName: "pristine" }] : []));
155
- disabled = computed(() => this.input().disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
156
- readonly = computed(() => this.input().readonly(), ...(ngDevMode ? [{ debugName: "readonly" }] : []));
157
- required = computed(() => this.input().required(), ...(ngDevMode ? [{ debugName: "required" }] : []));
158
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
159
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: InputComponent, isStandalone: true, selector: "lat-input", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, properties: { "attr.id": "htmlId()", "attr.data-size": "size()", "attr.data-variant": "variant()", "attr.data-label": "labelId()", "attr.data-input": "inputId()", "attr.data-output": "outputId()", "attr.data-dirty": "dirty() || undefined", "attr.data-invalid": "invalid() || undefined", "attr.data-pristine": "pristine() || undefined", "attr.data-disabled": "disabled() || undefined", "attr.data-readonly": "readonly() || undefined", "attr.data-required": "required() || undefined" } }, queries: [{ propertyName: "input", first: true, predicate: (HTMLInputDirective), descendants: true, isSignal: true }], exportAs: ["latInput"], ngImport: i0, template: "<ng-content select=\"lat-label\" />\r\n\r\n<ng-content />\r\n\r\n@if (dirty() && errors()) {\r\n <ng-content select=\"lat-output\" />\r\n}\r\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
8
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: InputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
9
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: InputComponent, isStandalone: true, selector: "lat-input", providers: [
10
+ {
11
+ provide: ARIA_LABELLEDBY,
12
+ useFactory: () => inject(InputComponent, { self: true }).labelId
13
+ },
14
+ {
15
+ provide: ARIA_ERRORMESSAGE,
16
+ useFactory: () => inject(InputComponent, { self: true }).outputId
17
+ },
18
+ ], exportAs: ["latInput"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"lat-label\" />\r\n\r\n<ng-content />\r\n\r\n@if (dirty() && errors()) {\r\n <ng-content select=\"lat-output\" />\r\n}\r\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
160
19
  }
161
20
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: InputComponent, decorators: [{
162
21
  type: Component,
163
- args: [{ exportAs: 'latInput', selector: 'lat-input', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
164
- role: 'presentation',
165
- '[attr.id]': 'htmlId()',
166
- '[attr.data-size]': 'size()',
167
- '[attr.data-variant]': 'variant()',
168
- '[attr.data-label]': 'labelId()',
169
- '[attr.data-input]': 'inputId()',
170
- '[attr.data-output]': 'outputId()',
171
- '[attr.data-dirty]': 'dirty() || undefined',
172
- '[attr.data-invalid]': 'invalid() || undefined',
173
- '[attr.data-pristine]': 'pristine() || undefined',
174
- '[attr.data-disabled]': 'disabled() || undefined',
175
- '[attr.data-readonly]': 'readonly() || undefined',
176
- '[attr.data-required]': 'required() || undefined'
177
- }, template: "<ng-content select=\"lat-label\" />\r\n\r\n<ng-content />\r\n\r\n@if (dirty() && errors()) {\r\n <ng-content select=\"lat-output\" />\r\n}\r\n" }]
178
- }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], input: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HTMLInputDirective), { isSignal: true }] }] } });
22
+ args: [{ exportAs: 'latInput', selector: 'lat-input', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
23
+ {
24
+ provide: ARIA_LABELLEDBY,
25
+ useFactory: () => inject(InputComponent, { self: true }).labelId
26
+ },
27
+ {
28
+ provide: ARIA_ERRORMESSAGE,
29
+ useFactory: () => inject(InputComponent, { self: true }).outputId
30
+ },
31
+ ], template: "<ng-content select=\"lat-label\" />\r\n\r\n<ng-content />\r\n\r\n@if (dirty() && errors()) {\r\n <ng-content select=\"lat-output\" />\r\n}\r\n" }]
32
+ }] });
179
33
 
180
34
  class LabelComponent {
181
35
  input = inject((InputComponent), { host: true });
182
36
  id = computed(() => this.input.labelId(), ...(ngDevMode ? [{ debugName: "id" }] : []));
183
- htmlFor = computed(() => this.input.inputId(), ...(ngDevMode ? [{ debugName: "htmlFor" }] : []));
37
+ htmlFor = computed(() => this.input.controlId(), ...(ngDevMode ? [{ debugName: "htmlFor" }] : []));
184
38
  required = computed(() => this.input.required(), ...(ngDevMode ? [{ debugName: "required" }] : []));
185
39
  readonly = computed(() => this.input.readonly(), ...(ngDevMode ? [{ debugName: "readonly" }] : []));
186
40
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: LabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -197,7 +51,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
197
51
  class OutputComponent {
198
52
  input = inject((InputComponent), { host: true });
199
53
  id = computed(() => this.input.outputId(), ...(ngDevMode ? [{ debugName: "id" }] : []));
200
- htmlFor = computed(() => this.input.inputId(), ...(ngDevMode ? [{ debugName: "htmlFor" }] : []));
54
+ htmlFor = computed(() => this.input.controlId(), ...(ngDevMode ? [{ debugName: "htmlFor" }] : []));
201
55
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: OutputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
202
56
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: OutputComponent, isStandalone: true, selector: "lat-output", host: { attributes: { "role": "presentation" }, properties: { "attr.id": "null" } }, exportAs: ["latOutput"], ngImport: i0, template: "<output [attr.id]=\"id()\" [attr.for]=\"htmlFor()\">\r\n <ng-content></ng-content>\r\n</output>\r\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
203
57
  }
@@ -213,5 +67,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
213
67
  * Generated bundle index. Do not edit.
214
68
  */
215
69
 
216
- export { HTMLInputDirective, INPUT_OPTIONS, InputComponent, LabelComponent, OutputComponent };
70
+ export { InputComponent, LabelComponent, OutputComponent };
217
71
  //# sourceMappingURL=latitude-ui-widgets-input.mjs.map