-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New Component: ComboBox #1920
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
New Component: ComboBox #1920
Changes from all commits
6d18606
3cc47d2
ec78224
3399566
e43ac7b
ac35bdc
d4c84ec
6b2ef29
aad70fb
1c6b74b
1612bcc
3941b20
d52e4e3
4b779c6
ba63a49
8a0a24c
8db368f
b1a1f6e
2be2043
f61ce25
51e4e21
f8e0956
b312e36
97c208f
80f901e
2670a5d
d02daaa
398bdd1
12b7b7b
3536017
55e2ad7
c6b98ed
460f3de
5bd6c64
3022036
358d025
705a852
2634c1b
6b0e678
9039ab4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import * as React from 'react'; | ||
| import { ComboBoxPage } from 'office-ui-fabric-react/lib/components/ComboBox/ComboBoxPage'; | ||
| import { PageHeader } from '../../components/PageHeader/PageHeader'; | ||
| import { ComponentPage } from '../../components/ComponentPage/ComponentPage'; | ||
|
|
||
| export class ComboBoxComponentPage extends React.Component<any, any> { | ||
| public render() { | ||
| return ( | ||
| <div ref='pageElement'> | ||
| <ComponentPage> | ||
| <PageHeader pageTitle='ComboBox' backgroundColor='#038387' | ||
| links={ | ||
| [ | ||
| { | ||
| 'text': 'Overview', | ||
| 'location': 'Overview' | ||
| }, | ||
| { | ||
| 'text': 'Variants', | ||
| 'location': 'Variants' | ||
| }, | ||
| { | ||
| 'text': 'Implementation', | ||
| 'location': 'Implementation' | ||
| } | ||
| ] | ||
| } /> | ||
| <ComboBoxPage isHeaderVisible={ false } /> | ||
| </ComponentPage> | ||
| </div> | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@uifabric/fabric-website", | ||
| "comment": "Fix issues with dev.office.com header", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@uifabric/fabric-website", | ||
| "email": "[email protected]" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@uifabric/fabric-website", | ||
| "comment": "Fix issues with dev.office.com header", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@uifabric/fabric-website", | ||
| "email": "[email protected]" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './components/ComboBox/index'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './utilities/selectableOption/index'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { IIconProps } from '../../Icon'; | ||
| import { ISelectableOption } from '../../utilities/selectableOption/SelectableOption.Props'; | ||
| import { ISelectableDroppableTextProps } from '../../utilities/selectableOption/SelectableDroppableText.Props'; | ||
|
|
||
| export interface IComboBox { | ||
| /** | ||
| * Sets focus to the input in the comboBox | ||
| * @returns True if focus could be set, false if no operation was taken. | ||
| */ | ||
| focus(): boolean; | ||
| } | ||
|
|
||
| export interface IComboBoxProps extends ISelectableDroppableTextProps<IComboBox> { | ||
| /** | ||
| * Optional callback to access the IComboBox interface. Use this instead of ref for accessing | ||
| * the public methods and properties of the component. | ||
| */ | ||
| componentRef?: (component: IComboBox) => void; | ||
|
|
||
| /** | ||
| * Collection of options for this ComboBox | ||
| */ | ||
| options?: ISelectableOption[]; | ||
|
|
||
| /** | ||
| * Callback issues when either: | ||
| * 1) the selected option changes | ||
| * 2) a manually edited value is submitted. In this case there may not be a matched option if allowFreeform is also true | ||
| * (and hence only value would be true, the other parameter would be null in this case) | ||
| */ | ||
| onChanged?: (option?: ISelectableOption, index?: number, value?: string) => void; | ||
|
|
||
| /** | ||
| * Callback issued when the options should be resolved, if they have been updated or | ||
| * if they need to be passed in the first time | ||
| */ | ||
| onResolveOptions?: (options: ISelectableOption[]) => ISelectableOption[] | PromiseLike<ISelectableOption[]>; | ||
|
|
||
| /** | ||
| * Whether the ComboBox is free form, meaning that the user input is not bound to provided items. Defaults to false. | ||
| */ | ||
| allowFreeform?: boolean; | ||
|
|
||
| /** | ||
| * Whether the ComboBox auto completes. As the user is inputing text, it will be suggested potential matches from the list of items. If | ||
| * the combo box is expanded, this will also scroll to the suggested item, and give it a selected style. Defaults to false. | ||
| */ | ||
| autoComplete?: boolean; | ||
|
|
||
| /** | ||
| * Value to show in the input, does not have to map to a combobox option | ||
| */ | ||
| value?: string; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be mutually exclusive with defaultSelectedKey and selectedKey? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the scenario that requires this extra prop?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll add the mutually exclusive warning. Really, you could have a selectedKey and a default value to show if desired, but I can't think of a case where you would not want to use the selected options value if it was known
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The scenario that requires this prop is the font size combobox, it allows freeform and will allow for input like "11.5" as valid, but will not add that value as an option in the menu. Another case where is could be needed is when all the options are gotten at a later time than when the component is rendered. This allows the creator pass in the value to show without having 1) have any other info, 2) duplicate data just to make the rendering work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, that make sense. I wonder if renaming the variable can make that clearer. |
||
|
|
||
| /** | ||
| * The IconProps to use for the button aspect of the combobox | ||
| */ | ||
| buttonIconProps?: IIconProps; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be renamed to something like unconstrainedInput?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but free form text is a common term: http://www.pcmag.com/encyclopedia/term/43488/free-form-text OR http://www.dictionaryofengineering.com/definition/free-form-text.html