Skip to content

Commit

Permalink
Changed inline errors trigger from errorMessage to error (closes #267).
Browse files Browse the repository at this point in the history
  • Loading branch information
Gervwyk authored and radekmie committed Apr 12, 2017
1 parent 32ad02a commit d71d835
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 23 deletions.
3 changes: 2 additions & 1 deletion packages/uniforms-antd/src/ListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ListItemField from './ListItemField';

const List = ({
children,
error,
errorMessage,
info,
initialCount,
Expand Down Expand Up @@ -38,7 +39,7 @@ const List = ({
</div>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div>
{errorMessage}
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-antd/src/NestField.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import AutoField from './AutoField';

const Nest = ({
children,
error,
errorMessage,
fields,
itemProps,
Expand All @@ -21,7 +22,7 @@ const Nest = ({
</label>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div>
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-antd/src/wrapField.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function wrapField ({
<Form.Item
colon={colon}
hasFeedback
help={showInlineError && errorMessage}
help={showInlineError && error && errorMessage}
htmlFor={id}
label={labelNode}
labelCol={labelCol}
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap3/src/ListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const List = ({

<ListAddField name={`${name}.$`} initialCount={initialCount} addIcon={addIcon} />

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<span className="help-block">
{errorMessage}
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap3/src/NestField.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Nest = ({
</label>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<span className="help-block">
{errorMessage}
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap3/src/wrapField.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function wrapField ({
}, children) {
const hasWrap = !!(grid || wrapClassName);

const blockError = !!(errorMessage && showInlineError) && (
const blockError = !!(error && showInlineError) && (
<span className="help-block">
{errorMessage}
</span>
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-bootstrap4/src/ListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const List = ({
addIcon,
children,
className,
error,
errorMessage,
initialCount,
itemProps,
Expand All @@ -32,7 +33,7 @@ const List = ({

<ListAddField name={`${name}.$`} initialCount={initialCount} addIcon={addIcon} />

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<span className="text-danger">
{errorMessage}
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap4/src/NestField.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Nest = ({
</label>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<span className="text-danger">
{errorMessage}
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-bootstrap4/src/wrapField.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function wrapField ({
}, children) {
const hasWrap = !!(grid || wrapClassName);

const blockError = !!(errorMessage && showInlineError) && (
const blockError = !!(error && showInlineError) && (
<span className="form-text text-danger">
{errorMessage}
</span>
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-material/src/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Date_ extends Component {
cancelLabel,
disableYearSelection,
disabled,
error,
errorMessage,
firstDayOfWeek,
formatDate,
Expand All @@ -71,7 +72,7 @@ class Date_ extends Component {
<div>
<TextField
disabled={disabled}
errorText={showInlineError ? errorMessage : undefined}
errorText={error && showInlineError ? errorMessage : undefined}
floatingLabelText={label}
hintText={placeholder}
id={id}
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-material/src/LongTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import filterDOMProps from 'uniforms/filterDOMProps';
const LongText = ({
disabled,
id,
error,
errorMessage,
inputRef,
label,
Expand All @@ -17,7 +18,7 @@ const LongText = ({
}) =>
<TextField
disabled={disabled}
errorText={errorMessage}
errorText={error && showInlineError ? errorMessage : undefined}
floatingLabelText={label}
id={id}
multiLine
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-material/src/NumField.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const noneIfNaN = x => isNaN(x) ? undefined : x;
const Num_ = ({
decimal,
disabled,
error,
errorMessage,
id,
inputRef,
Expand All @@ -24,7 +25,7 @@ const Num_ = ({
}) =>
<TextField
disabled={disabled}
errorText={showInlineError ? errorMessage : undefined}
errorText={error && showInlineError ? errorMessage : undefined}
floatingLabelText={label}
hintText={placeholder}
id={id}
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-material/src/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const renderCheckboxes = ({
const renderSelect = ({
allowedValues,
disabled,
error,
errorMessage,
fieldType,
fullWidth = true,
Expand All @@ -77,7 +78,7 @@ const renderSelect = ({
}) =>
<SelectField
disabled={disabled}
errorText={errorMessage}
errorText={error && showInlineError ? errorMessage : undefined}
floatingLabelText={label}
fullWidth={fullWidth}
hintText={placeholder}
Expand Down
3 changes: 2 additions & 1 deletion packages/uniforms-material/src/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import filterDOMProps from 'uniforms/filterDOMProps';

const Text = ({
disabled,
error,
errorMessage,
id,
inputRef,
Expand All @@ -19,7 +20,7 @@ const Text = ({
}) =>
<TextField
disabled={disabled}
errorText={showInlineError ? errorMessage : undefined}
errorText={error && showInlineError ? errorMessage : undefined}
floatingLabelText={label}
hintText={placeholder}
id={id}
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/BoolField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Bool = ({
</label>
</div>

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Date_ = ({
)}
</div>

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/ListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const List = ({
<div className="ui fitted hidden clearing horizontal divider" />
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/LongTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const LongText = ({
value={value}
/>

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/NestField.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Nest = ({
</div>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/NumField.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Num_ = ({
)}
</div>

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/RadioField.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Radio = ({
</div>
)}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const Select = ({
}
{/* eslint-enable */}

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/uniforms-semantic/src/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Text = ({
)}
</div>

{!!(errorMessage && showInlineError) && (
{!!(error && showInlineError) && (
<div className="ui red basic pointing label">
{errorMessage}
</div>
Expand Down

0 comments on commit d71d835

Please sign in to comment.