@appbuckets/react-ui
Version:
Just Another React UI Framework
45 lines (42 loc) • 762 B
JavaScript
;
var fieldPropsKey = [
'actions',
'actionsPosition',
'appearance',
'clearable',
'contentClassName',
'contentType',
'disabled',
'hint',
'hintClassName',
'icon',
'iconPosition',
'isDirty',
'isFocused',
'isTouched',
'label',
'onClear',
'readOnly',
'required',
'appearance',
'danger',
'info',
'primary',
'secondary',
'success',
'warning',
];
function splitFieldProps(props) {
var fieldProps = {};
var rest = {};
Object.keys(props).forEach(function (propKey) {
if (fieldPropsKey.includes(propKey)) {
// @ts-ignore
fieldProps[propKey] = props[propKey];
} else {
rest[propKey] = props[propKey];
}
});
return [fieldProps, rest];
}
module.exports = splitFieldProps;