@@ -3,15 +3,25 @@ import React from 'react';
33import _ from 'lodash' ;
44
55import { GroupIndent } from '../../' ;
6- import { Controller , FieldValue , ObjectIndependentInput , ValidateError } from '../../../../core' ;
6+ import {
7+ Controller ,
8+ FieldValue ,
9+ ObjectIndependentInput ,
10+ ObjectIndependentInputProps ,
11+ ValidateError ,
12+ } from '../../../../core' ;
713import { useOneOf } from '../../../hooks' ;
814import { block } from '../../../utils' ;
915
1016import './OneOf.scss' ;
1117
1218const b = block ( 'oneof' ) ;
1319
14- export const OneOf : ObjectIndependentInput = ( props ) => {
20+ export interface OneOfProps extends ObjectIndependentInputProps {
21+ withoutIndent ?: boolean ;
22+ }
23+
24+ const OneOfComponent : React . FC < OneOfProps > = ( props ) => {
1525 const { oneOfValue, specProperties, toggler} = useOneOf ( { props} ) ;
1626
1727 const parentOnChange = React . useCallback (
@@ -34,7 +44,12 @@ export const OneOf: ObjectIndependentInput = (props) => {
3444 ) ;
3545
3646 return (
37- < div className = { b ( ) } >
47+ < div
48+ className = { b ( {
49+ base : ! props . withoutIndent ,
50+ flat : props . withoutIndent ,
51+ } ) }
52+ >
3853 < div > { toggler } </ div >
3954 { specProperties [ oneOfValue ] ? (
4055 < GroupIndent >
@@ -51,3 +66,9 @@ export const OneOf: ObjectIndependentInput = (props) => {
5166 </ div >
5267 ) ;
5368} ;
69+
70+ export const OneOf = OneOfComponent ;
71+
72+ export const OneOfFlat : ObjectIndependentInput = ( props ) => (
73+ < OneOfComponent { ...props } withoutIndent />
74+ ) ;
0 commit comments