UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

33 lines 1.01 kB
import { isTrue } from "../component-helper.js"; export function filterValidProps(props, validKeys, excludeKeys) { const res = {}; const o = Object.prototype.hasOwnProperty; for (const key in props) { if ((!validKeys || validKeys && o.call(validKeys, key)) && (!excludeKeys || excludeKeys && !o.call(excludeKeys, key))) { res[key] = props[key]; } } return res; } export function pickFormElementProps(props, excludeProps) { return filterValidProps(props, validFormElementProps, excludeProps); } export function prepareFormElementContext(props) { if (isTrue(props.vertical)) { if (typeof props.labelDirection === 'undefined') { props.labelDirection = 'vertical'; } if (typeof props.label_direction === 'undefined') { props.label_direction = 'vertical'; } } return props; } const validFormElementProps = { skeleton: null, disabled: null, vertical: null, labelDirection: null, label_direction: null }; //# sourceMappingURL=filterValidProps.js.map