@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// source-logo-loading.component.scss
|
|
2
|
+
.src-logo-loading {
|
|
3
|
+
--srcLogoLoadingSize: 40px;
|
|
4
|
+
--srcLogoLoadingStroke: var(--color-brand-500, #016ef8);
|
|
5
|
+
width: var(--srcLogoLoadingSize);
|
|
6
|
+
height: var(--srcLogoLoadingSize);
|
|
7
|
+
|
|
8
|
+
svg {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
path {
|
|
14
|
+
stroke: var(--srcLogoLoadingStroke);
|
|
15
|
+
stroke-width: 1;
|
|
16
|
+
fill: none;
|
|
17
|
+
stroke-dasharray: 180;
|
|
18
|
+
stroke-dashoffset: 180;
|
|
19
|
+
animation: draw 3s linear infinite;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes draw {
|
|
24
|
+
0% {
|
|
25
|
+
stroke-dashoffset: 180;
|
|
26
|
+
}
|
|
27
|
+
50% {
|
|
28
|
+
stroke-dashoffset: 0;
|
|
29
|
+
}
|
|
30
|
+
100% {
|
|
31
|
+
stroke-dashoffset: 180;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgStyle } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
input,
|
|
6
|
+
ViewEncapsulation,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'src-logo-loading',
|
|
11
|
+
templateUrl: './source-logo-loading.component.html',
|
|
12
|
+
styleUrls: ['./source-logo-loading.component.scss'],
|
|
13
|
+
imports: [NgStyle],
|
|
14
|
+
encapsulation: ViewEncapsulation.None,
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
})
|
|
17
|
+
export class SourceLogoLoadingComponent {
|
|
18
|
+
size = input(32);
|
|
19
|
+
strokeColor = input('var(--src-color-brand-500)');
|
|
20
|
+
testID = input('', { alias: 'data-testid' });
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/source-logo-loading.component';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="src-slider"
|
|
3
|
+
[style.--srcSliderThumbSize.px]="thumbSize"
|
|
4
|
+
[style.--srcSliderTrackHeight.px]="trackHeight"
|
|
5
|
+
[class.src-slider--disabled]="isDisabled"
|
|
6
|
+
[class.src-slider--vertical]="orientation === 'vertical'"
|
|
7
|
+
[attr.data-testid]="testID()"
|
|
8
|
+
>
|
|
9
|
+
<input
|
|
10
|
+
type="range"
|
|
11
|
+
class="src-slider__input"
|
|
12
|
+
[id]="id"
|
|
13
|
+
[min]="min"
|
|
14
|
+
[max]="max"
|
|
15
|
+
[step]="step"
|
|
16
|
+
[disabled]="isDisabled"
|
|
17
|
+
[value]="value"
|
|
18
|
+
[attr.data-testid]="testID() + '-input'"
|
|
19
|
+
(change)="change($event)"
|
|
20
|
+
(input)="input($event)"
|
|
21
|
+
/>
|
|
22
|
+
<div
|
|
23
|
+
class="src-slider__filled-track"
|
|
24
|
+
[style.width]="calculateFilledWidth()"
|
|
25
|
+
></div>
|
|
26
|
+
|
|
27
|
+
<div class="src-slider__thumb" [style.left]="calculateThumbPosition()">
|
|
28
|
+
<ng-content select="[srcIconThumb]"></ng-content>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
@if (showTicks) {
|
|
32
|
+
<div class="src-slider__ticks-container">
|
|
33
|
+
@for (tick of tickPositions; track tick) {
|
|
34
|
+
<div class="tick" [style.left]="tick"></div>
|
|
35
|
+
}
|
|
36
|
+
</div>
|
|
37
|
+
}
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// source-slider.component.scss
|
|
2
|
+
.src-slider {
|
|
3
|
+
position: relative;
|
|
4
|
+
--srcSliderThumbBackground: #fff;
|
|
5
|
+
--srcSliderThumbShadow:
|
|
6
|
+
0 0 0 2px #abb2be, 0 2px 0 2px #e6e7e7, 0 0 0 4px #fff;
|
|
7
|
+
--srcSliderThumbIconColor: var(--src-color-icon-default);
|
|
8
|
+
--srcSliderClickableTrackHeight: var(--srcSliderThumbSize);
|
|
9
|
+
--srcSliderTrackShape: 0px;
|
|
10
|
+
--srcSliderTrackBg: var(--src-color-border-default, #e5e7eb);
|
|
11
|
+
--srcSliderTrackFilledBg: transparent;
|
|
12
|
+
--srcSliderTickBg: var(--src-color-border-default, #e5e7eb);
|
|
13
|
+
--srcSliderTickWidth: 2px;
|
|
14
|
+
--srcSliderTickHeight: 10px;
|
|
15
|
+
--srcSliderTickShape: 50%;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
|
|
19
|
+
&--vertical {
|
|
20
|
+
//
|
|
21
|
+
// transform: rotate(-90deg);
|
|
22
|
+
// transform-origin: left bottom;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--disabled {
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
--srcSliderThumbShadow: 0 0 0 2px #d1d5db, 0 0 0 4px #fff;
|
|
28
|
+
--srcSliderTrackBg: #f1f2f3;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
--srcSliderThumbShadow:
|
|
33
|
+
0 0 0 2px #6b7280, 0 2px 0 2px #e6e7e7, 0 0 0 4px #fff;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input.src-slider__input {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: var(--srcSliderClickableTrackHeight);
|
|
39
|
+
appearance: none;
|
|
40
|
+
background: transparent;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
&::-webkit-slider-thumb {
|
|
44
|
+
-webkit-appearance: none;
|
|
45
|
+
width: 0;
|
|
46
|
+
height: 0;
|
|
47
|
+
border: 0;
|
|
48
|
+
background: transparent;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&::-moz-range-thumb {
|
|
52
|
+
width: 0;
|
|
53
|
+
height: 0;
|
|
54
|
+
border: 0;
|
|
55
|
+
background: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&::-webkit-slider-runnable-track {
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: var(--srcSliderTrackHeight);
|
|
61
|
+
background: var(--srcSliderTrackBg);
|
|
62
|
+
border-radius: var(--srcSliderTrackShape);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&::-moz-range-track {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: var(--srcSliderTrackHeight);
|
|
68
|
+
background: var(--srcSliderTrackBg);
|
|
69
|
+
border-radius: var(--srcSliderTrackShape);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&::-ms-fill-lower {
|
|
73
|
+
background: var(--srcSliderTrackFilledBg);
|
|
74
|
+
border-radius: var(--srcSliderTrackShape);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.src-slider__thumb {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 50%;
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
background: var(--srcSliderThumbBackground);
|
|
84
|
+
transform: translate(-50%, -50%);
|
|
85
|
+
width: var(--srcSliderThumbSize);
|
|
86
|
+
height: var(--srcSliderThumbSize);
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
color: var(--srcSliderThumbIconColor);
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
box-shadow: var(--srcSliderThumbShadow);
|
|
94
|
+
z-index: 1;
|
|
95
|
+
transition: all 0.35s ease;
|
|
96
|
+
|
|
97
|
+
& > [srcIconThumb] {
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 100%;
|
|
100
|
+
object-fit: contain;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.src-slider__filled-track {
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: 50%;
|
|
108
|
+
height: var(--srcSliderTrackHeight);
|
|
109
|
+
background: var(--srcSliderTrackFilledBg);
|
|
110
|
+
border-radius: var(--srcSliderTrackShape);
|
|
111
|
+
left: 0;
|
|
112
|
+
transform: translateY(-50%);
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.src-slider__ticks-container {
|
|
117
|
+
width: 100%;
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: 50%;
|
|
120
|
+
height: 0;
|
|
121
|
+
|
|
122
|
+
.tick {
|
|
123
|
+
width: var(--srcSliderTickWidth);
|
|
124
|
+
height: var(--srcSliderTickHeight);
|
|
125
|
+
transform: translate(-50%, -50%);
|
|
126
|
+
position: absolute;
|
|
127
|
+
background: var(--srcSliderTickBg);
|
|
128
|
+
border-radius: var(--srcSliderTickShape);
|
|
129
|
+
top: 0;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterViewInit,
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
Input,
|
|
7
|
+
Output,
|
|
8
|
+
input,
|
|
9
|
+
ViewEncapsulation,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'src-slider',
|
|
14
|
+
templateUrl: './source-slider.component.html',
|
|
15
|
+
styleUrls: ['./source-slider.component.scss'],
|
|
16
|
+
encapsulation: ViewEncapsulation.None,
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
})
|
|
19
|
+
export class SourceSliderComponent implements AfterViewInit {
|
|
20
|
+
/**
|
|
21
|
+
* id of input to connect label and input[type=range]
|
|
22
|
+
*/
|
|
23
|
+
@Input() id?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The minimum value of the slider
|
|
26
|
+
*/
|
|
27
|
+
@Input() min!: number;
|
|
28
|
+
/**
|
|
29
|
+
* The maximum value of the slider
|
|
30
|
+
*/
|
|
31
|
+
@Input() max!: number;
|
|
32
|
+
/**
|
|
33
|
+
* The size of the thumb
|
|
34
|
+
*/
|
|
35
|
+
@Input() thumbSize = 12;
|
|
36
|
+
/**
|
|
37
|
+
* The height of the visual track. Height of the input won't be affected
|
|
38
|
+
*/
|
|
39
|
+
@Input() trackHeight = 2;
|
|
40
|
+
/**
|
|
41
|
+
* The step length of the slider
|
|
42
|
+
*/
|
|
43
|
+
@Input() step = 1;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to show the ticks on each step
|
|
46
|
+
*/
|
|
47
|
+
@Input() showTicks = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* If slider is disabled
|
|
51
|
+
*/
|
|
52
|
+
@Input() isDisabled = false;
|
|
53
|
+
/**
|
|
54
|
+
* Slider orientation - WIP
|
|
55
|
+
*/
|
|
56
|
+
@Input() orientation: 'horizontal' | 'vertical' = 'horizontal';
|
|
57
|
+
|
|
58
|
+
tickPositions: string[] = [];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The value of the slider
|
|
62
|
+
*/
|
|
63
|
+
@Input() value!: number;
|
|
64
|
+
/**
|
|
65
|
+
* Test ID for the component. Provide descriptive uniq id in kebab-case.
|
|
66
|
+
*/
|
|
67
|
+
testID = input('', { alias: 'data-testid' });
|
|
68
|
+
/**
|
|
69
|
+
* Emits the value of the slider when it changes
|
|
70
|
+
*/
|
|
71
|
+
@Output() onChange = new EventEmitter<number>();
|
|
72
|
+
@Output() onInput = new EventEmitter<number>();
|
|
73
|
+
|
|
74
|
+
ngAfterViewInit() {
|
|
75
|
+
if (this.showTicks) {
|
|
76
|
+
this.calculateTickPositions();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
input(valueEvent: Event) {
|
|
81
|
+
if (valueEvent.target instanceof HTMLInputElement) {
|
|
82
|
+
this.onInput.emit(this.getValue(valueEvent.target));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
change(valueEvent: Event) {
|
|
87
|
+
if (valueEvent.target instanceof HTMLInputElement) {
|
|
88
|
+
this.onChange.emit(this.getValue(valueEvent.target));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
calculateThumbPosition(): string {
|
|
93
|
+
const percent = ((this.value - this.min) * 100) / (this.max - this.min);
|
|
94
|
+
return isNaN(percent) ? '0%' : `${percent}%`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
calculateFilledWidth(): string {
|
|
98
|
+
const percent = ((this.value - this.min) / (this.max - this.min)) * 100;
|
|
99
|
+
return isNaN(percent) ? '0%' : `${percent}%`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private getValue(value: HTMLInputElement) {
|
|
103
|
+
const newValue = value.valueAsNumber;
|
|
104
|
+
const steppedValue = Math.round(newValue / this.step) * this.step;
|
|
105
|
+
this.value = Math.min(Math.max(steppedValue, this.min), this.max);
|
|
106
|
+
|
|
107
|
+
return newValue;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private calculateTickPositions() {
|
|
111
|
+
const numberOfTicks = (this.max - this.min) / this.step;
|
|
112
|
+
|
|
113
|
+
this.tickPositions = Array.from(
|
|
114
|
+
{ length: numberOfTicks + 1 },
|
|
115
|
+
(_, index) => {
|
|
116
|
+
const percent = (index / numberOfTicks) * 100;
|
|
117
|
+
|
|
118
|
+
return isNaN(percent) ? '0%' : `${percent}%`;
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/source-slider.component';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// SourceUI Global Styles: base.scss
|
|
2
|
+
// TODO: get rid of tags, subscitute them with classes
|
|
3
|
+
|
|
4
|
+
.section_3dsourcecom,
|
|
5
|
+
.cdk-overlay-container {
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
|
|
9
|
+
*,
|
|
10
|
+
*::before,
|
|
11
|
+
*::after {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
-webkit-tap-highlight-color: transparent;
|
|
14
|
+
font-family: var(--src-font-family-sans);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
code {
|
|
18
|
+
font-family: monospace;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// NEVER use user-select: none for ALL page!
|
|
22
|
+
// * {
|
|
23
|
+
// user-select: none;
|
|
24
|
+
// }
|
|
25
|
+
button {
|
|
26
|
+
// safari adds unwanted margin-top and margin-bottom
|
|
27
|
+
margin: 0;
|
|
28
|
+
font-family: var(--src-font-family-sans);
|
|
29
|
+
border: none;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
&:focus {
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.src-select,
|
|
38
|
+
select,
|
|
39
|
+
.src-input,
|
|
40
|
+
input,
|
|
41
|
+
.src-textarea,
|
|
42
|
+
textarea {
|
|
43
|
+
// safari adds unwanted margin-top and margin-bottom
|
|
44
|
+
margin: 0;
|
|
45
|
+
|
|
46
|
+
&:focus-visible,
|
|
47
|
+
&:focus {
|
|
48
|
+
outline: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// accent-color property is available only for some inputs and progress
|
|
53
|
+
input[type='checkbox'],
|
|
54
|
+
input[type='radio'],
|
|
55
|
+
input [type='range'],
|
|
56
|
+
progress {
|
|
57
|
+
accent-color: var(--src-color-brand-500);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
table,
|
|
61
|
+
.src-table {
|
|
62
|
+
border-spacing: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
p {
|
|
66
|
+
margin-top: 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// source-button.component.scss
|
|
2
|
+
.src-button {
|
|
3
|
+
--srcButtonBgColor: var(--src-color-bg-default, #fff);
|
|
4
|
+
--srcButtonBgHoverColor: var(--src-color-bg-default-hover, #f1f2f3);
|
|
5
|
+
--srcButtonBorderRadius: var(--src-br-small, 4px);
|
|
6
|
+
--srcButtonBoxShadow:
|
|
7
|
+
0px 0px 0px 1px var(--src-color-border-strong, #abb2be) inset,
|
|
8
|
+
0px 1px 0px 0px rgba(0, 0, 0, 0.05);
|
|
9
|
+
--srcButtonFontColor: var(--src-color-text-default);
|
|
10
|
+
--srcButtonFontSize: var(--src-fs-base, 16px);
|
|
11
|
+
--srcButtonFontWeight: var(--src-fw-medium, 500);
|
|
12
|
+
--srcButtonLineHeight: var(--src-lh-base, 20px);
|
|
13
|
+
--srcButtonPaddings: 8px 16px;
|
|
14
|
+
--srcButtonTextTransform: default;
|
|
15
|
+
--srcButtonWidth: auto;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
width: var(--srcButtonWidth);
|
|
20
|
+
padding: var(--srcButtonPaddings);
|
|
21
|
+
font-weight: var(--srcButtonFontWeight);
|
|
22
|
+
font-size: var(--srcButtonFontSize);
|
|
23
|
+
font-style: normal;
|
|
24
|
+
line-height: var(--srcButtonLineHeight);
|
|
25
|
+
text-align: center;
|
|
26
|
+
color: var(--srcButtonFontColor);
|
|
27
|
+
text-transform: var(--srcButtonTextTransform);
|
|
28
|
+
letter-spacing: 0;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
background-color: var(--srcButtonBgColor);
|
|
31
|
+
border: none;
|
|
32
|
+
border-radius: var(--srcButtonBorderRadius);
|
|
33
|
+
box-shadow: var(--srcButtonBoxShadow);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
|
|
36
|
+
& > div,
|
|
37
|
+
& > span {
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:active,
|
|
45
|
+
&--pressed {
|
|
46
|
+
background-color: var(--srcButtonBgHoverColor);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (pointer: fine) {
|
|
50
|
+
&:hover,
|
|
51
|
+
&:focus-visible {
|
|
52
|
+
background-color: var(--srcButtonBgHoverColor);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:disabled,
|
|
57
|
+
&[disabled],
|
|
58
|
+
&.disabled {
|
|
59
|
+
cursor: default;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// size
|
|
64
|
+
&--slim {
|
|
65
|
+
--srcButtonPaddings: 6px 12px;
|
|
66
|
+
|
|
67
|
+
&.src-button--icon-prefix {
|
|
68
|
+
--srcButtonPaddings: 6px 12px 6px 8px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--medium {
|
|
73
|
+
--srcButtonPaddings: 8px 16px;
|
|
74
|
+
|
|
75
|
+
&.src-button--icon-prefix {
|
|
76
|
+
--srcButtonPaddings: 8px 16px 8px 12px;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&--large {
|
|
81
|
+
--srcButtonPaddings: 12px 24px;
|
|
82
|
+
|
|
83
|
+
&.src-button--icon-prefix {
|
|
84
|
+
--srcButtonPaddings: 12px 24px 12px 20px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&--primary {
|
|
89
|
+
--srcButtonBgColor: var(--src-color-bg-primary);
|
|
90
|
+
--srcButtonBgHoverColor: var(--src-color-bg-primary-hover);
|
|
91
|
+
--srcButtonBoxShadow:
|
|
92
|
+
0px 1px 0px 0px rgba(0, 0, 0, 0.08),
|
|
93
|
+
0px -1px 0px 0px rgba(0, 0, 0, 0.2) inset;
|
|
94
|
+
--srcButtonFontColor: var(--src-color-text-inverse, #fff);
|
|
95
|
+
|
|
96
|
+
&:disabled,
|
|
97
|
+
&[disabled] {
|
|
98
|
+
--srcButtonBgColor: var(--src-color-bg-primary-disabled);
|
|
99
|
+
--srcButtonBoxShadow: none;
|
|
100
|
+
--srcButtonFontColor: var(--src-color-text-default-disabled);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--secondary {
|
|
105
|
+
--srcButtonFontColor: var(--src-color-text-default);
|
|
106
|
+
|
|
107
|
+
&:disabled,
|
|
108
|
+
&[disabled] {
|
|
109
|
+
--srcButtonBgColor: var(--src-color-bg-default-disabled);
|
|
110
|
+
--srcButtonBoxShadow: none;
|
|
111
|
+
--srcButtonFontColor: var(--src-color-text-default-disabled);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&--destructive {
|
|
116
|
+
--srcButtonBgColor: var(--src-color-bg-critical);
|
|
117
|
+
--srcButtonBgHoverColor: var(--src-color-bg-critical-strong);
|
|
118
|
+
--srcButtonBoxShadow:
|
|
119
|
+
0px 1px 0px 0px rgba(0, 0, 0, 0.08),
|
|
120
|
+
0px -1px 0px 0px rgba(0, 0, 0, 0.2) inset;
|
|
121
|
+
--srcButtonFontColor: var(--src-color-text-inverse, #fff);
|
|
122
|
+
|
|
123
|
+
&:disabled,
|
|
124
|
+
&[disabled] {
|
|
125
|
+
--srcButtonBgColor: var(--src-color-bg-primary-disabled);
|
|
126
|
+
--srcButtonBoxShadow: none;
|
|
127
|
+
--srcButtonFontColor: var(--src-color-text-default-disabled);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&--plain {
|
|
132
|
+
padding: 0;
|
|
133
|
+
--srcButtonBgColor: transparent;
|
|
134
|
+
--srcButtonBgHoverColor: transparent;
|
|
135
|
+
--srcButtonBoxShadow: none;
|
|
136
|
+
|
|
137
|
+
&:active,
|
|
138
|
+
&.src-button--pressed {
|
|
139
|
+
text-decoration: underline;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media (pointer: fine) {
|
|
143
|
+
&:hover,
|
|
144
|
+
&:focus {
|
|
145
|
+
text-decoration: underline;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
&:disabled,
|
|
149
|
+
&[disabled] {
|
|
150
|
+
--srcButtonFontColor: var(--src-color-text-default-disabled);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//colorScheme
|
|
154
|
+
&.src-button--primary {
|
|
155
|
+
--srcButtonFontColor: var(--src-color-text-primary);
|
|
156
|
+
|
|
157
|
+
&:active,
|
|
158
|
+
&--pressed {
|
|
159
|
+
--srcButtonFontColor: var(--src-color-text-primary);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@media (pointer: fine) {
|
|
163
|
+
&:hover,
|
|
164
|
+
&:focus {
|
|
165
|
+
--srcButtonFontColor: var(--src-color-text-primary);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&.src-button--destructive {
|
|
171
|
+
--srcButtonFontColor: var(--src-color-text-critical);
|
|
172
|
+
|
|
173
|
+
&:active,
|
|
174
|
+
&--pressed {
|
|
175
|
+
--srcButtonFontColor: var(--src-color-text-critical);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@media (pointer: fine) {
|
|
179
|
+
&:hover,
|
|
180
|
+
&:focus {
|
|
181
|
+
--srcButtonFontColor: var(--src-color-text-critical);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.src-button--secondary {
|
|
187
|
+
--srcButtonFontColor: var(--src-color-text-default);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&.src-button--primary,
|
|
191
|
+
&.src-button--destructive,
|
|
192
|
+
&.src-button--secondary {
|
|
193
|
+
&:disabled,
|
|
194
|
+
&[disabled] {
|
|
195
|
+
--srcButtonBgColor: transparent;
|
|
196
|
+
--srcButtonFontColor: var(--src-color-text-default-disabled);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// full-width
|
|
202
|
+
&--full-width {
|
|
203
|
+
--srcButtonWidth: 100%;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&--icon-button {
|
|
207
|
+
--srcButtonIconColor: var(--src-color-icon-default);
|
|
208
|
+
|
|
209
|
+
.icon {
|
|
210
|
+
flex-shrink: 0;
|
|
211
|
+
color: var(--srcButtonIconColor);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.src-button--primary,
|
|
215
|
+
&.src-button--destructive {
|
|
216
|
+
--srcButtonIconColor: var(--src-color-text-inverse);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&.src-button--secondary {
|
|
220
|
+
--srcButtonIconColor: var(--src-color-icon-default);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&.src-button--slim {
|
|
224
|
+
--srcButtonPaddings: 6px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&.src-button--medium {
|
|
228
|
+
--srcButtonPaddings: 8px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&.src-button--large {
|
|
232
|
+
--srcButtonPaddings: 12px;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|