-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
437 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"Export public api": { | ||
"scope": "typescript", | ||
"prefix": "et-expub", | ||
"body": ["export * from './public-api'"], | ||
"description": "Export public api" | ||
}, | ||
"Boolean input property": { | ||
"scope": "typescript", | ||
"prefix": "et-bool-prop", | ||
"body": [ | ||
" @Input()", | ||
" get ${1}(): boolean {", | ||
" return this._${1};", | ||
" }", | ||
" set ${1}(value: BooleanInput) {", | ||
" this._${1} = coerceBooleanProperty(value);", | ||
" }", | ||
" private _${1} = ${0:false};" | ||
], | ||
"description": "Add boolean input property" | ||
}, | ||
"Number input property": { | ||
"scope": "typescript", | ||
"prefix": "et-number-prop", | ||
"body": [ | ||
" @Input()", | ||
" get ${1}(): number {", | ||
" return this._${1};", | ||
" }", | ||
" set ${1}(value: NumberInput) {", | ||
" this._${1} = coerceNumberProperty(value);", | ||
" }", | ||
" private _${1} = ${0:0};" | ||
], | ||
"description": "Add number input property" | ||
}, | ||
"Destroy": { | ||
"scope": "typescript", | ||
"prefix": "et-destroy", | ||
"body": "private readonly _destroy$ = inject(DestroyService).destroy$" | ||
}, | ||
"Component": { | ||
"scope": "typescript", | ||
"prefix": "et-compoent", | ||
"body": [ | ||
"import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';", | ||
"", | ||
"@Component({", | ||
" selector: 'et-${1}',", | ||
" templateUrl: './${1}.component.html',", | ||
" styleUrls: ['./${1}.component.scss'],", | ||
" standalone: true,", | ||
" changeDetection: ChangeDetectionStrategy.OnPush,", | ||
" encapsulation: ViewEncapsulation.None,", | ||
" host: {", | ||
" class: 'et-${1}',", | ||
" },", | ||
"})", | ||
"export class ${0}Component {}" | ||
], | ||
"description": "Add component boilerplate" | ||
}, | ||
"HostDirective": { | ||
"scope": "typescript", | ||
"prefix": "et-host-directive", | ||
"body": [ | ||
"import { Directive } from '@angular/core';", | ||
"", | ||
"@Directive({", | ||
" standalone: true,", | ||
"})", | ||
"export class ${0}Directive {}" | ||
], | ||
"description": "Add host directive boilerplate" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './components/public-api'; | ||
export * from './directives/public-api'; |
1 change: 1 addition & 0 deletions
1
...nents/src/lib/components/checkbox/components/checkbox-group/checkbox-group.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ng-content /> |
Empty file.
35 changes: 35 additions & 0 deletions
35
...ponents/src/lib/components/checkbox/components/checkbox-group/checkbox-group.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
AfterContentInit, | ||
ChangeDetectionStrategy, | ||
Component, | ||
ContentChild, | ||
ContentChildren, | ||
QueryList, | ||
ViewEncapsulation, | ||
} from '@angular/core'; | ||
import { CheckboxGroupControlDirective, CHECKBOX_GROUP_CONTROL_TOKEN, CHECKBOX_TOKEN } from '../../directives'; | ||
import { CheckboxComponent } from '../checkbox'; | ||
|
||
@Component({ | ||
selector: 'et-checkbox-group', | ||
templateUrl: './checkbox-group.component.html', | ||
styleUrls: ['./checkbox-group.component.scss'], | ||
standalone: true, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, | ||
host: { | ||
class: 'et-checkbox-group', | ||
}, | ||
}) | ||
export class CheckboxGroupComponent implements AfterContentInit { | ||
@ContentChildren(CHECKBOX_TOKEN) | ||
checkboxes?: QueryList<CheckboxComponent>; | ||
|
||
@ContentChild(CHECKBOX_GROUP_CONTROL_TOKEN) | ||
groupControl?: CheckboxGroupControlDirective; | ||
|
||
ngAfterContentInit(): void { | ||
console.log(this.checkboxes); | ||
console.log(this.groupControl); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
libs/components/src/lib/components/checkbox/components/checkbox-group/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './public-api'; |
1 change: 1 addition & 0 deletions
1
libs/components/src/lib/components/checkbox/components/checkbox-group/public-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './checkbox-group.component'; |
15 changes: 15 additions & 0 deletions
15
libs/components/src/lib/components/checkbox/components/checkbox/checkbox.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<input | ||
[disabled]="checkbox.disabled" | ||
[id]="checkbox.id" | ||
[checked]="checkbox.checked" | ||
[indeterminate]="!checkbox.checked && checkbox.indeterminate" | ||
(change)="checkbox._onInputInteraction($event)" | ||
class="et-checkbox-native-input" | ||
type="checkbox" | ||
/> | ||
|
||
<div [ngClass]="{ 'et-checkbox-checked--active': checkbox.checked }" class="et-checkbox-checked"></div> | ||
<div | ||
[ngClass]="{ 'et-checkbox-indeterminate--active': !checkbox.checked && checkbox.indeterminate }" | ||
class="et-checkbox-indeterminate" | ||
></div> |
53 changes: 53 additions & 0 deletions
53
libs/components/src/lib/components/checkbox/components/checkbox/checkbox.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
:where(.et-checkbox) { | ||
--et-checkbox-size: 25px; | ||
--et-checkbox-checked-size: 10px; | ||
--et-checkbox-border-color: #e5e5e5; | ||
--et-checkbox-state-color: #e5e5e5; | ||
--et-checkbox-indeterminate-width: 10px; | ||
--et-checkbox-indeterminate-height: 2px; | ||
|
||
inline-size: var(--et-checkbox-size); | ||
block-size: var(--et-checkbox-size); | ||
border: 1px solid var(--et-checkbox-border-color); | ||
} | ||
|
||
:where(.et-checkbox-checked) { | ||
inline-size: var(--et-checkbox-checked-size); | ||
block-size: var(--et-checkbox-checked-size); | ||
|
||
&.et-checkbox-checked--active { | ||
background-color: var(--et-checkbox-state-color); | ||
} | ||
} | ||
|
||
:where(.et-checkbox-indeterminate) { | ||
inline-size: var(--et-checkbox-indeterminate-width); | ||
block-size: var(--et-checkbox-indeterminate-height); | ||
|
||
&.et-checkbox-indeterminate--active { | ||
background-color: var(--et-checkbox-state-color); | ||
} | ||
} | ||
|
||
.et-checkbox { | ||
position: relative; | ||
display: grid; | ||
align-items: center; | ||
justify-items: center; | ||
} | ||
|
||
.et-checkbox-native-input, | ||
.et-checkbox-checked, | ||
.et-checkbox-indeterminate { | ||
grid-area: 1 / 1 / 2 / 2; | ||
} | ||
|
||
.et-checkbox-native-input { | ||
z-index: 1; | ||
inline-size: var(--et-checkbox-size); | ||
block-size: var(--et-checkbox-size); | ||
cursor: pointer; | ||
opacity: 0; | ||
margin: 0; | ||
border: none; | ||
} |
Oops, something went wrong.