11
2- import { LitElement , html , css } from 'lit' ;
2+ import { LitElement , html , css , nothing } from 'lit' ;
33
44/**
55 * A row element which allows you to create a row with cells, either populating
@@ -10,7 +10,7 @@ import { LitElement, html, css } from 'lit';
1010 * Example:
1111 *
1212 * ```html
13- * <wc-row ltr >
13+ * <wc-row>
1414 * <wc-row-6>
1515 * <!-- content goes here -->
1616 * </wc-row-6>
@@ -22,13 +22,206 @@ export class RowElement extends LitElement {
2222
2323 constructor ( ) {
2424 super ( ) ;
25+ this . backgroundColor = '' ;
26+ }
27+ static get properties ( ) {
28+ return {
29+ /**
30+ * The badge background color. One of the following: primary, secondary, success, warning, danger, light, dark
31+ * @type {String }
32+ * @memberof BadgeElement
33+ */
34+ backgroundColor : { type : String } ,
35+ } ;
2536 }
2637 static get styles ( ) {
27- return css `` ;
38+ return css `
39+ slot {
40+ position: relative;
41+ display: flex;
42+ flex: 0 1 auto;
43+ flex-direction: row;
44+ flex-wrap: wrap;
45+ }
46+ .bg-color-primary {
47+ background-color: var(--primary-color);
48+ color: var(--light-color);
49+ }
50+ .bg-color-secondary {
51+ background-color: var(--secondary-color);
52+ color: var(--dark-color);
53+ }
54+ .bg-color-success {
55+ background-color: var(--success-color);
56+ color: var(--light-color);
57+ }
58+ .bg-color-warning {
59+ background-color: var(--warning-color);
60+ color: var(--light-color);
61+ }
62+ .bg-color-error {
63+ background-color: var(--error-color);
64+ color: var(--light-color);
65+ }
66+ .bg-color-light {
67+ background-color: var(--light-color);
68+ color: var(--dark-color);
69+ }
70+ .bg-color-dark {
71+ background-color: var(--dark-color);
72+ color: var(--light-color);
73+ }
74+ ` ;
2875 }
2976 render ( ) {
3077 return html `
31- < div class ="row "> < slot > < /slot > </ div >
78+ < slot class ="bg-color- ${ this . backgroundColor } "> </ slot >
3279 ` ;
3380 }
3481}
82+
83+ export class RowCellElement extends LitElement {
84+ static localName = 'wc-row-cell' ;
85+
86+ constructor ( ) {
87+ super ( ) ;
88+ this . width = 0 ;
89+ }
90+ static get properties ( ) {
91+ return {
92+ /**
93+ * The width of the cell, in a 12 column grid
94+ * @type {Number }
95+ * @memberof RowCellElement
96+ */
97+ width : { type : Number } ,
98+ } ;
99+ }
100+ get flexBasis ( ) {
101+ if ( this . width <= 12 ) {
102+ return `${ this . width * ( 100 / 12 ) } %` ;
103+ }
104+ return 'none' ;
105+ }
106+
107+ get display ( ) {
108+ return this . width ? 'block' : 'none' ;
109+ }
110+ render ( ) {
111+ this . style . maxWidth = `${ this . flexBasis } ` ;
112+ this . style . flexBasis = `${ this . flexBasis } ` ;
113+ this . style . display = `${ this . display } ` ;
114+ return html `
115+ < slot > </ slot >
116+ ` ;
117+ }
118+ }
119+
120+ export class RowCell1Element extends RowCellElement {
121+ static localName = 'wc-row-1' ;
122+
123+ constructor ( ) {
124+ super ( ) ;
125+ this . width = 1 ;
126+ }
127+ }
128+
129+ export class RowCell2Element extends RowCellElement {
130+ static localName = 'wc-row-2' ;
131+
132+ constructor ( ) {
133+ super ( ) ;
134+ this . width = 2 ;
135+ }
136+ }
137+
138+ export class RowCell3Element extends RowCellElement {
139+ static localName = 'wc-row-3' ;
140+
141+ constructor ( ) {
142+ super ( ) ;
143+ this . width = 3 ;
144+ }
145+ }
146+
147+ export class RowCell4Element extends RowCellElement {
148+ static localName = 'wc-row-4' ;
149+
150+ constructor ( ) {
151+ super ( ) ;
152+ this . width = 4 ;
153+ }
154+ }
155+
156+ export class RowCell5Element extends RowCellElement {
157+ static localName = 'wc-row-5' ;
158+
159+ constructor ( ) {
160+ super ( ) ;
161+ this . width = 5 ;
162+ }
163+ }
164+
165+ export class RowCell6Element extends RowCellElement {
166+ static localName = 'wc-row-6' ;
167+
168+ constructor ( ) {
169+ super ( ) ;
170+ this . width = 6 ;
171+ }
172+ }
173+
174+ export class RowCell7Element extends RowCellElement {
175+ static localName = 'wc-row-7' ;
176+
177+ constructor ( ) {
178+ super ( ) ;
179+ this . width = 7 ;
180+ }
181+ }
182+
183+ export class RowCell8Element extends RowCellElement {
184+ static localName = 'wc-row-8' ;
185+
186+ constructor ( ) {
187+ super ( ) ;
188+ this . width = 8 ;
189+ }
190+ }
191+
192+ export class RowCell9Element extends RowCellElement {
193+ static localName = 'wc-row-9' ;
194+
195+ constructor ( ) {
196+ super ( ) ;
197+ this . width = 9 ;
198+ }
199+ }
200+
201+ export class RowCell10Element extends RowCellElement {
202+ static localName = 'wc-row-10' ;
203+
204+ constructor ( ) {
205+ super ( ) ;
206+ this . width = 10 ;
207+ }
208+ }
209+
210+ export class RowCell11Element extends RowCellElement {
211+ static localName = 'wc-row-11' ;
212+
213+ constructor ( ) {
214+ super ( ) ;
215+ this . width = 11 ;
216+ }
217+ }
218+
219+
220+ export class RowCell12Element extends RowCellElement {
221+ static localName = 'wc-row-12' ;
222+
223+ constructor ( ) {
224+ super ( ) ;
225+ this . width = 12 ;
226+ }
227+ }
0 commit comments