AdvancedInspectorControl.js
2 years ago
AdvancedModalControl.js
2 years ago
BaseHelp.js
2 years ago
BaseLabel.js
2 years ago
ContainersList.js
2 years ago
DetailsContainer.js
2 years ago
GroupedSelectControl.js
2 years ago
HorizontalLine.js
2 years ago
HoverContainer.js
2 years ago
MacrosInserter.js
2 years ago
ToggleControl.js
2 years ago
AdvancedModalControl.js
57 lines
| 1 | import PresetButton from '../preset/components/PresetButton'; |
| 2 | import MacrosFields from '../macros.button/components/MacrosFields'; |
| 3 | |
| 4 | const { |
| 5 | Flex, |
| 6 | FlexItem, |
| 7 | } = wp.components; |
| 8 | const { |
| 9 | useInstanceId, |
| 10 | } = wp.compose; |
| 11 | |
| 12 | function AdvancedModalControl( { |
| 13 | children, |
| 14 | value, |
| 15 | label, |
| 16 | onChangePreset = false, |
| 17 | onChangeMacros = false, |
| 18 | macroWithCurrent = false, |
| 19 | } ) { |
| 20 | |
| 21 | const instanceId = useInstanceId( FlexItem, 'jfb-AdvancedModalControl' ); |
| 22 | |
| 23 | return <div className={ 'components-base-control' }> |
| 24 | <Flex |
| 25 | align={ 'flex-start' } |
| 26 | className={ 'components-base-control__field' } |
| 27 | > |
| 28 | <FlexItem isBlock> |
| 29 | <Flex |
| 30 | align={ 'center' } |
| 31 | justify={ 'flex-start' } |
| 32 | > |
| 33 | <label |
| 34 | htmlFor={ instanceId } |
| 35 | className={ 'jet-fb label' } |
| 36 | >{ label }</label> |
| 37 | { false !== onChangePreset && <PresetButton |
| 38 | value={ value } |
| 39 | onChange={ onChangePreset } |
| 40 | /> } |
| 41 | { false !== onChangeMacros && <MacrosFields |
| 42 | onClick={ onChangeMacros } |
| 43 | withCurrent={ macroWithCurrent } |
| 44 | /> } |
| 45 | </Flex> |
| 46 | </FlexItem> |
| 47 | <FlexItem isBlock style={ { flex: 3, marginLeft: 'unset' } }> |
| 48 | { 'function' === typeof children |
| 49 | ? children( { instanceId } ) |
| 50 | : children |
| 51 | } |
| 52 | </FlexItem> |
| 53 | </Flex> |
| 54 | </div>; |
| 55 | } |
| 56 | |
| 57 | export default AdvancedModalControl; |