-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1430 from dhis2/alpha
* fix(types): add type declarations for components (#1399) * fix: add types for popers * style: prettier constants decl * fix: rexport types from ui * fix: generate type script * chore: ignore declaration files * fix: add types for icons * fix: add types for alert, box, button * fix: add types for input * fix: add types for calendar * fix: add types for checkbox * fix: add types card, center, chip, cover, css * fix: add types for divier and field * fix: add types for file-input * fix: add types for logo, modal, node * fix: add types for headerbar, help, intersection, label, layer * fix: add types for legend, loader, menu, notice-box * fix: add types for orgunit-tree * fix: add types for portal, tab, tooltip * fix: add types for equired, statusicon, tag, useravatar * fix: add types for pagination * fix: edit input payloads, add radio types * fix: add types for segmented-control * fix: add types for select * fix: add types for selector-bar,switch * fix: add types for sharing-dialog and modal * fix: add types for transfer * fix: add types for textarea * fix: add types for table * fix: rexport declarations from collections/ui * style: run prettier * fix: remove generate-types script * fix: name conflicts * fix: name conflicts in rexport * chore: add @types/react to dependencies * fix: typo * style: run prettier on icons * fix: move files to types-folder and update packages * chore: eslint ignore *.d.ts * chore: run prettier * fix: fix types in package.json * fix: add forward prop types to datacell * style: prettier on package.json * style: prettier * fix: cleanup * chore: use range for peer-dep @react/types * fix: fix onClick type for layer * chore: move @types/react to peerdep * refactor(org unit tree): rename root error & loading to match exported name * chore(transferoption): add missing onClick/onDoubleClick prop TS types * chore(org unit tree): add missing / fix public TS types * fix(selector-bar): add types for selector-bar-item * style: fix selector-bar style --------- Co-authored-by: Jan-Gerke Salomon <[email protected]> Co-authored-by: Jan-Gerke Salomon <[email protected]> * chore(release): cut 8.14.2-alpha.1 [skip release] ## [8.14.2-alpha.1](v8.14.1...v8.14.2-alpha.1) (2023-10-12) ### Bug Fixes * **types:** add type declarations for components ([#1399](#1399)) ([d3e74c5](d3e74c5)) * feat(types): add types for forms collection (#1415) * feat: add types for FF field-wrappers * feat(types): add types for transformers and validators * fix: mirror folder-structure for types * fix: remove old-types structure * fix(types): cleanup * style: run prettier * refactor: rename overridden type name to rest * style: run prettier * fix(types): make selected payload always present * chore(release): cut 8.15.0-alpha.1 [skip release] # [8.15.0-alpha.1](v8.14.2-alpha.1...v8.15.0-alpha.1) (2023-10-19) ### Features * **types:** add types for forms collection ([#1415](#1415)) ([2e9d91a](2e9d91a)) * fix: minor type fixes (#1416) * fix(types): make value and name always present in eventpayload * fix(types): export payloads and handlers * style: run prettier * chore(release): cut 8.15.0-alpha.2 [skip release] # [8.15.0-alpha.2](v8.15.0-alpha.1...v8.15.0-alpha.2) (2023-10-20) ### Bug Fixes * minor type fixes ([#1416](#1416)) ([71f4537](71f4537)) * chore(changelog): merge changelog correctly * fix(package): include types in exports field * chore(release): cut 8.15.0-alpha.3 [skip release] # [8.15.0-alpha.3](v8.15.0-alpha.2...v8.15.0-alpha.3) (2023-11-20) ### Bug Fixes * **package:** include types in exports field ([e16036b](e16036b)) * **pagination:** add row padding on small screens and demo stories ([b373859](b373859)) * **portal:** get default mount node at execution time ([20ab2ca](20ab2ca)) * **translations:** sync translations from transifex (master) ([f7cc472](f7cc472)) * **translations:** sync translations from transifex (master) ([7ea15fe](7ea15fe)) * **translations:** sync translations from transifex (master) ([fb22f68](fb22f68)) * **translations:** sync translations from transifex (master) ([071453c](071453c)) * **translations:** sync translations from transifex (master) ([4a8b0b3](4a8b0b3)) * **translations:** sync translations from transifex (master) ([ac1b242](ac1b242)) * **translations:** sync translations from transifex (master) ([28e0da7](28e0da7)) * chore(changelog): merge changelog * chore(release): cut 8.16.0-alpha.1 [skip release] # [8.16.0-alpha.1](v8.15.0...v8.16.0-alpha.1) (2023-11-28) ### Bug Fixes * **package:** include types in exports field ([e16036b](e16036b)) * minor type fixes ([#1416](#1416)) ([71f4537](71f4537)) * **types:** add type declarations for components ([#1399](#1399)) ([d3e74c5](d3e74c5)) ### Features * **types:** add types for forms collection ([#1415](#1415)) ([2e9d91a](2e9d91a)) * fix(types): minor type fixes (#1434) [skip release] * fix(types): add types for sharedPropTypes * docs(types): align type comments with propTypes * chore(changelog): align changelog with master * chore(release): cut 8.16.0-alpha.2 [skip release] # [8.16.0-alpha.2](v8.16.0-alpha.1...v8.16.0-alpha.2) (2023-11-29) ### Bug Fixes * **prop-type:** fix deprecation of buttonVariantPropType ([#1433](#1433)) ([81644a8](81644a8)) * **types:** minor type fixes ([#1434](#1434)) [skip release] ([5e1068d](5e1068d)) --------- Co-authored-by: Jan-Gerke Salomon <[email protected]> Co-authored-by: Jan-Gerke Salomon <[email protected]> Co-authored-by: @dhis2-bot <[email protected]>
- Loading branch information
Showing
126 changed files
with
4,677 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.yarn/ | ||
utilities/icons/src/react/**/*.js | ||
**/locales/ | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
collections/forms/types/CheckboxFieldFF/CheckboxFieldFF.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { CheckboxFieldProps } from '@dhis2-ui/checkbox' | ||
import React from 'react' | ||
|
||
type CheckBoxValue = CheckboxFieldProps['value'] | ||
type CheckboxRestProps = Omit< | ||
CheckboxFieldProps, | ||
'onChange' | 'value' | 'checked' | 'name' | ||
> | ||
|
||
export type CheckboxFieldFFProps = FieldRenderProps<CheckBoxValue> & | ||
CheckboxRestProps & { | ||
showValidStatus?: boolean | ||
} | ||
|
||
export const CheckboxFieldFF: React.FC<CheckboxFieldFFProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react' | ||
import type { FieldGroupProps } from '@dhis2-ui/field' | ||
|
||
export type FieldGroupFFProps = Omit< | ||
FieldGroupProps, | ||
'children' | 'label' | 'name' | 'required' | ||
> | ||
|
||
export const FieldGroupFF: React.FC<FieldGroupFFProps> |
18 changes: 18 additions & 0 deletions
18
collections/forms/types/FileInputFieldFF/FileInputFieldFF.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import type { FileInputFieldProps } from '@dhis2-ui/file-input' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
|
||
export type FilesValue = File[] | undefined | null | '' | ||
|
||
type FileInputRestProps = Omit< | ||
FileInputFieldProps, | ||
'onChange' | 'multiple' | 'name' | ||
> | ||
|
||
export type FileInputFieldFFProps = FieldRenderProps<FilesValue> & | ||
FileInputRestProps & { | ||
showValidStatus?: boolean | ||
multifile: FileInputFieldProps['multiple'] | ||
} | ||
|
||
export const FileInputFieldFF: React.FC<FileInputFieldFFProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import type { InputFieldProps } from '@dhis2-ui/input' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
|
||
export type InputValue = InputFieldProps['value'] | ||
|
||
type InputFieldRestProps = Omit<InputFieldProps, 'onChange' | 'value' | 'name'> | ||
|
||
export type InputFieldFFProps = FieldRenderProps<InputValue> & | ||
InputFieldRestProps & { | ||
showLoadingStatus?: boolean | ||
showValidStatus?: boolean | ||
} | ||
|
||
export const InputFieldFF: React.FC<InputFieldFFProps> |
24 changes: 24 additions & 0 deletions
24
collections/forms/types/MultiSelectFieldFF/MutliSelectFieldFF.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { | ||
MultiSelectOptionProps, | ||
MultiSelectFieldProps, | ||
} from '@dhis2-ui/select' | ||
|
||
type InputValue = MultiSelectFieldProps['selected'] | '' | ||
|
||
type MultiSelectFieldRestProps = Omit< | ||
MultiSelectFieldProps, | ||
'onChange' | 'value' | ||
> | ||
|
||
type MultiSelectOptions = Array<Pick<MultiSelectOptionProps, 'value' | 'label'>> | ||
|
||
export type MultiSelectFieldFFProps = FieldRenderProps<InputValue> & | ||
MultiSelectFieldRestProps & { | ||
showLoadingStatus?: boolean | ||
showValidStatus?: boolean | ||
options: MultiSelectOptions | ||
} | ||
|
||
export const MultiSelectFieldFF: React.FC<MultiSelectFieldFFProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { RadioProps } from '@dhis2-ui/radio' | ||
|
||
type InputValue = RadioProps['value'] | ||
|
||
type RadioRestProps = Omit< | ||
RadioProps, | ||
'onChange' | 'value' | 'checked' | 'name' | ||
> | ||
|
||
export type RadioFieldFFProps = FieldRenderProps<InputValue> & | ||
RadioRestProps & { | ||
showValidStatus?: boolean | ||
} | ||
|
||
export const RadioFieldFF: React.FC<RadioFieldFFProps> |
26 changes: 26 additions & 0 deletions
26
collections/forms/types/SingleSelectFieldFF/SingleSelectFieldFF.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { | ||
SingleSelectOptionProps, | ||
SingleSelectFieldProps, | ||
} from '@dhis2-ui/select' | ||
|
||
type InputValue = SingleSelectFieldProps['selected'] | ||
|
||
type SingleSelectOptions = Array< | ||
Pick<SingleSelectOptionProps, 'value' | 'label'> | ||
> | ||
|
||
type SingleSelectRestProps = Omit< | ||
SingleSelectFieldProps, | ||
'onChange' | 'value' | 'name' | ||
> | ||
|
||
export type SingleSelectFieldFFProps = FieldRenderProps<InputValue> & | ||
SingleSelectRestProps & { | ||
showLoadingStatus?: boolean | ||
showValidStatus?: boolean | ||
options: SingleSelectOptions | ||
} | ||
|
||
export const SingleSelectFieldFF: React.FC<SingleSelectFieldFFProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { SwitchFieldProps } from '@dhis2-ui/switch' | ||
|
||
type InputValue = SwitchFieldProps['value'] | ||
|
||
type SwitchFieldRestProps = Omit< | ||
SwitchFieldProps, | ||
'onChange' | 'checked' | 'value' | 'name' | ||
> | ||
|
||
export type SwitchFieldFFProps = FieldRenderProps<InputValue> & | ||
SwitchFieldRestProps | ||
|
||
export const SwitchFieldFF: React.FC<SwitchFieldFFProps> |
15 changes: 15 additions & 0 deletions
15
collections/forms/types/TextAreaFieldFF/TextAreaFieldFF.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import type { FieldRenderProps } from 'react-final-form' | ||
import type { TextAreaFieldProps } from '@dhis2-ui/text-area' | ||
|
||
type InputValue = TextAreaFieldProps['value'] | ||
|
||
type TextAreaFieldRestProps = Omit< | ||
TextAreaFieldProps, | ||
'onChange' | 'value' | 'name' | ||
> | ||
|
||
export type TextAreaFieldFFProps = FieldRenderProps<InputValue> & | ||
TextAreaFieldRestProps | ||
|
||
export const TextAreaFieldFF: React.FC<TextAreaFieldFFProps> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as FinalForm from 'final-form' | ||
import * as ReactFinalForm from 'react-final-form' | ||
|
||
export { CheckboxFieldFF } from './CheckboxFieldFF/CheckboxFieldFF' | ||
export { FileInputFieldFF } from './FileInputFieldFF/FileInputFieldFF' | ||
export { InputFieldFF } from './InputFieldFF/InputFieldFF' | ||
export { MultiSelectFieldFF } from './MultiSelectFieldFF/MutliSelectFieldFF' | ||
export { SingleSelectFieldFF } from './SingleSelectFieldFF/SingleSelectFieldFF' | ||
export { RadioFieldFF } from './RadioFieldFF/RadioFieldFF' | ||
export { SwitchFieldFF } from './SwitchFieldFF/SwitchFieldFF' | ||
export { TextAreaFieldFF } from './TextAreaFieldFF/TextAreaFieldFF' | ||
export { FieldGroupFF } from './FieldGroupFF/FieldGroupFF' | ||
|
||
export * from './transformers' | ||
export * from './validators' | ||
|
||
/** | ||
* Allows direct access to the FinalForm library. Please note that this is considered advanced | ||
* usage and that you need to stay up to date with breaking changes in the FinalForm library. | ||
*/ | ||
export { FinalForm } | ||
|
||
/** | ||
* Allows direct access to the ReactFinalForm library. Please note that this is considered | ||
* advanced usage and that you need to stay up to date with breaking changes in the FinalForm | ||
* library. | ||
*/ | ||
export { ReactFinalForm } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type ValuesWithId = Array<{ id: string }> | undefined | ||
|
||
export const arrayWithIdObjects: { | ||
format: (value: ValuesWithId) => string | ||
pars: (value: string) => ValuesWithId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type Validator = (value: unknown) => string | undefined | ||
|
||
export const alphaNumeric: Validator | ||
export const boolean: Validator | ||
export const composeValidators: (...validators: Validator[]) => Validator | ||
|
||
export const createCharacterLengthRange: ( | ||
lowerBound: number, | ||
upperBound: number, | ||
customMessage?: string | ||
) => Validator | ||
export const createEqualTo: (key: string, description?: string) => Validator | ||
export const createMaxCharacterLength: (upperBound: number) => Validator | ||
export const createMaxNumber: (upperBound: number) => Validator | ||
export const createMinCharacterLength: (lowerBound: number) => Validator | ||
export const createMinNumber: (lowerBound: number) => Validator | ||
export const createNumberRange: ( | ||
lowerBound: number, | ||
upperBound: number, | ||
customMessage?: string | ||
) => Validator | ||
export const createPattern: (pattern: RegExp, message?: string) => Validator | ||
export const dhis2Password: Validator | ||
export const dhis2Username: Validator | ||
export const email: Validator | ||
export const hasValue: Validator | ||
export const integer: Validator | ||
export const internationalPhoneNumber: Validator | ||
export const number: Validator | ||
export const string: Validator | ||
export const url: Validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.