@xui/label 2.0.0-alpha.4 → 2.0.0-alpha.6
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/fesm2022/xui-label.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, input, computed, signal, Directive } from '@angular/core';
|
|
3
3
|
import { xui } from '@xui/core';
|
|
4
4
|
import * as i1 from '@xui/core/label';
|
|
5
|
-
import {
|
|
5
|
+
import { XLabelDirective } from '@xui/core/label';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
|
|
8
8
|
// TODO: theme - disabled, etc.
|
|
@@ -31,7 +31,7 @@ const labelVariants = cva([
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
class XuiLabelDirective {
|
|
34
|
-
|
|
34
|
+
xLabel = inject(XLabelDirective, { host: true });
|
|
35
35
|
class = input('');
|
|
36
36
|
variant = input('default');
|
|
37
37
|
error = input('auto');
|
|
@@ -41,13 +41,13 @@ class XuiLabelDirective {
|
|
|
41
41
|
computedClass = computed(() => xui(labelVariants({
|
|
42
42
|
variant: this.variant(),
|
|
43
43
|
error: this.state().error(),
|
|
44
|
-
disabled: this.
|
|
44
|
+
disabled: this.xLabel?.dataDisabled() ?? 'auto'
|
|
45
45
|
}), this.class()));
|
|
46
46
|
setError(error) {
|
|
47
47
|
this.state().error.set(error);
|
|
48
48
|
}
|
|
49
49
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
50
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: XuiLabelDirective, isStandalone: true, selector: "[xuiLabel]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, hostDirectives: [{ directive: i1.
|
|
50
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: XuiLabelDirective, isStandalone: true, selector: "[xuiLabel]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, hostDirectives: [{ directive: i1.XLabelDirective, inputs: ["id", "id"] }], ngImport: i0 });
|
|
51
51
|
}
|
|
52
52
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: XuiLabelDirective, decorators: [{
|
|
53
53
|
type: Directive,
|
|
@@ -55,7 +55,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
|
|
|
55
55
|
selector: '[xuiLabel]',
|
|
56
56
|
hostDirectives: [
|
|
57
57
|
{
|
|
58
|
-
directive:
|
|
58
|
+
directive: XLabelDirective,
|
|
59
59
|
inputs: ['id']
|
|
60
60
|
}
|
|
61
61
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-label.mjs","sources":["../../../../../../libs/ui/label/xui/src/lib/label.directive.ts","../../../../../../libs/ui/label/xui/src/xui-label.ts"],"sourcesContent":["import { Directive, computed, inject, input, signal } from '@angular/core';\nimport { xui } from '@xui/core';\nimport {
|
|
1
|
+
{"version":3,"file":"xui-label.mjs","sources":["../../../../../../libs/ui/label/xui/src/lib/label.directive.ts","../../../../../../libs/ui/label/xui/src/xui-label.ts"],"sourcesContent":["import { Directive, computed, inject, input, signal } from '@angular/core';\nimport { xui } from '@xui/core';\nimport { XLabelDirective } from '@xui/core/label';\nimport { type VariantProps, cva } from 'class-variance-authority';\nimport type { ClassValue } from 'clsx';\n\n// TODO: theme - disabled, etc.\nexport const labelVariants = cva(\n [\n 'text-sm font-medium leading-none',\n '[&.ng-invalid.ng-touched]:text-error',\n '[&>[xuiInput]]:my-1 [&:has([xuiInput]:disabled)]:cursor-not-allowed [&:has([xuiInput]:disabled)]:opacity-70'\n ],\n {\n variants: {\n variant: {\n default: ''\n },\n error: {\n auto: '[&:has([xuiInput].ng-invalid.ng-touched)]:text-error',\n true: 'text-error'\n },\n disabled: {\n auto: '[&:has([xuiInput]:disabled)]:opacity-70',\n true: 'opacity-70',\n false: ''\n }\n },\n defaultVariants: {\n variant: 'default',\n error: 'auto'\n }\n }\n);\nexport type LabelVariants = VariantProps<typeof labelVariants>;\n\n@Directive({\n selector: '[xuiLabel]',\n hostDirectives: [\n {\n directive: XLabelDirective,\n inputs: ['id']\n }\n ],\n host: {\n '[class]': 'computedClass()'\n }\n})\nexport class XuiLabelDirective {\n private readonly xLabel = inject(XLabelDirective, { host: true });\n\n readonly class = input<ClassValue>('');\n readonly variant = input<LabelVariants['variant']>('default');\n readonly error = input<LabelVariants['error']>('auto');\n\n protected readonly state = computed(() => ({\n error: signal(this.error())\n }));\n\n protected readonly computedClass = computed(() =>\n xui(\n labelVariants({\n variant: this.variant(),\n error: this.state().error(),\n disabled: this.xLabel?.dataDisabled() ?? 'auto'\n }),\n this.class()\n )\n );\n\n setError(error: LabelVariants['error']): void {\n this.state().error.set(error);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAMA;AACO,MAAM,aAAa,GAAG,GAAG,CAC9B;IACE,kCAAkC;IAClC,sCAAsC;IACtC;CACD,EACD;AACE,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,KAAK,EAA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,YAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,MAAA,EAAA,CAAA,IAAA,EAAA,IAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAZ7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,cAAc,EAAE;AACd,wBAAA;AACE,4BAAA,SAAS,EAAE,eAAe;4BAC1B,MAAM,EAAE,CAAC,IAAI;AACd;AACF,qBAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE;AACZ;AACF,iBAAA;;;AC/CD;;AAEG;;;;"}
|
package/lib/label.directive.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const labelVariants: (props?: ({
|
|
|
9
9
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
10
|
export type LabelVariants = VariantProps<typeof labelVariants>;
|
|
11
11
|
export declare class XuiLabelDirective {
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly xLabel;
|
|
13
13
|
readonly class: import("@angular/core").InputSignal<ClassValue>;
|
|
14
14
|
readonly variant: import("@angular/core").InputSignal<"default" | null | undefined>;
|
|
15
15
|
readonly error: import("@angular/core").InputSignal<boolean | "auto" | null | undefined>;
|
|
@@ -19,5 +19,5 @@ export declare class XuiLabelDirective {
|
|
|
19
19
|
protected readonly computedClass: import("@angular/core").Signal<string>;
|
|
20
20
|
setError(error: LabelVariants['error']): void;
|
|
21
21
|
static ɵfac: i0.ɵɵFactoryDeclaration<XuiLabelDirective, never>;
|
|
22
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<XuiLabelDirective, "[xuiLabel]", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.
|
|
22
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<XuiLabelDirective, "[xuiLabel]", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.XLabelDirective; inputs: { "id": "id"; }; outputs: {}; }]>;
|
|
23
23
|
}
|