-
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: add LitElement based version of date-time-picker (#8089)
- Loading branch information
1 parent
b19451d
commit 194af49
Showing
31 changed files
with
248 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './vaadin-date-time-picker.js'; |
86 changes: 86 additions & 0 deletions
86
packages/date-time-picker/src/vaadin-lit-date-time-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,86 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2019 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import '@vaadin/date-picker/src/vaadin-lit-date-picker.js'; | ||
import '@vaadin/time-picker/src/vaadin-lit-time-picker.js'; | ||
import { css, html, LitElement } from 'lit'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js'; | ||
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { DateTimePickerMixin } from './vaadin-date-time-picker-mixin.js'; | ||
|
||
/** | ||
* LitElement based version of `<vaadin-date-time-picker>` web component. | ||
* | ||
* ## Disclaimer | ||
* | ||
* This component is an experiment and not yet a part of Vaadin platform. | ||
* There is no ETA regarding specific Vaadin version where it'll land. | ||
* Feel free to try this code in your apps as per Apache 2.0 license. | ||
*/ | ||
class DateTimePicker extends DateTimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) { | ||
static get is() { | ||
return 'vaadin-date-time-picker'; | ||
} | ||
|
||
static get styles() { | ||
return [ | ||
inputFieldShared, | ||
css` | ||
.vaadin-date-time-picker-container { | ||
--vaadin-field-default-width: auto; | ||
} | ||
.slots { | ||
display: flex; | ||
--vaadin-field-default-width: 12em; | ||
} | ||
.slots ::slotted([slot='date-picker']) { | ||
min-width: 0; | ||
flex: 1 1 auto; | ||
} | ||
.slots ::slotted([slot='time-picker']) { | ||
min-width: 0; | ||
flex: 1 1.65 auto; | ||
} | ||
`, | ||
]; | ||
} | ||
|
||
/** @protected */ | ||
render() { | ||
return html` | ||
<div class="vaadin-date-time-picker-container"> | ||
<div part="label" @click="${this.focus}"> | ||
<slot name="label"></slot> | ||
<span part="required-indicator" aria-hidden="true"></span> | ||
</div> | ||
<div class="slots"> | ||
<slot name="date-picker" id="dateSlot"></slot> | ||
<slot name="time-picker" id="timeSlot"></slot> | ||
</div> | ||
<div part="helper-text"> | ||
<slot name="helper"></slot> | ||
</div> | ||
<div part="error-message"> | ||
<slot name="error-message"></slot> | ||
</div> | ||
</div> | ||
<slot name="tooltip"></slot> | ||
`; | ||
} | ||
} | ||
|
||
defineCustomElement(DateTimePicker); | ||
|
||
export { DateTimePicker }; |
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 '../src/vaadin-lit-date-time-picker.js'; | ||
import './aria.common.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 '../src/vaadin-date-time-picker.js'; | ||
import './aria.common.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
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 '../src/vaadin-lit-date-time-picker.js'; | ||
import './basic.common.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 '../src/vaadin-date-time-picker.js'; | ||
import './basic.common.js'; |
Oops, something went wrong.