Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/experiments",
"comment": "Comment out unused test.",
"type": "none"
}
],
"packageName": "@uifabric/experiments",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/merge-styles",
"comment": "Add resize rule to IRawStyleBase.",
"type": "minor"
}
],
"packageName": "@uifabric/merge-styles",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "TextField: Convert to JS styling.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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';

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

// Find the TextField component
const field = ReactTestUtils.findRenderedComponentWithType(renderedForm, TextField);
expect(field.state.errorMessage).toBeTruthy();
// TODO: this test is not working as intended as even nonsense state names pass.
// commented out for now since test isn't executing when named 'xit'
// const field = ReactTestUtils.findRenderedComponentWithType(renderedForm, TextField);
Copy link
Member

Choose a reason for hiding this comment

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

ive seen these tests in form tests randomly fail. We will need to evaluate what the right pattern is here once we gain traction.

// expect(field.state.errorMessage).toBeTruthy();
expect(result).toBeFalsy();
});
});
Expand Down
50 changes: 28 additions & 22 deletions packages/merge-styles/src/IRawStyleBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ export interface IRawFontStyle {
* See CSS 3 font-size property https://www.w3.org/TR/css-fonts-3/#propdef-font-size
*/
fontSize?:
| ICSSRule
| 'xx-small'
| 'x-small'
| 'small'
| 'medium'
| 'large'
| 'x-large'
| 'xx-large'
| 'larger'
| 'smaller'
| ICSSPixelUnitRule
| ICSSPercentageRule;
| ICSSRule
| 'xx-small'
| 'x-small'
| 'small'
| 'medium'
| 'large'
| 'x-large'
| 'xx-large'
| 'larger'
| 'smaller'
| ICSSPixelUnitRule
| ICSSPercentageRule;

/**
* The font-size-adjust property adjusts the font-size of the fallback fonts defined
Expand All @@ -95,16 +95,16 @@ export interface IRawFontStyle {
* https://drafts.csswg.org/css-fonts-3/#propdef-font-stretch
*/
fontStretch?:
| ICSSRule
| 'normal'
| 'ultra-condensed'
| 'extra-condensed'
| 'condensed'
| 'semi-condensed'
| 'semi-expanded'
| 'expanded'
| 'extra-expanded'
| 'ultra-expanded';
| ICSSRule
| 'normal'
| 'ultra-condensed'
| 'extra-condensed'
| 'condensed'
| 'semi-condensed'
| 'semi-expanded'
| 'expanded'
| 'extra-expanded'
| 'ultra-expanded';

/**
* The font-style property allows normal, italic, or oblique faces to be selected.
Expand Down Expand Up @@ -1338,6 +1338,12 @@ export interface IRawStyleBase extends IRawFontStyle {
*/
regionFragment?: ICSSRule | string;

/**
* The resize CSS sets whether an element is resizable, and if so, in which direction(s).
*/

resize?: ICSSRule | 'none' | 'both' | 'horizontal' | 'vertical' | 'block' | 'inline';

/**
* The rest-after property determines how long a speech media agent should pause after
* presenting an element's main content, before presenting that element's exit cue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { BaseComponent, classNamesFunction } from '../../Utilities';
import { BaseComponent, classNamesFunction, createRef } from '../../Utilities';
import { IColorPickerProps, IColorPickerStyleProps, IColorPickerStyles } from './ColorPicker.types';
import { TextField } from '../../TextField';
import { ITextField, TextField } from '../../TextField';
import { ColorRectangle } from './ColorRectangle/ColorRectangle';
import { ColorSlider } from './ColorSlider/ColorSlider';
import {
Expand Down Expand Up @@ -30,11 +30,11 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
alphaLabel: 'Alpha'
};

private hexText: TextField;
private rText: TextField;
private gText: TextField;
private bText: TextField;
private aText: TextField;
private _hexText = createRef<ITextField>();
private _rText = createRef<ITextField>();
private _gText = createRef<ITextField>();
private _bText = createRef<ITextField>();
private _aText = createRef<ITextField>();

constructor(props: IColorPickerProps) {
super(props);
Expand Down Expand Up @@ -97,7 +97,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
<TextField
className={classNames.input}
value={color.hex}
ref={ref => (this.hexText = ref!)}
componentRef={this._hexText}
Copy link
Member

Choose a reason for hiding this comment

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

yay thank you!

onBlur={this._onHexChanged}
spellCheck={false}
ariaLabel={this.props.hexLabel}
Expand All @@ -108,7 +108,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
className={classNames.input}
onBlur={this._onRGBAChanged}
value={String(color.r)}
ref={ref => (this.rText = ref!)}
componentRef={this._rText}
spellCheck={false}
ariaLabel={this.props.redLabel}
/>
Expand All @@ -118,7 +118,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
className={classNames.input}
onBlur={this._onRGBAChanged}
value={String(color.g)}
ref={ref => (this.gText = ref!)}
componentRef={this._gText}
spellCheck={false}
ariaLabel={this.props.greenLabel}
/>
Expand All @@ -128,7 +128,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
className={classNames.input}
onBlur={this._onRGBAChanged}
value={String(color.b)}
ref={ref => (this.bText = ref!)}
componentRef={this._bText}
spellCheck={false}
ariaLabel={this.props.blueLabel}
/>
Expand All @@ -139,7 +139,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
className={classNames.input}
onBlur={this._onRGBAChanged}
value={String(color.a)}
ref={ref => (this.aText = ref!)}
componentRef={this._aText}
spellCheck={false}
ariaLabel={this.props.alphaLabel}
/>
Expand All @@ -166,16 +166,16 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
};

private _onHexChanged = (): void => {
this._updateColor(getColorFromString('#' + this.hexText.value));
this._updateColor(getColorFromString('#' + this._hexText.value));
Copy link
Member

@dzearing dzearing Jul 25, 2018

Choose a reason for hiding this comment

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

I believe value is deprecated. Use current.

(We REALLY need to enable the deprecations tslint rule.)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is all pre-existing code. The only reason this changed at all is because TextField is now in an HOC wrapper. I'd rather not make ref-related or deprecation changes to this PR as it's already pretty wide in scope.

};

private _onRGBAChanged = (): void => {
this._updateColor(
getColorFromRGBA({
r: Number(this.rText.value),
g: Number(this.gText.value),
b: Number(this.bText.value),
a: Number((this.aText && this.aText.value) || 100)
r: Number(this._rText.value),
g: Number(this._gText.value),
b: Number(this._bText.value),
a: Number((this._aText && this._aText.value) || 100)
})
);
};
Expand Down
Loading