react-d3-utils
Advanced tools
Comparing version 0.5.1 to 0.6.0
# Changelog | ||
## [0.6.0](https://www.github.com/zakodium-oss/react-d3-utils/compare/v0.5.1...v0.6.0) (2022-10-19) | ||
### Features | ||
* update ResponsiveChart props types ([8b10c3a](https://www.github.com/zakodium-oss/react-d3-utils/commit/8b10c3aa7cd9e489d9aff1c2bc21df4a3e36f3dd)) | ||
### [0.5.1](https://www.github.com/zakodium-oss/react-d3-utils/compare/v0.5.0...v0.5.1) (2022-05-16) | ||
@@ -4,0 +11,0 @@ |
import { ReactNode } from 'react'; | ||
export interface ResponsiveChartProps { | ||
width?: number; | ||
height?: number; | ||
minWidth?: number; | ||
minHeight?: number; | ||
maxWidth?: number; | ||
maxHeight?: number; | ||
width?: number | `${number}%`; | ||
height?: number | `${number}%`; | ||
minWidth?: number | `${number}%`; | ||
minHeight?: number | `${number}%`; | ||
maxWidth?: number | `${number}%`; | ||
maxHeight?: number | `${number}%`; | ||
children: (size: { | ||
@@ -10,0 +10,0 @@ width: number; |
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import useResizeObserver from 'use-resize-observer'; | ||
export function ResponsiveChart(props) { | ||
const { width, height, minWidth, minHeight, maxWidth, maxHeight, children, } = props; | ||
const { width, height, minWidth, minHeight, maxWidth, maxHeight, children } = props; | ||
const observed = useResizeObserver(); | ||
@@ -12,4 +12,4 @@ return (_jsx("div", { ref: observed.ref, style: { | ||
minHeight: minHeight || 0, | ||
maxWidth: maxWidth, | ||
maxHeight: maxHeight, | ||
maxWidth, | ||
maxHeight, | ||
}, children: observed.width && observed.height | ||
@@ -16,0 +16,0 @@ ? children({ width: observed.width, height: observed.height }) |
@@ -10,3 +10,3 @@ "use strict"; | ||
function ResponsiveChart(props) { | ||
const { width, height, minWidth, minHeight, maxWidth, maxHeight, children, } = props; | ||
const { width, height, minWidth, minHeight, maxWidth, maxHeight, children } = props; | ||
const observed = (0, use_resize_observer_1.default)(); | ||
@@ -19,4 +19,4 @@ return ((0, jsx_runtime_1.jsx)("div", { ref: observed.ref, style: { | ||
minHeight: minHeight || 0, | ||
maxWidth: maxWidth, | ||
maxHeight: maxHeight, | ||
maxWidth, | ||
maxHeight, | ||
}, children: observed.width && observed.height | ||
@@ -23,0 +23,0 @@ ? children({ width: observed.width, height: observed.height }) |
{ | ||
"name": "react-d3-utils", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "Low-level utilities to build charts with React and D3", | ||
@@ -37,17 +37,17 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.17.10", | ||
"@babel/core": "^7.19.3", | ||
"@simbathesailor/use-what-changed": "^2.0.0", | ||
"@storybook/addon-actions": "^6.4.22", | ||
"@storybook/addon-essentials": "^6.4.22", | ||
"@storybook/addon-links": "^6.4.22", | ||
"@storybook/addon-storysource": "^6.4.22", | ||
"@storybook/react": "^6.4.22", | ||
"@storybook/addon-actions": "^6.5.12", | ||
"@storybook/addon-essentials": "^6.5.12", | ||
"@storybook/addon-links": "^6.5.12", | ||
"@storybook/addon-storysource": "^6.5.12", | ||
"@storybook/react": "^6.5.12", | ||
"@types/react": "^17.0.38", | ||
"@zakodium/eslint-config": "^5.1.1", | ||
"@zakodium/eslint-config": "^6.0.0", | ||
"babel-loader": "^8.2.5", | ||
"eslint": "^8.15.0", | ||
"prettier": "^2.6.2", | ||
"eslint": "^8.24.0", | ||
"prettier": "^2.7.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"typescript": "^4.6.4" | ||
"typescript": "^4.8.4" | ||
}, | ||
@@ -57,3 +57,3 @@ "dependencies": { | ||
"d3-scale": "^4.0.2", | ||
"use-resize-observer": "^9.0.0" | ||
"use-resize-observer": "^9.0.2" | ||
}, | ||
@@ -60,0 +60,0 @@ "volta": { |
Sorry, the diff of this file is not supported yet
43474
Updateduse-resize-observer@^9.0.2