UNPKG

@rjsf/mui

Version:

Material UI 7 theme, fields and widgets for react-jsonschema-form

4 lines 101 kB
{ "version": 3, "sources": ["../src/index.ts", "../src/MuiForm/MuiForm.tsx", "../src/AddButton/AddButton.tsx", "../src/util.ts", "../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx", "../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx", "../src/BaseInputTemplate/BaseInputTemplate.tsx", "../src/DescriptionField/DescriptionField.tsx", "../src/ErrorList/ErrorList.tsx", "../src/IconButton/IconButton.tsx", "../src/FieldErrorTemplate/FieldErrorTemplate.tsx", "../src/FieldHelpTemplate/FieldHelpTemplate.tsx", "../src/FieldTemplate/FieldTemplate.tsx", "../src/GridTemplate/GridTemplate.tsx", "../src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx", "../src/ObjectFieldTemplate/ObjectFieldTemplate.tsx", "../src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx", "../src/SubmitButton/SubmitButton.tsx", "../src/TitleField/TitleField.tsx", "../src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx", "../src/Templates/Templates.ts", "../src/CheckboxWidget/CheckboxWidget.tsx", "../src/CheckboxesWidget/CheckboxesWidget.tsx", "../src/RadioWidget/RadioWidget.tsx", "../src/RangeWidget/RangeWidget.tsx", "../src/SelectWidget/SelectWidget.tsx", "../src/TextareaWidget/TextareaWidget.tsx", "../src/Widgets/Widgets.ts", "../src/Theme/Theme.tsx"], "sourcesContent": ["import MuiForm from './MuiForm/MuiForm';\n\nexport { default as Form, generateForm } from './MuiForm';\nexport { default as Templates, generateTemplates } from './Templates';\nexport { default as Theme, generateTheme } from './Theme';\nexport { default as Widgets, generateWidgets } from './Widgets';\n\nexport default MuiForm;\n", "import { ComponentType } from 'react';\nimport { withTheme, FormProps } from '@rjsf/core';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport { generateTheme } from '../Theme';\n\nexport function generateForm<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(): ComponentType<FormProps<T, S, F>> {\n return withTheme<T, S, F>(generateTheme<T, S, F>());\n}\n\nexport default generateForm();\n", "import AddIcon from '@mui/icons-material/Add';\nimport IconButton, { IconButtonProps as MuiIconButtonProps } from '@mui/material/IconButton';\nimport {\n FormContextType,\n getUiOptions,\n IconButtonProps,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n} from '@rjsf/utils';\nimport { getMuiProps } from '../util';\n\n/** The `AddButton` renders a button that represent the `Add` action on a form\n */\nexport default function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n uiSchema,\n registry,\n ...props\n}: IconButtonProps<T, S, F>) {\n const { translateString } = registry;\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const muiProps = getMuiProps<T, S, F, MuiIconButtonProps>(uiOptions, [\n 'color',\n 'disableFocusRipple',\n 'disableRipple',\n 'edge',\n 'size',\n 'sx',\n ]);\n\n return (\n <IconButton title={translateString(TranslatableString.AddItemButton)} {...props} color='primary' {...muiProps}>\n <AddIcon />\n </IconButton>\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType, GenericObjectType } from '@rjsf/utils';\n\nimport { BoxProps, FormHelperTextProps, GridProps, PaperProps, SxProps, TypographyProps } from '@mui/material';\n\n/**\n * Extract props meant for MUI components from the `options` field of the `uiSchema`.\n * @param {UIOptionsType} options - The options from the uiSchema\n * @param {string[]} [propsToFilter] - An optional allowlist of props to return (used by button/icon components)\n * @param {boolean} [rjsfSlotPropsOnly] - If true, returns only `rjsfSlotProps`, preventing root-level prop bleeding\n * @returns {P}\n */\nexport function getMuiProps<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n P extends GenericObjectType = GenericObjectType,\n>(options: UIOptionsType<T, S, F>, propsToFilter?: string[], rjsfSlotPropsOnly?: boolean): P {\n const muiProps = (options?.mui as P) || ({} as P);\n if (rjsfSlotPropsOnly) {\n const { rjsfSlotProps } = muiProps as any;\n return { rjsfSlotProps } as unknown as P;\n }\n if (propsToFilter) {\n return Object.keys(muiProps)\n .filter((key) => propsToFilter.includes(key))\n .reduce((obj, key) => {\n obj[key as keyof P] = muiProps[key as keyof P];\n return obj;\n }, {} as P);\n }\n return muiProps;\n}\n\n/**\n * Merges default `sx` props with any `sx` provided on a MUI component's props, returning a value\n * suitable for passing directly to the MUI `sx` prop.\n *\n * When `muiProps.sx` is an array (only valid for `GridProps`), the default sx object is prepended\n * to produce an `sx` array, preserving MUI's array-merge semantics. Otherwise the two objects are\n * shallow-merged, with `muiProps.sx` taking precedence over the `sxProps`.\n *\n * If `muiProps` is omitted the `sxProps`` are returned as-is.\n *\n * @param sxProps - The default sx styles to apply\n * @param [muiProps] - The MUI component props that may contain a user-supplied `sx`\n * @returns - The merged sx value\n */\nexport function computeSxProps<MuiProps extends GridProps>(\n sxProps: SxProps,\n muiProps: MuiProps & { sx: any[] },\n): MuiProps['sx'] | MuiProps['sx'][];\nexport function computeSxProps<MuiProps extends BoxProps | FormHelperTextProps | PaperProps | TypographyProps>(\n sxProps: SxProps,\n muiProps?: MuiProps,\n): MuiProps['sx'];\nexport function computeSxProps<\n MuiProps extends BoxProps | FormHelperTextProps | GridProps | PaperProps | TypographyProps,\n>(sxProps: SxProps, muiProps?: MuiProps): MuiProps['sx'] | MuiProps['sx'][] {\n if (!muiProps) {\n return sxProps;\n }\n if (Array.isArray(muiProps?.sx)) {\n return [sxProps, ...muiProps.sx];\n }\n return { ...sxProps, ...muiProps?.sx } as MuiProps['sx'];\n}\n", "import { CSSProperties } from 'react';\nimport Box, { BoxProps } from '@mui/material/Box';\nimport Grid, { GridProps } from '@mui/material/Grid';\nimport Paper, { PaperProps } from '@mui/material/Paper';\nimport {\n ArrayFieldItemTemplateProps,\n FormContextType,\n getUiOptions,\n getTemplate,\n RJSFSchema,\n StrictRJSFSchema,\n GenericObjectType,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the ArrayFieldItemTemplate. */\nexport interface ArrayFieldItemTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the ArrayFieldItemTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the outermost `Grid` container. */\n arrayItemGridContainer?: GridProps;\n /** Props applied to the `Grid` item wrapping the item's content. */\n arrayItemGridItem?: GridProps;\n /** Props applied to the outer `Box` container. */\n arrayItemOuterBox?: BoxProps;\n /** Props applied to the `Paper` elevation component. */\n arrayItemPaper?: PaperProps;\n /** Props applied to the inner `Box` containing the actual children. */\n arrayItemInnerBox?: BoxProps;\n /** Props applied to the `Grid` containing the item's buttons. */\n arrayItemToolbarGrid?: GridProps;\n };\n}\n\n/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.\n *\n * @param props - The `ArrayFieldItemTemplateProps` props for the component\n */\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: ArrayFieldItemTemplateProps<T, S, F>) {\n const { children, buttonsProps, hasDescription, hasToolbar, uiSchema, registry } = props;\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(\n 'ArrayFieldItemButtonsTemplate',\n registry,\n uiOptions,\n );\n const btnStyle: CSSProperties = {\n flex: 1,\n paddingLeft: 6,\n paddingRight: 6,\n fontWeight: 'bold',\n minWidth: 0,\n };\n\n const {\n rjsfSlotProps: {\n arrayItemGridContainer,\n arrayItemGridItem,\n arrayItemInnerBox,\n arrayItemOuterBox,\n arrayItemPaper,\n arrayItemToolbarGrid,\n } = {},\n } = getMuiProps<T, S, F, ArrayFieldItemTemplateMuiProps>(uiOptions);\n\n return (\n <Grid\n container\n {...arrayItemGridContainer}\n sx={computeSxProps<GridProps>({ alignItems: 'center' }, arrayItemGridContainer)}\n >\n <Grid\n size={{ xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }}\n {...arrayItemGridItem}\n sx={computeSxProps({ overflow: 'auto' }, arrayItemGridItem)}\n >\n <Box {...arrayItemOuterBox} sx={computeSxProps<BoxProps>({ mb: 2 }, arrayItemOuterBox)}>\n <Paper elevation={2} {...arrayItemPaper}>\n <Box {...arrayItemInnerBox} sx={computeSxProps<BoxProps>({ p: 2 }, arrayItemInnerBox)}>\n {children}\n </Box>\n </Paper>\n </Box>\n </Grid>\n {hasToolbar && (\n <Grid\n {...arrayItemToolbarGrid}\n sx={computeSxProps<GridProps>({ mt: hasDescription ? -5 : -1.5 }, arrayItemToolbarGrid)}\n >\n <ArrayFieldItemButtonsTemplate {...buttonsProps} style={btnStyle} />\n </Grid>\n )}\n </Grid>\n );\n}\n", "import Box, { BoxProps } from '@mui/material/Box';\nimport Grid, { GridProps } from '@mui/material/Grid';\nimport Paper, { PaperProps } from '@mui/material/Paper';\nimport {\n getTemplate,\n getUiOptions,\n ArrayFieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n buttonId,\n GenericObjectType,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the ArrayFieldTemplate. */\nexport interface ArrayFieldTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the ArrayFieldTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the wrapper `Paper` material. */\n arrayPaper?: PaperProps;\n /** Props applied to the primary `Box` container. */\n arrayBox?: BoxProps;\n /** Props applied to the wrapper `Grid` container next to the Add Button. */\n arrayAddButtonGridContainer?: GridProps;\n /** Props applied to the `Grid` item containing the Add Button. */\n arrayAddButtonGridItem?: GridProps;\n /** Props applied to the `Box` containing the Add Button. */\n arrayAddButtonBox?: BoxProps;\n };\n}\n\n/** The `ArrayFieldTemplate` component is the template used to render all items in an array.\n *\n * @param props - The `ArrayFieldTemplateProps` props for the component\n */\nexport default function ArrayFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: ArrayFieldTemplateProps<T, S, F>) {\n const {\n canAdd,\n disabled,\n fieldPathId,\n uiSchema,\n items,\n optionalDataControl,\n onAddClick,\n readonly,\n registry,\n required,\n schema,\n title,\n } = props;\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const ArrayFieldDescriptionTemplate = getTemplate<'ArrayFieldDescriptionTemplate', T, S, F>(\n 'ArrayFieldDescriptionTemplate',\n registry,\n uiOptions,\n );\n const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(\n 'ArrayFieldTitleTemplate',\n registry,\n uiOptions,\n );\n const showOptionalDataControlInTitle = !readonly && !disabled;\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n\n const {\n rjsfSlotProps: {\n arrayPaper,\n arrayBox,\n arrayAddButtonGridContainer,\n arrayAddButtonGridItem,\n arrayAddButtonBox,\n } = {},\n } = getMuiProps<T, S, F, ArrayFieldTemplateMuiProps>(uiOptions);\n\n return (\n <Paper elevation={2} {...arrayPaper}>\n <Box {...arrayBox} sx={computeSxProps<BoxProps>({ p: 2 }, arrayBox)}>\n <ArrayFieldTitleTemplate\n fieldPathId={fieldPathId}\n title={uiOptions.title || title}\n schema={schema}\n uiSchema={uiSchema}\n required={required}\n registry={registry}\n optionalDataControl={showOptionalDataControlInTitle ? optionalDataControl : undefined}\n />\n <ArrayFieldDescriptionTemplate\n fieldPathId={fieldPathId}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n {!showOptionalDataControlInTitle ? optionalDataControl : undefined}\n {items}\n {canAdd && (\n <Grid\n container\n {...arrayAddButtonGridContainer}\n sx={computeSxProps<GridProps>({ justifyContent: 'flex-end' }, arrayAddButtonGridContainer)}\n >\n <Grid {...arrayAddButtonGridItem}>\n <Box {...arrayAddButtonBox} sx={computeSxProps<BoxProps>({ mt: 2 }, arrayAddButtonBox)}>\n <AddButton\n id={buttonId(fieldPathId, 'add')}\n className='rjsf-array-item-add'\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Box>\n </Grid>\n </Grid>\n )}\n </Box>\n </Paper>\n );\n}\n", "import { ChangeEvent, FocusEvent, MouseEvent, useCallback } from 'react';\nimport TextField, { TextFieldProps } from '@mui/material/TextField';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport { InputProps as MuiInputProps } from '@mui/material/Input';\nimport { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';\nimport {\n ariaDescribedByIds,\n BaseInputTemplateProps,\n examplesId,\n getInputProps,\n labelValue,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\nimport { SchemaExamples } from '@rjsf/core';\nimport { getMuiProps } from '../util';\n\n/** Properties available for the MUI `ui:options` of the BaseInputTemplate.\n * Unlike RJSF templates, `slotProps` here maps directly to MUI's native `TextField` `slotProps`,\n * enabling type-safe customization of the underlying MUI sub-components. */\nexport interface BaseInputTemplateMuiProps extends GenericObjectType {\n /** Native MUI `TextField` slotProps for targeting specific sub-components. */\n slotProps?: {\n /** Props applied to the base native HTML `<input>` or `<textarea>` element. */\n htmlInput?: React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;\n /** Props applied to the MUI `Input` element, useful for `endAdornment`/`startAdornment`. */\n input?: MuiInputProps;\n /** Props applied to the MUI `InputLabel` element. */\n inputLabel?: MuiInputLabelProps;\n };\n}\n\nconst TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];\n\n/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.\n * It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.\n * It can be customized/overridden for other themes or individual implementations as needed.\n *\n * @param props - The `WidgetProps` for this template\n */\nexport default function BaseInputTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: BaseInputTemplateProps<T, S, F>) {\n const {\n id,\n name, // remove this from textFieldProps\n htmlName,\n placeholder,\n required,\n readonly,\n disabled,\n type,\n label,\n hideLabel,\n hideError,\n value,\n onChange,\n onChangeOverride,\n onBlur,\n onFocus,\n autofocus,\n options,\n schema,\n uiSchema,\n rawErrors = [],\n errorSchema,\n registry,\n InputLabelProps,\n InputProps,\n slotProps,\n ...textFieldProps\n } = props;\n const { ClearButton } = registry.templates.ButtonTemplates;\n // Now we need to pull out the step, min, max into an inner `inputProps` for material-ui\n const { step, min, max, accept, ...rest } = getInputProps<T, S, F>(schema, type, options);\n\n const muiProps = getMuiProps<T, S, F, BaseInputTemplateMuiProps>(options);\n const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;\n\n const htmlInputProps = {\n ...slotProps?.htmlInput,\n ...muiSlotProps?.htmlInput,\n step,\n min,\n max,\n accept,\n ...(schema.examples ? { list: examplesId(id) } : undefined),\n };\n const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>\n onChange(value === '' ? options.emptyValue : value);\n const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);\n const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);\n const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type)\n ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true }\n : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };\n const _onClear = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onChange(options.emptyValue ?? '');\n },\n [onChange, options.emptyValue],\n );\n const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };\n if (options.allowClearTextInputs && value && !readonly && !disabled) {\n const clearAdornment = (\n <InputAdornment position='end'>\n <ClearButton registry={registry} onClick={_onClear} />\n </InputAdornment>\n );\n inputProps.endAdornment = !inputProps.endAdornment ? (\n clearAdornment\n ) : (\n <>\n {inputProps.endAdornment}\n {clearAdornment}\n </>\n );\n }\n\n return (\n <>\n <TextField\n id={id}\n name={htmlName || id}\n placeholder={placeholder}\n label={labelValue(label || undefined, hideLabel, undefined)}\n autoFocus={autofocus}\n required={required}\n disabled={disabled || readonly}\n slotProps={{\n ...slotProps,\n ...muiSlotProps,\n input: inputProps,\n htmlInput: htmlInputProps,\n inputLabel: DisplayInputLabelProps,\n }}\n {...rest}\n value={value || value === 0 ? value : ''}\n error={rawErrors.length > 0}\n onChange={onChangeOverride || _onChange}\n onBlur={_onBlur}\n onFocus={_onFocus}\n {...({ ...otherMuiProps, ...textFieldProps } as TextFieldProps)}\n aria-describedby={ariaDescribedByIds(id, !!schema.examples)}\n />\n <SchemaExamples id={id} schema={schema} />\n </>\n );\n}\n", "import Typography, { TypographyProps } from '@mui/material/Typography';\nimport {\n DescriptionFieldProps,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n getUiOptions,\n} from '@rjsf/utils';\nimport { RichDescription } from '@rjsf/core';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the DescriptionField. */\nexport interface DescriptionFieldMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the DescriptionField. */\n rjsfSlotProps?: {\n /** Props applied to the `Typography` element used for the description. */\n descTypography?: TypographyProps;\n };\n}\n\n/** The `DescriptionField` is the template to use to render the description of a field\n *\n * @param props - The `DescriptionFieldProps` for this component\n */\nexport default function DescriptionField<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: DescriptionFieldProps<T, S, F>) {\n const { id, description, registry, uiSchema } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const { rjsfSlotProps: { descTypography } = {} } = getMuiProps<T, S, F, DescriptionFieldMuiProps>(uiOptions);\n\n if (description) {\n return (\n <Typography\n id={id}\n variant='subtitle2'\n {...descTypography}\n sx={computeSxProps<TypographyProps>({ mt: 0.625 }, descTypography)}\n >\n <RichDescription description={description} registry={registry} uiSchema={uiSchema} />\n </Typography>\n );\n }\n\n return null;\n}\n", "import ErrorIcon from '@mui/icons-material/Error';\nimport Box, { BoxProps } from '@mui/material/Box';\nimport List, { ListProps } from '@mui/material/List';\nimport ListItem, { ListItemProps } from '@mui/material/ListItem';\nimport ListItemIcon, { ListItemIconProps } from '@mui/material/ListItemIcon';\nimport ListItemText, { ListItemTextProps } from '@mui/material/ListItemText';\nimport Paper, { PaperProps } from '@mui/material/Paper';\nimport Typography, { TypographyProps } from '@mui/material/Typography';\nimport {\n ErrorListProps,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n getUiOptions,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the ErrorList. */\nexport interface ErrorListMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the ErrorList. */\n rjsfSlotProps?: {\n /** Props applied to the outermost `Paper` component. */\n errorPaper?: PaperProps;\n /** Props applied to the `Box` container. */\n errorBox?: BoxProps;\n /** Props applied to the `Typography` element for the title. */\n errorTypography?: TypographyProps;\n /** Props applied to the `List` container holding the errors. */\n errorList?: ListProps;\n /** Props applied to each `ListItem` representing an error. */\n errorListItem?: ListItemProps;\n /** Props applied to each `ListItemIcon` representing the error icon. */\n errorListItemIcon?: ListItemIconProps;\n /** Props applied to each `ListItemText` representing the error message. */\n errorListItemText?: ListItemTextProps;\n };\n}\n\n/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`\n *\n * @param props - The `ErrorListProps` for this component\n */\nexport default function ErrorList<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n errors,\n registry,\n uiSchema,\n}: ErrorListProps<T, S, F>) {\n const { translateString } = registry;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const {\n rjsfSlotProps: {\n errorPaper,\n errorBox,\n errorTypography,\n errorList,\n errorListItem,\n errorListItemIcon,\n errorListItemText,\n } = {},\n } = getMuiProps<T, S, F, ErrorListMuiProps>(uiOptions);\n\n return (\n <Paper elevation={2} {...errorPaper}>\n <Box {...errorBox} sx={computeSxProps<BoxProps>({ mb: 2, p: 2 }, errorBox)}>\n <Typography variant='h6' {...errorTypography}>\n {translateString(TranslatableString.ErrorsLabel)}\n </Typography>\n <List dense={true} {...errorList}>\n {errors.map((error, i: number) => {\n return (\n <ListItem key={i} {...errorListItem}>\n <ListItemIcon {...errorListItemIcon}>\n <ErrorIcon color='error' />\n </ListItemIcon>\n <ListItemText primary={error.stack} {...errorListItemText} />\n </ListItem>\n );\n })}\n </List>\n </Box>\n </Paper>\n );\n}\n", "import IconButton, { IconButtonProps as MuiIconButtonProps } from '@mui/material/IconButton';\nimport ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';\nimport ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';\nimport CopyIcon from '@mui/icons-material/ContentCopy';\nimport RemoveIcon from '@mui/icons-material/Remove';\nimport ClearIcon from '@mui/icons-material/Clear';\nimport {\n FormContextType,\n IconButtonProps,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n getUiOptions,\n} from '@rjsf/utils';\nimport { getMuiProps } from '../util';\n\nexport default function MuiIconButton<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: IconButtonProps<T, S, F>) {\n const { icon, color, uiSchema, registry, ...otherProps } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const muiProps = getMuiProps<T, S, F, MuiIconButtonProps>(uiOptions, [\n 'color',\n 'disableFocusRipple',\n 'disableRipple',\n 'edge',\n 'size',\n 'sx',\n ]);\n\n return (\n <IconButton {...muiProps} {...otherProps} size='small' color={color as MuiIconButtonProps['color']}>\n {icon}\n </IconButton>\n );\n}\n\nexport function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>,\n) {\n const {\n registry: { translateString },\n } = props;\n return (\n <MuiIconButton\n title={translateString(TranslatableString.CopyButton)}\n {...props}\n icon={<CopyIcon fontSize='small' />}\n />\n );\n}\n\nexport function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>,\n) {\n const {\n registry: { translateString },\n } = props;\n return (\n <MuiIconButton\n title={translateString(TranslatableString.MoveDownButton)}\n {...props}\n icon={<ArrowDownwardIcon fontSize='small' />}\n />\n );\n}\n\nexport function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>,\n) {\n const {\n registry: { translateString },\n } = props;\n return (\n <MuiIconButton\n title={translateString(TranslatableString.MoveUpButton)}\n {...props}\n icon={<ArrowUpwardIcon fontSize='small' />}\n />\n );\n}\n\nexport function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>,\n) {\n const { iconType, ...otherProps } = props;\n const {\n registry: { translateString },\n } = otherProps;\n return (\n <MuiIconButton\n title={translateString(TranslatableString.RemoveButton)}\n {...otherProps}\n color='error'\n icon={<RemoveIcon fontSize={iconType === 'default' ? undefined : 'small'} />}\n />\n );\n}\n\nexport function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>,\n) {\n const { iconType, ...otherProps } = props;\n const {\n registry: { translateString },\n } = otherProps;\n return (\n <MuiIconButton\n title={translateString(TranslatableString.ClearButton)}\n {...otherProps}\n icon={<ClearIcon fontSize={iconType === 'default' ? undefined : 'small'} />}\n />\n );\n}\n", "import ListItem, { ListItemProps } from '@mui/material/ListItem';\nimport FormHelperText, { FormHelperTextProps } from '@mui/material/FormHelperText';\nimport List, { ListProps } from '@mui/material/List';\nimport {\n errorId,\n FieldErrorProps,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n getUiOptions,\n} from '@rjsf/utils';\nimport { getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the FieldErrorTemplate. */\nexport interface FieldErrorTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the FieldErrorTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the `List` container holding the errors. */\n fieldErrorList?: ListProps;\n /** Props applied to each `ListItem` representing an error. */\n fieldErrorListItem?: ListItemProps;\n /** Props applied to the `FormHelperText` displaying the actual error message. */\n fieldErrorFormHelperText?: FormHelperTextProps;\n };\n}\n\n/** The `FieldErrorTemplate` component renders the errors local to the particular field\n *\n * @param props - The `FieldErrorProps` for the errors being rendered\n */\nexport default function FieldErrorTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: FieldErrorProps<T, S, F>) {\n const { errors = [], fieldPathId, uiSchema } = props;\n if (errors.length === 0) {\n return null;\n }\n const id = errorId(fieldPathId);\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const muiProps = getMuiProps<T, S, F, FieldErrorTemplateMuiProps>(uiOptions);\n const { rjsfSlotProps: muiSlotProps } = muiProps;\n\n return (\n <List id={id} dense={true} disablePadding={true} {...muiSlotProps?.fieldErrorList}>\n {errors.map((error, i: number) => {\n return (\n <ListItem key={i} disableGutters={true} {...muiSlotProps?.fieldErrorListItem}>\n <FormHelperText component='div' id={`${id}-${i}`} {...muiSlotProps?.fieldErrorFormHelperText}>\n {error}\n </FormHelperText>\n </ListItem>\n );\n })}\n </List>\n );\n}\n", "import { RichHelp } from '@rjsf/core';\nimport {\n helpId,\n FieldHelpProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getUiOptions,\n GenericObjectType,\n} from '@rjsf/utils';\nimport FormHelperText, { FormHelperTextProps } from '@mui/material/FormHelperText';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the FieldHelpTemplate. */\nexport interface FieldHelpTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the FieldHelpTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the `FormHelperText` used for help text. */\n helpFormHelperText?: FormHelperTextProps;\n };\n}\n\n/** The `FieldHelpTemplate` component renders any help desired for a field\n *\n * @param props - The `FieldHelpProps` to be rendered\n */\nexport default function FieldHelpTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: FieldHelpProps<T, S, F>) {\n const { fieldPathId, help, uiSchema, registry } = props;\n if (!help) {\n return null;\n }\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const { rjsfSlotProps: { helpFormHelperText } = {} } = getMuiProps<T, S, F, FieldHelpTemplateMuiProps>(uiOptions);\n\n return (\n <FormHelperText\n component='div'\n id={helpId(fieldPathId)}\n {...helpFormHelperText}\n sx={computeSxProps<FormHelperTextProps>({ mt: 0.625 }, helpFormHelperText)}\n >\n <RichHelp help={help} registry={registry} uiSchema={uiSchema} />\n </FormHelperText>\n );\n}\n", "import FormControl, { FormControlProps } from '@mui/material/FormControl';\nimport Typography, { TypographyProps } from '@mui/material/Typography';\nimport {\n FieldTemplateProps,\n FormContextType,\n GenericObjectType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\nimport { getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the FieldTemplate. */\nexport interface FieldTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the FieldTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the MUI `FormControl` wrapping the field. */\n fieldFormControl?: FormControlProps;\n /** Props applied to the MUI `Typography` element used for description. */\n fieldTypography?: TypographyProps;\n };\n}\n\n/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field\n * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.\n *\n * @param props - The `FieldTemplateProps` for this component\n */\nexport default function FieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: FieldTemplateProps<T, S, F>) {\n const {\n id,\n children,\n classNames,\n style,\n disabled,\n displayLabel,\n hidden,\n label,\n onKeyRename,\n onKeyRenameBlur,\n onRemoveProperty,\n readonly,\n required,\n rawErrors = [],\n errors,\n help,\n description,\n rawDescription,\n schema,\n uiSchema,\n registry,\n } = props;\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(\n 'WrapIfAdditionalTemplate',\n registry,\n uiOptions,\n );\n\n if (hidden) {\n return <div style={{ display: 'none' }}>{children}</div>;\n }\n\n const isCheckbox = uiOptions.widget === 'checkbox';\n\n const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps<T, S, F, FieldTemplateMuiProps>(uiOptions);\n\n return (\n <WrapIfAdditionalTemplate\n classNames={classNames}\n style={style}\n disabled={disabled}\n id={id}\n label={label}\n displayLabel={displayLabel}\n rawDescription={rawDescription}\n onKeyRename={onKeyRename}\n onKeyRenameBlur={onKeyRenameBlur}\n onRemoveProperty={onRemoveProperty}\n readonly={readonly}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n >\n <FormControl\n fullWidth={true}\n error={rawErrors.length ? true : false}\n required={required}\n {...muiSlotProps?.fieldFormControl}\n sx={otherMuiProps.sx}\n className={otherMuiProps.className}\n >\n {children}\n {displayLabel && !isCheckbox && rawDescription ? (\n <Typography variant='caption' color='textSecondary' {...muiSlotProps?.fieldTypography}>\n {description}\n </Typography>\n ) : null}\n {errors}\n {help}\n </FormControl>\n </WrapIfAdditionalTemplate>\n );\n}\n", "import Grid from '@mui/material/Grid';\nimport { GridTemplateProps } from '@rjsf/utils';\n\n/** Renders a `GridTemplate` for mui, which is expecting the column sizing information coming in via the\n * extra props provided by the caller, which are spread directly on the `Grid`.\n *\n * @param props - The GridTemplateProps, including the extra props containing the mui grid positioning details\n */\nexport default function GridTemplate(props: GridTemplateProps) {\n const { children, column, ...rest } = props;\n return (\n <Grid container={!column} {...rest}>\n {children}\n </Grid>\n );\n}\n", "import Box, { BoxProps } from '@mui/material/Box';\nimport FormControl, { FormControlProps } from '@mui/material/FormControl';\nimport {\n FormContextType,\n GenericObjectType,\n MultiSchemaFieldTemplateProps,\n RJSFSchema,\n StrictRJSFSchema,\n getUiOptions,\n} from '@rjsf/utils';\nimport { getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the MultiSchemaFieldTemplate. */\nexport interface MultiSchemaFieldTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the MultiSchemaFieldTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the wrapper `Box` container. */\n multiBox?: BoxProps;\n /** Props applied to the MUI `FormControl` wrapping the selector. */\n multiFormControl?: FormControlProps;\n };\n}\n\nexport default function MultiSchemaFieldTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: MultiSchemaFieldTemplateProps<T, S, F>) {\n const { optionSchemaField, selector, uiSchema } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const { rjsfSlotProps: muiSlotProps } = getMuiProps<T, S, F, MultiSchemaFieldTemplateMuiProps>(uiOptions);\n\n return (\n <Box sx={{ mb: 2 }} {...muiSlotProps?.multiBox}>\n <FormControl fullWidth sx={{ mb: 2 }} {...muiSlotProps?.multiFormControl}>\n {selector}\n </FormControl>\n {optionSchemaField}\n </Box>\n );\n}\n", "import Grid, { GridProps } from '@mui/material/Grid';\nimport {\n FormContextType,\n GenericObjectType,\n ObjectFieldTemplateProps,\n RJSFSchema,\n StrictRJSFSchema,\n canExpand,\n descriptionId,\n getTemplate,\n getUiOptions,\n titleId,\n buttonId,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the ObjectFieldTemplate. */\nexport interface ObjectFieldTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the ObjectFieldTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the outermost `Grid` container wrapping all object properties. */\n objectGridContainer?: GridProps;\n /** Props applied to the `Grid` item wrapping each individual object property. */\n objectGridItem?: GridProps;\n /** Props applied to the wrapper `Grid` container next to the Add Button (when expandable). */\n objectAddButtonGridContainer?: GridProps;\n /** Props applied to the `Grid` item containing the Add Button. */\n objectAddButtonGridItem?: GridProps;\n };\n}\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 description,\n title,\n properties,\n required,\n disabled,\n readonly,\n uiSchema,\n fieldPathId,\n schema,\n formData,\n optionalDataControl,\n onAddProperty,\n registry,\n } = props;\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, uiOptions);\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n uiOptions,\n );\n const showOptionalDataControlInTitle = !readonly && !disabled;\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n\n const {\n rjsfSlotProps: { objectGridContainer, objectGridItem, objectAddButtonGridContainer, objectAddButtonGridItem } = {},\n } = getMuiProps<T, S, F, ObjectFieldTemplateMuiProps>(uiOptions);\n\n return (\n <>\n {title && (\n <TitleFieldTemplate\n id={titleId(fieldPathId)}\n title={title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n optionalDataControl={showOptionalDataControlInTitle ? optionalDataControl : undefined}\n />\n )}\n {description && (\n <DescriptionFieldTemplate\n id={descriptionId(fieldPathId)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n <Grid\n container\n spacing={2}\n {...objectGridContainer}\n sx={computeSxProps<GridProps>({ mt: 1.25 }, objectGridContainer)}\n >\n {!showOptionalDataControlInTitle ? optionalDataControl : undefined}\n {properties.map((element, index) =>\n // Remove the <Grid> if the inner element is hidden as the <Grid>\n // itself would otherwise still take up space.\n element.hidden ? (\n element.content\n ) : (\n <Grid\n size={{ xs: 12 }}\n key={index}\n {...objectGridItem}\n sx={computeSxProps<GridProps>({ mb: 1.25 }, objectGridItem)}\n >\n {element.content}\n </Grid>\n ),\n )}\n </Grid>\n {canExpand<T, S, F>(schema, uiSchema, formData) && (\n <Grid\n container\n {...objectAddButtonGridContainer}\n sx={computeSxProps<GridProps>({ justifyContent: 'flex-end' }, objectAddButtonGridContainer)}\n >\n <Grid {...objectAddButtonGridItem}>\n <AddButton\n id={buttonId(fieldPathId, 'add')}\n className='rjsf-object-property-expand'\n onClick={onAddProperty}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n </Grid>\n </Grid>\n )}\n </>\n );\n}\n", "import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport IconButton, { RemoveButton } from '../IconButton';\nimport AddIcon from '@mui/icons-material/Add';\n\n/** The OptionalDataControlsTemplate renders one of three different states. If\n * there is an `onAddClick()` function, it renders the \"Add\" button. If there is\n * an `onRemoveClick()` function, it renders the \"Remove\" button. Otherwise it\n * renders the \"No data found\" section. All of them use the `label` as either\n * the `title` of buttons or simply outputting it.\n *\n * @param props - The `OptionalDataControlsTemplateProps` for the template\n */\nexport default function OptionalDataControlsTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: OptionalDataControlsTemplateProps<T, S, F>) {\n const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;\n if (onAddClick) {\n return (\n <IconButton\n id={id}\n registry={registry}\n uiSchema={uiSchema}\n className='rjsf-add-optional-data'\n onClick={onAddClick}\n title={label}\n icon={<AddIcon fontSize='small' />}\n />\n );\n } else if (onRemoveClick) {\n return (\n <RemoveButton\n id={id}\n registry={registry}\n uiSchema={uiSchema}\n className='rjsf-remove-optional-data'\n onClick={onRemoveClick}\n title={label}\n />\n );\n }\n return <em id={id}>{label}</em>;\n}\n", "import Box, { BoxProps } from '@mui/material/Box';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport {\n getSubmitButtonOptions,\n GenericObjectType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n SubmitButtonProps,\n getUiOptions,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the SubmitButton. */\nexport interface SubmitButtonMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the SubmitButton. */\n rjsfSlotProps?: {\n /** Props applied to the `Box` wrapper. */\n submitBox?: BoxProps;\n /** Props applied to the `Button` element. */\n submitButton?: ButtonProps;\n };\n}\n\n/** The `SubmitButton` renders a button that represent the `Submit` action on a form\n */\nexport default function SubmitButton<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>({ uiSchema }: SubmitButtonProps<T, S, F>) {\n const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions<T, S, F>(uiSchema);\n if (norender) {\n return null;\n }\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const { rjsfSlotProps: { submitBox, submitButton } = {}, ...otherMuiProps } = getMuiProps<\n T,\n S,\n F,\n SubmitButtonMuiProps\n >(uiOptions);\n\n return (\n <Box {...submitBox} sx={computeSxProps<BoxProps>({ mt: 3 }, submitBox)}>\n <Button\n type='submit'\n variant='contained'\n color='primary'\n {...submitButtonProps}\n {...otherMuiProps}\n {...submitButton}\n >\n {submitText}\n </Button>\n </Box>\n );\n}\n", "import Box, { BoxProps } from '@mui/material/Box';\nimport Divider, { DividerProps } from '@mui/material/Divider';\nimport Grid, { GridProps } from '@mui/material/Grid';\nimport Typography, { TypographyProps } from '@mui/material/Typography';\nimport {\n FormContextType,\n GenericObjectType,\n TitleFieldProps,\n RJSFSchema,\n StrictRJSFSchema,\n getUiOptions,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n\n/** Properties available for the `rjsfSlotProps` target of the TitleField. */\nexport interface TitleFieldMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the TitleField. */\n rjsfSlotProps?: {\n /** Props applied to the `Box` wrapper. */\n titleBox?: BoxProps;\n /** Props applied to the `Divider` element. */\n titleDivider?: DividerProps;\n /** Props applied to the `Typography` element used for the title. */\n titleTypography?: TypographyProps;\n /** Props applied to the `Grid` container used when `optionalDataControl` is present. */\n titleGridContainer?: GridProps;\n /** Props applied to the `Grid` item containing the title. */\n titleGridItem?: GridProps;\n /** Props applied to the `Grid` item containing the `optionalDataControl`. */\n titleOptionalDataGridItem?: GridProps;\n };\n}\n\n/** The `TitleField` is the template to use to render the title of a field\n *\n * @param props - The `TitleFieldProps` for this component\n */\nexport default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: TitleFieldProps<T, S, F>,\n) {\n const { id, title, optionalDataControl, uiSchema } = props;\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const {\n rjsfSlotProps: {\n titleBox,\n titleDivider,\n titleTypography,\n titleGridContainer,\n titleGridItem,\n titleOptionalDataGridItem,\n } = {},\n } = getMuiProps<T, S, F, TitleFieldMuiProps>(uiOptions);\n\n let heading = (\n <Typography variant='h5' {...titleTypography}>\n {title}\n </Typography>\n );\n if (optionalDataControl) {\n heading = (\n <Grid container={true} spacing={0} {...titleGridContainer}>\n <Grid size='grow' {...titleGridItem}>\n {heading}\n </Grid>\n <Grid\n {...titleOptionalDataGridItem}\n sx={computeSxProps<GridProps>({ justifyContent: 'flex-end' }, titleOptionalDataGridItem)}\n >\n {optionalDataControl}\n </Grid>\n </Grid>\n );\n }\n return (\n <Box id={id} {...titleBox} sx={computeSxProps<BoxProps>({ mb: 1, mt: 1 }, titleBox)}>\n {heading}\n <Divider {...titleDivider} />\n </Box>\n );\n}\n", "import { CSSProperties } from 'react';\nimport Grid, { GridProps } from '@mui/material/Grid';\nimport TextField from '@mui/material/TextField';\nimport {\n ADDITIONAL_PROPERTY_FLAG,\n GenericObjectType,\n buttonId,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n WrapIfAdditionalTemplateProps,\n getUiOptions,\n} from '@rjsf/utils';\nimport { computeSxProps, getMuiProps } from '../util';\n/** Properties available for the `rjsfSlotProps` target of the WrapIfAdditionalTemplate. */\nexport interface WrapIfAdditionalTemplateMuiProps extends GenericObjectType {\n /** RJSF-specific slot props for targeting child elements of the WrapIfAdditionalTemplate. */\n rjsfSlotProps?: {\n /** Props applied to the outermost `Grid` container. */\n wrapGridContainer?: GridProps;\n /** Props applied to the `Grid` item containing the key TextField. */\n wrapKeyGridItem?: GridProps;\n /** Props applied to the `Grid` item containing the field children. */\n wrapChildrenGridItem?: GridProps;\n /** Props applied to the `Grid` item containing the remove button. */\n wrapRemoveButtonGridItem?: GridProps;\n };\n}\n\n/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are\n * part of an `additionalProperties` part of a schema.\n *\n * @param props - The `WrapIfAdditionalProps` for this component\n */\nexport default function WrapIfAdditionalTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any,\n>(props: WrapIfAdditionalTemplateProps<T, S, F>) {\n const {\n children,\n classNames,\n style,\n disabled,\n id,\n label,\n displayLabel,\n onKeyRenameBlur,\n onRemoveProperty,\n readonly,\n required,\n schema,\n uiSchema,\n registry,\n } = props;\n const { templates, translateString } = registry;\n // Button templates are not overridden in the uiSchema\n const { RemoveButton } = templates.ButtonTemplates;\n const keyLabel = translateString(TranslatableString.KeyLabel, [label]);\n const additional = ADDITIONAL_PROPERTY_FLAG in schema;\n const btnStyle: CSSProperties = {\n flex: 1,\n paddingLeft: 6,\n paddingRight: 6,\n fontWeight: 'bold',\n };\n\n const uiOptions = getUiOptions<T, S, F>(uiSchema);\n const { rjsfSlotProps: { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = {} } =\n getMuiProps<T, S, F, WrapIfAdditionalTemplateMuiProps>