1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.hasValue = hasValue;
|
7 | exports.isFilled = isFilled;
|
8 | exports.isAdornedStart = isAdornedStart;
|
9 |
|
10 | // Supports determination of isControlled().
|
11 | // Controlled input accepts its current value as a prop.
|
12 | //
|
13 | // @see https://facebook.github.io/react/docs/forms.html#controlled-components
|
14 | // @param value
|
15 | // @returns {boolean} true if string (including '') or number (including zero)
|
16 | function hasValue(value) {
|
17 | return value != null && !(Array.isArray(value) && value.length === 0);
|
18 | } // Determine if field is empty or filled.
|
19 | // Response determines if label is presented above field or as placeholder.
|
20 | //
|
21 | // @param obj
|
22 | // @param SSR
|
23 | // @returns {boolean} False when not present or empty string.
|
24 | // True when any number or string with length.
|
25 |
|
26 |
|
27 | function isFilled(obj) {
|
28 | var SSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
29 | return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');
|
30 | } // Determine if an Input is adorned on start.
|
31 | // It's corresponding to the left with LTR.
|
32 | //
|
33 | // @param obj
|
34 | // @returns {boolean} False when no adornments.
|
35 | // True when adorned at the start.
|
36 |
|
37 |
|
38 | function isAdornedStart(obj) {
|
39 | return obj.startAdornment;
|
40 | } |
\ | No newline at end of file |