Repository URL to install this package:
|
Version:
2.1.2-perf.5 ▾
|
import { toErrorProps } from "./toErrorProps";
import { toClassList } from "./toClassList";
import { toPassThroughProps } from "./toPassThroughProps";
import { toValidationProps } from "./toValidationProps";
import { toType } from "./toType";
import { createGetFromPropsOrState } from "./createGetFromPropsOrState";
import { toPlaceholder } from "./toPlaceholder";
import { toAccessibleAttributes } from "./toAccessibleProps";
import { toAriaLabel } from "./toAriaLabel";
export function toAttributes(instance) {
const {
props,
state
} = instance;
const classList = toClassList(props, state);
const passthroughProps = toPassThroughProps(props, state);
const validationProps = toValidationProps(props, state);
const type = toType(props, state);
const get = createGetFromPropsOrState(instance);
const placeholderText = toPlaceholder(props, state);
const accessibleProps = toAccessibleAttributes(props, state);
const {
hasError
} = toErrorProps(props, state);
const animatePlaceholder = get('animatePlaceholder');
const name = get('name');
const isDisabled = get('isDisabled'); // @todo should not come like this, should go as passthroughProps
const dataQa = get('dataQa');
const qa = get('qa');
const wrapperProps = Object.assign({}, accessibleProps, {
hasError
});
const labelText = get('labelText');
const ariaLabel = toAriaLabel(props, state);
const inputIcon = get('icon');
return {
passthroughProps,
wrapperProps,
validationProps,
classList,
placeholderText,
animatePlaceholder,
name,
isDisabled,
type,
dataQa,
qa,
labelText,
ariaLabel,
inputIcon
};
} //# sourceMappingURL=toAttributes.js.map