UNPKG

@wordpress/components

Version:
41 lines (36 loc) 1.18 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ /** * Internal dependencies */ import { Spacer } from '../spacer'; import { contextConnect, useContextSystem } from '../ui/context'; function UnconnectedInputControlPrefixWrapper(props, forwardedRef) { const derivedProps = useContextSystem(props, 'InputControlPrefixWrapper'); return createElement(Spacer, _extends({ marginBottom: 0 }, derivedProps, { ref: forwardedRef })); } /** * A convenience wrapper for the `prefix` when you want to apply * standard padding in accordance with the size variant. * * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper, * } from '@wordpress/components'; * * <InputControl * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>} * /> * ``` */ export const InputControlPrefixWrapper = contextConnect(UnconnectedInputControlPrefixWrapper, 'InputControlPrefixWrapper'); export default InputControlPrefixWrapper; //# sourceMappingURL=input-prefix-wrapper.js.map