import Translate from "@docusaurus/Translate" import { AndLabel } from "@theme/JSONSchemaViewer/labels" import type { JSX } from "react" import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude } // format minimum function FormatMinimum({ value, exclusive, }: { value: number exclusive: boolean }): JSX.Element { if (exclusive) { return ( {"> {count}"} ) } else { return ( {">= {count}"} ) } } // format maximum function FormatMaximum({ value, exclusive, }: { value: number exclusive: boolean }): JSX.Element { if (exclusive) { return ( {"< {count}"} ) } else { return ( {"<= {count}"} ) } } // minimum / exclusiveMinimum / maximum / exclusiveMaximum export default function NumberBounds(props: Props): JSX.Element { const { schema } = props // Not a fan of ugly IF cascades let minimum = schema.exclusiveMinimum || schema.minimum let isExclusiveMinimum = schema.exclusiveMinimum !== undefined let maximum = schema.exclusiveMaximum || schema.maximum let isExclusiveMaximum = schema.exclusiveMaximum !== undefined const minAndMax = minimum !== undefined && maximum !== undefined const boundsLabel = ( {"Possible values :"} ) return (
{boundsLabel}   {minimum !== undefined && ( )} {minAndMax && } {maximum !== undefined && ( )}
) }