@opengeoweb/form-fields 4.1.0 → 4.2.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/index.esm.js CHANGED
@@ -375,9 +375,7 @@ var ReactHookFormRadioGroup = function ReactHookFormRadioGroup(_a) {
375
375
  _a$disabled = _a.disabled,
376
376
  disabled = _a$disabled === void 0 ? false : _a$disabled,
377
377
  _a$onChange = _a.onChange,
378
- _onChange = _a$onChange === void 0 ? function () {
379
- return null;
380
- } : _a$onChange,
378
+ _onChange = _a$onChange === void 0 ? function () {} : _a$onChange,
381
379
  otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "disabled", "onChange"]);
382
380
 
383
381
  var labelId = "".concat(name, "-label");
@@ -422,11 +420,6 @@ var ReactHookFormRadioGroup = function ReactHookFormRadioGroup(_a) {
422
420
  }));
423
421
  };
424
422
 
425
- var styles = {
426
- textEditor: {
427
- backgroundColor: 'rgba(0, 117, 169, 0.05)'
428
- }
429
- };
430
423
  var convertTextInputValue = function convertTextInputValue(value, inCapitals) {
431
424
  return inCapitals ? value.toUpperCase() : value;
432
425
  };
@@ -446,9 +439,7 @@ var ReactHookFormTextField = function ReactHookFormTextField(_a) {
446
439
  className = _a.className,
447
440
  sx = _a.sx,
448
441
  _a$onChange = _a.onChange,
449
- _onChange = _a$onChange === void 0 ? function () {
450
- return null;
451
- } : _a$onChange,
442
+ _onChange = _a$onChange === void 0 ? function () {} : _a$onChange,
452
443
  otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "upperCase", "helperText", "className", "sx", "onChange"]);
453
444
 
454
445
  var inputRef = React.useRef(null);
@@ -467,7 +458,6 @@ var ReactHookFormTextField = function ReactHookFormTextField(_a) {
467
458
  render: function render(_props) {
468
459
  return /*#__PURE__*/React.createElement(TextField, Object.assign({
469
460
  label: label,
470
- style: otherProps.multiline ? styles.textEditor : {},
471
461
  error: !!errors,
472
462
  helperText: helperText,
473
463
  value: _props.value,
@@ -581,9 +571,7 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_a) {
581
571
  className = _a.className,
582
572
  sx = _a.sx,
583
573
  _a$onChange = _a.onChange,
584
- _onChange = _a$onChange === void 0 ? function () {
585
- return null;
586
- } : _a$onChange,
574
+ _onChange = _a$onChange === void 0 ? function () {} : _a$onChange,
587
575
  otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "inputMode", "helperText", "className", "sx", "onChange"]);
588
576
 
589
577
  var inputRef = React.useRef(null);
@@ -672,9 +660,7 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
672
660
  _a$helperText = _a.helperText,
673
661
  helperText = _a$helperText === void 0 ? '' : _a$helperText,
674
662
  _a$onChange = _a.onChange,
675
- _onChange = _a$onChange === void 0 ? function () {
676
- return null;
677
- } : _a$onChange,
663
+ _onChange = _a$onChange === void 0 ? function () {} : _a$onChange,
678
664
  className = _a.className,
679
665
  sx = _a.sx,
680
666
  otherProps = __rest(_a, ["name", "rules", "disabled", "label", "format", "openTo", "defaultNullValue", "helperText", "onChange", "className", "sx"]);
package/index.umd.js CHANGED
@@ -442,9 +442,7 @@
442
442
  _c = _a.disabled,
443
443
  disabled = _c === void 0 ? false : _c,
444
444
  _d = _a.onChange,
445
- _onChange = _d === void 0 ? function () {
446
- return null;
447
- } : _d,
445
+ _onChange = _d === void 0 ? function () {} : _d,
448
446
  otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "disabled", "onChange"]);
449
447
 
450
448
  var labelId = name + "-label";
@@ -489,11 +487,6 @@
489
487
  }));
490
488
  };
491
489
 
492
- var styles = {
493
- textEditor: {
494
- backgroundColor: 'rgba(0, 117, 169, 0.05)'
495
- }
496
- };
497
490
  var convertTextInputValue = function convertTextInputValue(value, inCapitals) {
498
491
  return inCapitals ? value.toUpperCase() : value;
499
492
  };
@@ -513,9 +506,7 @@
513
506
  className = _a.className,
514
507
  sx = _a.sx,
515
508
  _f = _a.onChange,
516
- _onChange = _f === void 0 ? function () {
517
- return null;
518
- } : _f,
509
+ _onChange = _f === void 0 ? function () {} : _f,
519
510
  otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "upperCase", "helperText", "className", "sx", "onChange"]);
520
511
 
521
512
  var inputRef = React__namespace.useRef(null);
@@ -534,7 +525,6 @@
534
525
  render: function render(_props) {
535
526
  return /*#__PURE__*/React__namespace.createElement(material.TextField, __assign({
536
527
  label: label,
537
- style: otherProps.multiline ? styles.textEditor : {},
538
528
  error: !!errors,
539
529
  helperText: helperText,
540
530
  value: _props.value,
@@ -619,9 +609,7 @@
619
609
  className = _a.className,
620
610
  sx = _a.sx,
621
611
  _f = _a.onChange,
622
- _onChange = _f === void 0 ? function () {
623
- return null;
624
- } : _f,
612
+ _onChange = _f === void 0 ? function () {} : _f,
625
613
  otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "inputMode", "helperText", "className", "sx", "onChange"]);
626
614
 
627
615
  var inputRef = React__namespace.useRef(null);
@@ -712,9 +700,7 @@
712
700
  _f = _a.helperText,
713
701
  helperText = _f === void 0 ? '' : _f,
714
702
  _g = _a.onChange,
715
- _onChange = _g === void 0 ? function () {
716
- return null;
717
- } : _g,
703
+ _onChange = _g === void 0 ? function () {} : _g,
718
704
  className = _a.className,
719
705
  sx = _a.sx,
720
706
  otherProps = __rest(_a, ["name", "rules", "disabled", "label", "format", "openTo", "defaultNullValue", "helperText", "onChange", "className", "sx"]);
@@ -6,7 +6,7 @@ import { Rules } from './types';
6
6
  export declare const getFormattedValue: (value: Moment | string) => string | Moment;
7
7
  declare type ReactHookKeyboardDateTimePickerProps = Partial<DateTimePickerProps> & {
8
8
  rules: Rules;
9
- defaultNullValue?: string;
9
+ defaultNullValue?: string | null;
10
10
  value?: string;
11
11
  onChange?: (value: any) => void;
12
12
  name: string;
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { RegisterOptions } from 'react-hook-form';
2
3
  interface ReactHookFormHiddenInputProps {
3
4
  name: string;
4
5
  defaultValue?: unknown;
5
- rules?: unknown;
6
+ rules?: RegisterOptions;
6
7
  }
7
8
  declare const ReactHookFormHiddenInput: React.FC<ReactHookFormHiddenInputProps>;
8
9
  export default ReactHookFormHiddenInput;
@@ -3,7 +3,7 @@ import { TextFieldProps } from '@mui/material';
3
3
  import { Rules } from './types';
4
4
  declare type InputMode = 'numeric' | 'decimal';
5
5
  export declare const convertNumericInputValue: (value: string, inputMode: InputMode) => number | string;
6
- export declare const parseInput: (value: number | string) => string;
6
+ export declare const parseInput: (value?: string | number | null | undefined) => string;
7
7
  export declare const getAllowedKeys: (inputMode?: InputMode) => string[];
8
8
  declare type ReactHookFormNumberFieldProps = Partial<TextFieldProps> & {
9
9
  rules: Rules;
@@ -1,4 +1,4 @@
1
- import { Moment } from 'moment';
1
+ import moment from 'moment';
2
2
  export declare const errorMessages: {
3
3
  required: string;
4
4
  isValidDate: string;
@@ -18,25 +18,25 @@ export declare const errorMessages: {
18
18
  minVisibility: string;
19
19
  maxVisibility: string;
20
20
  };
21
- export declare const isEmpty: (value: number | string) => boolean;
22
- export declare const isValidDate: (value: Moment | string) => boolean;
21
+ export declare const isEmpty: (value?: string | number | null | undefined) => boolean;
22
+ export declare const isValidDate: (value?: string | moment.Moment | null | undefined) => boolean;
23
23
  export declare const isBefore: (ownDate: string, referenceDate: string) => boolean;
24
24
  export declare const isAfter: (ownDate: string, otherDate: string) => boolean;
25
25
  export declare const isBetween: (ownDate: string, otherDateStart: string, otherDateEnd: string) => boolean;
26
26
  export declare const isXHoursBefore: (ownDate: string, otherDate: string, hours?: number) => boolean;
27
27
  export declare const isXHoursAfter: (ownDate: string, otherDate: string, hours?: number) => boolean;
28
- export declare const isLatitude: (lat: number) => boolean;
29
- export declare const isLongitude: (lng: number) => boolean;
28
+ export declare const isLatitude: (lat?: number | null | undefined) => boolean;
29
+ export declare const isLongitude: (lng?: number | null | undefined) => boolean;
30
30
  export declare const isValidMax: (value: number, maxValue: number) => boolean;
31
31
  export declare const isValidMin: (value: number, minValue: number) => boolean;
32
- export declare const hasValidGeometry: (geojson: GeoJSON.FeatureCollection) => boolean;
32
+ export declare const hasValidGeometry: (geojson?: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | null | undefined) => boolean;
33
33
  export declare const isValidGeoJsonCoordinates: (geojson: GeoJSON.FeatureCollection) => boolean;
34
34
  export declare const isMaximumOneDrawing: (geojson: GeoJSON.FeatureCollection) => boolean;
35
35
  export declare const hasIntersectionWithFIR: (geojson: GeoJSON.FeatureCollection, intersection: GeoJSON.FeatureCollection) => boolean;
36
36
  export declare const hasMaxFeaturePoints: (geojson: GeoJSON.FeatureCollection, maxPoints?: number) => boolean;
37
37
  export declare const hasMulitpleIntersections: (geojson: GeoJSON.FeatureCollection) => boolean;
38
- export declare const isGeometryDirty: (geoJSON: GeoJSON.FeatureCollection, formGeoJSON: GeoJSON.FeatureCollection) => boolean;
38
+ export declare const isGeometryDirty: (geoJSON?: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | null | undefined, formGeoJSON?: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | null | undefined) => boolean;
39
39
  export declare const isInteger: (value: number) => boolean;
40
40
  export declare const isNumeric: (value: any) => boolean;
41
- export declare const isNonOrBothCoordinates: (coordinate: number, otherCoordinate: number) => boolean;
41
+ export declare const isNonOrBothCoordinates: (coordinate?: number | null | undefined, otherCoordinate?: number | null | undefined) => boolean;
42
42
  export declare const containsNoCommas: (val: string | number) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/form-fields",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "GeoWeb form-fields library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "react": "^17.0.2",
17
17
  "@mui/material": "^5.2.8",
18
18
  "moment": "^2.29.0",
19
- "@opengeoweb/theme": "4.1.0",
19
+ "@opengeoweb/theme": "4.2.0",
20
20
  "moment-timezone": "^0.5.31",
21
21
  "@mui/lab": "^5.0.0-alpha.64",
22
22
  "lodash": "^4.17.20"