<commit_before>/* eslint "react/destructuring-assignment": 0, react/prop-types: 0 */

import React, { useState } from 'react'
import { storiesOf } from '@storybook/react'

import FilterAdvisersTypeahead from '../elements/FilterAdvisersTypeahead'
import exampleReadme from '../elements/FilterAdvisersTypeahead/example.md'
import usageReadme from '../elements/FilterAdvisersTypeahead/usage.md'

const asyncOptions = [
  {
    value: '379f390a-e083-4a2c-9cea-e3b9a08606a7',
    label: '<NAME> - Heart of the South West LEP',
  },
  {
    value: '8dcd2bb8-dc73-4a42-8655-4ae42d4d3c5a',
    label: '<NAME> - Welsh Government (Investment)',
  },
  {
    value: 'a6f39399-5bf4-46cb-a686-826f73e9f0ca',
    label: '<NAME>',
  },
]

const SearchMesssage = () => <p>Try searching for Bernard, Holly or Dennis</p>

const FilterAdvisersTypeaheadWithState = (props) => {
  const [advisers, setAdvisers] = useState([])

  const onChange = (adviser) => {
    setAdvisers(adviser)
  }

  return (
    <FilterAdvisersTypeahead
      onChange={onChange}
      selectedAdvisers={advisers}
      {...props}
    />
  )
}

const loadOptions = () =>
  new Promise((resolve) => setTimeout(resolve, 1000, asyncOptions))

storiesOf('Filters/Adviser typeahead', module)
  .addParameters({
    options: { theme: undefined },
    readme: {
      content: exampleReadme,
      sidebar: usageReadme,
    },
  })
  .add('Default', () => (
    <div style={{ width: '600px' }}>
      <SearchMesssage />
      <FilterAdvisersTypeaheadWithState
        label="Advisers"
        isMulti={true}
        closeMenuOnSelect={false}
        name="example-1"
        loadOptions={loadOptions}
        placeholder="Search advisers..."
        noOptionsMessage={() => <span>No advisers found</span>}
        taskProps={{
          name: 'task name 1',<commit_msg>Remove usage documentation<commit_after>/* eslint "react/destructuring-assignment": 0, react/prop-types: 0 */

import React, { useState } from 'react'
import { storiesOf } from '@storybook/react'

import FilterAdvisersTypeahead from '../elements/FilterAdvisersTypeahead'
import exampleReadme from '../elements/FilterAdvisersTypeahead/example.md'

const asyncOptions = [
  {
    value: '379f390a-e083-4a2c-9cea-e3b9a08606a7',
    label: '<NAME> - Heart of the South West LEP',
  },
  {
    value: '8dcd2bb8-dc73-4a42-8655-4ae42d4d3c5a',
    label: '<NAME> - Welsh Government (Investment)',
  },
  {
    value: 'a6f39399-5bf4-46cb-a686-826f73e9f0ca',
    label: '<NAME>',
  },
]

const SearchMesssage = () => <p>Try searching for Bernard, Holly or Dennis</p>

const FilterAdvisersTypeaheadWithState = (props) => {
  const [advisers, setAdvisers] = useState([])

  const onChange = (adviser) => {
    setAdvisers(adviser)
  }

  return (
    <FilterAdvisersTypeahead
      onChange={onChange}
      selectedAdvisers={advisers}
      {...props}
    />
  )
}

const loadOptions = () =>
  new Promise((resolve) => setTimeout(resolve, 1000, asyncOptions))

storiesOf('Filters/Adviser typeahead', module)
  .addParameters({
    options: { theme: undefined },
    readme: {
      content: exampleReadme,
    },
  })
  .add('Default', () => (
    <div style={{ width: '600px' }}>
      <SearchMesssage />
      <FilterAdvisersTypeaheadWithState
        label="Advisers"
        isMulti={true}
        closeMenuOnSelect={false}
        name="example-1"
        loadOptions={loadOptions}
        placeholder="Search advisers..."
        noOptionsMessage={() => <span>No advisers found</span>}
        taskProps={{
          name: 'task name 1',
{'fraction_non_alphanumeric': 0.1447887323943662, 'fraction_numerical': 0.038873239436619716, 'mean_word_length': 3.304242424242424, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 37, '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': '2373333', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1212, 'n_words': 229}