UNPKG

@cdmbase/react-google-autocomplete

Version:
59 lines (58 loc) 1.65 kB
import React, { forwardRef } from "react"; import PropTypes from "prop-types"; import usePlacesWidget from "./usePlacesWidget.js"; function ReactGoogleAutocomplete(props) { const { onPlaceSelected, apiKey, libraries, inputAutocompleteValue, options, googleMapsScriptBaseUrl, refProp, language, debounce, ...rest } = props; const { ref } = usePlacesWidget({ ref: refProp, googleMapsScriptBaseUrl, onPlaceSelected, apiKey, libraries, inputAutocompleteValue, options, language, debounce }); return /* @__PURE__ */ React.createElement("input", { ref, ...rest }); } ReactGoogleAutocomplete.propTypes = { apiKey: PropTypes.string, libraries: PropTypes.arrayOf(PropTypes.string), ref: PropTypes.oneOfType([ // Either a function PropTypes.func, // Or anything shaped { current: any } PropTypes.shape({ current: PropTypes.any }) ]), googleMapsScriptBaseUrl: PropTypes.string, onPlaceSelected: PropTypes.func, inputAutocompleteValue: PropTypes.string, options: PropTypes.shape({ componentRestrictions: PropTypes.object, bounds: PropTypes.object, location: PropTypes.object, offset: PropTypes.number, origin: PropTypes.object, radius: PropTypes.number, sessionToken: PropTypes.object, types: PropTypes.arrayOf(PropTypes.string) }), language: PropTypes.string, debounce: PropTypes.number }; var ReactGoogleAutocomplete_default = forwardRef((props, ref) => /* @__PURE__ */ React.createElement(ReactGoogleAutocomplete, { ...props, refProp: ref })); export { ReactGoogleAutocomplete_default as default };