-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (54 loc) · 1.41 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>color picker demo</title>
<link rel="stylesheet" href="./src/ColorPicker.css">
</head>
<body>
<form method="POST" enctype="multipart/form-data">
<fieldset>
<legend>Color</legend>
<div>
<label>
Name
<input name="name" type="text" required>
</label>
</div>
<div>
<label>
Description (optional)
<input name="description" type="text">
</label>
</div>
<div>
<label>
Value (native input)
<input name="value-native" type="color" value="#ff6600">
</label>
</div>
<div>
<label>
Value (custom element)
<color-picker name="value" value="#f60a" format="hex"></color-picker>
</label>
</div>
</fieldset>
<button type="reset">Reset</button>
<button>Submit</button>
</form>
<script type="module">
import './src/ColorPicker.ts'
const colorPicker = document.querySelector('color-picker')
colorPicker.addEventListener('color-change', function (event) {
console.info('color-change', event.detail.cssColor, event.detail.colors)
})
document.forms[0].addEventListener('submit', function (event) {
const formData = new FormData(event.target)
console.info('submit', JSON.stringify(Array.from(formData.entries()), null, 2))
event.preventDefault()
})
</script>
</body>
</html>