From 9faf425919d874052054108fe9cdfc00db97e9df Mon Sep 17 00:00:00 2001 From: plouc Date: Wed, 1 May 2024 13:22:50 +0900 Subject: [PATCH] feat(legends): remove prop-types support --- packages/legends/package.json | 4 +- packages/legends/src/index.ts | 1 - packages/legends/src/props.ts | 76 ----------------------------------- 3 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 packages/legends/src/props.ts diff --git a/packages/legends/package.json b/packages/legends/package.json index 3599ef796..5dc2cafde 100644 --- a/packages/legends/package.json +++ b/packages/legends/package.json @@ -25,9 +25,7 @@ "@nivo/colors": "workspace:*", "@nivo/core": "workspace:*", "@types/d3-scale": "^4.0.8", - "@types/prop-types": "^15.7.2", - "d3-scale": "^4.0.2", - "prop-types": "^15.7.2" + "d3-scale": "^4.0.2" }, "peerDependencies": { "react": ">= 16.14.0 < 19.0.0" diff --git a/packages/legends/src/index.ts b/packages/legends/src/index.ts index ea80ddfa8..401633777 100644 --- a/packages/legends/src/index.ts +++ b/packages/legends/src/index.ts @@ -2,7 +2,6 @@ export * from './svg' export * from './canvas' export * from './defaults' export * from './hooks' -export * from './props' export * from './types' export * from './compute' export * from './defaults' diff --git a/packages/legends/src/props.ts b/packages/legends/src/props.ts deleted file mode 100644 index cef3bf489..000000000 --- a/packages/legends/src/props.ts +++ /dev/null @@ -1,76 +0,0 @@ -import PropTypes from 'prop-types' - -/** - * The prop type is exported as a simple object instead of `PropTypes.shape` - * to be able to add extra properties. - * - * @example - * ```javascript - * import { LegendPropShape } from '@nivo/legends' - * - * const customLegendPropType = PropTypes.shape({ - * ...LegendPropShape, - * extra: PropTypes.any.isRequired, - * }) - * ``` - */ -export const LegendPropShape = { - data: PropTypes.arrayOf(PropTypes.object), - - // position & layout - anchor: PropTypes.oneOf([ - 'top', - 'top-right', - 'right', - 'bottom-right', - 'bottom', - 'bottom-left', - 'left', - 'top-left', - 'center', - ]).isRequired, - translateX: PropTypes.number, - translateY: PropTypes.number, - direction: PropTypes.oneOf(['row', 'column']).isRequired, - - // item - itemsSpacing: PropTypes.number, - itemWidth: PropTypes.number.isRequired, - itemHeight: PropTypes.number.isRequired, - itemDirection: PropTypes.oneOf([ - 'left-to-right', - 'right-to-left', - 'top-to-bottom', - 'bottom-to-top', - ]), - itemTextColor: PropTypes.string, - itemBackground: PropTypes.string, - itemOpacity: PropTypes.number, - - symbolShape: PropTypes.oneOfType([ - PropTypes.oneOf(['circle', 'diamond', 'square', 'triangle']), - PropTypes.func, - ]), - symbolSize: PropTypes.number, - symbolSpacing: PropTypes.number, - symbolBorderWidth: PropTypes.number, - symbolBorderColor: PropTypes.string, - - onClick: PropTypes.func, - onMouseEnter: PropTypes.func, - onMouseLeave: PropTypes.func, - - effects: PropTypes.arrayOf( - PropTypes.shape({ - on: PropTypes.oneOfType([PropTypes.oneOf(['hover'])]).isRequired, - style: PropTypes.shape({ - itemTextColor: PropTypes.string, - itemBackground: PropTypes.string, - itemOpacity: PropTypes.number, - symbolSize: PropTypes.number, - symbolBorderWidth: PropTypes.number, - symbolBorderColor: PropTypes.string, - }).isRequired, - }) - ), -}