@mui/x-charts 7.3.2 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,6 +55,7 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
55
55
  rightAxis,
56
56
  bottomAxis,
57
57
  skipAnimation,
58
+ borderRadius,
58
59
  onItemClick,
59
60
  onAxisClick,
60
61
  children,
@@ -107,7 +108,8 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
107
108
  slots: slots,
108
109
  slotProps: slotProps,
109
110
  skipAnimation: skipAnimation,
110
- onItemClick: onItemClick
111
+ onItemClick: onItemClick,
112
+ borderRadius: borderRadius
111
113
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
112
114
  loading: loading,
113
115
  slots: slots,
@@ -146,6 +148,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
146
148
  x: _propTypes.default.oneOf(['band', 'line', 'none']),
147
149
  y: _propTypes.default.oneOf(['band', 'line', 'none'])
148
150
  }),
151
+ /**
152
+ * Defines the border radius of the bar element.
153
+ */
154
+ borderRadius: _propTypes.default.number,
149
155
  /**
150
156
  * Indicate which axis to display the bottom of the charts.
151
157
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ export interface BarClipPathProps {
3
+ maskId: string;
4
+ borderRadius?: number;
5
+ hasNegative: boolean;
6
+ hasPositive: boolean;
7
+ layout?: 'vertical' | 'horizontal';
8
+ style: {};
9
+ }
10
+ /**
11
+ * @ignore - internal component.
12
+ */
13
+ declare function BarClipPath(props: BarClipPathProps): React.JSX.Element | null;
14
+ export { BarClipPath };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.BarClipPath = BarClipPath;
8
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _web = require("@react-spring/web");
12
+ var _getRadius = require("./getRadius");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ const _excluded = ["style", "maskId"];
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ const buildInset = corners => `inset(0px round ${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px)`;
18
+ function BarClipRect(props) {
19
+ const radiusData = props.ownerState;
20
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
21
+ style: (0, _extends2.default)({}, props.style, {
22
+ clipPath: (props.ownerState.layout === 'vertical' ? props.style?.height : props.style?.width).to(value => buildInset({
23
+ topLeft: Math.min(value, (0, _getRadius.getRadius)('top-left', radiusData)),
24
+ topRight: Math.min(value, (0, _getRadius.getRadius)('top-right', radiusData)),
25
+ bottomRight: Math.min(value, (0, _getRadius.getRadius)('bottom-right', radiusData)),
26
+ bottomLeft: Math.min(value, (0, _getRadius.getRadius)('bottom-left', radiusData))
27
+ }))
28
+ })
29
+ });
30
+ }
31
+ /**
32
+ * @ignore - internal component.
33
+ */
34
+ function BarClipPath(props) {
35
+ const {
36
+ style,
37
+ maskId
38
+ } = props,
39
+ rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
40
+ if (!props.borderRadius || props.borderRadius <= 0) {
41
+ return null;
42
+ }
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
44
+ id: maskId,
45
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BarClipRect, {
46
+ ownerState: rest,
47
+ style: style
48
+ })
49
+ });
50
+ }
@@ -17,6 +17,10 @@ export interface BarPlotProps extends Pick<BarElementProps, 'slots' | 'slotProps
17
17
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
18
18
  */
19
19
  onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier) => void;
20
+ /**
21
+ * Defines the border radius of the bar element.
22
+ */
23
+ borderRadius?: number;
20
24
  }
21
25
  /**
22
26
  * Demos:
@@ -16,8 +16,10 @@ var _BarElement = require("./BarElement");
16
16
  var _axis = require("../models/axis");
17
17
  var _constants = require("../constants");
18
18
  var _getColor = _interopRequireDefault(require("./getColor"));
19
+ var _hooks = require("../hooks");
20
+ var _BarClipPath = require("./BarClipPath");
19
21
  var _jsxRuntime = require("react/jsx-runtime");
20
- const _excluded = ["skipAnimation", "onItemClick"];
22
+ const _excluded = ["skipAnimation", "onItemClick", "borderRadius"];
21
23
  /**
22
24
  * Solution of the equations
23
25
  * W = barWidth * N + offset * (N-1)
@@ -54,6 +56,7 @@ const useAggregatedData = () => {
54
56
  seriesOrder: []
55
57
  };
56
58
  const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
59
+ const chartId = (0, _hooks.useChartId)();
57
60
  const {
58
61
  series,
59
62
  stackingGroups
@@ -66,6 +69,7 @@ const useAggregatedData = () => {
66
69
  } = axisData;
67
70
  const defaultXAxisId = xAxisIds[0];
68
71
  const defaultYAxisId = yAxisIds[0];
72
+ const masks = {};
69
73
  const data = stackingGroups.flatMap(({
70
74
  ids: groupIds
71
75
  }, groupIndex) => {
@@ -119,7 +123,8 @@ const useAggregatedData = () => {
119
123
  const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
120
124
  const minValueCoord = Math.round(Math.min(...valueCoordinates));
121
125
  const maxValueCoord = Math.round(Math.max(...valueCoordinates));
122
- return {
126
+ const stackId = series[seriesId].stack;
127
+ const result = {
123
128
  seriesId,
124
129
  dataIndex,
125
130
  layout: series[seriesId].layout,
@@ -130,14 +135,41 @@ const useAggregatedData = () => {
130
135
  height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
131
136
  width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
132
137
  color: colorGetter(dataIndex),
133
- highlightScope: series[seriesId].highlightScope
138
+ highlightScope: series[seriesId].highlightScope,
139
+ value: series[seriesId].data[dataIndex],
140
+ maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
134
141
  };
142
+ if (!masks[result.maskId]) {
143
+ masks[result.maskId] = {
144
+ id: result.maskId,
145
+ width: 0,
146
+ height: 0,
147
+ hasNegative: false,
148
+ hasPositive: false,
149
+ layout: result.layout,
150
+ xOrigin: xScale(0),
151
+ yOrigin: yScale(0),
152
+ x: 0,
153
+ y: 0
154
+ };
155
+ }
156
+ const mask = masks[result.maskId];
157
+ mask.width = result.layout === 'vertical' ? result.width : mask.width + result.width;
158
+ mask.height = result.layout === 'vertical' ? mask.height + result.height : result.height;
159
+ mask.x = Math.min(mask.x === 0 ? Infinity : mask.x, result.x);
160
+ mask.y = Math.min(mask.y === 0 ? Infinity : mask.y, result.y);
161
+ mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
162
+ mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
163
+ return result;
135
164
  });
136
165
  });
137
166
  });
138
- return data;
167
+ return {
168
+ completedData: data,
169
+ masksData: Object.values(masks)
170
+ };
139
171
  };
140
- const getOutStyle = ({
172
+ const leaveStyle = ({
141
173
  layout,
142
174
  yOrigin,
143
175
  x,
@@ -156,7 +188,7 @@ const getOutStyle = ({
156
188
  height,
157
189
  width: 0
158
190
  });
159
- const getInStyle = ({
191
+ const enterStyle = ({
160
192
  x,
161
193
  width,
162
194
  y,
@@ -180,41 +212,77 @@ const getInStyle = ({
180
212
  * - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
181
213
  */
182
214
  function BarPlot(props) {
183
- const completedData = useAggregatedData();
215
+ const {
216
+ completedData,
217
+ masksData
218
+ } = useAggregatedData();
184
219
  const {
185
220
  skipAnimation,
186
- onItemClick
221
+ onItemClick,
222
+ borderRadius
187
223
  } = props,
188
224
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
189
225
  const transition = (0, _web.useTransition)(completedData, {
190
226
  keys: bar => `${bar.seriesId}-${bar.dataIndex}`,
191
- from: getOutStyle,
192
- leave: getOutStyle,
193
- enter: getInStyle,
194
- update: getInStyle,
227
+ from: leaveStyle,
228
+ leave: leaveStyle,
229
+ enter: enterStyle,
230
+ update: enterStyle,
231
+ immediate: skipAnimation
232
+ });
233
+ const maskTransition = (0, _web.useTransition)(masksData, {
234
+ keys: v => v.id,
235
+ from: leaveStyle,
236
+ leave: leaveStyle,
237
+ enter: enterStyle,
238
+ update: enterStyle,
195
239
  immediate: skipAnimation
196
240
  });
197
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
198
- children: transition((style, {
241
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
242
+ children: [maskTransition((style, {
243
+ id,
244
+ hasPositive,
245
+ hasNegative,
246
+ layout
247
+ }) => {
248
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarClipPath.BarClipPath, {
249
+ maskId: id,
250
+ borderRadius: borderRadius,
251
+ hasNegative: hasNegative,
252
+ hasPositive: hasPositive,
253
+ layout: layout,
254
+ style: style
255
+ });
256
+ }), transition((style, {
199
257
  seriesId,
200
258
  dataIndex,
201
259
  color,
202
- highlightScope
203
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
204
- id: seriesId,
205
- dataIndex: dataIndex,
206
- highlightScope: highlightScope,
207
- color: color
208
- }, other, {
209
- onClick: onItemClick && (event => {
210
- onItemClick(event, {
211
- type: 'bar',
212
- seriesId,
213
- dataIndex
214
- });
215
- }),
216
- style: style
217
- })))
260
+ highlightScope,
261
+ maskId
262
+ }) => {
263
+ const barElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
264
+ id: seriesId,
265
+ dataIndex: dataIndex,
266
+ color: color,
267
+ highlightScope: highlightScope
268
+ }, other, {
269
+ onClick: onItemClick && (event => {
270
+ onItemClick(event, {
271
+ type: 'bar',
272
+ seriesId,
273
+ dataIndex
274
+ });
275
+ }),
276
+ style: style
277
+ }));
278
+ if (!borderRadius || borderRadius <= 0) {
279
+ return barElement;
280
+ }
281
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
282
+ clipPath: `url(#${maskId})`,
283
+ children: barElement
284
+ });
285
+ })]
218
286
  });
219
287
  }
220
288
  process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
@@ -222,6 +290,10 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
222
290
  // | These PropTypes are generated from the TypeScript type definitions |
223
291
  // | To update them edit the TypeScript types and run "yarn proptypes" |
224
292
  // ----------------------------------------------------------------------
293
+ /**
294
+ * Defines the border radius of the bar element.
295
+ */
296
+ borderRadius: _propTypes.default.number,
225
297
  /**
226
298
  * Callback fired when a bar item is clicked.
227
299
  * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
@@ -0,0 +1,15 @@
1
+ type GetRadiusData = {
2
+ hasNegative: boolean;
3
+ hasPositive: boolean;
4
+ borderRadius?: number;
5
+ layout?: 'vertical' | 'horizontal';
6
+ };
7
+ type GetRadiusCorner = 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
8
+ /**
9
+ * Returns if the corner should have a radius or not based on the layout and the data.
10
+ * @param {GetRadiusCorner} corner The corner to check.
11
+ * @param {GetRadiusData} cornerData The data for the corner.
12
+ * @returns {number} The radius for the corner.
13
+ */
14
+ export declare const getRadius: (corner: GetRadiusCorner, { hasNegative, hasPositive, borderRadius, layout }: GetRadiusData) => number;
15
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getRadius = void 0;
7
+ /**
8
+ * Returns if the corner should have a radius or not based on the layout and the data.
9
+ * @param {GetRadiusCorner} corner The corner to check.
10
+ * @param {GetRadiusData} cornerData The data for the corner.
11
+ * @returns {number} The radius for the corner.
12
+ */
13
+ const getRadius = (corner, {
14
+ hasNegative,
15
+ hasPositive,
16
+ borderRadius,
17
+ layout
18
+ }) => {
19
+ if (!borderRadius) {
20
+ return 0;
21
+ }
22
+ const isVertical = layout === 'vertical';
23
+ if (corner === 'top-left' && (isVertical && hasPositive || !isVertical && hasNegative)) {
24
+ return borderRadius;
25
+ }
26
+ if (corner === 'top-right' && (isVertical && hasPositive || !isVertical && hasPositive)) {
27
+ return borderRadius;
28
+ }
29
+ if (corner === 'bottom-right' && (isVertical && hasNegative || !isVertical && hasPositive)) {
30
+ return borderRadius;
31
+ }
32
+ if (corner === 'bottom-left' && (isVertical && hasNegative || !isVertical && hasNegative)) {
33
+ return borderRadius;
34
+ }
35
+ return 0;
36
+ };
37
+ exports.getRadius = getRadius;
@@ -0,0 +1,25 @@
1
+ import type { HighlightScope } from '../context';
2
+ import type { BarSeriesType } from '../models';
3
+ import type { SeriesId } from '../models/seriesType/common';
4
+ export type AnimationData = {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ yOrigin: number;
10
+ xOrigin: number;
11
+ layout: BarSeriesType['layout'];
12
+ };
13
+ export interface CompletedBarData extends AnimationData {
14
+ seriesId: SeriesId;
15
+ dataIndex: number;
16
+ color: string;
17
+ value: number | null;
18
+ highlightScope?: Partial<HighlightScope>;
19
+ maskId: string;
20
+ }
21
+ export interface MaskData extends AnimationData {
22
+ id: string;
23
+ hasNegative: boolean;
24
+ hasPositive: boolean;
25
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/CHANGELOG.md CHANGED
@@ -3,6 +3,73 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.4.0
7
+
8
+ _May 10, 2024_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ✨ Add optional `id` attribute on shortcut items of the Date and Time Pickers
13
+ - 🎁 Add support for `date-fns-jalali` v3 in the Date and Time Pickers
14
+ - 🚀 Support rounded corners on `BarChart`
15
+ - 🌍 Add accessibility page to TreeView docs
16
+ - 🐞 Bugfixes
17
+ - 📚 Documentation improvements
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@7.4.0`
22
+
23
+ - [DataGrid] Fix error when focus moves from column header to `svg` element (#13028) @oukunan
24
+ - [DataGrid] Fix error on column groups change (#12965) @romgrk
25
+
26
+ #### `@mui/x-data-grid-pro@7.4.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
27
+
28
+ Same changes as in `@mui/x-data-grid@7.4.0`.
29
+
30
+ #### `@mui/x-data-grid-premium@7.4.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
31
+
32
+ Same changes as in `@mui/x-data-grid-pro@7.4.0`.
33
+
34
+ ### Date and Time Pickers
35
+
36
+ #### `@mui/x-date-pickers@7.4.0`
37
+
38
+ - [fields] Fix regression preventing form submit on "Enter" click (#13065) @LukasTy
39
+ - [pickers] Add `AdapterDateFnsJalaliV3` adapter (#12891) @smmoosavi
40
+ - [pickers] Add optional `id` attribute on shortcut items (#12976) @noraleonte
41
+
42
+ #### `@mui/x-date-pickers-pro@7.4.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
43
+
44
+ Same changes as in `@mui/x-date-pickers@7.4.0`.
45
+
46
+ ### Charts
47
+
48
+ #### `@mui/x-charts@7.4.0`
49
+
50
+ - [charts] Add `ChartsGrid` to `themeAugmentation` (#13026) @noraleonte
51
+ - [charts] Support rounded corners on `BarChart` (#12834) @JCQuintas
52
+
53
+ ### Tree View
54
+
55
+ #### `@mui/x-tree-view@7.4.0`
56
+
57
+ - [TreeView] Fix props propagation and theme entry in `TreeItem2` (#12889) @flaviendelangle
58
+
59
+ ### Docs
60
+
61
+ - [docs] Add accessibility page to TreeView docs (#12845) @noraleonte
62
+ - [docs] Fix Charts styling typos (#13061) @oliviertassinari
63
+ - [docs] Fix legal link to EULA free trial (#13013) @oliviertassinari
64
+ - [docs] Update interface name in pinned columns docs (#13070) @cherniavskii
65
+
66
+ ### Core
67
+
68
+ - [core] Improve release process docs (#12977) @JCQuintas
69
+ - [core] Prepare React 19 (#12991) @oliviertassinari
70
+ - [docs-infra] Fix Netlify PR preview path (#12993) @oliviertassinari
71
+ - [infra] Automation: Add release PR reviewers (#12982) @michelengelen
72
+
6
73
  ## 7.3.2
7
74
 
8
75
  _May 2, 2024_
@@ -17,8 +84,6 @@ We'd like to offer a big thanks to the 11 contributors who made this release pos
17
84
  - 🐞 Bugfixes
18
85
  - 📚 Documentation improvements
19
86
 
20
- <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
21
-
22
87
  ### Data Grid
23
88
 
24
89
  #### `@mui/x-data-grid@7.3.2`
@@ -21,15 +21,22 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
21
21
  const GridRoot = (0, _styles.styled)('g', {
22
22
  name: 'MuiChartsGrid',
23
23
  slot: 'Root',
24
- overridesResolver: (props, styles) => styles.root
24
+ overridesResolver: (props, styles) => [{
25
+ [`&.${_chartsGridClasses.chartsGridClasses.verticalLine}`]: styles.verticalLine
26
+ }, {
27
+ [`&.${_chartsGridClasses.chartsGridClasses.horizontalLine}`]: styles.horizontalLine
28
+ }, styles.root]
29
+ })({});
30
+ const GridLine = (0, _styles.styled)('line', {
31
+ name: 'MuiChartsGrid',
32
+ slot: 'Line',
33
+ overridesResolver: (props, styles) => styles.line
25
34
  })(({
26
35
  theme
27
36
  }) => ({
28
- [`& .${_chartsGridClasses.chartsGridClasses.line}`]: {
29
- stroke: (theme.vars || theme).palette.divider,
30
- shapeRendering: 'crispEdges',
31
- strokeWidth: 1
32
- }
37
+ stroke: (theme.vars || theme).palette.divider,
38
+ shapeRendering: 'crispEdges',
39
+ strokeWidth: 1
33
40
  }));
34
41
  const useUtilityClasses = ({
35
42
  classes
@@ -51,18 +58,22 @@ const useUtilityClasses = ({
51
58
  * - [ChartsGrid API](https://mui.com/x/api/charts/charts-axis/)
52
59
  */
53
60
  function ChartsGrid(props) {
61
+ const themeProps = (0, _styles.useThemeProps)({
62
+ props,
63
+ name: 'MuiChartsGrid'
64
+ });
54
65
  const {
55
66
  vertical,
56
67
  horizontal
57
- } = props,
58
- other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
68
+ } = themeProps,
69
+ other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
59
70
  const {
60
71
  xAxis,
61
72
  xAxisIds,
62
73
  yAxis,
63
74
  yAxisIds
64
75
  } = React.useContext(_CartesianContextProvider.CartesianContext);
65
- const classes = useUtilityClasses(props);
76
+ const classes = useUtilityClasses(themeProps);
66
77
  const horizontalAxisId = yAxisIds[0];
67
78
  const verticalAxisId = xAxisIds[0];
68
79
  const {
@@ -90,7 +101,7 @@ function ChartsGrid(props) {
90
101
  children: [vertical && xTicks.map(({
91
102
  formattedValue,
92
103
  offset
93
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
104
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridLine, {
94
105
  y1: yScale.range()[0],
95
106
  y2: yScale.range()[1],
96
107
  x1: offset,
@@ -99,7 +110,7 @@ function ChartsGrid(props) {
99
110
  }, `vertical-${formattedValue}`)), horizontal && yTicks.map(({
100
111
  formattedValue,
101
112
  offset
102
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
113
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridLine, {
103
114
  y1: offset,
104
115
  y2: offset,
105
116
  x1: xScale.range()[0],
@@ -46,6 +46,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
46
46
  rightAxis,
47
47
  bottomAxis,
48
48
  skipAnimation,
49
+ borderRadius,
49
50
  onItemClick,
50
51
  onAxisClick,
51
52
  children,
@@ -98,7 +99,8 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
98
99
  slots: slots,
99
100
  slotProps: slotProps,
100
101
  skipAnimation: skipAnimation,
101
- onItemClick: onItemClick
102
+ onItemClick: onItemClick,
103
+ borderRadius: borderRadius
102
104
  }), /*#__PURE__*/_jsx(ChartsOverlay, {
103
105
  loading: loading,
104
106
  slots: slots,
@@ -137,6 +139,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
137
139
  x: PropTypes.oneOf(['band', 'line', 'none']),
138
140
  y: PropTypes.oneOf(['band', 'line', 'none'])
139
141
  }),
142
+ /**
143
+ * Defines the border radius of the bar element.
144
+ */
145
+ borderRadius: PropTypes.number,
140
146
  /**
141
147
  * Indicate which axis to display the bottom of the charts.
142
148
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -0,0 +1,42 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["style", "maskId"];
4
+ import * as React from 'react';
5
+ import { animated } from '@react-spring/web';
6
+ import { getRadius } from './getRadius';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const buildInset = corners => `inset(0px round ${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px)`;
9
+ function BarClipRect(props) {
10
+ const radiusData = props.ownerState;
11
+ return /*#__PURE__*/_jsx(animated.rect, {
12
+ style: _extends({}, props.style, {
13
+ clipPath: (props.ownerState.layout === 'vertical' ? props.style?.height : props.style?.width).to(value => buildInset({
14
+ topLeft: Math.min(value, getRadius('top-left', radiusData)),
15
+ topRight: Math.min(value, getRadius('top-right', radiusData)),
16
+ bottomRight: Math.min(value, getRadius('bottom-right', radiusData)),
17
+ bottomLeft: Math.min(value, getRadius('bottom-left', radiusData))
18
+ }))
19
+ })
20
+ });
21
+ }
22
+ /**
23
+ * @ignore - internal component.
24
+ */
25
+ function BarClipPath(props) {
26
+ const {
27
+ style,
28
+ maskId
29
+ } = props,
30
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
31
+ if (!props.borderRadius || props.borderRadius <= 0) {
32
+ return null;
33
+ }
34
+ return /*#__PURE__*/_jsx("clipPath", {
35
+ id: maskId,
36
+ children: /*#__PURE__*/_jsx(BarClipRect, {
37
+ ownerState: rest,
38
+ style: style
39
+ })
40
+ });
41
+ }
42
+ export { BarClipPath };