@razorpay/blade
Version:
The Design System that powers Razorpay
29 lines (26 loc) • 2.92 kB
JavaScript
import 'react';
import { FormHintWrapper } from './FormHintWrapper.native.js';
import { hintMarginTop, hintTextSize, hintIconSize } from './formTokens.js';
import { Text } from '../Typography/Text/Text.js';
import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'react-native-svg';
import '@babel/runtime/helpers/defineProperty';
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import '../Icons/_Svg/Svg/Svg.native.js';
import 'styled-components/native';
import '@gorhom/portal';
import 'react-native-gesture-handler';
import '../BladeProvider/useTheme.js';
import 'react-native';
import { getPlatformType } from '../../utils/getPlatformType/getPlatformType.js';
import '@babel/runtime/helpers/slicedToArray';
import '../BottomSheet/BottomSheetStack.js';
import '../../tokens/global/typography.js';
import '../../tokens/global/motion.js';
import CheckIcon from '../Icons/CheckIcon/CheckIcon.js';
import InfoIcon from '../Icons/InfoIcon/InfoIcon.js';
import { Box } from '../Box/Box.js';
var HintText=function HintText(_ref){var Icon=_ref.icon,children=_ref.children,id=_ref.id,color=_ref.color,size=_ref.size;var isReactNative=getPlatformType()==='react-native';return jsx(BaseBox,{marginTop:hintMarginTop[size],id:id,children:jsxs(FormHintWrapper,{children:[Icon?jsx(Box,{flexShrink:0,marginTop:"spacing.1",children:jsx(Icon,{})}):null,jsx(Text,{as:isReactNative?undefined:'span',color:color,size:hintTextSize[size],variant:"caption",wordBreak:"break-word",children:children})]})});};var Icons={error:function error(_ref2){var size=_ref2.size;return jsx(InfoIcon,{display:'block',color:"feedback.icon.negative.intense",size:hintIconSize[size]});},success:function success(_ref3){var size=_ref3.size;return jsx(CheckIcon,{display:'block',color:"feedback.icon.positive.intense",size:hintIconSize[size]});}};var FormHint=function FormHint(_ref4){var type=_ref4.type,helpText=_ref4.helpText,errorText=_ref4.errorText,successText=_ref4.successText,helpTextId=_ref4.helpTextId,errorTextId=_ref4.errorTextId,successTextId=_ref4.successTextId,_ref4$size=_ref4.size,size=_ref4$size===void 0?'medium':_ref4$size;var colors={help:'surface.text.gray.muted',error:'feedback.text.negative.intense',success:'feedback.text.positive.intense'};var showError=type==='error'&&errorText;var showSuccess=type==='success'&&successText;var showHelp=!showError&&!showSuccess&&helpText;return jsxs(Fragment,{children:[showHelp&&jsx(HintText,{size:size,id:helpTextId,color:colors.help,children:helpText}),showError&&jsx(HintText,{size:size,id:errorTextId,icon:function icon(){return Icons.error({size:size});},color:colors.error,children:errorText}),showSuccess&&jsx(HintText,{size:size,id:successTextId,icon:function icon(){return Icons.success({size:size});},color:colors.success,children:successText})]});};
export { FormHint };
//# sourceMappingURL=FormHint.js.map