import React, { useEffect, useRef } from 'react'; import { Accordion, Banner, Link, Radio, RadioGroup, css, spacing, } from '@mongodb-js/compass-components'; import type { ExportJSONFormat } from '../export/export-json'; const radioGroupStyles = css({ margin: `${spacing[3]}px 0`, }); const bannerContainerStyles = css({ margin: `${spacing[2]}px 0`, }); function JSONFileTypeOptions({ jsonFormat, setJSONFormatVariant, }: { jsonFormat: ExportJSONFormat; setJSONFormatVariant: (jsonFormatVariant: ExportJSONFormat) => void; }) { const relaxedWarningBannerContainerRef = useRef(null); useEffect(() => { // When the user selects relaxed we scroll to show the warning at the bottom. if (jsonFormat === 'relaxed') { relaxedWarningBannerContainerRef.current?.scrollIntoView(); } }, [jsonFormat]); return ( ) => setJSONFormatVariant(event.target.value as ExportJSONFormat) } > Default Extended JSON Relaxed Extended JSON Canonical Extended JSON {/* TODO(COMPASS-6632): Add docs link */} Learn more about JSON format
{jsonFormat === 'relaxed' && ( Large numbers (>= 2^^53) will lose precision with the relaxed EJSON format. This format is not recommended for data integrity. )}
); } export { JSONFileTypeOptions };