UNPKG

@aokiapp/rjsf-mantine-theme

Version:

Mantine theme, fields and widgets for react-jsonschema-form

1 lines 1.3 kB
{"version":3,"file":"createErrors.mjs","sources":["../../src/utils/createErrors.tsx"],"sourcesContent":["import { Stack, Text } from '@mantine/core';\nimport { IdSchema, errorId } from '@rjsf/utils';\nimport { ReactNode } from 'react';\n/**\n * Create error components from errors array\n */\nexport function createErrors<T = any>(\n errors: (string | ReactNode)[] | undefined | null,\n hideError: boolean | undefined | null, // it's okay to pass undefined here, but do not omit it\n idSchema?: IdSchema<T>,\n): ReactNode | null {\n if (hideError || !errors || errors.length === 0) {\n return null;\n }\n return (\n <Stack id={idSchema && errorId(idSchema.$id)}>\n {errors.map((error, index) => (\n <Text key={index} c='red' size='xs'>\n {error}\n </Text>\n ))}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE;AAC1D,EAAE,IAAI,SAAS,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACnD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,qBAAqB,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACpM;;;;"}