UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 1.22 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=require("./input-presentation.style.js"),o=require("../input-behaviour/input-behaviour.component.js"),t=require("../input-behaviour/input-group-behaviour.component.js"),i=require("../../components/carbon-provider/__internal__/new-validation.context.js");exports.default=({align:s,borderRadius:u="borderRadius050",children:a,disabled:d,error:p,hasIcon:l,hideBorders:c=!1,info:h,inputWidth:x,maxWidth:v,positionedChildren:b,prefix:M,readOnly:f,size:j="medium",warning:m})=>{const{hasFocus:g,onMouseDown:C,onMouseEnter:I,onMouseLeave:q}=n.useContext(o.InputContext),{validationRedesignOptIn:_}=n.useContext(i.default),{onMouseEnter:w,onMouseLeave:y}=n.useContext(t.InputGroupContext);return e.jsxs(r.StyledInputPresentationContainer,{inputWidth:x,maxWidth:v,"data-role":"input-presentation-container",children:[b,e.jsx(r.default,{hasFocus:g,role:"presentation",onMouseDown:C,onMouseEnter:()=>{I&&I(),w&&w()},onMouseLeave:()=>{q&&q(),y&&y()},align:s,prefix:M,disabled:d,readOnly:f,size:j,warning:m,error:p,info:h,validationRedesignOptIn:_,hasIcon:l,borderRadius:u,hideBorders:c,children:a})]})};