diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 3974f09..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,9 +0,0 @@ -env: - browser: true - es2021: true -extends: - - airbnb-base -parserOptions: - ecmaVersion: 12 - sourceType: module -rules: {} diff --git a/config/eslint.config.mjs b/config/eslint.config.mjs index 52c29e6..612f561 100644 --- a/config/eslint.config.mjs +++ b/config/eslint.config.mjs @@ -19,4 +19,4 @@ export default [ }, }, ...compat.extends('airbnb-base'), -]; +]; \ No newline at end of file diff --git a/src/component/layout/RowElement.js b/src/component/layout/RowElement.js index 8155264..ce8b52e 100644 --- a/src/component/layout/RowElement.js +++ b/src/component/layout/RowElement.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit'; +import { LitElement, html, css, nothing } from 'lit'; /** * A row element which allows you to create a row with cells, either populating @@ -10,7 +10,7 @@ import { LitElement, html, css } from 'lit'; * Example: * * ```html - * + * * * * @@ -22,13 +22,206 @@ export class RowElement extends LitElement { constructor() { super(); + this.backgroundColor = ''; + } + static get properties() { + return { + /** + * The badge background color. One of the following: primary, secondary, success, warning, danger, light, dark + * @type {String} + * @memberof BadgeElement + */ + backgroundColor: { type: String }, + }; } static get styles() { - return css``; + return css` + slot { + position: relative; + display: flex; + flex: 0 1 auto; + flex-direction: row; + flex-wrap: wrap; + } + .bg-color-primary { + background-color: var(--primary-color); + color: var(--light-color); + } + .bg-color-secondary { + background-color: var(--secondary-color); + color: var(--dark-color); + } + .bg-color-success { + background-color: var(--success-color); + color: var(--light-color); + } + .bg-color-warning { + background-color: var(--warning-color); + color: var(--light-color); + } + .bg-color-error { + background-color: var(--error-color); + color: var(--light-color); + } + .bg-color-light { + background-color: var(--light-color); + color: var(--dark-color); + } + .bg-color-dark { + background-color: var(--dark-color); + color: var(--light-color); + } + `; } render() { return html` -
+ `; } } + +export class RowCellElement extends LitElement { + static localName = 'wc-row-cell'; + + constructor() { + super(); + this.width = 0; + } + static get properties() { + return { + /** + * The width of the cell, in a 12 column grid + * @type {Number} + * @memberof RowCellElement + */ + width: { type: Number }, + }; + } + get flexBasis() { + if (this.width <= 12) { + return `${this.width * (100 / 12)}%`; + } + return 'none'; + } + + get display() { + return this.width ? 'block' : 'none'; + } + render() { + this.style.maxWidth = `${this.flexBasis}`; + this.style.flexBasis = `${this.flexBasis}`; + this.style.display = `${this.display}`; + return html` + + `; + } +} + +export class RowCell1Element extends RowCellElement { + static localName = 'wc-row-1'; + + constructor() { + super(); + this.width = 1; + } +} + +export class RowCell2Element extends RowCellElement { + static localName = 'wc-row-2'; + + constructor() { + super(); + this.width = 2; + } +} + +export class RowCell3Element extends RowCellElement { + static localName = 'wc-row-3'; + + constructor() { + super(); + this.width = 3; + } +} + +export class RowCell4Element extends RowCellElement { + static localName = 'wc-row-4'; + + constructor() { + super(); + this.width = 4; + } +} + +export class RowCell5Element extends RowCellElement { + static localName = 'wc-row-5'; + + constructor() { + super(); + this.width = 5; + } +} + +export class RowCell6Element extends RowCellElement { + static localName = 'wc-row-6'; + + constructor() { + super(); + this.width = 6; + } +} + +export class RowCell7Element extends RowCellElement { + static localName = 'wc-row-7'; + + constructor() { + super(); + this.width = 7; + } +} + +export class RowCell8Element extends RowCellElement { + static localName = 'wc-row-8'; + + constructor() { + super(); + this.width = 8; + } +} + +export class RowCell9Element extends RowCellElement { + static localName = 'wc-row-9'; + + constructor() { + super(); + this.width = 9; + } +} + +export class RowCell10Element extends RowCellElement { + static localName = 'wc-row-10'; + + constructor() { + super(); + this.width = 10; + } +} + +export class RowCell11Element extends RowCellElement { + static localName = 'wc-row-11'; + + constructor() { + super(); + this.width = 11; + } +} + + +export class RowCell12Element extends RowCellElement { + static localName = 'wc-row-12'; + + constructor() { + super(); + this.width = 12; + } +} diff --git a/src/component/nav/NavBarElement.js b/src/component/nav/NavBarElement.js index 771cf0e..9813c1c 100644 --- a/src/component/nav/NavBarElement.js +++ b/src/component/nav/NavBarElement.js @@ -20,7 +20,6 @@ export class NavBarElement extends LitElement { disabled: { type: Boolean }, }; } - static get styles() { return css` nav { diff --git a/src/css/document.css b/src/css/document.css index 2e426ca..63466e6 100644 --- a/src/css/document.css +++ b/src/css/document.css @@ -82,3 +82,4 @@ div.container { .m-6 { margin: var(--spacer-6) !important; } + diff --git a/src/index.html b/src/index.html index c94e9d5..a161b66 100644 --- a/src/index.html +++ b/src/index.html @@ -5,8 +5,8 @@ Storybook - - + + @@ -105,30 +105,37 @@

Modal

Form

- - - Name - - Email Address - - Address - - Date of Birth - - - Save - Cancel - + + + Name + + Email Address + + Date of Birth + + + Address + + + + + + + Save + Cancel + + + +

-

Row Layout

Two Columns

- + Left Hand Side @@ -180,13 +187,13 @@

Six Columns

Col 3 - + Col 4 - + Col 5 - + Col 6
diff --git a/src/index.js b/src/index.js index 1eeff78..1e59dca 100644 --- a/src/index.js +++ b/src/index.js @@ -11,12 +11,11 @@ import './component/button/ButtonGroupElement'; import './component/button/CloseButtonElement'; // Badges -import './component/badge/BadgeElement'; +import { BadgeElement } from './component/badge/BadgeElement'; import './component/badge/BadgeGroupElement'; customElements.define(BadgeElement.localName, BadgeElement); // wc-badge - // Icons import './component/icon/IconElement'; @@ -34,11 +33,23 @@ import './component/form/FormTextElement'; import './component/form/FormDateElement'; // Layout Elements -import './component/layout/SpacerElement.js'; -import './component/layout/RowElement.js'; +import { SpacerElement } from './component/layout/SpacerElement'; +import { RowElement, RowCell1Element, RowCell2Element,RowCell3Element,RowCell4Element,RowCell5Element,RowCell6Element,RowCell7Element,RowCell8Element,RowCell9Element,RowCell10Element,RowCell11Element,RowCell12Element } from './component/layout/RowElement'; customElements.define(SpacerElement.localName, SpacerElement); // wc-spacer customElements.define(RowElement.localName, RowElement); // wc-row +customElements.define(RowCell1Element.localName, RowCell1Element); // wc-row-1 +customElements.define(RowCell2Element.localName, RowCell2Element); // wc-row-2 +customElements.define(RowCell3Element.localName, RowCell3Element); // wc-row-3 +customElements.define(RowCell4Element.localName, RowCell4Element); // wc-row-4 +customElements.define(RowCell5Element.localName, RowCell5Element); // wc-row-5 +customElements.define(RowCell6Element.localName, RowCell6Element); // wc-row-6 +customElements.define(RowCell7Element.localName, RowCell7Element); // wc-row-7 +customElements.define(RowCell8Element.localName, RowCell8Element); // wc-row-8 +customElements.define(RowCell9Element.localName, RowCell9Element); // wc-row-9 +customElements.define(RowCell10Element.localName, RowCell10Element); // wc-row-10 +customElements.define(RowCell11Element.localName, RowCell11Element); // wc-row-11 +customElements.define(RowCell12Element.localName, RowCell12Element); // wc-row-12 // CSS import './css/core.css'; @@ -46,6 +57,5 @@ import './css/document.css'; // Other import './esbuild.js'; -import './test.js';import { BadgeElement } from './component/badge/BadgeElement'; -import { SpacerElement } from './component/layout/SpacerElement.js'; +import './test.js';