@rjsf/core 5.20.0 → 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/components/Form.tsx", "../src/getDefaultRegistry.ts", "../src/components/fields/ArrayField.tsx", "../src/components/fields/BooleanField.tsx", "../src/components/fields/MultiSchemaField.tsx", "../src/components/fields/NumberField.tsx", "../src/components/fields/ObjectField.tsx", "../src/components/fields/SchemaField.tsx", "../src/components/fields/StringField.tsx", "../src/components/fields/NullField.tsx", "../src/components/fields/index.ts", "../src/components/templates/ArrayFieldDescriptionTemplate.tsx", "../src/components/templates/ArrayFieldItemTemplate.tsx", "../src/components/templates/ArrayFieldTemplate.tsx", "../src/components/templates/ArrayFieldTitleTemplate.tsx", "../src/components/templates/BaseInputTemplate.tsx", "../src/components/templates/ButtonTemplates/SubmitButton.tsx", "../src/components/templates/ButtonTemplates/AddButton.tsx", "../src/components/templates/ButtonTemplates/IconButton.tsx", "../src/components/templates/ButtonTemplates/index.ts", "../src/components/templates/DescriptionField.tsx", "../src/components/templates/ErrorList.tsx", "../src/components/templates/FieldTemplate/FieldTemplate.tsx", "../src/components/templates/FieldTemplate/Label.tsx", "../src/components/templates/FieldTemplate/index.ts", "../src/components/templates/FieldErrorTemplate.tsx", "../src/components/templates/FieldHelpTemplate.tsx", "../src/components/templates/ObjectFieldTemplate.tsx", "../src/components/templates/TitleField.tsx", "../src/components/templates/UnsupportedField.tsx", "../src/components/templates/WrapIfAdditionalTemplate.tsx", "../src/components/templates/index.ts", "../src/components/widgets/AltDateWidget.tsx", "../src/components/widgets/AltDateTimeWidget.tsx", "../src/components/widgets/CheckboxWidget.tsx", "../src/components/widgets/CheckboxesWidget.tsx", "../src/components/widgets/ColorWidget.tsx", "../src/components/widgets/DateWidget.tsx", "../src/components/widgets/DateTimeWidget.tsx", "../src/components/widgets/EmailWidget.tsx", "../src/components/widgets/FileWidget.tsx", "../src/components/widgets/HiddenWidget.tsx", "../src/components/widgets/PasswordWidget.tsx", "../src/components/widgets/RadioWidget.tsx", "../src/components/widgets/RangeWidget.tsx", "../src/components/widgets/SelectWidget.tsx", "../src/components/widgets/TextareaWidget.tsx", "../src/components/widgets/TextWidget.tsx", "../src/components/widgets/TimeWidget.tsx", "../src/components/widgets/URLWidget.tsx", "../src/components/widgets/UpDownWidget.tsx", "../src/components/widgets/index.ts", "../src/withTheme.tsx", "../src/index.ts"],
4
- "sourcesContent": ["import { Component, ElementType, FormEvent, ReactNode, Ref, RefObject, createRef } from 'react';\nimport {\n createSchemaUtils,\n CustomValidator,\n deepEquals,\n ErrorSchema,\n ErrorTransformer,\n FormContextType,\n GenericObjectType,\n getTemplate,\n getUiOptions,\n IdSchema,\n isObject,\n mergeObjects,\n NAME_KEY,\n PathSchema,\n StrictRJSFSchema,\n Registry,\n RegistryFieldsType,\n RegistryWidgetsType,\n RJSFSchema,\n RJSFValidationError,\n RJSF_ADDITIONAL_PROPERTIES_FLAG,\n SchemaUtilsType,\n shouldRender,\n SUBMIT_BTN_OPTIONS_KEY,\n TemplatesType,\n toErrorList,\n UiSchema,\n UI_GLOBAL_OPTIONS_KEY,\n UI_OPTIONS_KEY,\n ValidationData,\n validationDataMerge,\n ValidatorType,\n Experimental_DefaultFormStateBehavior,\n} from '@rjsf/utils';\nimport _forEach from 'lodash/forEach';\nimport _get from 'lodash/get';\nimport _isEmpty from 'lodash/isEmpty';\nimport _pick from 'lodash/pick';\nimport _toPath from 'lodash/toPath';\n\nimport getDefaultRegistry from '../getDefaultRegistry';\n\n/** The properties that are passed to the `Form` */\nexport interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {\n /** The JSON schema object for the form */\n schema: S;\n /** An implementation of the `ValidatorType` interface that is needed for form validation to work */\n validator: ValidatorType<T, S, F>;\n /** The optional children for the form, if provided, it will replace the default `SubmitButton` */\n children?: ReactNode;\n /** The uiSchema for the form */\n uiSchema?: UiSchema<T, S, F>;\n /** The data for the form, used to prefill a form with existing data */\n formData?: T;\n // Form presentation and behavior modifiers\n /** You can provide a `formContext` object to the form, which is passed down to all fields and widgets. Useful for\n * implementing context aware fields and widgets.\n *\n * NOTE: Setting `{readonlyAsDisabled: false}` on the formContext will make the antd theme treat readOnly fields as\n * disabled.\n */\n formContext?: F;\n /** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids;\n * Default is `root`\n */\n idPrefix?: string;\n /** To avoid using a path separator that is present in field names, it is possible to change the separator used for\n * ids (Default is `_`)\n */\n idSeparator?: string;\n /** It's possible to disable the whole form by setting the `disabled` prop. The `disabled` prop is then forwarded down\n * to each field of the form. If you just want to disable some fields, see the `ui:disabled` parameter in `uiSchema`\n */\n disabled?: boolean;\n /** It's possible to make the whole form read-only by setting the `readonly` prop. The `readonly` prop is then\n * forwarded down to each field of the form. If you just want to make some fields read-only, see the `ui:readonly`\n * parameter in `uiSchema`\n */\n readonly?: boolean;\n // Form registry\n /** The dictionary of registered fields in the form */\n fields?: RegistryFieldsType<T, S, F>;\n /** The dictionary of registered templates in the form; Partial allows a subset to be provided beyond the defaults */\n templates?: Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {\n ButtonTemplates?: Partial<TemplatesType<T, S, F>['ButtonTemplates']>;\n };\n /** The dictionary of registered widgets in the form */\n widgets?: RegistryWidgetsType<T, S, F>;\n // Callbacks\n /** If you plan on being notified every time the form data are updated, you can pass an `onChange` handler, which will\n * receive the same args as `onSubmit` any time a value is updated in the form. Can also return the `id` of the field\n * that caused the change\n */\n onChange?: (data: IChangeEvent<T, S, F>, id?: string) => void;\n /** To react when submitted form data are invalid, pass an `onError` handler. It will be passed the list of\n * encountered errors\n */\n onError?: (errors: RJSFValidationError[]) => void;\n /** You can pass a function as the `onSubmit` prop of your `Form` component to listen to when the form is submitted\n * and its data are valid. It will be passed a result object having a `formData` attribute, which is the valid form\n * data you're usually after. The original event will also be passed as a second parameter\n */\n onSubmit?: (data: IChangeEvent<T, S, F>, event: FormEvent<any>) => void;\n /** Sometimes you may want to trigger events or modify external state when a field has been touched, so you can pass\n * an `onBlur` handler, which will receive the id of the input that was blurred and the field value\n */\n onBlur?: (id: string, data: any) => void;\n /** Sometimes you may want to trigger events or modify external state when a field has been focused, so you can pass\n * an `onFocus` handler, which will receive the id of the input that is focused and the field value\n */\n onFocus?: (id: string, data: any) => void;\n // <form /> HTML attributes\n /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form\n * @deprecated replaced with `acceptCharset` which will supercede this value if both are specified\n */\n acceptcharset?: string;\n /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */\n acceptCharset?: string;\n /** The value of this prop will be passed to the `action` HTML attribute on the form\n *\n * NOTE: this just renders the `action` attribute in the HTML markup. There is no real network request being sent to\n * this `action` on submit. Instead, react-jsonschema-form catches the submit event with `event.preventDefault()`\n * and then calls the `onSubmit` function, where you could send a request programmatically with `fetch` or similar.\n */\n action?: string;\n /** The value of this prop will be passed to the `autocomplete` HTML attribute on the form */\n autoComplete?: string;\n /** The value of this prop will be passed to the `class` HTML attribute on the form */\n className?: string;\n /** The value of this prop will be passed to the `enctype` HTML attribute on the form */\n enctype?: string;\n /** The value of this prop will be passed to the `id` HTML attribute on the form */\n id?: string;\n /** The value of this prop will be passed to the `name` HTML attribute on the form */\n name?: string;\n /** The value of this prop will be passed to the `method` HTML attribute on the form */\n method?: string;\n /** It's possible to change the default `form` tag name to a different HTML tag, which can be helpful if you are\n * nesting forms. However, native browser form behaviour, such as submitting when the `Enter` key is pressed, may no\n * longer work\n */\n tagName?: ElementType;\n /** The value of this prop will be passed to the `target` HTML attribute on the form */\n target?: string;\n // Errors and validation\n /** Formerly the `validate` prop; Takes a function that specifies custom validation rules for the form */\n customValidate?: CustomValidator<T, S, F>;\n /** This prop allows passing in custom errors that are augmented with the existing JSON Schema errors on the form; it\n * can be used to implement asynchronous validation. By default, these are non-blocking errors, meaning that you can\n * still submit the form when these are the only errors displayed to the user.\n */\n extraErrors?: ErrorSchema<T>;\n /** If set to true, causes the `extraErrors` to become blocking when the form is submitted */\n extraErrorsBlockSubmit?: boolean;\n /** If set to true, turns off HTML5 validation on the form; Set to `false` by default */\n noHtml5Validate?: boolean;\n /** If set to true, turns off all validation. Set to `false` by default\n *\n * @deprecated - In a future release, this switch may be replaced by making `validator` prop optional\n */\n noValidate?: boolean;\n /** If set to true, the form will perform validation and show any validation errors whenever the form data is changed,\n * rather than just on submit\n */\n liveValidate?: boolean;\n /** If `omitExtraData` and `liveOmit` are both set to true, then extra form data values that are not in any form field\n * will be removed whenever `onChange` is called. Set to `false` by default\n */\n liveOmit?: boolean;\n /** If set to true, then extra form data values that are not in any form field will be removed whenever `onSubmit` is\n * called. Set to `false` by default.\n */\n omitExtraData?: boolean;\n /** When this prop is set to `top` or 'bottom', a list of errors (or the custom error list defined in the `ErrorList`) will also\n * show. When set to false, only inline input validation errors will be shown. Set to `top` by default\n */\n showErrorList?: false | 'top' | 'bottom';\n /** A function can be passed to this prop in order to make modifications to the default errors resulting from JSON\n * Schema validation\n */\n transformErrors?: ErrorTransformer<T, S, F>;\n /** If set to true, then the first field with an error will receive the focus when the form is submitted with errors\n */\n focusOnFirstError?: boolean | ((error: RJSFValidationError) => void);\n /** Optional string translation function, if provided, allows users to change the translation of the RJSF internal\n * strings. Some strings contain replaceable parameter values as indicated by `%1`, `%2`, etc. The number after the\n * `%` indicates the order of the parameter. The ordering of parameters is important because some languages may choose\n * to put the second parameter before the first in its translation.\n */\n translateString?: Registry['translateString'];\n /** Optional configuration object with flags, if provided, allows users to override default form state behavior\n * Currently only affecting minItems on array fields and handling of setting defaults based on the value of\n * `emptyObjectFields`\n */\n experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior;\n // Private\n /**\n * _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`\n * that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two\n * props: `children` and `as`. That component, at minimum, should render the `children` inside of a <form /> tag\n * unless `as` is provided, in which case, use the `as` prop in place of `<form />`.\n * i.e.:\n * ```\n * export default function InternalForm({ children, as }) {\n * const FormTag = as || 'form';\n * return <FormTag>{children}</FormTag>;\n * }\n * ```\n *\n * Use at your own risk as this prop is private and may change at any time without notice.\n */\n _internalFormWrapper?: ElementType;\n /** Support receiving a React ref to the Form\n */\n ref?: Ref<Form<T, S, F>>;\n}\n\n/** The data that is contained within the state for the `Form` */\nexport interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {\n /** The JSON schema object for the form */\n schema: S;\n /** The uiSchema for the form */\n uiSchema: UiSchema<T, S, F>;\n /** The `IdSchema` for the form, computed from the `schema`, the `rootFieldId`, the `formData` and the `idPrefix` and\n * `idSeparator` props.\n */\n idSchema: IdSchema<T>;\n /** The schemaUtils implementation used by the `Form`, created from the `validator` and the `schema` */\n schemaUtils: SchemaUtilsType<T, S, F>;\n /** The current data for the form, computed from the `formData` prop and the changes made by the user */\n formData?: T;\n /** Flag indicating whether the form is in edit mode, true when `formData` is passed to the form, otherwise false */\n edit: boolean;\n /** The current list of errors for the form, includes `extraErrors` */\n errors: RJSFValidationError[];\n /** The current errors, in `ErrorSchema` format, for the form, includes `extraErrors` */\n errorSchema: ErrorSchema<T>;\n /** The current list of errors for the form directly from schema validation, does NOT include `extraErrors` */\n schemaValidationErrors: RJSFValidationError[];\n /** The current errors, in `ErrorSchema` format, for the form directly from schema validation, does NOT include\n * `extraErrors`\n */\n schemaValidationErrorSchema: ErrorSchema<T>;\n // Private\n /** @description result of schemaUtils.retrieveSchema(schema, formData). This a memoized value to avoid re calculate at internal functions (getStateFromProps, onChange) */\n retrievedSchema: S;\n}\n\n/** The event data passed when changes have been made to the form, includes everything from the `FormState` except\n * the schema validation errors. An additional `status` is added when returned from `onSubmit`\n */\nexport interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>\n extends Omit<FormState<T, S, F>, 'schemaValidationErrors' | 'schemaValidationErrorSchema'> {\n /** The status of the form when submitted */\n status?: 'submitted';\n}\n\n/** The `Form` component renders the outer form and all the fields defined in the `schema` */\nexport default class Form<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n> extends Component<FormProps<T, S, F>, FormState<T, S, F>> {\n /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can\n * provide any possible type here\n */\n formElement: RefObject<any>;\n\n /** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the\n * `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the\n * state construction.\n *\n * @param props - The initial props for the `Form`\n */\n constructor(props: FormProps<T, S, F>) {\n super(props);\n\n if (!props.validator) {\n throw new Error('A validator is required for Form functionality to work');\n }\n\n this.state = this.getStateFromProps(props, props.formData);\n if (this.props.onChange && !deepEquals(this.state.formData, this.props.formData)) {\n this.props.onChange(this.state);\n }\n this.formElement = createRef();\n }\n\n /**\n * `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered\n * output is committed to the DOM. It enables your component to capture current values (e.g., scroll position) before\n * they are potentially changed.\n *\n * In this case, it checks if the props have changed since the last render. If they have, it computes the next state\n * of the component using `getStateFromProps` method and returns it along with a `shouldUpdate` flag set to `true` IF\n * the `nextState` and `prevState` are different, otherwise `false`. This ensures that we have the most up-to-date\n * state ready to be applied in `componentDidUpdate`.\n *\n * If `formData` hasn't changed, it simply returns an object with `shouldUpdate` set to `false`, indicating that a\n * state update is not necessary.\n *\n * @param prevProps - The previous set of props before the update.\n * @param prevState - The previous state before the update.\n * @returns Either an object containing the next state and a flag indicating that an update should occur, or an object\n * with a flag indicating that an update is not necessary.\n */\n getSnapshotBeforeUpdate(\n prevProps: FormProps<T, S, F>,\n prevState: FormState<T, S, F>\n ): { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false } {\n if (!deepEquals(this.props, prevProps)) {\n const isSchemaChanged = !deepEquals(prevProps.schema, this.props.schema);\n const isFormDataChanged = !deepEquals(prevProps.formData, this.props.formData);\n const nextState = this.getStateFromProps(\n this.props,\n this.props.formData,\n // If the `schema` has changed, we need to update the retrieved schema.\n // Or if the `formData` changes, for example in the case of a schema with dependencies that need to\n // match one of the subSchemas, the retrieved schema must be updated.\n isSchemaChanged || isFormDataChanged ? undefined : this.state.retrievedSchema,\n isSchemaChanged\n );\n const shouldUpdate = !deepEquals(nextState, prevState);\n return { nextState, shouldUpdate };\n }\n return { shouldUpdate: false };\n }\n\n /**\n * `componentDidUpdate` is a React lifecycle method that is invoked immediately after updating occurs. This method is\n * not called for the initial render.\n *\n * Here, it checks if an update is necessary based on the `shouldUpdate` flag received from `getSnapshotBeforeUpdate`.\n * If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about\n * changes.\n *\n * This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative\n * to handle prop changes and state updates.\n *\n * @param _ - The previous set of props.\n * @param prevState - The previous state of the component before the update.\n * @param snapshot - The value returned from `getSnapshotBeforeUpdate`.\n */\n componentDidUpdate(\n _: FormProps<T, S, F>,\n prevState: FormState<T, S, F>,\n snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false }\n ) {\n if (snapshot.shouldUpdate) {\n const { nextState } = snapshot;\n\n if (\n !deepEquals(nextState.formData, this.props.formData) &&\n !deepEquals(nextState.formData, prevState.formData) &&\n this.props.onChange\n ) {\n this.props.onChange(nextState);\n }\n this.setState(nextState);\n }\n }\n\n /** Extracts the updated state from the given `props` and `inputFormData`. As part of this process, the\n * `inputFormData` is first processed to add any missing required defaults. After that, the data is run through the\n * validation process IF required by the `props`.\n *\n * @param props - The props passed to the `Form`\n * @param inputFormData - The new or current data for the `Form`\n * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.\n * @param isSchemaChanged - A flag indicating whether the schema has changed.\n * @returns - The new state for the `Form`\n */\n getStateFromProps(\n props: FormProps<T, S, F>,\n inputFormData?: T,\n retrievedSchema?: S,\n isSchemaChanged = false\n ): FormState<T, S, F> {\n const state: FormState<T, S, F> = this.state || {};\n const schema = 'schema' in props ? props.schema : this.props.schema;\n const uiSchema: UiSchema<T, S, F> = ('uiSchema' in props ? props.uiSchema! : this.props.uiSchema!) || {};\n const edit = typeof inputFormData !== 'undefined';\n const liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;\n const mustValidate = edit && !props.noValidate && liveValidate;\n const rootSchema = schema;\n const experimental_defaultFormStateBehavior =\n 'experimental_defaultFormStateBehavior' in props\n ? props.experimental_defaultFormStateBehavior\n : this.props.experimental_defaultFormStateBehavior;\n let schemaUtils: SchemaUtilsType<T, S, F> = state.schemaUtils;\n if (\n !schemaUtils ||\n schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)\n ) {\n schemaUtils = createSchemaUtils<T, S, F>(props.validator, rootSchema, experimental_defaultFormStateBehavior);\n }\n const formData: T = schemaUtils.getDefaultFormState(schema, inputFormData) as T;\n const _retrievedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);\n\n const getCurrentErrors = (): ValidationData<T> => {\n // If the `props.noValidate` option is set or the schema has changed, we reset the error state.\n if (props.noValidate || isSchemaChanged) {\n return { errors: [], errorSchema: {} };\n } else if (!props.liveValidate) {\n return {\n errors: state.schemaValidationErrors || [],\n errorSchema: state.schemaValidationErrorSchema || {},\n };\n }\n return {\n errors: state.errors || [],\n errorSchema: state.errorSchema || {},\n };\n };\n\n let errors: RJSFValidationError[];\n let errorSchema: ErrorSchema<T> | undefined;\n let schemaValidationErrors: RJSFValidationError[] = state.schemaValidationErrors;\n let schemaValidationErrorSchema: ErrorSchema<T> = state.schemaValidationErrorSchema;\n if (mustValidate) {\n const schemaValidation = this.validate(formData, schema, schemaUtils, _retrievedSchema);\n errors = schemaValidation.errors;\n // If the schema has changed, we do not merge state.errorSchema.\n // Else in the case where it hasn't changed, we merge 'state.errorSchema' with 'schemaValidation.errorSchema.' This done to display the raised field error.\n if (isSchemaChanged) {\n errorSchema = schemaValidation.errorSchema;\n } else {\n errorSchema = mergeObjects(\n this.state?.errorSchema,\n schemaValidation.errorSchema,\n 'preventDuplicates'\n ) as ErrorSchema<T>;\n }\n schemaValidationErrors = errors;\n schemaValidationErrorSchema = errorSchema;\n } else {\n const currentErrors = getCurrentErrors();\n errors = currentErrors.errors;\n errorSchema = currentErrors.errorSchema;\n }\n if (props.extraErrors) {\n const merged = validationDataMerge({ errorSchema, errors }, props.extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n const idSchema = schemaUtils.toIdSchema(\n _retrievedSchema,\n uiSchema['ui:rootFieldId'],\n formData,\n props.idPrefix,\n props.idSeparator\n );\n const nextState: FormState<T, S, F> = {\n schemaUtils,\n schema,\n uiSchema,\n idSchema,\n formData,\n edit,\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n retrievedSchema: _retrievedSchema,\n };\n return nextState;\n }\n\n /** React lifecycle method that is used to determine whether component should be updated.\n *\n * @param nextProps - The next version of the props\n * @param nextState - The next version of the state\n * @returns - True if the component should be updated, false otherwise\n */\n shouldComponentUpdate(nextProps: FormProps<T, S, F>, nextState: FormState<T, S, F>): boolean {\n return shouldRender(this, nextProps, nextState);\n }\n\n /** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the\n * `schemaUtils` in the state), returning the results.\n *\n * @param formData - The new form data to validate\n * @param schema - The schema used to validate against\n * @param altSchemaUtils - The alternate schemaUtils to use for validation\n */\n validate(\n formData: T | undefined,\n schema = this.props.schema,\n altSchemaUtils?: SchemaUtilsType<T, S, F>,\n retrievedSchema?: S\n ): ValidationData<T> {\n const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;\n const { customValidate, transformErrors, uiSchema } = this.props;\n const resolvedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);\n return schemaUtils\n .getValidator()\n .validateFormData(formData, resolvedSchema, customValidate, transformErrors, uiSchema);\n }\n\n /** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */\n renderErrors(registry: Registry<T, S, F>) {\n const { errors, errorSchema, schema, uiSchema } = this.state;\n const { formContext } = this.props;\n const options = getUiOptions<T, S, F>(uiSchema);\n const ErrorListTemplate = getTemplate<'ErrorListTemplate', T, S, F>('ErrorListTemplate', registry, options);\n\n if (errors && errors.length) {\n return (\n <ErrorListTemplate\n errors={errors}\n errorSchema={errorSchema || {}}\n schema={schema}\n uiSchema={uiSchema}\n formContext={formContext}\n registry={registry}\n />\n );\n }\n return null;\n }\n\n /** Returns the `formData` with only the elements specified in the `fields` list\n *\n * @param formData - The data for the `Form`\n * @param fields - The fields to keep while filtering\n */\n getUsedFormData = (formData: T | undefined, fields: string[][]): T | undefined => {\n // For the case of a single input form\n if (fields.length === 0 && typeof formData !== 'object') {\n return formData;\n }\n\n // _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it\n const data: GenericObjectType = _pick(formData, fields as unknown as string[]);\n if (Array.isArray(formData)) {\n return Object.keys(data).map((key: string) => data[key]) as unknown as T;\n }\n\n return data as T;\n };\n\n /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`\n *\n * @param pathSchema - The `PathSchema` object for the form\n * @param [formData] - The form data to use while checking for empty objects/arrays\n */\n getFieldNames = (pathSchema: PathSchema<T>, formData?: T): string[][] => {\n const getAllPaths = (_obj: GenericObjectType, acc: string[][] = [], paths: string[][] = [[]]) => {\n Object.keys(_obj).forEach((key: string) => {\n if (typeof _obj[key] === 'object') {\n const newPaths = paths.map((path) => [...path, key]);\n // If an object is marked with additionalProperties, all its keys are valid\n if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') {\n acc.push(_obj[key][NAME_KEY]);\n } else {\n getAllPaths(_obj[key], acc, newPaths);\n }\n } else if (key === NAME_KEY && _obj[key] !== '') {\n paths.forEach((path) => {\n const formValue = _get(formData, path);\n // adds path to fieldNames if it points to a value\n // or an empty object/array\n if (\n typeof formValue !== 'object' ||\n _isEmpty(formValue) ||\n (Array.isArray(formValue) && formValue.every((val) => typeof val !== 'object'))\n ) {\n acc.push(path);\n }\n });\n }\n });\n return acc;\n };\n\n return getAllPaths(pathSchema);\n };\n\n /** Returns the `formData` after filtering to remove any extra data not in a form field\n *\n * @param formData - The data for the `Form`\n * @returns The `formData` after omitting extra data\n */\n omitExtraData = (formData?: T): T | undefined => {\n const { schema, schemaUtils } = this.state;\n const retrievedSchema = schemaUtils.retrieveSchema(schema, formData);\n const pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);\n const fieldNames = this.getFieldNames(pathSchema, formData);\n const newFormData = this.getUsedFormData(formData, fieldNames);\n return newFormData;\n };\n\n // Filtering errors based on your retrieved schema to only show errors for properties in the selected branch.\n private filterErrorsBasedOnSchema(schemaErrors: ErrorSchema<T>, resolvedSchema?: S, formData?: any): ErrorSchema<T> {\n const { retrievedSchema, schemaUtils } = this.state;\n const _retrievedSchema = resolvedSchema ?? retrievedSchema;\n const pathSchema = schemaUtils.toPathSchema(_retrievedSchema, '', formData);\n const fieldNames = this.getFieldNames(pathSchema, formData);\n const filteredErrors: ErrorSchema<T> = _pick(schemaErrors, fieldNames as unknown as string[]);\n // If the root schema is of a primitive type, do not filter out the __errors\n if (resolvedSchema?.type !== 'object' && resolvedSchema?.type !== 'array') {\n filteredErrors.__errors = schemaErrors.__errors;\n }\n // Removing undefined and empty errors.\n const filterUndefinedErrors = (errors: any): ErrorSchema<T> => {\n _forEach(errors, (errorAtKey, errorKey: keyof typeof errors) => {\n if (errorAtKey === undefined) {\n delete errors[errorKey];\n } else if (typeof errorAtKey === 'object' && !Array.isArray(errorAtKey.__errors)) {\n filterUndefinedErrors(errorAtKey);\n }\n });\n return errors;\n };\n return filterUndefinedErrors(filteredErrors);\n }\n\n /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the\n * `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and\n * then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not\n * in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new\n * updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`\n * callback will be called if specified with the updated state.\n *\n * @param formData - The new form data from a change to a field\n * @param newErrorSchema - The new `ErrorSchema` based on the field change\n * @param id - The id of the field that caused the change\n */\n onChange = (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;\n const { schemaUtils, schema, retrievedSchema } = this.state;\n\n if (isObject(formData) || Array.isArray(formData)) {\n const newState = this.getStateFromProps(this.props, formData, retrievedSchema);\n formData = newState.formData;\n }\n\n const mustValidate = !noValidate && liveValidate;\n let state: Partial<FormState<T, S, F>> = { formData, schema };\n let newFormData = formData;\n\n let _retrievedSchema: S | undefined;\n if (omitExtraData === true && liveOmit === true) {\n newFormData = this.omitExtraData(formData);\n state = {\n formData: newFormData,\n };\n }\n\n if (mustValidate) {\n const schemaValidation = this.validate(newFormData, schema, schemaUtils, retrievedSchema);\n let errors = schemaValidation.errors;\n let errorSchema = schemaValidation.errorSchema;\n const schemaValidationErrors = errors;\n const schemaValidationErrorSchema = errorSchema;\n if (extraErrors) {\n const merged = validationDataMerge(schemaValidation, extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n // Merging 'newErrorSchema' into 'errorSchema' to display the custom raised errors.\n if (newErrorSchema) {\n const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);\n errorSchema = mergeObjects(errorSchema, filteredErrors, 'preventDuplicates') as ErrorSchema<T>;\n }\n state = {\n formData: newFormData,\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n };\n } else if (!noValidate && newErrorSchema) {\n const errorSchema = extraErrors\n ? (mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') as ErrorSchema<T>)\n : newErrorSchema;\n state = {\n formData: newFormData,\n errorSchema: errorSchema,\n errors: toErrorList(errorSchema),\n };\n }\n if (_retrievedSchema) {\n state.retrievedSchema = _retrievedSchema;\n }\n this.setState(state as FormState<T, S, F>, () => onChange && onChange({ ...this.state, ...state }, id));\n };\n\n /**\n * Callback function to handle reset form data.\n * - Reset all fields with default values.\n * - Reset validations and errors\n *\n */\n reset = () => {\n const { onChange } = this.props;\n const newState = this.getStateFromProps(this.props, undefined);\n const newFormData = newState.formData;\n const state = {\n formData: newFormData,\n errorSchema: {},\n errors: [] as unknown,\n schemaValidationErrors: [] as unknown,\n schemaValidationErrorSchema: {},\n } as FormState<T, S, F>;\n\n this.setState(state, () => onChange && onChange({ ...this.state, ...state }));\n };\n\n /** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it\n * was provided.\n *\n * @param id - The unique `id` of the field that was blurred\n * @param data - The data associated with the field that was blurred\n */\n onBlur = (id: string, data: any) => {\n const { onBlur } = this.props;\n if (onBlur) {\n onBlur(id, data);\n }\n };\n\n /** Callback function to handle when a field on the form is focused. Calls the `onFocus` callback for the `Form` if it\n * was provided.\n *\n * @param id - The unique `id` of the field that was focused\n * @param data - The data associated with the field that was focused\n */\n onFocus = (id: string, data: any) => {\n const { onFocus } = this.props;\n if (onFocus) {\n onFocus(id, data);\n }\n };\n\n /** Callback function to handle when the form is submitted. First, it prevents the default event behavior. Nothing\n * happens if the target and currentTarget of the event are not the same. It will omit any extra data in the\n * `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors\n * via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call\n * back the `onSubmit` callback if it was provided.\n *\n * @param event - The submit HTML form event\n */\n onSubmit = (event: FormEvent<any>) => {\n event.preventDefault();\n if (event.target !== event.currentTarget) {\n return;\n }\n\n event.persist();\n const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;\n let { formData: newFormData } = this.state;\n\n if (omitExtraData === true) {\n newFormData = this.omitExtraData(newFormData);\n }\n\n if (noValidate || this.validateFormWithFormData(newFormData)) {\n // There are no errors generated through schema validation.\n // Check for user provided errors and update state accordingly.\n const errorSchema = extraErrors || {};\n const errors = extraErrors ? toErrorList(extraErrors) : [];\n this.setState(\n {\n formData: newFormData,\n errors,\n errorSchema,\n schemaValidationErrors: [],\n schemaValidationErrorSchema: {},\n },\n () => {\n if (onSubmit) {\n onSubmit({ ...this.state, formData: newFormData, status: 'submitted' }, event);\n }\n }\n );\n }\n };\n\n /** Returns the registry for the form */\n getRegistry(): Registry<T, S, F> {\n const { translateString: customTranslateString, uiSchema = {} } = this.props;\n const { schemaUtils } = this.state;\n const { fields, templates, widgets, formContext, translateString } = getDefaultRegistry<T, S, F>();\n return {\n fields: { ...fields, ...this.props.fields },\n templates: {\n ...templates,\n ...this.props.templates,\n ButtonTemplates: {\n ...templates.ButtonTemplates,\n ...this.props.templates?.ButtonTemplates,\n },\n },\n widgets: { ...widgets, ...this.props.widgets },\n rootSchema: this.props.schema,\n formContext: this.props.formContext || formContext,\n schemaUtils,\n translateString: customTranslateString || translateString,\n globalUiOptions: uiSchema[UI_GLOBAL_OPTIONS_KEY],\n };\n }\n\n /** Provides a function that can be used to programmatically submit the `Form` */\n submit = () => {\n if (this.formElement.current) {\n const submitCustomEvent = new CustomEvent('submit', {\n cancelable: true,\n });\n submitCustomEvent.preventDefault();\n this.formElement.current.dispatchEvent(submitCustomEvent);\n this.formElement.current.requestSubmit();\n }\n };\n\n /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error\n * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that\n * id is attempted to be found using the `formElement` ref. If it is located, then it is focused.\n *\n * @param error - The error on which to focus\n */\n focusOnError(error: RJSFValidationError) {\n const { idPrefix = 'root', idSeparator = '_' } = this.props;\n const { property } = error;\n const path = _toPath(property);\n if (path[0] === '') {\n // Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix\n path[0] = idPrefix;\n } else {\n // Otherwise insert the idPrefix into the first location using unshift\n path.unshift(idPrefix);\n }\n\n const elementId = path.join(idSeparator);\n let field = this.formElement.current.elements[elementId];\n if (!field) {\n // if not an exact match, try finding an input starting with the element id (like radio buttons or checkboxes)\n field = this.formElement.current.querySelector(`input[id^=${elementId}`);\n }\n if (field && field.length) {\n // If we got a list with length > 0\n field = field[0];\n }\n if (field) {\n field.focus();\n }\n }\n\n /** Validates the form using the given `formData`. For use on form submission or on programmatic validation.\n * If `onError` is provided, then it will be called with the list of errors.\n *\n * @param formData - The form data to validate\n * @returns - True if the form is valid, false otherwise.\n */\n validateFormWithFormData = (formData?: T): boolean => {\n const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;\n const { errors: prevErrors } = this.state;\n const schemaValidation = this.validate(formData);\n let errors = schemaValidation.errors;\n let errorSchema = schemaValidation.errorSchema;\n const schemaValidationErrors = errors;\n const schemaValidationErrorSchema = errorSchema;\n const hasError = errors.length > 0 || (extraErrors && extraErrorsBlockSubmit);\n if (hasError) {\n if (extraErrors) {\n const merged = validationDataMerge(schemaValidation, extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n if (focusOnFirstError) {\n if (typeof focusOnFirstError === 'function') {\n focusOnFirstError(errors[0]);\n } else {\n this.focusOnError(errors[0]);\n }\n }\n this.setState(\n {\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n },\n () => {\n if (onError) {\n onError(errors);\n } else {\n console.error('Form validation failed', errors);\n }\n }\n );\n } else if (prevErrors.length > 0) {\n this.setState({\n errors: [],\n errorSchema: {},\n schemaValidationErrors: [],\n schemaValidationErrorSchema: {},\n });\n }\n return !hasError;\n };\n\n /** Programmatically validate the form. If `omitExtraData` is true, the `formData` will first be filtered to remove\n * any extra data not in a form field. If `onError` is provided, then it will be called with the list of errors the\n * same way as would happen on form submission.\n *\n * @returns - True if the form is valid, false otherwise.\n */\n validateForm() {\n const { omitExtraData } = this.props;\n let { formData: newFormData } = this.state;\n if (omitExtraData === true) {\n newFormData = this.omitExtraData(newFormData);\n }\n return this.validateFormWithFormData(newFormData);\n }\n\n /** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if\n * needed along with the submit button or any children of the form.\n */\n render() {\n const {\n children,\n id,\n idPrefix,\n idSeparator,\n className = '',\n tagName,\n name,\n method,\n target,\n action,\n autoComplete,\n enctype,\n acceptcharset,\n acceptCharset,\n noHtml5Validate = false,\n disabled,\n readonly,\n formContext,\n showErrorList = 'top',\n _internalFormWrapper,\n } = this.props;\n\n const { schema, uiSchema, formData, errorSchema, idSchema } = this.state;\n const registry = this.getRegistry();\n const { SchemaField: _SchemaField } = registry.fields;\n const { SubmitButton } = registry.templates.ButtonTemplates;\n // The `semantic-ui` and `material-ui` themes have `_internalFormWrapper`s that take an `as` prop that is the\n // PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.\n // NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme\n const as = _internalFormWrapper ? tagName : undefined;\n const FormTag = _internalFormWrapper || tagName || 'form';\n\n let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions<T, S, F>(uiSchema);\n if (disabled) {\n submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };\n }\n const submitUiSchema = { [UI_OPTIONS_KEY]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };\n\n return (\n <FormTag\n className={className ? className : 'rjsf'}\n id={id}\n name={name}\n method={method}\n target={target}\n action={action}\n autoComplete={autoComplete}\n encType={enctype}\n acceptCharset={acceptCharset || acceptcharset}\n noValidate={noHtml5Validate}\n onSubmit={this.onSubmit}\n as={as}\n ref={this.formElement}\n >\n {showErrorList === 'top' && this.renderErrors(registry)}\n <_SchemaField\n name=''\n schema={schema}\n uiSchema={uiSchema}\n errorSchema={errorSchema}\n idSchema={idSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n formContext={formContext}\n formData={formData}\n onChange={this.onChange}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n />\n\n {children ? children : <SubmitButton uiSchema={submitUiSchema} registry={registry} />}\n {showErrorList === 'bottom' && this.renderErrors(registry)}\n </FormTag>\n );\n }\n}\n", "import { englishStringTranslator, FormContextType, Registry, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport fields from './components/fields';\nimport templates from './components/templates';\nimport widgets from './components/widgets';\n\n/** The default registry consists of all the fields, templates and widgets provided in the core implementation,\n * plus an empty `rootSchema` and `formContext. We omit schemaUtils here because it cannot be defaulted without a\n * rootSchema and validator. It will be added into the computed registry later in the Form.\n */\nexport default function getDefaultRegistry<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): Omit<Registry<T, S, F>, 'schemaUtils'> {\n return {\n fields: fields<T, S, F>(),\n templates: templates<T, S, F>(),\n widgets: widgets<T, S, F>(),\n rootSchema: {} as S,\n formContext: {} as F,\n translateString: englishStringTranslator,\n };\n}\n", "import { Component, MouseEvent } from 'react';\nimport {\n getTemplate,\n getWidget,\n getUiOptions,\n isFixedItems,\n allowAdditionalItems,\n isCustomWidget,\n optionsList,\n ArrayFieldTemplateProps,\n ErrorSchema,\n FieldProps,\n FormContextType,\n IdSchema,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UiSchema,\n ITEMS_KEY,\n} from '@rjsf/utils';\nimport cloneDeep from 'lodash/cloneDeep';\nimport get from 'lodash/get';\nimport isObject from 'lodash/isObject';\nimport set from 'lodash/set';\nimport { nanoid } from 'nanoid';\n\n/** Type used to represent the keyed form data used in the state */\ntype KeyedFormDataType<T> = { key: string; item: T };\n\n/** Type used for the state of the `ArrayField` component */\ntype ArrayFieldState<T> = {\n /** The keyed form data elements */\n keyedFormData: KeyedFormDataType<T>[];\n /** Flag indicating whether any of the keyed form data has been updated */\n updatedKeyedFormData: boolean;\n};\n\n/** Used to generate a unique ID for an element in a row */\nfunction generateRowId() {\n return nanoid();\n}\n\n/** Converts the `formData` into `KeyedFormDataType` data, using the `generateRowId()` function to create the key\n *\n * @param formData - The data for the form\n * @returns - The `formData` converted into a `KeyedFormDataType` element\n */\nfunction generateKeyedFormData<T>(formData: T[]): KeyedFormDataType<T>[] {\n return !Array.isArray(formData)\n ? []\n : formData.map((item) => {\n return {\n key: generateRowId(),\n item,\n };\n });\n}\n\n/** Converts `KeyedFormDataType` data into the inner `formData`\n *\n * @param keyedFormData - The `KeyedFormDataType` to be converted\n * @returns - The inner `formData` item(s) in the `keyedFormData`\n */\nfunction keyedToPlainFormData<T>(keyedFormData: KeyedFormDataType<T> | KeyedFormDataType<T>[]): T[] {\n if (Array.isArray(keyedFormData)) {\n return keyedFormData.map((keyedItem) => keyedItem.item);\n }\n return [];\n}\n\n/** The `ArrayField` component is used to render a field in the schema that is of type `array`. It supports both normal\n * and fixed array, allowing user to add and remove elements from the array data.\n */\nclass ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T[], S, F>,\n ArrayFieldState<T>\n> {\n /** Constructs an `ArrayField` from the `props`, generating the initial keyed data from the `formData`\n *\n * @param props - The `FieldProps` for this template\n */\n constructor(props: FieldProps<T[], S, F>) {\n super(props);\n const { formData = [] } = props;\n const keyedFormData = generateKeyedFormData<T>(formData);\n this.state = {\n keyedFormData,\n updatedKeyedFormData: false,\n };\n }\n\n /** React lifecycle method that is called when the props are about to change allowing the state to be updated. It\n * regenerates the keyed form data and returns it\n *\n * @param nextProps - The next set of props data\n * @param prevState - The previous set of state data\n */\n static getDerivedStateFromProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n nextProps: Readonly<FieldProps<T[], S, F>>,\n prevState: Readonly<ArrayFieldState<T>>\n ) {\n // Don't call getDerivedStateFromProps if keyed formdata was just updated.\n if (prevState.updatedKeyedFormData) {\n return {\n updatedKeyedFormData: false,\n };\n }\n const nextFormData = Array.isArray(nextProps.formData) ? nextProps.formData : [];\n const previousKeyedFormData = prevState.keyedFormData || [];\n const newKeyedFormData =\n nextFormData.length === previousKeyedFormData.length\n ? previousKeyedFormData.map((previousKeyedFormDatum, index) => {\n return {\n key: previousKeyedFormDatum.key,\n item: nextFormData[index],\n };\n })\n : generateKeyedFormData<T>(nextFormData);\n return {\n keyedFormData: newKeyedFormData,\n };\n }\n\n /** Returns the appropriate title for an item by getting first the title from the schema.items, then falling back to\n * the description from the schema.items, and finally the string \"Item\"\n */\n get itemTitle() {\n const { schema, registry } = this.props;\n const { translateString } = registry;\n return get(\n schema,\n [ITEMS_KEY, 'title'],\n get(schema, [ITEMS_KEY, 'description'], translateString(TranslatableString.ArrayItemTitle))\n );\n }\n\n /** Determines whether the item described in the schema is always required, which is determined by whether any item\n * may be null.\n *\n * @param itemSchema - The schema for the item\n * @return - True if the item schema type does not contain the \"null\" type\n */\n isItemRequired(itemSchema: S) {\n if (Array.isArray(itemSchema.type)) {\n // While we don't yet support composite/nullable jsonschema types, it's\n // future-proof to check for requirement against these.\n return !itemSchema.type.includes('null');\n }\n // All non-null array item types are inherently required by design\n return itemSchema.type !== 'null';\n }\n\n /** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding\n * then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the\n * `formData` matches that value, then false is returned, otherwise true is returned.\n *\n * @param formItems - The list of items in the form\n * @returns - True if the item is addable otherwise false\n */\n canAddItem(formItems: any[]) {\n const { schema, uiSchema, registry } = this.props;\n let { addable } = getUiOptions<T[], S, F>(uiSchema, registry.globalUiOptions);\n if (addable !== false) {\n // if ui:options.addable was not explicitly set to false, we can add\n // another item if we have not exceeded maxItems yet\n if (schema.maxItems !== undefined) {\n addable = formItems.length < schema.maxItems;\n } else {\n addable = true;\n }\n }\n return addable;\n }\n\n /** Returns the default form information for an item based on the schema for that item. Deals with the possibility\n * that the schema is fixed and allows additional items.\n */\n _getNewFormDataRow = (): T => {\n const { schema, registry } = this.props;\n const { schemaUtils } = registry;\n let itemSchema = schema.items as S;\n if (isFixedItems(schema) && allowAdditionalItems(schema)) {\n itemSchema = schema.additionalItems as S;\n }\n // Cast this as a T to work around schema utils being for T[] caused by the FieldProps<T[], S, F> call on the class\n return schemaUtils.getDefaultFormState(itemSchema) as unknown as T;\n };\n\n /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data\n * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into\n * the state, and then returning `onChange()` with the plain form data converted from the keyed data\n *\n * @param event - The event for the click\n * @param [index] - The optional index at which to add the new data\n */\n _handleAddClick(event: MouseEvent, index?: number) {\n if (event) {\n event.preventDefault();\n }\n\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (index === undefined || i < index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i >= index) {\n set(newErrorSchema, [i + 1], errorSchema[idx]);\n }\n }\n }\n\n const newKeyedFormDataRow: KeyedFormDataType<T> = {\n key: generateRowId(),\n item: this._getNewFormDataRow(),\n };\n const newKeyedFormData = [...keyedFormData];\n if (index !== undefined) {\n newKeyedFormData.splice(index, 0, newKeyedFormDataRow);\n } else {\n newKeyedFormData.push(newKeyedFormDataRow);\n }\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n }\n\n /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of\n * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the\n * keyed data\n *\n * @param event - The event for the click\n */\n onAddClick = (event: MouseEvent) => {\n this._handleAddClick(event);\n };\n\n /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of\n * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain\n * form data converted from the keyed data\n *\n * @param index - The index at which the add button is clicked\n */\n onAddIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n this._handleAddClick(event, index);\n };\n };\n\n /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of\n * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain\n * form data converted from the keyed data\n *\n * @param index - The index at which the copy button is clicked\n */\n onCopyIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n if (event) {\n event.preventDefault();\n }\n\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i <= index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i > index) {\n set(newErrorSchema, [i + 1], errorSchema[idx]);\n }\n }\n }\n\n const newKeyedFormDataRow: KeyedFormDataType<T> = {\n key: generateRowId(),\n item: cloneDeep(keyedFormData[index].item),\n };\n const newKeyedFormData = [...keyedFormData];\n if (index !== undefined) {\n newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);\n } else {\n newKeyedFormData.push(newKeyedFormDataRow);\n }\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of\n * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted\n * from the keyed data\n *\n * @param index - The index at which the remove button is clicked\n */\n onDropIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n if (event) {\n event.preventDefault();\n }\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i < index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i > index) {\n set(newErrorSchema, [i - 1], errorSchema[idx]);\n }\n }\n }\n const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the\n * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the\n * plain form data converted from the keyed data\n *\n * @param index - The index of the item to move\n * @param newIndex - The index to where the item is to be moved\n */\n onReorderClick = (index: number, newIndex: number) => {\n return (event: MouseEvent<HTMLButtonElement>) => {\n if (event) {\n event.preventDefault();\n event.currentTarget.blur();\n }\n const { onChange, errorSchema } = this.props;\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i == index) {\n set(newErrorSchema, [newIndex], errorSchema[index]);\n } else if (i == newIndex) {\n set(newErrorSchema, [index], errorSchema[newIndex]);\n } else {\n set(newErrorSchema, [idx], errorSchema[i]);\n }\n }\n }\n\n const { keyedFormData } = this.state;\n function reOrderArray() {\n // Copy item\n const _newKeyedFormData = keyedFormData.slice();\n\n // Moves item from index to newIndex\n _newKeyedFormData.splice(index, 1);\n _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);\n\n return _newKeyedFormData;\n }\n const newKeyedFormData = reOrderArray();\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the\n * `onChange` callback with the updated form data\n *\n * @param index - The index of the item being changed\n */\n onChangeForIndex = (index: number) => {\n return (value: any, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { formData, onChange, errorSchema } = this.props;\n const arrayData = Array.isArray(formData) ? formData : [];\n const newFormData = arrayData.map((item: T, i: number) => {\n // We need to treat undefined items as nulls to have validation.\n // See https://github.com/tdegrunt/jsonschema/issues/206\n const jsonValue = typeof value === 'undefined' ? null : value;\n return index === i ? jsonValue : item;\n });\n onChange(\n newFormData,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [index]: newErrorSchema,\n },\n id\n );\n };\n };\n\n /** Callback handler used to change the value for a checkbox */\n onSelectChange = (value: any) => {\n const { onChange, idSchema } = this.props;\n onChange(value, undefined, idSchema && idSchema.$id);\n };\n\n /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements\n */\n render() {\n const { schema, uiSchema, idSchema, registry } = this.props;\n const { schemaUtils, translateString } = registry;\n if (!(ITEMS_KEY in schema)) {\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T[], S, F>(\n 'UnsupportedFieldTemplate',\n registry,\n uiOptions\n );\n\n return (\n <UnsupportedFieldTemplate\n schema={schema}\n idSchema={idSchema}\n reason={translateString(TranslatableString.MissingItems)}\n registry={registry}\n />\n );\n }\n if (schemaUtils.isMultiSelect(schema)) {\n // If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.\n return this.renderMultiSelect();\n }\n if (isCustomWidget<T[], S, F>(uiSchema)) {\n return this.renderCustomWidget();\n }\n if (isFixedItems(schema)) {\n return this.renderFixedArray();\n }\n if (schemaUtils.isFilesArray(schema, uiSchema)) {\n return this.renderFiles();\n }\n return this.renderNormalArray();\n }\n\n /** Renders a normal array without any limitations of length\n */\n renderNormalArray() {\n const {\n schema,\n uiSchema = {},\n errorSchema,\n idSchema,\n name,\n title,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n registry,\n onBlur,\n onFocus,\n idPrefix,\n idSeparator = '_',\n rawErrors,\n } = this.props;\n const { keyedFormData } = this.state;\n const fieldTitle = schema.title || title || name;\n const { schemaUtils, formContext } = registry;\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const _schemaItems: S = isObject(schema.items) ? (schema.items as S) : ({} as S);\n const itemsSchema: S = schemaUtils.retrieveSchema(_schemaItems);\n const formData = keyedToPlainFormData(this.state.keyedFormData);\n const canAdd = this.canAddItem(formData);\n const arrayProps: ArrayFieldTemplateProps<T[], S, F> = {\n canAdd,\n items: keyedFormData.map((keyedItem, index) => {\n const { key, item } = keyedItem;\n // While we are actually dealing with a single item of type T, the types require a T[], so cast\n const itemCast = item as unknown as T[];\n const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);\n const itemErrorSchema = errorSchema ? (errorSchema[index] as ErrorSchema<T[]>) : undefined;\n const itemIdPrefix = idSchema.$id + idSeparator + index;\n const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);\n return this.renderArrayFieldItem({\n key,\n index,\n name: name && `${name}-${index}`,\n title: fieldTitle ? `${fieldTitle}-${index + 1}` : undefined,\n canAdd,\n canMoveUp: index > 0,\n canMoveDown: index < formData.length - 1,\n itemSchema,\n itemIdSchema,\n itemErrorSchema,\n itemData: itemCast,\n itemUiSchema: uiSchema.items,\n autofocus: autofocus && index === 0,\n onBlur,\n onFocus,\n rawErrors,\n totalItems: keyedFormData.length,\n });\n }),\n className: `field field-array field-array-of-${itemsSchema.type}`,\n disabled,\n idSchema,\n uiSchema,\n onAddClick: this.onAddClick,\n readonly,\n required,\n schema,\n title: fieldTitle,\n formContext,\n formData,\n rawErrors,\n registry,\n };\n\n const Template = getTemplate<'ArrayFieldTemplate', T[], S, F>('ArrayFieldTemplate', registry, uiOptions);\n return <Template {...arrayProps} />;\n }\n\n /** Renders an array using the custom widget provided by the user in the `uiSchema`\n */\n renderCustomWidget() {\n const {\n schema,\n idSchema,\n uiSchema,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n hideError,\n placeholder,\n onBlur,\n onFocus,\n formData: items = [],\n registry,\n rawErrors,\n name,\n } = this.props;\n const { widgets, formContext, globalUiOptions, schemaUtils } = registry;\n const { widget, title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n options={options}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n value={items}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n required={required}\n label={label}\n hideLabel={!displayLabel}\n placeholder={placeholder}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n }\n\n /** Renders an array as a set of checkboxes\n */\n renderMultiSelect() {\n const {\n schema,\n idSchema,\n uiSchema,\n formData: items = [],\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n placeholder,\n onBlur,\n onFocus,\n registry,\n rawErrors,\n name,\n } = this.props;\n const { widgets, schemaUtils, formContext, globalUiOptions } = registry;\n const itemsSchema = schemaUtils.retrieveSchema(schema.items as S, items);\n const enumOptions = optionsList<S, T[], F>(itemsSchema, uiSchema);\n const { widget = 'select', title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n value={items}\n disabled={disabled}\n readonly={readonly}\n required={required}\n label={label}\n hideLabel={!displayLabel}\n placeholder={placeholder}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n }\n\n /** Renders an array of files using the `FileWidget`\n */\n renderFiles() {\n const {\n schema,\n uiSchema,\n idSchema,\n name,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n onBlur,\n onFocus,\n registry,\n formData: items = [],\n rawErrors,\n } = this.props;\n const { widgets, formContext, globalUiOptions, schemaUtils } = registry;\n const { widget = 'files', title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n options={options}\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n schema={schema}\n uiSchema={uiSchema}\n value={items}\n disabled={disabled}\n readonly={readonly}\n required={required}\n registry={registry}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n label={label}\n hideLabel={!displayLabel}\n />\n );\n }\n\n /** Renders an array that has a maximum limit of items\n */\n renderFixedArray() {\n const {\n schema,\n uiSchema = {},\n formData = [],\n errorSchema,\n idPrefix,\n idSeparator = '_',\n idSchema,\n name,\n title,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n registry,\n onBlur,\n onFocus,\n rawErrors,\n } = this.props;\n const { keyedFormData } = this.state;\n let { formData: items = [] } = this.props;\n const fieldTitle = schema.title || title || name;\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const { schemaUtils, formContext } = registry;\n const _schemaItems: S[] = isObject(schema.items) ? (schema.items as S[]) : ([] as S[]);\n const itemSchemas = _schemaItems.map((item: S, index: number) =>\n schemaUtils.retrieveSchema(item, formData[index] as unknown as T[])\n );\n const additionalSchema = isObject(schema.additionalItems)\n ? schemaUtils.retrieveSchema(schema.additionalItems as S, formData)\n : null;\n\n if (!items || items.length < itemSchemas.length) {\n // to make sure at least all fixed items are generated\n items = items || [];\n items = items.concat(new Array(itemSchemas.length - items.length));\n }\n\n // These are the props passed into the render function\n const canAdd = this.canAddItem(items) && !!additionalSchema;\n const arrayProps: ArrayFieldTemplateProps<T[], S, F> = {\n canAdd,\n className: 'field field-array field-array-fixed-items',\n disabled,\n idSchema,\n formData,\n items: keyedFormData.map((keyedItem, index) => {\n const { key, item } = keyedItem;\n // While we are actually dealing with a single item of type T, the types require a T[], so cast\n const itemCast = item as unknown as T[];\n const additional = index >= itemSchemas.length;\n const itemSchema =\n (additional && isObject(schema.additionalItems)\n ? schemaUtils.retrieveSchema(schema.additionalItems as S, itemCast)\n : itemSchemas[index]) || {};\n const itemIdPrefix = idSchema.$id + idSeparator + index;\n const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);\n const itemUiSchema = additional\n ? uiSchema.additionalItems || {}\n : Array.isArray(uiSchema.items)\n ? uiSchema.items[index]\n : uiSchema.items || {};\n const itemErrorSchema = errorSchema ? (errorSchema[index] as ErrorSchema<T[]>) : undefined;\n\n return this.renderArrayFieldItem({\n key,\n index,\n name: name && `${name}-${index}`,\n title: fieldTitle ? `${fieldTitle}-${index + 1}` : undefined,\n canAdd,\n canRemove: additional,\n canMoveUp: index >= itemSchemas.length + 1,\n canMoveDown: additional && index < items.length - 1,\n itemSchema,\n itemData: itemCast,\n itemUiSchema,\n itemIdSchema,\n itemErrorSchema,\n autofocus: autofocus && index === 0,\n onBlur,\n onFocus,\n rawErrors,\n totalItems: keyedFormData.length,\n });\n }),\n onAddClick: this.onAddClick,\n readonly,\n required,\n registry,\n schema,\n uiSchema,\n title: fieldTitle,\n formContext,\n errorSchema,\n rawErrors,\n };\n\n const Template = getTemplate<'ArrayFieldTemplate', T[], S, F>('ArrayFieldTemplate', registry, uiOptions);\n return <Template {...arrayProps} />;\n }\n\n /** Renders the individual array item using a `SchemaField` along with the additional properties required to be send\n * back to the `ArrayFieldItemTemplate`.\n *\n * @param props - The props for the individual array item to be rendered\n */\n renderArrayFieldItem(props: {\n key: string;\n index: number;\n name: string;\n title: string | undefined;\n canAdd: boolean;\n canRemove?: boolean;\n canMoveUp: boolean;\n canMoveDown: boolean;\n itemSchema: S;\n itemData: T[];\n itemUiSchema: UiSchema<T[], S, F>;\n itemIdSchema: IdSchema<T[]>;\n itemErrorSchema?: ErrorSchema<T[]>;\n autofocus?: boolean;\n onBlur: FieldProps<T[], S, F>['onBlur'];\n onFocus: FieldProps<T[], S, F>['onFocus'];\n rawErrors?: string[];\n totalItems: number;\n }) {\n const {\n key,\n index,\n name,\n canAdd,\n canRemove = true,\n canMoveUp,\n canMoveDown,\n itemSchema,\n itemData,\n itemUiSchema,\n itemIdSchema,\n itemErrorSchema,\n autofocus,\n onBlur,\n onFocus,\n rawErrors,\n totalItems,\n title,\n } = props;\n const { disabled, hideError, idPrefix, idSeparator, readonly, uiSchema, registry, formContext } = this.props;\n const {\n fields: { ArraySchemaField, SchemaField },\n globalUiOptions,\n } = registry;\n const ItemSchemaField = ArraySchemaField || SchemaField;\n const { orderable = true, removable = true, copyable = false } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const has: { [key: string]: boolean } = {\n moveUp: orderable && canMoveUp,\n moveDown: orderable && canMoveDown,\n copy: copyable && canAdd,\n remove: removable && canRemove,\n toolbar: false,\n };\n has.toolbar = Object.keys(has).some((key: keyof typeof has) => has[key]);\n\n return {\n children: (\n <ItemSchemaField\n name={name}\n title={title}\n index={index}\n schema={itemSchema}\n uiSchema={itemUiSchema}\n formData={itemData}\n formContext={formContext}\n errorSchema={itemErrorSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n idSchema={itemIdSchema}\n required={this.isItemRequired(itemSchema)}\n onChange={this.onChangeForIndex(index)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n ),\n className: 'array-item',\n disabled,\n canAdd,\n hasCopy: has.copy,\n hasToolbar: has.toolbar,\n hasMoveUp: has.moveUp,\n hasMoveDown: has.moveDown,\n hasRemove: has.remove,\n index,\n totalItems,\n key,\n onAddIndexClick: this.onAddIndexClick,\n onCopyIndexClick: this.onCopyIndexClick,\n onDropIndexClick: this.onDropIndexClick,\n onReorderClick: this.onReorderClick,\n readonly,\n registry,\n schema: itemSchema,\n uiSchema: itemUiSchema,\n };\n }\n}\n\n/** `ArrayField` is `React.ComponentType<FieldProps<T[], S, F>>` (necessarily) but the `registry` requires things to be a\n * `Field` which is defined as `React.ComponentType<FieldProps<T, S, F>>`, so cast it to make `registry` happy.\n */\nexport default ArrayField;\n", "import {\n getWidget,\n getUiOptions,\n optionsList,\n FieldProps,\n FormContextType,\n EnumOptionsType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n} from '@rjsf/utils';\nimport isObject from 'lodash/isObject';\n\n/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the\n * two boolean values based on the various alternatives in the schema.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema,\n name,\n uiSchema,\n idSchema,\n formData,\n registry,\n required,\n disabled,\n readonly,\n hideError,\n autofocus,\n title,\n onChange,\n onFocus,\n onBlur,\n rawErrors,\n } = props;\n const { title: schemaTitle } = schema;\n const { widgets, formContext, translateString, globalUiOptions } = registry;\n const {\n widget = 'checkbox',\n title: uiTitle,\n // Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type\n label: displayLabel = true,\n ...options\n } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget(schema, widget, widgets);\n const yes = translateString(TranslatableString.YesLabel);\n const no = translateString(TranslatableString.NoLabel);\n let enumOptions: EnumOptionsType<S>[] | undefined;\n const label = uiTitle ?? schemaTitle ?? title ?? name;\n if (Array.isArray(schema.oneOf)) {\n enumOptions = optionsList<S, T, F>(\n {\n oneOf: schema.oneOf\n .map((option) => {\n if (isObject(option)) {\n return {\n ...option,\n title: option.title || (option.const === true ? yes : no),\n };\n }\n return undefined;\n })\n .filter((o: any) => o) as S[], // cast away the error that typescript can't grok is fixed\n } as unknown as S,\n uiSchema\n );\n } else {\n // We deprecated enumNames in v5. It's intentionally omitted from RSJFSchema type, so we need to cast here.\n const schemaWithEnumNames = schema as S & { enumNames?: string[] };\n const enums = schema.enum ?? [true, false];\n if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {\n enumOptions = [\n {\n value: enums[0],\n label: enums[0] ? yes : no,\n },\n {\n value: enums[1],\n label: enums[1] ? yes : no,\n },\n ];\n } else {\n enumOptions = optionsList<S, T, F>(\n {\n enum: enums,\n // NOTE: enumNames is deprecated, but still supported for now.\n enumNames: schemaWithEnumNames.enumNames,\n } as unknown as S,\n uiSchema\n );\n }\n }\n\n return (\n <Widget\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n id={idSchema.$id}\n name={name}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n label={label}\n hideLabel={!displayLabel}\n value={formData}\n required={required}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n registry={registry}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n}\n\nexport default BooleanField;\n", "import { Component } from 'react';\nimport get from 'lodash/get';\nimport isEmpty from 'lodash/isEmpty';\nimport omit from 'lodash/omit';\nimport {\n ANY_OF_KEY,\n deepEquals,\n ERRORS_KEY,\n FieldProps,\n FormContextType,\n getDiscriminatorFieldFromSchema,\n getUiOptions,\n getWidget,\n mergeSchemas,\n ONE_OF_KEY,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UiSchema,\n} from '@rjsf/utils';\n\n/** Type used for the state of the `AnyOfField` component */\ntype AnyOfFieldState<S extends StrictRJSFSchema = RJSFSchema> = {\n /** The currently selected option */\n selectedOption: number;\n /** The option schemas after retrieving all $refs */\n retrievedOptions: S[];\n};\n\n/** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks\n * the currently selected option and cleans up any irrelevant data in `formData`.\n *\n * @param props - The `FieldProps` for this template\n */\nclass AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>,\n AnyOfFieldState<S>\n> {\n /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state\n *\n * @param props - The `FieldProps` for this template\n */\n constructor(props: FieldProps<T, S, F>) {\n super(props);\n\n const {\n formData,\n options,\n registry: { schemaUtils },\n } = this.props;\n // cache the retrieved options in state in case they have $refs to save doing it later\n const retrievedOptions = options.map((opt: S) => schemaUtils.retrieveSchema(opt, formData));\n\n this.state = {\n retrievedOptions,\n selectedOption: this.getMatchingOption(0, formData, retrievedOptions),\n };\n }\n\n /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the\n * currently selected option based on the overall `formData`\n *\n * @param prevProps - The previous `FieldProps` for this template\n * @param prevState - The previous `AnyOfFieldState` for this template\n */\n componentDidUpdate(prevProps: Readonly<FieldProps<T, S, F>>, prevState: Readonly<AnyOfFieldState>) {\n const { formData, options, idSchema } = this.props;\n const { selectedOption } = this.state;\n let newState = this.state;\n if (!deepEquals(prevProps.options, options)) {\n const {\n registry: { schemaUtils },\n } = this.props;\n // re-cache the retrieved options in state in case they have $refs to save doing it later\n const retrievedOptions = options.map((opt: S) => schemaUtils.retrieveSchema(opt, formData));\n newState = { selectedOption, retrievedOptions };\n }\n if (!deepEquals(formData, prevProps.formData) && idSchema.$id === prevProps.idSchema.$id) {\n const { retrievedOptions } = newState;\n const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);\n\n if (prevState && matchingOption !== selectedOption) {\n newState = { selectedOption: matchingOption, retrievedOptions };\n }\n }\n if (newState !== this.state) {\n this.setState(newState);\n }\n }\n\n /** Determines the best matching option for the given `formData` and `options`.\n *\n * @param formData - The new formData\n * @param options - The list of options to choose from\n * @return - The index of the `option` that best matches the `formData`\n */\n getMatchingOption(selectedOption: number, formData: T | undefined, options: S[]) {\n const {\n schema,\n registry: { schemaUtils },\n } = this.props;\n\n const discriminator = getDiscriminatorFieldFromSchema<S>(schema);\n const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);\n return option;\n }\n\n /** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated\n * to remove properties that are not part of the newly selected option schema, and then the updated data is passed to\n * the `onChange` handler.\n *\n * @param option - The new option value being selected\n */\n onOptionChange = (option?: string) => {\n const { selectedOption, retrievedOptions } = this.state;\n const { formData, onChange, registry } = this.props;\n const { schemaUtils } = registry;\n const intOption = option !== undefined ? parseInt(option, 10) : -1;\n if (intOption === selectedOption) {\n return;\n }\n const newOption = intOption >= 0 ? retrievedOptions[intOption] : undefined;\n const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : undefined;\n\n let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);\n if (newFormData && newOption) {\n // Call getDefaultFormState to make sure defaults are populated on change. Pass \"excludeObjectChildren\"\n // so that only the root objects themselves are created without adding undefined children properties\n newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren') as T;\n }\n onChange(newFormData, undefined, this.getFieldId());\n\n this.setState({ selectedOption: intOption });\n };\n\n getFieldId() {\n const { idSchema, schema } = this.props;\n return `${idSchema.$id}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`;\n }\n\n /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`\n */\n render() {\n const {\n name,\n disabled = false,\n errorSchema = {},\n formContext,\n onBlur,\n onFocus,\n registry,\n schema,\n uiSchema,\n } = this.props;\n\n const { widgets, fields, translateString, globalUiOptions, schemaUtils } = registry;\n const { SchemaField: _SchemaField } = fields;\n const { selectedOption, retrievedOptions } = this.state;\n const {\n widget = 'select',\n placeholder,\n autofocus,\n autocomplete,\n title = schema.title,\n ...uiOptions\n } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T, S, F>({ type: 'number' }, widget, widgets);\n const rawErrors = get(errorSchema, ERRORS_KEY, []);\n const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n\n const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;\n let optionSchema: S | undefined | null;\n\n if (option) {\n // merge top level required field\n const { required } = schema;\n // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property\n optionSchema = required ? (mergeSchemas({ required }, option) as S) : option;\n }\n\n // First we will check to see if there is an anyOf/oneOf override for the UI schema\n let optionsUiSchema: UiSchema<T, S, F>[] = [];\n if (ONE_OF_KEY in schema && uiSchema && ONE_OF_KEY in uiSchema) {\n if (Array.isArray(uiSchema[ONE_OF_KEY])) {\n optionsUiSchema = uiSchema[ONE_OF_KEY];\n } else {\n console.warn(`uiSchema.oneOf is not an array for \"${title || name}\"`);\n }\n } else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {\n if (Array.isArray(uiSchema[ANY_OF_KEY])) {\n optionsUiSchema = uiSchema[ANY_OF_KEY];\n } else {\n console.warn(`uiSchema.anyOf is not an array for \"${title || name}\"`);\n }\n }\n // Then we pick the one that matches the selected option index, if one exists otherwise default to the main uiSchema\n let optionUiSchema = uiSchema;\n if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {\n optionUiSchema = optionsUiSchema[selectedOption];\n }\n\n const translateEnum: TranslatableString = title\n ? TranslatableString.TitleOptionPrefix\n : TranslatableString.OptionPrefix;\n const translateParams = title ? [title] : [];\n const enumOptions = retrievedOptions.map((opt: { title?: string }, index: number) => {\n // Also see if there is an override title in the uiSchema for each option, otherwise use the title from the option\n const { title: uiTitle = opt.title } = getUiOptions<T, S, F>(optionsUiSchema[index]);\n return {\n label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),\n value: index,\n };\n });\n\n return (\n <div className='panel panel-default panel-body'>\n <div className='form-group'>\n <Widget\n id={this.getFieldId()}\n name={`${name}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`}\n schema={{ type: 'number', default: 0 } as S}\n onChange={this.onOptionChange}\n onBlur={onBlur}\n onFocus={onFocus}\n disabled={disabled || isEmpty(enumOptions)}\n multiple={false}\n rawErrors={rawErrors}\n errorSchema={fieldErrorSchema}\n value={selectedOption >= 0 ? selectedOption : undefined}\n options={{ enumOptions, ...uiOptions }}\n registry={registry}\n formContext={formContext}\n placeholder={placeholder}\n autocomplete={autocomplete}\n autofocus={autofocus}\n label={title ?? name}\n hideLabel={!displayLabel}\n />\n </div>\n {optionSchema && <_SchemaField {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />}\n </div>\n );\n }\n}\n\nexport default AnyOfField;\n", "import { useState, useCallback } from 'react';\nimport { asNumber, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n// Matches a string that ends in a . character, optionally followed by a sequence of\n// digits followed by any number of 0 characters up until the end of the line.\n// Ensuring that there is at least one prefixed character is important so that\n// you don't incorrectly match against \"0\".\nconst trailingCharMatcherWithPrefix = /\\.([0-9]*0)*$/;\n\n// This is used for trimming the trailing 0 and . characters without affecting\n// the rest of the string. Its possible to use one RegEx with groups for this\n// functionality, but it is fairly complex compared to simply defining two\n// different matchers.\nconst trailingCharMatcher = /[0.]0*$/;\n\n/**\n * The NumberField class has some special handling for dealing with trailing\n * decimal points and/or zeroes. This logic is designed to allow trailing values\n * to be visible in the input element, but not be represented in the\n * corresponding form data.\n *\n * The algorithm is as follows:\n *\n * 1. When the input value changes the value is cached in the component state\n *\n * 2. The value is then normalized, removing trailing decimal points and zeros,\n * then passed to the \"onChange\" callback\n *\n * 3. When the component is rendered, the formData value is checked against the\n * value cached in the state. If it matches the cached value, the cached\n * value is passed to the input instead of the formData value\n */\nfunction NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const { registry, onChange, formData, value: initialValue } = props;\n const [lastValue, setLastValue] = useState(initialValue);\n const { StringField } = registry.fields;\n\n let value = formData;\n\n /** Handle the change from the `StringField` to properly convert to a number\n *\n * @param value - The current value for the change occurring\n */\n const handleChange = useCallback(\n (value: FieldProps<T, S, F>['value']) => {\n // Cache the original value in component state\n setLastValue(value);\n\n // Normalize decimals that don't start with a zero character in advance so\n // that the rest of the normalization logic is simpler\n if (`${value}`.charAt(0) === '.') {\n value = `0${value}`;\n }\n\n // Check that the value is a string (this can happen if the widget used is a\n // <select>, due to an enum declaration etc) then, if the value ends in a\n // trailing decimal point or multiple zeroes, strip the trailing values\n const processed =\n typeof value === 'string' && value.match(trailingCharMatcherWithPrefix)\n ? asNumber(value.replace(trailingCharMatcher, ''))\n : asNumber(value);\n\n onChange(processed as unknown as T);\n },\n [onChange]\n );\n\n if (typeof lastValue === 'string' && typeof value === 'number') {\n // Construct a regular expression that checks for a string that consists\n // of the formData value suffixed with zero or one '.' characters and zero\n // or more '0' characters\n const re = new RegExp(`^(${String(value).replace('.', '\\\\.')})?\\\\.?0*$`);\n\n // If the cached \"lastValue\" is a match, use that instead of the formData\n // value to prevent the input value from changing in the UI\n if (lastValue.match(re)) {\n value = lastValue as unknown as T;\n }\n }\n\n return <StringField {...props} formData={value} onChange={handleChange} />;\n}\n\nexport default NumberField;\n", "import { Component } from 'react';\nimport {\n getTemplate,\n getUiOptions,\n orderProperties,\n ErrorSchema,\n FieldProps,\n FormContextType,\n GenericObjectType,\n IdSchema,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n ADDITIONAL_PROPERTY_FLAG,\n PROPERTIES_KEY,\n REF_KEY,\n ANY_OF_KEY,\n ONE_OF_KEY,\n} from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\nimport get from 'lodash/get';\nimport has from 'lodash/has';\nimport isObject from 'lodash/isObject';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\n\n/** Type used for the state of the `ObjectField` component */\ntype ObjectFieldState = {\n /** Flag indicating whether an additional property key was modified */\n wasPropertyKeyModified: boolean;\n /** The set of additional properties */\n additionalProperties: object;\n};\n\n/** The `ObjectField` component is used to render a field in the schema that is of type `object`. It tracks whether an\n * additional property key was modified and what it was modified to\n *\n * @param props - The `FieldProps` for this template\n */\nclass ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>,\n ObjectFieldState\n> {\n /** Set up the initial state */\n state = {\n wasPropertyKeyModified: false,\n additionalProperties: {},\n };\n\n /** Returns a flag indicating whether the `name` field is required in the object schema\n *\n * @param name - The name of the field to check for required-ness\n * @returns - True if the field `name` is required, false otherwise\n */\n isRequired(name: string) {\n const { schema } = this.props;\n return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;\n }\n\n /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting\n * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated\n * formData.\n *\n * @param name - The name of the property\n * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property\n * @returns - The onPropertyChange callback for the `name` property\n */\n onPropertyChange = (name: string, addedByAdditionalProperties = false) => {\n return (value: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { formData, onChange, errorSchema } = this.props;\n if (value === undefined && addedByAdditionalProperties) {\n // Don't set value = undefined for fields added by\n // additionalProperties. Doing so removes them from the\n // formData, which causes them to completely disappear\n // (including the input field for the property name). Unlike\n // fields which are \"mandated\" by the schema, these fields can\n // be set to undefined by clicking a \"delete field\" button, so\n // set empty values to the empty string.\n value = '' as unknown as T;\n }\n const newFormData = { ...formData, [name]: value } as unknown as T;\n onChange(\n newFormData,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [name]: newErrorSchema,\n },\n id\n );\n };\n };\n\n /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data\n * and calls the `onChange` callback with it\n *\n * @param key - The key for which the drop callback is desired\n * @returns - The drop property click callback\n */\n onDropPropertyClick = (key: string) => {\n return (event: DragEvent) => {\n event.preventDefault();\n const { onChange, formData } = this.props;\n const copiedFormData = { ...formData } as T;\n unset(copiedFormData, key);\n onChange(copiedFormData);\n };\n };\n\n /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one\n * that is already not assigned is found.\n *\n * @param preferredKey - The preferred name of a new key\n * @param [formData] - The form data in which to check if the desired key already exists\n * @returns - The name of the next available key from `preferredKey`\n */\n getAvailableKey = (preferredKey: string, formData?: T) => {\n const { uiSchema, registry } = this.props;\n const { duplicateKeySuffixSeparator = '-' } = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n\n let index = 0;\n let newKey = preferredKey;\n while (has(formData, newKey)) {\n newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;\n }\n return newKey;\n };\n\n /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That\n * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.\n *\n * @param oldValue - The old value of a field\n * @returns - The key change callback function\n */\n onKeyChange = (oldValue: any) => {\n return (value: any, newErrorSchema: ErrorSchema<T>) => {\n if (oldValue === value) {\n return;\n }\n const { formData, onChange, errorSchema } = this.props;\n\n value = this.getAvailableKey(value, formData);\n const newFormData: GenericObjectType = {\n ...(formData as GenericObjectType),\n };\n const newKeys: GenericObjectType = { [oldValue]: value };\n const keyValues = Object.keys(newFormData).map((key) => {\n const newKey = newKeys[key] || key;\n return { [newKey]: newFormData[key] };\n });\n const renamedObj = Object.assign({}, ...keyValues);\n\n this.setState({ wasPropertyKeyModified: true });\n\n onChange(\n renamedObj,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [value]: newErrorSchema,\n }\n );\n };\n };\n\n /** Returns a default value to be used for a new additional schema property of the given `type`\n *\n * @param type - The type of the new additional schema property\n */\n getDefaultValue(type?: RJSFSchema['type']) {\n const {\n registry: { translateString },\n } = this.props;\n switch (type) {\n case 'array':\n return [];\n case 'boolean':\n return false;\n case 'null':\n return null;\n case 'number':\n return 0;\n case 'object':\n return {};\n case 'string':\n default:\n // We don't have a datatype for some reason (perhaps additionalProperties was true)\n return translateString(TranslatableString.NewStringDefault);\n }\n }\n\n /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new\n * default data for that field has been added to the formData.\n *\n * @param schema - The schema element to which the new property is being added\n */\n handleAddClick = (schema: S) => () => {\n if (!schema.additionalProperties) {\n return;\n }\n const { formData, onChange, registry } = this.props;\n const newFormData = { ...formData } as T;\n\n let type: RJSFSchema['type'] = undefined;\n let defaultValue: RJSFSchema['default'] = undefined;\n if (isObject(schema.additionalProperties)) {\n type = schema.additionalProperties.type;\n defaultValue = schema.additionalProperties.default;\n let apSchema = schema.additionalProperties;\n if (REF_KEY in apSchema) {\n const { schemaUtils } = registry;\n apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] } as S, formData);\n type = apSchema.type;\n defaultValue = apSchema.default;\n }\n if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {\n type = 'object';\n }\n }\n\n const newKey = this.getAvailableKey('newKey', newFormData);\n // Cast this to make the `set` work properly\n set(newFormData as GenericObjectType, newKey, defaultValue ?? this.getDefaultValue(type));\n\n onChange(newFormData);\n };\n\n /** Renders the `ObjectField` from the given props\n */\n render() {\n const {\n schema: rawSchema,\n uiSchema = {},\n formData,\n errorSchema,\n idSchema,\n name,\n required = false,\n disabled,\n readonly,\n hideError,\n idPrefix,\n idSeparator,\n onBlur,\n onFocus,\n registry,\n title,\n } = this.props;\n\n const { fields, formContext, schemaUtils, translateString, globalUiOptions } = registry;\n const { SchemaField } = fields;\n const schema: S = schemaUtils.retrieveSchema(rawSchema, formData);\n const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const { properties: schemaProperties = {} } = schema;\n\n const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;\n const description = uiOptions.description ?? schema.description;\n let orderedProperties: string[];\n try {\n const properties = Object.keys(schemaProperties);\n orderedProperties = orderProperties(properties, uiOptions.order);\n } catch (err) {\n return (\n <div>\n <p className='config-error' style={{ color: 'red' }}>\n <Markdown options={{ disableParsingRawHTML: true }}>\n {translateString(TranslatableString.InvalidObjectField, [name || 'root', (err as Error).message])}\n </Markdown>\n </p>\n <pre>{JSON.stringify(schema)}</pre>\n </div>\n );\n }\n\n const Template = getTemplate<'ObjectFieldTemplate', T, S, F>('ObjectFieldTemplate', registry, uiOptions);\n\n const templateProps = {\n // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`\n title: uiOptions.label === false ? '' : templateTitle,\n description: uiOptions.label === false ? undefined : description,\n properties: orderedProperties.map((name) => {\n const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);\n const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];\n const hidden = getUiOptions<T, S, F>(fieldUiSchema).widget === 'hidden';\n const fieldIdSchema: IdSchema<T> = get(idSchema, [name], {});\n\n return {\n content: (\n <SchemaField\n key={name}\n name={name}\n required={this.isRequired(name)}\n schema={get(schema, [PROPERTIES_KEY, name], {})}\n uiSchema={fieldUiSchema}\n errorSchema={get(errorSchema, name)}\n idSchema={fieldIdSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n formData={get(formData, name)}\n formContext={formContext}\n wasPropertyKeyModified={this.state.wasPropertyKeyModified}\n onKeyChange={this.onKeyChange(name)}\n onChange={this.onPropertyChange(name, addedByAdditionalProperties)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n onDropPropertyClick={this.onDropPropertyClick}\n />\n ),\n name,\n readonly,\n disabled,\n required,\n hidden,\n };\n }),\n readonly,\n disabled,\n required,\n idSchema,\n uiSchema,\n errorSchema,\n schema,\n formData,\n formContext,\n registry,\n };\n return <Template {...templateProps} onAddClick={this.handleAddClick} />;\n }\n}\n\nexport default ObjectField;\n", "import { useCallback, Component } from 'react';\nimport {\n ADDITIONAL_PROPERTY_FLAG,\n deepEquals,\n descriptionId,\n ErrorSchema,\n FieldProps,\n FieldTemplateProps,\n FormContextType,\n getSchemaType,\n getTemplate,\n getUiOptions,\n ID_KEY,\n IdSchema,\n mergeObjects,\n Registry,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UI_OPTIONS_KEY,\n UIOptionsType,\n} from '@rjsf/utils';\nimport isObject from 'lodash/isObject';\nimport omit from 'lodash/omit';\nimport Markdown from 'markdown-to-jsx';\n\n/** The map of component type to FieldName */\nconst COMPONENT_TYPES: { [key: string]: string } = {\n array: 'ArrayField',\n boolean: 'BooleanField',\n integer: 'NumberField',\n number: 'NumberField',\n object: 'ObjectField',\n string: 'StringField',\n null: 'NullField',\n};\n\n/** Computes and returns which `Field` implementation to return in order to render the field represented by the\n * `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no\n * appropriate `Field` implementation can be found then a wrapper around `UnsupportedFieldTemplate` is used.\n *\n * @param schema - The schema from which to obtain the type\n * @param uiOptions - The UI Options that may affect the component decision\n * @param idSchema - The id that is passed to the `UnsupportedFieldTemplate`\n * @param registry - The registry from which fields and templates are obtained\n * @returns - The `Field` component that is used to render the actual field data\n */\nfunction getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n schema: S,\n uiOptions: UIOptionsType<T, S, F>,\n idSchema: IdSchema<T>,\n registry: Registry<T, S, F>\n) {\n const field = uiOptions.field;\n const { fields, translateString } = registry;\n if (typeof field === 'function') {\n return field;\n }\n if (typeof field === 'string' && field in fields) {\n return fields[field];\n }\n\n const schemaType = getSchemaType(schema);\n const type: string = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';\n\n const schemaId = schema.$id;\n\n let componentName = COMPONENT_TYPES[type];\n if (schemaId && schemaId in fields) {\n componentName = schemaId;\n }\n\n // If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't\n // render a field and let the MultiSchemaField component handle the form display\n if (!componentName && (schema.anyOf || schema.oneOf)) {\n return () => null;\n }\n\n return componentName in fields\n ? fields[componentName]\n : () => {\n const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T, S, F>(\n 'UnsupportedFieldTemplate',\n registry,\n uiOptions\n );\n\n return (\n <UnsupportedFieldTemplate\n schema={schema}\n idSchema={idSchema}\n reason={translateString(TranslatableString.UnknownFieldType, [String(schema.type)])}\n registry={registry}\n />\n );\n };\n}\n\n/** The `SchemaFieldRender` component is the work-horse of react-jsonschema-form, determining what kind of real field to\n * render based on the `schema`, `uiSchema` and all the other props. It also deals with rendering the `anyOf` and\n * `oneOf` fields.\n *\n * @param props - The `FieldProps` for this component\n */\nfunction SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema: _schema,\n idSchema: _idSchema,\n uiSchema,\n formData,\n errorSchema,\n idPrefix,\n idSeparator,\n name,\n onChange,\n onKeyChange,\n onDropPropertyClick,\n required,\n registry,\n wasPropertyKeyModified = false,\n } = props;\n const { formContext, schemaUtils, globalUiOptions } = registry;\n const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const FieldTemplate = getTemplate<'FieldTemplate', T, S, F>('FieldTemplate', registry, uiOptions);\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n uiOptions\n );\n const FieldHelpTemplate = getTemplate<'FieldHelpTemplate', T, S, F>('FieldHelpTemplate', registry, uiOptions);\n const FieldErrorTemplate = getTemplate<'FieldErrorTemplate', T, S, F>('FieldErrorTemplate', registry, uiOptions);\n const schema = schemaUtils.retrieveSchema(_schema, formData);\n const fieldId = _idSchema[ID_KEY];\n const idSchema = mergeObjects(\n schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator),\n _idSchema\n ) as IdSchema<T>;\n\n /** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the\n * `onChange` chain if it is not already being provided from a deeper level in the hierarchy\n */\n const handleFieldComponentChange = useCallback(\n (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const theId = id || fieldId;\n return onChange(formData, newErrorSchema, theId);\n },\n [fieldId, onChange]\n );\n\n const FieldComponent = getFieldComponent<T, S, F>(schema, uiOptions, idSchema, registry);\n const disabled = Boolean(uiOptions.disabled ?? props.disabled);\n const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));\n const uiSchemaHideError = uiOptions.hideError;\n // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children\n const hideError = uiSchemaHideError === undefined ? props.hideError : Boolean(uiSchemaHideError);\n const autofocus = Boolean(uiOptions.autofocus ?? props.autofocus);\n if (Object.keys(schema).length === 0) {\n return null;\n }\n\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n\n const { __errors, ...fieldErrorSchema } = errorSchema || {};\n // See #439: uiSchema: Don't pass consumed class names or style to child components\n const fieldUiSchema = omit(uiSchema, ['ui:classNames', 'classNames', 'ui:style']);\n if (UI_OPTIONS_KEY in fieldUiSchema) {\n fieldUiSchema[UI_OPTIONS_KEY] = omit(fieldUiSchema[UI_OPTIONS_KEY], ['classNames', 'style']);\n }\n\n const field = (\n <FieldComponent\n {...props}\n onChange={handleFieldComponentChange}\n idSchema={idSchema}\n schema={schema}\n uiSchema={fieldUiSchema}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n autofocus={autofocus}\n errorSchema={fieldErrorSchema}\n formContext={formContext}\n rawErrors={__errors}\n />\n );\n\n const id = idSchema[ID_KEY];\n\n // If this schema has a title defined, but the user has set a new key/label, retain their input.\n let label;\n if (wasPropertyKeyModified) {\n label = name;\n } else {\n label =\n ADDITIONAL_PROPERTY_FLAG in schema\n ? name\n : uiOptions.title || props.schema.title || schema.title || props.title || name;\n }\n\n const description = uiOptions.description || props.schema.description || schema.description || '';\n\n const richDescription = uiOptions.enableMarkdownInDescription ? (\n <Markdown options={{ disableParsingRawHTML: true }}>{description}</Markdown>\n ) : (\n description\n );\n const help = uiOptions.help;\n const hidden = uiOptions.widget === 'hidden';\n\n const classNames = ['form-group', 'field', `field-${getSchemaType(schema)}`];\n if (!hideError && __errors && __errors.length > 0) {\n classNames.push('field-error has-error has-danger');\n }\n if (uiSchema?.classNames) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n \"'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.\"\n );\n }\n classNames.push(uiSchema.classNames);\n }\n if (uiOptions.classNames) {\n classNames.push(uiOptions.classNames);\n }\n\n const helpComponent = (\n <FieldHelpTemplate\n help={help}\n idSchema={idSchema}\n schema={schema}\n uiSchema={uiSchema}\n hasErrors={!hideError && __errors && __errors.length > 0}\n registry={registry}\n />\n );\n /*\n * AnyOf/OneOf errors handled by child schema\n * unless it can be rendered as select control\n */\n const errorsComponent =\n hideError || ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema)) ? undefined : (\n <FieldErrorTemplate\n errors={__errors}\n errorSchema={errorSchema}\n idSchema={idSchema}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n const fieldProps: Omit<FieldTemplateProps<T, S, F>, 'children'> = {\n description: (\n <DescriptionFieldTemplate\n id={descriptionId<T>(id)}\n description={richDescription}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n ),\n rawDescription: description,\n help: helpComponent,\n rawHelp: typeof help === 'string' ? help : undefined,\n errors: errorsComponent,\n rawErrors: hideError ? undefined : __errors,\n id,\n label,\n hidden,\n onChange,\n onKeyChange,\n onDropPropertyClick,\n required,\n disabled,\n readonly,\n hideError,\n displayLabel,\n classNames: classNames.join(' ').trim(),\n style: uiOptions.style,\n formContext,\n formData,\n schema,\n uiSchema,\n registry,\n };\n\n const _AnyOfField = registry.fields.AnyOfField;\n const _OneOfField = registry.fields.OneOfField;\n const isReplacingAnyOrOneOf = uiSchema?.['ui:field'] && uiSchema?.['ui:fieldReplacesAnyOrOneOf'] === true;\n\n return (\n <FieldTemplate {...fieldProps}>\n <>\n {field}\n {/*\n If the schema `anyOf` or 'oneOf' can be rendered as a select control, don't\n render the selection and let `StringField` component handle\n rendering\n */}\n {schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (\n <_AnyOfField\n name={name}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n errorSchema={errorSchema}\n formData={formData}\n formContext={formContext}\n idPrefix={idPrefix}\n idSchema={idSchema}\n idSeparator={idSeparator}\n onBlur={props.onBlur}\n onChange={props.onChange}\n onFocus={props.onFocus}\n options={schema.anyOf.map((_schema) =>\n schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)\n )}\n registry={registry}\n schema={schema}\n uiSchema={uiSchema}\n />\n )}\n {schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (\n <_OneOfField\n name={name}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n errorSchema={errorSchema}\n formData={formData}\n formContext={formContext}\n idPrefix={idPrefix}\n idSchema={idSchema}\n idSeparator={idSeparator}\n onBlur={props.onBlur}\n onChange={props.onChange}\n onFocus={props.onFocus}\n options={schema.oneOf.map((_schema) =>\n schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)\n )}\n registry={registry}\n schema={schema}\n uiSchema={uiSchema}\n />\n )}\n </>\n </FieldTemplate>\n );\n}\n\n/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes\n * and if so, calls the `SchemaFieldRender` component with the props.\n */\nclass SchemaField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>\n> {\n shouldComponentUpdate(nextProps: Readonly<FieldProps<T, S, F>>) {\n return !deepEquals(this.props, nextProps);\n }\n\n render() {\n return <SchemaFieldRender<T, S, F> {...this.props} />;\n }\n}\n\nexport default SchemaField;\n", "import {\n getWidget,\n getUiOptions,\n optionsList,\n hasWidget,\n FieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `StringField` component is used to render a schema field that represents a string type\n *\n * @param props - The `FieldProps` for this template\n */\nfunction StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema,\n name,\n uiSchema,\n idSchema,\n formData,\n required,\n disabled = false,\n readonly = false,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n registry,\n rawErrors,\n hideError,\n } = props;\n const { title, format } = schema;\n const { widgets, formContext, schemaUtils, globalUiOptions } = registry;\n const enumOptions = schemaUtils.isSelect(schema) ? optionsList<S, T, F>(schema, uiSchema) : undefined;\n let defaultWidget = enumOptions ? 'select' : 'text';\n if (format && hasWidget<T, S, F>(schema, format, widgets)) {\n defaultWidget = format;\n }\n const { widget = defaultWidget, placeholder = '', title: uiTitle, ...options } = getUiOptions<T, S, F>(uiSchema);\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n const label = uiTitle ?? title ?? name;\n const Widget = getWidget<T, S, F>(schema, widget, widgets);\n return (\n <Widget\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n id={idSchema.$id}\n name={name}\n label={label}\n hideLabel={!displayLabel}\n hideError={hideError}\n value={formData}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n required={required}\n disabled={disabled}\n readonly={readonly}\n formContext={formContext}\n autofocus={autofocus}\n registry={registry}\n placeholder={placeholder}\n rawErrors={rawErrors}\n />\n );\n}\n\nexport default StringField;\n", "import { useEffect } from 'react';\nimport { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The `NullField` component is used to render a field in the schema is null. It also ensures that the `formData` is\n * also set to null if it has no value.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction NullField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const { formData, onChange } = props;\n useEffect(() => {\n if (formData === undefined) {\n onChange(null as unknown as T);\n }\n }, [formData, onChange]);\n\n return null;\n}\n\nexport default NullField;\n", "import { Field, FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport ArrayField from './ArrayField';\nimport BooleanField from './BooleanField';\nimport MultiSchemaField from './MultiSchemaField';\nimport NumberField from './NumberField';\nimport ObjectField from './ObjectField';\nimport SchemaField from './SchemaField';\nimport StringField from './StringField';\nimport NullField from './NullField';\n\nfunction fields<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): RegistryFieldsType<T, S, F> {\n return {\n AnyOfField: MultiSchemaField,\n ArrayField: ArrayField as unknown as Field<T, S, F>,\n // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default\n BooleanField,\n NumberField,\n ObjectField,\n OneOfField: MultiSchemaField,\n SchemaField,\n StringField,\n NullField,\n };\n}\n\nexport default fields;\n", "import {\n descriptionId,\n getTemplate,\n getUiOptions,\n ArrayFieldDescriptionProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldDescriptionTemplate` component renders a `DescriptionFieldTemplate` with an `id` derived from\n * the `idSchema`.\n *\n * @param props - The `ArrayFieldDescriptionProps` for the component\n */\nexport default function ArrayFieldDescriptionTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldDescriptionProps<T, S, F>) {\n const { idSchema, description, registry, schema, uiSchema } = props;\n const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n const { label: displayLabel = true } = options;\n if (!description || !displayLabel) {\n return null;\n }\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n return (\n <DescriptionFieldTemplate\n id={descriptionId<T>(idSchema)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n}\n", "import { CSSProperties } from 'react';\nimport { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.\n *\n * @param props - The `ArrayFieldTemplateItemType` props for the component\n */\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldTemplateItemType<T, S, F>) {\n const {\n children,\n className,\n disabled,\n hasToolbar,\n hasMoveDown,\n hasMoveUp,\n hasRemove,\n hasCopy,\n index,\n onCopyIndexClick,\n onDropIndexClick,\n onReorderClick,\n readonly,\n registry,\n uiSchema,\n } = props;\n const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;\n const btnStyle: CSSProperties = {\n flex: 1,\n paddingLeft: 6,\n paddingRight: 6,\n fontWeight: 'bold',\n };\n return (\n <div className={className}>\n <div className={hasToolbar ? 'col-xs-9' : 'col-xs-12'}>{children}</div>\n {hasToolbar && (\n <div className='col-xs-3 array-item-toolbox'>\n <div\n className='btn-group'\n style={{\n display: 'flex',\n justifyContent: 'space-around',\n }}\n >\n {(hasMoveUp || hasMoveDown) && (\n <MoveUpButton\n style={btnStyle}\n disabled={disabled || readonly || !hasMoveUp}\n onClick={onReorderClick(index, index - 1)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {(hasMoveUp || hasMoveDown) && (\n <MoveDownButton\n style={btnStyle}\n disabled={disabled || readonly || !hasMoveDown}\n onClick={onReorderClick(index, index + 1)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {hasCopy && (\n <CopyButton\n style={btnStyle}\n disabled={disabled || readonly}\n onClick={onCopyIndexClick(index)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {hasRemove && (\n <RemoveButton\n style={btnStyle}\n disabled={disabled || readonly}\n onClick={onDropIndexClick(index)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n", "import {\n getTemplate,\n getUiOptions,\n ArrayFieldTemplateProps,\n ArrayFieldTemplateItemType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldTemplate` component is the template used to render all items in an array.\n *\n * @param props - The `ArrayFieldTemplateItemType` 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 className,\n disabled,\n idSchema,\n uiSchema,\n items,\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 ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(\n 'ArrayFieldItemTemplate',\n registry,\n uiOptions\n );\n const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(\n 'ArrayFieldTitleTemplate',\n registry,\n uiOptions\n );\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n return (\n <fieldset className={className} id={idSchema.$id}>\n <ArrayFieldTitleTemplate\n idSchema={idSchema}\n title={uiOptions.title || title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n <ArrayFieldDescriptionTemplate\n idSchema={idSchema}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n <div className='row array-item-list'>\n {items &&\n items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (\n <ArrayFieldItemTemplate key={key} {...itemProps} />\n ))}\n </div>\n {canAdd && (\n <AddButton\n className='array-item-add'\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n </fieldset>\n );\n}\n", "import {\n getTemplate,\n getUiOptions,\n titleId,\n ArrayFieldTitleProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TemplatesType,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from\n * the `idSchema`.\n *\n * @param props - The `ArrayFieldTitleProps` for the component\n */\nexport default function ArrayFieldTitleTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldTitleProps<T, S, F>) {\n const { idSchema, title, schema, uiSchema, required, registry } = props;\n const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n const { label: displayLabel = true } = options;\n if (!title || !displayLabel) {\n return null;\n }\n const TitleFieldTemplate: TemplatesType<T, S, F>['TitleFieldTemplate'] = getTemplate<'TitleFieldTemplate', T, S, F>(\n 'TitleFieldTemplate',\n registry,\n options\n );\n return (\n <TitleFieldTemplate\n id={titleId<T>(idSchema)}\n title={title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n}\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n BaseInputTemplateProps,\n examplesId,\n getInputProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\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 ...rest\n value,\n readonly,\n disabled,\n autofocus,\n onBlur,\n onFocus,\n onChange,\n onChangeOverride,\n options,\n schema,\n uiSchema,\n formContext,\n registry,\n rawErrors,\n type,\n hideLabel, // remove this from ...rest\n hideError, // remove this from ...rest\n ...rest\n } = props;\n\n // Note: since React 15.2.0 we can't forward unknown element attributes, so we\n // exclude the \"options\" and \"schema\" ones here.\n if (!id) {\n console.log('No id for', props);\n throw new Error(`no id for props ${JSON.stringify(props)}`);\n }\n const inputProps = {\n ...rest,\n ...getInputProps<T, S, F>(schema, type, options),\n };\n\n let inputValue;\n if (inputProps.type === 'number' || inputProps.type === 'integer') {\n inputValue = value || value === 0 ? value : '';\n } else {\n inputValue = value == null ? '' : value;\n }\n\n const _onChange = useCallback(\n ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onChange(value === '' ? options.emptyValue : value),\n [onChange, options]\n );\n const _onBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value),\n [onBlur, id]\n );\n const _onFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value),\n [onFocus, id]\n );\n\n return (\n <>\n <input\n id={id}\n name={id}\n className='form-control'\n readOnly={readonly}\n disabled={disabled}\n autoFocus={autofocus}\n value={inputValue}\n {...inputProps}\n list={schema.examples ? examplesId<T>(id) : undefined}\n onChange={onChangeOverride || _onChange}\n onBlur={_onBlur}\n onFocus={_onFocus}\n aria-describedby={ariaDescribedByIds<T>(id, !!schema.examples)}\n />\n {Array.isArray(schema.examples) && (\n <datalist key={`datalist_${id}`} id={examplesId<T>(id)}>\n {(schema.examples as string[])\n .concat(schema.default && !schema.examples.includes(schema.default) ? ([schema.default] as string[]) : [])\n .map((example: any) => {\n return <option key={example} value={example} />;\n })}\n </datalist>\n )}\n </>\n );\n}\n", "import { getSubmitButtonOptions, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';\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 return (\n <div>\n <button type='submit' {...submitButtonProps} className={`btn btn-info ${submitButtonProps.className || ''}`}>\n {submitText}\n </button>\n </div>\n );\n}\n", "import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';\n\nimport IconButton from './IconButton';\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 className,\n onClick,\n disabled,\n registry,\n}: IconButtonProps<T, S, F>) {\n const { translateString } = registry;\n return (\n <div className='row'>\n <p className={`col-xs-3 col-xs-offset-9 text-right ${className}`}>\n <IconButton\n iconType='info'\n icon='plus'\n className='btn-add col-xs-12'\n title={translateString(TranslatableString.AddButton)}\n onClick={onClick}\n disabled={disabled}\n registry={registry}\n />\n </p>\n </div>\n );\n}\n", "import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';\n\nexport default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>\n) {\n const { iconType = 'default', icon, className, uiSchema, registry, ...otherProps } = props;\n return (\n <button type='button' className={`btn btn-${iconType} ${className}`} {...otherProps}>\n <i className={`glyphicon glyphicon-${icon}`} />\n </button>\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 <IconButton\n title={translateString(TranslatableString.CopyButton)}\n className='array-item-copy'\n {...props}\n icon='copy'\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 <IconButton\n title={translateString(TranslatableString.MoveDownButton)}\n className='array-item-move-down'\n {...props}\n icon='arrow-down'\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 <IconButton\n title={translateString(TranslatableString.MoveUpButton)}\n className='array-item-move-up'\n {...props}\n icon='arrow-up'\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 {\n registry: { translateString },\n } = props;\n return (\n <IconButton\n title={translateString(TranslatableString.RemoveButton)}\n className='array-item-remove'\n {...props}\n iconType='danger'\n icon='remove'\n />\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';\n\nimport SubmitButton from './SubmitButton';\nimport AddButton from './AddButton';\nimport { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from './IconButton';\n\nfunction buttonTemplates<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): TemplatesType<T, S, F>['ButtonTemplates'] {\n return {\n SubmitButton,\n AddButton,\n CopyButton,\n MoveDownButton,\n MoveUpButton,\n RemoveButton,\n };\n}\n\nexport default buttonTemplates;\n", "import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 } = props;\n if (!description) {\n return null;\n }\n if (typeof description === 'string') {\n return (\n <p id={id} className='field-description'>\n {description}\n </p>\n );\n } else {\n return (\n <div id={id} className='field-description'>\n {description}\n </div>\n );\n }\n}\n", "import {\n ErrorListProps,\n FormContextType,\n RJSFValidationError,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n} from '@rjsf/utils';\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}: ErrorListProps<T, S, F>) {\n const { translateString } = registry;\n return (\n <div className='panel panel-danger errors'>\n <div className='panel-heading'>\n <h3 className='panel-title'>{translateString(TranslatableString.ErrorsLabel)}</h3>\n </div>\n <ul className='list-group'>\n {errors.map((error: RJSFValidationError, i: number) => {\n return (\n <li key={i} className='list-group-item text-danger'>\n {error.stack}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n", "import {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport Label from './Label';\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 { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;\n const uiOptions = getUiOptions(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(\n 'WrapIfAdditionalTemplate',\n registry,\n uiOptions\n );\n if (hidden) {\n return <div className='hidden'>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate {...props}>\n {displayLabel && <Label label={label} required={required} id={id} />}\n {displayLabel && description ? description : null}\n {children}\n {errors}\n {help}\n </WrapIfAdditionalTemplate>\n );\n}\n", "const REQUIRED_FIELD_SYMBOL = '*';\n\nexport type LabelProps = {\n /** The label for the field */\n label?: string;\n /** A boolean value stating if the field is required */\n required?: boolean;\n /** The id of the input field being labeled */\n id?: string;\n};\n\n/** Renders a label for a field\n *\n * @param props - The `LabelProps` for this component\n */\nexport default function Label(props: LabelProps) {\n const { label, required, id } = props;\n if (!label) {\n return null;\n }\n return (\n <label className='control-label' htmlFor={id}>\n {label}\n {required && <span className='required'>{REQUIRED_FIELD_SYMBOL}</span>}\n </label>\n );\n}\n", "import FieldTemplate from './FieldTemplate';\n\nexport default FieldTemplate;\n", "import { errorId, FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 = [], idSchema } = props;\n if (errors.length === 0) {\n return null;\n }\n const id = errorId<T>(idSchema);\n\n return (\n <div>\n <ul id={id} className='error-detail bs-callout bs-callout-info'>\n {errors\n .filter((elem) => !!elem)\n .map((error, index: number) => {\n return (\n <li className='text-danger' key={index}>\n {error}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n", "import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 { idSchema, help } = props;\n if (!help) {\n return null;\n }\n const id = helpId<T>(idSchema);\n if (typeof help === 'string') {\n return (\n <p id={id} className='help-block'>\n {help}\n </p>\n );\n }\n return (\n <div id={id} className='help-block'>\n {help}\n </div>\n );\n}\n", "import {\n FormContextType,\n ObjectFieldTemplatePropertyType,\n ObjectFieldTemplateProps,\n RJSFSchema,\n StrictRJSFSchema,\n canExpand,\n descriptionId,\n getTemplate,\n getUiOptions,\n titleId,\n} from '@rjsf/utils';\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 disabled,\n formData,\n idSchema,\n onAddClick,\n properties,\n readonly,\n registry,\n required,\n schema,\n title,\n uiSchema,\n } = props;\n const options = getUiOptions<T, S, F>(uiSchema);\n const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, options);\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n return (\n <fieldset id={idSchema.$id}>\n {title && (\n <TitleFieldTemplate\n id={titleId<T>(idSchema)}\n title={title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {description && (\n <DescriptionFieldTemplate\n id={descriptionId<T>(idSchema)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {properties.map((prop: ObjectFieldTemplatePropertyType) => prop.content)}\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 </fieldset>\n );\n}\n", "import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nconst REQUIRED_FIELD_SYMBOL = '*';\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, required } = props;\n return (\n <legend id={id}>\n {title}\n {required && <span className='required'>{REQUIRED_FIELD_SYMBOL}</span>}\n </legend>\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString, UnsupportedFieldProps } from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\n\n/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by\n * react-jsonschema-form.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction UnsupportedField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: UnsupportedFieldProps<T, S, F>\n) {\n const { schema, idSchema, reason, registry } = props;\n const { translateString } = registry;\n let translateEnum: TranslatableString = TranslatableString.UnsupportedField;\n const translateParams: string[] = [];\n if (idSchema && idSchema.$id) {\n translateEnum = TranslatableString.UnsupportedFieldWithId;\n translateParams.push(idSchema.$id);\n }\n if (reason) {\n translateEnum =\n translateEnum === TranslatableString.UnsupportedField\n ? TranslatableString.UnsupportedFieldWithReason\n : TranslatableString.UnsupportedFieldWithIdAndReason;\n translateParams.push(reason);\n }\n return (\n <div className='unsupported-field'>\n <p>\n <Markdown options={{ disableParsingRawHTML: true }}>{translateString(translateEnum, translateParams)}</Markdown>\n </p>\n {schema && <pre>{JSON.stringify(schema, null, 2)}</pre>}\n </div>\n );\n}\n\nexport default UnsupportedField;\n", "import {\n ADDITIONAL_PROPERTY_FLAG,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n WrapIfAdditionalTemplateProps,\n} from '@rjsf/utils';\n\nimport Label from './FieldTemplate/Label';\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 id,\n classNames,\n style,\n disabled,\n label,\n onKeyChange,\n onDropPropertyClick,\n readonly,\n required,\n schema,\n children,\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\n if (!additional) {\n return (\n <div className={classNames} style={style}>\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames} style={style}>\n <div className='row'>\n <div className='col-xs-5 form-additional'>\n <div className='form-group'>\n <Label label={keyLabel} required={required} id={`${id}-key`} />\n <input\n className='form-control'\n type='text'\n id={`${id}-key`}\n onBlur={({ target }) => onKeyChange(target && target.value)}\n defaultValue={label}\n />\n </div>\n </div>\n <div className='form-additional form-group col-xs-5'>{children}</div>\n <div className='col-xs-2'>\n <RemoveButton\n className='array-item-remove btn-block'\n style={{ border: '0' }}\n disabled={disabled || readonly}\n onClick={onDropPropertyClick(label)}\n uiSchema={uiSchema}\n registry={registry}\n />\n </div>\n </div>\n </div>\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';\n\nimport ArrayFieldDescriptionTemplate from './ArrayFieldDescriptionTemplate';\nimport ArrayFieldItemTemplate from './ArrayFieldItemTemplate';\nimport ArrayFieldTemplate from './ArrayFieldTemplate';\nimport ArrayFieldTitleTemplate from './ArrayFieldTitleTemplate';\nimport BaseInputTemplate from './BaseInputTemplate';\nimport ButtonTemplates from './ButtonTemplates';\nimport DescriptionField from './DescriptionField';\nimport ErrorList from './ErrorList';\nimport FieldTemplate from './FieldTemplate';\nimport FieldErrorTemplate from './FieldErrorTemplate';\nimport FieldHelpTemplate from './FieldHelpTemplate';\nimport ObjectFieldTemplate from './ObjectFieldTemplate';\nimport TitleField from './TitleField';\nimport UnsupportedField from './UnsupportedField';\nimport WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate';\n\nfunction templates<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): TemplatesType<\n T,\n S,\n F\n> {\n return {\n ArrayFieldDescriptionTemplate,\n ArrayFieldItemTemplate,\n ArrayFieldTemplate,\n ArrayFieldTitleTemplate,\n ButtonTemplates: ButtonTemplates<T, S, F>(),\n BaseInputTemplate,\n DescriptionFieldTemplate: DescriptionField,\n ErrorListTemplate: ErrorList,\n FieldTemplate,\n FieldErrorTemplate,\n FieldHelpTemplate,\n ObjectFieldTemplate,\n TitleFieldTemplate: TitleField,\n UnsupportedFieldTemplate: UnsupportedField,\n WrapIfAdditionalTemplate,\n };\n}\n\nexport default templates;\n", "import { MouseEvent, useCallback, useEffect, useReducer, useState } from 'react';\nimport {\n ariaDescribedByIds,\n dateRangeOptions,\n parseDateString,\n toDateString,\n DateObject,\n type DateElementFormat,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n WidgetProps,\n getDateElementProps,\n} from '@rjsf/utils';\n\nfunction readyForChange(state: DateObject) {\n return Object.values(state).every((value) => value !== -1);\n}\n\ntype DateElementProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<\n WidgetProps<T, S, F>,\n 'value' | 'name' | 'disabled' | 'readonly' | 'autofocus' | 'registry' | 'onBlur' | 'onFocus'\n> & {\n rootId: string;\n select: (property: keyof DateObject, value: any) => void;\n type: string;\n range: [number, number];\n};\n\nfunction DateElement<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n type,\n range,\n value,\n select,\n rootId,\n name,\n disabled,\n readonly,\n autofocus,\n registry,\n onBlur,\n onFocus,\n}: DateElementProps<T, S, F>) {\n const id = rootId + '_' + type;\n const { SelectWidget } = registry.widgets;\n return (\n <SelectWidget\n schema={{ type: 'integer' } as S}\n id={id}\n name={name}\n className='form-control'\n options={{ enumOptions: dateRangeOptions<S>(range[0], range[1]) }}\n placeholder={type}\n value={value}\n disabled={disabled}\n readonly={readonly}\n autofocus={autofocus}\n onChange={(value: any) => select(type as keyof DateObject, value)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n label=''\n aria-describedby={ariaDescribedByIds<T>(rootId)}\n />\n );\n}\n\n/** The `AltDateWidget` is an alternative widget for rendering date properties.\n * @param props - The `WidgetProps` for this component\n */\nfunction AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n time = false,\n disabled = false,\n readonly = false,\n autofocus = false,\n options,\n id,\n name,\n registry,\n onBlur,\n onFocus,\n onChange,\n value,\n}: WidgetProps<T, S, F>) {\n const { translateString } = registry;\n const [lastValue, setLastValue] = useState(value);\n const [state, setState] = useReducer((state: DateObject, action: Partial<DateObject>) => {\n return { ...state, ...action };\n }, parseDateString(value, time));\n\n useEffect(() => {\n const stateValue = toDateString(state, time);\n if (readyForChange(state) && stateValue !== value) {\n // The user changed the date to a new valid data via the comboboxes, so call onChange\n onChange(stateValue);\n } else if (lastValue !== value) {\n // We got a new value in the props\n setLastValue(value);\n setState(parseDateString(value, time));\n }\n }, [time, value, onChange, state, lastValue]);\n\n const handleChange = useCallback((property: keyof DateObject, value: string) => {\n setState({ [property]: value });\n }, []);\n\n const handleSetNow = useCallback(\n (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n if (disabled || readonly) {\n return;\n }\n const nextState = parseDateString(new Date().toJSON(), time);\n onChange(toDateString(nextState, time));\n },\n [disabled, readonly, time]\n );\n\n const handleClear = useCallback(\n (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n if (disabled || readonly) {\n return;\n }\n onChange(undefined);\n },\n [disabled, readonly, onChange]\n );\n\n return (\n <ul className='list-inline'>\n {getDateElementProps(\n state,\n time,\n options.yearsRange as [number, number] | undefined,\n options.format as DateElementFormat | undefined\n ).map((elemProps, i) => (\n <li className='list-inline-item' key={i}>\n <DateElement\n rootId={id}\n name={name}\n select={handleChange}\n {...elemProps}\n disabled={disabled}\n readonly={readonly}\n registry={registry}\n onBlur={onBlur}\n onFocus={onFocus}\n autofocus={autofocus && i === 0}\n />\n </li>\n ))}\n {(options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && (\n <li className='list-inline-item'>\n <a href='#' className='btn btn-info btn-now' onClick={handleSetNow}>\n {translateString(TranslatableString.NowLabel)}\n </a>\n </li>\n )}\n {(options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && (\n <li className='list-inline-item'>\n <a href='#' className='btn btn-warning btn-clear' onClick={handleClear}>\n {translateString(TranslatableString.ClearLabel)}\n </a>\n </li>\n )}\n </ul>\n );\n}\n\nexport default AltDateWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `AltDateTimeWidget` is an alternative widget for rendering datetime properties.\n * It uses the AltDateWidget for rendering, with the `time` prop set to true by default.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction AltDateTimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n time = true,\n ...props\n}: WidgetProps<T, S, F>) {\n const { AltDateWidget } = props.registry.widgets;\n return <AltDateWidget time={time} {...props} />;\n}\n\nexport default AltDateTimeWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n descriptionId,\n getTemplate,\n labelValue,\n schemaRequiresTrueValue,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `CheckBoxWidget` is a widget for rendering boolean properties.\n * It is typically used to represent a boolean.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction CheckboxWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n schema,\n uiSchema,\n options,\n id,\n value,\n disabled,\n readonly,\n label,\n hideLabel,\n autofocus = false,\n onBlur,\n onFocus,\n onChange,\n registry,\n}: WidgetProps<T, S, F>) {\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n // Because an unchecked checkbox will cause html5 validation to fail, only add\n // the \"required\" attribute if the field value must be \"true\", due to the\n // \"const\" or \"enum\" keywords\n const required = schemaRequiresTrueValue<S>(schema);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => onChange(event.target.checked),\n [onChange]\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => onBlur(id, event.target.checked),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => onFocus(id, event.target.checked),\n [onFocus, id]\n );\n const description = options.description ?? schema.description;\n\n return (\n <div className={`checkbox ${disabled || readonly ? 'disabled' : ''}`}>\n {!hideLabel && !!description && (\n <DescriptionFieldTemplate\n id={descriptionId<T>(id)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n <label>\n <input\n type='checkbox'\n id={id}\n name={id}\n checked={typeof value === 'undefined' ? false : value}\n required={required}\n disabled={disabled || readonly}\n autoFocus={autofocus}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n {labelValue(<span>{label}</span>, hideLabel)}\n </label>\n </div>\n );\n}\n\nexport default CheckboxWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsDeselectValue,\n enumOptionsIsSelected,\n enumOptionsSelectValue,\n enumOptionsValueForIndex,\n optionId,\n FormContextType,\n WidgetProps,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `CheckboxesWidget` is a widget for rendering checkbox groups.\n * It is typically used to represent an array of enums.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction CheckboxesWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n disabled,\n options: { inline = false, enumOptions, enumDisabled, emptyValue },\n value,\n autofocus = false,\n readonly,\n onChange,\n onBlur,\n onFocus,\n}: WidgetProps<T, S, F>) {\n const checkboxesValues = Array.isArray(value) ? value : [value];\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onBlur(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onFocus(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onFocus, id]\n );\n return (\n <div className='checkboxes' id={id}>\n {Array.isArray(enumOptions) &&\n enumOptions.map((option, index) => {\n const checked = enumOptionsIsSelected<S>(option.value, checkboxesValues);\n const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;\n const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.checked) {\n onChange(enumOptionsSelectValue<S>(index, checkboxesValues, enumOptions));\n } else {\n onChange(enumOptionsDeselectValue<S>(index, checkboxesValues, enumOptions));\n }\n };\n\n const checkbox = (\n <span>\n <input\n type='checkbox'\n id={optionId(id, index)}\n name={id}\n checked={checked}\n value={String(index)}\n disabled={disabled || itemDisabled || readonly}\n autoFocus={autofocus && index === 0}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n <span>{option.label}</span>\n </span>\n );\n return inline ? (\n <label key={index} className={`checkbox-inline ${disabledCls}`}>\n {checkbox}\n </label>\n ) : (\n <div key={index} className={`checkbox ${disabledCls}`}>\n <label>{checkbox}</label>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default CheckboxesWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is\n * either disabled or readonly.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { disabled, readonly, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='color' {...props} disabled={disabled || readonly} />;\n}\n", "import { useCallback } from 'react';\nimport { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms\n * the value to undefined when it is falsy during the `onChange` handling.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function DateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { onChange, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n const handleChange = useCallback((value: any) => onChange(value || undefined), [onChange]);\n\n return <BaseInputTemplate type='date' {...props} onChange={handleChange} />;\n}\n", "import {\n getTemplate,\n localToUTC,\n utcToLocal,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms\n * the value to/from utc using the appropriate utility functions.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function DateTimeWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: WidgetProps<T, S, F>) {\n const { onChange, value, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return (\n <BaseInputTemplate\n type='datetime-local'\n {...props}\n value={utcToLocal(value)}\n onChange={(value) => onChange(localToUTC(value))}\n />\n );\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `EmailWidget` component uses the `BaseInputTemplate` changing the type to `email`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function EmailWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='email' {...props} />;\n}\n", "import { ChangeEvent, useCallback, useMemo } from 'react';\nimport {\n dataURItoBlob,\n FormContextType,\n getTemplate,\n Registry,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UIOptionsType,\n WidgetProps,\n} from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\n\nfunction addNameToDataURL(dataURL: string, name: string) {\n if (dataURL === null) {\n return null;\n }\n return dataURL.replace(';base64', `;name=${encodeURIComponent(name)};base64`);\n}\n\ntype FileInfoType = {\n dataURL?: string | null;\n name: string;\n size: number;\n type: string;\n};\n\nfunction processFile(file: File): Promise<FileInfoType> {\n const { name, size, type } = file;\n return new Promise((resolve, reject) => {\n const reader = new window.FileReader();\n reader.onerror = reject;\n reader.onload = (event) => {\n if (typeof event.target?.result === 'string') {\n resolve({\n dataURL: addNameToDataURL(event.target.result, name),\n name,\n size,\n type,\n });\n } else {\n resolve({\n dataURL: null,\n name,\n size,\n type,\n });\n }\n };\n reader.readAsDataURL(file);\n });\n}\n\nfunction processFiles(files: FileList) {\n return Promise.all(Array.from(files).map(processFile));\n}\n\nfunction FileInfoPreview<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n fileInfo,\n registry,\n}: {\n fileInfo: FileInfoType;\n registry: Registry<T, S, F>;\n}) {\n const { translateString } = registry;\n const { dataURL, type, name } = fileInfo;\n if (!dataURL) {\n return null;\n }\n\n // If type is JPEG or PNG then show image preview.\n // Originally, any type of image was supported, but this was changed into a whitelist\n // since SVGs and animated GIFs are also images, which are generally considered a security risk.\n if (['image/jpeg', 'image/png'].includes(type)) {\n return <img src={dataURL} style={{ maxWidth: '100%' }} className='file-preview' />;\n }\n\n // otherwise, let users download file\n\n return (\n <>\n {' '}\n <a download={`preview-${name}`} href={dataURL} className='file-download'>\n {translateString(TranslatableString.PreviewLabel)}\n </a>\n </>\n );\n}\n\nfunction FilesInfo<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n filesInfo,\n registry,\n preview,\n onRemove,\n options,\n}: {\n filesInfo: FileInfoType[];\n registry: Registry<T, S, F>;\n preview?: boolean;\n onRemove: (index: number) => void;\n options: UIOptionsType<T, S, F>;\n}) {\n if (filesInfo.length === 0) {\n return null;\n }\n const { translateString } = registry;\n\n const { RemoveButton } = getTemplate<'ButtonTemplates', T, S, F>('ButtonTemplates', registry, options);\n\n return (\n <ul className='file-info'>\n {filesInfo.map((fileInfo, key) => {\n const { name, size, type } = fileInfo;\n const handleRemove = () => onRemove(key);\n return (\n <li key={key}>\n <Markdown>{translateString(TranslatableString.FilesInfo, [name, type, String(size)])}</Markdown>\n {preview && <FileInfoPreview<T, S, F> fileInfo={fileInfo} registry={registry} />}\n <RemoveButton onClick={handleRemove} registry={registry} />\n </li>\n );\n })}\n </ul>\n );\n}\n\nfunction extractFileInfo(dataURLs: string[]): FileInfoType[] {\n return dataURLs.reduce((acc, dataURL) => {\n if (!dataURL) {\n return acc;\n }\n try {\n const { blob, name } = dataURItoBlob(dataURL);\n return [\n ...acc,\n {\n dataURL,\n name: name,\n size: blob.size,\n type: blob.type,\n },\n ];\n } catch (e) {\n // Invalid dataURI, so just ignore it.\n return acc;\n }\n }, [] as FileInfoType[]);\n}\n\n/**\n * The `FileWidget` is a widget for rendering file upload fields.\n * It is typically used with a string property with data-url format.\n */\nfunction FileWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!event.target.files) {\n return;\n }\n // Due to variances in themes, dealing with multiple files for the array case now happens one file at a time.\n // This is because we don't pass `multiple` into the `BaseInputTemplate` anymore. Instead, we deal with the single\n // file in each event and concatenate them together ourselves\n processFiles(event.target.files).then((filesInfoEvent) => {\n const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);\n if (multiple) {\n onChange(value.concat(newValue[0]));\n } else {\n onChange(newValue[0]);\n }\n });\n },\n [multiple, value, onChange]\n );\n\n const filesInfo = useMemo(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);\n const rmFile = useCallback(\n (index: number) => {\n if (multiple) {\n const newValue = value.filter((_: any, i: number) => i !== index);\n onChange(newValue);\n } else {\n onChange(undefined);\n }\n },\n [multiple, value, onChange]\n );\n return (\n <div>\n <BaseInputTemplate\n {...props}\n disabled={disabled || readonly}\n type='file'\n required={value ? false : required} // this turns off HTML required validation when a value exists\n onChangeOverride={handleChange}\n value=''\n accept={options.accept ? String(options.accept) : undefined}\n />\n <FilesInfo<T, S, F>\n filesInfo={filesInfo}\n onRemove={rmFile}\n registry={registry}\n preview={options.filePreview}\n options={options}\n />\n </div>\n );\n}\n\nexport default FileWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `HiddenWidget` is a widget for rendering a hidden input field.\n * It is typically used by setting type to \"hidden\".\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction HiddenWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n value,\n}: WidgetProps<T, S, F>) {\n return <input type='hidden' id={id} name={id} value={typeof value === 'undefined' ? '' : value} />;\n}\n\nexport default HiddenWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `PasswordWidget` component uses the `BaseInputTemplate` changing the type to `password`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function PasswordWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: WidgetProps<T, S, F>) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='password' {...props} />;\n}\n", "import { FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsIsSelected,\n enumOptionsValueForIndex,\n optionId,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `RadioWidget` is a widget for rendering a radio group.\n * It is typically used with a string property constrained with enum options.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n options,\n value,\n required,\n disabled,\n readonly,\n autofocus = false,\n onBlur,\n onFocus,\n onChange,\n id,\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled, inline, emptyValue } = options;\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onBlur(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onFocus(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onFocus, id]\n );\n\n return (\n <div className='field-radio-group' id={id}>\n {Array.isArray(enumOptions) &&\n enumOptions.map((option, i) => {\n const checked = enumOptionsIsSelected<S>(option.value, value);\n const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;\n const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';\n\n const handleChange = () => onChange(option.value);\n\n const radio = (\n <span>\n <input\n type='radio'\n id={optionId(id, i)}\n checked={checked}\n name={id}\n required={required}\n value={String(i)}\n disabled={disabled || itemDisabled || readonly}\n autoFocus={autofocus && i === 0}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n <span>{option.label}</span>\n </span>\n );\n\n return inline ? (\n <label key={i} className={`radio-inline ${disabledCls}`}>\n {radio}\n </label>\n ) : (\n <div key={i} className={`radio ${disabledCls}`}>\n <label>{radio}</label>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RadioWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result\n * in a div, with the value along side it.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const {\n value,\n registry: {\n templates: { BaseInputTemplate },\n },\n } = props;\n return (\n <div className='field-range-wrapper'>\n <BaseInputTemplate type='range' {...props} />\n <span className='range-view'>{value}</span>\n </div>\n );\n}\n", "import { ChangeEvent, FocusEvent, SyntheticEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsIndexForValue,\n enumOptionsValueForIndex,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\nfunction getValue(event: SyntheticEvent<HTMLSelectElement>, multiple: boolean) {\n if (multiple) {\n return Array.from((event.target as HTMLSelectElement).options)\n .slice()\n .filter((o) => o.selected)\n .map((o) => o.value);\n }\n return (event.target as HTMLSelectElement).value;\n}\n\n/** The `SelectWidget` is a widget for rendering dropdowns.\n * It is typically used with string properties constrained with enum options.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n schema,\n id,\n options,\n value,\n required,\n disabled,\n readonly,\n multiple = false,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n placeholder,\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;\n const emptyValue = multiple ? [] : '';\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onFocus(id, enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onFocus, id, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onBlur(id, enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onBlur, id, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onChange(enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onChange, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const selectedIndexes = enumOptionsIndexForValue<S>(value, enumOptions, multiple);\n const showPlaceholderOption = !multiple && schema.default === undefined;\n\n return (\n <select\n id={id}\n name={id}\n multiple={multiple}\n className='form-control'\n value={typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes}\n required={required}\n disabled={disabled || readonly}\n autoFocus={autofocus}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onChange={handleChange}\n aria-describedby={ariaDescribedByIds<T>(id)}\n >\n {showPlaceholderOption && <option value=''>{placeholder}</option>}\n {Array.isArray(enumOptions) &&\n enumOptions.map(({ value, label }, i) => {\n const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;\n return (\n <option key={i} value={String(i)} disabled={disabled}>\n {label}\n </option>\n );\n })}\n </select>\n );\n}\n\nexport default SelectWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TextareaWidget` is a widget for rendering input fields as textarea.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction TextareaWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n options = {},\n placeholder,\n value,\n required,\n disabled,\n readonly,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n}: WidgetProps<T, S, F>) {\n const handleChange = useCallback(\n ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) => onChange(value === '' ? options.emptyValue : value),\n [onChange, options.emptyValue]\n );\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLTextAreaElement>) => onBlur(id, target && target.value),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLTextAreaElement>) => onFocus(id, target && target.value),\n [id, onFocus]\n );\n\n return (\n <textarea\n id={id}\n name={id}\n className='form-control'\n value={value ? value : ''}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n readOnly={readonly}\n autoFocus={autofocus}\n rows={options.rows}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onChange={handleChange}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n );\n}\n\nTextareaWidget.defaultProps = {\n autofocus: false,\n options: {},\n};\n\nexport default TextareaWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TextWidget` component uses the `BaseInputTemplate`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function TextWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate {...props} />;\n}\n", "import { useCallback } from 'react';\nimport { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TimeWidget` component uses the `BaseInputTemplate` changing the type to `time` and transforms\n * the value to undefined when it is falsy during the `onChange` handling.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function TimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { onChange, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n const handleChange = useCallback((value: any) => onChange(value ? `${value}:00` : undefined), [onChange]);\n\n return <BaseInputTemplate type='time' {...props} onChange={handleChange} />;\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function URLWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='url' {...props} />;\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `UpDownWidget` component uses the `BaseInputTemplate` changing the type to `number`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function UpDownWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='number' {...props} />;\n}\n", "import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport AltDateWidget from './AltDateWidget';\nimport AltDateTimeWidget from './AltDateTimeWidget';\nimport CheckboxWidget from './CheckboxWidget';\nimport CheckboxesWidget from './CheckboxesWidget';\nimport ColorWidget from './ColorWidget';\nimport DateWidget from './DateWidget';\nimport DateTimeWidget from './DateTimeWidget';\nimport EmailWidget from './EmailWidget';\nimport FileWidget from './FileWidget';\nimport HiddenWidget from './HiddenWidget';\nimport PasswordWidget from './PasswordWidget';\nimport RadioWidget from './RadioWidget';\nimport RangeWidget from './RangeWidget';\nimport SelectWidget from './SelectWidget';\nimport TextareaWidget from './TextareaWidget';\nimport TextWidget from './TextWidget';\nimport TimeWidget from './TimeWidget';\nimport URLWidget from './URLWidget';\nimport UpDownWidget from './UpDownWidget';\n\nfunction widgets<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): RegistryWidgetsType<T, S, F> {\n return {\n AltDateWidget,\n AltDateTimeWidget,\n CheckboxWidget,\n CheckboxesWidget,\n ColorWidget,\n DateWidget,\n DateTimeWidget,\n EmailWidget,\n FileWidget,\n HiddenWidget,\n PasswordWidget,\n RadioWidget,\n RangeWidget,\n SelectWidget,\n TextWidget,\n TextareaWidget,\n TimeWidget,\n UpDownWidget,\n URLWidget,\n };\n}\n\nexport default widgets;\n", "import { ComponentType, ForwardedRef, forwardRef } from 'react';\nimport Form, { FormProps } from './components/Form';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be\n * overridden while creating a theme\n */\nexport type ThemeProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<\n FormProps<T, S, F>,\n 'fields' | 'templates' | 'widgets' | '_internalFormWrapper'\n>;\n\n/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */\nexport default function withTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n themeProps: ThemeProps<T, S, F>\n): ComponentType<FormProps<T, S, F>> {\n return forwardRef(\n ({ fields, widgets, templates, ...directProps }: FormProps<T, S, F>, ref: ForwardedRef<Form<T, S, F>>) => {\n fields = { ...themeProps?.fields, ...fields };\n widgets = { ...themeProps?.widgets, ...widgets };\n templates = {\n ...themeProps?.templates,\n ...templates,\n ButtonTemplates: {\n ...themeProps?.templates?.ButtonTemplates,\n ...templates?.ButtonTemplates,\n },\n };\n\n return (\n <Form<T, S, F>\n {...themeProps}\n {...directProps}\n fields={fields}\n widgets={widgets}\n templates={templates}\n ref={ref}\n />\n );\n }\n );\n}\n", "import Form, { FormProps, FormState, IChangeEvent } from './components/Form';\nimport withTheme, { ThemeProps } from './withTheme';\nimport getDefaultRegistry from './getDefaultRegistry';\n\nexport type { FormProps, FormState, IChangeEvent, ThemeProps };\n\nexport { withTheme, getDefaultRegistry };\nexport default Form;\n"],
4
+ "sourcesContent": ["import { Component, ElementType, FormEvent, ReactNode, Ref, RefObject, createRef } from 'react';\nimport {\n createSchemaUtils,\n CustomValidator,\n deepEquals,\n ErrorSchema,\n ErrorTransformer,\n FormContextType,\n GenericObjectType,\n getTemplate,\n getUiOptions,\n IdSchema,\n isObject,\n mergeObjects,\n NAME_KEY,\n PathSchema,\n StrictRJSFSchema,\n Registry,\n RegistryFieldsType,\n RegistryWidgetsType,\n RJSFSchema,\n RJSFValidationError,\n RJSF_ADDITIONAL_PROPERTIES_FLAG,\n SchemaUtilsType,\n shouldRender,\n SUBMIT_BTN_OPTIONS_KEY,\n TemplatesType,\n toErrorList,\n UiSchema,\n UI_GLOBAL_OPTIONS_KEY,\n UI_OPTIONS_KEY,\n ValidationData,\n validationDataMerge,\n ValidatorType,\n Experimental_DefaultFormStateBehavior,\n} from '@rjsf/utils';\nimport _forEach from 'lodash/forEach';\nimport _get from 'lodash/get';\nimport _isEmpty from 'lodash/isEmpty';\nimport _pick from 'lodash/pick';\nimport _toPath from 'lodash/toPath';\n\nimport getDefaultRegistry from '../getDefaultRegistry';\n\n/** The properties that are passed to the `Form` */\nexport interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {\n /** The JSON schema object for the form */\n schema: S;\n /** An implementation of the `ValidatorType` interface that is needed for form validation to work */\n validator: ValidatorType<T, S, F>;\n /** The optional children for the form, if provided, it will replace the default `SubmitButton` */\n children?: ReactNode;\n /** The uiSchema for the form */\n uiSchema?: UiSchema<T, S, F>;\n /** The data for the form, used to prefill a form with existing data */\n formData?: T;\n // Form presentation and behavior modifiers\n /** You can provide a `formContext` object to the form, which is passed down to all fields and widgets. Useful for\n * implementing context aware fields and widgets.\n *\n * NOTE: Setting `{readonlyAsDisabled: false}` on the formContext will make the antd theme treat readOnly fields as\n * disabled.\n */\n formContext?: F;\n /** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids;\n * Default is `root`\n */\n idPrefix?: string;\n /** To avoid using a path separator that is present in field names, it is possible to change the separator used for\n * ids (Default is `_`)\n */\n idSeparator?: string;\n /** It's possible to disable the whole form by setting the `disabled` prop. The `disabled` prop is then forwarded down\n * to each field of the form. If you just want to disable some fields, see the `ui:disabled` parameter in `uiSchema`\n */\n disabled?: boolean;\n /** It's possible to make the whole form read-only by setting the `readonly` prop. The `readonly` prop is then\n * forwarded down to each field of the form. If you just want to make some fields read-only, see the `ui:readonly`\n * parameter in `uiSchema`\n */\n readonly?: boolean;\n // Form registry\n /** The dictionary of registered fields in the form */\n fields?: RegistryFieldsType<T, S, F>;\n /** The dictionary of registered templates in the form; Partial allows a subset to be provided beyond the defaults */\n templates?: Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {\n ButtonTemplates?: Partial<TemplatesType<T, S, F>['ButtonTemplates']>;\n };\n /** The dictionary of registered widgets in the form */\n widgets?: RegistryWidgetsType<T, S, F>;\n // Callbacks\n /** If you plan on being notified every time the form data are updated, you can pass an `onChange` handler, which will\n * receive the same args as `onSubmit` any time a value is updated in the form. Can also return the `id` of the field\n * that caused the change\n */\n onChange?: (data: IChangeEvent<T, S, F>, id?: string) => void;\n /** To react when submitted form data are invalid, pass an `onError` handler. It will be passed the list of\n * encountered errors\n */\n onError?: (errors: RJSFValidationError[]) => void;\n /** You can pass a function as the `onSubmit` prop of your `Form` component to listen to when the form is submitted\n * and its data are valid. It will be passed a result object having a `formData` attribute, which is the valid form\n * data you're usually after. The original event will also be passed as a second parameter\n */\n onSubmit?: (data: IChangeEvent<T, S, F>, event: FormEvent<any>) => void;\n /** Sometimes you may want to trigger events or modify external state when a field has been touched, so you can pass\n * an `onBlur` handler, which will receive the id of the input that was blurred and the field value\n */\n onBlur?: (id: string, data: any) => void;\n /** Sometimes you may want to trigger events or modify external state when a field has been focused, so you can pass\n * an `onFocus` handler, which will receive the id of the input that is focused and the field value\n */\n onFocus?: (id: string, data: any) => void;\n // <form /> HTML attributes\n /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form\n * @deprecated replaced with `acceptCharset` which will supercede this value if both are specified\n */\n acceptcharset?: string;\n /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */\n acceptCharset?: string;\n /** The value of this prop will be passed to the `action` HTML attribute on the form\n *\n * NOTE: this just renders the `action` attribute in the HTML markup. There is no real network request being sent to\n * this `action` on submit. Instead, react-jsonschema-form catches the submit event with `event.preventDefault()`\n * and then calls the `onSubmit` function, where you could send a request programmatically with `fetch` or similar.\n */\n action?: string;\n /** The value of this prop will be passed to the `autocomplete` HTML attribute on the form */\n autoComplete?: string;\n /** The value of this prop will be passed to the `class` HTML attribute on the form */\n className?: string;\n /** The value of this prop will be passed to the `enctype` HTML attribute on the form */\n enctype?: string;\n /** The value of this prop will be passed to the `id` HTML attribute on the form */\n id?: string;\n /** The value of this prop will be passed to the `name` HTML attribute on the form */\n name?: string;\n /** The value of this prop will be passed to the `method` HTML attribute on the form */\n method?: string;\n /** It's possible to change the default `form` tag name to a different HTML tag, which can be helpful if you are\n * nesting forms. However, native browser form behaviour, such as submitting when the `Enter` key is pressed, may no\n * longer work\n */\n tagName?: ElementType;\n /** The value of this prop will be passed to the `target` HTML attribute on the form */\n target?: string;\n // Errors and validation\n /** Formerly the `validate` prop; Takes a function that specifies custom validation rules for the form */\n customValidate?: CustomValidator<T, S, F>;\n /** This prop allows passing in custom errors that are augmented with the existing JSON Schema errors on the form; it\n * can be used to implement asynchronous validation. By default, these are non-blocking errors, meaning that you can\n * still submit the form when these are the only errors displayed to the user.\n */\n extraErrors?: ErrorSchema<T>;\n /** If set to true, causes the `extraErrors` to become blocking when the form is submitted */\n extraErrorsBlockSubmit?: boolean;\n /** If set to true, turns off HTML5 validation on the form; Set to `false` by default */\n noHtml5Validate?: boolean;\n /** If set to true, turns off all validation. Set to `false` by default\n *\n * @deprecated - In a future release, this switch may be replaced by making `validator` prop optional\n */\n noValidate?: boolean;\n /** If set to true, the form will perform validation and show any validation errors whenever the form data is changed,\n * rather than just on submit\n */\n liveValidate?: boolean;\n /** If `omitExtraData` and `liveOmit` are both set to true, then extra form data values that are not in any form field\n * will be removed whenever `onChange` is called. Set to `false` by default\n */\n liveOmit?: boolean;\n /** If set to true, then extra form data values that are not in any form field will be removed whenever `onSubmit` is\n * called. Set to `false` by default.\n */\n omitExtraData?: boolean;\n /** When this prop is set to `top` or 'bottom', a list of errors (or the custom error list defined in the `ErrorList`) will also\n * show. When set to false, only inline input validation errors will be shown. Set to `top` by default\n */\n showErrorList?: false | 'top' | 'bottom';\n /** A function can be passed to this prop in order to make modifications to the default errors resulting from JSON\n * Schema validation\n */\n transformErrors?: ErrorTransformer<T, S, F>;\n /** If set to true, then the first field with an error will receive the focus when the form is submitted with errors\n */\n focusOnFirstError?: boolean | ((error: RJSFValidationError) => void);\n /** Optional string translation function, if provided, allows users to change the translation of the RJSF internal\n * strings. Some strings contain replaceable parameter values as indicated by `%1`, `%2`, etc. The number after the\n * `%` indicates the order of the parameter. The ordering of parameters is important because some languages may choose\n * to put the second parameter before the first in its translation.\n */\n translateString?: Registry['translateString'];\n /** Optional configuration object with flags, if provided, allows users to override default form state behavior\n * Currently only affecting minItems on array fields and handling of setting defaults based on the value of\n * `emptyObjectFields`\n */\n experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior;\n // Private\n /**\n * _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`\n * that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two\n * props: `children` and `as`. That component, at minimum, should render the `children` inside of a <form /> tag\n * unless `as` is provided, in which case, use the `as` prop in place of `<form />`.\n * i.e.:\n * ```\n * export default function InternalForm({ children, as }) {\n * const FormTag = as || 'form';\n * return <FormTag>{children}</FormTag>;\n * }\n * ```\n *\n * Use at your own risk as this prop is private and may change at any time without notice.\n */\n _internalFormWrapper?: ElementType;\n /** Support receiving a React ref to the Form\n */\n ref?: Ref<Form<T, S, F>>;\n}\n\n/** The data that is contained within the state for the `Form` */\nexport interface FormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {\n /** The JSON schema object for the form */\n schema: S;\n /** The uiSchema for the form */\n uiSchema: UiSchema<T, S, F>;\n /** The `IdSchema` for the form, computed from the `schema`, the `rootFieldId`, the `formData` and the `idPrefix` and\n * `idSeparator` props.\n */\n idSchema: IdSchema<T>;\n /** The schemaUtils implementation used by the `Form`, created from the `validator` and the `schema` */\n schemaUtils: SchemaUtilsType<T, S, F>;\n /** The current data for the form, computed from the `formData` prop and the changes made by the user */\n formData?: T;\n /** Flag indicating whether the form is in edit mode, true when `formData` is passed to the form, otherwise false */\n edit: boolean;\n /** The current list of errors for the form, includes `extraErrors` */\n errors: RJSFValidationError[];\n /** The current errors, in `ErrorSchema` format, for the form, includes `extraErrors` */\n errorSchema: ErrorSchema<T>;\n /** The current list of errors for the form directly from schema validation, does NOT include `extraErrors` */\n schemaValidationErrors: RJSFValidationError[];\n /** The current errors, in `ErrorSchema` format, for the form directly from schema validation, does NOT include\n * `extraErrors`\n */\n schemaValidationErrorSchema: ErrorSchema<T>;\n // Private\n /** @description result of schemaUtils.retrieveSchema(schema, formData). This a memoized value to avoid re calculate at internal functions (getStateFromProps, onChange) */\n retrievedSchema: S;\n}\n\n/** The event data passed when changes have been made to the form, includes everything from the `FormState` except\n * the schema validation errors. An additional `status` is added when returned from `onSubmit`\n */\nexport interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>\n extends Omit<FormState<T, S, F>, 'schemaValidationErrors' | 'schemaValidationErrorSchema'> {\n /** The status of the form when submitted */\n status?: 'submitted';\n}\n\n/** The `Form` component renders the outer form and all the fields defined in the `schema` */\nexport default class Form<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n> extends Component<FormProps<T, S, F>, FormState<T, S, F>> {\n /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can\n * provide any possible type here\n */\n formElement: RefObject<any>;\n\n /** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the\n * `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the\n * state construction.\n *\n * @param props - The initial props for the `Form`\n */\n constructor(props: FormProps<T, S, F>) {\n super(props);\n\n if (!props.validator) {\n throw new Error('A validator is required for Form functionality to work');\n }\n\n this.state = this.getStateFromProps(props, props.formData);\n if (this.props.onChange && !deepEquals(this.state.formData, this.props.formData)) {\n this.props.onChange(this.state);\n }\n this.formElement = createRef();\n }\n\n /**\n * `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered\n * output is committed to the DOM. It enables your component to capture current values (e.g., scroll position) before\n * they are potentially changed.\n *\n * In this case, it checks if the props have changed since the last render. If they have, it computes the next state\n * of the component using `getStateFromProps` method and returns it along with a `shouldUpdate` flag set to `true` IF\n * the `nextState` and `prevState` are different, otherwise `false`. This ensures that we have the most up-to-date\n * state ready to be applied in `componentDidUpdate`.\n *\n * If `formData` hasn't changed, it simply returns an object with `shouldUpdate` set to `false`, indicating that a\n * state update is not necessary.\n *\n * @param prevProps - The previous set of props before the update.\n * @param prevState - The previous state before the update.\n * @returns Either an object containing the next state and a flag indicating that an update should occur, or an object\n * with a flag indicating that an update is not necessary.\n */\n getSnapshotBeforeUpdate(\n prevProps: FormProps<T, S, F>,\n prevState: FormState<T, S, F>\n ): { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false } {\n if (!deepEquals(this.props, prevProps)) {\n const isSchemaChanged = !deepEquals(prevProps.schema, this.props.schema);\n const isFormDataChanged = !deepEquals(prevProps.formData, this.props.formData);\n const nextState = this.getStateFromProps(\n this.props,\n this.props.formData,\n // If the `schema` has changed, we need to update the retrieved schema.\n // Or if the `formData` changes, for example in the case of a schema with dependencies that need to\n // match one of the subSchemas, the retrieved schema must be updated.\n isSchemaChanged || isFormDataChanged ? undefined : this.state.retrievedSchema,\n isSchemaChanged\n );\n const shouldUpdate = !deepEquals(nextState, prevState);\n return { nextState, shouldUpdate };\n }\n return { shouldUpdate: false };\n }\n\n /**\n * `componentDidUpdate` is a React lifecycle method that is invoked immediately after updating occurs. This method is\n * not called for the initial render.\n *\n * Here, it checks if an update is necessary based on the `shouldUpdate` flag received from `getSnapshotBeforeUpdate`.\n * If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about\n * changes.\n *\n * This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative\n * to handle prop changes and state updates.\n *\n * @param _ - The previous set of props.\n * @param prevState - The previous state of the component before the update.\n * @param snapshot - The value returned from `getSnapshotBeforeUpdate`.\n */\n componentDidUpdate(\n _: FormProps<T, S, F>,\n prevState: FormState<T, S, F>,\n snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false }\n ) {\n if (snapshot.shouldUpdate) {\n const { nextState } = snapshot;\n\n if (\n !deepEquals(nextState.formData, this.props.formData) &&\n !deepEquals(nextState.formData, prevState.formData) &&\n this.props.onChange\n ) {\n this.props.onChange(nextState);\n }\n this.setState(nextState);\n }\n }\n\n /** Extracts the updated state from the given `props` and `inputFormData`. As part of this process, the\n * `inputFormData` is first processed to add any missing required defaults. After that, the data is run through the\n * validation process IF required by the `props`.\n *\n * @param props - The props passed to the `Form`\n * @param inputFormData - The new or current data for the `Form`\n * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.\n * @param isSchemaChanged - A flag indicating whether the schema has changed.\n * @returns - The new state for the `Form`\n */\n getStateFromProps(\n props: FormProps<T, S, F>,\n inputFormData?: T,\n retrievedSchema?: S,\n isSchemaChanged = false\n ): FormState<T, S, F> {\n const state: FormState<T, S, F> = this.state || {};\n const schema = 'schema' in props ? props.schema : this.props.schema;\n const uiSchema: UiSchema<T, S, F> = ('uiSchema' in props ? props.uiSchema! : this.props.uiSchema!) || {};\n const edit = typeof inputFormData !== 'undefined';\n const liveValidate = 'liveValidate' in props ? props.liveValidate : this.props.liveValidate;\n const mustValidate = edit && !props.noValidate && liveValidate;\n const rootSchema = schema;\n const experimental_defaultFormStateBehavior =\n 'experimental_defaultFormStateBehavior' in props\n ? props.experimental_defaultFormStateBehavior\n : this.props.experimental_defaultFormStateBehavior;\n let schemaUtils: SchemaUtilsType<T, S, F> = state.schemaUtils;\n if (\n !schemaUtils ||\n schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)\n ) {\n schemaUtils = createSchemaUtils<T, S, F>(props.validator, rootSchema, experimental_defaultFormStateBehavior);\n }\n const formData: T = schemaUtils.getDefaultFormState(schema, inputFormData) as T;\n const _retrievedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);\n\n const getCurrentErrors = (): ValidationData<T> => {\n // If the `props.noValidate` option is set or the schema has changed, we reset the error state.\n if (props.noValidate || isSchemaChanged) {\n return { errors: [], errorSchema: {} };\n } else if (!props.liveValidate) {\n return {\n errors: state.schemaValidationErrors || [],\n errorSchema: state.schemaValidationErrorSchema || {},\n };\n }\n return {\n errors: state.errors || [],\n errorSchema: state.errorSchema || {},\n };\n };\n\n let errors: RJSFValidationError[];\n let errorSchema: ErrorSchema<T> | undefined;\n let schemaValidationErrors: RJSFValidationError[] = state.schemaValidationErrors;\n let schemaValidationErrorSchema: ErrorSchema<T> = state.schemaValidationErrorSchema;\n if (mustValidate) {\n const schemaValidation = this.validate(formData, schema, schemaUtils, _retrievedSchema);\n errors = schemaValidation.errors;\n // If the schema has changed, we do not merge state.errorSchema.\n // Else in the case where it hasn't changed, we merge 'state.errorSchema' with 'schemaValidation.errorSchema.' This done to display the raised field error.\n if (isSchemaChanged) {\n errorSchema = schemaValidation.errorSchema;\n } else {\n errorSchema = mergeObjects(\n this.state?.errorSchema,\n schemaValidation.errorSchema,\n 'preventDuplicates'\n ) as ErrorSchema<T>;\n }\n schemaValidationErrors = errors;\n schemaValidationErrorSchema = errorSchema;\n } else {\n const currentErrors = getCurrentErrors();\n errors = currentErrors.errors;\n errorSchema = currentErrors.errorSchema;\n }\n if (props.extraErrors) {\n const merged = validationDataMerge({ errorSchema, errors }, props.extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n const idSchema = schemaUtils.toIdSchema(\n _retrievedSchema,\n uiSchema['ui:rootFieldId'],\n formData,\n props.idPrefix,\n props.idSeparator\n );\n const nextState: FormState<T, S, F> = {\n schemaUtils,\n schema,\n uiSchema,\n idSchema,\n formData,\n edit,\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n retrievedSchema: _retrievedSchema,\n };\n return nextState;\n }\n\n /** React lifecycle method that is used to determine whether component should be updated.\n *\n * @param nextProps - The next version of the props\n * @param nextState - The next version of the state\n * @returns - True if the component should be updated, false otherwise\n */\n shouldComponentUpdate(nextProps: FormProps<T, S, F>, nextState: FormState<T, S, F>): boolean {\n return shouldRender(this, nextProps, nextState);\n }\n\n /** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the\n * `schemaUtils` in the state), returning the results.\n *\n * @param formData - The new form data to validate\n * @param schema - The schema used to validate against\n * @param altSchemaUtils - The alternate schemaUtils to use for validation\n */\n validate(\n formData: T | undefined,\n schema = this.props.schema,\n altSchemaUtils?: SchemaUtilsType<T, S, F>,\n retrievedSchema?: S\n ): ValidationData<T> {\n const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;\n const { customValidate, transformErrors, uiSchema } = this.props;\n const resolvedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);\n return schemaUtils\n .getValidator()\n .validateFormData(formData, resolvedSchema, customValidate, transformErrors, uiSchema);\n }\n\n /** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */\n renderErrors(registry: Registry<T, S, F>) {\n const { errors, errorSchema, schema, uiSchema } = this.state;\n const { formContext } = this.props;\n const options = getUiOptions<T, S, F>(uiSchema);\n const ErrorListTemplate = getTemplate<'ErrorListTemplate', T, S, F>('ErrorListTemplate', registry, options);\n\n if (errors && errors.length) {\n return (\n <ErrorListTemplate\n errors={errors}\n errorSchema={errorSchema || {}}\n schema={schema}\n uiSchema={uiSchema}\n formContext={formContext}\n registry={registry}\n />\n );\n }\n return null;\n }\n\n /** Returns the `formData` with only the elements specified in the `fields` list\n *\n * @param formData - The data for the `Form`\n * @param fields - The fields to keep while filtering\n */\n getUsedFormData = (formData: T | undefined, fields: string[][]): T | undefined => {\n // For the case of a single input form\n if (fields.length === 0 && typeof formData !== 'object') {\n return formData;\n }\n\n // _pick has incorrect type definition, it works with string[][], because lodash/hasIn supports it\n const data: GenericObjectType = _pick(formData, fields as unknown as string[]);\n if (Array.isArray(formData)) {\n return Object.keys(data).map((key: string) => data[key]) as unknown as T;\n }\n\n return data as T;\n };\n\n /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`\n *\n * @param pathSchema - The `PathSchema` object for the form\n * @param [formData] - The form data to use while checking for empty objects/arrays\n */\n getFieldNames = (pathSchema: PathSchema<T>, formData?: T): string[][] => {\n const getAllPaths = (_obj: GenericObjectType, acc: string[][] = [], paths: string[][] = [[]]) => {\n Object.keys(_obj).forEach((key: string) => {\n if (typeof _obj[key] === 'object') {\n const newPaths = paths.map((path) => [...path, key]);\n // If an object is marked with additionalProperties, all its keys are valid\n if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') {\n acc.push(_obj[key][NAME_KEY]);\n } else {\n getAllPaths(_obj[key], acc, newPaths);\n }\n } else if (key === NAME_KEY && _obj[key] !== '') {\n paths.forEach((path) => {\n const formValue = _get(formData, path);\n // adds path to fieldNames if it points to a value\n // or an empty object/array\n if (\n typeof formValue !== 'object' ||\n _isEmpty(formValue) ||\n (Array.isArray(formValue) && formValue.every((val) => typeof val !== 'object'))\n ) {\n acc.push(path);\n }\n });\n }\n });\n return acc;\n };\n\n return getAllPaths(pathSchema);\n };\n\n /** Returns the `formData` after filtering to remove any extra data not in a form field\n *\n * @param formData - The data for the `Form`\n * @returns The `formData` after omitting extra data\n */\n omitExtraData = (formData?: T): T | undefined => {\n const { schema, schemaUtils } = this.state;\n const retrievedSchema = schemaUtils.retrieveSchema(schema, formData);\n const pathSchema = schemaUtils.toPathSchema(retrievedSchema, '', formData);\n const fieldNames = this.getFieldNames(pathSchema, formData);\n const newFormData = this.getUsedFormData(formData, fieldNames);\n return newFormData;\n };\n\n // Filtering errors based on your retrieved schema to only show errors for properties in the selected branch.\n private filterErrorsBasedOnSchema(schemaErrors: ErrorSchema<T>, resolvedSchema?: S, formData?: any): ErrorSchema<T> {\n const { retrievedSchema, schemaUtils } = this.state;\n const _retrievedSchema = resolvedSchema ?? retrievedSchema;\n const pathSchema = schemaUtils.toPathSchema(_retrievedSchema, '', formData);\n const fieldNames = this.getFieldNames(pathSchema, formData);\n const filteredErrors: ErrorSchema<T> = _pick(schemaErrors, fieldNames as unknown as string[]);\n // If the root schema is of a primitive type, do not filter out the __errors\n if (resolvedSchema?.type !== 'object' && resolvedSchema?.type !== 'array') {\n filteredErrors.__errors = schemaErrors.__errors;\n }\n // Removing undefined and empty errors.\n const filterUndefinedErrors = (errors: any): ErrorSchema<T> => {\n _forEach(errors, (errorAtKey, errorKey: keyof typeof errors) => {\n if (errorAtKey === undefined) {\n delete errors[errorKey];\n } else if (typeof errorAtKey === 'object' && !Array.isArray(errorAtKey.__errors)) {\n filterUndefinedErrors(errorAtKey);\n }\n });\n return errors;\n };\n return filterUndefinedErrors(filteredErrors);\n }\n\n /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the\n * `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and\n * then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not\n * in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new\n * updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`\n * callback will be called if specified with the updated state.\n *\n * @param formData - The new form data from a change to a field\n * @param newErrorSchema - The new `ErrorSchema` based on the field change\n * @param id - The id of the field that caused the change\n */\n onChange = (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;\n const { schemaUtils, schema, retrievedSchema } = this.state;\n\n if (isObject(formData) || Array.isArray(formData)) {\n const newState = this.getStateFromProps(this.props, formData, retrievedSchema);\n formData = newState.formData;\n }\n\n const mustValidate = !noValidate && liveValidate;\n let state: Partial<FormState<T, S, F>> = { formData, schema };\n let newFormData = formData;\n\n let _retrievedSchema: S | undefined;\n if (omitExtraData === true && liveOmit === true) {\n newFormData = this.omitExtraData(formData);\n state = {\n formData: newFormData,\n };\n }\n\n if (mustValidate) {\n const schemaValidation = this.validate(newFormData, schema, schemaUtils, retrievedSchema);\n let errors = schemaValidation.errors;\n let errorSchema = schemaValidation.errorSchema;\n const schemaValidationErrors = errors;\n const schemaValidationErrorSchema = errorSchema;\n if (extraErrors) {\n const merged = validationDataMerge(schemaValidation, extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n // Merging 'newErrorSchema' into 'errorSchema' to display the custom raised errors.\n if (newErrorSchema) {\n const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);\n errorSchema = mergeObjects(errorSchema, filteredErrors, 'preventDuplicates') as ErrorSchema<T>;\n }\n state = {\n formData: newFormData,\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n };\n } else if (!noValidate && newErrorSchema) {\n const errorSchema = extraErrors\n ? (mergeObjects(newErrorSchema, extraErrors, 'preventDuplicates') as ErrorSchema<T>)\n : newErrorSchema;\n state = {\n formData: newFormData,\n errorSchema: errorSchema,\n errors: toErrorList(errorSchema),\n };\n }\n if (_retrievedSchema) {\n state.retrievedSchema = _retrievedSchema;\n }\n this.setState(state as FormState<T, S, F>, () => onChange && onChange({ ...this.state, ...state }, id));\n };\n\n /**\n * Callback function to handle reset form data.\n * - Reset all fields with default values.\n * - Reset validations and errors\n *\n */\n reset = () => {\n const { onChange } = this.props;\n const newState = this.getStateFromProps(this.props, undefined);\n const newFormData = newState.formData;\n const state = {\n formData: newFormData,\n errorSchema: {},\n errors: [] as unknown,\n schemaValidationErrors: [] as unknown,\n schemaValidationErrorSchema: {},\n } as FormState<T, S, F>;\n\n this.setState(state, () => onChange && onChange({ ...this.state, ...state }));\n };\n\n /** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it\n * was provided.\n *\n * @param id - The unique `id` of the field that was blurred\n * @param data - The data associated with the field that was blurred\n */\n onBlur = (id: string, data: any) => {\n const { onBlur } = this.props;\n if (onBlur) {\n onBlur(id, data);\n }\n };\n\n /** Callback function to handle when a field on the form is focused. Calls the `onFocus` callback for the `Form` if it\n * was provided.\n *\n * @param id - The unique `id` of the field that was focused\n * @param data - The data associated with the field that was focused\n */\n onFocus = (id: string, data: any) => {\n const { onFocus } = this.props;\n if (onFocus) {\n onFocus(id, data);\n }\n };\n\n /** Callback function to handle when the form is submitted. First, it prevents the default event behavior. Nothing\n * happens if the target and currentTarget of the event are not the same. It will omit any extra data in the\n * `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors\n * via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call\n * back the `onSubmit` callback if it was provided.\n *\n * @param event - The submit HTML form event\n */\n onSubmit = (event: FormEvent<any>) => {\n event.preventDefault();\n if (event.target !== event.currentTarget) {\n return;\n }\n\n event.persist();\n const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;\n let { formData: newFormData } = this.state;\n\n if (omitExtraData === true) {\n newFormData = this.omitExtraData(newFormData);\n }\n\n if (noValidate || this.validateFormWithFormData(newFormData)) {\n // There are no errors generated through schema validation.\n // Check for user provided errors and update state accordingly.\n const errorSchema = extraErrors || {};\n const errors = extraErrors ? toErrorList(extraErrors) : [];\n this.setState(\n {\n formData: newFormData,\n errors,\n errorSchema,\n schemaValidationErrors: [],\n schemaValidationErrorSchema: {},\n },\n () => {\n if (onSubmit) {\n onSubmit({ ...this.state, formData: newFormData, status: 'submitted' }, event);\n }\n }\n );\n }\n };\n\n /** Returns the registry for the form */\n getRegistry(): Registry<T, S, F> {\n const { translateString: customTranslateString, uiSchema = {} } = this.props;\n const { schemaUtils } = this.state;\n const { fields, templates, widgets, formContext, translateString } = getDefaultRegistry<T, S, F>();\n return {\n fields: { ...fields, ...this.props.fields },\n templates: {\n ...templates,\n ...this.props.templates,\n ButtonTemplates: {\n ...templates.ButtonTemplates,\n ...this.props.templates?.ButtonTemplates,\n },\n },\n widgets: { ...widgets, ...this.props.widgets },\n rootSchema: this.props.schema,\n formContext: this.props.formContext || formContext,\n schemaUtils,\n translateString: customTranslateString || translateString,\n globalUiOptions: uiSchema[UI_GLOBAL_OPTIONS_KEY],\n };\n }\n\n /** Provides a function that can be used to programmatically submit the `Form` */\n submit = () => {\n if (this.formElement.current) {\n const submitCustomEvent = new CustomEvent('submit', {\n cancelable: true,\n });\n submitCustomEvent.preventDefault();\n this.formElement.current.dispatchEvent(submitCustomEvent);\n this.formElement.current.requestSubmit();\n }\n };\n\n /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error\n * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that\n * id is attempted to be found using the `formElement` ref. If it is located, then it is focused.\n *\n * @param error - The error on which to focus\n */\n focusOnError(error: RJSFValidationError) {\n const { idPrefix = 'root', idSeparator = '_' } = this.props;\n const { property } = error;\n const path = _toPath(property);\n if (path[0] === '') {\n // Most of the time the `.foo` property results in the first element being empty, so replace it with the idPrefix\n path[0] = idPrefix;\n } else {\n // Otherwise insert the idPrefix into the first location using unshift\n path.unshift(idPrefix);\n }\n\n const elementId = path.join(idSeparator);\n let field = this.formElement.current.elements[elementId];\n if (!field) {\n // if not an exact match, try finding an input starting with the element id (like radio buttons or checkboxes)\n field = this.formElement.current.querySelector(`input[id^=${elementId}`);\n }\n if (field && field.length) {\n // If we got a list with length > 0\n field = field[0];\n }\n if (field) {\n field.focus();\n }\n }\n\n /** Validates the form using the given `formData`. For use on form submission or on programmatic validation.\n * If `onError` is provided, then it will be called with the list of errors.\n *\n * @param formData - The form data to validate\n * @returns - True if the form is valid, false otherwise.\n */\n validateFormWithFormData = (formData?: T): boolean => {\n const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;\n const { errors: prevErrors } = this.state;\n const schemaValidation = this.validate(formData);\n let errors = schemaValidation.errors;\n let errorSchema = schemaValidation.errorSchema;\n const schemaValidationErrors = errors;\n const schemaValidationErrorSchema = errorSchema;\n const hasError = errors.length > 0 || (extraErrors && extraErrorsBlockSubmit);\n if (hasError) {\n if (extraErrors) {\n const merged = validationDataMerge(schemaValidation, extraErrors);\n errorSchema = merged.errorSchema;\n errors = merged.errors;\n }\n if (focusOnFirstError) {\n if (typeof focusOnFirstError === 'function') {\n focusOnFirstError(errors[0]);\n } else {\n this.focusOnError(errors[0]);\n }\n }\n this.setState(\n {\n errors,\n errorSchema,\n schemaValidationErrors,\n schemaValidationErrorSchema,\n },\n () => {\n if (onError) {\n onError(errors);\n } else {\n console.error('Form validation failed', errors);\n }\n }\n );\n } else if (prevErrors.length > 0) {\n this.setState({\n errors: [],\n errorSchema: {},\n schemaValidationErrors: [],\n schemaValidationErrorSchema: {},\n });\n }\n return !hasError;\n };\n\n /** Programmatically validate the form. If `omitExtraData` is true, the `formData` will first be filtered to remove\n * any extra data not in a form field. If `onError` is provided, then it will be called with the list of errors the\n * same way as would happen on form submission.\n *\n * @returns - True if the form is valid, false otherwise.\n */\n validateForm() {\n const { omitExtraData } = this.props;\n let { formData: newFormData } = this.state;\n if (omitExtraData === true) {\n newFormData = this.omitExtraData(newFormData);\n }\n return this.validateFormWithFormData(newFormData);\n }\n\n /** Renders the `Form` fields inside the <form> | `tagName` or `_internalFormWrapper`, rendering any errors if\n * needed along with the submit button or any children of the form.\n */\n render() {\n const {\n children,\n id,\n idPrefix,\n idSeparator,\n className = '',\n tagName,\n name,\n method,\n target,\n action,\n autoComplete,\n enctype,\n acceptcharset,\n acceptCharset,\n noHtml5Validate = false,\n disabled,\n readonly,\n formContext,\n showErrorList = 'top',\n _internalFormWrapper,\n } = this.props;\n\n const { schema, uiSchema, formData, errorSchema, idSchema } = this.state;\n const registry = this.getRegistry();\n const { SchemaField: _SchemaField } = registry.fields;\n const { SubmitButton } = registry.templates.ButtonTemplates;\n // The `semantic-ui` theme has an `_internalFormWrapper` that take an `as` prop that is the\n // PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.\n // NOTE, the `as` prop is native to `semantic-ui`\n const as = _internalFormWrapper ? tagName : undefined;\n const FormTag = _internalFormWrapper || tagName || 'form';\n\n let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions<T, S, F>(uiSchema);\n if (disabled) {\n submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };\n }\n const submitUiSchema = { [UI_OPTIONS_KEY]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };\n\n return (\n <FormTag\n className={className ? className : 'rjsf'}\n id={id}\n name={name}\n method={method}\n target={target}\n action={action}\n autoComplete={autoComplete}\n encType={enctype}\n acceptCharset={acceptCharset || acceptcharset}\n noValidate={noHtml5Validate}\n onSubmit={this.onSubmit}\n as={as}\n ref={this.formElement}\n >\n {showErrorList === 'top' && this.renderErrors(registry)}\n <_SchemaField\n name=''\n schema={schema}\n uiSchema={uiSchema}\n errorSchema={errorSchema}\n idSchema={idSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n formContext={formContext}\n formData={formData}\n onChange={this.onChange}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n />\n\n {children ? children : <SubmitButton uiSchema={submitUiSchema} registry={registry} />}\n {showErrorList === 'bottom' && this.renderErrors(registry)}\n </FormTag>\n );\n }\n}\n", "import { englishStringTranslator, FormContextType, Registry, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport fields from './components/fields';\nimport templates from './components/templates';\nimport widgets from './components/widgets';\n\n/** The default registry consists of all the fields, templates and widgets provided in the core implementation,\n * plus an empty `rootSchema` and `formContext. We omit schemaUtils here because it cannot be defaulted without a\n * rootSchema and validator. It will be added into the computed registry later in the Form.\n */\nexport default function getDefaultRegistry<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): Omit<Registry<T, S, F>, 'schemaUtils'> {\n return {\n fields: fields<T, S, F>(),\n templates: templates<T, S, F>(),\n widgets: widgets<T, S, F>(),\n rootSchema: {} as S,\n formContext: {} as F,\n translateString: englishStringTranslator,\n };\n}\n", "import { Component, MouseEvent } from 'react';\nimport {\n getTemplate,\n getWidget,\n getUiOptions,\n isFixedItems,\n allowAdditionalItems,\n isCustomWidget,\n optionsList,\n ArrayFieldTemplateProps,\n ErrorSchema,\n FieldProps,\n FormContextType,\n IdSchema,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UiSchema,\n ITEMS_KEY,\n} from '@rjsf/utils';\nimport cloneDeep from 'lodash/cloneDeep';\nimport get from 'lodash/get';\nimport isObject from 'lodash/isObject';\nimport set from 'lodash/set';\nimport { nanoid } from 'nanoid';\n\n/** Type used to represent the keyed form data used in the state */\ntype KeyedFormDataType<T> = { key: string; item: T };\n\n/** Type used for the state of the `ArrayField` component */\ntype ArrayFieldState<T> = {\n /** The keyed form data elements */\n keyedFormData: KeyedFormDataType<T>[];\n /** Flag indicating whether any of the keyed form data has been updated */\n updatedKeyedFormData: boolean;\n};\n\n/** Used to generate a unique ID for an element in a row */\nfunction generateRowId() {\n return nanoid();\n}\n\n/** Converts the `formData` into `KeyedFormDataType` data, using the `generateRowId()` function to create the key\n *\n * @param formData - The data for the form\n * @returns - The `formData` converted into a `KeyedFormDataType` element\n */\nfunction generateKeyedFormData<T>(formData: T[]): KeyedFormDataType<T>[] {\n return !Array.isArray(formData)\n ? []\n : formData.map((item) => {\n return {\n key: generateRowId(),\n item,\n };\n });\n}\n\n/** Converts `KeyedFormDataType` data into the inner `formData`\n *\n * @param keyedFormData - The `KeyedFormDataType` to be converted\n * @returns - The inner `formData` item(s) in the `keyedFormData`\n */\nfunction keyedToPlainFormData<T>(keyedFormData: KeyedFormDataType<T> | KeyedFormDataType<T>[]): T[] {\n if (Array.isArray(keyedFormData)) {\n return keyedFormData.map((keyedItem) => keyedItem.item);\n }\n return [];\n}\n\n/** The `ArrayField` component is used to render a field in the schema that is of type `array`. It supports both normal\n * and fixed array, allowing user to add and remove elements from the array data.\n */\nclass ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T[], S, F>,\n ArrayFieldState<T>\n> {\n /** Constructs an `ArrayField` from the `props`, generating the initial keyed data from the `formData`\n *\n * @param props - The `FieldProps` for this template\n */\n constructor(props: FieldProps<T[], S, F>) {\n super(props);\n const { formData = [] } = props;\n const keyedFormData = generateKeyedFormData<T>(formData);\n this.state = {\n keyedFormData,\n updatedKeyedFormData: false,\n };\n }\n\n /** React lifecycle method that is called when the props are about to change allowing the state to be updated. It\n * regenerates the keyed form data and returns it\n *\n * @param nextProps - The next set of props data\n * @param prevState - The previous set of state data\n */\n static getDerivedStateFromProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n nextProps: Readonly<FieldProps<T[], S, F>>,\n prevState: Readonly<ArrayFieldState<T>>\n ) {\n // Don't call getDerivedStateFromProps if keyed formdata was just updated.\n if (prevState.updatedKeyedFormData) {\n return {\n updatedKeyedFormData: false,\n };\n }\n const nextFormData = Array.isArray(nextProps.formData) ? nextProps.formData : [];\n const previousKeyedFormData = prevState.keyedFormData || [];\n const newKeyedFormData =\n nextFormData.length === previousKeyedFormData.length\n ? previousKeyedFormData.map((previousKeyedFormDatum, index) => {\n return {\n key: previousKeyedFormDatum.key,\n item: nextFormData[index],\n };\n })\n : generateKeyedFormData<T>(nextFormData);\n return {\n keyedFormData: newKeyedFormData,\n };\n }\n\n /** Returns the appropriate title for an item by getting first the title from the schema.items, then falling back to\n * the description from the schema.items, and finally the string \"Item\"\n */\n get itemTitle() {\n const { schema, registry } = this.props;\n const { translateString } = registry;\n return get(\n schema,\n [ITEMS_KEY, 'title'],\n get(schema, [ITEMS_KEY, 'description'], translateString(TranslatableString.ArrayItemTitle))\n );\n }\n\n /** Determines whether the item described in the schema is always required, which is determined by whether any item\n * may be null.\n *\n * @param itemSchema - The schema for the item\n * @return - True if the item schema type does not contain the \"null\" type\n */\n isItemRequired(itemSchema: S) {\n if (Array.isArray(itemSchema.type)) {\n // While we don't yet support composite/nullable jsonschema types, it's\n // future-proof to check for requirement against these.\n return !itemSchema.type.includes('null');\n }\n // All non-null array item types are inherently required by design\n return itemSchema.type !== 'null';\n }\n\n /** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding\n * then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the\n * `formData` matches that value, then false is returned, otherwise true is returned.\n *\n * @param formItems - The list of items in the form\n * @returns - True if the item is addable otherwise false\n */\n canAddItem(formItems: any[]) {\n const { schema, uiSchema, registry } = this.props;\n let { addable } = getUiOptions<T[], S, F>(uiSchema, registry.globalUiOptions);\n if (addable !== false) {\n // if ui:options.addable was not explicitly set to false, we can add\n // another item if we have not exceeded maxItems yet\n if (schema.maxItems !== undefined) {\n addable = formItems.length < schema.maxItems;\n } else {\n addable = true;\n }\n }\n return addable;\n }\n\n /** Returns the default form information for an item based on the schema for that item. Deals with the possibility\n * that the schema is fixed and allows additional items.\n */\n _getNewFormDataRow = (): T => {\n const { schema, registry } = this.props;\n const { schemaUtils } = registry;\n let itemSchema = schema.items as S;\n if (isFixedItems(schema) && allowAdditionalItems(schema)) {\n itemSchema = schema.additionalItems as S;\n }\n // Cast this as a T to work around schema utils being for T[] caused by the FieldProps<T[], S, F> call on the class\n return schemaUtils.getDefaultFormState(itemSchema) as unknown as T;\n };\n\n /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data\n * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into\n * the state, and then returning `onChange()` with the plain form data converted from the keyed data\n *\n * @param event - The event for the click\n * @param [index] - The optional index at which to add the new data\n */\n _handleAddClick(event: MouseEvent, index?: number) {\n if (event) {\n event.preventDefault();\n }\n\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (index === undefined || i < index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i >= index) {\n set(newErrorSchema, [i + 1], errorSchema[idx]);\n }\n }\n }\n\n const newKeyedFormDataRow: KeyedFormDataType<T> = {\n key: generateRowId(),\n item: this._getNewFormDataRow(),\n };\n const newKeyedFormData = [...keyedFormData];\n if (index !== undefined) {\n newKeyedFormData.splice(index, 0, newKeyedFormDataRow);\n } else {\n newKeyedFormData.push(newKeyedFormDataRow);\n }\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n }\n\n /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of\n * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the\n * keyed data\n *\n * @param event - The event for the click\n */\n onAddClick = (event: MouseEvent) => {\n this._handleAddClick(event);\n };\n\n /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of\n * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain\n * form data converted from the keyed data\n *\n * @param index - The index at which the add button is clicked\n */\n onAddIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n this._handleAddClick(event, index);\n };\n };\n\n /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of\n * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain\n * form data converted from the keyed data\n *\n * @param index - The index at which the copy button is clicked\n */\n onCopyIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n if (event) {\n event.preventDefault();\n }\n\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i <= index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i > index) {\n set(newErrorSchema, [i + 1], errorSchema[idx]);\n }\n }\n }\n\n const newKeyedFormDataRow: KeyedFormDataType<T> = {\n key: generateRowId(),\n item: cloneDeep(keyedFormData[index].item),\n };\n const newKeyedFormData = [...keyedFormData];\n if (index !== undefined) {\n newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);\n } else {\n newKeyedFormData.push(newKeyedFormDataRow);\n }\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of\n * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted\n * from the keyed data\n *\n * @param index - The index at which the remove button is clicked\n */\n onDropIndexClick = (index: number) => {\n return (event: MouseEvent) => {\n if (event) {\n event.preventDefault();\n }\n const { onChange, errorSchema } = this.props;\n const { keyedFormData } = this.state;\n // refs #195: revalidate to ensure properly reindexing errors\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i < index) {\n set(newErrorSchema, [i], errorSchema[idx]);\n } else if (i > index) {\n set(newErrorSchema, [i - 1], errorSchema[idx]);\n }\n }\n }\n const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n updatedKeyedFormData: true,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the\n * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the\n * plain form data converted from the keyed data\n *\n * @param index - The index of the item to move\n * @param newIndex - The index to where the item is to be moved\n */\n onReorderClick = (index: number, newIndex: number) => {\n return (event: MouseEvent<HTMLButtonElement>) => {\n if (event) {\n event.preventDefault();\n event.currentTarget.blur();\n }\n const { onChange, errorSchema } = this.props;\n let newErrorSchema: ErrorSchema<T>;\n if (errorSchema) {\n newErrorSchema = {};\n for (const idx in errorSchema) {\n const i = parseInt(idx);\n if (i == index) {\n set(newErrorSchema, [newIndex], errorSchema[index]);\n } else if (i == newIndex) {\n set(newErrorSchema, [index], errorSchema[newIndex]);\n } else {\n set(newErrorSchema, [idx], errorSchema[i]);\n }\n }\n }\n\n const { keyedFormData } = this.state;\n function reOrderArray() {\n // Copy item\n const _newKeyedFormData = keyedFormData.slice();\n\n // Moves item from index to newIndex\n _newKeyedFormData.splice(index, 1);\n _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);\n\n return _newKeyedFormData;\n }\n const newKeyedFormData = reOrderArray();\n this.setState(\n {\n keyedFormData: newKeyedFormData,\n },\n () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)\n );\n };\n };\n\n /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the\n * `onChange` callback with the updated form data\n *\n * @param index - The index of the item being changed\n */\n onChangeForIndex = (index: number) => {\n return (value: any, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { formData, onChange, errorSchema } = this.props;\n const arrayData = Array.isArray(formData) ? formData : [];\n const newFormData = arrayData.map((item: T, i: number) => {\n // We need to treat undefined items as nulls to have validation.\n // See https://github.com/tdegrunt/jsonschema/issues/206\n const jsonValue = typeof value === 'undefined' ? null : value;\n return index === i ? jsonValue : item;\n });\n onChange(\n newFormData,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [index]: newErrorSchema,\n },\n id\n );\n };\n };\n\n /** Callback handler used to change the value for a checkbox */\n onSelectChange = (value: any) => {\n const { onChange, idSchema } = this.props;\n onChange(value, undefined, idSchema && idSchema.$id);\n };\n\n /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements\n */\n render() {\n const { schema, uiSchema, idSchema, registry } = this.props;\n const { schemaUtils, translateString } = registry;\n if (!(ITEMS_KEY in schema)) {\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T[], S, F>(\n 'UnsupportedFieldTemplate',\n registry,\n uiOptions\n );\n\n return (\n <UnsupportedFieldTemplate\n schema={schema}\n idSchema={idSchema}\n reason={translateString(TranslatableString.MissingItems)}\n registry={registry}\n />\n );\n }\n if (schemaUtils.isMultiSelect(schema)) {\n // If array has enum or uniqueItems set to true, call renderMultiSelect() to render the default multiselect widget or a custom widget, if specified.\n return this.renderMultiSelect();\n }\n if (isCustomWidget<T[], S, F>(uiSchema)) {\n return this.renderCustomWidget();\n }\n if (isFixedItems(schema)) {\n return this.renderFixedArray();\n }\n if (schemaUtils.isFilesArray(schema, uiSchema)) {\n return this.renderFiles();\n }\n return this.renderNormalArray();\n }\n\n /** Renders a normal array without any limitations of length\n */\n renderNormalArray() {\n const {\n schema,\n uiSchema = {},\n errorSchema,\n idSchema,\n name,\n title,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n registry,\n onBlur,\n onFocus,\n idPrefix,\n idSeparator = '_',\n rawErrors,\n } = this.props;\n const { keyedFormData } = this.state;\n const fieldTitle = schema.title || title || name;\n const { schemaUtils, formContext } = registry;\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const _schemaItems: S = isObject(schema.items) ? (schema.items as S) : ({} as S);\n const itemsSchema: S = schemaUtils.retrieveSchema(_schemaItems);\n const formData = keyedToPlainFormData(this.state.keyedFormData);\n const canAdd = this.canAddItem(formData);\n const arrayProps: ArrayFieldTemplateProps<T[], S, F> = {\n canAdd,\n items: keyedFormData.map((keyedItem, index) => {\n const { key, item } = keyedItem;\n // While we are actually dealing with a single item of type T, the types require a T[], so cast\n const itemCast = item as unknown as T[];\n const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);\n const itemErrorSchema = errorSchema ? (errorSchema[index] as ErrorSchema<T[]>) : undefined;\n const itemIdPrefix = idSchema.$id + idSeparator + index;\n const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);\n return this.renderArrayFieldItem({\n key,\n index,\n name: name && `${name}-${index}`,\n title: fieldTitle ? `${fieldTitle}-${index + 1}` : undefined,\n canAdd,\n canMoveUp: index > 0,\n canMoveDown: index < formData.length - 1,\n itemSchema,\n itemIdSchema,\n itemErrorSchema,\n itemData: itemCast,\n itemUiSchema: uiSchema.items,\n autofocus: autofocus && index === 0,\n onBlur,\n onFocus,\n rawErrors,\n totalItems: keyedFormData.length,\n });\n }),\n className: `field field-array field-array-of-${itemsSchema.type}`,\n disabled,\n idSchema,\n uiSchema,\n onAddClick: this.onAddClick,\n readonly,\n required,\n schema,\n title: fieldTitle,\n formContext,\n formData,\n rawErrors,\n registry,\n };\n\n const Template = getTemplate<'ArrayFieldTemplate', T[], S, F>('ArrayFieldTemplate', registry, uiOptions);\n return <Template {...arrayProps} />;\n }\n\n /** Renders an array using the custom widget provided by the user in the `uiSchema`\n */\n renderCustomWidget() {\n const {\n schema,\n idSchema,\n uiSchema,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n hideError,\n placeholder,\n onBlur,\n onFocus,\n formData: items = [],\n registry,\n rawErrors,\n name,\n } = this.props;\n const { widgets, formContext, globalUiOptions, schemaUtils } = registry;\n const { widget, title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n options={options}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n value={items}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n required={required}\n label={label}\n hideLabel={!displayLabel}\n placeholder={placeholder}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n }\n\n /** Renders an array as a set of checkboxes\n */\n renderMultiSelect() {\n const {\n schema,\n idSchema,\n uiSchema,\n formData: items = [],\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n placeholder,\n onBlur,\n onFocus,\n registry,\n rawErrors,\n name,\n } = this.props;\n const { widgets, schemaUtils, formContext, globalUiOptions } = registry;\n const itemsSchema = schemaUtils.retrieveSchema(schema.items as S, items);\n const enumOptions = optionsList<S, T[], F>(itemsSchema, uiSchema);\n const { widget = 'select', title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n value={items}\n disabled={disabled}\n readonly={readonly}\n required={required}\n label={label}\n hideLabel={!displayLabel}\n placeholder={placeholder}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n }\n\n /** Renders an array of files using the `FileWidget`\n */\n renderFiles() {\n const {\n schema,\n uiSchema,\n idSchema,\n name,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n onBlur,\n onFocus,\n registry,\n formData: items = [],\n rawErrors,\n } = this.props;\n const { widgets, formContext, globalUiOptions, schemaUtils } = registry;\n const { widget = 'files', title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T[], S, F>(schema, widget, widgets);\n const label = uiTitle ?? schema.title ?? name;\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n return (\n <Widget\n options={options}\n id={idSchema.$id}\n name={name}\n multiple\n onChange={this.onSelectChange}\n onBlur={onBlur}\n onFocus={onFocus}\n schema={schema}\n uiSchema={uiSchema}\n value={items}\n disabled={disabled}\n readonly={readonly}\n required={required}\n registry={registry}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n label={label}\n hideLabel={!displayLabel}\n />\n );\n }\n\n /** Renders an array that has a maximum limit of items\n */\n renderFixedArray() {\n const {\n schema,\n uiSchema = {},\n formData = [],\n errorSchema,\n idPrefix,\n idSeparator = '_',\n idSchema,\n name,\n title,\n disabled = false,\n readonly = false,\n autofocus = false,\n required = false,\n registry,\n onBlur,\n onFocus,\n rawErrors,\n } = this.props;\n const { keyedFormData } = this.state;\n let { formData: items = [] } = this.props;\n const fieldTitle = schema.title || title || name;\n const uiOptions = getUiOptions<T[], S, F>(uiSchema);\n const { schemaUtils, formContext } = registry;\n const _schemaItems: S[] = isObject(schema.items) ? (schema.items as S[]) : ([] as S[]);\n const itemSchemas = _schemaItems.map((item: S, index: number) =>\n schemaUtils.retrieveSchema(item, formData[index] as unknown as T[])\n );\n const additionalSchema = isObject(schema.additionalItems)\n ? schemaUtils.retrieveSchema(schema.additionalItems as S, formData)\n : null;\n\n if (!items || items.length < itemSchemas.length) {\n // to make sure at least all fixed items are generated\n items = items || [];\n items = items.concat(new Array(itemSchemas.length - items.length));\n }\n\n // These are the props passed into the render function\n const canAdd = this.canAddItem(items) && !!additionalSchema;\n const arrayProps: ArrayFieldTemplateProps<T[], S, F> = {\n canAdd,\n className: 'field field-array field-array-fixed-items',\n disabled,\n idSchema,\n formData,\n items: keyedFormData.map((keyedItem, index) => {\n const { key, item } = keyedItem;\n // While we are actually dealing with a single item of type T, the types require a T[], so cast\n const itemCast = item as unknown as T[];\n const additional = index >= itemSchemas.length;\n const itemSchema =\n (additional && isObject(schema.additionalItems)\n ? schemaUtils.retrieveSchema(schema.additionalItems as S, itemCast)\n : itemSchemas[index]) || {};\n const itemIdPrefix = idSchema.$id + idSeparator + index;\n const itemIdSchema = schemaUtils.toIdSchema(itemSchema, itemIdPrefix, itemCast, idPrefix, idSeparator);\n const itemUiSchema = additional\n ? uiSchema.additionalItems || {}\n : Array.isArray(uiSchema.items)\n ? uiSchema.items[index]\n : uiSchema.items || {};\n const itemErrorSchema = errorSchema ? (errorSchema[index] as ErrorSchema<T[]>) : undefined;\n\n return this.renderArrayFieldItem({\n key,\n index,\n name: name && `${name}-${index}`,\n title: fieldTitle ? `${fieldTitle}-${index + 1}` : undefined,\n canAdd,\n canRemove: additional,\n canMoveUp: index >= itemSchemas.length + 1,\n canMoveDown: additional && index < items.length - 1,\n itemSchema,\n itemData: itemCast,\n itemUiSchema,\n itemIdSchema,\n itemErrorSchema,\n autofocus: autofocus && index === 0,\n onBlur,\n onFocus,\n rawErrors,\n totalItems: keyedFormData.length,\n });\n }),\n onAddClick: this.onAddClick,\n readonly,\n required,\n registry,\n schema,\n uiSchema,\n title: fieldTitle,\n formContext,\n errorSchema,\n rawErrors,\n };\n\n const Template = getTemplate<'ArrayFieldTemplate', T[], S, F>('ArrayFieldTemplate', registry, uiOptions);\n return <Template {...arrayProps} />;\n }\n\n /** Renders the individual array item using a `SchemaField` along with the additional properties required to be send\n * back to the `ArrayFieldItemTemplate`.\n *\n * @param props - The props for the individual array item to be rendered\n */\n renderArrayFieldItem(props: {\n key: string;\n index: number;\n name: string;\n title: string | undefined;\n canAdd: boolean;\n canRemove?: boolean;\n canMoveUp: boolean;\n canMoveDown: boolean;\n itemSchema: S;\n itemData: T[];\n itemUiSchema: UiSchema<T[], S, F>;\n itemIdSchema: IdSchema<T[]>;\n itemErrorSchema?: ErrorSchema<T[]>;\n autofocus?: boolean;\n onBlur: FieldProps<T[], S, F>['onBlur'];\n onFocus: FieldProps<T[], S, F>['onFocus'];\n rawErrors?: string[];\n totalItems: number;\n }) {\n const {\n key,\n index,\n name,\n canAdd,\n canRemove = true,\n canMoveUp,\n canMoveDown,\n itemSchema,\n itemData,\n itemUiSchema,\n itemIdSchema,\n itemErrorSchema,\n autofocus,\n onBlur,\n onFocus,\n rawErrors,\n totalItems,\n title,\n } = props;\n const { disabled, hideError, idPrefix, idSeparator, readonly, uiSchema, registry, formContext } = this.props;\n const {\n fields: { ArraySchemaField, SchemaField },\n globalUiOptions,\n } = registry;\n const ItemSchemaField = ArraySchemaField || SchemaField;\n const { orderable = true, removable = true, copyable = false } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);\n const has: { [key: string]: boolean } = {\n moveUp: orderable && canMoveUp,\n moveDown: orderable && canMoveDown,\n copy: copyable && canAdd,\n remove: removable && canRemove,\n toolbar: false,\n };\n has.toolbar = Object.keys(has).some((key: keyof typeof has) => has[key]);\n\n return {\n children: (\n <ItemSchemaField\n name={name}\n title={title}\n index={index}\n schema={itemSchema}\n uiSchema={itemUiSchema}\n formData={itemData}\n formContext={formContext}\n errorSchema={itemErrorSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n idSchema={itemIdSchema}\n required={this.isItemRequired(itemSchema)}\n onChange={this.onChangeForIndex(index)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n ),\n className: 'array-item',\n disabled,\n canAdd,\n hasCopy: has.copy,\n hasToolbar: has.toolbar,\n hasMoveUp: has.moveUp,\n hasMoveDown: has.moveDown,\n hasRemove: has.remove,\n index,\n totalItems,\n key,\n onAddIndexClick: this.onAddIndexClick,\n onCopyIndexClick: this.onCopyIndexClick,\n onDropIndexClick: this.onDropIndexClick,\n onReorderClick: this.onReorderClick,\n readonly,\n registry,\n schema: itemSchema,\n uiSchema: itemUiSchema,\n };\n }\n}\n\n/** `ArrayField` is `React.ComponentType<FieldProps<T[], S, F>>` (necessarily) but the `registry` requires things to be a\n * `Field` which is defined as `React.ComponentType<FieldProps<T, S, F>>`, so cast it to make `registry` happy.\n */\nexport default ArrayField;\n", "import {\n getWidget,\n getUiOptions,\n optionsList,\n FieldProps,\n FormContextType,\n EnumOptionsType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n} from '@rjsf/utils';\nimport isObject from 'lodash/isObject';\n\n/** The `BooleanField` component is used to render a field in the schema is boolean. It constructs `enumOptions` for the\n * two boolean values based on the various alternatives in the schema.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema,\n name,\n uiSchema,\n idSchema,\n formData,\n registry,\n required,\n disabled,\n readonly,\n hideError,\n autofocus,\n title,\n onChange,\n onFocus,\n onBlur,\n rawErrors,\n } = props;\n const { title: schemaTitle } = schema;\n const { widgets, formContext, translateString, globalUiOptions } = registry;\n const {\n widget = 'checkbox',\n title: uiTitle,\n // Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type\n label: displayLabel = true,\n ...options\n } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget(schema, widget, widgets);\n const yes = translateString(TranslatableString.YesLabel);\n const no = translateString(TranslatableString.NoLabel);\n let enumOptions: EnumOptionsType<S>[] | undefined;\n const label = uiTitle ?? schemaTitle ?? title ?? name;\n if (Array.isArray(schema.oneOf)) {\n enumOptions = optionsList<S, T, F>(\n {\n oneOf: schema.oneOf\n .map((option) => {\n if (isObject(option)) {\n return {\n ...option,\n title: option.title || (option.const === true ? yes : no),\n };\n }\n return undefined;\n })\n .filter((o: any) => o) as S[], // cast away the error that typescript can't grok is fixed\n } as unknown as S,\n uiSchema\n );\n } else {\n // We deprecated enumNames in v5. It's intentionally omitted from RSJFSchema type, so we need to cast here.\n const schemaWithEnumNames = schema as S & { enumNames?: string[] };\n const enums = schema.enum ?? [true, false];\n if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {\n enumOptions = [\n {\n value: enums[0],\n label: enums[0] ? yes : no,\n },\n {\n value: enums[1],\n label: enums[1] ? yes : no,\n },\n ];\n } else {\n enumOptions = optionsList<S, T, F>(\n {\n enum: enums,\n // NOTE: enumNames is deprecated, but still supported for now.\n enumNames: schemaWithEnumNames.enumNames,\n } as unknown as S,\n uiSchema\n );\n }\n }\n\n return (\n <Widget\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n id={idSchema.$id}\n name={name}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n label={label}\n hideLabel={!displayLabel}\n value={formData}\n required={required}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n registry={registry}\n formContext={formContext}\n autofocus={autofocus}\n rawErrors={rawErrors}\n />\n );\n}\n\nexport default BooleanField;\n", "import { Component } from 'react';\nimport get from 'lodash/get';\nimport isEmpty from 'lodash/isEmpty';\nimport omit from 'lodash/omit';\nimport {\n ANY_OF_KEY,\n deepEquals,\n ERRORS_KEY,\n FieldProps,\n FormContextType,\n getDiscriminatorFieldFromSchema,\n getUiOptions,\n getWidget,\n mergeSchemas,\n ONE_OF_KEY,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UiSchema,\n} from '@rjsf/utils';\n\n/** Type used for the state of the `AnyOfField` component */\ntype AnyOfFieldState<S extends StrictRJSFSchema = RJSFSchema> = {\n /** The currently selected option */\n selectedOption: number;\n /** The option schemas after retrieving all $refs */\n retrievedOptions: S[];\n};\n\n/** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks\n * the currently selected option and cleans up any irrelevant data in `formData`.\n *\n * @param props - The `FieldProps` for this template\n */\nclass AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>,\n AnyOfFieldState<S>\n> {\n /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state\n *\n * @param props - The `FieldProps` for this template\n */\n constructor(props: FieldProps<T, S, F>) {\n super(props);\n\n const {\n formData,\n options,\n registry: { schemaUtils },\n } = this.props;\n // cache the retrieved options in state in case they have $refs to save doing it later\n const retrievedOptions = options.map((opt: S) => schemaUtils.retrieveSchema(opt, formData));\n\n this.state = {\n retrievedOptions,\n selectedOption: this.getMatchingOption(0, formData, retrievedOptions),\n };\n }\n\n /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the\n * currently selected option based on the overall `formData`\n *\n * @param prevProps - The previous `FieldProps` for this template\n * @param prevState - The previous `AnyOfFieldState` for this template\n */\n componentDidUpdate(prevProps: Readonly<FieldProps<T, S, F>>, prevState: Readonly<AnyOfFieldState>) {\n const { formData, options, idSchema } = this.props;\n const { selectedOption } = this.state;\n let newState = this.state;\n if (!deepEquals(prevProps.options, options)) {\n const {\n registry: { schemaUtils },\n } = this.props;\n // re-cache the retrieved options in state in case they have $refs to save doing it later\n const retrievedOptions = options.map((opt: S) => schemaUtils.retrieveSchema(opt, formData));\n newState = { selectedOption, retrievedOptions };\n }\n if (!deepEquals(formData, prevProps.formData) && idSchema.$id === prevProps.idSchema.$id) {\n const { retrievedOptions } = newState;\n const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);\n\n if (prevState && matchingOption !== selectedOption) {\n newState = { selectedOption: matchingOption, retrievedOptions };\n }\n }\n if (newState !== this.state) {\n this.setState(newState);\n }\n }\n\n /** Determines the best matching option for the given `formData` and `options`.\n *\n * @param formData - The new formData\n * @param options - The list of options to choose from\n * @return - The index of the `option` that best matches the `formData`\n */\n getMatchingOption(selectedOption: number, formData: T | undefined, options: S[]) {\n const {\n schema,\n registry: { schemaUtils },\n } = this.props;\n\n const discriminator = getDiscriminatorFieldFromSchema<S>(schema);\n const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);\n return option;\n }\n\n /** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated\n * to remove properties that are not part of the newly selected option schema, and then the updated data is passed to\n * the `onChange` handler.\n *\n * @param option - The new option value being selected\n */\n onOptionChange = (option?: string) => {\n const { selectedOption, retrievedOptions } = this.state;\n const { formData, onChange, registry } = this.props;\n const { schemaUtils } = registry;\n const intOption = option !== undefined ? parseInt(option, 10) : -1;\n if (intOption === selectedOption) {\n return;\n }\n const newOption = intOption >= 0 ? retrievedOptions[intOption] : undefined;\n const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : undefined;\n\n let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);\n if (newFormData && newOption) {\n // Call getDefaultFormState to make sure defaults are populated on change. Pass \"excludeObjectChildren\"\n // so that only the root objects themselves are created without adding undefined children properties\n newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren') as T;\n }\n onChange(newFormData, undefined, this.getFieldId());\n\n this.setState({ selectedOption: intOption });\n };\n\n getFieldId() {\n const { idSchema, schema } = this.props;\n return `${idSchema.$id}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`;\n }\n\n /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`\n */\n render() {\n const {\n name,\n disabled = false,\n errorSchema = {},\n formContext,\n onBlur,\n onFocus,\n registry,\n schema,\n uiSchema,\n } = this.props;\n\n const { widgets, fields, translateString, globalUiOptions, schemaUtils } = registry;\n const { SchemaField: _SchemaField } = fields;\n const { selectedOption, retrievedOptions } = this.state;\n const {\n widget = 'select',\n placeholder,\n autofocus,\n autocomplete,\n title = schema.title,\n ...uiOptions\n } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const Widget = getWidget<T, S, F>({ type: 'number' }, widget, widgets);\n const rawErrors = get(errorSchema, ERRORS_KEY, []);\n const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n\n const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;\n let optionSchema: S | undefined | null;\n\n if (option) {\n // merge top level required field\n const { required } = schema;\n // Merge in all the non-oneOf/anyOf properties and also skip the special ADDITIONAL_PROPERTY_FLAG property\n optionSchema = required ? (mergeSchemas({ required }, option) as S) : option;\n }\n\n // First we will check to see if there is an anyOf/oneOf override for the UI schema\n let optionsUiSchema: UiSchema<T, S, F>[] = [];\n if (ONE_OF_KEY in schema && uiSchema && ONE_OF_KEY in uiSchema) {\n if (Array.isArray(uiSchema[ONE_OF_KEY])) {\n optionsUiSchema = uiSchema[ONE_OF_KEY];\n } else {\n console.warn(`uiSchema.oneOf is not an array for \"${title || name}\"`);\n }\n } else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {\n if (Array.isArray(uiSchema[ANY_OF_KEY])) {\n optionsUiSchema = uiSchema[ANY_OF_KEY];\n } else {\n console.warn(`uiSchema.anyOf is not an array for \"${title || name}\"`);\n }\n }\n // Then we pick the one that matches the selected option index, if one exists otherwise default to the main uiSchema\n let optionUiSchema = uiSchema;\n if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {\n optionUiSchema = optionsUiSchema[selectedOption];\n }\n\n const translateEnum: TranslatableString = title\n ? TranslatableString.TitleOptionPrefix\n : TranslatableString.OptionPrefix;\n const translateParams = title ? [title] : [];\n const enumOptions = retrievedOptions.map((opt: { title?: string }, index: number) => {\n // Also see if there is an override title in the uiSchema for each option, otherwise use the title from the option\n const { title: uiTitle = opt.title } = getUiOptions<T, S, F>(optionsUiSchema[index]);\n return {\n label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),\n value: index,\n };\n });\n\n return (\n <div className='panel panel-default panel-body'>\n <div className='form-group'>\n <Widget\n id={this.getFieldId()}\n name={`${name}${schema.oneOf ? '__oneof_select' : '__anyof_select'}`}\n schema={{ type: 'number', default: 0 } as S}\n onChange={this.onOptionChange}\n onBlur={onBlur}\n onFocus={onFocus}\n disabled={disabled || isEmpty(enumOptions)}\n multiple={false}\n rawErrors={rawErrors}\n errorSchema={fieldErrorSchema}\n value={selectedOption >= 0 ? selectedOption : undefined}\n options={{ enumOptions, ...uiOptions }}\n registry={registry}\n formContext={formContext}\n placeholder={placeholder}\n autocomplete={autocomplete}\n autofocus={autofocus}\n label={title ?? name}\n hideLabel={!displayLabel}\n />\n </div>\n {optionSchema && <_SchemaField {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />}\n </div>\n );\n }\n}\n\nexport default AnyOfField;\n", "import { useState, useCallback } from 'react';\nimport { asNumber, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n// Matches a string that ends in a . character, optionally followed by a sequence of\n// digits followed by any number of 0 characters up until the end of the line.\n// Ensuring that there is at least one prefixed character is important so that\n// you don't incorrectly match against \"0\".\nconst trailingCharMatcherWithPrefix = /\\.([0-9]*0)*$/;\n\n// This is used for trimming the trailing 0 and . characters without affecting\n// the rest of the string. Its possible to use one RegEx with groups for this\n// functionality, but it is fairly complex compared to simply defining two\n// different matchers.\nconst trailingCharMatcher = /[0.]0*$/;\n\n/**\n * The NumberField class has some special handling for dealing with trailing\n * decimal points and/or zeroes. This logic is designed to allow trailing values\n * to be visible in the input element, but not be represented in the\n * corresponding form data.\n *\n * The algorithm is as follows:\n *\n * 1. When the input value changes the value is cached in the component state\n *\n * 2. The value is then normalized, removing trailing decimal points and zeros,\n * then passed to the \"onChange\" callback\n *\n * 3. When the component is rendered, the formData value is checked against the\n * value cached in the state. If it matches the cached value, the cached\n * value is passed to the input instead of the formData value\n */\nfunction NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const { registry, onChange, formData, value: initialValue } = props;\n const [lastValue, setLastValue] = useState(initialValue);\n const { StringField } = registry.fields;\n\n let value = formData;\n\n /** Handle the change from the `StringField` to properly convert to a number\n *\n * @param value - The current value for the change occurring\n */\n const handleChange = useCallback(\n (value: FieldProps<T, S, F>['value']) => {\n // Cache the original value in component state\n setLastValue(value);\n\n // Normalize decimals that don't start with a zero character in advance so\n // that the rest of the normalization logic is simpler\n if (`${value}`.charAt(0) === '.') {\n value = `0${value}`;\n }\n\n // Check that the value is a string (this can happen if the widget used is a\n // <select>, due to an enum declaration etc) then, if the value ends in a\n // trailing decimal point or multiple zeroes, strip the trailing values\n const processed =\n typeof value === 'string' && value.match(trailingCharMatcherWithPrefix)\n ? asNumber(value.replace(trailingCharMatcher, ''))\n : asNumber(value);\n\n onChange(processed as unknown as T);\n },\n [onChange]\n );\n\n if (typeof lastValue === 'string' && typeof value === 'number') {\n // Construct a regular expression that checks for a string that consists\n // of the formData value suffixed with zero or one '.' characters and zero\n // or more '0' characters\n const re = new RegExp(`^(${String(value).replace('.', '\\\\.')})?\\\\.?0*$`);\n\n // If the cached \"lastValue\" is a match, use that instead of the formData\n // value to prevent the input value from changing in the UI\n if (lastValue.match(re)) {\n value = lastValue as unknown as T;\n }\n }\n\n return <StringField {...props} formData={value} onChange={handleChange} />;\n}\n\nexport default NumberField;\n", "import { Component } from 'react';\nimport {\n getTemplate,\n getUiOptions,\n orderProperties,\n ErrorSchema,\n FieldProps,\n FormContextType,\n GenericObjectType,\n IdSchema,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n ADDITIONAL_PROPERTY_FLAG,\n PROPERTIES_KEY,\n REF_KEY,\n ANY_OF_KEY,\n ONE_OF_KEY,\n} from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\nimport get from 'lodash/get';\nimport has from 'lodash/has';\nimport isObject from 'lodash/isObject';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\n\n/** Type used for the state of the `ObjectField` component */\ntype ObjectFieldState = {\n /** Flag indicating whether an additional property key was modified */\n wasPropertyKeyModified: boolean;\n /** The set of additional properties */\n additionalProperties: object;\n};\n\n/** The `ObjectField` component is used to render a field in the schema that is of type `object`. It tracks whether an\n * additional property key was modified and what it was modified to\n *\n * @param props - The `FieldProps` for this template\n */\nclass ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>,\n ObjectFieldState\n> {\n /** Set up the initial state */\n state = {\n wasPropertyKeyModified: false,\n additionalProperties: {},\n };\n\n /** Returns a flag indicating whether the `name` field is required in the object schema\n *\n * @param name - The name of the field to check for required-ness\n * @returns - True if the field `name` is required, false otherwise\n */\n isRequired(name: string) {\n const { schema } = this.props;\n return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;\n }\n\n /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting\n * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated\n * formData.\n *\n * @param name - The name of the property\n * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property\n * @returns - The onPropertyChange callback for the `name` property\n */\n onPropertyChange = (name: string, addedByAdditionalProperties = false) => {\n return (value: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const { formData, onChange, errorSchema } = this.props;\n if (value === undefined && addedByAdditionalProperties) {\n // Don't set value = undefined for fields added by\n // additionalProperties. Doing so removes them from the\n // formData, which causes them to completely disappear\n // (including the input field for the property name). Unlike\n // fields which are \"mandated\" by the schema, these fields can\n // be set to undefined by clicking a \"delete field\" button, so\n // set empty values to the empty string.\n value = '' as unknown as T;\n }\n const newFormData = { ...formData, [name]: value } as unknown as T;\n onChange(\n newFormData,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [name]: newErrorSchema,\n },\n id\n );\n };\n };\n\n /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data\n * and calls the `onChange` callback with it\n *\n * @param key - The key for which the drop callback is desired\n * @returns - The drop property click callback\n */\n onDropPropertyClick = (key: string) => {\n return (event: DragEvent) => {\n event.preventDefault();\n const { onChange, formData } = this.props;\n const copiedFormData = { ...formData } as T;\n unset(copiedFormData, key);\n onChange(copiedFormData);\n };\n };\n\n /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one\n * that is already not assigned is found.\n *\n * @param preferredKey - The preferred name of a new key\n * @param [formData] - The form data in which to check if the desired key already exists\n * @returns - The name of the next available key from `preferredKey`\n */\n getAvailableKey = (preferredKey: string, formData?: T) => {\n const { uiSchema, registry } = this.props;\n const { duplicateKeySuffixSeparator = '-' } = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n\n let index = 0;\n let newKey = preferredKey;\n while (has(formData, newKey)) {\n newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;\n }\n return newKey;\n };\n\n /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That\n * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.\n *\n * @param oldValue - The old value of a field\n * @returns - The key change callback function\n */\n onKeyChange = (oldValue: any) => {\n return (value: any, newErrorSchema: ErrorSchema<T>) => {\n if (oldValue === value) {\n return;\n }\n const { formData, onChange, errorSchema } = this.props;\n\n value = this.getAvailableKey(value, formData);\n const newFormData: GenericObjectType = {\n ...(formData as GenericObjectType),\n };\n const newKeys: GenericObjectType = { [oldValue]: value };\n const keyValues = Object.keys(newFormData).map((key) => {\n const newKey = newKeys[key] || key;\n return { [newKey]: newFormData[key] };\n });\n const renamedObj = Object.assign({}, ...keyValues);\n\n this.setState({ wasPropertyKeyModified: true });\n\n onChange(\n renamedObj,\n errorSchema &&\n errorSchema && {\n ...errorSchema,\n [value]: newErrorSchema,\n }\n );\n };\n };\n\n /** Returns a default value to be used for a new additional schema property of the given `type`\n *\n * @param type - The type of the new additional schema property\n */\n getDefaultValue(type?: RJSFSchema['type']) {\n const {\n registry: { translateString },\n } = this.props;\n switch (type) {\n case 'array':\n return [];\n case 'boolean':\n return false;\n case 'null':\n return null;\n case 'number':\n return 0;\n case 'object':\n return {};\n case 'string':\n default:\n // We don't have a datatype for some reason (perhaps additionalProperties was true)\n return translateString(TranslatableString.NewStringDefault);\n }\n }\n\n /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new\n * default data for that field has been added to the formData.\n *\n * @param schema - The schema element to which the new property is being added\n */\n handleAddClick = (schema: S) => () => {\n if (!schema.additionalProperties) {\n return;\n }\n const { formData, onChange, registry } = this.props;\n const newFormData = { ...formData } as T;\n\n let type: RJSFSchema['type'] = undefined;\n let defaultValue: RJSFSchema['default'] = undefined;\n if (isObject(schema.additionalProperties)) {\n type = schema.additionalProperties.type;\n defaultValue = schema.additionalProperties.default;\n let apSchema = schema.additionalProperties;\n if (REF_KEY in apSchema) {\n const { schemaUtils } = registry;\n apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] } as S, formData);\n type = apSchema.type;\n defaultValue = apSchema.default;\n }\n if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {\n type = 'object';\n }\n }\n\n const newKey = this.getAvailableKey('newKey', newFormData);\n // Cast this to make the `set` work properly\n set(newFormData as GenericObjectType, newKey, defaultValue ?? this.getDefaultValue(type));\n\n onChange(newFormData);\n };\n\n /** Renders the `ObjectField` from the given props\n */\n render() {\n const {\n schema: rawSchema,\n uiSchema = {},\n formData,\n errorSchema,\n idSchema,\n name,\n required = false,\n disabled,\n readonly,\n hideError,\n idPrefix,\n idSeparator,\n onBlur,\n onFocus,\n registry,\n title,\n } = this.props;\n\n const { fields, formContext, schemaUtils, translateString, globalUiOptions } = registry;\n const { SchemaField } = fields;\n const schema: S = schemaUtils.retrieveSchema(rawSchema, formData);\n const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const { properties: schemaProperties = {} } = schema;\n\n const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;\n const description = uiOptions.description ?? schema.description;\n let orderedProperties: string[];\n try {\n const properties = Object.keys(schemaProperties);\n orderedProperties = orderProperties(properties, uiOptions.order);\n } catch (err) {\n return (\n <div>\n <p className='config-error' style={{ color: 'red' }}>\n <Markdown options={{ disableParsingRawHTML: true }}>\n {translateString(TranslatableString.InvalidObjectField, [name || 'root', (err as Error).message])}\n </Markdown>\n </p>\n <pre>{JSON.stringify(schema)}</pre>\n </div>\n );\n }\n\n const Template = getTemplate<'ObjectFieldTemplate', T, S, F>('ObjectFieldTemplate', registry, uiOptions);\n\n const templateProps = {\n // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`\n title: uiOptions.label === false ? '' : templateTitle,\n description: uiOptions.label === false ? undefined : description,\n properties: orderedProperties.map((name) => {\n const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name, ADDITIONAL_PROPERTY_FLAG]);\n const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name];\n const hidden = getUiOptions<T, S, F>(fieldUiSchema).widget === 'hidden';\n const fieldIdSchema: IdSchema<T> = get(idSchema, [name], {});\n\n return {\n content: (\n <SchemaField\n key={name}\n name={name}\n required={this.isRequired(name)}\n schema={get(schema, [PROPERTIES_KEY, name], {})}\n uiSchema={fieldUiSchema}\n errorSchema={get(errorSchema, name)}\n idSchema={fieldIdSchema}\n idPrefix={idPrefix}\n idSeparator={idSeparator}\n formData={get(formData, name)}\n formContext={formContext}\n wasPropertyKeyModified={this.state.wasPropertyKeyModified}\n onKeyChange={this.onKeyChange(name)}\n onChange={this.onPropertyChange(name, addedByAdditionalProperties)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n onDropPropertyClick={this.onDropPropertyClick}\n />\n ),\n name,\n readonly,\n disabled,\n required,\n hidden,\n };\n }),\n readonly,\n disabled,\n required,\n idSchema,\n uiSchema,\n errorSchema,\n schema,\n formData,\n formContext,\n registry,\n };\n return <Template {...templateProps} onAddClick={this.handleAddClick} />;\n }\n}\n\nexport default ObjectField;\n", "import { useCallback, Component } from 'react';\nimport {\n ADDITIONAL_PROPERTY_FLAG,\n deepEquals,\n descriptionId,\n ErrorSchema,\n FieldProps,\n FieldTemplateProps,\n FormContextType,\n getSchemaType,\n getTemplate,\n getUiOptions,\n ID_KEY,\n IdSchema,\n mergeObjects,\n Registry,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UI_OPTIONS_KEY,\n UIOptionsType,\n} from '@rjsf/utils';\nimport isObject from 'lodash/isObject';\nimport omit from 'lodash/omit';\nimport Markdown from 'markdown-to-jsx';\n\n/** The map of component type to FieldName */\nconst COMPONENT_TYPES: { [key: string]: string } = {\n array: 'ArrayField',\n boolean: 'BooleanField',\n integer: 'NumberField',\n number: 'NumberField',\n object: 'ObjectField',\n string: 'StringField',\n null: 'NullField',\n};\n\n/** Computes and returns which `Field` implementation to return in order to render the field represented by the\n * `schema`. The `uiOptions` are used to alter what potential `Field` implementation is actually returned. If no\n * appropriate `Field` implementation can be found then a wrapper around `UnsupportedFieldTemplate` is used.\n *\n * @param schema - The schema from which to obtain the type\n * @param uiOptions - The UI Options that may affect the component decision\n * @param idSchema - The id that is passed to the `UnsupportedFieldTemplate`\n * @param registry - The registry from which fields and templates are obtained\n * @returns - The `Field` component that is used to render the actual field data\n */\nfunction getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n schema: S,\n uiOptions: UIOptionsType<T, S, F>,\n idSchema: IdSchema<T>,\n registry: Registry<T, S, F>\n) {\n const field = uiOptions.field;\n const { fields, translateString } = registry;\n if (typeof field === 'function') {\n return field;\n }\n if (typeof field === 'string' && field in fields) {\n return fields[field];\n }\n\n const schemaType = getSchemaType(schema);\n const type: string = Array.isArray(schemaType) ? schemaType[0] : schemaType || '';\n\n const schemaId = schema.$id;\n\n let componentName = COMPONENT_TYPES[type];\n if (schemaId && schemaId in fields) {\n componentName = schemaId;\n }\n\n // If the type is not defined and the schema uses 'anyOf' or 'oneOf', don't\n // render a field and let the MultiSchemaField component handle the form display\n if (!componentName && (schema.anyOf || schema.oneOf)) {\n return () => null;\n }\n\n return componentName in fields\n ? fields[componentName]\n : () => {\n const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T, S, F>(\n 'UnsupportedFieldTemplate',\n registry,\n uiOptions\n );\n\n return (\n <UnsupportedFieldTemplate\n schema={schema}\n idSchema={idSchema}\n reason={translateString(TranslatableString.UnknownFieldType, [String(schema.type)])}\n registry={registry}\n />\n );\n };\n}\n\n/** The `SchemaFieldRender` component is the work-horse of react-jsonschema-form, determining what kind of real field to\n * render based on the `schema`, `uiSchema` and all the other props. It also deals with rendering the `anyOf` and\n * `oneOf` fields.\n *\n * @param props - The `FieldProps` for this component\n */\nfunction SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema: _schema,\n idSchema: _idSchema,\n uiSchema,\n formData,\n errorSchema,\n idPrefix,\n idSeparator,\n name,\n onChange,\n onKeyChange,\n onDropPropertyClick,\n required,\n registry,\n wasPropertyKeyModified = false,\n } = props;\n const { formContext, schemaUtils, globalUiOptions } = registry;\n const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);\n const FieldTemplate = getTemplate<'FieldTemplate', T, S, F>('FieldTemplate', registry, uiOptions);\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n uiOptions\n );\n const FieldHelpTemplate = getTemplate<'FieldHelpTemplate', T, S, F>('FieldHelpTemplate', registry, uiOptions);\n const FieldErrorTemplate = getTemplate<'FieldErrorTemplate', T, S, F>('FieldErrorTemplate', registry, uiOptions);\n const schema = schemaUtils.retrieveSchema(_schema, formData);\n const fieldId = _idSchema[ID_KEY];\n const idSchema = mergeObjects(\n schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator),\n _idSchema\n ) as IdSchema<T>;\n\n /** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the\n * `onChange` chain if it is not already being provided from a deeper level in the hierarchy\n */\n const handleFieldComponentChange = useCallback(\n (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {\n const theId = id || fieldId;\n return onChange(formData, newErrorSchema, theId);\n },\n [fieldId, onChange]\n );\n\n const FieldComponent = getFieldComponent<T, S, F>(schema, uiOptions, idSchema, registry);\n const disabled = Boolean(uiOptions.disabled ?? props.disabled);\n const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));\n const uiSchemaHideError = uiOptions.hideError;\n // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children\n const hideError = uiSchemaHideError === undefined ? props.hideError : Boolean(uiSchemaHideError);\n const autofocus = Boolean(uiOptions.autofocus ?? props.autofocus);\n if (Object.keys(schema).length === 0) {\n return null;\n }\n\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n\n const { __errors, ...fieldErrorSchema } = errorSchema || {};\n // See #439: uiSchema: Don't pass consumed class names or style to child components\n const fieldUiSchema = omit(uiSchema, ['ui:classNames', 'classNames', 'ui:style']);\n if (UI_OPTIONS_KEY in fieldUiSchema) {\n fieldUiSchema[UI_OPTIONS_KEY] = omit(fieldUiSchema[UI_OPTIONS_KEY], ['classNames', 'style']);\n }\n\n const field = (\n <FieldComponent\n {...props}\n onChange={handleFieldComponentChange}\n idSchema={idSchema}\n schema={schema}\n uiSchema={fieldUiSchema}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n autofocus={autofocus}\n errorSchema={fieldErrorSchema}\n formContext={formContext}\n rawErrors={__errors}\n />\n );\n\n const id = idSchema[ID_KEY];\n\n // If this schema has a title defined, but the user has set a new key/label, retain their input.\n let label;\n if (wasPropertyKeyModified) {\n label = name;\n } else {\n label =\n ADDITIONAL_PROPERTY_FLAG in schema\n ? name\n : uiOptions.title || props.schema.title || schema.title || props.title || name;\n }\n\n const description = uiOptions.description || props.schema.description || schema.description || '';\n\n const richDescription = uiOptions.enableMarkdownInDescription ? (\n <Markdown options={{ disableParsingRawHTML: true }}>{description}</Markdown>\n ) : (\n description\n );\n const help = uiOptions.help;\n const hidden = uiOptions.widget === 'hidden';\n\n const classNames = ['form-group', 'field', `field-${getSchemaType(schema)}`];\n if (!hideError && __errors && __errors.length > 0) {\n classNames.push('field-error has-error has-danger');\n }\n if (uiSchema?.classNames) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n \"'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead.\"\n );\n }\n classNames.push(uiSchema.classNames);\n }\n if (uiOptions.classNames) {\n classNames.push(uiOptions.classNames);\n }\n\n const helpComponent = (\n <FieldHelpTemplate\n help={help}\n idSchema={idSchema}\n schema={schema}\n uiSchema={uiSchema}\n hasErrors={!hideError && __errors && __errors.length > 0}\n registry={registry}\n />\n );\n /*\n * AnyOf/OneOf errors handled by child schema\n * unless it can be rendered as select control\n */\n const errorsComponent =\n hideError || ((schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema)) ? undefined : (\n <FieldErrorTemplate\n errors={__errors}\n errorSchema={errorSchema}\n idSchema={idSchema}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n const fieldProps: Omit<FieldTemplateProps<T, S, F>, 'children'> = {\n description: (\n <DescriptionFieldTemplate\n id={descriptionId<T>(id)}\n description={richDescription}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n ),\n rawDescription: description,\n help: helpComponent,\n rawHelp: typeof help === 'string' ? help : undefined,\n errors: errorsComponent,\n rawErrors: hideError ? undefined : __errors,\n id,\n label,\n hidden,\n onChange,\n onKeyChange,\n onDropPropertyClick,\n required,\n disabled,\n readonly,\n hideError,\n displayLabel,\n classNames: classNames.join(' ').trim(),\n style: uiOptions.style,\n formContext,\n formData,\n schema,\n uiSchema,\n registry,\n };\n\n const _AnyOfField = registry.fields.AnyOfField;\n const _OneOfField = registry.fields.OneOfField;\n const isReplacingAnyOrOneOf = uiSchema?.['ui:field'] && uiSchema?.['ui:fieldReplacesAnyOrOneOf'] === true;\n\n return (\n <FieldTemplate {...fieldProps}>\n <>\n {field}\n {/*\n If the schema `anyOf` or 'oneOf' can be rendered as a select control, don't\n render the selection and let `StringField` component handle\n rendering\n */}\n {schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (\n <_AnyOfField\n name={name}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n errorSchema={errorSchema}\n formData={formData}\n formContext={formContext}\n idPrefix={idPrefix}\n idSchema={idSchema}\n idSeparator={idSeparator}\n onBlur={props.onBlur}\n onChange={props.onChange}\n onFocus={props.onFocus}\n options={schema.anyOf.map((_schema) =>\n schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)\n )}\n registry={registry}\n schema={schema}\n uiSchema={uiSchema}\n />\n )}\n {schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && (\n <_OneOfField\n name={name}\n disabled={disabled}\n readonly={readonly}\n hideError={hideError}\n errorSchema={errorSchema}\n formData={formData}\n formContext={formContext}\n idPrefix={idPrefix}\n idSchema={idSchema}\n idSeparator={idSeparator}\n onBlur={props.onBlur}\n onChange={props.onChange}\n onFocus={props.onFocus}\n options={schema.oneOf.map((_schema) =>\n schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)\n )}\n registry={registry}\n schema={schema}\n uiSchema={uiSchema}\n />\n )}\n </>\n </FieldTemplate>\n );\n}\n\n/** The `SchemaField` component determines whether it is necessary to rerender the component based on any props changes\n * and if so, calls the `SchemaFieldRender` component with the props.\n */\nclass SchemaField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends Component<\n FieldProps<T, S, F>\n> {\n shouldComponentUpdate(nextProps: Readonly<FieldProps<T, S, F>>) {\n return !deepEquals(this.props, nextProps);\n }\n\n render() {\n return <SchemaFieldRender<T, S, F> {...this.props} />;\n }\n}\n\nexport default SchemaField;\n", "import {\n getWidget,\n getUiOptions,\n optionsList,\n hasWidget,\n FieldProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `StringField` component is used to render a schema field that represents a string type\n *\n * @param props - The `FieldProps` for this template\n */\nfunction StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const {\n schema,\n name,\n uiSchema,\n idSchema,\n formData,\n required,\n disabled = false,\n readonly = false,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n registry,\n rawErrors,\n hideError,\n } = props;\n const { title, format } = schema;\n const { widgets, formContext, schemaUtils, globalUiOptions } = registry;\n const enumOptions = schemaUtils.isSelect(schema) ? optionsList<S, T, F>(schema, uiSchema) : undefined;\n let defaultWidget = enumOptions ? 'select' : 'text';\n if (format && hasWidget<T, S, F>(schema, format, widgets)) {\n defaultWidget = format;\n }\n const { widget = defaultWidget, placeholder = '', title: uiTitle, ...options } = getUiOptions<T, S, F>(uiSchema);\n const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);\n const label = uiTitle ?? title ?? name;\n const Widget = getWidget<T, S, F>(schema, widget, widgets);\n return (\n <Widget\n options={{ ...options, enumOptions }}\n schema={schema}\n uiSchema={uiSchema}\n id={idSchema.$id}\n name={name}\n label={label}\n hideLabel={!displayLabel}\n hideError={hideError}\n value={formData}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n required={required}\n disabled={disabled}\n readonly={readonly}\n formContext={formContext}\n autofocus={autofocus}\n registry={registry}\n placeholder={placeholder}\n rawErrors={rawErrors}\n />\n );\n}\n\nexport default StringField;\n", "import { useEffect } from 'react';\nimport { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The `NullField` component is used to render a field in the schema is null. It also ensures that the `formData` is\n * also set to null if it has no value.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction NullField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: FieldProps<T, S, F>\n) {\n const { formData, onChange } = props;\n useEffect(() => {\n if (formData === undefined) {\n onChange(null as unknown as T);\n }\n }, [formData, onChange]);\n\n return null;\n}\n\nexport default NullField;\n", "import { Field, FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport ArrayField from './ArrayField';\nimport BooleanField from './BooleanField';\nimport MultiSchemaField from './MultiSchemaField';\nimport NumberField from './NumberField';\nimport ObjectField from './ObjectField';\nimport SchemaField from './SchemaField';\nimport StringField from './StringField';\nimport NullField from './NullField';\n\nfunction fields<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): RegistryFieldsType<T, S, F> {\n return {\n AnyOfField: MultiSchemaField,\n ArrayField: ArrayField as unknown as Field<T, S, F>,\n // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default\n BooleanField,\n NumberField,\n ObjectField,\n OneOfField: MultiSchemaField,\n SchemaField,\n StringField,\n NullField,\n };\n}\n\nexport default fields;\n", "import {\n descriptionId,\n getTemplate,\n getUiOptions,\n ArrayFieldDescriptionProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldDescriptionTemplate` component renders a `DescriptionFieldTemplate` with an `id` derived from\n * the `idSchema`.\n *\n * @param props - The `ArrayFieldDescriptionProps` for the component\n */\nexport default function ArrayFieldDescriptionTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldDescriptionProps<T, S, F>) {\n const { idSchema, description, registry, schema, uiSchema } = props;\n const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n const { label: displayLabel = true } = options;\n if (!description || !displayLabel) {\n return null;\n }\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n return (\n <DescriptionFieldTemplate\n id={descriptionId<T>(idSchema)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n}\n", "import { CSSProperties } from 'react';\nimport { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.\n *\n * @param props - The `ArrayFieldTemplateItemType` props for the component\n */\nexport default function ArrayFieldItemTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldTemplateItemType<T, S, F>) {\n const {\n children,\n className,\n disabled,\n hasToolbar,\n hasMoveDown,\n hasMoveUp,\n hasRemove,\n hasCopy,\n index,\n onCopyIndexClick,\n onDropIndexClick,\n onReorderClick,\n readonly,\n registry,\n uiSchema,\n } = props;\n const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;\n const btnStyle: CSSProperties = {\n flex: 1,\n paddingLeft: 6,\n paddingRight: 6,\n fontWeight: 'bold',\n };\n return (\n <div className={className}>\n <div className={hasToolbar ? 'col-xs-9' : 'col-xs-12'}>{children}</div>\n {hasToolbar && (\n <div className='col-xs-3 array-item-toolbox'>\n <div\n className='btn-group'\n style={{\n display: 'flex',\n justifyContent: 'space-around',\n }}\n >\n {(hasMoveUp || hasMoveDown) && (\n <MoveUpButton\n style={btnStyle}\n disabled={disabled || readonly || !hasMoveUp}\n onClick={onReorderClick(index, index - 1)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {(hasMoveUp || hasMoveDown) && (\n <MoveDownButton\n style={btnStyle}\n disabled={disabled || readonly || !hasMoveDown}\n onClick={onReorderClick(index, index + 1)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {hasCopy && (\n <CopyButton\n style={btnStyle}\n disabled={disabled || readonly}\n onClick={onCopyIndexClick(index)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {hasRemove && (\n <RemoveButton\n style={btnStyle}\n disabled={disabled || readonly}\n onClick={onDropIndexClick(index)}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n", "import {\n getTemplate,\n getUiOptions,\n ArrayFieldTemplateProps,\n ArrayFieldTemplateItemType,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldTemplate` component is the template used to render all items in an array.\n *\n * @param props - The `ArrayFieldTemplateItemType` 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 className,\n disabled,\n idSchema,\n uiSchema,\n items,\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 ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(\n 'ArrayFieldItemTemplate',\n registry,\n uiOptions\n );\n const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(\n 'ArrayFieldTitleTemplate',\n registry,\n uiOptions\n );\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n return (\n <fieldset className={className} id={idSchema.$id}>\n <ArrayFieldTitleTemplate\n idSchema={idSchema}\n title={uiOptions.title || title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n <ArrayFieldDescriptionTemplate\n idSchema={idSchema}\n description={uiOptions.description || schema.description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n <div className='row array-item-list'>\n {items &&\n items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (\n <ArrayFieldItemTemplate key={key} {...itemProps} />\n ))}\n </div>\n {canAdd && (\n <AddButton\n className='array-item-add'\n onClick={onAddClick}\n disabled={disabled || readonly}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n </fieldset>\n );\n}\n", "import {\n getTemplate,\n getUiOptions,\n titleId,\n ArrayFieldTitleProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TemplatesType,\n} from '@rjsf/utils';\n\n/** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from\n * the `idSchema`.\n *\n * @param props - The `ArrayFieldTitleProps` for the component\n */\nexport default function ArrayFieldTitleTemplate<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: ArrayFieldTitleProps<T, S, F>) {\n const { idSchema, title, schema, uiSchema, required, registry } = props;\n const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);\n const { label: displayLabel = true } = options;\n if (!title || !displayLabel) {\n return null;\n }\n const TitleFieldTemplate: TemplatesType<T, S, F>['TitleFieldTemplate'] = getTemplate<'TitleFieldTemplate', T, S, F>(\n 'TitleFieldTemplate',\n registry,\n options\n );\n return (\n <TitleFieldTemplate\n id={titleId<T>(idSchema)}\n title={title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n );\n}\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n BaseInputTemplateProps,\n examplesId,\n getInputProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\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 ...rest\n value,\n readonly,\n disabled,\n autofocus,\n onBlur,\n onFocus,\n onChange,\n onChangeOverride,\n options,\n schema,\n uiSchema,\n formContext,\n registry,\n rawErrors,\n type,\n hideLabel, // remove this from ...rest\n hideError, // remove this from ...rest\n ...rest\n } = props;\n\n // Note: since React 15.2.0 we can't forward unknown element attributes, so we\n // exclude the \"options\" and \"schema\" ones here.\n if (!id) {\n console.log('No id for', props);\n throw new Error(`no id for props ${JSON.stringify(props)}`);\n }\n const inputProps = {\n ...rest,\n ...getInputProps<T, S, F>(schema, type, options),\n };\n\n let inputValue;\n if (inputProps.type === 'number' || inputProps.type === 'integer') {\n inputValue = value || value === 0 ? value : '';\n } else {\n inputValue = value == null ? '' : value;\n }\n\n const _onChange = useCallback(\n ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onChange(value === '' ? options.emptyValue : value),\n [onChange, options]\n );\n const _onBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value),\n [onBlur, id]\n );\n const _onFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value),\n [onFocus, id]\n );\n\n return (\n <>\n <input\n id={id}\n name={id}\n className='form-control'\n readOnly={readonly}\n disabled={disabled}\n autoFocus={autofocus}\n value={inputValue}\n {...inputProps}\n list={schema.examples ? examplesId<T>(id) : undefined}\n onChange={onChangeOverride || _onChange}\n onBlur={_onBlur}\n onFocus={_onFocus}\n aria-describedby={ariaDescribedByIds<T>(id, !!schema.examples)}\n />\n {Array.isArray(schema.examples) && (\n <datalist key={`datalist_${id}`} id={examplesId<T>(id)}>\n {(schema.examples as string[])\n .concat(schema.default && !schema.examples.includes(schema.default) ? ([schema.default] as string[]) : [])\n .map((example: any) => {\n return <option key={example} value={example} />;\n })}\n </datalist>\n )}\n </>\n );\n}\n", "import { getSubmitButtonOptions, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';\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 return (\n <div>\n <button type='submit' {...submitButtonProps} className={`btn btn-info ${submitButtonProps.className || ''}`}>\n {submitText}\n </button>\n </div>\n );\n}\n", "import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';\n\nimport IconButton from './IconButton';\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 className,\n onClick,\n disabled,\n registry,\n}: IconButtonProps<T, S, F>) {\n const { translateString } = registry;\n return (\n <div className='row'>\n <p className={`col-xs-3 col-xs-offset-9 text-right ${className}`}>\n <IconButton\n iconType='info'\n icon='plus'\n className='btn-add col-xs-12'\n title={translateString(TranslatableString.AddButton)}\n onClick={onClick}\n disabled={disabled}\n registry={registry}\n />\n </p>\n </div>\n );\n}\n", "import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';\n\nexport default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: IconButtonProps<T, S, F>\n) {\n const { iconType = 'default', icon, className, uiSchema, registry, ...otherProps } = props;\n return (\n <button type='button' className={`btn btn-${iconType} ${className}`} {...otherProps}>\n <i className={`glyphicon glyphicon-${icon}`} />\n </button>\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 <IconButton\n title={translateString(TranslatableString.CopyButton)}\n className='array-item-copy'\n {...props}\n icon='copy'\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 <IconButton\n title={translateString(TranslatableString.MoveDownButton)}\n className='array-item-move-down'\n {...props}\n icon='arrow-down'\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 <IconButton\n title={translateString(TranslatableString.MoveUpButton)}\n className='array-item-move-up'\n {...props}\n icon='arrow-up'\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 {\n registry: { translateString },\n } = props;\n return (\n <IconButton\n title={translateString(TranslatableString.RemoveButton)}\n className='array-item-remove'\n {...props}\n iconType='danger'\n icon='remove'\n />\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';\n\nimport SubmitButton from './SubmitButton';\nimport AddButton from './AddButton';\nimport { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from './IconButton';\n\nfunction buttonTemplates<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): TemplatesType<T, S, F>['ButtonTemplates'] {\n return {\n SubmitButton,\n AddButton,\n CopyButton,\n MoveDownButton,\n MoveUpButton,\n RemoveButton,\n };\n}\n\nexport default buttonTemplates;\n", "import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 } = props;\n if (!description) {\n return null;\n }\n if (typeof description === 'string') {\n return (\n <p id={id} className='field-description'>\n {description}\n </p>\n );\n } else {\n return (\n <div id={id} className='field-description'>\n {description}\n </div>\n );\n }\n}\n", "import {\n ErrorListProps,\n FormContextType,\n RJSFValidationError,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n} from '@rjsf/utils';\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}: ErrorListProps<T, S, F>) {\n const { translateString } = registry;\n return (\n <div className='panel panel-danger errors'>\n <div className='panel-heading'>\n <h3 className='panel-title'>{translateString(TranslatableString.ErrorsLabel)}</h3>\n </div>\n <ul className='list-group'>\n {errors.map((error: RJSFValidationError, i: number) => {\n return (\n <li key={i} className='list-group-item text-danger'>\n {error.stack}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n", "import {\n FieldTemplateProps,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n getTemplate,\n getUiOptions,\n} from '@rjsf/utils';\n\nimport Label from './Label';\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 { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;\n const uiOptions = getUiOptions(uiSchema);\n const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(\n 'WrapIfAdditionalTemplate',\n registry,\n uiOptions\n );\n if (hidden) {\n return <div className='hidden'>{children}</div>;\n }\n return (\n <WrapIfAdditionalTemplate {...props}>\n {displayLabel && <Label label={label} required={required} id={id} />}\n {displayLabel && description ? description : null}\n {children}\n {errors}\n {help}\n </WrapIfAdditionalTemplate>\n );\n}\n", "const REQUIRED_FIELD_SYMBOL = '*';\n\nexport type LabelProps = {\n /** The label for the field */\n label?: string;\n /** A boolean value stating if the field is required */\n required?: boolean;\n /** The id of the input field being labeled */\n id?: string;\n};\n\n/** Renders a label for a field\n *\n * @param props - The `LabelProps` for this component\n */\nexport default function Label(props: LabelProps) {\n const { label, required, id } = props;\n if (!label) {\n return null;\n }\n return (\n <label className='control-label' htmlFor={id}>\n {label}\n {required && <span className='required'>{REQUIRED_FIELD_SYMBOL}</span>}\n </label>\n );\n}\n", "import FieldTemplate from './FieldTemplate';\n\nexport default FieldTemplate;\n", "import { errorId, FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 = [], idSchema } = props;\n if (errors.length === 0) {\n return null;\n }\n const id = errorId<T>(idSchema);\n\n return (\n <div>\n <ul id={id} className='error-detail bs-callout bs-callout-info'>\n {errors\n .filter((elem) => !!elem)\n .map((error, index: number) => {\n return (\n <li className='text-danger' key={index}>\n {error}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n", "import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\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 { idSchema, help } = props;\n if (!help) {\n return null;\n }\n const id = helpId<T>(idSchema);\n if (typeof help === 'string') {\n return (\n <p id={id} className='help-block'>\n {help}\n </p>\n );\n }\n return (\n <div id={id} className='help-block'>\n {help}\n </div>\n );\n}\n", "import {\n FormContextType,\n ObjectFieldTemplatePropertyType,\n ObjectFieldTemplateProps,\n RJSFSchema,\n StrictRJSFSchema,\n canExpand,\n descriptionId,\n getTemplate,\n getUiOptions,\n titleId,\n} from '@rjsf/utils';\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 disabled,\n formData,\n idSchema,\n onAddClick,\n properties,\n readonly,\n registry,\n required,\n schema,\n title,\n uiSchema,\n } = props;\n const options = getUiOptions<T, S, F>(uiSchema);\n const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, options);\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n // Button templates are not overridden in the uiSchema\n const {\n ButtonTemplates: { AddButton },\n } = registry.templates;\n return (\n <fieldset id={idSchema.$id}>\n {title && (\n <TitleFieldTemplate\n id={titleId<T>(idSchema)}\n title={title}\n required={required}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {description && (\n <DescriptionFieldTemplate\n id={descriptionId<T>(idSchema)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n {properties.map((prop: ObjectFieldTemplatePropertyType) => prop.content)}\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 </fieldset>\n );\n}\n", "import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nconst REQUIRED_FIELD_SYMBOL = '*';\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, required } = props;\n return (\n <legend id={id}>\n {title}\n {required && <span className='required'>{REQUIRED_FIELD_SYMBOL}</span>}\n </legend>\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString, UnsupportedFieldProps } from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\n\n/** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by\n * react-jsonschema-form.\n *\n * @param props - The `FieldProps` for this template\n */\nfunction UnsupportedField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: UnsupportedFieldProps<T, S, F>\n) {\n const { schema, idSchema, reason, registry } = props;\n const { translateString } = registry;\n let translateEnum: TranslatableString = TranslatableString.UnsupportedField;\n const translateParams: string[] = [];\n if (idSchema && idSchema.$id) {\n translateEnum = TranslatableString.UnsupportedFieldWithId;\n translateParams.push(idSchema.$id);\n }\n if (reason) {\n translateEnum =\n translateEnum === TranslatableString.UnsupportedField\n ? TranslatableString.UnsupportedFieldWithReason\n : TranslatableString.UnsupportedFieldWithIdAndReason;\n translateParams.push(reason);\n }\n return (\n <div className='unsupported-field'>\n <p>\n <Markdown options={{ disableParsingRawHTML: true }}>{translateString(translateEnum, translateParams)}</Markdown>\n </p>\n {schema && <pre>{JSON.stringify(schema, null, 2)}</pre>}\n </div>\n );\n}\n\nexport default UnsupportedField;\n", "import {\n ADDITIONAL_PROPERTY_FLAG,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n WrapIfAdditionalTemplateProps,\n} from '@rjsf/utils';\n\nimport Label from './FieldTemplate/Label';\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 id,\n classNames,\n style,\n disabled,\n label,\n onKeyChange,\n onDropPropertyClick,\n readonly,\n required,\n schema,\n children,\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\n if (!additional) {\n return (\n <div className={classNames} style={style}>\n {children}\n </div>\n );\n }\n\n return (\n <div className={classNames} style={style}>\n <div className='row'>\n <div className='col-xs-5 form-additional'>\n <div className='form-group'>\n <Label label={keyLabel} required={required} id={`${id}-key`} />\n <input\n className='form-control'\n type='text'\n id={`${id}-key`}\n onBlur={({ target }) => onKeyChange(target && target.value)}\n defaultValue={label}\n />\n </div>\n </div>\n <div className='form-additional form-group col-xs-5'>{children}</div>\n <div className='col-xs-2'>\n <RemoveButton\n className='array-item-remove btn-block'\n style={{ border: '0' }}\n disabled={disabled || readonly}\n onClick={onDropPropertyClick(label)}\n uiSchema={uiSchema}\n registry={registry}\n />\n </div>\n </div>\n </div>\n );\n}\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';\n\nimport ArrayFieldDescriptionTemplate from './ArrayFieldDescriptionTemplate';\nimport ArrayFieldItemTemplate from './ArrayFieldItemTemplate';\nimport ArrayFieldTemplate from './ArrayFieldTemplate';\nimport ArrayFieldTitleTemplate from './ArrayFieldTitleTemplate';\nimport BaseInputTemplate from './BaseInputTemplate';\nimport ButtonTemplates from './ButtonTemplates';\nimport DescriptionField from './DescriptionField';\nimport ErrorList from './ErrorList';\nimport FieldTemplate from './FieldTemplate';\nimport FieldErrorTemplate from './FieldErrorTemplate';\nimport FieldHelpTemplate from './FieldHelpTemplate';\nimport ObjectFieldTemplate from './ObjectFieldTemplate';\nimport TitleField from './TitleField';\nimport UnsupportedField from './UnsupportedField';\nimport WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate';\n\nfunction templates<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): TemplatesType<\n T,\n S,\n F\n> {\n return {\n ArrayFieldDescriptionTemplate,\n ArrayFieldItemTemplate,\n ArrayFieldTemplate,\n ArrayFieldTitleTemplate,\n ButtonTemplates: ButtonTemplates<T, S, F>(),\n BaseInputTemplate,\n DescriptionFieldTemplate: DescriptionField,\n ErrorListTemplate: ErrorList,\n FieldTemplate,\n FieldErrorTemplate,\n FieldHelpTemplate,\n ObjectFieldTemplate,\n TitleFieldTemplate: TitleField,\n UnsupportedFieldTemplate: UnsupportedField,\n WrapIfAdditionalTemplate,\n };\n}\n\nexport default templates;\n", "import { MouseEvent, useCallback, useEffect, useReducer, useState } from 'react';\nimport {\n ariaDescribedByIds,\n dateRangeOptions,\n parseDateString,\n toDateString,\n DateObject,\n type DateElementFormat,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n WidgetProps,\n getDateElementProps,\n} from '@rjsf/utils';\n\nfunction readyForChange(state: DateObject) {\n return Object.values(state).every((value) => value !== -1);\n}\n\ntype DateElementProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<\n WidgetProps<T, S, F>,\n 'value' | 'name' | 'disabled' | 'readonly' | 'autofocus' | 'registry' | 'onBlur' | 'onFocus'\n> & {\n rootId: string;\n select: (property: keyof DateObject, value: any) => void;\n type: string;\n range: [number, number];\n};\n\nfunction DateElement<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n type,\n range,\n value,\n select,\n rootId,\n name,\n disabled,\n readonly,\n autofocus,\n registry,\n onBlur,\n onFocus,\n}: DateElementProps<T, S, F>) {\n const id = rootId + '_' + type;\n const { SelectWidget } = registry.widgets;\n return (\n <SelectWidget\n schema={{ type: 'integer' } as S}\n id={id}\n name={name}\n className='form-control'\n options={{ enumOptions: dateRangeOptions<S>(range[0], range[1]) }}\n placeholder={type}\n value={value}\n disabled={disabled}\n readonly={readonly}\n autofocus={autofocus}\n onChange={(value: any) => select(type as keyof DateObject, value)}\n onBlur={onBlur}\n onFocus={onFocus}\n registry={registry}\n label=''\n aria-describedby={ariaDescribedByIds<T>(rootId)}\n />\n );\n}\n\n/** The `AltDateWidget` is an alternative widget for rendering date properties.\n * @param props - The `WidgetProps` for this component\n */\nfunction AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n time = false,\n disabled = false,\n readonly = false,\n autofocus = false,\n options,\n id,\n name,\n registry,\n onBlur,\n onFocus,\n onChange,\n value,\n}: WidgetProps<T, S, F>) {\n const { translateString } = registry;\n const [lastValue, setLastValue] = useState(value);\n const [state, setState] = useReducer((state: DateObject, action: Partial<DateObject>) => {\n return { ...state, ...action };\n }, parseDateString(value, time));\n\n useEffect(() => {\n const stateValue = toDateString(state, time);\n if (readyForChange(state) && stateValue !== value) {\n // The user changed the date to a new valid data via the comboboxes, so call onChange\n onChange(stateValue);\n } else if (lastValue !== value) {\n // We got a new value in the props\n setLastValue(value);\n setState(parseDateString(value, time));\n }\n }, [time, value, onChange, state, lastValue]);\n\n const handleChange = useCallback((property: keyof DateObject, value: string) => {\n setState({ [property]: value });\n }, []);\n\n const handleSetNow = useCallback(\n (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n if (disabled || readonly) {\n return;\n }\n const nextState = parseDateString(new Date().toJSON(), time);\n onChange(toDateString(nextState, time));\n },\n [disabled, readonly, time]\n );\n\n const handleClear = useCallback(\n (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n if (disabled || readonly) {\n return;\n }\n onChange(undefined);\n },\n [disabled, readonly, onChange]\n );\n\n return (\n <ul className='list-inline'>\n {getDateElementProps(\n state,\n time,\n options.yearsRange as [number, number] | undefined,\n options.format as DateElementFormat | undefined\n ).map((elemProps, i) => (\n <li className='list-inline-item' key={i}>\n <DateElement\n rootId={id}\n name={name}\n select={handleChange}\n {...elemProps}\n disabled={disabled}\n readonly={readonly}\n registry={registry}\n onBlur={onBlur}\n onFocus={onFocus}\n autofocus={autofocus && i === 0}\n />\n </li>\n ))}\n {(options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && (\n <li className='list-inline-item'>\n <a href='#' className='btn btn-info btn-now' onClick={handleSetNow}>\n {translateString(TranslatableString.NowLabel)}\n </a>\n </li>\n )}\n {(options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && (\n <li className='list-inline-item'>\n <a href='#' className='btn btn-warning btn-clear' onClick={handleClear}>\n {translateString(TranslatableString.ClearLabel)}\n </a>\n </li>\n )}\n </ul>\n );\n}\n\nexport default AltDateWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `AltDateTimeWidget` is an alternative widget for rendering datetime properties.\n * It uses the AltDateWidget for rendering, with the `time` prop set to true by default.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction AltDateTimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n time = true,\n ...props\n}: WidgetProps<T, S, F>) {\n const { AltDateWidget } = props.registry.widgets;\n return <AltDateWidget time={time} {...props} />;\n}\n\nexport default AltDateTimeWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n descriptionId,\n getTemplate,\n labelValue,\n schemaRequiresTrueValue,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `CheckBoxWidget` is a widget for rendering boolean properties.\n * It is typically used to represent a boolean.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction CheckboxWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n schema,\n uiSchema,\n options,\n id,\n value,\n disabled,\n readonly,\n label,\n hideLabel,\n autofocus = false,\n onBlur,\n onFocus,\n onChange,\n registry,\n}: WidgetProps<T, S, F>) {\n const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(\n 'DescriptionFieldTemplate',\n registry,\n options\n );\n // Because an unchecked checkbox will cause html5 validation to fail, only add\n // the \"required\" attribute if the field value must be \"true\", due to the\n // \"const\" or \"enum\" keywords\n const required = schemaRequiresTrueValue<S>(schema);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => onChange(event.target.checked),\n [onChange]\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => onBlur(id, event.target.checked),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => onFocus(id, event.target.checked),\n [onFocus, id]\n );\n const description = options.description ?? schema.description;\n\n return (\n <div className={`checkbox ${disabled || readonly ? 'disabled' : ''}`}>\n {!hideLabel && !!description && (\n <DescriptionFieldTemplate\n id={descriptionId<T>(id)}\n description={description}\n schema={schema}\n uiSchema={uiSchema}\n registry={registry}\n />\n )}\n <label>\n <input\n type='checkbox'\n id={id}\n name={id}\n checked={typeof value === 'undefined' ? false : value}\n required={required}\n disabled={disabled || readonly}\n autoFocus={autofocus}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n {labelValue(<span>{label}</span>, hideLabel)}\n </label>\n </div>\n );\n}\n\nexport default CheckboxWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsDeselectValue,\n enumOptionsIsSelected,\n enumOptionsSelectValue,\n enumOptionsValueForIndex,\n optionId,\n FormContextType,\n WidgetProps,\n RJSFSchema,\n StrictRJSFSchema,\n} from '@rjsf/utils';\n\n/** The `CheckboxesWidget` is a widget for rendering checkbox groups.\n * It is typically used to represent an array of enums.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction CheckboxesWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n disabled,\n options: { inline = false, enumOptions, enumDisabled, emptyValue },\n value,\n autofocus = false,\n readonly,\n onChange,\n onBlur,\n onFocus,\n}: WidgetProps<T, S, F>) {\n const checkboxesValues = Array.isArray(value) ? value : [value];\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onBlur(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onFocus(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onFocus, id]\n );\n return (\n <div className='checkboxes' id={id}>\n {Array.isArray(enumOptions) &&\n enumOptions.map((option, index) => {\n const checked = enumOptionsIsSelected<S>(option.value, checkboxesValues);\n const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;\n const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (event.target.checked) {\n onChange(enumOptionsSelectValue<S>(index, checkboxesValues, enumOptions));\n } else {\n onChange(enumOptionsDeselectValue<S>(index, checkboxesValues, enumOptions));\n }\n };\n\n const checkbox = (\n <span>\n <input\n type='checkbox'\n id={optionId(id, index)}\n name={id}\n checked={checked}\n value={String(index)}\n disabled={disabled || itemDisabled || readonly}\n autoFocus={autofocus && index === 0}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n <span>{option.label}</span>\n </span>\n );\n return inline ? (\n <label key={index} className={`checkbox-inline ${disabledCls}`}>\n {checkbox}\n </label>\n ) : (\n <div key={index} className={`checkbox ${disabledCls}`}>\n <label>{checkbox}</label>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default CheckboxesWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `ColorWidget` component uses the `BaseInputTemplate` changing the type to `color` and disables it when it is\n * either disabled or readonly.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { disabled, readonly, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='color' {...props} disabled={disabled || readonly} />;\n}\n", "import { useCallback } from 'react';\nimport { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `DateWidget` component uses the `BaseInputTemplate` changing the type to `date` and transforms\n * the value to undefined when it is falsy during the `onChange` handling.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function DateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { onChange, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n const handleChange = useCallback((value: any) => onChange(value || undefined), [onChange]);\n\n return <BaseInputTemplate type='date' {...props} onChange={handleChange} />;\n}\n", "import {\n getTemplate,\n localToUTC,\n utcToLocal,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `DateTimeWidget` component uses the `BaseInputTemplate` changing the type to `datetime-local` and transforms\n * the value to/from utc using the appropriate utility functions.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function DateTimeWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: WidgetProps<T, S, F>) {\n const { onChange, value, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return (\n <BaseInputTemplate\n type='datetime-local'\n {...props}\n value={utcToLocal(value)}\n onChange={(value) => onChange(localToUTC(value))}\n />\n );\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `EmailWidget` component uses the `BaseInputTemplate` changing the type to `email`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function EmailWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='email' {...props} />;\n}\n", "import { ChangeEvent, useCallback, useMemo } from 'react';\nimport {\n dataURItoBlob,\n FormContextType,\n getTemplate,\n Registry,\n RJSFSchema,\n StrictRJSFSchema,\n TranslatableString,\n UIOptionsType,\n WidgetProps,\n} from '@rjsf/utils';\nimport Markdown from 'markdown-to-jsx';\n\nfunction addNameToDataURL(dataURL: string, name: string) {\n if (dataURL === null) {\n return null;\n }\n return dataURL.replace(';base64', `;name=${encodeURIComponent(name)};base64`);\n}\n\ntype FileInfoType = {\n dataURL?: string | null;\n name: string;\n size: number;\n type: string;\n};\n\nfunction processFile(file: File): Promise<FileInfoType> {\n const { name, size, type } = file;\n return new Promise((resolve, reject) => {\n const reader = new window.FileReader();\n reader.onerror = reject;\n reader.onload = (event) => {\n if (typeof event.target?.result === 'string') {\n resolve({\n dataURL: addNameToDataURL(event.target.result, name),\n name,\n size,\n type,\n });\n } else {\n resolve({\n dataURL: null,\n name,\n size,\n type,\n });\n }\n };\n reader.readAsDataURL(file);\n });\n}\n\nfunction processFiles(files: FileList) {\n return Promise.all(Array.from(files).map(processFile));\n}\n\nfunction FileInfoPreview<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n fileInfo,\n registry,\n}: {\n fileInfo: FileInfoType;\n registry: Registry<T, S, F>;\n}) {\n const { translateString } = registry;\n const { dataURL, type, name } = fileInfo;\n if (!dataURL) {\n return null;\n }\n\n // If type is JPEG or PNG then show image preview.\n // Originally, any type of image was supported, but this was changed into a whitelist\n // since SVGs and animated GIFs are also images, which are generally considered a security risk.\n if (['image/jpeg', 'image/png'].includes(type)) {\n return <img src={dataURL} style={{ maxWidth: '100%' }} className='file-preview' />;\n }\n\n // otherwise, let users download file\n\n return (\n <>\n {' '}\n <a download={`preview-${name}`} href={dataURL} className='file-download'>\n {translateString(TranslatableString.PreviewLabel)}\n </a>\n </>\n );\n}\n\nfunction FilesInfo<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n filesInfo,\n registry,\n preview,\n onRemove,\n options,\n}: {\n filesInfo: FileInfoType[];\n registry: Registry<T, S, F>;\n preview?: boolean;\n onRemove: (index: number) => void;\n options: UIOptionsType<T, S, F>;\n}) {\n if (filesInfo.length === 0) {\n return null;\n }\n const { translateString } = registry;\n\n const { RemoveButton } = getTemplate<'ButtonTemplates', T, S, F>('ButtonTemplates', registry, options);\n\n return (\n <ul className='file-info'>\n {filesInfo.map((fileInfo, key) => {\n const { name, size, type } = fileInfo;\n const handleRemove = () => onRemove(key);\n return (\n <li key={key}>\n <Markdown>{translateString(TranslatableString.FilesInfo, [name, type, String(size)])}</Markdown>\n {preview && <FileInfoPreview<T, S, F> fileInfo={fileInfo} registry={registry} />}\n <RemoveButton onClick={handleRemove} registry={registry} />\n </li>\n );\n })}\n </ul>\n );\n}\n\nfunction extractFileInfo(dataURLs: string[]): FileInfoType[] {\n return dataURLs.reduce((acc, dataURL) => {\n if (!dataURL) {\n return acc;\n }\n try {\n const { blob, name } = dataURItoBlob(dataURL);\n return [\n ...acc,\n {\n dataURL,\n name: name,\n size: blob.size,\n type: blob.type,\n },\n ];\n } catch (e) {\n // Invalid dataURI, so just ignore it.\n return acc;\n }\n }, [] as FileInfoType[]);\n}\n\n/**\n * The `FileWidget` is a widget for rendering file upload fields.\n * It is typically used with a string property with data-url format.\n */\nfunction FileWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!event.target.files) {\n return;\n }\n // Due to variances in themes, dealing with multiple files for the array case now happens one file at a time.\n // This is because we don't pass `multiple` into the `BaseInputTemplate` anymore. Instead, we deal with the single\n // file in each event and concatenate them together ourselves\n processFiles(event.target.files).then((filesInfoEvent) => {\n const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);\n if (multiple) {\n onChange(value.concat(newValue[0]));\n } else {\n onChange(newValue[0]);\n }\n });\n },\n [multiple, value, onChange]\n );\n\n const filesInfo = useMemo(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);\n const rmFile = useCallback(\n (index: number) => {\n if (multiple) {\n const newValue = value.filter((_: any, i: number) => i !== index);\n onChange(newValue);\n } else {\n onChange(undefined);\n }\n },\n [multiple, value, onChange]\n );\n return (\n <div>\n <BaseInputTemplate\n {...props}\n disabled={disabled || readonly}\n type='file'\n required={value ? false : required} // this turns off HTML required validation when a value exists\n onChangeOverride={handleChange}\n value=''\n accept={options.accept ? String(options.accept) : undefined}\n />\n <FilesInfo<T, S, F>\n filesInfo={filesInfo}\n onRemove={rmFile}\n registry={registry}\n preview={options.filePreview}\n options={options}\n />\n </div>\n );\n}\n\nexport default FileWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `HiddenWidget` is a widget for rendering a hidden input field.\n * It is typically used by setting type to \"hidden\".\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction HiddenWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n value,\n}: WidgetProps<T, S, F>) {\n return <input type='hidden' id={id} name={id} value={typeof value === 'undefined' ? '' : value} />;\n}\n\nexport default HiddenWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `PasswordWidget` component uses the `BaseInputTemplate` changing the type to `password`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function PasswordWidget<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(props: WidgetProps<T, S, F>) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='password' {...props} />;\n}\n", "import { FocusEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsIsSelected,\n enumOptionsValueForIndex,\n optionId,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\n/** The `RadioWidget` is a widget for rendering a radio group.\n * It is typically used with a string property constrained with enum options.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n options,\n value,\n required,\n disabled,\n readonly,\n autofocus = false,\n onBlur,\n onFocus,\n onChange,\n id,\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled, inline, emptyValue } = options;\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onBlur(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLInputElement>) =>\n onFocus(id, enumOptionsValueForIndex<S>(target && target.value, enumOptions, emptyValue)),\n [onFocus, id]\n );\n\n return (\n <div className='field-radio-group' id={id}>\n {Array.isArray(enumOptions) &&\n enumOptions.map((option, i) => {\n const checked = enumOptionsIsSelected<S>(option.value, value);\n const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;\n const disabledCls = disabled || itemDisabled || readonly ? 'disabled' : '';\n\n const handleChange = () => onChange(option.value);\n\n const radio = (\n <span>\n <input\n type='radio'\n id={optionId(id, i)}\n checked={checked}\n name={id}\n required={required}\n value={String(i)}\n disabled={disabled || itemDisabled || readonly}\n autoFocus={autofocus && i === 0}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={handleFocus}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n <span>{option.label}</span>\n </span>\n );\n\n return inline ? (\n <label key={i} className={`radio-inline ${disabledCls}`}>\n {radio}\n </label>\n ) : (\n <div key={i} className={`radio ${disabledCls}`}>\n <label>{radio}</label>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RadioWidget;\n", "import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result\n * in a div, with the value along side it.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const {\n value,\n registry: {\n templates: { BaseInputTemplate },\n },\n } = props;\n return (\n <div className='field-range-wrapper'>\n <BaseInputTemplate type='range' {...props} />\n <span className='range-view'>{value}</span>\n </div>\n );\n}\n", "import { ChangeEvent, FocusEvent, SyntheticEvent, useCallback } from 'react';\nimport {\n ariaDescribedByIds,\n enumOptionsIndexForValue,\n enumOptionsValueForIndex,\n FormContextType,\n RJSFSchema,\n StrictRJSFSchema,\n WidgetProps,\n} from '@rjsf/utils';\n\nfunction getValue(event: SyntheticEvent<HTMLSelectElement>, multiple: boolean) {\n if (multiple) {\n return Array.from((event.target as HTMLSelectElement).options)\n .slice()\n .filter((o) => o.selected)\n .map((o) => o.value);\n }\n return (event.target as HTMLSelectElement).value;\n}\n\n/** The `SelectWidget` is a widget for rendering dropdowns.\n * It is typically used with string properties constrained with enum options.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n schema,\n id,\n options,\n value,\n required,\n disabled,\n readonly,\n multiple = false,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n placeholder,\n}: WidgetProps<T, S, F>) {\n const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;\n const emptyValue = multiple ? [] : '';\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onFocus(id, enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onFocus, id, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onBlur(id, enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onBlur, id, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLSelectElement>) => {\n const newValue = getValue(event, multiple);\n return onChange(enumOptionsValueForIndex<S>(newValue, enumOptions, optEmptyVal));\n },\n [onChange, schema, multiple, enumOptions, optEmptyVal]\n );\n\n const selectedIndexes = enumOptionsIndexForValue<S>(value, enumOptions, multiple);\n const showPlaceholderOption = !multiple && schema.default === undefined;\n\n return (\n <select\n id={id}\n name={id}\n multiple={multiple}\n className='form-control'\n value={typeof selectedIndexes === 'undefined' ? emptyValue : selectedIndexes}\n required={required}\n disabled={disabled || readonly}\n autoFocus={autofocus}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onChange={handleChange}\n aria-describedby={ariaDescribedByIds<T>(id)}\n >\n {showPlaceholderOption && <option value=''>{placeholder}</option>}\n {Array.isArray(enumOptions) &&\n enumOptions.map(({ value, label }, i) => {\n const disabled = enumDisabled && enumDisabled.indexOf(value) !== -1;\n return (\n <option key={i} value={String(i)} disabled={disabled}>\n {label}\n </option>\n );\n })}\n </select>\n );\n}\n\nexport default SelectWidget;\n", "import { ChangeEvent, FocusEvent, useCallback } from 'react';\nimport { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TextareaWidget` is a widget for rendering input fields as textarea.\n *\n * @param props - The `WidgetProps` for this component\n */\nfunction TextareaWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({\n id,\n options = {},\n placeholder,\n value,\n required,\n disabled,\n readonly,\n autofocus = false,\n onChange,\n onBlur,\n onFocus,\n}: WidgetProps<T, S, F>) {\n const handleChange = useCallback(\n ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) => onChange(value === '' ? options.emptyValue : value),\n [onChange, options.emptyValue]\n );\n\n const handleBlur = useCallback(\n ({ target }: FocusEvent<HTMLTextAreaElement>) => onBlur(id, target && target.value),\n [onBlur, id]\n );\n\n const handleFocus = useCallback(\n ({ target }: FocusEvent<HTMLTextAreaElement>) => onFocus(id, target && target.value),\n [id, onFocus]\n );\n\n return (\n <textarea\n id={id}\n name={id}\n className='form-control'\n value={value ? value : ''}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n readOnly={readonly}\n autoFocus={autofocus}\n rows={options.rows}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onChange={handleChange}\n aria-describedby={ariaDescribedByIds<T>(id)}\n />\n );\n}\n\nTextareaWidget.defaultProps = {\n autofocus: false,\n options: {},\n};\n\nexport default TextareaWidget;\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TextWidget` component uses the `BaseInputTemplate`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function TextWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate {...props} />;\n}\n", "import { useCallback } from 'react';\nimport { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `TimeWidget` component uses the `BaseInputTemplate` changing the type to `time` and transforms\n * the value to undefined when it is falsy during the `onChange` handling.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function TimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { onChange, options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n const handleChange = useCallback((value: any) => onChange(value ? `${value}:00` : undefined), [onChange]);\n\n return <BaseInputTemplate type='time' {...props} onChange={handleChange} />;\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `URLWidget` component uses the `BaseInputTemplate` changing the type to `url`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function URLWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='url' {...props} />;\n}\n", "import { getTemplate, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';\n\n/** The `UpDownWidget` component uses the `BaseInputTemplate` changing the type to `number`.\n *\n * @param props - The `WidgetProps` for this component\n */\nexport default function UpDownWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n props: WidgetProps<T, S, F>\n) {\n const { options, registry } = props;\n const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);\n return <BaseInputTemplate type='number' {...props} />;\n}\n", "import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\nimport AltDateWidget from './AltDateWidget';\nimport AltDateTimeWidget from './AltDateTimeWidget';\nimport CheckboxWidget from './CheckboxWidget';\nimport CheckboxesWidget from './CheckboxesWidget';\nimport ColorWidget from './ColorWidget';\nimport DateWidget from './DateWidget';\nimport DateTimeWidget from './DateTimeWidget';\nimport EmailWidget from './EmailWidget';\nimport FileWidget from './FileWidget';\nimport HiddenWidget from './HiddenWidget';\nimport PasswordWidget from './PasswordWidget';\nimport RadioWidget from './RadioWidget';\nimport RangeWidget from './RangeWidget';\nimport SelectWidget from './SelectWidget';\nimport TextareaWidget from './TextareaWidget';\nimport TextWidget from './TextWidget';\nimport TimeWidget from './TimeWidget';\nimport URLWidget from './URLWidget';\nimport UpDownWidget from './UpDownWidget';\n\nfunction widgets<\n T = any,\n S extends StrictRJSFSchema = RJSFSchema,\n F extends FormContextType = any\n>(): RegistryWidgetsType<T, S, F> {\n return {\n AltDateWidget,\n AltDateTimeWidget,\n CheckboxWidget,\n CheckboxesWidget,\n ColorWidget,\n DateWidget,\n DateTimeWidget,\n EmailWidget,\n FileWidget,\n HiddenWidget,\n PasswordWidget,\n RadioWidget,\n RangeWidget,\n SelectWidget,\n TextWidget,\n TextareaWidget,\n TimeWidget,\n UpDownWidget,\n URLWidget,\n };\n}\n\nexport default widgets;\n", "import { ComponentType, ForwardedRef, forwardRef } from 'react';\nimport Form, { FormProps } from './components/Form';\nimport { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';\n\n/** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be\n * overridden while creating a theme\n */\nexport type ThemeProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Pick<\n FormProps<T, S, F>,\n 'fields' | 'templates' | 'widgets' | '_internalFormWrapper'\n>;\n\n/** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */\nexport default function withTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(\n themeProps: ThemeProps<T, S, F>\n): ComponentType<FormProps<T, S, F>> {\n return forwardRef(\n ({ fields, widgets, templates, ...directProps }: FormProps<T, S, F>, ref: ForwardedRef<Form<T, S, F>>) => {\n fields = { ...themeProps?.fields, ...fields };\n widgets = { ...themeProps?.widgets, ...widgets };\n templates = {\n ...themeProps?.templates,\n ...templates,\n ButtonTemplates: {\n ...themeProps?.templates?.ButtonTemplates,\n ...templates?.ButtonTemplates,\n },\n };\n\n return (\n <Form<T, S, F>\n {...themeProps}\n {...directProps}\n fields={fields}\n widgets={widgets}\n templates={templates}\n ref={ref}\n />\n );\n }\n );\n}\n", "import Form, { FormProps, FormState, IChangeEvent } from './components/Form';\nimport withTheme, { ThemeProps } from './withTheme';\nimport getDefaultRegistry from './getDefaultRegistry';\n\nexport type { FormProps, FormState, IChangeEvent, ThemeProps };\n\nexport { withTheme, getDefaultRegistry };\nexport default Form;\n"],
5
5
  "mappings": ";AAAA,SAAS,aAAAA,YAA8D,iBAAiB;AACxF;AAAA,EACE;AAAA,EAEA,cAAAC;AAAA,EAKA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EAEA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EAQA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;A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GAAG,YAAY;AAAA,QACf,GAAGA;AAAA,QACH,iBAAiB;AAAA,UACf,GAAG,YAAY,WAAW;AAAA,UAC1B,GAAGA,YAAW;AAAA,QAChB;AAAA,MACF;AAEA,aACE,gBAAAH;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,QAAQC;AAAA,UACR,SAASC;AAAA,UACT,WAAWC;AAAA,UACX;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AACF;;;AClCA,IAAO,cAAQ;",
6
6
  "names": ["Component", "deepEquals", "getTemplate", "getUiOptions", "isObject", "mergeObjects", "UI_OPTIONS_KEY", "widgets", "SchemaField", "has", "key", "getWidget", "getUiOptions", "optionsList", "TranslatableString", "isObject", "jsx", "widgets", "Component", "get", "getUiOptions", "getWidget", "TranslatableString", "jsx", "widgets", "fields", "jsx", "StringField", "value", "Component", "getTemplate", "getUiOptions", "TranslatableString", "ANY_OF_KEY", "ONE_OF_KEY", "get", "isObject", "set", "jsx", "jsxs", "fields", "SchemaField", "name", "useCallback", "Component", "ADDITIONAL_PROPERTY_FLAG", "deepEquals", "getTemplate", "getUiOptions", "TranslatableString", "isObject", "omit", "Markdown", "jsx", "jsxs", "fields", "FieldTemplate", "FieldHelpTemplate", "FieldErrorTemplate", "formData", "id", "_schema", "getWidget", "getUiOptions", "optionsList", "jsx", "widgets", "descriptionId", "getTemplate", "getUiOptions", "jsx", "jsx", "jsxs", "CopyButton", "MoveDownButton", "MoveUpButton", "RemoveButton", "getTemplate", "getUiOptions", "jsx", "jsxs", "ArrayFieldDescriptionTemplate", "ArrayFieldItemTemplate", "ArrayFieldTitleTemplate", "AddButton", "getTemplate", "getUiOptions", "jsx", "useCallback", "Fragment", "jsx", "jsxs", "value", "jsx", "TranslatableString", "TranslatableString", "jsx", "jsx", "TranslatableString", "jsx", "TranslatableString", "jsx", "jsxs", "getTemplate", "getUiOptions", "jsx", "jsxs", "jsx", "jsxs", "getUiOptions", "WrapIfAdditionalTemplate", "getTemplate", "jsx", "jsx", "descriptionId", "getTemplate", "getUiOptions", "titleId", "jsx", "jsxs", "AddButton", "jsx", "jsxs", "REQUIRED_FIELD_SYMBOL", "TranslatableString", "Markdown", "jsx", "jsxs", "ADDITIONAL_PROPERTY_FLAG", "TranslatableString", "jsx", "jsxs", "templates", "RemoveButton", "TranslatableString", "ADDITIONAL_PROPERTY_FLAG", "useCallback", "useEffect", "useState", "ariaDescribedByIds", "TranslatableString", "jsx", "jsxs", "SelectWidget", "value", "state", "jsx", "AltDateWidget", "useCallback", "ariaDescribedByIds", "descriptionId", "getTemplate", "jsx", "jsxs", "useCallback", "ariaDescribedByIds", "jsx", "jsxs", "getTemplate", "jsx", "BaseInputTemplate", "useCallback", "getTemplate", "jsx", "BaseInputTemplate", "getTemplate", "jsx", "BaseInputTemplate", "value", "getTemplate", "jsx", "BaseInputTemplate", "useCallback", "getTemplate", "TranslatableString", "Markdown", "Fragment", "jsx", "jsxs", "RemoveButton", "BaseInputTemplate", "jsx", "getTemplate", "jsx", "BaseInputTemplate", "useCallback", "ariaDescribedByIds", "enumOptionsIsSelected", "enumOptionsValueForIndex", "optionId", "jsx", "jsxs", "jsx", "jsxs", "BaseInputTemplate", "useCallback", "ariaDescribedByIds", "enumOptionsValueForIndex", "jsx", "jsxs", "value", "disabled", "useCallback", "ariaDescribedByIds", "jsx", "value", "getTemplate", "jsx", "BaseInputTemplate", "useCallback", "getTemplate", "jsx", "BaseInputTemplate", "getTemplate", "jsx", "BaseInputTemplate", "getTemplate", "jsx", "BaseInputTemplate", "jsx", "jsxs", "Component", "fields", "isObject", "mergeObjects", "deepEquals", "getUiOptions", "getTemplate", "templates", "widgets", "SubmitButton", "UI_OPTIONS_KEY", "jsx", "fields", "widgets", "templates"]
7
7
  }