@3dsource/source-ui-native 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 +64 -0
- package/eslint.config.js +37 -0
- package/ng-package.json +7 -0
- package/package.json +9 -0
- package/src/lib/components/source-badge/components/source-badge.component.html +20 -0
- package/src/lib/components/source-badge/components/source-badge.component.scss +76 -0
- package/src/lib/components/source-badge/components/source-badge.component.ts +62 -0
- package/src/lib/components/source-badge/constants/index.ts +2 -0
- package/src/lib/components/source-badge/constants/sourceBadgeSize.ts +8 -0
- package/src/lib/components/source-badge/constants/sourceBadgeType.ts +11 -0
- package/src/lib/components/source-badge/index.ts +2 -0
- package/src/lib/components/source-banner/components/source-banner.component.html +10 -0
- package/src/lib/components/source-banner/components/source-banner.component.scss +75 -0
- package/src/lib/components/source-banner/components/source-banner.component.ts +25 -0
- package/src/lib/components/source-banner/constants/sourceBannerType.ts +10 -0
- package/src/lib/components/source-banner/index.ts +2 -0
- package/src/lib/components/source-button/components/source-button.component.html +44 -0
- package/src/lib/components/source-button/components/source-button.component.scss +355 -0
- package/src/lib/components/source-button/components/source-button.component.ts +220 -0
- package/src/lib/components/source-button/constants/index.ts +4 -0
- package/src/lib/components/source-button/constants/sourceButtonAppearance.ts +7 -0
- package/src/lib/components/source-button/constants/sourceButtonColorScheme.ts +8 -0
- package/src/lib/components/source-button/constants/sourceButtonSize.ts +8 -0
- package/src/lib/components/source-button/constants/sourceButtonType.ts +8 -0
- package/src/lib/components/source-button/index.ts +3 -0
- package/src/lib/components/source-button/interfaces/defaultSourceButton.config.ts +24 -0
- package/src/lib/components/source-button/interfaces/index.ts +2 -0
- package/src/lib/components/source-button/interfaces/sourceButton.interface.ts +26 -0
- package/src/lib/components/source-copyright/components/source-copyright.component.html +20 -0
- package/src/lib/components/source-copyright/components/source-copyright.component.scss +81 -0
- package/src/lib/components/source-copyright/components/source-copyright.component.ts +18 -0
- package/src/lib/components/source-copyright/index.ts +1 -0
- package/src/lib/components/source-divider/components/source-divider.component.html +5 -0
- package/src/lib/components/source-divider/components/source-divider.component.scss +15 -0
- package/src/lib/components/source-divider/components/source-divider.component.ts +18 -0
- package/src/lib/components/source-divider/index.ts +1 -0
- package/src/lib/components/source-hint/components/source-hint.component.html +8 -0
- package/src/lib/components/source-hint/components/source-hint.component.scss +31 -0
- package/src/lib/components/source-hint/components/source-hint.component.ts +18 -0
- package/src/lib/components/source-hint/index.ts +1 -0
- package/src/lib/components/source-icon-button/components/source-icon-button.component.html +18 -0
- package/src/lib/components/source-icon-button/components/source-icon-button.component.scss +89 -0
- package/src/lib/components/source-icon-button/components/source-icon-button.component.ts +87 -0
- package/src/lib/components/source-icon-button/constants/index.ts +3 -0
- package/src/lib/components/source-icon-button/constants/sourceIconButtonShape.ts +7 -0
- package/src/lib/components/source-icon-button/constants/sourceIconButtonSize.ts +10 -0
- package/src/lib/components/source-icon-button/constants/sourceIconButtonType.ts +8 -0
- package/src/lib/components/source-icon-button/index.ts +2 -0
- package/src/lib/components/source-loading/components/source-loading.component.html +40 -0
- package/src/lib/components/source-loading/components/source-loading.component.scss +62 -0
- package/src/lib/components/source-loading/components/source-loading.component.ts +79 -0
- package/src/lib/components/source-loading/constants/sourceLoadingLineCap.ts +7 -0
- package/src/lib/components/source-loading/index.ts +1 -0
- package/src/lib/components/source-logo-loading/components/source-logo-loading.component.html +23 -0
- package/src/lib/components/source-logo-loading/components/source-logo-loading.component.scss +33 -0
- package/src/lib/components/source-logo-loading/components/source-logo-loading.component.ts +21 -0
- package/src/lib/components/source-logo-loading/index.ts +1 -0
- package/src/lib/components/source-slider/components/source-slider.component.html +38 -0
- package/src/lib/components/source-slider/components/source-slider.component.scss +132 -0
- package/src/lib/components/source-slider/components/source-slider.component.ts +122 -0
- package/src/lib/components/source-slider/index.ts +1 -0
- package/src/lib/styles/base.scss +68 -0
- package/src/lib/styles/elements/_src-button.scss +235 -0
- package/src/lib/styles/elements/_src-input.scss +83 -0
- package/src/lib/styles/elements/_src-list.scss +82 -0
- package/src/lib/styles/elements/_src-select.scss +71 -0
- package/src/lib/styles/elements/elements.scss +4 -0
- package/src/lib/styles/fonts/Inter-VariableFont_slnt,wght.woff2 +0 -0
- package/src/lib/styles/fonts.scss +18 -0
- package/src/lib/styles/source.ui.scss +23 -0
- package/src/lib/styles/typography.scss +90 -0
- package/src/lib/styles/utils.scss +40 -0
- package/src/lib/styles/variables/_borders.scss +14 -0
- package/src/lib/styles/variables/_colors-aliases.scss +39 -0
- package/src/lib/styles/variables/_colors.scss +64 -0
- package/src/lib/styles/variables/_shadows.scss +9 -0
- package/src/lib/styles/variables/_typography.scss +32 -0
- package/src/lib/styles/variables/index.scss +5 -0
- package/src/public-api.ts +10 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# SourceUiNative
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build source-ui-native
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd dist/source-ui-native
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
40
|
+
```bash
|
|
41
|
+
npm publish
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Running unit tests
|
|
45
|
+
|
|
46
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
ng test
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Running end-to-end tests
|
|
53
|
+
|
|
54
|
+
For end-to-end (e2e) testing, run:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ng e2e
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
61
|
+
|
|
62
|
+
## Additional Resources
|
|
63
|
+
|
|
64
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const tseslint = require('typescript-eslint');
|
|
3
|
+
const rootConfig = require('../../../eslint.config.js');
|
|
4
|
+
|
|
5
|
+
module.exports = tseslint.config(
|
|
6
|
+
...rootConfig,
|
|
7
|
+
{
|
|
8
|
+
files: ['**/*.ts'],
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parserOptions: {
|
|
11
|
+
projectService: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
'@angular-eslint/directive-selector': [
|
|
16
|
+
'error',
|
|
17
|
+
{
|
|
18
|
+
type: 'attribute',
|
|
19
|
+
prefix: 'lib',
|
|
20
|
+
style: 'camelCase',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'@angular-eslint/component-selector': [
|
|
24
|
+
'error',
|
|
25
|
+
{
|
|
26
|
+
type: 'element',
|
|
27
|
+
prefix: 'lib',
|
|
28
|
+
style: 'kebab-case',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
files: ['**/*.html'],
|
|
35
|
+
rules: {},
|
|
36
|
+
},
|
|
37
|
+
);
|
package/ng-package.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="src-badge"
|
|
3
|
+
[ngClass]="classes"
|
|
4
|
+
[ngStyle]="
|
|
5
|
+
type
|
|
6
|
+
? {}
|
|
7
|
+
: {
|
|
8
|
+
'--srcBadgeBorderColor': borderColor,
|
|
9
|
+
'--srcBadgeBackgroundColor': backgroundColor,
|
|
10
|
+
'--srcBadgeBorderWidth': borderWidth,
|
|
11
|
+
'--srcBadgeTextColor': textColor,
|
|
12
|
+
}
|
|
13
|
+
"
|
|
14
|
+
[attr.data-testid]="testID"
|
|
15
|
+
>
|
|
16
|
+
@if (number) {
|
|
17
|
+
{{ number }}
|
|
18
|
+
}
|
|
19
|
+
<ng-content></ng-content>
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// source-badge.component.scss
|
|
2
|
+
.src-badge {
|
|
3
|
+
--srcBadgeHeight: 18px;
|
|
4
|
+
--srcBadgeBorderWidth: 2px;
|
|
5
|
+
--srcBadgePadding: 2px 4px;
|
|
6
|
+
--srcBadgeBackgroundColor: var(--src-color-brand-500, darkgreen);
|
|
7
|
+
--srcBadgeBorderColor: var(--src-color-bg-default, #fff);
|
|
8
|
+
--srcBadgeTextColor: var(--src-color-text-inverse, #fff);
|
|
9
|
+
display: inline-block;
|
|
10
|
+
width: auto;
|
|
11
|
+
min-width: var(--srcBadgeHeight);
|
|
12
|
+
height: var(--srcBadgeHeight);
|
|
13
|
+
padding: var(--srcBadgePadding);
|
|
14
|
+
vertical-align: top;
|
|
15
|
+
text-align: center;
|
|
16
|
+
border-radius: 99px;
|
|
17
|
+
border: var(--srcBadgeBorderWidth) solid var(--srcBadgeBorderColor, #fff);
|
|
18
|
+
background: var(--srcBadgeBackgroundColor);
|
|
19
|
+
color: var(--srcBadgeTextColor);
|
|
20
|
+
font-size: 9px;
|
|
21
|
+
font-weight: 700;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
|
|
24
|
+
&--small {
|
|
25
|
+
--srcBadgeHeight: 16px;
|
|
26
|
+
font-size: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--large {
|
|
30
|
+
--srcBadgeHeight: 20px;
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&--neutral,
|
|
35
|
+
&--informational,
|
|
36
|
+
&--success,
|
|
37
|
+
&--warning,
|
|
38
|
+
&--attention,
|
|
39
|
+
&--critical {
|
|
40
|
+
--srcBadgeHeight: 20px;
|
|
41
|
+
--srcBadgeBorderWidth: 0px;
|
|
42
|
+
--srcBadgePadding: 2px 8px;
|
|
43
|
+
--srcBadgeBackgroundColor: var(--src-color-bg-strong);
|
|
44
|
+
--srcBadgeTextColor: var(--src-color-text-default, #1f2937);
|
|
45
|
+
text-align: center;
|
|
46
|
+
font-family: var(--src-font-family-sans);
|
|
47
|
+
font-size: var(--src-fs-small);
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: var(--src-fw-medium, 500);
|
|
50
|
+
line-height: var(--src-lh-small);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&--neutral {
|
|
54
|
+
--srcBadgeBackgroundColor: var(--src-color-bg-strong);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--informational {
|
|
58
|
+
--srcBadgeBackgroundColor: #a4e8f2;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--success {
|
|
62
|
+
--srcBadgeBackgroundColor: #aee9d1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--warning {
|
|
66
|
+
--srcBadgeBackgroundColor: #ffd79d;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&--attention {
|
|
70
|
+
--srcBadgeBackgroundColor: #ffea8a;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&--critical {
|
|
74
|
+
--srcBadgeBackgroundColor: #ffb7b7;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
Input,
|
|
5
|
+
input,
|
|
6
|
+
OnInit,
|
|
7
|
+
ViewEncapsulation,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import {
|
|
10
|
+
SourceBadgeSize,
|
|
11
|
+
SourceBadgeSizeValues,
|
|
12
|
+
SourceBadgeType,
|
|
13
|
+
} from '../constants';
|
|
14
|
+
import { NgClass, NgStyle } from '@angular/common';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'src-badge',
|
|
18
|
+
templateUrl: './source-badge.component.html',
|
|
19
|
+
styleUrls: ['./source-badge.component.scss'],
|
|
20
|
+
imports: [NgStyle, NgClass],
|
|
21
|
+
encapsulation: ViewEncapsulation.None,
|
|
22
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
|
+
})
|
|
24
|
+
export class SourceBadgeComponent implements OnInit {
|
|
25
|
+
@Input() number = 0;
|
|
26
|
+
@Input() backgroundColor? = 'var(--src-color-icon-critical, #B91C1C)';
|
|
27
|
+
@Input() type: SourceBadgeType | string | null = null;
|
|
28
|
+
@Input() size?: SourceBadgeSizeValues | string = SourceBadgeSize.DEFAULT;
|
|
29
|
+
/**
|
|
30
|
+
* Custom class to be added to the badge.
|
|
31
|
+
*/
|
|
32
|
+
@Input() customClass?: string | string[];
|
|
33
|
+
/**
|
|
34
|
+
* 2 px border around the badge to increase visibility.
|
|
35
|
+
*/
|
|
36
|
+
@Input() borderColor? = 'var(--src-color-bg-default, #FFFFFF)';
|
|
37
|
+
/**
|
|
38
|
+
* It's not recommended to change the border width. If you're changing the width of the border, you should also change the size of the badge manually through scss.
|
|
39
|
+
* */
|
|
40
|
+
@Input() borderWidth? = '2px';
|
|
41
|
+
@Input() textColor? = 'var(--src-color-text-inverse, #FFFFFF)';
|
|
42
|
+
testID = input('', { alias: 'data-testid' });
|
|
43
|
+
|
|
44
|
+
classes: string[] = [];
|
|
45
|
+
|
|
46
|
+
ngOnInit() {
|
|
47
|
+
this.classes = [
|
|
48
|
+
this.type ? `src-badge--${this.type}` : '',
|
|
49
|
+
this.size && !this.type ? `src-badge--${this.size}` : '',
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
if (this.customClass) {
|
|
53
|
+
if (Array.isArray(this.customClass)) {
|
|
54
|
+
this.classes.forEach((customClass) => {
|
|
55
|
+
this.classes.push(customClass);
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
this.classes.push(this.customClass);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const SourceBadgeType = {
|
|
2
|
+
NEUTRAL: 'neutral',
|
|
3
|
+
INFORMATIONAL: 'informational',
|
|
4
|
+
SUCCESS: 'success',
|
|
5
|
+
WARNING: 'warning',
|
|
6
|
+
ATTENTION: 'attention',
|
|
7
|
+
CRITICAL: 'critical',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export type SourceBadgeType =
|
|
11
|
+
(typeof SourceBadgeType)[keyof typeof SourceBadgeType];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="src-banner"
|
|
3
|
+
[class.src-banner--compact]="isCompact()"
|
|
4
|
+
[ngClass]="type() !== 'default' ? 'src-banner--' + type() : ''"
|
|
5
|
+
[attr.data-testid]="testID"
|
|
6
|
+
>
|
|
7
|
+
<ng-content select="[srcIconPrefix]"></ng-content>
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
<ng-content select="[srcIconPostfix]"></ng-content>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// source-banner.component.scss
|
|
2
|
+
.src-banner {
|
|
3
|
+
--srcBannerPadding: 20px;
|
|
4
|
+
--srcBannerBackgroundColor: var(--src-color-bg-default-subdued, #f9fafb);
|
|
5
|
+
--srcBannerBorderWidth: 1px;
|
|
6
|
+
--srcBannerBorderColor: var(--src-color-border-default, #e5e7eb);
|
|
7
|
+
--srcBannerTextColor: var(--src-color-text-default, #1f2937);
|
|
8
|
+
--srcBannerIconColor: var(--src-color-icon-default, #6b7280);
|
|
9
|
+
--srcBannerBorderRadius: var(--src-br-small, 4px);
|
|
10
|
+
--srcBannerIconMargin: 16px;
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 8px;
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding: var(--srcBannerPadding, 20px);
|
|
15
|
+
border: var(--srcBannerBorderWidth) solid var(--srcBannerBorderColor, #fff);
|
|
16
|
+
border-radius: var(--srcBannerBorderRadius);
|
|
17
|
+
background: var(--srcBannerBackgroundColor);
|
|
18
|
+
color: var(--srcBannerTextColor);
|
|
19
|
+
font-size: var(--src-fs-base, 14px);
|
|
20
|
+
font-weight: normal;
|
|
21
|
+
line-height: var(--src-lh-base);
|
|
22
|
+
|
|
23
|
+
[srcIconPrefix] {
|
|
24
|
+
color: var(--srcBannerIconColor);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
p {
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--compact {
|
|
32
|
+
--srcBannerPadding: 16px;
|
|
33
|
+
--srcBannerIconMargin: 8px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--info {
|
|
37
|
+
--srcBannerBackgroundColor: #e8f0fd;
|
|
38
|
+
--srcBannerBorderColor: transparent;
|
|
39
|
+
--srcBannerIconColor: #2463bc;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--success {
|
|
43
|
+
--srcBannerBackgroundColor: var(--src-color-green-50);
|
|
44
|
+
--srcBannerBorderColor: var(--src-color-green-500);
|
|
45
|
+
--srcBannerIconColor: var(--src-color-green-500);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--critical {
|
|
49
|
+
--srcBannerBackgroundColor: var(--src-color-bg-critical-subdued);
|
|
50
|
+
--srcBannerBorderColor: var(--src-color-border-critical-strong);
|
|
51
|
+
--srcBannerIconColor: var(--src-color-icon-critical);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&--warning {
|
|
55
|
+
--srcBannerBackgroundColor: var(--src-color-yellow-50);
|
|
56
|
+
--srcBannerBorderColor: var(--src-color-yellow-700);
|
|
57
|
+
--srcBannerIconColor: var(--src-color-yellow-700);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.src-banner__icon {
|
|
62
|
+
margin-right: var(--srcBannerIconMargin, 8px);
|
|
63
|
+
color: var(--srcBannerIconColor);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.src-banner__close {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 16px;
|
|
69
|
+
right: 16px;
|
|
70
|
+
margin-left: auto;
|
|
71
|
+
|
|
72
|
+
button.src-icon-button {
|
|
73
|
+
--srcButtonBgColor: transparent;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
input,
|
|
5
|
+
ViewEncapsulation,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { NgClass } from '@angular/common';
|
|
8
|
+
import {
|
|
9
|
+
SourceBannerType,
|
|
10
|
+
SourceBannerTypeValues,
|
|
11
|
+
} from '../constants/sourceBannerType';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'src-banner',
|
|
15
|
+
templateUrl: './source-banner.component.html',
|
|
16
|
+
styleUrls: ['./source-banner.component.scss'],
|
|
17
|
+
imports: [NgClass],
|
|
18
|
+
encapsulation: ViewEncapsulation.None,
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
})
|
|
21
|
+
export class SourceBannerComponent {
|
|
22
|
+
type = input<SourceBannerTypeValues>(SourceBannerType.DEFAULT);
|
|
23
|
+
isCompact = input(false);
|
|
24
|
+
testID = input('', { alias: 'data-testid' });
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<button
|
|
2
|
+
[type]="type"
|
|
3
|
+
class="src-button"
|
|
4
|
+
[ngClass]="classes"
|
|
5
|
+
[attr.form]="formID"
|
|
6
|
+
(click)="handleClick($event)"
|
|
7
|
+
(submit)="handleSubmit($event)"
|
|
8
|
+
[disabled]="isDisabled"
|
|
9
|
+
[attr.data-testid]="testID()"
|
|
10
|
+
>
|
|
11
|
+
<span [style.opacity]="isLoading ? 0 : 1">
|
|
12
|
+
@if (iconPrefix) {
|
|
13
|
+
<span class="src-button__icon">
|
|
14
|
+
<ng-content select="[srcIconPrefix]"></ng-content>
|
|
15
|
+
</span>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
<ng-content></ng-content>
|
|
19
|
+
|
|
20
|
+
@if (hasDisclosure) {
|
|
21
|
+
<svg
|
|
22
|
+
class="disclosure-icon"
|
|
23
|
+
width="8"
|
|
24
|
+
height="5"
|
|
25
|
+
viewBox="0 0 8 5"
|
|
26
|
+
fill="none"
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
d="M3.40573 4.3L0.805725 1.7C0.489058 1.38333 0.418392 1.021 0.593725 0.613C0.768392 0.204333 1.08073 0 1.53073 0H6.68072C7.13072 0 7.44306 0.204333 7.61772 0.613C7.79306 1.021 7.72239 1.38333 7.40573 1.7L4.80572 4.3C4.70572 4.4 4.59739 4.475 4.48073 4.525C4.36406 4.575 4.23906 4.6 4.10573 4.6C3.97239 4.6 3.84739 4.575 3.73073 4.525C3.61406 4.475 3.50573 4.4 3.40573 4.3Z"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
}
|
|
35
|
+
</span>
|
|
36
|
+
@if (isLoading) {
|
|
37
|
+
<src-loading
|
|
38
|
+
[size]="16"
|
|
39
|
+
[progressStrokeColor]="'#6B7280'"
|
|
40
|
+
[strokeWidth]="2"
|
|
41
|
+
[data-testid]="testID() + '-loading-state'"
|
|
42
|
+
></src-loading>
|
|
43
|
+
}
|
|
44
|
+
</button>
|