Skip to content

Commit

Permalink
Merge pull request #1430 from dhis2/alpha
Browse files Browse the repository at this point in the history
* 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
4 people authored Dec 8, 2023
2 parents 26c033f + 3467423 commit 1f4df55
Show file tree
Hide file tree
Showing 126 changed files with 4,677 additions and 412 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.yarn/
utilities/icons/src/react/**/*.js
**/locales/
*.d.ts
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const config = {
'*.stories*.js',
'**/__stories__/*.js',
'**/__stories__/**/*.js',
'*.d.ts',
],
rules: {
'import/no-extraneous-dependencies': 'error',
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [9.0.0-alpha.2](https://github.com/dhis2/ui/compare/v9.0.0-alpha.1...v9.0.0-alpha.2) (2023-12-08)


### Features

* **menu-item:** add suffix prop ([77cd949](https://github.com/dhis2/ui/commit/77cd94953cf8c14b21373c53d055a8f8ed68110d))

# [8.16.0](https://github.com/dhis2/ui/compare/v8.15.1...v8.16.0) (2023-12-07)


Expand Down
27 changes: 15 additions & 12 deletions collections/forms/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@dhis2/ui-forms",
"version": "8.16.0",
"version": "9.0.0-alpha.2",
"main": "./build/cjs/index.js",
"module": "./build/es/index.js",
"sideEffects": [
"build/es/locales/index.js",
"build/cjs/locales/index.js"
],
"exports": {
"types": "./types/index.d.ts",
"import": "./build/es/index.js",
"require": "./build/cjs/index.js"
},
Expand All @@ -34,25 +35,27 @@
},
"dependencies": {
"@dhis2/prop-types": "^3.1.2",
"@dhis2-ui/button": "8.16.0",
"@dhis2-ui/checkbox": "8.16.0",
"@dhis2-ui/field": "8.16.0",
"@dhis2-ui/file-input": "8.16.0",
"@dhis2-ui/input": "8.16.0",
"@dhis2-ui/radio": "8.16.0",
"@dhis2-ui/select": "8.16.0",
"@dhis2-ui/switch": "8.16.0",
"@dhis2-ui/text-area": "8.16.0",
"@dhis2-ui/button": "9.0.0-alpha.2",
"@dhis2-ui/checkbox": "9.0.0-alpha.2",
"@dhis2-ui/field": "9.0.0-alpha.2",
"@dhis2-ui/file-input": "9.0.0-alpha.2",
"@dhis2-ui/input": "9.0.0-alpha.2",
"@dhis2-ui/radio": "9.0.0-alpha.2",
"@dhis2-ui/select": "9.0.0-alpha.2",
"@dhis2-ui/switch": "9.0.0-alpha.2",
"@dhis2-ui/text-area": "9.0.0-alpha.2",
"classnames": "^2.3.1",
"final-form": "^4.20.2",
"prop-types": "^15.7.2",
"react-final-form": "^6.5.3"
},
"files": [
"build"
"build",
"types"
],
"devDependencies": {
"react": "16.13",
"react-dom": "16.13"
}
},
"types": "types"
}
16 changes: 16 additions & 0 deletions collections/forms/types/CheckboxFieldFF/CheckboxFieldFF.d.ts
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>
9 changes: 9 additions & 0 deletions collections/forms/types/FieldGroupFF/FieldGroupFF.d.ts
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 collections/forms/types/FileInputFieldFF/FileInputFieldFF.d.ts
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>
15 changes: 15 additions & 0 deletions collections/forms/types/InputFieldFF/InputFieldFF.d.ts
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 collections/forms/types/MultiSelectFieldFF/MutliSelectFieldFF.d.ts
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>
17 changes: 17 additions & 0 deletions collections/forms/types/RadioFieldFF/RadioFieldFF.d.ts
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>
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>
15 changes: 15 additions & 0 deletions collections/forms/types/SwitchFieldFF/SwitchFieldFF.d.ts
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 collections/forms/types/TextAreaFieldFF/TextAreaFieldFF.d.ts
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>
28 changes: 28 additions & 0 deletions collections/forms/types/index.d.ts
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 }
6 changes: 6 additions & 0 deletions collections/forms/types/transformers/index.d.ts
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
}
31 changes: 31 additions & 0 deletions collections/forms/types/validators/index.d.ts
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
37 changes: 37 additions & 0 deletions collections/ui/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,43 @@ import { NoticeBox } from '@dhis2/ui'
|valid|custom|||Applies 'valid' message styles. Mutually exclusive with the `error` and `warning` props|
|warning|custom|||Applies 'warning' message styles. Mutually exclusive with the `error` and `valid` props|

### OrganisationUnitTreeRootError

#### Usage

**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.


```js
import { OrganisationUnitTreeRootError } from '@dhis2/ui'
```


#### Props

|Name|Type|Default|Required|Description|
|---|---|---|---|---|
|error|string||*||
|dataTest|string|`'dhis2-uiwidgets-orgunittree-error'`|||

### OrganisationUnitTreeRootLoading

#### Usage

**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.


```js
import { OrganisationUnitTreeRootLoading } from '@dhis2/ui'
```


#### Props

|Name|Type|Default|Required|Description|
|---|---|---|---|---|
|dataTest|string|`'dhis2-uiwidgets-orgunittree-loading'`|||

### OrganisationUnitTree

#### Usage
Expand Down
Loading

0 comments on commit 1f4df55

Please sign in to comment.