@linzjs/lui 16.2.9 → 16.5.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 +21 -0
- package/dist/components/LuiBearingInput/LuiBearingInput.d.ts +4 -0
- package/dist/components/LuiFormElements/LuiCheckboxInput/LuiCheckboxInput.d.ts +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +5 -4
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [16.5.0](https://github.com/linz/lui/compare/v16.4.0...v16.5.0) (2022-05-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **LuiBearingFormikInput:** Add preferValidationError prop ([#660](https://github.com/linz/lui/issues/660)) ([657dc23](https://github.com/linz/lui/commit/657dc23807aca7a2cd7e1c1d6e3788b40de1af08))
|
|
7
|
+
|
|
8
|
+
# [16.4.0](https://github.com/linz/lui/compare/v16.3.0...v16.4.0) (2022-05-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **LuiBearingInput:** Allow validationError prop to optionally override internalError ([#659](https://github.com/linz/lui/issues/659)) ([55e016c](https://github.com/linz/lui/commit/55e016c568997b663e4d7b95708198bf648fd3bb))
|
|
14
|
+
|
|
15
|
+
# [16.3.0](https://github.com/linz/lui/compare/v16.2.9...v16.3.0) (2022-05-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **LuiCheckboxInput:** Adds indeterminate state for checkbox ([#656](https://github.com/linz/lui/issues/656)) ([e55d806](https://github.com/linz/lui/commit/e55d8061e2d9e04fdde1c80fadca3c77bf9d7436))
|
|
21
|
+
|
|
1
22
|
## [16.2.9](https://github.com/linz/lui/compare/v16.2.8...v16.2.9) (2022-04-25)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -9,11 +9,15 @@ 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 {
|
|
15
17
|
name: string;
|
|
16
18
|
label: string;
|
|
19
|
+
/** If true, validationError prop takes precedence over the LuiBearingInput internalError value. */
|
|
20
|
+
preferValidationError?: boolean;
|
|
17
21
|
}
|
|
18
22
|
export declare const LuiBearingFormikInput: React.FC<LuiBearingFormikInputProps & LuiCommonInputProps>;
|
|
19
23
|
export {};
|
|
@@ -5,6 +5,7 @@ export interface LuiCheckboxProps {
|
|
|
5
5
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
6
|
isChecked: boolean;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
|
+
isIndeterminate?: boolean;
|
|
8
9
|
error?: string;
|
|
9
10
|
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
10
11
|
className?: string;
|
package/dist/index.js
CHANGED
|
@@ -900,8 +900,7 @@ var LuiCheckboxInput = function (props) {
|
|
|
900
900
|
React__default["default"].createElement("input", __assign({ className: clsx('LuiCheckboxInput-input'), id: id, type: "checkbox", value: props.value, onChange: props.onChange, checked: props.isChecked, disabled: props.isDisabled }, props.inputProps)),
|
|
901
901
|
React__default["default"].createElement("span", { className: "LuiCheckboxInput-label" },
|
|
902
902
|
props.label,
|
|
903
|
-
' ',
|
|
904
|
-
React__default["default"].createElement(LuiIcon, { name: "ic_check", size: "md", alt: "Check", className: "LuiCheckboxInput-labelCheck" }))),
|
|
903
|
+
React__default["default"].createElement(LuiIcon, { name: props.isIndeterminate ? 'ic_zoom_out' : 'ic_check', size: "md", alt: props.isIndeterminate ? 'Indeterminate Check' : 'Check', className: "LuiCheckboxInput-labelCheck" }))),
|
|
905
904
|
props.error && (React__default["default"].createElement(LuiError, { className: "LuiCheckboxInput", error: props.error }))));
|
|
906
905
|
};
|
|
907
906
|
|
|
@@ -1348,7 +1347,9 @@ var LuiBearingInput = function (props) {
|
|
|
1348
1347
|
}
|
|
1349
1348
|
var parsedBearing = parseBearing(props.value);
|
|
1350
1349
|
var internalError = validateBearing(parsedBearing);
|
|
1351
|
-
var error =
|
|
1350
|
+
var error = props.preferValidationError
|
|
1351
|
+
? props.validationError || internalError || null
|
|
1352
|
+
: internalError || props.validationError || null;
|
|
1352
1353
|
var showError = error !== null;
|
|
1353
1354
|
props.onValidate && props.onValidate(internalError);
|
|
1354
1355
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
@@ -1372,7 +1373,7 @@ var LuiBearingFormikInput = function (props) {
|
|
|
1372
1373
|
}
|
|
1373
1374
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1374
1375
|
React__default["default"].createElement(formik.Field, { name: props.name, validate: validateBearing }, function (renderProps) {
|
|
1375
|
-
return (React__default["default"].createElement(LuiBearingInput, __assign({ name: props.name }, renderProps.field, { validationError: formik.getIn(ctx === null || ctx === void 0 ? void 0 : ctx.errors, props.name), required: true, onValidate: onValidate, inputProps: props.inputProps })));
|
|
1376
|
+
return (React__default["default"].createElement(LuiBearingInput, __assign({ name: props.name }, renderProps.field, { validationError: formik.getIn(ctx === null || ctx === void 0 ? void 0 : ctx.errors, props.name), required: true, onValidate: onValidate, inputProps: props.inputProps, preferValidationError: props.preferValidationError })));
|
|
1376
1377
|
})));
|
|
1377
1378
|
};
|
|
1378
1379
|
|