forked from uber/baseweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(combobox): add flag to disable autocomplete (uber#3391)
* feat(combobox): add flag to disable autocomplete * test(vrt): update visual snapshots for 70a320d [skip ci] (uber#3392) Co-authored-by: UberOpenSourceBot <[email protected]> Co-authored-by: UberOpenSourceBot <[email protected]> Co-authored-by: UberOpenSourceBot <[email protected]>
- Loading branch information
1 parent
b232e26
commit c59394f
Showing
9 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/combobox/__tests__/combobox-autocomplete-false.scenario.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Copyright (c) 2018-2020 Uber Technologies, Inc. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
// @flow | ||
|
||
import * as React from 'react'; | ||
|
||
import {FormControl} from '../../form-control/index.js'; | ||
import {useStyletron} from '../../styles/index.js'; | ||
import {Combobox} from '../index.js'; | ||
|
||
type OptionT = {label: string, id: string}; | ||
const options: OptionT[] = [ | ||
{label: 'AliceBlue', id: '#F0F8FF'}, | ||
{label: 'AntiqueWhite', id: '#FAEBD7'}, | ||
{label: 'Aqua', id: '#00FFFF'}, | ||
{label: 'Aquamarine', id: '#7FFFD4'}, | ||
{label: 'Azure', id: '#F0FFFF'}, | ||
{label: 'Beige', id: '#F5F5DC'}, | ||
]; | ||
|
||
function Example() { | ||
const [css] = useStyletron(); | ||
const [value, setValue] = React.useState(''); | ||
return ( | ||
<div className={css({width: '375px', padding: '12px 48px'})}> | ||
<FormControl label="label" caption="caption"> | ||
<Combobox | ||
autocomplete={false} | ||
value={value} | ||
onChange={setValue} | ||
mapOptionToString={o => o.label} | ||
options={options} | ||
/> | ||
</FormControl> | ||
</div> | ||
); | ||
} | ||
|
||
export default Example; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.31 KB
vrt/__image_snapshots__/combobox-autocomplete-false__desktop-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.