mopinion-react-native-sdk
Version:
Collect in-app feedback with Mopinion for React Native. Built fully in React Native for optimal integration with your React Native app.
1 lines • 6.01 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:true});exports.baseTheme=void 0;exports.generateTheme=generateTheme;exports.spacing=spacing;var _utils=require("../utils");var colors={blue:'#03a9f4',blueDark:'#0288d1',blueLight:'#B3E5FC',purple:'#512DA8',purpleDark:'#673AB7',purpleLight:'#D1C4E9',indigo:'#303F9F',indigoDark:'#3F51B5',indigoLight:'#C5CAE9',green:'#388E3C',greenDark:'#4CAF50',greenLight:'#C8E6C9',red:'#D32F2F',redDark:'#F44336',redLight:'#FFCDD2',pink:'#C2185B',pinkDark:'#E91E63',pinkLight:'#F8BBD0',white:'#fff',grey900:'#121212',grey800:'#424242',grey700:'#616161',grey600:'#757575',grey500:'#9E9E9E',grey400:'#BDBDBD',grey300:'#E0E0E0',grey200:'#EEEEEE',grey100:'#F5F5F5',errorRed:'#f00'};var baseTheme=exports.baseTheme={previousButtonBgColor:colors.white,groupsAsCardsFormBgColor:colors.grey200,groupsAsCards:false,formBgColor:colors.white,borderColor:'rgba(0, 0, 0, 0.18)',headerHeight:56,borderRadius:3,baseSpacing:8,redToGreen:['#c61600','#e53800','#ff6100','#55a526','#007d17'],thumbs:{positive:'#21a70b',negative:'#d40c0c'},textColorPrimary:colors.grey900,textColorSecondary:colors.grey700,highlightColor:'rgba(0, 0, 0, .08)',tooltipBgColor:'rgba(0, 0, 0, .7)',tooltipTextColor:colors.white,rippleColor:colors.white,uiComponentsGrey:'rgba(0, 0, 0, 0.4)',selectedStarColor:'#dc7827',typography:{base:{fontSize:16,fontWeight:400,color:colors.grey900},error:{fontSize:12,fontWeight:600,color:colors.errorRed},header:{fontSize:22,fontWeight:600},sectionHeader:{fontSize:18,fontWeight:600},caption:{fontSize:13,color:colors.grey700}}};var themeColors={MaterialBlue:{headerBgColor:colors.blue,headerTextColor:colors.white,selectedControlColor:colors.blue,actionButtonBgColor:colors.blue,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.blueLight,progressColor:colors.blueDark,progressBgColor:colors.blueLight},PurpleRain:{headerBgColor:colors.purple,headerTextColor:colors.white,selectedControlColor:colors.purple,actionButtonBgColor:colors.purple,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.purpleLight,progressColor:colors.blueDark,progressBgColor:colors.purpleLight},IndigoDream:{headerBgColor:colors.indigo,headerTextColor:colors.white,selectedControlColor:colors.indigo,actionButtonBgColor:colors.indigo,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.indigoLight,progressColor:colors.indigoDark,progressBgColor:colors.indigoLight},LeafyGreen:{headerBgColor:colors.green,headerTextColor:colors.white,selectedControlColor:colors.green,actionButtonBgColor:colors.green,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.greenLight,progressColor:colors.greenDark,progressBgColor:colors.greenLight},Redtastic:{headerBgColor:colors.red,headerTextColor:colors.white,selectedControlColor:colors.red,actionButtonBgColor:colors.red,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.redLight,progressColor:colors.redDark,progressBgColor:colors.redLight},PinkPanther:{headerBgColor:colors.pink,headerTextColor:colors.white,selectedControlColor:colors.pink,actionButtonBgColor:colors.pink,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.pinkLight,progressColor:colors.blueDark,progressBgColor:colors.pinkLight},SnowWhite:{headerBgColor:colors.white,headerTextColor:colors.grey900,selectedControlColor:colors.blue,actionButtonBgColor:colors.blue,actionButtonTextColor:colors.white,previousButtonBgColor:colors.white,previousButtonTextColor:colors.grey900,requiredMarkColor:colors.blueLight,progressColor:colors.blueDark,progressBgColor:colors.blueLight}};var darkTheme={formBgColor:colors.grey900,groupsAsCardsFormBgColor:colors.grey800,textColorPrimary:colors.grey400,textColorSecondary:colors.grey500,previousButtonTextColor:colors.grey900,actionButtonTextColor:colors.grey900,headerTextColor:colors.grey900,highlightColor:'rgba(255, 255, 255, .08)',tooltipBgColor:'rgba(255, 255, 255, .7)',borderColor:'rgba(255, 255, 255, 0.24)',tooltipTextColor:colors.grey900,rippleColor:colors.grey900,uiComponentsGrey:'rgba(255, 255, 255, 0.4)',selectedStarColor:'#dc7827'};function generateTheme(_ref){var _themeColors$themeNam,_themeVariant$colorSc;var themeName=_ref.theme,_ref$custom=_ref.custom,custom=_ref$custom===void 0?{}:_ref$custom,_ref$themeVariant=_ref.themeVariant,themeVariant=_ref$themeVariant===void 0?{}:_ref$themeVariant,_ref$colorScheme=_ref.colorScheme,colorScheme=_ref$colorScheme===void 0?'light':_ref$colorScheme;var colors=(_themeColors$themeNam=themeColors[themeName])!=null?_themeColors$themeNam:themeColors.MaterialBlue;var mergedBaseTheme=(0,_utils.deepMerge)(baseTheme,colorScheme==='dark'?darkTheme:{});if(themeName==='SnowWhite'&&colorScheme==='dark'){mergedBaseTheme.headerBgColor=mergedBaseTheme.formBgColor;mergedBaseTheme.headerTextColor=mergedBaseTheme.textColorPrimary;}var customTheme=(_themeVariant$colorSc=themeVariant==null?void 0:themeVariant[colorScheme])!=null?_themeVariant$colorSc:custom;var theme=(0,_utils.deepMerge)(colors,mergedBaseTheme,customTheme);var contrastColors={selectedControlTextColor:(0,_utils.getContrastColor)({backgroundColor:theme.selectedControlColor,darkColor:theme.formBgColor,lightColor:colorScheme==='dark'?mergedBaseTheme.textColorSecondary:'#ffffff',preferredColor:colorScheme})};return(0,_utils.deepMerge)(theme,contrastColors,{colorScheme:colorScheme});}function spacing(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(args.length===1){return args[0]*baseTheme.baseSpacing;}return args.map(function(x){return`${x*baseTheme.baseSpacing}`;}).join(' ');}