diff --git a/superset-frontend/.storybook/shared/ResizablePanel.tsx b/superset-frontend/.storybook/shared/ResizablePanel.tsx index 3ac33c57052..bf6bdbfdca4 100644 --- a/superset-frontend/.storybook/shared/ResizablePanel.tsx +++ b/superset-frontend/.storybook/shared/ResizablePanel.tsx @@ -17,12 +17,8 @@ * under the License. */ -import { PropsWithChildren, ReactNode, SyntheticEvent } from 'react'; -import { - ResizableBox, - ResizableBoxProps, - ResizeCallbackData, -} from 'react-resizable'; +import { ReactNode, SyntheticEvent } from 'react'; +import { ResizableBox, ResizeCallbackData } from 'react-resizable'; import { styled } from '@apache-superset/core/theme'; import 'react-resizable/css/styles.css'; @@ -46,14 +42,16 @@ export type Size = ResizeCallbackData['size']; export default function ResizablePanel({ children, - heading = undefined, + heading, initialSize = { width: 500, height: 300 }, minConstraints = [100, 100] as [number, number], onResize, - ...props -}: PropsWithChildren> & { +}: { + children?: ReactNode; heading?: ReactNode; initialSize?: Size; + minConstraints?: [number, number]; + onResize?: (e: SyntheticEvent, data: ResizeCallbackData) => void; }) { const { width, height } = initialSize; return ( @@ -61,16 +59,14 @@ export default function ResizablePanel({ className="panel" width={width} height={height} + axis="both" minConstraints={minConstraints} - onResize={ - onResize - ? (e: SyntheticEvent, data: ResizeCallbackData) => { - const { size } = data; - onResize(e, { ...data, size }); - } - : undefined - } - {...props} + maxConstraints={[Infinity, Infinity]} + handleSize={[20, 20]} + lockAspectRatio={false} + resizeHandles={['se']} + transformScale={1} + onResize={onResize} > <> {heading ?
{heading}
: null} diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index d7f21f69b02..5aad7fa914c 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -213,7 +213,7 @@ "@types/react-dom": "^18.2.0", "@types/react-loadable": "^5.5.11", "@types/react-redux": "^7.1.10", - "@types/react-resizable": "^3.0.8", + "@types/react-resizable": "^4.0.0", "@types/react-router-dom": "^5.3.3", "@types/react-transition-group": "^4.4.12", "@types/react-window": "^1.8.8", @@ -275,7 +275,7 @@ "prettier-plugin-packagejson": "^3.0.2", "process": "^0.11.10", "react-refresh": "^0.18.0", - "react-resizable": "^3.1.3", + "react-resizable": "^4.0.1", "redux-mock-store": "^1.5.4", "source-map": "^0.7.6", "source-map-support": "^0.5.21", @@ -13796,12 +13796,14 @@ } }, "node_modules/@types/react-resizable": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/@types/react-resizable/-/react-resizable-3.0.8.tgz", - "integrity": "sha512-Pcvt2eGA7KNXldt1hkhVhAgZ8hK41m0mp89mFgQi7LAAEZiaLgm4fHJ5zbJZ/4m2LVaAyYrrRRv1LHDcrGQanA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/react-resizable/-/react-resizable-4.0.0.tgz", + "integrity": "sha512-zEMfyoFP/I6L796+dIjXeAVL2q7C4vwCXwQW2be79uPZAQLsI/pU1NOVqqfVQG3FkIxr/n96KjhzdRnWGZcTcg==", + "deprecated": "This is a stub types definition. react-resizable provides its own type definitions, so you do not need this installed.", "dev": true, + "license": "MIT", "dependencies": { - "@types/react": "*" + "react-resizable": "*" } }, "node_modules/@types/react-router": { @@ -40804,9 +40806,9 @@ } }, "node_modules/react-resizable": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/react-resizable/-/react-resizable-3.1.3.tgz", - "integrity": "sha512-liJBNayhX7qA4tBJiBD321FDhJxgGTJ07uzH5zSORXoE8h7PyEZ8mLqmosST7ppf6C4zUsbd2gzDMmBCfFp9Lw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/react-resizable/-/react-resizable-4.0.1.tgz", + "integrity": "sha512-FR25Rcfxpi1iKiC7taIrqc1Tz6VnslqM94/IrA1LxoM5C3ap2EqaKLnCit/aKrcn3H4wfzO0nFBadFBc+SzEWA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 3a1c8caf0be..f0910841a57 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -294,7 +294,7 @@ "@types/react-dom": "^18.2.0", "@types/react-loadable": "^5.5.11", "@types/react-redux": "^7.1.10", - "@types/react-resizable": "^3.0.8", + "@types/react-resizable": "^4.0.0", "@types/react-router-dom": "^5.3.3", "@types/react-transition-group": "^4.4.12", "@types/react-window": "^1.8.8", @@ -356,7 +356,7 @@ "prettier-plugin-packagejson": "^3.0.2", "process": "^0.11.10", "react-refresh": "^0.18.0", - "react-resizable": "^3.1.3", + "react-resizable": "^4.0.1", "redux-mock-store": "^1.5.4", "source-map": "^0.7.6", "source-map-support": "^0.5.21",