@uni-ds/ui 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ # ui
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running unit tests
6
+
7
+ Run `nx test ui` to execute the unit tests.
@@ -0,0 +1,73 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { cva } from 'class-variance-authority';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+
7
+ const buttonVariants = cva('inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
8
+ variants: {
9
+ variant: {
10
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90',
11
+ destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
12
+ outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
13
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
14
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
15
+ link: 'text-primary underline-offset-4 hover:underline',
16
+ success: 'bg-success text-success-foreground hover:bg-success/90',
17
+ },
18
+ size: {
19
+ default: 'h-10 px-4 py-2',
20
+ sm: 'h-9 rounded-md px-3',
21
+ lg: 'h-11 rounded-md px-8',
22
+ icon: 'h-10 w-10',
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: 'default',
27
+ size: 'default',
28
+ },
29
+ });
30
+ function cn(...inputs) {
31
+ return twMerge(clsx(inputs));
32
+ }
33
+ class UniButtonComponent {
34
+ constructor() {
35
+ this.variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
36
+ this.size = input('default', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
37
+ this.customClass = input('', ...(ngDevMode ? [{ debugName: "customClass" }] : /* istanbul ignore next */ []));
38
+ this.computedClass = computed(() => {
39
+ return cn(buttonVariants({ variant: this.variant(), size: this.size() }), this.customClass());
40
+ }, ...(ngDevMode ? [{ debugName: "computedClass" }] : /* istanbul ignore next */ []));
41
+ }
42
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: UniButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
43
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.13", type: UniButtonComponent, isStandalone: true, selector: "button[uni-button], a[uni-button]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, customClass: { classPropertyName: "customClass", publicName: "customClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: UniButtonComponent, decorators: [{
46
+ type: Component,
47
+ args: [{
48
+ // eslint-disable-next-line @angular-eslint/component-selector
49
+ selector: 'button[uni-button], a[uni-button]',
50
+ standalone: true,
51
+ template: `<ng-content></ng-content>`,
52
+ changeDetection: ChangeDetectionStrategy.OnPush,
53
+ host: {
54
+ '[class]': 'computedClass()',
55
+ },
56
+ }]
57
+ }], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], customClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "customClass", required: false }] }] } });
58
+
59
+ class Ui {
60
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: Ui, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
61
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.13", type: Ui, isStandalone: true, selector: "uni-ui", ngImport: i0, template: "<p>Ui works!</p>\n", styles: [""] }); }
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImport: i0, type: Ui, decorators: [{
64
+ type: Component,
65
+ args: [{ selector: 'uni-ui', imports: [], template: "<p>Ui works!</p>\n" }]
66
+ }] });
67
+
68
+ /**
69
+ * Generated bundle index. Do not edit.
70
+ */
71
+
72
+ export { Ui, UniButtonComponent, buttonVariants, cn };
73
+ //# sourceMappingURL=uni-ds-ui.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uni-ds-ui.mjs","sources":["../../../../libs/ui/src/lib/button/button.component.ts","../../../../libs/ui/src/lib/ui/ui.ts","../../../../libs/ui/src/lib/ui/ui.html","../../../../libs/ui/src/uni-ds-ui.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n} from '@angular/core';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const buttonVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n);\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport type ButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'success';\nexport type ButtonSize = 'default' | 'sm' | 'lg' | 'icon';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[uni-button], a[uni-button]',\n standalone: true,\n template: `<ng-content></ng-content>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class UniButtonComponent {\n variant = input<ButtonVariant>('default');\n size = input<ButtonSize>('default');\n customClass = input<string>('');\n\n computedClass = computed(() => {\n return cn(\n buttonVariants({ variant: this.variant(), size: this.size() }),\n this.customClass(),\n );\n });\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'uni-ui',\n imports: [],\n templateUrl: './ui.html',\n styleUrl: './ui.css',\n})\nexport class Ui {}\n","<p>Ui works!</p>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,cAAc,GAAG,GAAG,CAC/B,wRAAwR,EACxR;AACE,IAAA,QAAQ,EAAE;AACR,QAAA,OAAO,EAAE;AACP,YAAA,OAAO,EAAE,wDAAwD;AACjE,YAAA,WAAW,EACT,oEAAoE;AACtE,YAAA,OAAO,EACL,gFAAgF;AAClF,YAAA,SAAS,EACP,8DAA8D;AAChE,YAAA,KAAK,EAAE,8CAA8C;AACrD,YAAA,IAAI,EAAE,iDAAiD;AACvD,YAAA,OAAO,EAAE,wDAAwD;AAClE,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,OAAO,EAAE,gBAAgB;AACzB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kBAV9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;;AAET,oBAAA,QAAQ,EAAE,mCAAmC;AAC7C,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,CAAA,yBAAA,CAA2B;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,iBAAiB;AAC7B,qBAAA;AACF,iBAAA;;;MChDY,EAAE,CAAA;+GAAF,EAAE,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAF,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,EAAE,kECRf,oBACA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FDOa,EAAE,EAAA,UAAA,EAAA,CAAA;kBANd,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,QAAQ,WACT,EAAE,EAAA,QAAA,EAAA,oBAAA,EAAA;;;AEJb;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@uni-ds/ui",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/core": "^21.2.0",
6
+ "class-variance-authority": ">=0.7.0",
7
+ "clsx": ">=2.0.0",
8
+ "tailwind-merge": ">=3.0.0"
9
+ },
10
+ "sideEffects": false,
11
+ "module": "fesm2022/uni-ds-ui.mjs",
12
+ "typings": "types/uni-ds-ui.d.ts",
13
+ "exports": {
14
+ "./package.json": {
15
+ "default": "./package.json"
16
+ },
17
+ ".": {
18
+ "types": "./types/uni-ds-ui.d.ts",
19
+ "default": "./fesm2022/uni-ds-ui.mjs"
20
+ }
21
+ },
22
+ "type": "module",
23
+ "dependencies": {
24
+ "tslib": "^2.3.0"
25
+ }
26
+ }
@@ -0,0 +1,27 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import { ClassValue } from 'clsx';
4
+
5
+ declare const buttonVariants: (props?: ({
6
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "success" | null | undefined;
7
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
8
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
9
+ declare function cn(...inputs: ClassValue[]): string;
10
+ type ButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'success';
11
+ type ButtonSize = 'default' | 'sm' | 'lg' | 'icon';
12
+ declare class UniButtonComponent {
13
+ variant: _angular_core.InputSignal<ButtonVariant>;
14
+ size: _angular_core.InputSignal<ButtonSize>;
15
+ customClass: _angular_core.InputSignal<string>;
16
+ computedClass: _angular_core.Signal<string>;
17
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UniButtonComponent, never>;
18
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UniButtonComponent, "button[uni-button], a[uni-button]", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "customClass": { "alias": "customClass"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
19
+ }
20
+
21
+ declare class Ui {
22
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Ui, never>;
23
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Ui, "uni-ui", never, {}, {}, never, never, true, never>;
24
+ }
25
+
26
+ export { Ui, UniButtonComponent, buttonVariants, cn };
27
+ export type { ButtonSize, ButtonVariant };