Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const exotic_1 = require("exotic");
const omit_1 = require("@skava/modules/___dist/utils/omit");
const classnames_1 = __importDefault(require("classnames"));
function toClassList(props, state) {
    const className = classnames_1.default(props.className, {
        selected: props.isSelected,
        select: true,
        'input-error': state.isValidInput === false,
    });
    return className;
}
exports.toClassList = toClassList;
function toOnChange(props) {
    return props.onDropDownStateChange || props.onChange || props.onChangeValue;
}
exports.toOnChange = toOnChange;
function toList(props) {
    // if elseif if
    if (exotic_1.isArray(props.list) === true) {
        return props.list;
    }
    else if (exotic_1.isArray(props.options) === true) {
        return props.options;
    }
    else {
        return exotic_1.EMPTY_ARRAY;
    }
}
exports.toList = toList;
const omitList = [
    'list',
    'options',
    'onDropDownStateChange',
    'onChangeValue',
    'onChange',
    'className',
    'isActive',
];
Object.freeze(omitList);
function toAccessibleAttributes(props, state) {
    // aria-haspopup="listbox"
    // aria-activedescendant="exp_elem_Cm"
    // aria-expanded="true"
    // tabindex="-1"
    // @todo .attributes
    return '@@todo';
}
exports.toAccessibleAttributes = toAccessibleAttributes;
function toAttributes(props, state) {
    return {
        onChange: toOnChange(props),
        list: toList(props),
        className: toClassList(props, state),
        passthroughProps: omit_1.omit(props, omitList),
    };
}
exports.toAttributes = toAttributes;
function defaultRenderEmpty(props, state) {
    console.warn('SelectDropDown received no dropdowns');
    return '';
}
exports.defaultRenderEmpty = defaultRenderEmpty;
function toText(props, state) {
    const text = props.label || props.value || props.children || '';
    // try on props, then try on state
    if (!text && exotic_1.isObj(state) && arguments.length === 2) {
        return toText(state);
    }
    else {
        return String(text);
    }
}
exports.toText = toText;
exports.default = {
    toClassList,
    toOnChange,
    toList,
    toAccessibleAttributes,
    toAttributes,
    defaultRenderEmpty,
};
//# sourceMappingURL=_deps.js.map