forked from jcgertig/date-input-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
428 lines (393 loc) · 11.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Polyfill Datepicker Demo</title>
<meta name="description" content="Polyfill Demo" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"
/>
<link rel="shortcut icon" type="image/x-icon" href="favicons/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="favicons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="favicons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="favicons/favicon-16x16.png"
/>
<style>
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
body {
padding: 0 10%;
}
input {
width: 100%;
font-size: 20px;
box-sizing: border-box;
}
h1 {
font-size: 40px;
font-weight: bold;
text-align: center;
text-shadow: 2px 2px 2px #000000;
color: #a2d8f6;
word-wrap: Break-Word;
margin-bottom: 30px;
}
h2 {
font-size: 20px;
text-align: center;
margin-bottom: 30px;
}
.catchphrase {
margin: 0;
}
.preview-wrapper {
margin: 70px 0 70px 0;
display: flex;
justify-content: center;
}
.basic-example {
font-size: 32px;
text-align: center;
border: solid 3px #a2d8f6;
box-shadow: 0 2px 4px #000000;
outline: none;
}
.downloads-wrapper {
display: flex;
justify-content: center;
gap: 10px;
flex-direction: column;
}
.examples-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
.example-container {
width: 100%;
margin-bottom: 50px;
}
.example-container > p {
text-align: center;
}
.example p {
font-size: 18px;
margin-bottom: 2px;
margin-top: 10px;
}
.button {
min-width: 100%;
min-height: 90px;
border: solid 1px black;
font-size: 54px;
text-align: center;
line-height: 75px;
font-weight: bolder;
cursor: pointer;
}
.download {
background-color: #ffffff;
color: #a2d8f6;
}
.npm {
background-color: #cc3534;
border: solid 1px #cc3534;
color: #ffffff;
}
.information {
color: #721c24;
background-color: #f8d7da;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid #f5c6cb;
border-radius: 0.25rem;
}
.information p {
margin: 0;
}
.back {
background-color: transparent;
border: 0;
padding: 0;
font-size: 18px;
margin-bottom: 30px;
}
@media (min-width: 768px) {
h1 {
font-size: 60px;
}
h2 {
font-size: 26px;
}
.button {
min-width: 325px;
font-size: 60px;
}
.catchphrase {
margin: 0 50px;
}
.basic-example {
width: 60%;
}
.downloads-wrapper {
flex-direction: row;
}
.example-container {
width: 50%;
}
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #f8f8f8;
}
button {
background-color: #f9f9f9;
}
}
</style>
</head>
<body>
<h1>Configurable Date-Input-Polyfill DEMO</h1>
<h2 class="catchphrase">
The last date-input-polyfill you will ever need. A fancy and lightweight
date input with a high number of configuration options for all needs.
</h2>
<div class="preview">
<div class="preview-wrapper">
<input
class="basic-example"
placeholder="Click me.."
title="the basic example"
type="date"
data-force-polyfill="true"
/>
</div>
</div>
<div class="downloads-wrapper">
<button
class="button download"
onclick="window.open('https://github.com/KreutzerCode/configurable-date-input-polyfill/archive/master.zip','_blank')"
>
Download
</button>
<button
class="button npm"
onclick="window.open('https://www.npmjs.com/package/configurable-date-input-polyfill','_blank')"
>
NPM
</button>
</div>
<h1>Examples</h1>
<div class="examples-wrapper">
<div class="example-container">
<h2>Date Input</h2>
<div class="information">
<p>
Modern browsers utilize their own date pickers for date inputs which
do not have the <b>forcing polyfill</b> property applied.
</p>
</div>
<div class="example">
<p>Normal Input date (default):</p>
<input
id="default-configuration"
title="with default configuration"
type="date"
/>
</div>
<div class="example">
<p>With value:</p>
<input title="with preset value" type="date" value="2015-03-28" />
</div>
<div class="example">
<p>With format ("date-format"):</p>
<input
title="with configured date format"
type="date"
date-format="mm/dd/yyyy"
/>
</div>
<div class="example">
<p>Forcing Polyfill:</p>
<input
title="with configured date format"
type="date"
data-force-polyfill="true"
/>
</div>
<div class="example">
<p>With localization:</p>
<input title="with german local" type="date" lang="de" />
</div>
<div class="example">
<p>With monday as first week day:</p>
<input
title="with monday as first week day"
type="date"
data-first-day="mo"
data-force-polyfill="true"
/>
</div>
<div class="example">
<p>With min and max configuration:</p>
<input
title="with configured min & max value"
type="date"
data-min="2008-03-01"
data-max="2015-02-01"
/>
</div>
</div>
<div class="example-container">
<h2>Text Input</h2>
<div class="example">
<p>With type text & class (default):</p>
<input
title="with default configuration"
class="date-polyfill"
type="text"
/>
</div>
<div class="example">
<p>Text & class with value:</p>
<input
title="with preset value"
class="date-polyfill"
type="text"
value="2020-03-28"
/>
</div>
<div class="example">
<p>Text & class with format:</p>
<input
title="with configured date format"
class="date-polyfill"
type="text"
date-format="mm/dd/yyyy"
/>
</div>
<div class="example">
<p>Text & class with localization:</p>
<input
title="with french local"
class="date-polyfill"
type="text"
lang="fr"
/>
</div>
<div class="example">
<p>Text & class with monday as first week day:</p>
<input
title="with monday as first week day"
class="date-polyfill"
type="text"
data-first-day="mo"
/>
</div>
<div class="example">
<p>Text & class with a german configuration:</p>
<input
title="with german configuration"
class="date-polyfill"
type="text"
lang="de"
data-date-format="dd.mm.yyyy"
data-first-day="mo"
/>
</div>
<div class="example">
<p>Text & class with min and max value:</p>
<input
title="with configured min & max value"
class="date-polyfill"
type="text"
data-min="2008-03-01"
data-max="2015-02-01"
/>
</div>
</div>
<div class="example-container">
<h2>Dynamicly created Input</h2>
<p>(created after 2 sek)</p>
<div class="example">
<p>Dynamically created date input:</p>
<div class="example-input" id="dynamic-example"></div>
</div>
<div class="example">
<p>Dynamic and forcing polyfill:</p>
<div class="xample-input" id="dynamic-example-forcing"></div>
</div>
<div class="example">
<p>Dynamic with a german configuration:</p>
<div class="example-input" id="dynamic-example-german"></div>
</div>
<div class="example">
<p>Dynamic with min and max:</p>
<div class="example-input" id="dynamic-example-min-max"></div>
</div>
</div>
</div>
<div class="">
<div class="">
<button class="back" onclick="history.back()">Back</button>
</div>
</div>
<script>
setTimeout(function () {
const dynamicInput = document.createElement("input");
dynamicInput.setAttribute("type", "date");
document.getElementById("dynamic-example").appendChild(dynamicInput);
const dynamicInputForcing = document.createElement("input");
dynamicInputForcing.setAttribute("type", "date");
dynamicInputForcing.setAttribute("data-force-polyfill", "true");
document
.getElementById("dynamic-example-forcing")
.appendChild(dynamicInputForcing);
const dynamicInputGerman = document.createElement("input");
dynamicInputGerman.setAttribute("type", "text");
dynamicInputGerman.setAttribute("lang", "de");
dynamicInputGerman.setAttribute("class", "date-polyfill");
dynamicInputGerman.setAttribute("date-format", "dd.mm.yyyy");
dynamicInputGerman.setAttribute("data-first-day", "mo");
dynamicInputGerman.setAttribute("data-force-polyfill", "true");
document
.getElementById("dynamic-example-german")
.appendChild(dynamicInputGerman);
const dynamicInputMinMax = document.createElement("input");
dynamicInputMinMax.setAttribute("type", "date");
dynamicInputMinMax.setAttribute("data-min", "2008-03-01");
dynamicInputMinMax.setAttribute("data-max", "2015-02-01");
document
.getElementById("dynamic-example-min-max")
.appendChild(dynamicInputMinMax);
}, 2000);
</script>
<script src="./dist/configurable-date-input-polyfill.dist.js"></script>
</body>
</html>