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 {
82
82
div {
83
83
display: flex;
84
84
justify-content: start;
85
- border: 1px solid red;
86
85
}
87
86
.labelbeside {
88
87
flex-direction: row;
@@ -91,14 +90,13 @@ export class FormElement extends LitElement {
91
90
flex-direction: column;
92
91
}
93
92
div.description {
93
+ flex: 1;
94
94
flex-direction: column;
95
95
color: var(--form-input-description-color);
96
96
font-size: var(--form-input-description-font-size);
97
97
font-weight: var(--form-input-description-font-weight);
98
98
}
99
99
.control {
100
- border: 1px solid red;
101
- flex: 1;
102
100
background-color: var(--form-input-background-color);
103
101
color: var(--form-input-color);
104
102
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>
105
105
< div class ="container ">
106
106
< form method ="POST " action ="# " onSubmit ="console.log('submit'); return false; ">
107
107
< 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 >
109
110
< wc-form-text name ="name " placeholder ="Name " autocomplete required minlength ="3 "> Name</ wc-form-text >
111
+ < wc-spacer > </ wc-spacer >
110
112
< 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 >
111
114
< 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 >
112
118
< 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 >
114
120
< wc-button name ="save " submit > Cancel</ wc-button >
115
121
</ wc-button-group >
116
122
</ form >
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ import './component/modal/SideModalElement';
24
24
// Form Elements
25
25
import './component/form/FormElement' ;
26
26
import './component/form/FormTextElement' ;
27
- import './component/form/FormPasswordElement' ;
27
+ import './component/form/FormDateElement' ;
28
+
29
+ // Scaffold Elements
30
+ import './component/spacer/SpacerElement' ;
28
31
29
32
// CSS
30
33
import './css/core.css' ;
You can’t perform that action at this time.
0 commit comments