|
1 |
| -/* |
2 |
| - * This file is part of the nivo project. |
3 |
| - * |
4 |
| - * Copyright 2016-present, Raphaël Benitte. |
5 |
| - * |
6 |
| - * For the full copyright and license information, please view the LICENSE |
7 |
| - * file that was distributed with this source code. |
8 |
| - */ |
9 | 1 | import { createElement, memo } from 'react'
|
10 | 2 | import PropTypes from 'prop-types'
|
11 | 3 | import { useSpring, animated } from '@react-spring/web'
|
12 |
| -import { dotsThemePropType } from '../../theming' |
| 4 | +import { useTheme } from '../../theming' |
13 | 5 | import { useMotionConfig } from '../../motion'
|
14 | 6 | import DotsItemSymbol from './DotsItemSymbol'
|
15 | 7 |
|
16 | 8 | const DotsItem = ({
|
17 | 9 | x,
|
18 | 10 | y,
|
19 |
| - symbol, |
| 11 | + symbol = DotsItemSymbol, |
20 | 12 | size,
|
21 | 13 | datum,
|
22 | 14 | color,
|
23 | 15 | borderWidth,
|
24 | 16 | borderColor,
|
25 | 17 | label,
|
26 |
| - labelTextAnchor, |
27 |
| - labelYOffset, |
28 |
| - theme, |
| 18 | + labelTextAnchor = 'middle', |
| 19 | + labelYOffset = -12, |
29 | 20 | }) => {
|
30 |
| - const { animate, config: springConfig } = useMotionConfig() |
| 21 | + const theme = useTheme() |
31 | 22 |
|
| 23 | + const { animate, config: springConfig } = useMotionConfig() |
32 | 24 | const animatedProps = useSpring({
|
33 | 25 | transform: `translate(${x}, ${y})`,
|
34 | 26 | config: springConfig,
|
@@ -68,19 +60,6 @@ DotsItem.propTypes = {
|
68 | 60 | label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
69 | 61 | labelTextAnchor: PropTypes.oneOf(['start', 'middle', 'end']),
|
70 | 62 | labelYOffset: PropTypes.number.isRequired,
|
71 |
| - |
72 |
| - theme: PropTypes.shape({ |
73 |
| - dots: dotsThemePropType.isRequired, |
74 |
| - }).isRequired, |
75 | 63 | }
|
76 | 64 |
|
77 |
| -export const DotsItemDefaultProps = { |
78 |
| - symbol: DotsItemSymbol, |
79 |
| - |
80 |
| - labelTextAnchor: 'middle', |
81 |
| - labelYOffset: -12, |
82 |
| -} |
83 |
| - |
84 |
| -DotsItem.defaultProps = DotsItemDefaultProps |
85 |
| - |
86 | 65 | export default memo(DotsItem)
|
0 commit comments