From df4e7b824b2c12b8386bde1e46f9978169765d5e Mon Sep 17 00:00:00 2001 From: github-actions-bot Date: Mon, 7 Aug 2023 09:40:23 +0000 Subject: [PATCH] Updates --- app.css | 167 ------ app.js | 1429 +-------------------------------------------------- index.html | 43 -- ubilabs.svg | 9 - 4 files changed, 3 insertions(+), 1645 deletions(-) delete mode 100644 app.css delete mode 100644 index.html delete mode 100644 ubilabs.svg diff --git a/app.css b/app.css deleted file mode 100644 index 3b8ba73..0000000 --- a/app.css +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Base - */ -html { - width: 100%; - height: 100%; - overflow: hidden-x; - text-align: center; -} - -body { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -webkit-align-items: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - width: 100%; - height: 100%; -} - -.container { - -webkit-box-flex: 0; - -webkit-flex: 0 0 auto; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - max-width: 576px; - max-width: 36rem; -} - -h1 { - font-size: 64px; - font-size: 4rem; - margin-bottom: 0.5em; - color: var(--ubilabs-green); -} - -.subheader { - margin-bottom: 1.5em; - font-weight: 400; -} - -input[type='text'] { - /** Reset Ubilabs input styles */ - background-color: initial; - border-radius: initial; - color: initial; - font-family: initial; - font-size: initial; - height: initial; - line-height: initial; - max-width: initial; - outline: initial; - font: inherit; - /** Set Geosuggest styles */ - width: 100%; - border: 2px solid transparent; - box-shadow: 0 0 1px #3d464d; - padding: 0.5em 1em; - -webkit-transition: - border 0.2s, - box-shadow 0.2s; - transition: - border 0.2s, - box-shadow 0.2s; -} -input[type='text']:focus-visible { - /** Set Geosuggest styles */ - border-color: #267dc0; - box-shadow: 0 0 0 transparent; -} - -.hint { - color: var(--ubilabs-gray-dark-1); - margin: 2em 0; -} - -.footer { - font-weight: 300; - padding-top: 2em; - margin-top: 2em; - border-top: 1px solid var(--ubilabs-gray); -} - -.ubilabs { - height: 1em; - margin: 0.05em 0.25em; - vertical-align: text-top; -} -/** - * The geosuggest module - * NOTE: duplicated font-sizes' are for browsers which don't support rem (only IE 8) - */ -.geosuggest { - font-size: 18px; - font-size: 1rem; - position: relative; - width: 50%; - margin: 1em auto; - text-align: left; -} -.geosuggest__input { - width: 100%; - border: 2px solid transparent; - box-shadow: 0 0 1px #3d464d; - padding: .5em 1em; - -webkit-transition: border 0.2s, box-shadow 0.2s; - transition: border 0.2s, box-shadow 0.2s; -} -.geosuggest__input:focus { - border-color: #267dc0; - box-shadow: 0 0 0 transparent; -} -.geosuggest__suggests { - position: absolute; - top: 100%; - left: 0; - right: 0; - max-height: 25em; - padding: 0; - margin-top: -1px; - background: #fff; - border: 2px solid #267dc0; - border-top-width: 0; - overflow-x: hidden; - overflow-y: auto; - list-style: none; - z-index: 5; - -webkit-transition: max-height 0.2s, border 0.2s; - transition: max-height 0.2s, border 0.2s; -} -.geosuggest__suggests--hidden { - max-height: 0; - overflow: hidden; - border-width: 0; -} - -/** - * A geosuggest item - */ -.geosuggest__item { - font-size: 18px; - font-size: 1rem; - padding: .5em .65em; - cursor: pointer; -} -.geosuggest__item:hover, -.geosuggest__item:focus { - background: #f5f5f5; -} -.geosuggest__item--active { - background: #267dc0; - color: #fff; -} -.geosuggest__item--active:hover, -.geosuggest__item--active:focus { - background: #ccc; -} -.geosuggest__item__matched-text { - font-weight: bold; -} diff --git a/app.js b/app.js index fc60294..720e019 100644 --- a/app.js +++ b/app.js @@ -1,1429 +1,6 @@ -(function (React, ReactDOM) { - 'use strict'; - - function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); - } - - var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React); - - /****************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - /* global Reflect, Promise, SuppressedError, Symbol */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - var classnames$1 = {exports: {}}; - - /*! +!function(t,e){"use strict";function s(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var o=s(t),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function s(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}var r=function(){return r=Object.assign||function(t){for(var e,s=1,o=arguments.length;s - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - - /** Used as the `TypeError` message for "Functions" methods. */ - var FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used as references for various `Number` constants. */ - var NAN = 0 / 0; - - /** `Object#toString` result references. */ - var symbolTag = '[object Symbol]'; - - /** Used to match leading and trailing whitespace. */ - var reTrim = /^\s+|\s+$/g; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Built-in method references without a dependency on `root`. */ - var freeParseInt = parseInt; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root$1 = freeGlobal || freeSelf || Function('return this')(); - - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var objectToString = objectProto.toString; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeMax = Math.max, - nativeMin = Math.min; - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = function() { - return root$1.Date.now(); - }; - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - result = wait - timeSinceLastCall; - - return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return !!value && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - var lodash_debounce = debounce; - - var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce); - - /* istanbul ignore next */ - /* eslint-disable @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function */ - /** - * Default values - */ - var defaults = { - autoActivateFirstSuggest: false, - disabled: false, - fixtures: [], - // eslint-disable-next-line @typescript-eslint/no-explicit-any - getSuggestLabel: function (suggest) { return suggest.description; }, - highlightMatch: true, - ignoreEnter: false, - ignoreTab: false, - initialValue: '', - maxFixtures: 10, - minLength: 1, - onKeyDown: function () { }, - onKeyPress: function () { }, - placeholder: 'Search places', - queryDelay: 250, - skipSuggest: function () { return false; }, - style: {}, - inputType: 'text' - }; - - /** - * Attributes allowed on input elements - */ - var allowedAttributes = [ - 'autoCapitalize', - 'autoComplete', - 'autoCorrect', - 'autoFocus', - 'disabled', - 'form', - 'formAction', - 'formEncType', - 'formMethod', - 'formNoValidate', - 'formTarget', - 'height', - 'inputMode', - 'maxLength', - 'name', - 'onClick', - 'onContextMenu', - 'onCopy', - 'onCut', - 'onDoubleClick', - 'onMouseDown', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOut', - 'onMouseOver', - 'onMouseUp', - 'onPaste', - 'pattern', - 'placeholder', - 'readOnly', - 'required', - 'size', - 'spellCheck', - 'tabIndex', - 'title', - 'aria-atomic', - 'aria-busy', - 'aria-controls', - 'aria-current', - 'aria-describedby', - 'aria-details', - 'aria-disabled', - 'aria-dropeffect', - 'aria-errormessage', - 'aria-flowto', - 'aria-grabbed', - 'aria-haspopup', - 'aria-hidden', - 'aria-invalid', - 'aria-keyshortcuts', - 'aria-label', - 'aria-labelledby', - 'aria-live', - 'aria-owns', - 'aria-relevant', - 'aria-roledescription', - 'aria-activedescendant', - 'aria-autocomplete', - 'aria-multiline', - 'aria-placeholder', - 'aria-readonly', - 'aria-required' - ]; - /** - * Filter the properties for only allowed input properties - */ - function filterInputAttributes (props) { - var attributes = {}; - Object.keys(props).forEach(function (attribute) { - var isDataAttribute = attribute.startsWith('data-'); - var isAllowedAttribute = allowedAttributes.includes(attribute); - if (isAllowedAttribute || isDataAttribute) { - attributes[attribute] = props[attribute]; - } - }); - return attributes; - } - - /** - * The input field - */ - var Input = /** @class */ (function (_super) { - __extends(Input, _super); - /** - * The constructor. - */ - function Input(props) { - var _this = _super.call(this, props) || this; - /* eslint-enable @typescript-eslint/no-empty-function */ - /** - * The reference to the input element - */ - _this.input = null; - _this.onChange = _this.onChange.bind(_this); - _this.onInputKeyDown = _this.onInputKeyDown.bind(_this); - return _this; - } - /** - * When the input got changed - */ - Input.prototype.onChange = function () { - if (this.input) { - this.props.onChange(this.input.value); - } - }; - /** - * When a key gets pressed in the input - */ - // eslint-disable-next-line complexity - Input.prototype.onInputKeyDown = function (event) { - // Call props.onKeyDown if defined - // Gives the developer a little bit more control if needed - if (this.props.onKeyDown) { - this.props.onKeyDown(event); - } - switch (event.which) { - case 40: // DOWN - if (!event.shiftKey) { - event.preventDefault(); - this.props.onNext(); - } - break; - case 38: // UP - if (!event.shiftKey) { - event.preventDefault(); - this.props.onPrev(); - } - break; - case 13: // ENTER - if (this.props.doNotSubmitOnEnter) { - event.preventDefault(); - } - if (!this.props.ignoreEnter) { - this.props.onSelect(); - } - break; - case 9: // TAB - if (!this.props.ignoreTab) { - this.props.onSelect(); - } - break; - case 27: // ESC - this.props.onEscape(); - break; - } - }; - /** - * Focus the input - */ - Input.prototype.focus = function () { - if (this.input) { - this.input.focus(); - } - }; - /** - * Blur the input - */ - Input.prototype.blur = function () { - if (this.input) { - this.input.blur(); - } - }; - /** - * Render the view - */ - Input.prototype.render = function () { - var _this = this; - var attributes = filterInputAttributes(this.props); - var classes = classnames('geosuggest__input', this.props.className); - var shouldRenderLabel = this.props.label && this.props.id; - if (!attributes.tabIndex) { - attributes.tabIndex = 0; - } - return (React__namespace.createElement(React__namespace.Fragment, null, - shouldRenderLabel && (React__namespace.createElement("label", { className: "geosuggest__label", htmlFor: this.props.id }, this.props.label)), - React__namespace.createElement("input", __assign({ className: classes, id: "geosuggest__input".concat(this.props.id ? "--".concat(this.props.id) : ''), ref: function (i) { return (_this.input = i); }, type: this.props.inputType }, attributes, { value: this.props.value, style: this.props.style, onKeyDown: this.onInputKeyDown, onChange: this.onChange, onKeyPress: this.props.onKeyPress, onFocus: this.props.onFocus, onBlur: this.props.onBlur, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest - ? this.props.activeSuggest.placeId - : // eslint-disable-next-line no-undefined - undefined, "aria-owns": this.props.listId })))); - }; - /* eslint-disable @typescript-eslint/no-empty-function */ - /** - * Default values for the properties - */ - Input.defaultProps = { - activeSuggest: null, - autoComplete: 'off', - className: '', - isSuggestsHidden: true, - listId: '', - inputType: 'text', - onBlur: function () { }, - onChange: function () { }, - onEscape: function () { }, - onFocus: function () { }, - onKeyDown: function () { }, - onKeyPress: function () { }, - onNext: function () { }, - onPrev: function () { }, - onSelect: function () { }, - value: '' - }; - return Input; - }(React__namespace.PureComponent)); - - /** - * A single Geosuggest item in the list - */ - var SuggestItem = /** @class */ (function (_super) { - __extends(SuggestItem, _super); - /** - * The constructor. - */ - function SuggestItem(props) { - var _this = _super.call(this, props) || this; - /** - * The reference to the suggest element - */ - _this.ref = null; - _this.onClick = _this.onClick.bind(_this); - return _this; - } - /** - * Makes a text bold - */ - SuggestItem.prototype.makeBold = function (element, key) { - return (React__namespace.createElement("b", { className: "geosuggest__item__matched-text", key: key }, element)); - }; - /** - * Replace matched text with the same in bold - */ - SuggestItem.prototype.formatMatchedText = function (userInput, suggest) { - if (!userInput || !suggest.matchedSubstrings) { - return suggest.label; - } - var start = suggest.matchedSubstrings.offset; - var length = suggest.matchedSubstrings.length; - var end = start + length; - var boldPart = this.makeBold(suggest.label.substring(start, end), suggest.label); - var pre = ''; - var post = ''; - if (start > 0) { - pre = suggest.label.slice(0, start); - } - if (end < suggest.label.length) { - post = suggest.label.slice(end); - } - return (React__namespace.createElement("span", null, - pre, - boldPart, - post)); - }; - /** - * Checking if item just became active and scrolling if needed. - */ - SuggestItem.prototype.componentDidUpdate = function (prevProps) { - if (!prevProps.isActive && this.props.isActive) { - this.scrollIfNeeded(); - } - }; - /** - * Scrolling current item to the center of the list if item needs scrolling. - * Item is scrolled to the center of the list. - */ - SuggestItem.prototype.scrollIfNeeded = function () { - var element = this.ref; - var parent = element && element.parentElement; - if (!element || !parent) { - return; - } - var overTop = element.offsetTop - parent.offsetTop < parent.scrollTop; - var overBottom = element.offsetTop - parent.offsetTop + element.clientHeight > - parent.scrollTop + parent.clientHeight; - if (overTop || overBottom) { - parent.scrollTop = - element.offsetTop - - parent.offsetTop - - parent.clientHeight / 2 + - element.clientHeight / 2; - } - }; - /** - * When the suggest item got clicked - */ - SuggestItem.prototype.onClick = function (event) { - event.preventDefault(); - this.props.onSelect(this.props.suggest); - }; - /** - * Render the view - */ - SuggestItem.prototype.render = function () { - var _a; - var _this = this; - var suggest = this.props.suggest; - var classes = classnames('geosuggest__item', this.props.className, this.props.suggestItemClassName, { 'geosuggest__item--active': this.props.isActive }, (_a = {}, - _a[this.props.activeClassName || ''] = this.props.activeClassName - ? this.props.isActive - : null, - _a)); - var content = suggest.label; - if (this.props.renderSuggestItem) { - content = this.props.renderSuggestItem(suggest, this.props.userInput); - } - else if (this.props.isHighlightMatch) { - content = this.formatMatchedText(this.props.userInput, suggest); - } - return (React__namespace.createElement("li", { className: classes, ref: function (li) { return (_this.ref = li); }, style: this.props.style, onMouseDown: this.props.onMouseDown, onMouseOut: this.props.onMouseOut, onClick: this.onClick, role: "option", "aria-selected": this.props.isActive, id: suggest.placeId }, content)); - }; - return SuggestItem; - }(React__namespace.PureComponent)); - - /** - * The list with suggestions. - */ - var SuggestList = /** @class */ (function (_super) { - __extends(SuggestList, _super); - function SuggestList() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Whether or not it is hidden - */ - SuggestList.prototype.isHidden = function () { - return this.props.isHidden || this.props.suggests.length === 0; - }; - /** - * There are new properties available for the list - */ - SuggestList.prototype.componentDidUpdate = function (prevProps) { - if (prevProps.suggests !== this.props.suggests) { - if (this.props.suggests.length === 0) { - this.props.onSuggestNoResults(); - } - } - }; - /** - * Render the view - * @return {Function} The React element to render - */ - SuggestList.prototype.render = function () { - var _a; - var _this = this; - var classes = classnames('geosuggest__suggests', this.props.suggestsClassName, { 'geosuggest__suggests--hidden': this.isHidden() }, (_a = {}, - _a[this.props.hiddenClassName || ''] = this.props.hiddenClassName - ? this.isHidden() - : null, - _a)); - return (React__namespace.createElement("ul", { className: classes, style: this.props.style, role: "listbox", "aria-label": this.props.listLabel, id: this.props.listId }, this.props.suggests.map(function (suggest) { - var isActive = (_this.props.activeSuggest && - suggest.placeId === _this.props.activeSuggest.placeId) || - false; - return (React__namespace.createElement(SuggestItem, { key: suggest.placeId, className: suggest.className || '', userInput: _this.props.userInput, isHighlightMatch: _this.props.isHighlightMatch, suggest: suggest, style: _this.props.suggestItemStyle, suggestItemClassName: _this.props.suggestItemClassName, isActive: isActive, activeClassName: _this.props.suggestItemActiveClassName, onMouseDown: _this.props.onSuggestMouseDown, onMouseOut: _this.props.onSuggestMouseOut, onSelect: _this.props.onSuggestSelect, renderSuggestItem: _this.props.renderSuggestItem })); - }))); - }; - return SuggestList; - }(React__namespace.PureComponent)); - - /* global window */ - // Escapes special characters in user input for regex - function escapeRegExp(str) { - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); - } - /** - * Entry point for the Geosuggest component - */ - var GeoSuggest = /** @class */ (function (_super) { - __extends(GeoSuggest, _super); - /** - * The constructor. Sets the initial state. - */ - // eslint-disable-next-line max-statements - function GeoSuggest(props) { - var _this = _super.call(this, props) || this; - /** - * The Google Map instance - */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _this.googleMaps = null; - /** - * The autocomple service to get suggests - */ - _this.autocompleteService = null; - /** - * The places service to get place details - */ - _this.placesService = null; - /** - * The sessionToken service to use session based monetization - */ - _this.sessionToken = undefined; - /** - * The geocoder to get geocoded results - */ - _this.geocoder = null; - /** - * The input component - */ - _this.input = null; - _this.state = { - activeSuggest: null, - ignoreBlur: false, - isLoading: false, - isSuggestsHidden: true, - suggests: [], - userInput: props.initialValue || '' - }; - _this.onInputChange = _this.onInputChange.bind(_this); - _this.onAfterInputChange = _this.onAfterInputChange.bind(_this); - _this.onInputFocus = _this.onInputFocus.bind(_this); - _this.onInputBlur = _this.onInputBlur.bind(_this); - _this.onNext = _this.onNext.bind(_this); - _this.onPrev = _this.onPrev.bind(_this); - _this.onSelect = _this.onSelect.bind(_this); - _this.onSuggestMouseDown = _this.onSuggestMouseDown.bind(_this); - _this.onSuggestMouseOut = _this.onSuggestMouseOut.bind(_this); - _this.onSuggestNoResults = _this.onSuggestNoResults.bind(_this); - _this.hideSuggests = _this.hideSuggests.bind(_this); - _this.selectSuggest = _this.selectSuggest.bind(_this); - _this.listId = "geosuggest__list".concat(props.id ? "--".concat(props.id) : ''); - _this.listLabel = props.label ? "".concat(props.label, " options") : 'options'; - if (props.queryDelay) { - _this.onAfterInputChange = debounce$1(_this.onAfterInputChange, props.queryDelay); - } - return _this; - } - /** - * Change inputValue if prop changes - */ - GeoSuggest.prototype.componentDidUpdate = function (prevProps) { - if (prevProps.initialValue !== this.props.initialValue) { - this.setState({ userInput: this.props.initialValue || '' }); - } - if (JSON.stringify(prevProps.fixtures) !== JSON.stringify(this.props.fixtures)) { - this.searchSuggests(); - } - }; - /** - * Called on the client side after component is mounted. - * Google api sdk object will be obtained and cached as a instance property. - * Necessary objects of google api will also be determined and saved. - */ - GeoSuggest.prototype.componentDidMount = function () { - if (typeof window === 'undefined') { - return; - } - var googleMaps = this.props.googleMaps || - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (window.google && window.google.maps) || - this.googleMaps; - /* istanbul ignore next */ - if (!googleMaps) { - if (console) { - // eslint-disable-next-line no-console - console.error('Google maps API was not found in the page.'); - } - return; - } - this.googleMaps = googleMaps; - this.autocompleteService = new googleMaps.places.AutocompleteService(); - this.placesService = new googleMaps.places.PlacesService(document.createElement('div')); - this.sessionToken = new googleMaps.places.AutocompleteSessionToken(); - this.geocoder = new googleMaps.Geocoder(); - }; - /** - * When the component will unmount - */ - GeoSuggest.prototype.componentWillUnmount = function () { - clearTimeout(this.timer); - }; - /** - * When the input changed - */ - GeoSuggest.prototype.onInputChange = function (userInput) { - if (!userInput) { - if (this.props.onSuggestSelect) { - this.props.onSuggestSelect(); - } - } - this.setState({ userInput: userInput }, this.onAfterInputChange); - }; - /** - * On After the input got changed - */ - GeoSuggest.prototype.onAfterInputChange = function () { - this.showSuggests(); - if (this.props.onChange) { - this.props.onChange(this.state.userInput); - } - }; - /** - * When the input gets focused - */ - GeoSuggest.prototype.onInputFocus = function () { - if (this.props.onFocus) { - this.props.onFocus(); - } - this.showSuggests(); - }; - /** - * When the input gets blurred - */ - GeoSuggest.prototype.onInputBlur = function () { - if (!this.state.ignoreBlur) { - this.hideSuggests(); - } - }; - GeoSuggest.prototype.onNext = function () { - this.activateSuggest('next'); - }; - GeoSuggest.prototype.onPrev = function () { - this.activateSuggest('prev'); - }; - GeoSuggest.prototype.onSelect = function () { - this.selectSuggest(this.state.activeSuggest); - }; - GeoSuggest.prototype.onSuggestMouseDown = function () { - this.setState({ ignoreBlur: true }); - }; - GeoSuggest.prototype.onSuggestMouseOut = function () { - this.setState({ ignoreBlur: false }); - }; - GeoSuggest.prototype.onSuggestNoResults = function () { - if (this.props.onSuggestNoResults) { - this.props.onSuggestNoResults(this.state.userInput); - } - }; - /** - * Focus the input - */ - GeoSuggest.prototype.focus = function () { - if (this.input) { - this.input.focus(); - } - }; - /** - * Blur the input - */ - GeoSuggest.prototype.blur = function () { - if (this.input) { - this.input.blur(); - } - }; - /** - * Update the value of the user input - */ - GeoSuggest.prototype.update = function (userInput) { - this.setState({ userInput: userInput }); - if (this.props.onChange) { - this.props.onChange(userInput); - } - }; - /* - * Clear the input and close the suggestion pane - */ - GeoSuggest.prototype.clear = function () { - this.setState({ userInput: '' }, this.hideSuggests); - }; - /** - * Search for new suggests - */ - // eslint-disable-next-line complexity, max-statements - GeoSuggest.prototype.searchSuggests = function () { - var _this = this; - if (!this.state.userInput) { - this.updateSuggests(); - return; - } - var options = { - input: this.state.userInput, - sessionToken: this.sessionToken - }; - var inputLength = this.state.userInput.length; - var isShorterThanMinLength = this.props.minLength && inputLength < this.props.minLength; - if (isShorterThanMinLength) { - this.updateSuggests(); - return; - } - var _a = this.props, location = _a.location, radius = _a.radius, bounds = _a.bounds, types = _a.types, country = _a.country; - /* eslint-disable curly */ - if (location) - options.location = location; - if (radius) - options.radius = Number(this.props.radius); - if (bounds) - options.bounds = bounds; - if (types) - options.types = types; - if (country) - options.componentRestrictions = { country: country }; - /* eslint-enable curly */ - this.setState({ isLoading: true }, function () { - if (!_this.autocompleteService) { - _this.setState({ isLoading: false }); - return; - } - _this.autocompleteService.getPlacePredictions(options, function (suggestsGoogle) { - _this.setState({ isLoading: false }); - _this.updateSuggests(suggestsGoogle || [], // can be null - function () { - if (_this.props.autoActivateFirstSuggest && - !_this.state.activeSuggest) { - _this.activateSuggest('next'); - } - }); - }); - }); - }; - /** - * Update the suggests - */ - GeoSuggest.prototype.updateSuggests = function (suggestsGoogle, - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function - callback) { - var _this = this; - if (suggestsGoogle === void 0) { suggestsGoogle = []; } - if (callback === void 0) { callback = function () { }; } - var suggests = []; - var userInput = this.state.userInput; - var _a = this.props, skipSuggest = _a.skipSuggest, maxFixtures = _a.maxFixtures, fixtures = _a.fixtures; - var regex = new RegExp(escapeRegExp(userInput), 'gim'); - var fixturesSearched = 0; - var activeSuggest = null; - if (fixtures) { - fixtures.forEach(function (fixture) { - if (maxFixtures && fixturesSearched >= maxFixtures) { - return; - } - if (skipSuggest && - !skipSuggest(fixture) && - fixture.label.match(regex)) { - fixturesSearched++; - suggests.push(__assign(__assign({}, fixture), { isFixture: true, matchedSubstrings: { - length: userInput.length, - offset: fixture.label.indexOf(userInput) - }, placeId: fixture.placeId || fixture.label })); - } - }); - } - suggestsGoogle.forEach(function (suggest) { - if (skipSuggest && !skipSuggest(suggest)) { - suggests.push({ - description: suggest.description, - isFixture: false, - label: _this.props.getSuggestLabel - ? _this.props.getSuggestLabel(suggest) - : '', - matchedSubstrings: suggest.matched_substrings[0], - placeId: suggest.place_id - }); - } - }); - activeSuggest = this.updateActiveSuggest(suggests); - if (this.props.onUpdateSuggests) { - this.props.onUpdateSuggests(suggests, activeSuggest); - } - this.setState({ suggests: suggests, activeSuggest: activeSuggest }, callback); - }; - /** - * Return the new activeSuggest object after suggests have been updated - */ - GeoSuggest.prototype.updateActiveSuggest = function (suggests) { - if (suggests === void 0) { suggests = []; } - var activeSuggest = this.state.activeSuggest; - if (activeSuggest) { - var newSuggest = suggests.filter(function (listedSuggest) { - return activeSuggest && - activeSuggest.placeId === listedSuggest.placeId && - activeSuggest.isFixture === listedSuggest.isFixture; - })[0]; - activeSuggest = newSuggest || null; - } - return activeSuggest; - }; - /** - * Show the suggestions - */ - GeoSuggest.prototype.showSuggests = function () { - this.searchSuggests(); - this.setState({ isSuggestsHidden: false }); - }; - /** - * Hide the suggestions - */ - GeoSuggest.prototype.hideSuggests = function () { - var _this = this; - if (this.props.onBlur) { - this.props.onBlur(this.state.userInput); - } - this.timer = window.setTimeout(function () { - _this.setState({ - activeSuggest: null, - isSuggestsHidden: true - }); - }, 100); - }; - /** - * Activate a new suggest - */ - // eslint-disable-next-line complexity, max-statements - GeoSuggest.prototype.activateSuggest = function (direction) { - if (this.state.isSuggestsHidden) { - this.showSuggests(); - return; - } - var suggestsCount = this.state.suggests.length - 1; - var next = direction === 'next'; - var newActiveSuggest = null; - var newIndex = 0; - var i = 0; - for (i; i <= suggestsCount; i++) { - if (this.state.suggests[i] === this.state.activeSuggest) { - newIndex = next ? i + 1 : i - 1; - } - } - if (!this.state.activeSuggest) { - newIndex = next ? 0 : suggestsCount; - } - if (newIndex >= 0 && newIndex <= suggestsCount) { - newActiveSuggest = this.state.suggests[newIndex]; - } - if (this.props.onActivateSuggest) { - this.props.onActivateSuggest(newActiveSuggest); - } - this.setState({ activeSuggest: newActiveSuggest }); - }; - /** - * When an item got selected - */ - // eslint-disable-next-line complexity - GeoSuggest.prototype.selectSuggest = function (suggestToSelect) { - var suggest = suggestToSelect || { - isFixture: true, - label: this.state.userInput, - placeId: this.state.userInput - }; - if (!suggestToSelect && - this.props.autoActivateFirstSuggest && - this.state.suggests.length > 0) { - suggest = this.state.suggests[0]; - } - this.setState({ - isSuggestsHidden: true, - userInput: typeof suggest.label !== 'object' - ? suggest.label - : suggest.description || '' - }); - if (suggest.location) { - this.setState({ ignoreBlur: false }); - if (this.props.onSuggestSelect) { - this.props.onSuggestSelect(suggest); - } - return; - } - this.geocodeSuggest(suggest); - }; - /** - * Geocode a suggest - */ - GeoSuggest.prototype.geocodeSuggest = function (suggestToGeocode) { - var _this = this; - if (!this.geocoder) { - return; - } - if (suggestToGeocode.placeId && - !suggestToGeocode.isFixture && - this.placesService) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var options = { - placeId: suggestToGeocode.placeId, - sessionToken: this.sessionToken - }; - if (this.props.placeDetailFields) { - options.fields = this.props.placeDetailFields; - options.fields.unshift('geometry'); - } - this.placesService.getDetails(options, function (results, status) { - if (status === _this.googleMaps.places.PlacesServiceStatus.OK) { - var gmaps = results; - var location_1 = (gmaps.geometry && - gmaps.geometry.location); - var suggest = __assign(__assign({}, suggestToGeocode), { gmaps: gmaps, location: { - lat: location_1.lat(), - lng: location_1.lng() - } }); - _this.sessionToken = new google.maps.places.AutocompleteSessionToken(); - if (_this.props.onSuggestSelect) { - _this.props.onSuggestSelect(suggest); - } - } - }); - } - else { - var options = { - address: suggestToGeocode.label, - bounds: this.props.bounds, - componentRestrictions: this.props.country - ? { country: this.props.country } - : // eslint-disable-next-line no-undefined - undefined, - location: this.props.location - }; - this.geocoder.geocode(options, function (results, status) { - if (status === _this.googleMaps.GeocoderStatus.OK) { - var gmaps = results[0]; - var location_2 = (gmaps.geometry && - gmaps.geometry.location); - var suggest = __assign(__assign({}, suggestToGeocode), { gmaps: gmaps, location: { - lat: location_2.lat(), - lng: location_2.lng() - } }); - if (_this.props.onSuggestSelect) { - _this.props.onSuggestSelect(suggest); - } - } - }); - } - }; - /** - * Render the view - */ - GeoSuggest.prototype.render = function () { - var _this = this; - var attributes = filterInputAttributes(this.props); - var classes = classnames('geosuggest', this.props.className, { - 'geosuggest--loading': this.state.isLoading - }); - var input = (React__namespace.createElement(Input, __assign({ className: this.props.inputClassName, ref: function (i) { return (_this.input = i); }, value: this.state.userInput, doNotSubmitOnEnter: !this.state.isSuggestsHidden, ignoreTab: this.props.ignoreTab, ignoreEnter: this.props.ignoreEnter, style: this.props.style && this.props.style.input, onChange: this.onInputChange, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onKeyDown: this.props.onKeyDown, onKeyPress: this.props.onKeyPress, inputType: this.props.inputType, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes))); - var suggestionsList = (React__namespace.createElement(SuggestList, { isHidden: this.state.isSuggestsHidden, style: this.props.style && this.props.style.suggests, suggestItemStyle: this.props.style && this.props.style.suggestItem, userInput: this.state.userInput, isHighlightMatch: Boolean(this.props.highlightMatch), suggestsClassName: this.props.suggestsClassName, suggestItemClassName: this.props.suggestItemClassName, suggests: this.state.suggests, hiddenClassName: this.props.suggestsHiddenClassName, suggestItemActiveClassName: this.props.suggestItemActiveClassName, activeSuggest: this.state.activeSuggest, onSuggestNoResults: this.onSuggestNoResults, onSuggestMouseDown: this.onSuggestMouseDown, onSuggestMouseOut: this.onSuggestMouseOut, onSuggestSelect: this.selectSuggest, renderSuggestItem: this.props.renderSuggestItem, listId: this.listId, listLabel: this.listLabel })); - return (React__namespace.createElement("div", { className: classes, id: this.props.id }, - React__namespace.createElement("div", { className: "geosuggest__input-wrapper" }, input), - React__namespace.createElement("div", { className: "geosuggest__suggests-wrapper" }, suggestionsList))); - }; - /** - * Default values for the properties - */ - GeoSuggest.defaultProps = defaults; - return GeoSuggest; - }(React__namespace.Component)); - - /* global google */ - /* eslint-disable no-console */ - var App = function () { - /** - * When the input receives focus - */ - var onFocus = function () { return console.log('onFocus'); }; - /** - * When the input loses focus - */ - var onBlur = function (value) { return console.log('onBlur', value); }; - /** - * When the input got changed - */ - var onChange = function (value) { - return console.log("input changes to : ".concat(value)); - }; - /** - * When a suggest got selected - */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var onSuggestSelect = function (suggest) { return console.log(suggest); }; - /** - * When there are no suggest results - */ - var onSuggestNoResults = function (userInput) { - return console.log("onSuggestNoResults for : ".concat(userInput)); - }; - var fixtures = [ - { label: 'New York', location: { lat: 40.7033127, lng: -73.979681 } }, - { label: 'Rio', location: { lat: -22.066452, lng: -42.9232368 } }, - { label: 'Tokyo', location: { lat: 35.673343, lng: 139.710388 } } - ]; - return (React.createElement(GeoSuggest, { fixtures: fixtures, onFocus: onFocus, onBlur: onBlur, onChange: onChange, onSuggestSelect: onSuggestSelect, onSuggestNoResults: onSuggestNoResults, location: new google.maps.LatLng(53.558572, 9.9278215), radius: "20" })); - }; - var container = document.getElementById('app'); - var root = ReactDOM.createRoot(container); - root.render(React.createElement(App, null)); - -})(React, ReactDOM); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlcyI6WyIuLi8uLi9ub2RlX21vZHVsZXMvY2xhc3NuYW1lcy9pbmRleC5qcyIsIi4uLy4uL25vZGVfbW9kdWxlcy9sb2Rhc2guZGVib3VuY2UvaW5kZXguanMiXSwic291cmNlc0NvbnRlbnQiOlsiLyohXG5cdENvcHlyaWdodCAoYykgMjAxOCBKZWQgV2F0c29uLlxuXHRMaWNlbnNlZCB1bmRlciB0aGUgTUlUIExpY2Vuc2UgKE1JVCksIHNlZVxuXHRodHRwOi8vamVkd2F0c29uLmdpdGh1Yi5pby9jbGFzc25hbWVzXG4qL1xuLyogZ2xvYmFsIGRlZmluZSAqL1xuXG4oZnVuY3Rpb24gKCkge1xuXHQndXNlIHN0cmljdCc7XG5cblx0dmFyIGhhc093biA9IHt9Lmhhc093blByb3BlcnR5O1xuXHR2YXIgbmF0aXZlQ29kZVN0cmluZyA9ICdbbmF0aX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ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsiLCJ4X2dvb2dsZV9pZ25vcmVMaXN0IjpbMCwxXX0= + */p=l,function(){var t={}.hasOwnProperty;function e(){for(var s=[],o=0;o=e||s<0||g&&t-p>=i}function f(){var t=x();if(d(t))return S(t);u=setTimeout(f,function(t){var s=e-(t-a);return g?C(s,i-(t-p)):s}(t))}function S(t){return u=void 0,c&&o?h(t):(o=n=void 0,r)}function m(){var t=x(),s=d(t);if(o=arguments,n=this,a=t,s){if(void 0===u)return function(t){return p=t,u=setTimeout(f,e),l?h(t):r}(a);if(g)return u=setTimeout(f,e),h(a)}return void 0===u&&(u=setTimeout(f,e)),r}return e=O(e)||0,M(s)&&(l=!!s.leading,i=(g="maxWait"in s)?N(O(s.maxWait)||0,e):i,c="trailing"in s?!!s.trailing:c),m.cancel=function(){void 0!==u&&clearTimeout(u),p=0,o=a=n=u=void 0},m.flush=function(){return void 0===u?r:S(x())},m},D=a(T),E={autoActivateFirstSuggest:!1,disabled:!1,fixtures:[],getSuggestLabel:function(t){return t.description},highlightMatch:!0,ignoreEnter:!1,ignoreTab:!1,initialValue:"",maxFixtures:10,minLength:1,onKeyDown:function(){},onKeyPress:function(){},placeholder:"Search places",queryDelay:250,skipSuggest:function(){return!1},style:{},inputType:"text"},_=["autoCapitalize","autoComplete","autoCorrect","autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","height","inputMode","maxLength","name","onClick","onContextMenu","onCopy","onCut","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPaste","pattern","placeholder","readOnly","required","size","spellCheck","tabIndex","title","aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription","aria-activedescendant","aria-autocomplete","aria-multiline","aria-placeholder","aria-readonly","aria-required"];function k(t){var e={};return Object.keys(t).forEach((function(s){var o=s.startsWith("data-");(_.includes(s)||o)&&(e[s]=t[s])})),e}var P=function(t){function e(e){var s=t.call(this,e)||this;return s.input=null,s.onChange=s.onChange.bind(s),s.onInputKeyDown=s.onInputKeyDown.bind(s),s}return i(e,t),e.prototype.onChange=function(){this.input&&this.props.onChange(this.input.value)},e.prototype.onInputKeyDown=function(t){switch(this.props.onKeyDown&&this.props.onKeyDown(t),t.which){case 40:t.shiftKey||(t.preventDefault(),this.props.onNext());break;case 38:t.shiftKey||(t.preventDefault(),this.props.onPrev());break;case 13:this.props.doNotSubmitOnEnter&&t.preventDefault(),this.props.ignoreEnter||this.props.onSelect();break;case 9:this.props.ignoreTab||this.props.onSelect();break;case 27:this.props.onEscape()}},e.prototype.focus=function(){this.input&&this.input.focus()},e.prototype.blur=function(){this.input&&this.input.blur()},e.prototype.render=function(){var t=this,e=k(this.props),s=g("geosuggest__input",this.props.className),n=this.props.label&&this.props.id;return e.tabIndex||(e.tabIndex=0),o.createElement(o.Fragment,null,n&&o.createElement("label",{className:"geosuggest__label",htmlFor:this.props.id},this.props.label),o.createElement("input",r({className:s,id:"geosuggest__input".concat(this.props.id?"--".concat(this.props.id):""),ref:function(e){return t.input=e},type:this.props.inputType},e,{value:this.props.value,style:this.props.style,onKeyDown:this.onInputKeyDown,onChange:this.onChange,onKeyPress:this.props.onKeyPress,onFocus:this.props.onFocus,onBlur:this.props.onBlur,role:"combobox","aria-expanded":!this.props.isSuggestsHidden,"aria-activedescendant":this.props.activeSuggest?this.props.activeSuggest.placeId:void 0,"aria-owns":this.props.listId})))},e.defaultProps={activeSuggest:null,autoComplete:"off",className:"",isSuggestsHidden:!0,listId:"",inputType:"text",onBlur:function(){},onChange:function(){},onEscape:function(){},onFocus:function(){},onKeyDown:function(){},onKeyPress:function(){},onNext:function(){},onPrev:function(){},onSelect:function(){},value:""},e}(o.PureComponent),A=function(t){function e(e){var s=t.call(this,e)||this;return s.ref=null,s.onClick=s.onClick.bind(s),s}return i(e,t),e.prototype.makeBold=function(t,e){return o.createElement("b",{className:"geosuggest__item__matched-text",key:e},t)},e.prototype.formatMatchedText=function(t,e){if(!t||!e.matchedSubstrings)return e.label;var s=e.matchedSubstrings.offset,n=s+e.matchedSubstrings.length,i=this.makeBold(e.label.substring(s,n),e.label),r="",u="";return s>0&&(r=e.label.slice(0,s)),ne.scrollTop+e.clientHeight;(s||o)&&(e.scrollTop=t.offsetTop-e.offsetTop-e.clientHeight/2+t.clientHeight/2)}},e.prototype.onClick=function(t){t.preventDefault(),this.props.onSelect(this.props.suggest)},e.prototype.render=function(){var t,e=this,s=this.props.suggest,n=g("geosuggest__item",this.props.className,this.props.suggestItemClassName,{"geosuggest__item--active":this.props.isActive},((t={})[this.props.activeClassName||""]=this.props.activeClassName?this.props.isActive:null,t)),i=s.label;return this.props.renderSuggestItem?i=this.props.renderSuggestItem(s,this.props.userInput):this.props.isHighlightMatch&&(i=this.formatMatchedText(this.props.userInput,s)),o.createElement("li",{className:n,ref:function(t){return e.ref=t},style:this.props.style,onMouseDown:this.props.onMouseDown,onMouseOut:this.props.onMouseOut,onClick:this.onClick,role:"option","aria-selected":this.props.isActive,id:s.placeId},i)},e}(o.PureComponent),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.isHidden=function(){return this.props.isHidden||0===this.props.suggests.length},e.prototype.componentDidUpdate=function(t){t.suggests!==this.props.suggests&&0===this.props.suggests.length&&this.props.onSuggestNoResults()},e.prototype.render=function(){var t,e=this,s=g("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},((t={})[this.props.hiddenClassName||""]=this.props.hiddenClassName?this.isHidden():null,t));return o.createElement("ul",{className:s,style:this.props.style,role:"listbox","aria-label":this.props.listLabel,id:this.props.listId},this.props.suggests.map((function(t){var s=e.props.activeSuggest&&t.placeId===e.props.activeSuggest.placeId||!1;return o.createElement(A,{key:t.placeId,className:t.className||"",userInput:e.props.userInput,isHighlightMatch:e.props.isHighlightMatch,suggest:t,style:e.props.suggestItemStyle,suggestItemClassName:e.props.suggestItemClassName,isActive:s,activeClassName:e.props.suggestItemActiveClassName,onMouseDown:e.props.onSuggestMouseDown,onMouseOut:e.props.onSuggestMouseOut,onSelect:e.props.onSuggestSelect,renderSuggestItem:e.props.renderSuggestItem})})))},e}(o.PureComponent);var j=function(t){function e(e){var s=t.call(this,e)||this;return s.googleMaps=null,s.autocompleteService=null,s.placesService=null,s.sessionToken=void 0,s.geocoder=null,s.input=null,s.state={activeSuggest:null,ignoreBlur:!1,isLoading:!1,isSuggestsHidden:!0,suggests:[],userInput:e.initialValue||""},s.onInputChange=s.onInputChange.bind(s),s.onAfterInputChange=s.onAfterInputChange.bind(s),s.onInputFocus=s.onInputFocus.bind(s),s.onInputBlur=s.onInputBlur.bind(s),s.onNext=s.onNext.bind(s),s.onPrev=s.onPrev.bind(s),s.onSelect=s.onSelect.bind(s),s.onSuggestMouseDown=s.onSuggestMouseDown.bind(s),s.onSuggestMouseOut=s.onSuggestMouseOut.bind(s),s.onSuggestNoResults=s.onSuggestNoResults.bind(s),s.hideSuggests=s.hideSuggests.bind(s),s.selectSuggest=s.selectSuggest.bind(s),s.listId="geosuggest__list".concat(e.id?"--".concat(e.id):""),s.listLabel=e.label?"".concat(e.label," options"):"options",e.queryDelay&&(s.onAfterInputChange=D(s.onAfterInputChange,e.queryDelay)),s}return i(e,t),e.prototype.componentDidUpdate=function(t){t.initialValue!==this.props.initialValue&&this.setState({userInput:this.props.initialValue||""}),JSON.stringify(t.fixtures)!==JSON.stringify(this.props.fixtures)&&this.searchSuggests()},e.prototype.componentDidMount=function(){if("undefined"!=typeof window){var t=this.props.googleMaps||window.google&&window.google.maps||this.googleMaps;t?(this.googleMaps=t,this.autocompleteService=new t.places.AutocompleteService,this.placesService=new t.places.PlacesService(document.createElement("div")),this.sessionToken=new t.places.AutocompleteSessionToken,this.geocoder=new t.Geocoder):console&&console.error("Google maps API was not found in the page.")}},e.prototype.componentWillUnmount=function(){clearTimeout(this.timer)},e.prototype.onInputChange=function(t){t||this.props.onSuggestSelect&&this.props.onSuggestSelect(),this.setState({userInput:t},this.onAfterInputChange)},e.prototype.onAfterInputChange=function(){this.showSuggests(),this.props.onChange&&this.props.onChange(this.state.userInput)},e.prototype.onInputFocus=function(){this.props.onFocus&&this.props.onFocus(),this.showSuggests()},e.prototype.onInputBlur=function(){this.state.ignoreBlur||this.hideSuggests()},e.prototype.onNext=function(){this.activateSuggest("next")},e.prototype.onPrev=function(){this.activateSuggest("prev")},e.prototype.onSelect=function(){this.selectSuggest(this.state.activeSuggest)},e.prototype.onSuggestMouseDown=function(){this.setState({ignoreBlur:!0})},e.prototype.onSuggestMouseOut=function(){this.setState({ignoreBlur:!1})},e.prototype.onSuggestNoResults=function(){this.props.onSuggestNoResults&&this.props.onSuggestNoResults(this.state.userInput)},e.prototype.focus=function(){this.input&&this.input.focus()},e.prototype.blur=function(){this.input&&this.input.blur()},e.prototype.update=function(t){this.setState({userInput:t}),this.props.onChange&&this.props.onChange(t)},e.prototype.clear=function(){this.setState({userInput:""},this.hideSuggests)},e.prototype.searchSuggests=function(){var t=this;if(this.state.userInput){var e={input:this.state.userInput,sessionToken:this.sessionToken},s=this.state.userInput.length;if(this.props.minLength&&s=p||a&&!a(t)&&t.label.match(g)&&(c++,n.push(r(r({},t),{isFixture:!0,matchedSubstrings:{length:i.length,offset:t.label.indexOf(i)},placeId:t.placeId||t.label})))})),t.forEach((function(t){a&&!a(t)&&n.push({description:t.description,isFixture:!1,label:s.props.getSuggestLabel?s.props.getSuggestLabel(t):"",matchedSubstrings:t.matched_substrings[0],placeId:t.place_id})})),o=this.updateActiveSuggest(n),this.props.onUpdateSuggests&&this.props.onUpdateSuggests(n,o),this.setState({suggests:n,activeSuggest:o},e)},e.prototype.updateActiveSuggest=function(t){void 0===t&&(t=[]);var e=this.state.activeSuggest;if(e){var s=t.filter((function(t){return e&&e.placeId===t.placeId&&e.isFixture===t.isFixture}))[0];e=s||null}return e},e.prototype.showSuggests=function(){this.searchSuggests(),this.setState({isSuggestsHidden:!1})},e.prototype.hideSuggests=function(){var t=this;this.props.onBlur&&this.props.onBlur(this.state.userInput),this.timer=window.setTimeout((function(){t.setState({activeSuggest:null,isSuggestsHidden:!0})}),100)},e.prototype.activateSuggest=function(t){if(this.state.isSuggestsHidden)this.showSuggests();else{for(var e=this.state.suggests.length-1,s="next"===t,o=null,n=0,i=0;i<=e;i++)this.state.suggests[i]===this.state.activeSuggest&&(n=s?i+1:i-1);this.state.activeSuggest||(n=s?0:e),n>=0&&n<=e&&(o=this.state.suggests[n]),this.props.onActivateSuggest&&this.props.onActivateSuggest(o),this.setState({activeSuggest:o})}},e.prototype.selectSuggest=function(t){var e=t||{isFixture:!0,label:this.state.userInput,placeId:this.state.userInput};if(!t&&this.props.autoActivateFirstSuggest&&this.state.suggests.length>0&&(e=this.state.suggests[0]),this.setState({isSuggestsHidden:!0,userInput:"object"!=typeof e.label?e.label:e.description||""}),e.location)return this.setState({ignoreBlur:!1}),void(this.props.onSuggestSelect&&this.props.onSuggestSelect(e));this.geocodeSuggest(e)},e.prototype.geocodeSuggest=function(t){var e=this;if(this.geocoder)if(t.placeId&&!t.isFixture&&this.placesService){var s={placeId:t.placeId,sessionToken:this.sessionToken};this.props.placeDetailFields&&(s.fields=this.props.placeDetailFields,s.fields.unshift("geometry")),this.placesService.getDetails(s,(function(s,o){if(o===e.googleMaps.places.PlacesServiceStatus.OK){var n=s,i=n.geometry&&n.geometry.location,u=r(r({},t),{gmaps:n,location:{lat:i.lat(),lng:i.lng()}});e.sessionToken=new google.maps.places.AutocompleteSessionToken,e.props.onSuggestSelect&&e.props.onSuggestSelect(u)}}))}else{s={address:t.label,bounds:this.props.bounds,componentRestrictions:this.props.country?{country:this.props.country}:void 0,location:this.props.location};this.geocoder.geocode(s,(function(s,o){if(o===e.googleMaps.GeocoderStatus.OK){var n=s[0],i=n.geometry&&n.geometry.location,u=r(r({},t),{gmaps:n,location:{lat:i.lat(),lng:i.lng()}});e.props.onSuggestSelect&&e.props.onSuggestSelect(u)}}))}},e.prototype.render=function(){var t=this,e=k(this.props),s=g("geosuggest",this.props.className,{"geosuggest--loading":this.state.isLoading}),n=o.createElement(P,r({className:this.props.inputClassName,ref:function(e){return t.input=e},value:this.state.userInput,doNotSubmitOnEnter:!this.state.isSuggestsHidden,ignoreTab:this.props.ignoreTab,ignoreEnter:this.props.ignoreEnter,style:this.props.style&&this.props.style.input,onChange:this.onInputChange,onFocus:this.onInputFocus,onBlur:this.onInputBlur,onKeyDown:this.props.onKeyDown,onKeyPress:this.props.onKeyPress,inputType:this.props.inputType,onNext:this.onNext,onPrev:this.onPrev,onSelect:this.onSelect,onEscape:this.hideSuggests,isSuggestsHidden:this.state.isSuggestsHidden,activeSuggest:this.state.activeSuggest,label:this.props.label,id:this.props.id,listId:this.listId},e)),i=o.createElement(F,{isHidden:this.state.isSuggestsHidden,style:this.props.style&&this.props.style.suggests,suggestItemStyle:this.props.style&&this.props.style.suggestItem,userInput:this.state.userInput,isHighlightMatch:Boolean(this.props.highlightMatch),suggestsClassName:this.props.suggestsClassName,suggestItemClassName:this.props.suggestItemClassName,suggests:this.state.suggests,hiddenClassName:this.props.suggestsHiddenClassName,suggestItemActiveClassName:this.props.suggestItemActiveClassName,activeSuggest:this.state.activeSuggest,onSuggestNoResults:this.onSuggestNoResults,onSuggestMouseDown:this.onSuggestMouseDown,onSuggestMouseOut:this.onSuggestMouseOut,onSuggestSelect:this.selectSuggest,renderSuggestItem:this.props.renderSuggestItem,listId:this.listId,listLabel:this.listLabel});return o.createElement("div",{className:s,id:this.props.id},o.createElement("div",{className:"geosuggest__input-wrapper"},n),o.createElement("div",{className:"geosuggest__suggests-wrapper"},i))},e.defaultProps=E,e}(o.Component),H=document.getElementById("app");e.createRoot(H).render(t.createElement((function(){return t.createElement(j,{fixtures:[{label:"New York",location:{lat:40.7033127,lng:-73.979681}},{label:"Rio",location:{lat:-22.066452,lng:-42.9232368}},{label:"Tokyo",location:{lat:35.673343,lng:139.710388}}],onFocus:function(){return console.log("onFocus")},onBlur:function(t){return console.log("onBlur",t)},onChange:function(t){return console.log("input changes to : ".concat(t))},onSuggestSelect:function(t){return console.log(t)},onSuggestNoResults:function(t){return console.log("onSuggestNoResults for : ".concat(t))},location:new google.maps.LatLng(53.558572,9.9278215),radius:"20"})}),null))}(React,ReactDOM); diff --git a/index.html b/index.html deleted file mode 100644 index 51334cf..0000000 --- a/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - React Geosuggest - - - - - - - - -
-

React Geosuggest

-

- Google Places Suggest for - - React.js,
- supporting default places. -

-
-
Check the console when selecting a suggest!
- -
- - - diff --git a/ubilabs.svg b/ubilabs.svg deleted file mode 100644 index 8a806bd..0000000 --- a/ubilabs.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - -