mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana UI: Export prop types for queryfield, modal and field components (#57097)
* chore(grafana-ui): export prop types for queryfield, modal and field components * docs(migration-guide): add notes for react peerdependencies and additional type exposure * Update docs/sources/developers/plugins/migration-guide.md Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com> Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
This commit is contained in:
parent
b7feb34acf
commit
24c04740e3
@ -18,7 +18,9 @@ This guide helps you identify the steps required to update a plugin from the Gra
|
||||
- [Introduction](#introduction)
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [From version 9.1.x to 9.2.x](#from-version-91x-to-92x)
|
||||
- [React and React-dom as peer dependencies](#react-and-react-dom-as-peer-dependencies)
|
||||
- [NavModelItem requires a valid icon name](#navmodelitem-requires-a-valid-icon-name)
|
||||
- [Additional type availability](#additional-type-availability)
|
||||
- [From version 8.x to 9.x](#from-version-8x-to-9x)
|
||||
- [9.0 breaking changes](#90-breaking-changes)
|
||||
- [theme.visualization.getColorByName replaces getColorForTheme](#themevisualizationgetcolorbyname-replaces-getcolorfortheme)
|
||||
@ -64,6 +66,29 @@ This guide helps you identify the steps required to update a plugin from the Gra
|
||||
|
||||
## From version 9.1.x to 9.2.x
|
||||
|
||||
### React and React-dom as peer dependencies
|
||||
|
||||
In earlier versions of Grafana packages `react` and `react-dom` were installed during a `yarn install` regardless of a plugins dependencies. In 9.2.0 the `@grafana` packages declare these react packages as peerDependencies and will need adding to a plugins `package.json` file for test commands to continue to run successfully.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
// before
|
||||
"dependencies": {
|
||||
"@grafana/data": "9.1.0",
|
||||
"@grafana/ui": "9.1.0",
|
||||
},
|
||||
|
||||
// after
|
||||
"dependencies": {
|
||||
"@grafana/data": "9.2.0",
|
||||
"@grafana/ui": "9.2.0",
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2"
|
||||
},
|
||||
|
||||
```
|
||||
|
||||
### NavModelItem requires a valid icon name
|
||||
|
||||
The typings of the `NavModelItem` have improved to only allow a valid `IconName` for the icon property. You can find the complete list of valid icons [here](https://github.com/grafana/grafana/blob/v9.2.0-beta1/packages/grafana-data/src/types/icon.ts). The icons specified in the list will work for older versions of Grafana 9.
|
||||
@ -88,6 +113,16 @@ const model: NavModelItem = {
|
||||
};
|
||||
```
|
||||
|
||||
### Additional type availability
|
||||
|
||||
FieldProps, ModalProps, and QueryFieldProps are now exposed from `@grafana/ui`. They can be imported in the same way as other types.
|
||||
|
||||
Example:
|
||||
|
||||
```ts
|
||||
import { FieldProps, ModalProps, QueryFieldProps } from '@grafana/ui';
|
||||
```
|
||||
|
||||
## From version 8.x to 9.x
|
||||
|
||||
### 9.0 breaking changes
|
||||
|
@ -49,7 +49,7 @@ export { TagList } from './Tags/TagList';
|
||||
export { FilterPill } from './FilterPill/FilterPill';
|
||||
|
||||
export { ConfirmModal, type ConfirmModalProps } from './ConfirmModal/ConfirmModal';
|
||||
export { QueryField } from './QueryField/QueryField';
|
||||
export { QueryField, type QueryFieldProps } from './QueryField/QueryField';
|
||||
|
||||
export { CodeEditor } from './Monaco/CodeEditor';
|
||||
|
||||
@ -66,7 +66,7 @@ export {
|
||||
export { variableSuggestionToCodeEditorSuggestion } from './Monaco/utils';
|
||||
|
||||
// TODO: namespace
|
||||
export { Modal } from './Modal/Modal';
|
||||
export { Modal, type Props as ModalProps } from './Modal/Modal';
|
||||
export { ModalHeader } from './Modal/ModalHeader';
|
||||
export { ModalTabsHeader } from './Modal/ModalTabsHeader';
|
||||
export { ModalTabContent } from './Modal/ModalTabContent';
|
||||
@ -198,7 +198,7 @@ export { fieldMatchersUI } from './MatchersUI/fieldMatchersUI';
|
||||
export { Link } from './Link/Link';
|
||||
|
||||
export { Label } from './Forms/Label';
|
||||
export { Field } from './Forms/Field';
|
||||
export { Field, type FieldProps } from './Forms/Field';
|
||||
export { Legend } from './Forms/Legend';
|
||||
export { FieldSet } from './Forms/FieldSet';
|
||||
export { FieldValidationMessage } from './Forms/FieldValidationMessage';
|
||||
|
Loading…
Reference in New Issue
Block a user