@dhis2/ui-forms 8.15.1 → 8.16.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/ui-forms",
3
- "version": "8.15.1",
3
+ "version": "8.16.0-alpha.2",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "sideEffects": [
@@ -8,6 +8,7 @@
8
8
  "build/cjs/locales/index.js"
9
9
  ],
10
10
  "exports": {
11
+ "types": "./types/index.d.ts",
11
12
  "import": "./build/es/index.js",
12
13
  "require": "./build/cjs/index.js"
13
14
  },
@@ -34,25 +35,27 @@
34
35
  },
35
36
  "dependencies": {
36
37
  "@dhis2/prop-types": "^3.1.2",
37
- "@dhis2-ui/button": "8.15.1",
38
- "@dhis2-ui/checkbox": "8.15.1",
39
- "@dhis2-ui/field": "8.15.1",
40
- "@dhis2-ui/file-input": "8.15.1",
41
- "@dhis2-ui/input": "8.15.1",
42
- "@dhis2-ui/radio": "8.15.1",
43
- "@dhis2-ui/select": "8.15.1",
44
- "@dhis2-ui/switch": "8.15.1",
45
- "@dhis2-ui/text-area": "8.15.1",
38
+ "@dhis2-ui/button": "8.16.0-alpha.2",
39
+ "@dhis2-ui/checkbox": "8.16.0-alpha.2",
40
+ "@dhis2-ui/field": "8.16.0-alpha.2",
41
+ "@dhis2-ui/file-input": "8.16.0-alpha.2",
42
+ "@dhis2-ui/input": "8.16.0-alpha.2",
43
+ "@dhis2-ui/radio": "8.16.0-alpha.2",
44
+ "@dhis2-ui/select": "8.16.0-alpha.2",
45
+ "@dhis2-ui/switch": "8.16.0-alpha.2",
46
+ "@dhis2-ui/text-area": "8.16.0-alpha.2",
46
47
  "classnames": "^2.3.1",
47
48
  "final-form": "^4.20.2",
48
49
  "prop-types": "^15.7.2",
49
50
  "react-final-form": "^6.5.3"
50
51
  },
51
52
  "files": [
52
- "build"
53
+ "build",
54
+ "types"
53
55
  ],
54
56
  "devDependencies": {
55
57
  "react": "16.13",
56
58
  "react-dom": "16.13"
57
- }
59
+ },
60
+ "types": "types"
58
61
  }
@@ -0,0 +1,16 @@
1
+ import type { FieldRenderProps } from 'react-final-form'
2
+ import type { CheckboxFieldProps } from '@dhis2-ui/checkbox'
3
+ import React from 'react'
4
+
5
+ type CheckBoxValue = CheckboxFieldProps['value']
6
+ type CheckboxRestProps = Omit<
7
+ CheckboxFieldProps,
8
+ 'onChange' | 'value' | 'checked' | 'name'
9
+ >
10
+
11
+ export type CheckboxFieldFFProps = FieldRenderProps<CheckBoxValue> &
12
+ CheckboxRestProps & {
13
+ showValidStatus?: boolean
14
+ }
15
+
16
+ export const CheckboxFieldFF: React.FC<CheckboxFieldFFProps>
@@ -0,0 +1,9 @@
1
+ import React from 'react'
2
+ import type { FieldGroupProps } from '@dhis2-ui/field'
3
+
4
+ export type FieldGroupFFProps = Omit<
5
+ FieldGroupProps,
6
+ 'children' | 'label' | 'name' | 'required'
7
+ >
8
+
9
+ export const FieldGroupFF: React.FC<FieldGroupFFProps>
@@ -0,0 +1,18 @@
1
+ import React from 'react'
2
+ import type { FileInputFieldProps } from '@dhis2-ui/file-input'
3
+ import type { FieldRenderProps } from 'react-final-form'
4
+
5
+ export type FilesValue = File[] | undefined | null | ''
6
+
7
+ type FileInputRestProps = Omit<
8
+ FileInputFieldProps,
9
+ 'onChange' | 'multiple' | 'name'
10
+ >
11
+
12
+ export type FileInputFieldFFProps = FieldRenderProps<FilesValue> &
13
+ FileInputRestProps & {
14
+ showValidStatus?: boolean
15
+ multifile: FileInputFieldProps['multiple']
16
+ }
17
+
18
+ export const FileInputFieldFF: React.FC<FileInputFieldFFProps>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import type { InputFieldProps } from '@dhis2-ui/input'
3
+ import type { FieldRenderProps } from 'react-final-form'
4
+
5
+ export type InputValue = InputFieldProps['value']
6
+
7
+ type InputFieldRestProps = Omit<InputFieldProps, 'onChange' | 'value' | 'name'>
8
+
9
+ export type InputFieldFFProps = FieldRenderProps<InputValue> &
10
+ InputFieldRestProps & {
11
+ showLoadingStatus?: boolean
12
+ showValidStatus?: boolean
13
+ }
14
+
15
+ export const InputFieldFF: React.FC<InputFieldFFProps>
@@ -0,0 +1,24 @@
1
+ import React from 'react'
2
+ import type { FieldRenderProps } from 'react-final-form'
3
+ import type {
4
+ MultiSelectOptionProps,
5
+ MultiSelectFieldProps,
6
+ } from '@dhis2-ui/select'
7
+
8
+ type InputValue = MultiSelectFieldProps['selected'] | ''
9
+
10
+ type MultiSelectFieldRestProps = Omit<
11
+ MultiSelectFieldProps,
12
+ 'onChange' | 'value'
13
+ >
14
+
15
+ type MultiSelectOptions = Array<Pick<MultiSelectOptionProps, 'value' | 'label'>>
16
+
17
+ export type MultiSelectFieldFFProps = FieldRenderProps<InputValue> &
18
+ MultiSelectFieldRestProps & {
19
+ showLoadingStatus?: boolean
20
+ showValidStatus?: boolean
21
+ options: MultiSelectOptions
22
+ }
23
+
24
+ export const MultiSelectFieldFF: React.FC<MultiSelectFieldFFProps>
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import type { FieldRenderProps } from 'react-final-form'
3
+ import type { RadioProps } from '@dhis2-ui/radio'
4
+
5
+ type InputValue = RadioProps['value']
6
+
7
+ type RadioRestProps = Omit<
8
+ RadioProps,
9
+ 'onChange' | 'value' | 'checked' | 'name'
10
+ >
11
+
12
+ export type RadioFieldFFProps = FieldRenderProps<InputValue> &
13
+ RadioRestProps & {
14
+ showValidStatus?: boolean
15
+ }
16
+
17
+ export const RadioFieldFF: React.FC<RadioFieldFFProps>
@@ -0,0 +1,26 @@
1
+ import React from 'react'
2
+ import type { FieldRenderProps } from 'react-final-form'
3
+ import type {
4
+ SingleSelectOptionProps,
5
+ SingleSelectFieldProps,
6
+ } from '@dhis2-ui/select'
7
+
8
+ type InputValue = SingleSelectFieldProps['selected']
9
+
10
+ type SingleSelectOptions = Array<
11
+ Pick<SingleSelectOptionProps, 'value' | 'label'>
12
+ >
13
+
14
+ type SingleSelectRestProps = Omit<
15
+ SingleSelectFieldProps,
16
+ 'onChange' | 'value' | 'name'
17
+ >
18
+
19
+ export type SingleSelectFieldFFProps = FieldRenderProps<InputValue> &
20
+ SingleSelectRestProps & {
21
+ showLoadingStatus?: boolean
22
+ showValidStatus?: boolean
23
+ options: SingleSelectOptions
24
+ }
25
+
26
+ export const SingleSelectFieldFF: React.FC<SingleSelectFieldFFProps>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import type { FieldRenderProps } from 'react-final-form'
3
+ import type { SwitchFieldProps } from '@dhis2-ui/switch'
4
+
5
+ type InputValue = SwitchFieldProps['value']
6
+
7
+ type SwitchFieldRestProps = Omit<
8
+ SwitchFieldProps,
9
+ 'onChange' | 'checked' | 'value' | 'name'
10
+ >
11
+
12
+ export type SwitchFieldFFProps = FieldRenderProps<InputValue> &
13
+ SwitchFieldRestProps
14
+
15
+ export const SwitchFieldFF: React.FC<SwitchFieldFFProps>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import type { FieldRenderProps } from 'react-final-form'
3
+ import type { TextAreaFieldProps } from '@dhis2-ui/text-area'
4
+
5
+ type InputValue = TextAreaFieldProps['value']
6
+
7
+ type TextAreaFieldRestProps = Omit<
8
+ TextAreaFieldProps,
9
+ 'onChange' | 'value' | 'name'
10
+ >
11
+
12
+ export type TextAreaFieldFFProps = FieldRenderProps<InputValue> &
13
+ TextAreaFieldRestProps
14
+
15
+ export const TextAreaFieldFF: React.FC<TextAreaFieldFFProps>
@@ -0,0 +1,28 @@
1
+ import * as FinalForm from 'final-form'
2
+ import * as ReactFinalForm from 'react-final-form'
3
+
4
+ export { CheckboxFieldFF } from './CheckboxFieldFF/CheckboxFieldFF'
5
+ export { FileInputFieldFF } from './FileInputFieldFF/FileInputFieldFF'
6
+ export { InputFieldFF } from './InputFieldFF/InputFieldFF'
7
+ export { MultiSelectFieldFF } from './MultiSelectFieldFF/MutliSelectFieldFF'
8
+ export { SingleSelectFieldFF } from './SingleSelectFieldFF/SingleSelectFieldFF'
9
+ export { RadioFieldFF } from './RadioFieldFF/RadioFieldFF'
10
+ export { SwitchFieldFF } from './SwitchFieldFF/SwitchFieldFF'
11
+ export { TextAreaFieldFF } from './TextAreaFieldFF/TextAreaFieldFF'
12
+ export { FieldGroupFF } from './FieldGroupFF/FieldGroupFF'
13
+
14
+ export * from './transformers'
15
+ export * from './validators'
16
+
17
+ /**
18
+ * Allows direct access to the FinalForm library. Please note that this is considered advanced
19
+ * usage and that you need to stay up to date with breaking changes in the FinalForm library.
20
+ */
21
+ export { FinalForm }
22
+
23
+ /**
24
+ * Allows direct access to the ReactFinalForm library. Please note that this is considered
25
+ * advanced usage and that you need to stay up to date with breaking changes in the FinalForm
26
+ * library.
27
+ */
28
+ export { ReactFinalForm }
@@ -0,0 +1,6 @@
1
+ export type ValuesWithId = Array<{ id: string }> | undefined
2
+
3
+ export const arrayWithIdObjects: {
4
+ format: (value: ValuesWithId) => string
5
+ pars: (value: string) => ValuesWithId
6
+ }
@@ -0,0 +1,31 @@
1
+ export type Validator = (value: unknown) => string | undefined
2
+
3
+ export const alphaNumeric: Validator
4
+ export const boolean: Validator
5
+ export const composeValidators: (...validators: Validator[]) => Validator
6
+
7
+ export const createCharacterLengthRange: (
8
+ lowerBound: number,
9
+ upperBound: number,
10
+ customMessage?: string
11
+ ) => Validator
12
+ export const createEqualTo: (key: string, description?: string) => Validator
13
+ export const createMaxCharacterLength: (upperBound: number) => Validator
14
+ export const createMaxNumber: (upperBound: number) => Validator
15
+ export const createMinCharacterLength: (lowerBound: number) => Validator
16
+ export const createMinNumber: (lowerBound: number) => Validator
17
+ export const createNumberRange: (
18
+ lowerBound: number,
19
+ upperBound: number,
20
+ customMessage?: string
21
+ ) => Validator
22
+ export const createPattern: (pattern: RegExp, message?: string) => Validator
23
+ export const dhis2Password: Validator
24
+ export const dhis2Username: Validator
25
+ export const email: Validator
26
+ export const hasValue: Validator
27
+ export const integer: Validator
28
+ export const internationalPhoneNumber: Validator
29
+ export const number: Validator
30
+ export const string: Validator
31
+ export const url: Validator