UNPKG

2.93 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright 2016 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23var strings = {
24 ARIA_CONTROLS: 'aria-controls',
25 ARIA_DESCRIBEDBY: 'aria-describedby',
26 INPUT_SELECTOR: '.mdc-text-field__input',
27 LABEL_SELECTOR: '.mdc-floating-label',
28 LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
29 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
30 OUTLINE_SELECTOR: '.mdc-notched-outline',
31 PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
32 SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
33 TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
34};
35var cssClasses = {
36 DISABLED: 'mdc-text-field--disabled',
37 FOCUSED: 'mdc-text-field--focused',
38 HELPER_LINE: 'mdc-text-field-helper-line',
39 INVALID: 'mdc-text-field--invalid',
40 LABEL_FLOATING: 'mdc-text-field--label-floating',
41 NO_LABEL: 'mdc-text-field--no-label',
42 OUTLINED: 'mdc-text-field--outlined',
43 ROOT: 'mdc-text-field',
44 TEXTAREA: 'mdc-text-field--textarea',
45 WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
46 WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',
47 WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter',
48};
49var numbers = {
50 LABEL_SCALE: 0.75,
51};
52/**
53 * Whitelist based off of
54 * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
55 * under the "Validation-related attributes" section.
56 */
57var VALIDATION_ATTR_WHITELIST = [
58 'pattern',
59 'min',
60 'max',
61 'required',
62 'step',
63 'minlength',
64 'maxlength',
65];
66/**
67 * Label should always float for these types as they show some UI even if value
68 * is empty.
69 */
70var ALWAYS_FLOAT_TYPES = [
71 'color',
72 'date',
73 'datetime-local',
74 'month',
75 'range',
76 'time',
77 'week',
78];
79export { cssClasses, strings, numbers, VALIDATION_ATTR_WHITELIST, ALWAYS_FLOAT_TYPES };
80//# sourceMappingURL=constants.js.map
\No newline at end of file