@mui/x-data-grid 8.29.2 → 8.29.3

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,78 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.29.3
9
+
10
+ _Aug 21, 2026_
11
+
12
+ We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🐞 Bugfixes
15
+
16
+ The following team members contributed to this release:
17
+ @LukasTy, @MBilalShafi
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@8.29.3`
22
+
23
+ - [DataGrid] Fix toolbar button stealing focus when a sibling's disabled state changes (#23265) @MBilalShafi
24
+
25
+ #### `@mui/x-data-grid-pro@8.29.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
26
+
27
+ Same changes as in `@mui/x-data-grid@8.29.3`.
28
+
29
+ #### `@mui/x-data-grid-premium@8.29.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
30
+
31
+ Same changes as in `@mui/x-data-grid-pro@8.29.3`.
32
+
33
+ ### Date and Time Pickers
34
+
35
+ #### `@mui/x-date-pickers@8.29.3`
36
+
37
+ - [fields] Keep the field editable on blank space clicks (#23372) @LukasTy
38
+ - [pickers] Fix format placeholder brightness with a start adornment (#23205) @LukasTy
39
+
40
+ #### `@mui/x-date-pickers-pro@8.29.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
41
+
42
+ Same changes as in `@mui/x-date-pickers@8.29.3`, plus:
43
+
44
+ - [DateRangePicker] Fix broken active range position underline in single input range fields (#23201) @LukasTy
45
+
46
+ ### Charts
47
+
48
+ #### `@mui/x-charts@8.29.3`
49
+
50
+ Internal changes.
51
+
52
+ #### `@mui/x-charts-pro@8.29.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
53
+
54
+ Same changes as in `@mui/x-charts@8.29.3`.
55
+
56
+ #### `@mui/x-charts-premium@8.29.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
57
+
58
+ Same changes as in `@mui/x-charts-pro@8.29.3`.
59
+
60
+ ### Tree View
61
+
62
+ #### `@mui/x-tree-view@8.29.3`
63
+
64
+ Internal changes.
65
+
66
+ #### `@mui/x-tree-view-pro@8.29.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
67
+
68
+ Same changes as in `@mui/x-tree-view@8.29.3`.
69
+
70
+ ### Codemod
71
+
72
+ #### `@mui/x-codemod@8.29.3`
73
+
74
+ Internal changes.
75
+
76
+ ### Miscellaneous
77
+
78
+ - [core] Fix `test-react-18` install failure on v8.x (#23202) @LukasTy
79
+
8
80
  ## 8.29.2
9
81
 
10
82
  _Jul 2, 2026_
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  /**
5
5
  * A function to customize rendering of the component.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
4
4
  /**
5
5
  * A function to customize rendering of the component.
@@ -16,11 +16,10 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
16
16
  var _clsx = _interopRequireDefault(require("clsx"));
17
17
  var _forwardRef = require("@mui/x-internals/forwardRef");
18
18
  var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
19
+ var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
19
20
  var _cssVariables = require("../../constants/cssVariables");
20
21
  var _gridClasses = require("../../constants/gridClasses");
21
- var _ToolbarContext = require("./ToolbarContext");
22
22
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
23
- var _utils = require("./utils");
24
23
  var _jsxRuntime = require("react/jsx-runtime");
25
24
  const _excluded = ["render", "className"];
26
25
  const useUtilityClasses = ownerState => {
@@ -67,127 +66,6 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
67
66
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
68
67
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
69
68
  const classes = useUtilityClasses(rootProps);
70
- const [focusableItemId, setFocusableItemId] = React.useState(null);
71
- const [items, setItems] = React.useState([]);
72
- const getSortedItems = React.useCallback(() => items.sort(_utils.sortByDocumentPosition), [items]);
73
- const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
74
- let index = startIndex;
75
- const sortedItems = getSortedItems();
76
- const itemCount = sortedItems.length;
77
-
78
- // Look for enabled items in the specified direction
79
- for (let i = 0; i < itemCount; i += 1) {
80
- index += step;
81
-
82
- // Handle wrapping around the ends
83
- if (index >= itemCount) {
84
- if (!wrap) {
85
- return -1;
86
- }
87
- index = 0;
88
- } else if (index < 0) {
89
- if (!wrap) {
90
- return -1;
91
- }
92
- index = itemCount - 1;
93
- }
94
-
95
- // Return if we found an enabled item
96
- if (!sortedItems[index].ref.current?.disabled && sortedItems[index].ref.current?.ariaDisabled !== 'true') {
97
- return index;
98
- }
99
- }
100
-
101
- // If we've checked all items and found none enabled
102
- return -1;
103
- }, [getSortedItems]);
104
- const registerItem = React.useCallback((id, itemRef) => {
105
- setItems(prevItems => [...prevItems, {
106
- id,
107
- ref: itemRef
108
- }]);
109
- }, []);
110
- const unregisterItem = React.useCallback(id => {
111
- setItems(prevItems => prevItems.filter(i => i.id !== id));
112
- }, []);
113
- const onItemKeyDown = React.useCallback(event => {
114
- if (!focusableItemId) {
115
- return;
116
- }
117
- const sortedItems = getSortedItems();
118
- const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
119
- let newIndex = -1;
120
- if (event.key === 'ArrowRight') {
121
- event.preventDefault();
122
- newIndex = findEnabledItem(focusableItemIndex, 1);
123
- } else if (event.key === 'ArrowLeft') {
124
- event.preventDefault();
125
- newIndex = findEnabledItem(focusableItemIndex, -1);
126
- } else if (event.key === 'Home') {
127
- event.preventDefault();
128
- newIndex = findEnabledItem(-1, 1, false);
129
- } else if (event.key === 'End') {
130
- event.preventDefault();
131
- newIndex = findEnabledItem(sortedItems.length, -1, false);
132
- }
133
-
134
- // TODO: Check why this is necessary
135
- if (newIndex >= 0 && newIndex < sortedItems.length) {
136
- const item = sortedItems[newIndex];
137
- setFocusableItemId(item.id);
138
- item.ref.current?.focus();
139
- }
140
- }, [getSortedItems, focusableItemId, findEnabledItem]);
141
- const onItemFocus = React.useCallback(id => {
142
- if (focusableItemId !== id) {
143
- setFocusableItemId(id);
144
- }
145
- }, [focusableItemId, setFocusableItemId]);
146
- const onItemDisabled = React.useCallback(id => {
147
- const sortedItems = getSortedItems();
148
- const currentIndex = sortedItems.findIndex(item => item.id === id);
149
- const newIndex = findEnabledItem(currentIndex, 1);
150
- if (newIndex >= 0 && newIndex < sortedItems.length) {
151
- const item = sortedItems[newIndex];
152
- setFocusableItemId(item.id);
153
- item.ref.current?.focus();
154
- }
155
- }, [getSortedItems, findEnabledItem]);
156
- React.useEffect(() => {
157
- const sortedItems = getSortedItems();
158
- if (sortedItems.length > 0) {
159
- // Set initial focusable item
160
- if (!focusableItemId) {
161
- setFocusableItemId(sortedItems[0].id);
162
- return;
163
- }
164
- const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
165
- if (!sortedItems[focusableItemIndex]) {
166
- // Last item has been removed from the items array
167
- const item = sortedItems[sortedItems.length - 1];
168
- if (item) {
169
- setFocusableItemId(item.id);
170
- item.ref.current?.focus();
171
- }
172
- } else if (focusableItemIndex === -1) {
173
- // Focused item has been removed from the items array
174
- const item = sortedItems[focusableItemIndex];
175
- if (item) {
176
- setFocusableItemId(item.id);
177
- item.ref.current?.focus();
178
- }
179
- }
180
- }
181
- // eslint-disable-next-line react-hooks/exhaustive-deps
182
- }, [getSortedItems, findEnabledItem]);
183
- const contextValue = React.useMemo(() => ({
184
- focusableItemId,
185
- registerItem,
186
- unregisterItem,
187
- onItemKeyDown,
188
- onItemFocus,
189
- onItemDisabled
190
- }), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
191
69
  const element = (0, _useComponentRenderer.useComponentRenderer)(ToolbarRoot, render, (0, _extends2.default)({
192
70
  role: 'toolbar',
193
71
  'aria-orientation': 'horizontal',
@@ -196,8 +74,7 @@ const Toolbar = exports.Toolbar = (0, _forwardRef.forwardRef)(function Toolbar(p
196
74
  }, other, {
197
75
  ref
198
76
  }));
199
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContext.Provider, {
200
- value: contextValue,
77
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContextProvider, {
201
78
  children: element
202
79
  });
203
80
  });
@@ -10,11 +10,10 @@ import composeClasses from '@mui/utils/composeClasses';
10
10
  import clsx from 'clsx';
11
11
  import { forwardRef } from '@mui/x-internals/forwardRef';
12
12
  import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
13
+ import { ToolbarContextProvider } from '@mui/x-internals/ToolbarContext';
13
14
  import { vars } from "../../constants/cssVariables.mjs";
14
15
  import { getDataGridUtilityClass } from "../../constants/gridClasses.mjs";
15
- import { ToolbarContext } from "./ToolbarContext.mjs";
16
16
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.mjs";
17
- import { sortByDocumentPosition } from "./utils.mjs";
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  const useUtilityClasses = ownerState => {
20
19
  const {
@@ -60,127 +59,6 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
60
59
  other = _objectWithoutPropertiesLoose(props, _excluded);
61
60
  const rootProps = useGridRootProps();
62
61
  const classes = useUtilityClasses(rootProps);
63
- const [focusableItemId, setFocusableItemId] = React.useState(null);
64
- const [items, setItems] = React.useState([]);
65
- const getSortedItems = React.useCallback(() => items.sort(sortByDocumentPosition), [items]);
66
- const findEnabledItem = React.useCallback((startIndex, step, wrap = true) => {
67
- let index = startIndex;
68
- const sortedItems = getSortedItems();
69
- const itemCount = sortedItems.length;
70
-
71
- // Look for enabled items in the specified direction
72
- for (let i = 0; i < itemCount; i += 1) {
73
- index += step;
74
-
75
- // Handle wrapping around the ends
76
- if (index >= itemCount) {
77
- if (!wrap) {
78
- return -1;
79
- }
80
- index = 0;
81
- } else if (index < 0) {
82
- if (!wrap) {
83
- return -1;
84
- }
85
- index = itemCount - 1;
86
- }
87
-
88
- // Return if we found an enabled item
89
- if (!sortedItems[index].ref.current?.disabled && sortedItems[index].ref.current?.ariaDisabled !== 'true') {
90
- return index;
91
- }
92
- }
93
-
94
- // If we've checked all items and found none enabled
95
- return -1;
96
- }, [getSortedItems]);
97
- const registerItem = React.useCallback((id, itemRef) => {
98
- setItems(prevItems => [...prevItems, {
99
- id,
100
- ref: itemRef
101
- }]);
102
- }, []);
103
- const unregisterItem = React.useCallback(id => {
104
- setItems(prevItems => prevItems.filter(i => i.id !== id));
105
- }, []);
106
- const onItemKeyDown = React.useCallback(event => {
107
- if (!focusableItemId) {
108
- return;
109
- }
110
- const sortedItems = getSortedItems();
111
- const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
112
- let newIndex = -1;
113
- if (event.key === 'ArrowRight') {
114
- event.preventDefault();
115
- newIndex = findEnabledItem(focusableItemIndex, 1);
116
- } else if (event.key === 'ArrowLeft') {
117
- event.preventDefault();
118
- newIndex = findEnabledItem(focusableItemIndex, -1);
119
- } else if (event.key === 'Home') {
120
- event.preventDefault();
121
- newIndex = findEnabledItem(-1, 1, false);
122
- } else if (event.key === 'End') {
123
- event.preventDefault();
124
- newIndex = findEnabledItem(sortedItems.length, -1, false);
125
- }
126
-
127
- // TODO: Check why this is necessary
128
- if (newIndex >= 0 && newIndex < sortedItems.length) {
129
- const item = sortedItems[newIndex];
130
- setFocusableItemId(item.id);
131
- item.ref.current?.focus();
132
- }
133
- }, [getSortedItems, focusableItemId, findEnabledItem]);
134
- const onItemFocus = React.useCallback(id => {
135
- if (focusableItemId !== id) {
136
- setFocusableItemId(id);
137
- }
138
- }, [focusableItemId, setFocusableItemId]);
139
- const onItemDisabled = React.useCallback(id => {
140
- const sortedItems = getSortedItems();
141
- const currentIndex = sortedItems.findIndex(item => item.id === id);
142
- const newIndex = findEnabledItem(currentIndex, 1);
143
- if (newIndex >= 0 && newIndex < sortedItems.length) {
144
- const item = sortedItems[newIndex];
145
- setFocusableItemId(item.id);
146
- item.ref.current?.focus();
147
- }
148
- }, [getSortedItems, findEnabledItem]);
149
- React.useEffect(() => {
150
- const sortedItems = getSortedItems();
151
- if (sortedItems.length > 0) {
152
- // Set initial focusable item
153
- if (!focusableItemId) {
154
- setFocusableItemId(sortedItems[0].id);
155
- return;
156
- }
157
- const focusableItemIndex = sortedItems.findIndex(item => item.id === focusableItemId);
158
- if (!sortedItems[focusableItemIndex]) {
159
- // Last item has been removed from the items array
160
- const item = sortedItems[sortedItems.length - 1];
161
- if (item) {
162
- setFocusableItemId(item.id);
163
- item.ref.current?.focus();
164
- }
165
- } else if (focusableItemIndex === -1) {
166
- // Focused item has been removed from the items array
167
- const item = sortedItems[focusableItemIndex];
168
- if (item) {
169
- setFocusableItemId(item.id);
170
- item.ref.current?.focus();
171
- }
172
- }
173
- }
174
- // eslint-disable-next-line react-hooks/exhaustive-deps
175
- }, [getSortedItems, findEnabledItem]);
176
- const contextValue = React.useMemo(() => ({
177
- focusableItemId,
178
- registerItem,
179
- unregisterItem,
180
- onItemKeyDown,
181
- onItemFocus,
182
- onItemDisabled
183
- }), [focusableItemId, registerItem, unregisterItem, onItemKeyDown, onItemFocus, onItemDisabled]);
184
62
  const element = useComponentRenderer(ToolbarRoot, render, _extends({
185
63
  role: 'toolbar',
186
64
  'aria-orientation': 'horizontal',
@@ -189,8 +67,7 @@ const Toolbar = forwardRef(function Toolbar(props, ref) {
189
67
  }, other, {
190
68
  ref
191
69
  }));
192
- return /*#__PURE__*/_jsx(ToolbarContext.Provider, {
193
- value: contextValue,
70
+ return /*#__PURE__*/_jsx(ToolbarContextProvider, {
194
71
  children: element
195
72
  });
196
73
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.mjs";
4
4
  export type ToolbarButtonProps = GridSlotProps['baseIconButton'] & {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
2
+ import type { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
3
  import type { GridSlotProps } from "../../models/index.js";
4
4
  export type ToolbarButtonProps = GridSlotProps['baseIconButton'] & {
5
5
  /**
@@ -12,13 +12,13 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
15
- var _useId = _interopRequireDefault(require("@mui/utils/useId"));
16
15
  var _forwardRef = require("@mui/x-internals/forwardRef");
17
16
  var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
17
+ var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
18
18
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
19
- var _ToolbarContext = require("./ToolbarContext");
20
19
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"];
20
+ const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
21
+ _excluded2 = ["tabIndex"];
22
22
  /**
23
23
  * A button for performing actions from the toolbar.
24
24
  * It renders the `baseIconButton` slot.
@@ -33,59 +33,20 @@ const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"
33
33
  */
34
34
  const ToolbarButton = exports.ToolbarButton = (0, _forwardRef.forwardRef)(function ToolbarButton(props, ref) {
35
35
  const {
36
- render,
37
- onKeyDown,
38
- onFocus,
39
- disabled,
40
- 'aria-disabled': ariaDisabled
36
+ render
41
37
  } = props,
42
38
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
43
- const id = (0, _useId.default)();
44
39
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
45
40
  const buttonRef = React.useRef(null);
46
41
  const handleRef = (0, _useForkRef.default)(buttonRef, ref);
47
- const {
48
- focusableItemId,
49
- registerItem,
50
- unregisterItem,
51
- onItemKeyDown,
52
- onItemFocus,
53
- onItemDisabled
54
- } = (0, _ToolbarContext.useToolbarContext)();
55
- const handleKeyDown = event => {
56
- onItemKeyDown(event);
57
- onKeyDown?.(event);
58
- };
59
- const handleFocus = event => {
60
- onItemFocus(id);
61
- onFocus?.(event);
62
- };
63
- React.useEffect(() => {
64
- registerItem(id, buttonRef);
65
- return () => unregisterItem(id);
66
- // eslint-disable-next-line react-hooks/exhaustive-deps
67
- }, []);
68
- const previousDisabled = React.useRef(disabled);
69
- React.useEffect(() => {
70
- if (previousDisabled.current !== disabled && disabled === true) {
71
- onItemDisabled(id, disabled);
72
- }
73
- previousDisabled.current = disabled;
74
- }, [disabled, id, onItemDisabled]);
75
- const previousAriaDisabled = React.useRef(ariaDisabled);
76
- React.useEffect(() => {
77
- if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
78
- onItemDisabled(id, true);
79
- }
80
- previousAriaDisabled.current = ariaDisabled;
81
- }, [ariaDisabled, id, onItemDisabled]);
42
+ const _useRegisterToolbarBu = (0, _ToolbarContext.useRegisterToolbarButton)(props, buttonRef),
43
+ {
44
+ tabIndex
45
+ } = _useRegisterToolbarBu,
46
+ toolbarButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_useRegisterToolbarBu, _excluded2);
82
47
  const element = (0, _useComponentRenderer.useComponentRenderer)(rootProps.slots.baseIconButton, render, (0, _extends2.default)({}, rootProps.slotProps?.baseIconButton, {
83
- tabIndex: focusableItemId === id ? 0 : -1
84
- }, other, {
85
- disabled,
86
- 'aria-disabled': ariaDisabled,
87
- onKeyDown: handleKeyDown,
88
- onFocus: handleFocus,
48
+ tabIndex
49
+ }, other, toolbarButtonProps, {
89
50
  ref: handleRef
90
51
  }));
91
52
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
@@ -2,15 +2,15 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"];
5
+ const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
6
+ _excluded2 = ["tabIndex"];
6
7
  import * as React from 'react';
7
8
  import PropTypes from 'prop-types';
8
9
  import useForkRef from '@mui/utils/useForkRef';
9
- import useId from '@mui/utils/useId';
10
10
  import { forwardRef } from '@mui/x-internals/forwardRef';
11
11
  import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
12
+ import { useRegisterToolbarButton } from '@mui/x-internals/ToolbarContext';
12
13
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.mjs";
13
- import { useToolbarContext } from "./ToolbarContext.mjs";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  /**
16
16
  * A button for performing actions from the toolbar.
@@ -26,59 +26,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
26
26
  */
27
27
  const ToolbarButton = forwardRef(function ToolbarButton(props, ref) {
28
28
  const {
29
- render,
30
- onKeyDown,
31
- onFocus,
32
- disabled,
33
- 'aria-disabled': ariaDisabled
29
+ render
34
30
  } = props,
35
31
  other = _objectWithoutPropertiesLoose(props, _excluded);
36
- const id = useId();
37
32
  const rootProps = useGridRootProps();
38
33
  const buttonRef = React.useRef(null);
39
34
  const handleRef = useForkRef(buttonRef, ref);
40
- const {
41
- focusableItemId,
42
- registerItem,
43
- unregisterItem,
44
- onItemKeyDown,
45
- onItemFocus,
46
- onItemDisabled
47
- } = useToolbarContext();
48
- const handleKeyDown = event => {
49
- onItemKeyDown(event);
50
- onKeyDown?.(event);
51
- };
52
- const handleFocus = event => {
53
- onItemFocus(id);
54
- onFocus?.(event);
55
- };
56
- React.useEffect(() => {
57
- registerItem(id, buttonRef);
58
- return () => unregisterItem(id);
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, []);
61
- const previousDisabled = React.useRef(disabled);
62
- React.useEffect(() => {
63
- if (previousDisabled.current !== disabled && disabled === true) {
64
- onItemDisabled(id, disabled);
65
- }
66
- previousDisabled.current = disabled;
67
- }, [disabled, id, onItemDisabled]);
68
- const previousAriaDisabled = React.useRef(ariaDisabled);
69
- React.useEffect(() => {
70
- if (previousAriaDisabled.current !== ariaDisabled && ariaDisabled === true) {
71
- onItemDisabled(id, true);
72
- }
73
- previousAriaDisabled.current = ariaDisabled;
74
- }, [ariaDisabled, id, onItemDisabled]);
35
+ const _useRegisterToolbarBu = useRegisterToolbarButton(props, buttonRef),
36
+ {
37
+ tabIndex
38
+ } = _useRegisterToolbarBu,
39
+ toolbarButtonProps = _objectWithoutPropertiesLoose(_useRegisterToolbarBu, _excluded2);
75
40
  const element = useComponentRenderer(rootProps.slots.baseIconButton, render, _extends({}, rootProps.slotProps?.baseIconButton, {
76
- tabIndex: focusableItemId === id ? 0 : -1
77
- }, other, {
78
- disabled,
79
- 'aria-disabled': ariaDisabled,
80
- onKeyDown: handleKeyDown,
81
- onFocus: handleFocus,
41
+ tabIndex
42
+ }, other, toolbarButtonProps, {
82
43
  ref: handleRef
83
44
  }));
84
45
  return /*#__PURE__*/_jsx(React.Fragment, {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.29.2
2
+ * @mui/x-data-grid v8.29.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.29.2
2
+ * @mui/x-data-grid v8.29.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "8.29.2",
3
+ "version": "8.29.3",
4
4
  "author": "MUI Team",
5
5
  "description": "The Community plan edition of the MUI X Data Grid components.",
6
6
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  "clsx": "^2.1.1",
43
43
  "prop-types": "^15.8.1",
44
44
  "use-sync-external-store": "^1.6.0",
45
- "@mui/x-internals": "8.29.2",
46
- "@mui/x-virtualizer": "0.4.1"
45
+ "@mui/x-internals": "8.29.3",
46
+ "@mui/x-virtualizer": "0.4.2"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@emotion/react": "^11.9.0",
@@ -166,98 +166,98 @@
166
166
  }
167
167
  },
168
168
  "./context": {
169
- "require": {
170
- "types": "./context/index.d.ts",
171
- "default": "./context/index.js"
172
- },
173
169
  "import": {
174
170
  "types": "./context/index.d.mts",
175
171
  "default": "./context/index.mjs"
176
172
  },
173
+ "require": {
174
+ "types": "./context/index.d.ts",
175
+ "default": "./context/index.js"
176
+ },
177
177
  "default": {
178
178
  "types": "./context/index.d.mts",
179
179
  "default": "./context/index.mjs"
180
180
  }
181
181
  },
182
182
  "./hooks": {
183
- "require": {
184
- "types": "./hooks/index.d.ts",
185
- "default": "./hooks/index.js"
186
- },
187
183
  "import": {
188
184
  "types": "./hooks/index.d.mts",
189
185
  "default": "./hooks/index.mjs"
190
186
  },
187
+ "require": {
188
+ "types": "./hooks/index.d.ts",
189
+ "default": "./hooks/index.js"
190
+ },
191
191
  "default": {
192
192
  "types": "./hooks/index.d.mts",
193
193
  "default": "./hooks/index.mjs"
194
194
  }
195
195
  },
196
196
  "./internals": {
197
- "require": {
198
- "types": "./internals/index.d.ts",
199
- "default": "./internals/index.js"
200
- },
201
197
  "import": {
202
198
  "types": "./internals/index.d.mts",
203
199
  "default": "./internals/index.mjs"
204
200
  },
201
+ "require": {
202
+ "types": "./internals/index.d.ts",
203
+ "default": "./internals/index.js"
204
+ },
205
205
  "default": {
206
206
  "types": "./internals/index.d.mts",
207
207
  "default": "./internals/index.mjs"
208
208
  }
209
209
  },
210
210
  "./locales": {
211
- "require": {
212
- "types": "./locales/index.d.ts",
213
- "default": "./locales/index.js"
214
- },
215
211
  "import": {
216
212
  "types": "./locales/index.d.mts",
217
213
  "default": "./locales/index.mjs"
218
214
  },
215
+ "require": {
216
+ "types": "./locales/index.d.ts",
217
+ "default": "./locales/index.js"
218
+ },
219
219
  "default": {
220
220
  "types": "./locales/index.d.mts",
221
221
  "default": "./locales/index.mjs"
222
222
  }
223
223
  },
224
224
  "./models": {
225
- "require": {
226
- "types": "./models/index.d.ts",
227
- "default": "./models/index.js"
228
- },
229
225
  "import": {
230
226
  "types": "./models/index.d.mts",
231
227
  "default": "./models/index.mjs"
232
228
  },
229
+ "require": {
230
+ "types": "./models/index.d.ts",
231
+ "default": "./models/index.js"
232
+ },
233
233
  "default": {
234
234
  "types": "./models/index.d.mts",
235
235
  "default": "./models/index.mjs"
236
236
  }
237
237
  },
238
238
  "./themeAugmentation": {
239
- "require": {
240
- "types": "./themeAugmentation/index.d.ts",
241
- "default": "./themeAugmentation/index.js"
242
- },
243
239
  "import": {
244
240
  "types": "./themeAugmentation/index.d.mts",
245
241
  "default": "./themeAugmentation/index.mjs"
246
242
  },
243
+ "require": {
244
+ "types": "./themeAugmentation/index.d.ts",
245
+ "default": "./themeAugmentation/index.js"
246
+ },
247
247
  "default": {
248
248
  "types": "./themeAugmentation/index.d.mts",
249
249
  "default": "./themeAugmentation/index.mjs"
250
250
  }
251
251
  },
252
252
  "./utils": {
253
- "require": {
254
- "types": "./utils/index.d.ts",
255
- "default": "./utils/index.js"
256
- },
257
253
  "import": {
258
254
  "types": "./utils/index.d.mts",
259
255
  "default": "./utils/index.mjs"
260
256
  },
257
+ "require": {
258
+ "types": "./utils/index.d.ts",
259
+ "default": "./utils/index.js"
260
+ },
261
261
  "default": {
262
262
  "types": "./utils/index.d.mts",
263
263
  "default": "./utils/index.mjs"
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- export interface ToolbarContextValue {
3
- focusableItemId: string | null;
4
- registerItem: (id: string, ref: React.RefObject<HTMLButtonElement | null>) => void;
5
- unregisterItem: (id: string) => void;
6
- onItemKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
7
- onItemFocus: (id: string) => void;
8
- onItemDisabled: (id: string, disabled: boolean) => void;
9
- }
10
- export declare const ToolbarContext: React.Context<ToolbarContextValue | undefined>;
11
- export declare function useToolbarContext(): ToolbarContextValue;
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- export interface ToolbarContextValue {
3
- focusableItemId: string | null;
4
- registerItem: (id: string, ref: React.RefObject<HTMLButtonElement | null>) => void;
5
- unregisterItem: (id: string) => void;
6
- onItemKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
7
- onItemFocus: (id: string) => void;
8
- onItemDisabled: (id: string, disabled: boolean) => void;
9
- }
10
- export declare const ToolbarContext: React.Context<ToolbarContextValue | undefined>;
11
- export declare function useToolbarContext(): ToolbarContextValue;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- 'use client';
3
-
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.ToolbarContext = void 0;
9
- exports.useToolbarContext = useToolbarContext;
10
- var React = _interopRequireWildcard(require("react"));
11
- const ToolbarContext = exports.ToolbarContext = /*#__PURE__*/React.createContext(undefined);
12
- if (process.env.NODE_ENV !== "production") ToolbarContext.displayName = "ToolbarContext";
13
- function useToolbarContext() {
14
- const context = React.useContext(ToolbarContext);
15
- if (context === undefined) {
16
- throw new Error('MUI X: Missing context. Toolbar subcomponents must be placed within a <Toolbar /> component.');
17
- }
18
- return context;
19
- }
@@ -1,12 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- export const ToolbarContext = /*#__PURE__*/React.createContext(undefined);
5
- if (process.env.NODE_ENV !== "production") ToolbarContext.displayName = "ToolbarContext";
6
- export function useToolbarContext() {
7
- const context = React.useContext(ToolbarContext);
8
- if (context === undefined) {
9
- throw new Error('MUI X: Missing context. Toolbar subcomponents must be placed within a <Toolbar /> component.');
10
- }
11
- return context;
12
- }
@@ -1,5 +0,0 @@
1
- export declare function sortByDocumentPosition(a: {
2
- ref: React.RefObject<HTMLButtonElement | null>;
3
- }, b: {
4
- ref: React.RefObject<HTMLButtonElement | null>;
5
- }): 0 | 1 | -1;
@@ -1,5 +0,0 @@
1
- export declare function sortByDocumentPosition(a: {
2
- ref: React.RefObject<HTMLButtonElement | null>;
3
- }, b: {
4
- ref: React.RefObject<HTMLButtonElement | null>;
5
- }): 0 | 1 | -1;
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.sortByDocumentPosition = sortByDocumentPosition;
7
- /* eslint-disable no-bitwise */
8
- function sortByDocumentPosition(a, b) {
9
- if (!a.ref.current || !b.ref.current) {
10
- return 0;
11
- }
12
- const position = a.ref.current.compareDocumentPosition(b.ref.current);
13
- if (!position) {
14
- return 0;
15
- }
16
- if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
17
- return -1;
18
- }
19
- if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) {
20
- return 1;
21
- }
22
- return 0;
23
- }
@@ -1,17 +0,0 @@
1
- /* eslint-disable no-bitwise */
2
- export function sortByDocumentPosition(a, b) {
3
- if (!a.ref.current || !b.ref.current) {
4
- return 0;
5
- }
6
- const position = a.ref.current.compareDocumentPosition(b.ref.current);
7
- if (!position) {
8
- return 0;
9
- }
10
- if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
11
- return -1;
12
- }
13
- if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) {
14
- return 1;
15
- }
16
- return 0;
17
- }