-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experiment: prepare LitElement based date-picker for publishing (#6801)
- Loading branch information
1 parent
1fd0e1d
commit f36824c
Showing
13 changed files
with
99 additions
and
31 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,35 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
|
||
/** | ||
* @polymerMixin | ||
*/ | ||
export const DatePickerYearMixin = (superClass) => | ||
class DatePickerYearMixin extends superClass { | ||
static get properties() { | ||
return { | ||
year: { | ||
type: String, | ||
sync: true, | ||
}, | ||
|
||
selectedDate: { | ||
type: Object, | ||
sync: true, | ||
}, | ||
}; | ||
} | ||
|
||
static get observers() { | ||
return ['__updateSelected(year, selectedDate)']; | ||
} | ||
|
||
/** @private */ | ||
__updateSelected(year, selectedDate) { | ||
this.toggleAttribute('selected', selectedDate && selectedDate.getFullYear() === year); | ||
this.toggleAttribute('current', year === new Date().getFullYear()); | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { css, html, LitElement } from 'lit'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { DatePickerYearMixin } from './vaadin-date-picker-year-mixin.js'; | ||
|
||
/** | ||
* @extends HTMLElement | ||
* @mixes ThemableMixin | ||
* @mixes DatePickerYearMixin | ||
* @private | ||
*/ | ||
export class DatePickerYear extends ThemableMixin(DatePickerYearMixin(PolylitMixin(LitElement))) { | ||
static get is() { | ||
return 'vaadin-date-picker-year'; | ||
} | ||
|
||
static get styles() { | ||
return css` | ||
:host { | ||
display: block; | ||
height: 100%; | ||
} | ||
`; | ||
} | ||
|
||
/** @protected */ | ||
render() { | ||
return html` | ||
<div part="year-number">${this.year}</div> | ||
<div part="year-separator" aria-hidden="true"></div> | ||
`; | ||
} | ||
} | ||
|
||
defineCustomElement(DatePickerYear); |
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,5 @@ | ||
import './vaadin-date-picker-overlay-styles.js'; | ||
import './vaadin-date-picker-overlay-content-styles.js'; | ||
import './vaadin-month-calendar-styles.js'; | ||
import './vaadin-date-picker-styles.js'; | ||
import '../../src/vaadin-lit-date-picker.js'; |
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
5 changes: 5 additions & 0 deletions
5
packages/date-picker/theme/material/vaadin-lit-date-picker.js
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,5 @@ | ||
import './vaadin-date-picker-overlay-styles.js'; | ||
import './vaadin-date-picker-overlay-content-styles.js'; | ||
import './vaadin-month-calendar-styles.js'; | ||
import './vaadin-date-picker-styles.js'; | ||
import '../../src/vaadin-lit-date-picker.js'; |
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 './src/vaadin-date-picker-light.js'; |
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,2 @@ | ||
import './theme/lumo/vaadin-lit-date-picker-light.js'; | ||
export * from './src/vaadin-lit-date-picker-light.js'; |
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 './src/vaadin-date-picker.js'; |
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,2 @@ | ||
import './theme/lumo/vaadin-lit-date-picker.js'; | ||
export * from './src/vaadin-lit-date-picker.js'; |