Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement autocomplete and geocoding #103

Merged
merged 17 commits into from
May 25, 2021

Conversation

erikfazio
Copy link
Contributor

I implemented autocomplete and geocoding features.

@erikfazio erikfazio requested a review from AleDore as a code owner May 24, 2021 14:56
@pagopa-github-bot
Copy link
Contributor

pagopa-github-bot commented May 24, 2021

Warnings
⚠️ This PR changes a total of 751 LOCs, that is more than a reasonable size of 250. Consider splitting the pull request into smaller ones.
⚠️ Please include a Pivotal story at the beginning of the PR title (see below).

@types/react-select

Author: Unknown

Description: TypeScript definitions for react-select

Homepage: http://npmjs.com/package/@types/react-select

Createdabout 5 years ago
Last Updated8 days ago
LicenseMIT
Maintainers1
Releases132
Direct Dependencies@emotion/serialize, @types/react, @types/react-dom and @types/react-transition-group
README

Installation

npm install --save @types/react-select

Summary

This package contains type definitions for react-select (https://github.com/JedWatson/react-select#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-select.

Additional Details

Credits

These definitions were written by Jon Freedman, Nathan Bierema, Thomas Chia, Joonas Rouhiainen, and Kyle Holmberg.

react-select

Author: Jed Watson

Description: A Select control built with and for ReactJS

Homepage: http://npmjs.com/package/react-select

Createdover 6 years ago
Last Updated14 days ago
LicenseMIT
Maintainers5
Releases147
Direct Dependencies@babel/runtime, @emotion/cache, @emotion/react, memoize-one, prop-types, react-input-autosize and react-transition-group
Keywordscombobox, form, input, multiselect, react, react-component, select and ui
README

NPM
CircleCI
Coverage Status
Supported by Thinkmill

React-Select

The Select control for React. Initially built for use in KeystoneJS.

See react-select.com for live demos and comprehensive docs.

See our upgrade guide for a breakdown on how to upgrade from v2 to v3.

React Select is funded by Thinkmill and Atlassian. It represents a whole new approach to developing powerful React.js components that just work out of the box, while being extremely customisable.

Features include:

  • Flexible approach to data, with customisable functions
  • Extensible styling API with emotion
  • Component Injection API for complete control over the UI behaviour
  • Controllable state props and modular architecture
  • Long-requested features like option groups, portal support, animation, and more

If you're interested in the background, watch Jed's talk on React Select at ReactNYC in March 2018.

See our upgrade guide for a breakdown on how to upgrade from v1 to v2.

The old docs and examples will continue to be available at v1.react-select.com.

Installation and usage

The easiest way to use react-select is to install it from npm and build it into your app with Webpack.

yarn add react-select

Then use it in your app:

import React from 'react';
import Select from 'react-select';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' },
];

class App extends React.Component {
  state = {
    selectedOption: null,
  };
  handleChange = selectedOption => {
    this.setState({ selectedOption });
    console.log(`Option selected:`, selectedOption);
  };
  render() {
    const { selectedOption } = this.state;

    return (
      <Select
        value={selectedOption}
        onChange={this.handleChange}
        options={options}
      />
    );
  }
}

Props

Common props you may want to specify include:

  • autoFocus - focus the control when it mounts
  • className - apply a className to the control
  • classNamePrefix - apply classNames to inner elements with the given prefix
  • isDisabled - disable the control
  • isMulti - allow the user to select multiple values
  • isSearchable - allow the user to search for matching options
  • name - generate an HTML input with this name, containing the current value
  • onChange - subscribe to change events
  • options - specify the options the user can select from
  • placeholder - change the text displayed when no option is selected
  • value - control the current value

See the props documentation for complete documentation on the props react-select supports.

Controllable Props

You can control the following props by providing values for them. If you don't, react-select will manage them for you.

  • value / onChange - specify the current value of the control
  • menuIsOpen / onMenuOpen / onMenuClose - control whether the menu is open
  • inputValue / onInputChange - control the value of the search input (changing this will update the available options)

If you don't provide these props, you can set the initial value of the state they control:

  • defaultValue - set the initial value of the control
  • defaultMenuIsOpen - set the initial open value of the menu
  • defaultInputValue - set the initial value of the search input

Methods

React-select exposes two public methods:

  • focus() - focus the control programatically
  • blur() - blur the control programatically

Customisation

Check the docs for more information on:

Thanks

Thank you to everyone who has contributed to this project. It's been a wild ride.

If you like React Select, you should follow me on twitter

Shout out to Joss Mackison, Charles Lee, Ben Conolly, Dave Brotherstone, Brian Vaughn, and the Atlassian Design System team ❤️

License

MIT Licensed. Copyright (c) Jed Watson 2019.

New dependencies added: react-select and @types/react-select.

Example of PR titles that include pivotal stories:

  • single story: [#123456] my PR title
  • multiple stories: [#123456,#123457,#123458] my PR title

Generated by 🚫 dangerJS against bdd0134

AleDore
AleDore previously approved these changes May 25, 2021
@erikfazio erikfazio merged commit a689b16 into master May 25, 2021
@erikfazio erikfazio deleted the implement-autocomplete-and-geocoding branch May 25, 2021 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants