Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class CopyToClipboardComponent {
public readonly value =
input.required<HTMLCgCopyToClipboardElement['value']>();

public readonly type = input<HTMLCgCopyToClipboardElement['type']>();

constructor(
private readonly ngZone: NgZone,
private readonly elementRef: ElementRef<HTMLCgCopyToClipboardElement>,
Expand All @@ -31,5 +33,17 @@ export class CopyToClipboardComponent {
this.elementRef.nativeElement.value = value;
});
});

effect(() => {
const type = this.type();
// [TODO]: use `isNil` from `@cg/utils` package
if (!type) {
return;
}

this.ngZone.runOutsideAngular(() => {
this.elementRef.nativeElement.type = type;
});
});
}
}
1 change: 1 addition & 0 deletions lib/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@forward 'common/dropdown';
@forward 'common/effects';
@forward 'common/elevation';
@forward 'common/forms';
@forward 'common/icons';
@forward 'common/responsiveness';
@forward 'common/sizing';
Expand Down
40 changes: 40 additions & 0 deletions lib/styles/common/forms.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@use 'sizing';
@use 'colors';
@use 'dark-mode';
@use 'effects';

@mixin input-common {
display: block;
width: 100%;

border-radius: sizing.$border-sm-radius;
border: sizing.$border-md-size solid colors.$slate-400;
padding: sizing.size(2.5);

font-size: 0.875rem;
line-height: 1.25rem;

color: colors.$slate-900;
background-color: colors.$white;
outline: none;

&:focus {
border-color: colors.$primary;
@include effects.ring(colors.$primary-400);

@include dark-mode.dark {
@include effects.ring(colors.$primary-800);
}
}

@include dark-mode.dark {
color: colors.$slate-200;
background-color: colors.$slate-950;
border-color: colors.$slate-500;
}
}

@mixin text-area {
height: sizing.size(24);
resize: vertical;
}
55 changes: 25 additions & 30 deletions lib/styles/global/buttons.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
@use '../common/colors';
@use '../common/dark-mode';
@use '../common/effects';
@use '../common/icons';
@use '../common/sizing';
@use '../common/utils';
@use '../common';

$btn-color: colors.$primary;
$bn-hover-color: colors.$primary-600;
$btn-disabled-color: rgba(colors.$primary, 0.45);
$btn-color: common.$primary;
$bn-hover-color: common.$primary-600;
$btn-disabled-color: rgba(common.$primary, 0.45);

.btn {
@include sizing.px(4);
@include sizing.py(1);
@include utils.no-underline;
@include common.px(4);
@include common.py(1);
@include common.no-underline;

border: sizing.$border-md-size solid transparent;
border-radius: sizing.$border-sm-radius;
border: common.$border-md-size solid transparent;
border-radius: common.$border-sm-radius;
outline: none;

color: colors.$white;
color: common.$white;
background-color: $btn-color;
position: relative;

Expand All @@ -28,10 +23,10 @@ $btn-disabled-color: rgba(colors.$primary, 0.45);
}

&:focus:not(:disabled) {
@include effects.ring(colors.$primary-400);
@include common.ring(common.$primary-400);

@include dark-mode.dark {
@include effects.ring(colors.$primary-800);
@include common.dark {
@include common.ring(common.$primary-800);
}
}

Expand All @@ -50,7 +45,7 @@ $btn-disabled-color: rgba(colors.$primary, 0.45);
background-color: transparent;

&:hover:not(:disabled) {
color: colors.$white;
color: common.$white;
}

&:disabled {
Expand All @@ -60,22 +55,22 @@ $btn-disabled-color: rgba(colors.$primary, 0.45);
}

&.btn--success {
color: colors.$success;
border-color: colors.$success;
color: common.$success;
border-color: common.$success;

&:hover:not(:disabled) {
background-color: colors.$success;
border-color: colors.$success;
background-color: common.$success;
border-color: common.$success;
}
}

&.btn--error {
color: colors.$error;
border-color: colors.$error;
color: common.$error;
border-color: common.$error;

&:hover:not(:disabled) {
background-color: colors.$error;
border-color: colors.$error;
background-color: common.$error;
border-color: common.$error;
}
}
}
Expand All @@ -85,17 +80,17 @@ $btn-disabled-color: rgba(colors.$primary, 0.45);
flex-direction: row;
justify-content: end;
align-items: center;
margin-top: sizing.size(4);
margin-top: common.size(4);

> :not(:last-child) {
margin-right: sizing.size(2);
margin-right: common.size(2);
}
}

.btn--loading {
position: absolute;
left: 50%;
top: 50%;
@include icons.icon-xxl;
@include common.icon-xxl;
transform: translate(-50%, -50%);
}
49 changes: 9 additions & 40 deletions lib/styles/global/forms.scss
Original file line number Diff line number Diff line change
@@ -1,58 +1,27 @@
@use '../common/colors';
@use '../common/dark-mode';
@use '../common/effects';
@use '../common/sizing';
@use '../common';

.input {
display: block;
width: 100%;

border-radius: sizing.$border-sm-radius;
border: sizing.$border-md-size solid colors.$slate-400;
padding: sizing.size(2.5);

font-size: 0.875rem;
line-height: 1.25rem;

color: colors.$slate-900;
background-color: colors.$white;
outline: none;

&:focus {
border-color: colors.$primary;
@include effects.ring(colors.$primary-400);

@include dark-mode.dark {
@include effects.ring(colors.$primary-800);
}
}

@include dark-mode.dark {
color: colors.$slate-200;
background-color: colors.$slate-950;
border-color: colors.$slate-500;
}
@include common.input-common;
}

.input--invalid {
border-color: colors.$error;
border-color: common.$error;

&:focus {
border-color: colors.$error;
border-color: common.$error;

@include effects.ring(colors.$error);
@include common.ring(common.$error);
}
}

.input--textarea {
height: sizing.size(24);
resize: vertical;
@include common.text-area;
}

.label {
color: colors.$black;
color: common.$black;

@include dark-mode.dark {
color: colors.$white;
@include common.dark {
color: common.$white;
}
}
14 changes: 7 additions & 7 deletions lib/styles/global/icons.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../common/icons';
@use '../common';

.icon {
width: 100%;
Expand All @@ -8,25 +8,25 @@
}

.icon-xs {
@include icons.icon-xs;
@include common.icon-xs;
}

.icon-sm {
@include icons.icon-sm;
@include common.icon-sm;
}

.icon-md {
@include icons.icon-md;
@include common.icon-md;
}

.icon-lg {
@include icons.icon-lg;
@include common.icon-lg;
}

.icon-xl {
@include icons.icon-xl;
@include common.icon-xl;
}

.icon-xxl {
@include icons.icon-xxl;
@include common.icon-xxl;
}
7 changes: 3 additions & 4 deletions lib/styles/global/overlays.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
@use '../common/colors';
@use '../common/elevation';
@use '../common';

.backdrop {
@include elevation.layer-40;
@include common.layer-40;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(colors.$slate-800, 0.8);
background-color: rgba(common.$slate-800, 0.8);
}
Loading
Loading