File tree Expand file tree Collapse file tree 6 files changed +114
-6
lines changed Expand file tree Collapse file tree 6 files changed +114
-6
lines changed Original file line number Diff line number Diff line change 1+
2+ import { html , nothing } from 'lit' ;
3+ import { FormElement } from './FormElement' ;
4+
5+ /**
6+ * FormDateElement implements a date input element
7+ */
8+ export class FormDateElement extends FormElement {
9+ constructor ( ) {
10+ super ( ) ;
11+
12+ // Default properties
13+ this . pattern = '' ;
14+ this . rows = 0 ;
15+ this . minlength = null ;
16+ this . maxlength = null ;
17+ }
18+ static get properties ( ) {
19+ return {
20+ /**
21+ * The minimum date allowed
22+ */
23+ min : { type : Date } ,
24+
25+ /**
26+ * The maximum date allowed
27+ */
28+ max : { type : Date }
29+ } ;
30+ }
31+ _renderInput ( ) {
32+ return html `< input class ="control "
33+ name =${ this . name || nothing }
34+ type ="date"
35+ ?required=${ this . required }
36+ ?disabled=${ this . disabled }
37+ placeholder=${ this . placeholder || nothing }
38+ min=${ this . min || nothing }
39+ max=${ this . max || nothing }
40+ @input=${ this . _updateValue } > ${ this . value } </ textarea >
41+ ` ;
42+ }
43+ }
44+
45+ customElements . define ( 'wc-form-date' , FormDateElement ) ;
Original file line number Diff line number Diff line change @@ -82,7 +82,6 @@ export class FormElement extends LitElement {
8282 div {
8383 display: flex;
8484 justify-content: start;
85- border: 1px solid red;
8685 }
8786 .labelbeside {
8887 flex-direction: row;
@@ -91,14 +90,13 @@ export class FormElement extends LitElement {
9190 flex-direction: column;
9291 }
9392 div.description {
93+ flex: 1;
9494 flex-direction: column;
9595 color: var(--form-input-description-color);
9696 font-size: var(--form-input-description-font-size);
9797 font-weight: var(--form-input-description-font-weight);
9898 }
9999 .control {
100- border: 1px solid red;
101- flex: 1;
102100 background-color: var(--form-input-background-color);
103101 color: var(--form-input-color);
104102 margin: var(--form-input-margin-y) var(--form-input-margin-x) var(--form-input-margin-y) var(--form-input-margin-x);
File renamed without changes.
Original file line number Diff line number Diff line change 1+
2+ import { LitElement , html , css } from 'lit' ;
3+
4+ /**
5+ * A vertical spacer element
6+ */
7+ export class SpacerElement extends LitElement {
8+ constructor ( ) {
9+ super ( ) ;
10+
11+ // Default properties
12+ this . y = 1 ;
13+ }
14+ static get properties ( ) {
15+ return {
16+ /**
17+ * Y space (0-6)
18+ * @type {Number }
19+ */
20+ y : { type : Number } ,
21+ } ;
22+ }
23+
24+ static get styles ( ) {
25+ return css `
26+ .m-0 {
27+ margin: var(--spacer-0)
28+ }
29+ .m-1 {
30+ margin: var(--spacer-1)
31+ }
32+ .m-2 {
33+ margin: var(--spacer-2)
34+ }
35+ .m-3 {
36+ margin: var(--spacer-3)
37+ }
38+ .m-4 {
39+ margin: var(--spacer-4)
40+ }
41+ .m-5 {
42+ margin: var(--spacer-5)
43+ }
44+ .m-6 {
45+ margin: var(--spacer-6)
46+ }
47+ ` ;
48+ }
49+ render ( ) {
50+ return html `
51+ < div class ="m- ${ this . y } "> </ div >
52+ ` ;
53+ }
54+ }
55+
56+ customElements . define ( 'wc-spacer' , SpacerElement ) ;
Original file line number Diff line number Diff line change @@ -105,12 +105,18 @@ <h1>Modal</h1>
105105 < div class ="container ">
106106 < form method ="POST " action ="# " onSubmit ="console.log('submit'); return false; ">
107107 < h1 > Form</ h1 >
108- < wc-form-input name ="generic input "> </ wc-form-input >
108+ < wc-form-input name ="test " disabled placeholder ="Generic input box without a label "> </ wc-form-input >
109+ < wc-spacer > </ wc-spacer >
109110 < wc-form-text name ="name " placeholder ="Name " autocomplete required minlength ="3 "> Name</ wc-form-text >
111+ < wc-spacer > </ wc-spacer >
110112 < wc-form-text name ="email " placeholder ="Email " pattern ="^\S+@\S+$ " description ="Email Address (optional) " autocomplete minlength ="3 "> Email Address</ wc-form-text >
113+ < wc-spacer > </ wc-spacer >
111114 < wc-form-text name ="address " placeholder ="Address " labelabove rows ="4 " description ="Shipping address (optional) "> Address</ wc-form-text >
115+ < wc-spacer > </ wc-spacer >
116+ < wc-form-date name ="date " placeholder ="Date of Birth " labelabove > Date of Birth</ wc-form-date >
117+ < wc-spacer > </ wc-spacer >
112118 < wc-button-group style ="border: 1px solid red ">
113- < wc-button name ="save " submit > Save</ wc-button >
119+ < wc-button name ="save " submit default > Save</ wc-button >
114120 < wc-button name ="save " submit > Cancel</ wc-button >
115121 </ wc-button-group >
116122 </ form >
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ import './component/modal/SideModalElement';
2424// Form Elements
2525import './component/form/FormElement' ;
2626import './component/form/FormTextElement' ;
27- import './component/form/FormPasswordElement' ;
27+ import './component/form/FormDateElement' ;
28+
29+ // Scaffold Elements
30+ import './component/spacer/SpacerElement' ;
2831
2932// CSS
3033import './css/core.css' ;
You can’t perform that action at this time.
0 commit comments