@opengeoweb/form-fields 19.0.0 → 19.1.1
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/dist/README.md +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1177 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/lib/components/DegreesMinutesField.d.ts +15 -0
- package/dist/src/lib/components/Providers.d.ts +19 -0
- package/dist/src/lib/components/ReactHookFormDateTime.d.ts +24 -0
- package/dist/src/lib/components/ReactHookFormFormControl.d.ts +12 -0
- package/dist/src/lib/components/ReactHookFormHiddenInput.d.ts +7 -0
- package/dist/src/lib/components/ReactHookFormNumberField.d.ts +12 -0
- package/dist/src/lib/components/ReactHookFormProvider.d.ts +9 -0
- package/dist/src/lib/components/ReactHookFormRadioGroup.d.ts +9 -0
- package/dist/src/lib/components/ReactHookFormSelect.d.ts +8 -0
- package/dist/src/lib/components/ReactHookFormTextField.d.ts +10 -0
- package/dist/src/lib/components/formUtils.d.ts +3 -0
- package/dist/src/lib/components/index.d.ts +13 -0
- package/dist/src/lib/components/types.d.ts +8 -0
- package/dist/src/lib/components/utils.d.ts +37 -0
- package/dist/src/lib/hooks/useDraftFormHelpers/useDraftFormHelpers.d.ts +8 -0
- package/dist/src/lib/utils/i18n.d.ts +7 -0
- package/package.json +2 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function decimalToDegreesMinutes(value: number): string;
|
|
4
|
+
export declare function degreesMinutesToDecimal(input: string | number): number;
|
|
5
|
+
interface Props {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
isReadOnly?: boolean;
|
|
10
|
+
size?: 'small' | 'medium';
|
|
11
|
+
isLongitude?: boolean;
|
|
12
|
+
t: TFunction;
|
|
13
|
+
}
|
|
14
|
+
export declare const DegreesMinutesField: React.FC<Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseFormProps } from 'react-hook-form';
|
|
3
|
+
export declare const zeplinLinks: {
|
|
4
|
+
name: string;
|
|
5
|
+
link: string;
|
|
6
|
+
}[];
|
|
7
|
+
interface StoryLayoutProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const FormFieldsWrapper: React.FC<StoryLayoutProps & {
|
|
11
|
+
options?: UseFormProps;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const FormFieldsWrappeDecorator: React.FC<StoryLayoutProps & {
|
|
14
|
+
isDarkTheme?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const FormFieldsI18nProvider: React.FC<{
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import type { DateTimePickerProps, DateTimePickerSlotProps } from '@mui/x-date-pickers';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { ReactHookFormInput } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Should return an isostring in the form "YYYY-MM-DDThh:mmZ";
|
|
7
|
+
* The milli seconds section should not be included, strictly YYYY-MM-DDThh:mm:ssZ is important
|
|
8
|
+
* @param value input Date
|
|
9
|
+
* @returns iso string in YYYY-MM-DDThh:mm format.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getFormattedValueForDatePicker: (value: Date) => string | null;
|
|
12
|
+
export declare const getDateValue: (value: string) => Date | null;
|
|
13
|
+
type ReactHookKeyboardDateTimePickerProps = DateTimePickerProps & DateTimePickerSlotProps & ReactHookFormInput<{
|
|
14
|
+
defaultNullValue?: string | null;
|
|
15
|
+
value?: string;
|
|
16
|
+
onChange?: (value: Date | string | null) => void;
|
|
17
|
+
format?: string;
|
|
18
|
+
sx?: SxProps<Theme>;
|
|
19
|
+
}> & {
|
|
20
|
+
'data-testid'?: string;
|
|
21
|
+
shouldHideUTC?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare const ReactHookKeyboardDateTimePicker: React.FC<ReactHookKeyboardDateTimePickerProps>;
|
|
24
|
+
export default ReactHookKeyboardDateTimePicker;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormControlProps } from '@mui/material';
|
|
2
|
+
import type { TFunction } from 'i18next';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { FieldErrors } from 'react-hook-form';
|
|
5
|
+
interface ReactHookFormFormControlProps extends FormControlProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
errors?: FieldErrors;
|
|
8
|
+
isReadOnly?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const getErrorMessage: (t: TFunction, errors: FieldErrors) => string;
|
|
11
|
+
declare const ReactHookFormFormControl: React.FC<ReactHookFormFormControlProps>;
|
|
12
|
+
export default ReactHookFormFormControl;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactHookFormInput } from './types';
|
|
3
|
+
type ReactHookFormHiddenInputProps = ReactHookFormInput<{
|
|
4
|
+
defaultValue?: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
declare const ReactHookFormHiddenInput: React.FC<ReactHookFormHiddenInputProps>;
|
|
7
|
+
export default ReactHookFormHiddenInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextFieldProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactHookFormInput } from './types';
|
|
4
|
+
type InputMode = 'numeric' | 'decimal';
|
|
5
|
+
export declare const convertNumericInputValue: (value: string, inputMode: InputMode) => number | null;
|
|
6
|
+
export declare const getAllowedKeys: (inputMode?: InputMode) => string[];
|
|
7
|
+
type ReactHookFormNumberFieldProps = Partial<TextFieldProps> & ReactHookFormInput<{
|
|
8
|
+
inputMode?: InputMode;
|
|
9
|
+
onBeforeChange?: () => void;
|
|
10
|
+
}>;
|
|
11
|
+
declare const ReactHookFormNumberField: React.FC<ReactHookFormNumberFieldProps>;
|
|
12
|
+
export default ReactHookFormNumberField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseFormProps } from 'react-hook-form';
|
|
3
|
+
interface WrapperProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
options?: UseFormProps;
|
|
6
|
+
}
|
|
7
|
+
export declare const defaultFormOptions: UseFormProps;
|
|
8
|
+
declare const ReactHookFormProviderWrapper: React.FC<WrapperProps>;
|
|
9
|
+
export default ReactHookFormProviderWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RadioGroupProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactHookFormInput } from './types';
|
|
4
|
+
type ReactHookFormRadioGroupProps = Partial<RadioGroupProps> & ReactHookFormInput<{
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
declare const ReactHookFormRadioGroup: React.FC<ReactHookFormRadioGroupProps>;
|
|
9
|
+
export default ReactHookFormRadioGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SelectProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactHookFormInput } from './types';
|
|
4
|
+
type ReactHookFormSelectProps = Partial<SelectProps> & ReactHookFormInput<{
|
|
5
|
+
onBeforeChange?: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare const ReactHookFormSelect: React.FC<ReactHookFormSelectProps>;
|
|
8
|
+
export default ReactHookFormSelect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BaseTextFieldProps, FilledInputProps, SlotCommonProps, SlotProps, TextFieldProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ReactHookFormInput } from './types';
|
|
4
|
+
export declare const convertTextInputValue: (value: string, inCapitals: boolean) => number | string;
|
|
5
|
+
type ReactHookFormTextFieldProps = Partial<TextFieldProps> & ReactHookFormInput<{
|
|
6
|
+
upperCase?: boolean;
|
|
7
|
+
inputSlotProps?: SlotProps<React.ElementType<FilledInputProps, keyof React.JSX.IntrinsicElements>, SlotCommonProps, BaseTextFieldProps> | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
declare const ReactHookFormTextField: React.FC<ReactHookFormTextFieldProps>;
|
|
10
|
+
export default ReactHookFormTextField;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as ReactHookFormSelect } from './ReactHookFormSelect';
|
|
2
|
+
export { default as ReactHookFormRadioGroup } from './ReactHookFormRadioGroup';
|
|
3
|
+
export { default as ReactHookFormTextField } from './ReactHookFormTextField';
|
|
4
|
+
export { default as ReactHookFormNumberField } from './ReactHookFormNumberField';
|
|
5
|
+
export { default as ReactHookFormFormControl } from './ReactHookFormFormControl';
|
|
6
|
+
export { default as ReactHookFormDateTime } from './ReactHookFormDateTime';
|
|
7
|
+
export * from './ReactHookFormDateTime';
|
|
8
|
+
export { default as ReactHookFormProvider } from './ReactHookFormProvider';
|
|
9
|
+
export { default as ReactHookFormHiddenInput } from './ReactHookFormHiddenInput';
|
|
10
|
+
export { DegreesMinutesField } from './DegreesMinutesField';
|
|
11
|
+
export { defaultFormOptions } from './ReactHookFormProvider';
|
|
12
|
+
export { errorMessages, isMaximumOneDrawing, hasValidGeometry, isGeometryDirty, isValidGeoJsonCoordinates, hasIntersectionWithFIR, countIntersectionPoints, isValidMax, isValidMin, isInteger, hasMulitpleIntersections, isLatitude, isLongitude, isNonOrBothCoordinates, isEmpty, isXHoursAfter, isXHoursBefore, } from './utils';
|
|
13
|
+
export { getDeepProperty } from './formUtils';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Polygon } from 'geojson';
|
|
2
|
+
export declare const defaultProps: {
|
|
3
|
+
shouldUnregister: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const errorMessages: {
|
|
6
|
+
required: string;
|
|
7
|
+
isValidDate: string;
|
|
8
|
+
isAfter: string;
|
|
9
|
+
isXHoursBefore: string;
|
|
10
|
+
isXHoursAfter: string;
|
|
11
|
+
isBefore: string;
|
|
12
|
+
minLevel: string;
|
|
13
|
+
isLatitude: string;
|
|
14
|
+
isLongitude: string;
|
|
15
|
+
isValidMax: string;
|
|
16
|
+
isLevelLower: string;
|
|
17
|
+
isNonOrBothCoordinates: string;
|
|
18
|
+
isInteger: string;
|
|
19
|
+
isNumeric: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const isEmpty: (value?: number | string | null) => boolean;
|
|
22
|
+
export declare const isXHoursBefore: (ownDate: string, otherDate: string, hours?: number) => boolean;
|
|
23
|
+
export declare const isXHoursAfter: (ownDate: string, otherDate: string, hours?: number) => boolean;
|
|
24
|
+
export declare const isLatitude: (lat?: number | null) => boolean;
|
|
25
|
+
export declare const isLongitude: (lng?: number | null) => boolean;
|
|
26
|
+
export declare const isValidMax: (value: number, maxValue: number | null) => boolean;
|
|
27
|
+
export declare const isValidMin: (value: number, minValue: number | null) => boolean;
|
|
28
|
+
export declare const hasValidGeometry: (geojson?: GeoJSON.FeatureCollection | null) => boolean;
|
|
29
|
+
export declare const isValidGeoJsonCoordinates: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
30
|
+
export declare const isMaximumOneDrawing: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
31
|
+
export declare const hasIntersectionWithFIR: (geojson: GeoJSON.FeatureCollection, intersection: GeoJSON.FeatureCollection) => boolean;
|
|
32
|
+
export declare const hasMulitpleIntersections: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
33
|
+
export declare const countIntersectionPoints: (geojson: GeoJSON.FeatureCollection<Polygon>, intersection: GeoJSON.FeatureCollection<Polygon>) => number;
|
|
34
|
+
export declare const isGeometryDirty: (geoJSON?: GeoJSON.FeatureCollection | null, formGeoJSON?: GeoJSON.FeatureCollection | null) => boolean;
|
|
35
|
+
export declare const isInteger: (value: number) => boolean;
|
|
36
|
+
export declare const isNumeric: (value: any) => boolean;
|
|
37
|
+
export declare const isNonOrBothCoordinates: (coordinate?: number | null, otherCoordinate?: number | null) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const HIDDEN_INPUT_HELPER_IS_DRAFT = "IS_DRAFT";
|
|
3
|
+
export declare const useDraftFormHelpers: (isDefaultDraft?: boolean) => {
|
|
4
|
+
isRequired: (value: string) => boolean | string;
|
|
5
|
+
toggleIsDraft: (isDraft: boolean) => void;
|
|
6
|
+
isDraft: () => boolean;
|
|
7
|
+
DraftFieldHelper: () => React.ReactElement;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
import type { UseTranslationResponse } from 'react-i18next';
|
|
3
|
+
export declare const FORM_FIELDS_NAMESPACE = "form-fields";
|
|
4
|
+
export declare const initFormFieldsI18n: () => void;
|
|
5
|
+
export declare const translateInTestsAndStories: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
6
|
+
export declare const useFormFieldsTranslation: () => UseTranslationResponse<typeof FORM_FIELDS_NAMESPACE, typeof i18n>;
|
|
7
|
+
export { i18n };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.1.1",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
|
+
"!dist/package.json",
|
|
43
44
|
"README.md",
|
|
44
45
|
"package.json"
|
|
45
46
|
]
|