UNPKG

@rjsf/semantic-ui

Version:

Semantic UI theme, fields and widgets for react-jsonschema-form

61 lines (60 loc) 2.5 kB
import { ElementType } from 'react'; import { UiSchema, GenericObjectType, FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType } from '@rjsf/utils'; export type SemanticPropsTypes<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = { formContext?: F; uiSchema?: UiSchema<T, S, F>; options?: UIOptionsType<T, S, F>; defaultSchemaProps?: GenericObjectType; defaultContextProps?: GenericObjectType; }; export type SemanticErrorPropsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = { formContext?: F; uiSchema?: UiSchema<T, S, F>; options?: UIOptionsType<T, S, F>; defaultProps?: GenericObjectType; }; export type WrapProps = GenericObjectType & { wrap: boolean; component?: ElementType; }; /** * Extract props meant for semantic UI components from props that are * passed to Widgets, Templates and Fields. * @param {Object} params * @param {Object?} params.formContext * @param {Object?} params.uiSchema * @param {Object?} params.options * @param {Object?} params.defaultSchemaProps * @param {Object?} params.defaultContextProps * @returns {any} */ export declare function getSemanticProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ formContext, uiSchema, options, defaultSchemaProps, defaultContextProps, }: SemanticPropsTypes<T, S, F>): any; /** * Extract error props meant for semantic UI components from props that are * passed to Widgets, Templates and Fields. * @param {Object} params * @param {Object?} params.formContext * @param {Object?} params.uiSchema * @param {Object?} params.defaultProps * @returns {any} */ export declare function getSemanticErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ formContext, uiSchema, options, defaultProps, }: SemanticErrorPropsType<T, S, F>): any; /** * Combine multiple strings containing class names into a single string, * removing duplicates. E.g. * cleanClassNames('bar', 'baz bar', 'x y ', undefined) * // 'bar baz x y' * @param {Array} classNameArr * @param {Array} omit * @returns {string} */ export declare function cleanClassNames(classNameArr: Array<string | undefined>, omit?: string[]): string; /** * * @param {boolean} wrap * @param Component * @param {Object} props * @returns {*} * @constructor */ export declare function MaybeWrap({ wrap, component: Component, ...props }: WrapProps): any;