@linzjs/lui 16.3.0 → 16.5.1-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,17 @@
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
+
1
15
  # [16.3.0](https://github.com/linz/lui/compare/v16.2.9...v16.3.0) (2022-05-01)
2
16
 
3
17
 
Binary file
@@ -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 {};
@@ -1,5 +1,4 @@
1
1
  import { ReactNode } from 'react';
2
- import '@szhsin/react-menu/dist/index.css';
3
2
  declare type LuiFilterMenuProps = {
4
3
  menuButton: (toggleMenu: () => void) => ReactNode;
5
4
  filteredItems: SelectMenuItem[];
package/dist/index.js CHANGED
@@ -655,33 +655,6 @@ var LuiControlledMenu = function (props) {
655
655
  return React__default["default"].createElement(reactMenu.ControlledMenu, __assign({ menuClassName: 'lui-menu', offsetY: 12 }, props));
656
656
  };
657
657
 
658
- function styleInject(css, ref) {
659
- if ( ref === void 0 ) ref = {};
660
- var insertAt = ref.insertAt;
661
-
662
- if (!css || typeof document === 'undefined') { return; }
663
-
664
- var head = document.head || document.getElementsByTagName('head')[0];
665
- var style = document.createElement('style');
666
- style.type = 'text/css';
667
-
668
- if (insertAt === 'top') {
669
- if (head.firstChild) {
670
- head.insertBefore(style, head.firstChild);
671
- } else {
672
- head.appendChild(style);
673
- }
674
- } else {
675
- head.appendChild(style);
676
- }
677
-
678
- if (style.styleSheet) {
679
- style.styleSheet.cssText = css;
680
- } else {
681
- style.appendChild(document.createTextNode(css));
682
- }
683
- }
684
-
685
658
  var LuiFilterMenu = function (props) {
686
659
  var _a = React.useState(''), filter = _a[0], setFilter = _a[1];
687
660
  var _b = reactMenu.useMenuState(), toggleMenu = _b.toggleMenu, menuProps = __rest(_b, ["toggleMenu"]);
@@ -782,6 +755,33 @@ function LuiFormikForm(props) {
782
755
  " "))));
783
756
  }
784
757
 
758
+ function styleInject(css, ref) {
759
+ if ( ref === void 0 ) ref = {};
760
+ var insertAt = ref.insertAt;
761
+
762
+ if (!css || typeof document === 'undefined') { return; }
763
+
764
+ var head = document.head || document.getElementsByTagName('head')[0];
765
+ var style = document.createElement('style');
766
+ style.type = 'text/css';
767
+
768
+ if (insertAt === 'top') {
769
+ if (head.firstChild) {
770
+ head.insertBefore(style, head.firstChild);
771
+ } else {
772
+ head.appendChild(style);
773
+ }
774
+ } else {
775
+ head.appendChild(style);
776
+ }
777
+
778
+ if (style.styleSheet) {
779
+ style.styleSheet.cssText = css;
780
+ } else {
781
+ style.appendChild(document.createTextNode(css));
782
+ }
783
+ }
784
+
785
785
  var css_248z$3 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n:root {\n --grey-80: #2a292c;\n --grey-60: #6b6966;\n --$gray: #989189;\n --grey-20: #beb9b4;\n --grey-10: #eaeaea;\n --grey-05: #f9f9f9;\n --teal: #00425d;\n --sea: #007198;\n --electric: #0096cc;\n --spray: #73c8e1;\n --polar: #e2f3f7;\n --sherpa: #004b50;\n --surfie: #017a76;\n --persian: #00a599;\n --downy: #73cdc8;\n --iceberg: #dcf5f0;\n --sacramento: #004e32;\n --salem: #08814d;\n --pigment: #0aa245;\n --granny: #9bd79b;\n --panache: #e9fae7;\n --brand-primary: #004b50;\n --brand-secondary: #017a76;\n --success: #0aa245;\n --success-bg: #e9fae7;\n --info: #3a7cdf;\n --info-bg: #d8e5f9;\n --warning: #ea6a2e;\n --warning-bg: #fbdfd2;\n --error: #cc0000;\n --error-focus: #5a0000;\n --error-bg: #f5cccc;\n --visited: #00425d;\n --green-hover: #107c3a;\n --color-green-active: #094A22;\n --green-btn: #0aa245;\n --txt-link: #0096cc;\n --color-primary-hover-btn: #005678;\n --color-selection: #c7e9f3;\n --heading-color: #017a76;\n --heading-color--secondary: #2a292c;\n --base-type-color: #2a292c;\n --base-icon-color: #007198;\n --disabled-color: #989189;\n --disabled-color-dark: #6b6966;\n --linz-color-primary: #023d48;\n --linz-color-primary-hover: #01818a;\n --linz-color-tertiary: #e1e44a;\n --linz-color-tertiary-hover: #cdcf59;\n --color-test-pink: #f09;\n --linz-linear-gradient-blue: linear-gradient(70deg, #00425d 12%, #007198 100%);\n --linz-linear-gradient-teal: linear-gradient(270deg, #00a599 1%, #73cdc8 100%);\n}\n\n:export {\n charcoal: #2a292c;\n fuscous: #6b6966;\n gray: #989189;\n silver: #beb9b4;\n lily: #eaeaea;\n hint: #f9f9f9;\n snow: #ffffff;\n white: #ffffff;\n teal: #00425d;\n sea: #007198;\n electric: #0096cc;\n spray: #73c8e1;\n polar: #e2f3f7;\n sherpa: #004b50;\n surfie: #017a76;\n persian: #00a599;\n downy: #73cdc8;\n iceberg: #dcf5f0;\n sacramento: #004e32;\n salem: #08814d;\n pigment: #0aa245;\n granny: #9bd79b;\n panache: #e9fae7;\n brand-primary: #004b50;\n brand-secondary: #017a76;\n error: #cc0000;\n error-bg: #f5cccc;\n error-focus: #5a0000;\n warning: #ea6a2e;\n warning-bg: #fbdfd2;\n warning-focus: #b33a01;\n success: #0aa245;\n success-bg: #e9fae7;\n info: #3a7cdf;\n info-bg: #d8e5f9;\n visited: #00425d;\n green-hover: #107c3a;\n green-active: #094A22;\n green-btn: #0aa245;\n txt-link: #0096cc;\n primary-hover-btn: #005678;\n selection: #c7e9f3;\n heading-color: #017a76;\n heading-color--secondary: #2a292c;\n base-type-color: #2a292c;\n input-text: #2a292c;\n input-placeholder: #6b6966;\n input-placeholder-when-disabled: #989189;\n base-icon-color: #007198;\n disabled-color: #989189;\n disabled-color-dark: #6b6966;\n linz-color-primary: #023d48;\n linz-color-primary-hover: #01818a;\n linz-color-tertiary: #e1e44a;\n linz-color-tertiary-hover: #cdcf59;\n color-test-pink: #f09;\n linz-linear-gradient-blue: linear-gradient(70deg, #00425d 12%, #007198 100%);\n linz-linear-gradient-teal: linear-gradient(270deg, #00a599 1%, #73cdc8 100%);\n}\n\n.LuiError {\n font-family: \"Open Sans\", system-ui, sans-serif;\n font-style: normal;\n font-weight: 600;\n margin-bottom: 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5rem;\n color: #2a292c;\n}\n.LuiError-errorIcon {\n vertical-align: middle;\n display: inline-block;\n}\n.LuiError-errorText {\n margin-left: 0.5rem;\n}";
786
786
  styleInject(css_248z$3);
787
787
 
@@ -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 = internalError || props.validationError || null;
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,
@@ -1371,7 +1373,7 @@ var LuiBearingFormikInput = function (props) {
1371
1373
  }
1372
1374
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
1373
1375
  React__default["default"].createElement(formik.Field, { name: props.name, validate: validateBearing }, function (renderProps) {
1374
- 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 })));
1375
1377
  })));
1376
1378
  };
1377
1379