| Index: third_party/polymer/components/core-input/demo.html
|
| diff --git a/third_party/polymer/components/core-input/demo.html b/third_party/polymer/components/core-input/demo.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c519f8ea6b057799f6114977214607eaeca227bc
|
| --- /dev/null
|
| +++ b/third_party/polymer/components/core-input/demo.html
|
| @@ -0,0 +1,133 @@
|
| +<!doctype html>
|
| +<html>
|
| +<head>
|
| + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
| +
|
| + <title>core-input</title>
|
| +
|
| + <script src="../platform/platform.js"></script>
|
| +
|
| + <link href="core-input.html" rel="import">
|
| +
|
| + <style>
|
| + body {
|
| + padding: 24px;
|
| + margin: 0;
|
| + -webkit-transform: translateZ(0);
|
| + font-family: sans-serif;
|
| + font-size: 16px;
|
| + }
|
| +
|
| + section {
|
| + margin: 2em 0;
|
| + }
|
| +
|
| + aside {
|
| + background: #ccc;
|
| + padding: 1em;
|
| + margin-right: 2em;
|
| + font-size: 12px;
|
| + width: 250px;
|
| + border-radius: 3px;
|
| + }
|
| +
|
| + core-input {
|
| + margin: 1em;
|
| + }
|
| +
|
| + core-input[multiline] {
|
| + border: 1px dotted #ccc;
|
| + }
|
| +
|
| + core-input.sized {
|
| + width: 500px;
|
| + height: 200px;
|
| + }
|
| +
|
| + .validation core-input,
|
| + .validation core-input[multiline] {
|
| + border: solid 1px lime;
|
| + }
|
| +
|
| + .validation core-input.invalid,
|
| + .validation core-input[multiline].invalid {
|
| + border: solid 1px red;
|
| + }
|
| +
|
| + </style>
|
| +
|
| +</head>
|
| +<body>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>A single-line text input. See console for committed values.</aside>
|
| + <core-input id="single" placeholder="Type something..."></core-input>
|
| + <script>
|
| + var single = document.getElementById('single');
|
| + single.addEventListener('change', function() {
|
| + console.log('single: value committed: ', single.value);
|
| + });
|
| + </script>
|
| + </section>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>The <code>type</code> attribute is supported. This is a single-line input with <code>type = password</code>. See console for committed values.</aside>
|
| + <core-input id="password" type="password" placeholder="Enter password..."></core-input>
|
| + <script>
|
| + var password = document.getElementById('password');
|
| + password.addEventListener('change', function() {
|
| + console.log('password: value committed: ', password.value);
|
| + });
|
| + </script>
|
| + </section>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>A multi-line text input with 3 rows. The input is normally unstyled but here is styled with a dotted border to show its size.</aside>
|
| + <core-input multiline rows="3" placeholder="Type many lines here..."></core-input>
|
| + </section>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>A multi-line text input sized with CSS. The input is normally unstyled but here is styled with a dotted border to show its size.</aside>
|
| + <core-input class="sized" multiline rows="fit" placeholder="This input is 500px * 200px"></core-input>
|
| + </section>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>Inputs with the <code>tabindex</code> attribute.</aside>
|
| + <div>
|
| + <core-input tabindex="2" placeholder="tabindex = 2"></core-input>
|
| + <br>
|
| + <core-input tabindex="3" placeholder="tabindex = 3"></core-input>
|
| + <br>
|
| + <core-input tabindex="1" placeholder="tabindex = 1"></core-input>
|
| + </div>
|
| + </section>
|
| +
|
| + <section horizontal start layout>
|
| + <aside>Validation examples. The border color reflects the current validation state. See console for validation events.</aside>
|
| + <div class="validation">
|
| + <core-input id="validate-number" type="number" placeholder="type = number"></core-input>
|
| + <br>
|
| + <core-input id="validate-email" type="email" placeholder="type = email"></core-input>
|
| + <br>
|
| + <core-input id="validate-required" required placeholder="required"></core-input>
|
| + <br>
|
| + <core-input id="validate-ml-required" multiline rows="3" required placeholder="required (multiline)"></core-input>
|
| + <br>
|
| + <core-input id="validate-pattern" pattern="a*bc" placeholder="with pattern = a*bc"></core-input>
|
| + <br>
|
| + <core-input id="validate-min-max" type="number" min="5" max="10" placeholder="type = number, min = 5, max = 10"></core-input>
|
| + <br>
|
| + <core-input id="validate-step" type="number" step="2" placeholder="type = number, step = 2"></core-input>
|
| + </div>
|
| + <script>
|
| + document.querySelector('.validation').addEventListener('input-invalid', function(e, value, s) {
|
| + console.log(e.target.id, 'invalid, inputValue:', e.detail.value, e.target.validity);
|
| + });
|
| + document.querySelector('.validation').addEventListener('input-valid', function(e, value, s) {
|
| + console.log(e.target.id, 'valid, inputValue:', e.detail.value, e.target.validity);
|
| + });
|
| + </script>
|
| + </section>
|
| +
|
| +
|
| +</body>
|
|
|