Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions examples/grid-lite/components-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { useState, useRef } from 'react';
import {
type GridInstance,
// type GridRefHandle,
type GridRefHandle,
type GridOptions,
Grid,
Caption
Caption,
Description
} from '@highcharts/grid-lite-react';

function App() {
/* const grid = useRef<GridRefHandle<GridOptions> | null>(null);

const onButtonClick = () => {
console.info('(ref) grid:', grid.current?.grid);
}; */

const onGridCallback = (grid: GridInstance<GridOptions>) => {
console.info('(callback) grid:', grid);
// const grid = useRef<GridRefHandle<GridOptions> | null>(null);
const [description, setDescription] = useState<string>('Grid Description');
const onSetDescriptionClick = () => {
setDescription('This is a new description');
// console.info('(ref) grid:', grid.current?.grid);
};

const [options] = useState<GridOptions>({
Expand All @@ -34,19 +32,19 @@ function App() {
<Grid
options={options}
// gridRef={grid}
callback={onGridCallback}
// callback={(grid) => console.info('(callback) grid:', grid)}
>
<Caption>Grid Caption</Caption>
{/* <Description>Grid Description</Description>
<DataTable>
<Description>{description}</Description>
{ /* <DataTable>
<Column>
<Header>Grid Header</Header>
<Cell>Grid Cell</Cell>
</Column>
</DataTable> */}
{/* <Pagination>Grid Pagination</Pagination> */}
</Grid>
{/* <button onClick={onButtonClick}>Click me</button> */}
<button onClick={onSetDescriptionClick}>Set new description</button>
</>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/grid-lite-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import GridLite from '@highcharts/grid-lite';

export { default as Grid } from './Grid';
export { default as GridLite } from './Grid';
export { Caption } from '@highcharts/grid-shared-react';
export type { GridInstance, GridRefHandle, CaptionProps } from '@highcharts/grid-shared-react';
export { Caption, Description } from '@highcharts/grid-shared-react';
export type { GridInstance, GridRefHandle, CaptionProps, DescriptionProps } from '@highcharts/grid-shared-react';
export type GridOptions = GridLite.Options;
4 changes: 2 additions & 2 deletions packages/grid-pro-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import GridPro from '@highcharts/grid-pro';

export { default as Grid } from './Grid';
export { default as GridPro } from './Grid';
export { Caption } from '@highcharts/grid-shared-react';
export type { GridInstance, GridRefHandle, CaptionProps } from '@highcharts/grid-shared-react';
export { Caption, Description } from '@highcharts/grid-shared-react';
export type { GridInstance, GridRefHandle, CaptionProps, DescriptionProps } from '@highcharts/grid-shared-react';
export type GridOptions = GridPro.Options;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Grid React integration.
* Copyright (c) 2025, Highsoft
*
* A valid license is required for using this software.
* See highcharts.com/license
*
*/

import { ReactNode } from 'react';

export interface DescriptionProps {
/**
* The custom CSS class name for the description.
*/
className?: string;
children?: ReactNode;
}

export function Description(_props: DescriptionProps) {
return null;
}

Description._GridReact = {
type: 'Grid_Option',
gridOption: 'description',
childOption: 'text',
isArrayType: false
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Grid React integration.
* Copyright (c) 2025, Highsoft
*
* A valid license is required for using this software.
* See highcharts.com/license
*
*/

export { Description } from './Description';
export type { DescriptionProps } from './Description';
2 changes: 2 additions & 0 deletions packages/grid-shared-react/src/components/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

export { Caption } from './caption';
export type { CaptionProps } from './caption';
export { Description } from './description';
export type { DescriptionProps } from './description';
4 changes: 2 additions & 2 deletions packages/grid-shared-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { GridType, GridInstance } from './hooks/useGrid';
import type { GridProps, GridRefHandle } from './components/BaseGrid';

export { BaseGrid };
export { Caption } from './components/options';
export { Caption, Description } from './components/options';
export { getChildProps } from './utils/getChildProps';
export type { CaptionProps } from './components/options';
export type { CaptionProps, DescriptionProps } from './components/options';
export type { GridType, GridInstance, GridProps, GridRefHandle };
Loading