Skip to content

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Nov 8, 2022

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@aws-amplify/[email protected]

Minor Changes

  • #2708 702a35738 Thanks @zchenwei! - feat: add Autocomplete primitive

    Example

    // Uncontrolled component
    import { Autocomplete } from '@aws-amplify/ui-react';
    import * as React from 'react';
    
    const options = [
      { id: 'apple', label: 'apple' },
      { id: 'banana', label: 'banana' },
      { id: 'cherry', label: 'cherry' },
      { id: 'grape', label: 'grape' },
      { id: 'kiwis', label: 'kiwis' },
      { id: 'lemon', label: 'lemon' },
      { id: 'mango', label: 'mango' },
      { id: 'orange', label: 'orange' },
      { id: 'strawberry', label: 'strawberry' },
    ];
    
    export const AutocompleteUncontrolledExample = () => {
      return <Autocomplete label="Uncontrolled autocomplete" options={options} />;
    };
    // Controlled component
    import { Autocomplete } from '@aws-amplify/ui-react';
    import * as React from 'react';
    
    const options = [
      { id: 'apple', label: 'apple' },
      { id: 'banana', label: 'banana' },
      { id: 'cherry', label: 'cherry' },
      { id: 'grape', label: 'grape' },
      { id: 'kiwis', label: 'kiwis' },
      { id: 'lemon', label: 'lemon' },
      { id: 'mango', label: 'mango' },
      { id: 'orange', label: 'orange' },
      { id: 'strawberry', label: 'strawberry' },
    ];
    
    export const AutocompleteControlledExample = () => {
      const [value, setValue] = React.useState('');
    
      const onChange = (event) => {
        setValue(event.target.value);
      };
    
      // Set up onSelect
      const onSelect = (option) => {
        const { label } = option;
        setValue(label);
      };
    
      // Set up onClear
      const onClear = () => {
        setValue('');
      };
    
      return (
        <Autocomplete
          label="Controlled autocomplete"
          options={options}
          value={value}
          onChange={onChange}
          onClear={onClear}
          onSelect={onSelect}
        />
      );
    };

Patch Changes

@aws-amplify/[email protected]

Minor Changes

  • #2708 702a35738 Thanks @zchenwei! - feat: add Autocomplete primitive

    Example

    // Uncontrolled component
    import { Autocomplete } from '@aws-amplify/ui-react';
    import * as React from 'react';
    
    const options = [
      { id: 'apple', label: 'apple' },
      { id: 'banana', label: 'banana' },
      { id: 'cherry', label: 'cherry' },
      { id: 'grape', label: 'grape' },
      { id: 'kiwis', label: 'kiwis' },
      { id: 'lemon', label: 'lemon' },
      { id: 'mango', label: 'mango' },
      { id: 'orange', label: 'orange' },
      { id: 'strawberry', label: 'strawberry' },
    ];
    
    export const AutocompleteUncontrolledExample = () => {
      return <Autocomplete label="Uncontrolled autocomplete" options={options} />;
    };
    // Controlled component
    import { Autocomplete } from '@aws-amplify/ui-react';
    import * as React from 'react';
    
    const options = [
      { id: 'apple', label: 'apple' },
      { id: 'banana', label: 'banana' },
      { id: 'cherry', label: 'cherry' },
      { id: 'grape', label: 'grape' },
      { id: 'kiwis', label: 'kiwis' },
      { id: 'lemon', label: 'lemon' },
      { id: 'mango', label: 'mango' },
      { id: 'orange', label: 'orange' },
      { id: 'strawberry', label: 'strawberry' },
    ];
    
    export const AutocompleteControlledExample = () => {
      const [value, setValue] = React.useState('');
    
      const onChange = (event) => {
        setValue(event.target.value);
      };
    
      // Set up onSelect
      const onSelect = (option) => {
        const { label } = option;
        setValue(label);
      };
    
      // Set up onClear
      const onClear = () => {
        setValue('');
      };
    
      return (
        <Autocomplete
          label="Controlled autocomplete"
          options={options}
          value={value}
          onChange={onChange}
          onClear={onClear}
          onSelect={onSelect}
        />
      );
    };

Patch Changes

@aws-amplify/[email protected]

Patch Changes

@aws-amplify/[email protected]

Patch Changes

@aws-amplify/[email protected]

Patch Changes

@github-actions github-actions bot force-pushed the changeset-release/main branch from b8622e7 to 049c3d6 Compare November 8, 2022 22:40
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.

0 participants