Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
251e839
TextField: Implemented masking
lambertwang-zz Jan 24, 2018
71cea3f
Changed example
lambertwang-zz Jan 24, 2018
4bf0059
Change file
lambertwang-zz Jan 24, 2018
ab1c2c7
Moved functions to util. Added tests
lambertwang-zz Jan 24, 2018
cfd5e0a
Added selection deletion tests
lambertwang-zz Jan 24, 2018
c61c77c
Refactored textfield into separate components
lambertwang-zz Jan 26, 2018
b932927
Merge branch 'master' of github.com:OfficeDev/office-ui-fabric-react …
lambertwang-zz Jan 26, 2018
e2462f0
Merge branch 'master' of github.com:OfficeDev/office-ui-fabric-react …
lambertwang-zz Jan 30, 2018
257ea8a
Merge branch 'master' of github.com:lambertwang/office-ui-fabric-reac…
lambertwang-zz Feb 21, 2018
86e3260
Deleted base and default textfields
lambertwang-zz Feb 21, 2018
76c3d1b
Revert additional changes
lambertwang-zz Feb 21, 2018
322141d
Fixed refs
lambertwang-zz Feb 21, 2018
7ae09a0
Merge branch 'master' of https://github.com/officedev/office-ui-fabri…
dzearing Mar 10, 2018
794d948
Update magellan-textFieldMasking_2018-01-24-01-35.json
dzearing Mar 13, 2018
2ac854f
Merge branch 'master' of github.com:lambertwang/office-ui-fabric-reac…
lambertwang-zz Mar 26, 2018
17cff11
Merge branch 'magellan/textFieldMasking' of github.com:lambertwang/of…
lambertwang-zz Mar 26, 2018
b66bdb9
Added enzyme and snapshot tests for the component
lambertwang-zz Mar 27, 2018
3ea706d
Fixed typo
lambertwang-zz Mar 27, 2018
218637f
Added character overflow test
lambertwang-zz Mar 27, 2018
fc57283
Undo changes to textfield
lambertwang-zz Mar 27, 2018
ed138ae
Merge branch 'master' of github.com:OfficeDev/office-ui-fabric-react …
lambertwang-zz Mar 27, 2018
f47a481
Fixed linting error
lambertwang-zz Mar 27, 2018
1cfbdf7
Update TextField.Basic.Example.tsx
lambertwang Mar 28, 2018
7060aee
Added comments to inputMask.ts
lambertwang Mar 28, 2018
5eb7615
Removed trailing whitespace
lambertwang Mar 28, 2018
7776a30
Merge branch 'master' of github.com:OfficeDev/office-ui-fabric-react …
lambertwang-zz Apr 18, 2018
ade5b57
Fix build errors for Lambert
cliffkoh Apr 19, 2018
41353cd
Update jest snapshot
cliffkoh Apr 19, 2018
ef1e721
Merge pull request #1 from cliffkoh/lambertwang-magellan/textFieldMas…
lambertwang Apr 19, 2018
ed03b12
Merge branch 'master' of github.com:OfficeDev/office-ui-fabric-react …
lambertwang-zz Apr 19, 2018
5087641
Fix build errors
lambertwang-zz Apr 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/todo-app/src/components/TodoForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { autobind, BaseComponent, IBaseProps } from 'office-ui-fabric-react/lib/Utilities';
import { PrimaryButton } from 'office-ui-fabric-react/lib/Button';
import { TextField, ITextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField, ITextField } from 'office-ui-fabric-react/lib/TextField';
import * as stylesImport from './Todo.scss';
const styles: any = stylesImport;
import strings from './../strings';
Expand Down Expand Up @@ -59,7 +59,7 @@ export default class TodoForm extends BaseComponent<ITodoFormProps, ITodoFormSta
public render(): JSX.Element {
return (
<form className={ styles.todoForm } onSubmit={ this._onSubmit }>
<TextField
<DefaultTextField
className={ styles.textField }
value={ this.state.inputValue }
componentRef={ this._resolveRef('_textField') }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "[TextField] Inmplemented Input Masking",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "law@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IFormProps } from '../../Form.types';
import { DEFAULT_DEBOUNCE } from '../../FormBaseInput';
import { FormTextInput } from './FormTextInput';
import { IFormTextInputProps } from './FormTextInput.types';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { BaseTextField } from 'office-ui-fabric-react/lib/TextField';

// Utilities
import { Validators } from '../../validators/Validators';
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('FormTextInput Unit Tests', () => {
ReactTestUtils.Simulate.submit(form);

// Find the TextField component
let field = ReactTestUtils.findRenderedComponentWithType(renderedForm, TextField);
let field = ReactTestUtils.findRenderedComponentWithType(renderedForm, BaseTextField);
expect(field.state.errorMessage).toBeTruthy();
expect(result).toBeFalsy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import { IFormTextInputProps } from './FormTextInput.types';
import { FormBaseInput, IFormBaseInputState } from '../../FormBaseInput';
import { IFormContext } from '../../Form';
import { TextField, ITextFieldProps } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField, ITextFieldProps } from 'office-ui-fabric-react/lib/TextField';

// Utilities
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
Expand Down Expand Up @@ -37,7 +37,7 @@ export class FormTextInput extends FormBaseInput<string, IFormTextInputProps, IF
*/
public render(): JSX.Element {
return (
<TextField
<DefaultTextField
{...this.props.textFieldProps}
key={ this.props.inputKey }
value={ this.state.currentValue }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { LayoutGroup } from '../LayoutGroup';
import { PrimaryButton } from 'office-ui-fabric-react/lib/Button';
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { ChoiceGroup } from 'office-ui-fabric-react/lib/ChoiceGroup';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { Label } from 'office-ui-fabric-react/lib/Label';
Expand Down Expand Up @@ -37,8 +37,15 @@ export class LayoutGroupBasicExample extends React.Component<{}, {}> {
}
/>
<LayoutGroup layoutGap={ 20 } direction='horizontal' justify='fill'>
<TextField label='TextField with a placeholder' placeholder='Now I am a Placeholder' ariaLabel='Please enter text here' />
<TextField label='TextField with an icon' iconProps={ { iconName: 'Calendar' } } />
<DefaultTextField
label='TextField with a placeholder'
placeholder='Now I am a Placeholder'
ariaLabel='Please enter text here'
/>
<DefaultTextField
label='TextField with an icon'
iconProps={ { iconName: 'Calendar' } }
/>
</LayoutGroup>

<LayoutGroup layoutGap={ 20 } direction='horizontal' justify='fill'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
css
} from '../../Utilities';
import { IColorPickerProps } from './ColorPicker.types';
import { TextField } from '../../TextField';
import { DefaultTextField, ITextField } from '../../TextField';
import { ColorRectangle } from './ColorRectangle';
import { ColorSlider } from './ColorSlider';
import {
Expand Down Expand Up @@ -35,11 +35,11 @@ export class ColorPicker extends BaseComponent<IColorPickerProps, IColorPickerSt
alphaLabel: 'Alpha'
};

private hexText: TextField;
private rText: TextField;
private gText: TextField;
private bText: TextField;
private aText: TextField;
private hexText: ITextField;
private rText: ITextField;
private gText: ITextField;
private bText: ITextField;
private aText: ITextField;

constructor(props: IColorPickerProps) {
super(props);
Expand Down Expand Up @@ -92,48 +92,58 @@ export class ColorPicker extends BaseComponent<IColorPickerProps, IColorPickerSt
<tbody>
<tr>
<td>
<TextField
<DefaultTextField

@dzearing dzearing Feb 7, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you renaming everything that was TextField to DefaultTextField? That feels counterintuitive.

className={ css('ms-ColorPicker-input', styles.input) }
value={ color.hex }
ref={ (ref) => this.hexText = ref! }
/* tslint:disable:jsx-no-lambda*/
componentRef={ (ref) => this.hexText = ref! }
/* tslint:enable:jsx-no-lambda*/
onBlur={ this._onHexChanged }
spellCheck={ false }
/>
</td>
<td style={ { width: '18%' } }>
<TextField
<DefaultTextField
className={ css('ms-ColorPicker-input', styles.input) }
onBlur={ this._onRGBAChanged }
value={ String(color.r) }
ref={ (ref) => this.rText = ref! }
/* tslint:disable:jsx-no-lambda*/
componentRef={ (ref) => this.rText = ref! }
/* tslint:enable:jsx-no-lambda*/
spellCheck={ false }
/>
</td>
<td style={ { width: '18%' } }>
<TextField
<DefaultTextField
className={ css('ms-ColorPicker-input', styles.input) }
onBlur={ this._onRGBAChanged }
value={ String(color.g) }
ref={ (ref) => this.gText = ref! }
/* tslint:disable:jsx-no-lambda*/
componentRef={ (ref) => this.gText = ref! }
/* tslint:enable:jsx-no-lambda*/
spellCheck={ false }
/>
</td>
<td style={ { width: '18%' } }>
<TextField
<DefaultTextField
className={ css('ms-ColorPicker-input', styles.input) }
onBlur={ this._onRGBAChanged }
value={ String(color.b) }
ref={ (ref) => this.bText = ref! }
/* tslint:disable:jsx-no-lambda*/
componentRef={ (ref) => this.bText = ref! }
/* tslint:enable:jsx-no-lambda*/
spellCheck={ false }
/>
</td>
{ !this.props.alphaSliderHidden && (
<td style={ { width: '18%' } }>
<TextField
<DefaultTextField
className={ css('ms-ColorPicker-input', styles.input) }
onBlur={ this._onRGBAChanged }
value={ String(color.a) }
ref={ (ref) => this.aText = ref! }
/* tslint:disable:jsx-no-lambda*/
componentRef={ (ref) => this.aText = ref! }
/* tslint:enable:jsx-no-lambda*/
spellCheck={ false }
/>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { DirectionalHint, ContextualMenuItemType } from 'office-ui-fabric-react/lib/ContextualMenu';
import { Dropdown, IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { autobind, getRTL } from 'office-ui-fabric-react/lib/Utilities';
import './ContextualMenuExample.scss';
import * as exampleStylesImport from '../../../common/_exampleStyles.scss';
Expand Down Expand Up @@ -39,7 +39,6 @@ export class ContextualMenuDirectionalExample extends React.Component<{}, IConte
public refs: {
[key: string]: React.ReactInstance;
menuButton: HTMLElement;
gapSize: TextField;
};

public constructor(props: {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { FirstWeekOfYear } from '../../utilities/dateValues/DateValues';
import { Callout } from '../../Callout';
import { DirectionalHint } from '../../common/DirectionalHint';
import { TextField } from '../../TextField';
import { DefaultTextField, ITextField } from '../../TextField';
import {
autobind,
BaseComponent,
Expand Down Expand Up @@ -122,7 +122,7 @@ export class DatePicker extends BaseComponent<IDatePickerProps, IDatePickerState
private _root: HTMLElement;
private _calendar: Calendar;
private _datepicker: HTMLDivElement;
private _textField: TextField;
private _textField: ITextField;
private _preventFocusOpeningPicker: boolean;
private _focusOnSelectedDateOnUpdate: boolean;

Expand Down Expand Up @@ -190,7 +190,7 @@ export class DatePicker extends BaseComponent<IDatePickerProps, IDatePickerState
return (
<div className={ css('ms-DatePicker', styles.root, className) } ref={ this._resolveRef('_root') }>
<div ref={ this._resolveRef('_datepicker') }>
<TextField
<DefaultTextField
className={ styles.textField }
ariaLabel={ ariaLabel }
aria-haspopup='true'
Expand All @@ -217,7 +217,7 @@ export class DatePicker extends BaseComponent<IDatePickerProps, IDatePickerState
} }
readOnly={ !allowTextInput }
value={ formattedDate }
ref={ this._resolveRef('_textField') }
componentRef={ this._resolveRef('_textField') }
role={ allowTextInput ? 'combobox' : 'menu' }
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { CommandBar } from 'office-ui-fabric-react/lib/CommandBar';
import {
IContextualMenuProps,
Expand Down Expand Up @@ -119,7 +119,7 @@ export class DetailsListAdvancedExample extends React.Component<{}, IDetailsList

{
(isGrouped) ?
<TextField label='Group Item Limit' onChanged={ this._onItemLimitChanged } /> :
<DefaultTextField label='Group Item Limit' onChanged={ this._onItemLimitChanged } /> :
(null)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* tslint:disable:no-unused-variable */
import * as React from 'react';
/* tslint:enable:no-unused-variable */
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import {
DetailsList,
DetailsListLayoutMode,
Expand Down Expand Up @@ -70,7 +70,7 @@ export class DetailsListBasicExample extends React.Component<{}, {
return (
<div>
<div>{ selectionDetails }</div>
<TextField
<DefaultTextField
label='Filter by name:'
onChanged={ this._onChanged }
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* tslint:disable:no-unused-variable */
import * as React from 'react';
/* tslint:enable:no-unused-variable */
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change all of the examples to use DefaultTextField instead of TextField? That doesn't seem right

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason all of the Button examples were changed to use DefaultButton instead of Button.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about compat, when I use TextField today, will I have to change to DefaultTextfield with this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just as with button, the TextField component still exists, it will just warn you for using a deprecated component.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lambertwang I don't really think that's a good idea.

import {
DetailsList,
DetailsListLayoutMode,
Expand Down Expand Up @@ -71,7 +71,7 @@ export class DetailsListCompactExample extends React.Component<{}, {
return (
<div>
<div>{ selectionDetails }</div>
<TextField
<DefaultTextField
label='Filter by name:'
onChanged={ this._onChanged }
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* tslint:disable:no-unused-variable */
import * as React from 'react';
/* tslint:enable:no-unused-variable */
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { Toggle } from 'office-ui-fabric-react/lib/Toggle';
import {
DetailsList,
Expand Down Expand Up @@ -222,7 +222,7 @@ export class DetailsListDocumentsExample extends React.Component<any, IDetailsLi
offText='Normal'
/>
<div>{ selectionDetails }</div>
<TextField
<DefaultTextField
label='Filter by name:'
onChanged={ this._onChangeText }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { autobind } from '../../../Utilities';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { Toggle, IToggle } from 'office-ui-fabric-react/lib/Toggle';
import './FocusTrapZone.Box.Example.scss';

Expand Down Expand Up @@ -60,7 +60,7 @@ export default class BoxNoClickExample extends React.Component<React.HTMLAttribu

return (
<div className='ms-FocusTrapZoneBoxExample'>
<TextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<DefaultTextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<Link href='' className='' >Hyperlink inside FocusTrapZone</Link><br /><br />
<Toggle
componentRef={ this._setRef }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { autobind } from '../../../Utilities';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { Toggle, IToggle } from 'office-ui-fabric-react/lib/Toggle';
import './FocusTrapZone.Box.Example.scss';

Expand Down Expand Up @@ -60,7 +60,7 @@ export default class BoxExample extends React.Component<React.HTMLAttributes<HTM

return (
<div className='ms-FocusTrapZoneBoxExample'>
<TextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<DefaultTextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<Link href='' className='' >Hyperlink inside FocusTrapZone</Link><br /><br />
<Toggle
componentRef={ this._setRef }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { autobind } from '../../../Utilities';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import { Toggle, IToggle } from 'office-ui-fabric-react/lib/Toggle';

export interface IBoxExampleExampleState {
Expand Down Expand Up @@ -58,7 +58,7 @@ export default class BoxExample extends React.Component<React.HTMLAttributes<HTM

return (
<div className='ms-FocusTrapZoneBoxExample'>
<TextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<DefaultTextField label='Default TextField' placeholder='Input inside Focus Trap Zone' className='' />
<Link href='' className='' >Hyperlink inside FocusTrapZone</Link><br /><br />
<div className='shouldFocus input'>
<Toggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';

import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZone';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DefaultTextField } from 'office-ui-fabric-react/lib/TextField';
import './FocusZone.Disabled.Example.scss';

export const FocusZoneDisabledExample = () => (
Expand All @@ -14,7 +14,7 @@ export const FocusZoneDisabledExample = () => (
<span>Enabled FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value='FocusZone TextField' className='ms-FocusZoneDisabledExample-textField' />
<DefaultTextField value='FocusZone TextField' className='ms-FocusZoneDisabledExample-textField' />
<DefaultButton>Button 3</DefaultButton>
</FocusZone>
</div>
Expand All @@ -29,7 +29,7 @@ export const FocusZoneDisabledExample = () => (
</FocusZone>
</div>
<div className='ms-Row'>
<TextField value='Tabbable Element 2' />
<DefaultTextField value='Tabbable Element 2' />
</div>
</div>
);
Loading