{"version":3,"file":"ObjectFieldTemplate.mjs","sources":["../../src/templates/ObjectFieldTemplate.tsx"],"sourcesContent":["import { Box, Stack } from '@mantine/core';\nimport {\n  FormContextType,\n  ObjectFieldTemplatePropertyType,\n  ObjectFieldTemplateProps,\n  RJSFSchema,\n  StrictRJSFSchema,\n  canExpand,\n  // getTemplate,\n  getUiOptions,\n  // titleId,\n} from '@rjsf/utils';\n// import { useFieldContext } from './FieldTemplate';\n\n/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the\n * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all\n * the properties.\n *\n * @param props - The `ObjectFieldTemplateProps` for this component\n */\nexport default function ObjectFieldTemplate<\n  T = any,\n  S extends StrictRJSFSchema = RJSFSchema,\n  F extends FormContextType = any,\n>(props: ObjectFieldTemplateProps<T, S, F>) {\n  const {\n    disabled,\n    formData,\n    idSchema,\n    onAddClick,\n    properties,\n    readonly,\n    registry,\n    // required,\n    schema,\n    // title,\n    uiSchema,\n  } = props;\n\n  // const { description } = useFieldContext();\n  const options = getUiOptions<T, S, F>(uiSchema);\n  // const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, options);\n\n  // Button templates are not overridden in the uiSchema\n  const {\n    ButtonTemplates: { AddButton },\n  } = registry.templates;\n\n  const classNames = options.classNames;\n\n  return (\n    <div\n      id={idSchema.$id}\n      style={{\n        width: '100%',\n        marginBottom: '12px',\n      }}\n      className={`armt-template-objectfield ${classNames ?? ''}`}\n    >\n      <Box className='armt-template-objectfield-item'>\n        <Stack spacing='xs'>{properties.map((prop: ObjectFieldTemplatePropertyType) => prop.content)}</Stack>\n      </Box>\n      {canExpand<T, S, F>(schema, uiSchema, formData) && (\n        <AddButton\n          className='object-property-expand'\n          onClick={onAddClick(schema)}\n          disabled={disabled || readonly}\n          uiSchema={uiSchema}\n          registry={registry}\n        />\n      )}\n    </div>\n  );\n}\n"],"names":[],"mappings":";;;;AAOe,SAAS,mBAAm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