@opengeoweb/form-fields 2.0.1 → 2.1.3
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/README.md +15 -0
- package/form-fields.esm.js +14 -2
- package/form-fields.umd.js +17 -5
- package/lib/components/ReactHookFormDateTime.stories.d.ts +4 -0
- package/lib/components/ReactHookFormNumberField.stories.d.ts +4 -0
- package/lib/components/ReactHookFormProvider.d.ts +2 -2
- package/lib/components/ReactHookFormRadioGroup.stories.d.ts +4 -0
- package/lib/components/ReactHookFormSelect.stories.d.ts +4 -0
- package/lib/components/ReactHookFormTextField.stories.d.ts +4 -0
- package/lib/storyshots/Storyshots.spec.d.ts +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,3 +9,18 @@ This library was generated with [Nx](https://nx.dev).
|
|
|
9
9
|
## Running unit tests
|
|
10
10
|
|
|
11
11
|
Run `nx test form-fields` to execute the unit tests via [Jest](https://jestjs.io).
|
|
12
|
+
|
|
13
|
+
## Image snapshot testing
|
|
14
|
+
|
|
15
|
+
The current regex filters on storyname takeSnapshot. So to add a story to the snapshot tests, simply add (takeSnapshot) to it's storyName and run the snapshot tests.
|
|
16
|
+
|
|
17
|
+
[Read more about snapshot testing](https://gitlab.com/opengeoweb/opengeoweb/#image-snapshot-testing)
|
|
18
|
+
|
|
19
|
+
### Running snapshot tests and updating snapshots locally
|
|
20
|
+
|
|
21
|
+
1. You need to have [docker](https://docs.docker.com/get-docker/) installed and running.
|
|
22
|
+
2. Start Chromium by running: `npm run start-chromium`. (This will start a docker container with chromium, to run snapshot tests in. We need this to make sure everyone gets the same snapshot results.)
|
|
23
|
+
3. Run the snapshot tests: `npm run test:image-snap-form-fields`. This will first create a new static storybook build and then run the tests.
|
|
24
|
+
4. If a snapshot test fails, you can find and inspect the differences in `libs/form-fields/src/lib/storyshots/__image_snapshots__/__diff_output__/`.
|
|
25
|
+
5. To update the snapshots, run `npm run test:image-snap-form-fields-update`. Snapshots are saved under `libs/form-fields/src/lib/storyshots/__image_snapshots__/`. Make sure to commit the new snapshots.
|
|
26
|
+
6. Stop Chromium by running: `npm run stop-chromium`.
|
package/form-fields.esm.js
CHANGED
|
@@ -4,8 +4,9 @@ import { FormControl, FormHelperText, InputLabel, Select, RadioGroup, TextField,
|
|
|
4
4
|
import { useFormContext, Controller, useForm, FormProvider } from 'react-hook-form';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
import { isEqual } from 'lodash';
|
|
7
|
-
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
7
|
+
import { KeyboardDateTimePicker, MuiPickersUtilsProvider } from '@material-ui/pickers';
|
|
8
8
|
import moment$1 from 'moment-timezone';
|
|
9
|
+
import MomentUtils from '@date-io/moment';
|
|
9
10
|
|
|
10
11
|
/*! *****************************************************************************
|
|
11
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -760,6 +761,17 @@ var ReactHookFormProvider = function ReactHookFormProvider(_ref) {
|
|
|
760
761
|
return /*#__PURE__*/React__default.createElement(FormProvider, Object.assign({}, formMethods), children);
|
|
761
762
|
};
|
|
762
763
|
|
|
764
|
+
var ReactHookFormProviderWrapper = function ReactHookFormProviderWrapper(_ref2) {
|
|
765
|
+
var children = _ref2.children,
|
|
766
|
+
_ref2$options = _ref2.options,
|
|
767
|
+
options = _ref2$options === void 0 ? defaultFormOptions : _ref2$options;
|
|
768
|
+
return /*#__PURE__*/React__default.createElement(ReactHookFormProvider, {
|
|
769
|
+
options: options
|
|
770
|
+
}, /*#__PURE__*/React__default.createElement(MuiPickersUtilsProvider, {
|
|
771
|
+
utils: MomentUtils
|
|
772
|
+
}, children));
|
|
773
|
+
};
|
|
774
|
+
|
|
763
775
|
/* *
|
|
764
776
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
765
777
|
* you may not use this file except in compliance with the License.
|
|
@@ -799,4 +811,4 @@ var ReactHookFormHiddenInput = function ReactHookFormHiddenInput(_ref) {
|
|
|
799
811
|
});
|
|
800
812
|
};
|
|
801
813
|
|
|
802
|
-
export { ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, containsNoCommas, defaultFormOptions, errorMessages, getDeepProperty, hasIntersectionWithFIR, hasMaxFeaturePoints, hasMulitpleIntersections, isAfter, isBefore, isBetween, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidDate, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore };
|
|
814
|
+
export { ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, containsNoCommas, defaultFormOptions, errorMessages, getDeepProperty, hasIntersectionWithFIR, hasMaxFeaturePoints, hasMulitpleIntersections, isAfter, isBefore, isBetween, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidDate, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore };
|
package/form-fields.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@material-ui/core'), require('react-hook-form'), require('moment'), require('lodash'), require('@material-ui/pickers'), require('moment-timezone')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@material-ui/core', 'react-hook-form', 'moment', 'lodash', '@material-ui/pickers', 'moment-timezone'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormFields = {}, global.React, global.core, global.reactHookForm, global.moment, global.lodash, global.pickers, global.moment$1));
|
|
5
|
-
})(this, (function (exports, React, core, reactHookForm, moment, lodash, pickers, moment$1) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@material-ui/core'), require('react-hook-form'), require('moment'), require('lodash'), require('@material-ui/pickers'), require('moment-timezone'), require('@date-io/moment')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@material-ui/core', 'react-hook-form', 'moment', 'lodash', '@material-ui/pickers', 'moment-timezone', '@date-io/moment'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormFields = {}, global.React, global.core, global.reactHookForm, global.moment, global.lodash, global.pickers, global.moment$1, global.MomentUtils));
|
|
5
|
+
})(this, (function (exports, React, core, reactHookForm, moment, lodash, pickers, moment$1, MomentUtils) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
30
30
|
var moment__default$1 = /*#__PURE__*/_interopDefaultLegacy(moment$1);
|
|
31
|
+
var MomentUtils__default = /*#__PURE__*/_interopDefaultLegacy(MomentUtils);
|
|
31
32
|
|
|
32
33
|
/*! *****************************************************************************
|
|
33
34
|
Copyright (c) Microsoft Corporation.
|
|
@@ -780,6 +781,17 @@
|
|
|
780
781
|
return /*#__PURE__*/React__default["default"].createElement(reactHookForm.FormProvider, __assign({}, formMethods), children);
|
|
781
782
|
};
|
|
782
783
|
|
|
784
|
+
var ReactHookFormProviderWrapper = function ReactHookFormProviderWrapper(_a) {
|
|
785
|
+
var children = _a.children,
|
|
786
|
+
_b = _a.options,
|
|
787
|
+
options = _b === void 0 ? defaultFormOptions : _b;
|
|
788
|
+
return /*#__PURE__*/React__default["default"].createElement(ReactHookFormProvider, {
|
|
789
|
+
options: options
|
|
790
|
+
}, /*#__PURE__*/React__default["default"].createElement(pickers.MuiPickersUtilsProvider, {
|
|
791
|
+
utils: MomentUtils__default["default"]
|
|
792
|
+
}, children));
|
|
793
|
+
};
|
|
794
|
+
|
|
783
795
|
var ReactHookFormHiddenInput = function ReactHookFormHiddenInput(_a) {
|
|
784
796
|
var name = _a.name,
|
|
785
797
|
_b = _a.defaultValue,
|
|
@@ -803,7 +815,7 @@
|
|
|
803
815
|
exports.ReactHookFormFormControl = ReactHookFormFormControl;
|
|
804
816
|
exports.ReactHookFormHiddenInput = ReactHookFormHiddenInput;
|
|
805
817
|
exports.ReactHookFormNumberField = ReactHookFormNumberField;
|
|
806
|
-
exports.ReactHookFormProvider =
|
|
818
|
+
exports.ReactHookFormProvider = ReactHookFormProviderWrapper;
|
|
807
819
|
exports.ReactHookFormRadioGroup = ReactHookFormRadioGroup;
|
|
808
820
|
exports.ReactHookFormSelect = ReactHookFormSelect;
|
|
809
821
|
exports.ReactHookFormTextField = ReactHookFormTextField;
|
|
@@ -16,5 +16,5 @@ export declare const defaultFormOptions: Partial<{
|
|
|
16
16
|
shouldUnregister: boolean;
|
|
17
17
|
criteriaMode: "all" | "firstError";
|
|
18
18
|
}>;
|
|
19
|
-
declare const
|
|
20
|
-
export default
|
|
19
|
+
declare const ReactHookFormProviderWrapper: React.FC<WrapperProps>;
|
|
20
|
+
export default ReactHookFormProviderWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"react-hook-form": "^6.12.1",
|
|
16
16
|
"react": "16.14.0",
|
|
17
17
|
"@material-ui/core": "^4.11.0",
|
|
18
|
-
"@material-ui/pickers": "^3.2.10",
|
|
19
|
-
"@date-io/moment": "^1.3.13",
|
|
20
18
|
"moment": "^2.29.0",
|
|
21
|
-
"@opengeoweb/theme": "2.
|
|
19
|
+
"@opengeoweb/theme": "2.1.3",
|
|
22
20
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
|
23
21
|
"@material-ui/icons": "^4.9.1",
|
|
22
|
+
"@material-ui/pickers": "^3.2.10",
|
|
24
23
|
"moment-timezone": "^0.5.31",
|
|
24
|
+
"@date-io/moment": "^1.3.13",
|
|
25
25
|
"lodash": "^4.17.20"
|
|
26
26
|
}
|
|
27
27
|
}
|