<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import { polyfill as reactLifecyclesCompat } from 'react-lifecycles-compat'
import classNames from 'classnames'

import ExpandableList from './ExpandableList'
import List from './List'
import Label from './TextInputLabel'
import TextInput from './TextInputInput'
import Ellipsis from './Ellipsis'
import WithError from './WithError'

import { onBlurForReduxForm } from './utility/redux-form'
import { submitFormOnCtrlEnter } from './utility/dom'

// `PureComponent` is only available in React >= 15.3.0.
const PureComponent = React.PureComponent || React.Component

const empty_value_option_value = ''

@reactLifecyclesCompat
export default class Autocomplete extends PureComponent
{
	static propTypes =
	{
		// A list of selectable options
		options : PropTypes.arrayOf
		(
			PropTypes.shape
			({
				// Option value (may be `undefined`)
				value : PropTypes.any,
				// Could restrict it to stringifiable types
				// but I guess this is not required
				// and one could even use `object`s as `value`s.
				// // Option value (may be `undefined`)
				// value : PropTypes.oneOfType([
				// 	PropTypes.string,
				// 	PropTypes.number,
				// 	PropTypes.bool
				// ]),
				// Option label (may be `undefined`)
				label : PropTypes.string,
				// Option icon
				icon  : PropTypes.oneOfType
				([
					PropTypes.node,
					PropTypes.func
				]),
				// Render custom content (a React component).
				// Receives `{ value, label }` properties.
				content : PropTypes.func
			})
		)
		.isRequired,

		// An alternative way of getting `options`.
		// If it's an `autocomplete` then this function
		// receives the `query : string` argument.
		// Is only for `autocomplete` mode.
		// Must return a `Promise`.
		getOptions : PropTypes.func,

		// Can be supplied when supplying `options` prop.
		// By default filters by substring inclusion (case-insensitive).
		filterOptions : PropTypes.func.isRequired,

		// The maximum number of options to be rendered
		// in the options list when it's expanded.
		// `0` means "unlimited".
		maxOptions : PropTypes.number,

		// Throttle `async getOptions()` invocations.
		throttle : PropTypes.number.isRequired,

		// Throttle `async getOptions()` invocations.
		minCharactersToStartThrottling : PropTypes.number.isRequired,

		// Option component.<commit_msg>`<Autocomplete options/>` aren't required<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import { polyfill as reactLifecyclesCompat } from 'react-lifecycles-compat'
import classNames from 'classnames'

import ExpandableList from './ExpandableList'
import List from './List'
import Label from './TextInputLabel'
import TextInput from './TextInputInput'
import Ellipsis from './Ellipsis'
import WithError from './WithError'

import { onBlurForReduxForm } from './utility/redux-form'
import { submitFormOnCtrlEnter } from './utility/dom'

// `PureComponent` is only available in React >= 15.3.0.
const PureComponent = React.PureComponent || React.Component

const empty_value_option_value = ''

@reactLifecyclesCompat
export default class Autocomplete extends PureComponent
{
	static propTypes =
	{
		// A list of selectable options
		options : PropTypes.arrayOf
		(
			PropTypes.shape
			({
				// Option value (may be `undefined`)
				value : PropTypes.any,
				// Could restrict it to stringifiable types
				// but I guess this is not required
				// and one could even use `object`s as `value`s.
				// // Option value (may be `undefined`)
				// value : PropTypes.oneOfType([
				// 	PropTypes.string,
				// 	PropTypes.number,
				// 	PropTypes.bool
				// ]),
				// Option label (may be `undefined`)
				label : PropTypes.string,
				// Option icon
				icon  : PropTypes.oneOfType
				([
					PropTypes.node,
					PropTypes.func
				]),
				// Render custom content (a React component).
				// Receives `{ value, label }` properties.
				content : PropTypes.func
			})
		),

		// An alternative way of getting `options`.
		// If it's an `autocomplete` then this function
		// receives the `query : string` argument.
		// Is only for `autocomplete` mode.
		// Must return a `Promise`.
		getOptions : PropTypes.func,

		// Can be supplied when supplying `options` prop.
		// By default filters by substring inclusion (case-insensitive).
		filterOptions : PropTypes.func.isRequired,

		// The maximum number of options to be rendered
		// in the options list when it's expanded.
		// `0` means "unlimited".
		maxOptions : PropTypes.number,

		// Throttle `async getOptions()` invocations.
		throttle : PropTypes.number.isRequired,

		// Throttle `async getOptions()` invocations.
		minCharactersToStartThrottling : PropTypes.number.isRequired,

		// Option component.
{'fraction_non_alphanumeric': 0.1098326359832636, 'fraction_numerical': 0.0020920502092050207, 'mean_word_length': 3.1755458515283843, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6474590', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1403, 'n_words': 447}