|
| 1 | +<fieldset> |
| 2 | + <label for="default-input">Labelled input</label> |
| 3 | + <pf-text-input id="default-input"></pf-text-input> |
| 4 | +</fieldset> |
| 5 | + |
| 6 | +<fieldset> |
| 7 | + <legend>Disabled</legend> |
| 8 | + <label for="disabled-input">Disabled input</label> |
| 9 | + <pf-text-input id="disabled-input" |
| 10 | + disabled |
| 11 | + value="disabled text input example"></pf-text-input> |
| 12 | +</fieldset> |
| 13 | + |
| 14 | +<fieldset> |
| 15 | + <legend>Left Truncated</legend> |
| 16 | + <label for="left-truncated-input">Truncated input</label> |
| 17 | + <pf-text-input id="left-truncated-input" |
| 18 | + left-truncated |
| 19 | + value="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."></pf-text-input> |
| 20 | +</fieldset> |
| 21 | + |
| 22 | +<fieldset> |
| 23 | + <legend>Read only</legend> |
| 24 | + <label for="read-only-input">Read only input</label> |
| 25 | + <pf-text-input id="read-only-input" |
| 26 | + readonly |
| 27 | + value="read only text input example"></pf-text-input> |
| 28 | + <label> |
| 29 | + <pf-switch onchange="this.closest('fieldset').querySelector('pf-text-input').plain=this.checked;"></pf-switch> |
| 30 | + Plain read only variant |
| 31 | + </label> |
| 32 | +</fieldset> |
| 33 | + |
| 34 | +<fieldset> |
| 35 | + <legend>Invalid</legend> |
| 36 | + <label for="invalid-input">Invalid input</label> |
| 37 | + <pf-text-input id="invalid-input" required></pf-text-input> |
| 38 | +</fieldset> |
| 39 | + |
| 40 | +<fieldset> |
| 41 | + <legend>Icon variants</legend> |
| 42 | + <pf-text-input accessible-label="success" validated="success"></pf-text-input> |
| 43 | + <pf-text-input accessible-label="warning" validated="warning"></pf-text-input> |
| 44 | + <pf-text-input accessible-label="invalid" required></pf-text-input> |
| 45 | + <pf-text-input accessible-label="calendar" icon="calendar"></pf-text-input> |
| 46 | + <pf-text-input accessible-label="clock" icon="clock"></pf-text-input> |
| 47 | + <pf-text-input accessible-label="search" icon="search"></pf-text-input> |
| 48 | + <pf-text-input accessible-label="custom" |
| 49 | + custom-icon-url='data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"%3E%3Cpath fill="%23a18fff" d="M158.87.15c-16.16-1.52-31.2 8.42-35.33 24.12l-14.81 56.27c187.62 5.49 314.54 130.61 322.48 317l56.94-15.78c15.72-4.36 25.49-19.68 23.62-35.9C490.89 165.08 340.78 17.32 158.87.15zm-58.47 112L.55 491.64a16.21 16.21 0 0 0 20 19.75l379-105.1c-4.27-174.89-123.08-292.14-299.15-294.1zM128 416a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48-152a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm104 104a32 32 0 1 1 32-32 32 32 0 0 1-32 32z"/%3E%3C/svg%3E' |
| 50 | + custom-icon-dimensions="24px 24px"></pf-text-input> |
| 51 | +</fieldset> |
| 52 | + |
| 53 | +<!-- TBD if we will implement this |
| 54 | +<fieldset> |
| 55 | + <legend>Icon sprite variants</legend> |
| 56 | + <p> |
| 57 | + <strong>Note</strong>: The icons for the success, invalid, calendar, etc. variations in form control elements are applied as |
| 58 | + background images to the form element. By default, the image URLs for these icons are data URIs. However, |
| 59 | + there may be cases where data URIs are not ideal, such as in an application with a content security policy that |
| 60 | + disallows data URIs for security reasons. The <code>isIconSprite</code> variation changes the icon source to an external |
| 61 | + SVG file that serves as a sprite for all of the supported icons. |
| 62 | + </p> |
| 63 | + <pf-text-input icon-sprite validated="success"></pf-text-input> |
| 64 | + <pf-text-input icon-sprite validated="warning"></pf-text-input> |
| 65 | + <pf-text-input icon-sprite required></pf-text-input> |
| 66 | + <pf-text-input icon-sprite icon="calendar"></pf-text-input> |
| 67 | + <pf-text-input icon-sprite icon="clock"></pf-text-input> |
| 68 | +</fieldset> |
| 69 | +--> |
| 70 | + |
| 71 | +<script type="module"> |
| 72 | + import '@patternfly/elements/pf-text-input/pf-text-input.js'; |
| 73 | + import '@patternfly/elements/pf-switch/pf-switch.js'; |
| 74 | + await customElements.whenDefined('pf-text-input'); |
| 75 | + for (const input of document.querySelectorAll('pf-text-input[required]')) { |
| 76 | + await input.updateComplete; |
| 77 | + input.checkValidity(); |
| 78 | + } |
| 79 | +</script> |
| 80 | + |
| 81 | +<link rel="stylesheet" href="demo.css"> |
0 commit comments