Skip to content

Commit

Permalink
Replace dom-module with registerStyles [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 16, 2020
1 parent 9e2c874 commit ab5a89b
Show file tree
Hide file tree
Showing 15 changed files with 803 additions and 826 deletions.
77 changes: 37 additions & 40 deletions src/vaadin-date-picker-styles.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
import '@polymer/polymer/lib/elements/custom-style.js';
const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = `<dom-module id="vaadin-date-picker-overlay-styles" theme-for="vaadin-date-picker-overlay">
<template>
<style>
:host {
align-items: flex-start;
justify-content: flex-start;
}
:host([bottom-aligned]) {
justify-content: flex-end;
}
:host([right-aligned]) {
align-items: flex-end;
}
:host([dir="rtl"]) {
align-items: flex-end;
}
:host([dir="rtl"][right-aligned]) {
align-items: flex-start;
}
[part="overlay"] {
display: flex;
flex: auto;
}
[part~="content"] {
flex: auto;
}
</style>
</template>
</dom-module>`;

document.head.appendChild($_documentContainer.content);
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';

registerStyles(
'vaadin-date-picker-overlay',
css`
:host {
align-items: flex-start;
justify-content: flex-start;
}
:host([bottom-aligned]) {
justify-content: flex-end;
}
:host([right-aligned]) {
align-items: flex-end;
}
:host([dir='rtl']) {
align-items: flex-end;
}
:host([dir='rtl'][right-aligned]) {
align-items: flex-start;
}
[part='overlay'] {
display: flex;
flex: auto;
}
[part~='content'] {
flex: auto;
}
`,
{ moduleId: 'vaadin-date-picker-overlay-styles' }
);
70 changes: 34 additions & 36 deletions src/vaadin-date-picker-text-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,46 @@ Copyright (c) 2019 Vaadin Ltd.
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { TextFieldElement } from '@vaadin/vaadin-text-field/src/vaadin-text-field.js';
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';

const $_documentContainer = document.createElement('template');
registerStyles(
'vaadin-date-picker-text-field',
css`
:host([dir='rtl']) [part='input-field'] {
direction: ltr;
}
$_documentContainer.innerHTML = `<dom-module id="vaadin-date-picker-text-field-styles" theme-for="vaadin-date-picker-text-field">
<template>
<style>
:host([dir="rtl"]) [part="input-field"] {
direction: ltr;
}
:host([dir='rtl']) [part='value']::placeholder {
direction: rtl;
text-align: left;
}
:host([dir="rtl"]) [part="value"]::placeholder {
direction: rtl;
text-align: left;
}
:host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
direction: rtl;
text-align: left;
}
:host([dir="rtl"]) [part="input-field"] ::slotted(input)::placeholder {
direction: rtl;
text-align: left;
}
:host([dir='rtl']) [part='value']:-ms-input-placeholder,
:host([dir='rtl']) [part='input-field'] ::slotted(input):-ms-input-placeholder {
direction: rtl;
text-align: left;
}
`,
{ moduleId: 'vaadin-date-picker-text-field-styles' }
);

:host([dir="rtl"]) [part="value"]:-ms-input-placeholder,
:host([dir="rtl"]) [part="input-field"] ::slotted(input):-ms-input-placeholder {
direction: rtl;
text-align: left;
}
</style>
</template>
</dom-module>`;

document.head.appendChild($_documentContainer.content);
/**
* The text-field element for date input.
*
* ### Styling
*
* See [`<vaadin-text-field>` documentation](https://github.com/vaadin/vaadin-text-field/blob/master/src/vaadin-text-field.html)
* for `<vaadin-date-picker-text-field>` parts and available slots (prefix, suffix etc.)
*
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
*
* @extends PolymerElement
*/
* The text-field element for date input.
*
* ### Styling
*
* See [`<vaadin-text-field>` documentation](https://github.com/vaadin/vaadin-text-field/blob/master/src/vaadin-text-field.html)
* for `<vaadin-date-picker-text-field>` parts and available slots (prefix, suffix etc.)
*
* See [ThemableMixin – how to apply styles for shadow parts](https://github.com/vaadin/vaadin-themable-mixin/wiki)
*
* @extends PolymerElement
*/
class DatePickerTextFieldElement extends TextFieldElement {
static get is() {
return 'vaadin-date-picker-text-field';
Expand Down
Loading

0 comments on commit ab5a89b

Please sign in to comment.