@lamenna/lxp-angular 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/.turbo/turbo-build.log +5 -0
- package/jest.config.js +22 -0
- package/jest.setup.ts +5 -0
- package/package.json +24 -0
- package/src/components/button/button.component.ts +61 -0
- package/src/components/button/index.ts +1 -0
- package/src/index.ts +1 -0
package/jest.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jest Configuration for @lamenna/lxp-angular
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
displayName: '@lamenna/lxp-angular',
|
|
7
|
+
testEnvironment: 'jsdom',
|
|
8
|
+
preset: 'ts-jest',
|
|
9
|
+
rootDir: '.',
|
|
10
|
+
testMatch: ['<rootDir>/src/**/__tests__/**/*.test.ts', '<rootDir>/src/**/*.test.ts'],
|
|
11
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
12
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
13
|
+
collectCoverageFrom: [
|
|
14
|
+
'src/**/*.{ts,tsx}',
|
|
15
|
+
'!src/**/*.d.ts',
|
|
16
|
+
'!src/index.ts',
|
|
17
|
+
],
|
|
18
|
+
coveragePathIgnorePatterns: [
|
|
19
|
+
'/node_modules/',
|
|
20
|
+
'/dist/',
|
|
21
|
+
],
|
|
22
|
+
};
|
package/jest.setup.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lamenna/lxp-angular",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Angular components for LXP",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@angular/common": "^17.0.0",
|
|
10
|
+
"@angular/core": "^17.0.0"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@lamenna/lxp-tokens": "0.0.1",
|
|
14
|
+
"@lamenna/lxp-shared-components": "0.0.1"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "echo 'Angular build will be configured later'",
|
|
18
|
+
"dev": "echo 'Angular dev mode'",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"test:watch": "jest --watch",
|
|
21
|
+
"test:coverage": "jest --coverage",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
HostBinding,
|
|
7
|
+
} from "@angular/core";
|
|
8
|
+
import {
|
|
9
|
+
AngularButtonProps,
|
|
10
|
+
ButtonVariant,
|
|
11
|
+
ButtonSize,
|
|
12
|
+
buttonConfig,
|
|
13
|
+
} from "@lamenna/lxp-shared-components";
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: "lxp-button",
|
|
17
|
+
template: `
|
|
18
|
+
<button
|
|
19
|
+
[attr.id]="id"
|
|
20
|
+
[attr.data-testid]="testID"
|
|
21
|
+
[attr.aria-label]="ariaLabel"
|
|
22
|
+
[disabled]="disabled"
|
|
23
|
+
(click)="onClick.emit($event)"
|
|
24
|
+
[ngClass]="buttonClasses"
|
|
25
|
+
>
|
|
26
|
+
{{ content }}
|
|
27
|
+
</button>
|
|
28
|
+
`,
|
|
29
|
+
standalone: true,
|
|
30
|
+
})
|
|
31
|
+
export class ButtonComponent implements AngularButtonProps {
|
|
32
|
+
@Input() content?: string;
|
|
33
|
+
@Input() variant: ButtonVariant = "primary";
|
|
34
|
+
@Input() size: ButtonSize = "md";
|
|
35
|
+
@Input() disabled: boolean = false;
|
|
36
|
+
@Input() className?: string;
|
|
37
|
+
@Input() id?: string;
|
|
38
|
+
@Input() ariaLabel?: string;
|
|
39
|
+
@Input() testID?: string;
|
|
40
|
+
@Input() label?: string;
|
|
41
|
+
|
|
42
|
+
@Output() onClick = new EventEmitter<MouseEvent>();
|
|
43
|
+
|
|
44
|
+
@HostBinding("style") get hostStyles() {
|
|
45
|
+
const variantConfig = buttonConfig.variants[this.variant];
|
|
46
|
+
const sizeConfig = buttonConfig.sizes[this.size];
|
|
47
|
+
return {
|
|
48
|
+
...buttonConfig.common,
|
|
49
|
+
...variantConfig,
|
|
50
|
+
...sizeConfig,
|
|
51
|
+
opacity: this.disabled ? "0.6" : "1",
|
|
52
|
+
pointerEvents: this.disabled ? "none" : "auto",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get buttonClasses() {
|
|
57
|
+
return {
|
|
58
|
+
[this.className || ""]: !!this.className,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonComponent } from "./button.component";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button/button.component";
|