This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datepicker): Added datepicker component.
Fixes #894
- Loading branch information
1 parent
ccd282f
commit 9d2101c
Showing
19 changed files
with
1,326 additions
and
2 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
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
53 changes: 53 additions & 0 deletions
53
libs/barista-components/experimental/datepicker/src/calendar-body.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,53 @@ | ||
<span | ||
[attr.id]="_labelid" | ||
class="dt-calendar-body-header-label" | ||
aria-live="polite" | ||
>{{ _label }}</span | ||
> | ||
|
||
<table | ||
class="dt-calendar-table" | ||
role="grid" | ||
[attr.aria-labelledby]="ariaLabelledby || _labelid" | ||
[attr.aria-describedby]="ariaLabelledby || _labelid" | ||
> | ||
<thead class="dt-calendar-table-header"> | ||
<tr> | ||
<th | ||
scope="col" | ||
*ngFor="let day of _weekdays" | ||
[attr.aria-label]="day.long" | ||
[attr.abbr]="day.short" | ||
> | ||
{{ day.short }} | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody class="dt-calendar-table-body"> | ||
<tr | ||
*ngFor="let week of _weeks; let weekIndex = index" | ||
role="row" | ||
class="dt-calendar-table-row" | ||
> | ||
<td | ||
*ngIf="weekIndex === 0 && _firstRowOffset" | ||
aria-hidden="true" | ||
[attr.colspan]="_firstRowOffset" | ||
></td> | ||
<td | ||
*ngFor="let cell of week; let dateIndex = index" | ||
role="gridcell" | ||
class="dt-calendar-table-cell" | ||
[class.dt-calendar-active]="_isSame(cell, activeDate)" | ||
[class.dt-calendar-selected]="_isSame(cell, selected)" | ||
[attr.aria-selected]="_isSame(cell, selected)" | ||
[attr.aria-label]="cell.ariaLabel" | ||
(click)="_cellClicked(cell)" | ||
> | ||
<div class="dt-calendar-table-cell-inner"> | ||
{{ cell.displayValue }} | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
54 changes: 54 additions & 0 deletions
54
libs/barista-components/experimental/datepicker/src/calendar-body.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,54 @@ | ||
@import '../../../core/src/style/variables'; | ||
@import './calendar-body-theme'; | ||
|
||
:host { | ||
display: block; | ||
outline: none; | ||
} | ||
|
||
.dt-calendar-table { | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
width: 100%; | ||
} | ||
|
||
.dt-calendar-table-header th { | ||
text-align: center; | ||
padding: 0 0 8px; | ||
width: 14%; | ||
} | ||
|
||
.dt-calendar-table-cell { | ||
position: relative; | ||
text-align: center; | ||
outline: none; | ||
cursor: pointer; | ||
} | ||
|
||
.dt-calendar-table-cell:not(.dt-calendar-selected):hover | ||
.dt-calendar-table-cell-inner { | ||
background: $gray-200; | ||
} | ||
|
||
.dt-calendar-table-cell-inner { | ||
padding: 2px 0; | ||
border: 1px solid white; | ||
border-radius: 3px; | ||
} | ||
|
||
.dt-calendar-active .dt-calendar-table-cell-inner { | ||
border-color: $disabledcolor; | ||
} | ||
|
||
:host:focus .dt-calendar-active .dt-calendar-table-cell-inner { | ||
border-color: $turquoise-600; | ||
} | ||
|
||
.dt-calendar-selected .dt-calendar-table-cell-inner { | ||
background-color: $turquoise-600; | ||
color: white; | ||
} | ||
|
||
.dt-calendar-body-header-label { | ||
display: none; | ||
} |
Oops, something went wrong.