fix: use ...styles / CSSResult[] everywhere for types consistency
This commit is contained in:
parent
806017a5b1
commit
6ea0298884
24 changed files with 44 additions and 27 deletions
14
.changeset/silver-mayflies-dance.md
Normal file
14
.changeset/silver-mayflies-dance.md
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
'@lion/checkbox-group': patch
|
||||||
|
'@lion/combobox': patch
|
||||||
|
'@lion/form-core': patch
|
||||||
|
'@lion/input-amount': patch
|
||||||
|
'@lion/input-stepper': patch
|
||||||
|
'@lion/listbox': patch
|
||||||
|
'@lion/overlays': patch
|
||||||
|
'@lion/switch': patch
|
||||||
|
'@lion/textarea': patch
|
||||||
|
'@lion/tooltip': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Always use ...styles and [css``] everywhere consistently, meaning an array of CSSResult. Makes it easier on TSC.
|
||||||
|
|
@ -156,7 +156,7 @@ import { LionTabs } from '@lion/tabs';
|
||||||
export class LeaTabs extends LionTabs {
|
export class LeaTabs extends LionTabs {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
/* my stylings */
|
/* my stylings */
|
||||||
`,
|
`,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { LionTabs } from '@lion/tabs';
|
||||||
export class LeaTabs extends LionTabs {
|
export class LeaTabs extends LionTabs {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
background: #222;
|
background: #222;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export class GhOption extends LionOption {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -118,7 +118,7 @@ export class GhCombobox extends LionCombobox {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
/** @configure LionCombobox */
|
/** @configure LionCombobox */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import './style/load-roboto.js';
|
||||||
export class MdOption extends LionOption {
|
export class MdOption extends LionOption {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -69,7 +69,7 @@ customElements.define('md-option', MdOption);
|
||||||
export class MdCombobox extends MdFieldMixin(LionCombobox) {
|
export class MdCombobox extends MdFieldMixin(LionCombobox) {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
.input-group__container {
|
.input-group__container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class WaOption extends LionOption {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
--background-default: white;
|
--background-default: white;
|
||||||
|
|
@ -287,7 +287,7 @@ customElements.define('wa-option', WaOption);
|
||||||
class WaCombobox extends LionCombobox {
|
class WaCombobox extends LionCombobox {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
font-family: SF Pro Text, SF Pro Icons, system, -apple-system, system-ui,
|
font-family: SF Pro Text, SF Pro Icons, system, -apple-system, system-ui,
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ export const customArrow = () => {
|
||||||
class extends LionTooltip {
|
class extends LionTooltip {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
--tooltip-arrow-width: 20px;
|
--tooltip-arrow-width: 20px;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import { LionInput } from '@lion/input';
|
||||||
class MyInput extends LionInput {
|
class MyInput extends LionInput {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
/* your styles here */
|
/* your styles here */
|
||||||
`,
|
`,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { MyCounter } from '../src/MyCounter.js';
|
||||||
export class MyExtension extends MyCounter {
|
export class MyExtension extends MyCounter {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
button {
|
button {
|
||||||
background: #c43f16;
|
background: #c43f16;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export class PTable extends DecorateMixin(LitElement) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
/**
|
/**
|
||||||
* Structural css
|
* Structural css
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class PBoard extends DecorateMixin(LitElement) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
utilsStyles,
|
utilsStyles,
|
||||||
tooltipStyles,
|
tooltipStyles,
|
||||||
css`
|
css`
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { LionCheckbox } from './LionCheckbox.js';
|
||||||
export class LionCheckboxIndeterminate extends LionCheckbox {
|
export class LionCheckboxIndeterminate extends LionCheckbox {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles || [],
|
...(super.styles || []),
|
||||||
css`
|
css`
|
||||||
:host .choice-field__nested-checkboxes {
|
:host .choice-field__nested-checkboxes {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export class GoogleOption extends LinkMixin(LionOption) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -106,7 +106,7 @@ customElements.define('google-option', GoogleOption);
|
||||||
export class GoogleCombobox extends LionCombobox {
|
export class GoogleCombobox extends LionCombobox {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
/** @configure FormControlMixin */
|
/** @configure FormControlMixin */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
.input-group__input {
|
.input-group__input {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { Unparseable } from './validate/Unparseable.js';
|
||||||
/**
|
/**
|
||||||
* @typedef {import('@lion/core').TemplateResult} TemplateResult
|
* @typedef {import('@lion/core').TemplateResult} TemplateResult
|
||||||
* @typedef {import('@lion/core').CSSResult} CSSResult
|
* @typedef {import('@lion/core').CSSResult} CSSResult
|
||||||
|
* @typedef {import('@lion/core').CSSResultArray} CSSResultArray
|
||||||
* @typedef {import('@lion/core').nothing} nothing
|
* @typedef {import('@lion/core').nothing} nothing
|
||||||
* @typedef {import('@lion/core/types/SlotMixinTypes').SlotsMap} SlotsMap
|
* @typedef {import('@lion/core/types/SlotMixinTypes').SlotsMap} SlotsMap
|
||||||
* @typedef {import('../types/FormControlMixinTypes.js').FormControlMixin} FormControlMixin
|
* @typedef {import('../types/FormControlMixinTypes.js').FormControlMixin} FormControlMixin
|
||||||
|
|
@ -618,7 +619,7 @@ const FormControlMixinImplementation = superclass =>
|
||||||
*/
|
*/
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles || [],
|
.../** @type {CSSResultArray} */ (super.styles || []),
|
||||||
css`
|
css`
|
||||||
/**********************
|
/**********************
|
||||||
{block} .form-field
|
{block} .form-field
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ const ChoiceInputMixinImplementation = superclass =>
|
||||||
*/
|
*/
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles || [],
|
...(super.styles || []),
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
.input-group__container > .input-group__input ::slotted(.form-control) {
|
.input-group__container > .input-group__input ::slotted(.form-control) {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { IsNumber, MinNumber, MaxNumber } from '@lion/form-core';
|
||||||
export class LionInputStepper extends LionInput {
|
export class LionInputStepper extends LionInput {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
.input-group__container > .input-group__input ::slotted(.form-control) {
|
.input-group__container > .input-group__input ::slotted(.form-control) {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ const ListboxMixinImplementation = superclass =>
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles || [],
|
...(super.styles || []),
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Constructor } from '@open-wc/dedupe-mixin';
|
import { Constructor } from '@open-wc/dedupe-mixin';
|
||||||
import { LitElement } from '@lion/core';
|
import { LitElement, CSSResultArray } from '@lion/core';
|
||||||
import { SlotHost } from '@lion/core/types/SlotMixinTypes';
|
import { SlotHost } from '@lion/core/types/SlotMixinTypes';
|
||||||
|
|
||||||
import { FormControlHost } from '@lion/form-core/types/FormControlMixinTypes';
|
import { FormControlHost } from '@lion/form-core/types/FormControlMixinTypes';
|
||||||
|
|
@ -9,6 +9,7 @@ import { LionOptions } from '../src/LionOptions.js';
|
||||||
import { LionOption } from '../src/LionOption.js';
|
import { LionOption } from '../src/LionOption.js';
|
||||||
|
|
||||||
export declare class ListboxHost {
|
export declare class ListboxHost {
|
||||||
|
static get styles(): CSSResultArray;
|
||||||
/**
|
/**
|
||||||
* When true, will synchronize activedescendant and selected element on
|
* When true, will synchronize activedescendant and selected element on
|
||||||
* arrow key navigation.
|
* arrow key navigation.
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { OverlayMixin } from './OverlayMixin.js';
|
||||||
* @typedef {import('../types/ArrowMixinTypes').ArrowMixin} ArrowMixin
|
* @typedef {import('../types/ArrowMixinTypes').ArrowMixin} ArrowMixin
|
||||||
* @typedef {import('@popperjs/core/lib/popper').Options} PopperOptions
|
* @typedef {import('@popperjs/core/lib/popper').Options} PopperOptions
|
||||||
* @typedef {import('@popperjs/core/lib/enums').Placement} Placement
|
* @typedef {import('@popperjs/core/lib/enums').Placement} Placement
|
||||||
|
* @typedef {import('@lion/core').CSSResultArray} CSSResultArray
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,7 +27,7 @@ export const ArrowMixinImplementation = superclass =>
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles || [],
|
.../** @type {CSSResultArray} */ (super.styles || []),
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
--tooltip-arrow-width: 12px;
|
--tooltip-arrow-width: 12px;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { LionSwitchButton } from './LionSwitchButton.js';
|
||||||
export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField)) {
|
export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField)) {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host([hidden]) {
|
:host([hidden]) {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ export class LionTextarea extends NativeTextFieldMixin(LionFieldWithTextArea) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles,
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
.input-group__container > .input-group__input ::slotted(.form-control) {
|
.input-group__container > .input-group__input ::slotted(.form-control) {
|
||||||
overflow-x: hidden; /* for FF adds height to the TextArea to reserve place for scroll-bars */
|
overflow-x: hidden; /* for FF adds height to the TextArea to reserve place for scroll-bars */
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export class LionTooltip extends ArrowMixin(OverlayMixin(LitElement)) {
|
||||||
|
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
super.styles ? super.styles : [],
|
...super.styles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue