@linzjs/lui 16.3.0 → 16.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [16.4.0](https://github.com/linz/lui/compare/v16.3.0...v16.4.0) (2022-05-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **LuiBearingInput:** Allow validationError prop to optionally override internalError ([#659](https://github.com/linz/lui/issues/659)) ([55e016c](https://github.com/linz/lui/commit/55e016c568997b663e4d7b95708198bf648fd3bb))
|
|
7
|
+
|
|
1
8
|
# [16.3.0](https://github.com/linz/lui/compare/v16.2.9...v16.3.0) (2022-05-01)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -9,6 +9,8 @@ interface LuiBearingInputProps {
|
|
|
9
9
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
10
|
validationError?: string;
|
|
11
11
|
onValidate?: (error: string | null) => void;
|
|
12
|
+
/** If true, validationError prop takes precedence over the internalError value. */
|
|
13
|
+
preferValidationError?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const LuiBearingInput: React.FC<LuiBearingInputProps & LuiCommonInputProps>;
|
|
14
16
|
interface LuiBearingFormikInputProps {
|
package/dist/index.js
CHANGED
|
@@ -1347,7 +1347,9 @@ var LuiBearingInput = function (props) {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
var parsedBearing = parseBearing(props.value);
|
|
1349
1349
|
var internalError = validateBearing(parsedBearing);
|
|
1350
|
-
var error =
|
|
1350
|
+
var error = props.preferValidationError
|
|
1351
|
+
? props.validationError || internalError || null
|
|
1352
|
+
: internalError || props.validationError || null;
|
|
1351
1353
|
var showError = error !== null;
|
|
1352
1354
|
props.onValidate && props.onValidate(internalError);
|
|
1353
1355
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|