@mui/material 6.0.0-alpha.12 → 6.0.0-alpha.14
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/Alert/Alert.d.ts +12 -3
- package/ButtonBase/ButtonBase.js +4 -12
- package/CHANGELOG.md +91 -0
- package/Dialog/Dialog.js +2 -1
- package/Hidden/hiddenCssClasses.d.ts +3 -0
- package/Link/Link.js +4 -14
- package/Modal/Modal.js +27 -17
- package/PigmentContainer/PigmentContainer.d.ts +55 -0
- package/PigmentContainer/PigmentContainer.js +98 -0
- package/PigmentContainer/index.d.ts +3 -0
- package/PigmentContainer/index.js +3 -0
- package/PigmentContainer/package.json +6 -0
- package/PigmentGrid/PigmentGrid.d.ts +108 -0
- package/PigmentGrid/PigmentGrid.js +149 -0
- package/PigmentGrid/index.d.ts +3 -0
- package/PigmentGrid/index.js +3 -0
- package/PigmentGrid/package.json +6 -0
- package/PigmentHidden/PigmentHidden.d.ts +97 -0
- package/PigmentHidden/PigmentHidden.js +278 -0
- package/PigmentHidden/index.d.ts +2 -0
- package/PigmentHidden/index.js +2 -0
- package/PigmentHidden/package.json +6 -0
- package/PigmentStack/PigmentStack.d.ts +51 -0
- package/PigmentStack/PigmentStack.js +81 -0
- package/PigmentStack/index.d.ts +3 -0
- package/PigmentStack/index.js +3 -0
- package/PigmentStack/package.json +6 -0
- package/Rating/Rating.js +5 -12
- package/Tooltip/Tooltip.js +4 -14
- package/index.js +1 -1
- package/modern/ButtonBase/ButtonBase.js +4 -12
- package/modern/Dialog/Dialog.js +2 -1
- package/modern/Link/Link.js +4 -14
- package/modern/Modal/Modal.js +27 -17
- package/modern/PigmentContainer/PigmentContainer.js +98 -0
- package/modern/PigmentContainer/index.js +3 -0
- package/modern/PigmentGrid/PigmentGrid.js +149 -0
- package/modern/PigmentGrid/index.js +3 -0
- package/modern/PigmentHidden/PigmentHidden.js +278 -0
- package/modern/PigmentHidden/index.js +2 -0
- package/modern/PigmentStack/PigmentStack.js +81 -0
- package/modern/PigmentStack/index.js +3 -0
- package/modern/Rating/Rating.js +5 -12
- package/modern/Tooltip/Tooltip.js +4 -14
- package/modern/index.js +1 -1
- package/modern/utils/index.js +0 -1
- package/node/ButtonBase/ButtonBase.js +4 -12
- package/node/Dialog/Dialog.js +2 -1
- package/node/Link/Link.js +4 -14
- package/node/Modal/Modal.js +27 -18
- package/node/PigmentContainer/PigmentContainer.js +108 -0
- package/node/PigmentContainer/index.js +36 -0
- package/node/PigmentGrid/PigmentGrid.js +159 -0
- package/node/PigmentGrid/index.js +36 -0
- package/node/PigmentHidden/PigmentHidden.js +287 -0
- package/node/PigmentHidden/index.js +26 -0
- package/node/PigmentStack/PigmentStack.js +91 -0
- package/node/PigmentStack/index.js +36 -0
- package/node/Rating/Rating.js +4 -11
- package/node/Tooltip/Tooltip.js +4 -14
- package/node/index.js +1 -1
- package/node/utils/index.js +0 -7
- package/package.json +10 -6
- package/styles/responsiveFontSizes.d.ts +3 -4
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -1
- package/modern/utils/useIsFocusVisible.js +0 -4
- package/node/utils/useIsFocusVisible.js +0 -10
- package/utils/useIsFocusVisible.d.ts +0 -3
- package/utils/useIsFocusVisible.js +0 -4
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import Hidden from '@pigment-css/react/Hidden';
|
|
8
|
+
import capitalize from '@mui/utils/capitalize';
|
|
9
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
+
import HiddenJs from '../Hidden/HiddenJs';
|
|
11
|
+
import { getHiddenCssUtilityClass } from '../Hidden/hiddenCssClasses';
|
|
12
|
+
import { useTheme } from '../zero-styled';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const useUtilityClasses = ownerState => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
breakpoints
|
|
18
|
+
} = ownerState;
|
|
19
|
+
const slots = {
|
|
20
|
+
root: ['root', ...breakpoints.map(({
|
|
21
|
+
breakpoint,
|
|
22
|
+
dir
|
|
23
|
+
}) => {
|
|
24
|
+
return dir === 'only' ? `${dir}${capitalize(breakpoint)}` : `${breakpoint}${capitalize(dir)}`;
|
|
25
|
+
})]
|
|
26
|
+
};
|
|
27
|
+
return composeClasses(slots, getHiddenCssUtilityClass, classes);
|
|
28
|
+
};
|
|
29
|
+
function HiddenCss(props) {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const {
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
only,
|
|
35
|
+
...other
|
|
36
|
+
} = props;
|
|
37
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
+
const unknownProps = Object.keys(other).filter(propName => {
|
|
39
|
+
const isUndeclaredBreakpoint = !theme.breakpoints.keys.some(breakpoint => {
|
|
40
|
+
return `${breakpoint}Up` === propName || `${breakpoint}Down` === propName;
|
|
41
|
+
});
|
|
42
|
+
return !['classes', 'theme', 'isRtl', 'sx'].includes(propName) && isUndeclaredBreakpoint;
|
|
43
|
+
});
|
|
44
|
+
if (unknownProps.length > 0) {
|
|
45
|
+
console.error(`MUI: Unsupported props received by \`<Hidden implementation="css" />\`: ${unknownProps.join(', ')}. Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const breakpoints = [];
|
|
49
|
+
for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
|
|
50
|
+
const breakpoint = theme.breakpoints.keys[i];
|
|
51
|
+
const breakpointUp = other[`${breakpoint}Up`];
|
|
52
|
+
const breakpointDown = other[`${breakpoint}Down`];
|
|
53
|
+
if (breakpointUp) {
|
|
54
|
+
breakpoints.push({
|
|
55
|
+
breakpoint,
|
|
56
|
+
dir: 'up'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (breakpointDown) {
|
|
60
|
+
breakpoints.push({
|
|
61
|
+
breakpoint,
|
|
62
|
+
dir: 'down'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (only) {
|
|
67
|
+
const onlyBreakpoints = Array.isArray(only) ? only : [only];
|
|
68
|
+
onlyBreakpoints.forEach(breakpoint => {
|
|
69
|
+
breakpoints.push({
|
|
70
|
+
breakpoint,
|
|
71
|
+
dir: 'only'
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const ownerState = {
|
|
76
|
+
...props,
|
|
77
|
+
classes: {},
|
|
78
|
+
breakpoints
|
|
79
|
+
};
|
|
80
|
+
const classes = useUtilityClasses(ownerState);
|
|
81
|
+
return /*#__PURE__*/_jsx(Hidden, {
|
|
82
|
+
className: clsx(classes.root, className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? HiddenCss.propTypes /* remove-proptypes */ = {
|
|
87
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
88
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
89
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
90
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
91
|
+
/**
|
|
92
|
+
* The content of the component.
|
|
93
|
+
*/
|
|
94
|
+
children: PropTypes.node,
|
|
95
|
+
className: PropTypes.string,
|
|
96
|
+
/**
|
|
97
|
+
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
|
98
|
+
* server-side rendering.
|
|
99
|
+
* @default 'js'
|
|
100
|
+
*/
|
|
101
|
+
implementation: PropTypes.oneOf(['css', 'js']),
|
|
102
|
+
/**
|
|
103
|
+
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
|
104
|
+
*
|
|
105
|
+
* As `window.innerWidth` is unavailable on the server,
|
|
106
|
+
* we default to rendering an empty component during the first mount.
|
|
107
|
+
* You might want to use a heuristic to approximate
|
|
108
|
+
* the screen width of the client browser screen width.
|
|
109
|
+
*
|
|
110
|
+
* For instance, you could be using the user-agent or the client-hints.
|
|
111
|
+
* https://caniuse.com/#search=client%20hint
|
|
112
|
+
*/
|
|
113
|
+
initialWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']),
|
|
114
|
+
/**
|
|
115
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
lgDown: PropTypes.bool,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, component is hidden on screens this size and above.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
lgUp: PropTypes.bool,
|
|
124
|
+
/**
|
|
125
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
mdDown: PropTypes.bool,
|
|
129
|
+
/**
|
|
130
|
+
* If `true`, component is hidden on screens this size and above.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
mdUp: PropTypes.bool,
|
|
134
|
+
/**
|
|
135
|
+
* Hide the given breakpoint(s).
|
|
136
|
+
*/
|
|
137
|
+
only: PropTypes.oneOfType([PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']), PropTypes.arrayOf(PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']).isRequired)]),
|
|
138
|
+
/**
|
|
139
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
smDown: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* If `true`, component is hidden on screens this size and above.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
smUp: PropTypes.bool,
|
|
148
|
+
/**
|
|
149
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
xlDown: PropTypes.bool,
|
|
153
|
+
/**
|
|
154
|
+
* If `true`, component is hidden on screens this size and above.
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
xlUp: PropTypes.bool,
|
|
158
|
+
/**
|
|
159
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
xsDown: PropTypes.bool,
|
|
163
|
+
/**
|
|
164
|
+
* If `true`, component is hidden on screens this size and above.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
xsUp: PropTypes.bool
|
|
168
|
+
} : void 0;
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* Demos:
|
|
172
|
+
*
|
|
173
|
+
* - [Hidden](https://next.mui.com/material-ui/react-hidden/)
|
|
174
|
+
*
|
|
175
|
+
* API:
|
|
176
|
+
*
|
|
177
|
+
* - [PigmentHidden API](https://next.mui.com/material-ui/api/pigment-hidden/)
|
|
178
|
+
*/
|
|
179
|
+
function PigmentHidden({
|
|
180
|
+
implementation = 'js',
|
|
181
|
+
...props
|
|
182
|
+
}) {
|
|
183
|
+
if (implementation === 'js') {
|
|
184
|
+
return /*#__PURE__*/_jsx(HiddenJs, {
|
|
185
|
+
...props
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return /*#__PURE__*/_jsx(HiddenCss, {
|
|
189
|
+
...props
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
process.env.NODE_ENV !== "production" ? PigmentHidden.propTypes /* remove-proptypes */ = {
|
|
193
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
194
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
195
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
196
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
197
|
+
/**
|
|
198
|
+
* The content of the component.
|
|
199
|
+
*/
|
|
200
|
+
children: PropTypes.node,
|
|
201
|
+
/**
|
|
202
|
+
* @ignore
|
|
203
|
+
*/
|
|
204
|
+
className: PropTypes.string,
|
|
205
|
+
/**
|
|
206
|
+
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
|
207
|
+
* server-side rendering.
|
|
208
|
+
* @default 'js'
|
|
209
|
+
*/
|
|
210
|
+
implementation: PropTypes.oneOf(['css', 'js']),
|
|
211
|
+
/**
|
|
212
|
+
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
|
213
|
+
*
|
|
214
|
+
* As `window.innerWidth` is unavailable on the server,
|
|
215
|
+
* we default to rendering an empty component during the first mount.
|
|
216
|
+
* You might want to use a heuristic to approximate
|
|
217
|
+
* the screen width of the client browser screen width.
|
|
218
|
+
*
|
|
219
|
+
* For instance, you could be using the user-agent or the client-hints.
|
|
220
|
+
* https://caniuse.com/#search=client%20hint
|
|
221
|
+
*/
|
|
222
|
+
initialWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']),
|
|
223
|
+
/**
|
|
224
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
lgDown: PropTypes.bool,
|
|
228
|
+
/**
|
|
229
|
+
* If `true`, component is hidden on screens this size and above.
|
|
230
|
+
* @default false
|
|
231
|
+
*/
|
|
232
|
+
lgUp: PropTypes.bool,
|
|
233
|
+
/**
|
|
234
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
mdDown: PropTypes.bool,
|
|
238
|
+
/**
|
|
239
|
+
* If `true`, component is hidden on screens this size and above.
|
|
240
|
+
* @default false
|
|
241
|
+
*/
|
|
242
|
+
mdUp: PropTypes.bool,
|
|
243
|
+
/**
|
|
244
|
+
* Hide the given breakpoint(s).
|
|
245
|
+
*/
|
|
246
|
+
only: PropTypes.oneOfType([PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']), PropTypes.arrayOf(PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs']).isRequired)]),
|
|
247
|
+
/**
|
|
248
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
smDown: PropTypes.bool,
|
|
252
|
+
/**
|
|
253
|
+
* If `true`, component is hidden on screens this size and above.
|
|
254
|
+
* @default false
|
|
255
|
+
*/
|
|
256
|
+
smUp: PropTypes.bool,
|
|
257
|
+
/**
|
|
258
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
261
|
+
xlDown: PropTypes.bool,
|
|
262
|
+
/**
|
|
263
|
+
* If `true`, component is hidden on screens this size and above.
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
xlUp: PropTypes.bool,
|
|
267
|
+
/**
|
|
268
|
+
* If `true`, component is hidden on screens below (but not including) this size.
|
|
269
|
+
* @default false
|
|
270
|
+
*/
|
|
271
|
+
xsDown: PropTypes.bool,
|
|
272
|
+
/**
|
|
273
|
+
* If `true`, component is hidden on screens this size and above.
|
|
274
|
+
* @default false
|
|
275
|
+
*/
|
|
276
|
+
xsUp: PropTypes.bool
|
|
277
|
+
} : void 0;
|
|
278
|
+
export default PigmentHidden;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import Stack from '@pigment-css/react/Stack';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const useUtilityClasses = () => {
|
|
10
|
+
const slots = {
|
|
11
|
+
root: ['root']
|
|
12
|
+
};
|
|
13
|
+
return composeClasses(slots, slot => generateUtilityClass('MuiStack', slot), {});
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* Demos:
|
|
18
|
+
*
|
|
19
|
+
* - [Stack](https://next.mui.com/material-ui/react-stack/)
|
|
20
|
+
*
|
|
21
|
+
* API:
|
|
22
|
+
*
|
|
23
|
+
* - [PigmentStack API](https://next.mui.com/material-ui/api/pigment-stack/)
|
|
24
|
+
*/
|
|
25
|
+
const PigmentStack = /*#__PURE__*/React.forwardRef(function PigmentStack({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}, ref) {
|
|
29
|
+
const classes = useUtilityClasses();
|
|
30
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
31
|
+
ref: ref,
|
|
32
|
+
className: clsx(classes.root, className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
process.env.NODE_ENV !== "production" ? PigmentStack.propTypes /* remove-proptypes */ = {
|
|
37
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
38
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
39
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
40
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
41
|
+
/**
|
|
42
|
+
* The content of the component.
|
|
43
|
+
*/
|
|
44
|
+
children: PropTypes.node,
|
|
45
|
+
/**
|
|
46
|
+
* @ignore
|
|
47
|
+
*/
|
|
48
|
+
className: PropTypes.string,
|
|
49
|
+
/**
|
|
50
|
+
* Defines the `flex-direction` style property.
|
|
51
|
+
* It is applied for all screen sizes.
|
|
52
|
+
* @default 'column'
|
|
53
|
+
*/
|
|
54
|
+
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.shape({
|
|
55
|
+
lg: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
56
|
+
md: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
57
|
+
sm: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
58
|
+
xl: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']),
|
|
59
|
+
xs: PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])
|
|
60
|
+
})]),
|
|
61
|
+
/**
|
|
62
|
+
* Add an element between each child.
|
|
63
|
+
*/
|
|
64
|
+
divider: PropTypes.node,
|
|
65
|
+
/**
|
|
66
|
+
* Defines the space between immediate children.
|
|
67
|
+
* @default 0
|
|
68
|
+
*/
|
|
69
|
+
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.shape({
|
|
70
|
+
lg: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
71
|
+
md: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
72
|
+
sm: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
73
|
+
xl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
74
|
+
xs: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
75
|
+
}), PropTypes.string]),
|
|
76
|
+
/**
|
|
77
|
+
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
78
|
+
*/
|
|
79
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
80
|
+
} : void 0;
|
|
81
|
+
export default PigmentStack;
|
package/modern/Rating/Rating.js
CHANGED
|
@@ -8,7 +8,8 @@ import visuallyHidden from '@mui/utils/visuallyHidden';
|
|
|
8
8
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
11
|
-
import
|
|
11
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
12
|
+
import { capitalize, useForkRef, useControlled, unstable_useId as useId } from '../utils';
|
|
12
13
|
import Star from '../internal/svg-icons/Star';
|
|
13
14
|
import StarBorder from '../internal/svg-icons/StarBorder';
|
|
14
15
|
import { styled } from '../zero-styled';
|
|
@@ -353,15 +354,9 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
353
354
|
if (focus !== -1) {
|
|
354
355
|
value = focus;
|
|
355
356
|
}
|
|
356
|
-
const {
|
|
357
|
-
isFocusVisibleRef,
|
|
358
|
-
onBlur: handleBlurVisible,
|
|
359
|
-
onFocus: handleFocusVisible,
|
|
360
|
-
ref: focusVisibleRef
|
|
361
|
-
} = useIsFocusVisible();
|
|
362
357
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
363
358
|
const rootRef = React.useRef();
|
|
364
|
-
const handleRef = useForkRef(
|
|
359
|
+
const handleRef = useForkRef(rootRef, ref);
|
|
365
360
|
const handleMouseMove = event => {
|
|
366
361
|
if (onMouseMove) {
|
|
367
362
|
onMouseMove(event);
|
|
@@ -431,8 +426,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
431
426
|
}
|
|
432
427
|
};
|
|
433
428
|
const handleFocus = event => {
|
|
434
|
-
|
|
435
|
-
if (isFocusVisibleRef.current === true) {
|
|
429
|
+
if (isFocusVisible(event.target)) {
|
|
436
430
|
setFocusVisible(true);
|
|
437
431
|
}
|
|
438
432
|
const newFocus = parseFloat(event.target.value);
|
|
@@ -445,8 +439,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
445
439
|
if (hover !== -1) {
|
|
446
440
|
return;
|
|
447
441
|
}
|
|
448
|
-
|
|
449
|
-
if (isFocusVisibleRef.current === false) {
|
|
442
|
+
if (!isFocusVisible(event.target)) {
|
|
450
443
|
setFocusVisible(false);
|
|
451
444
|
}
|
|
452
445
|
const newFocus = -1;
|
|
@@ -9,6 +9,7 @@ import { appendOwnerState } from '@mui/base/utils';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { alpha } from '@mui/system/colorManipulator';
|
|
11
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
|
+
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
12
13
|
import { styled, useTheme } from '../zero-styled';
|
|
13
14
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
14
15
|
import capitalize from '../utils/capitalize';
|
|
@@ -17,7 +18,6 @@ import Popper from '../Popper';
|
|
|
17
18
|
import useEventCallback from '../utils/useEventCallback';
|
|
18
19
|
import useForkRef from '../utils/useForkRef';
|
|
19
20
|
import useId from '../utils/useId';
|
|
20
|
-
import useIsFocusVisible from '../utils/useIsFocusVisible';
|
|
21
21
|
import useControlled from '../utils/useControlled';
|
|
22
22
|
import tooltipClasses, { getTooltipUtilityClass } from './tooltipClasses';
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -444,18 +444,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
444
444
|
handleClose(event);
|
|
445
445
|
});
|
|
446
446
|
};
|
|
447
|
-
const {
|
|
448
|
-
isFocusVisibleRef,
|
|
449
|
-
onBlur: handleBlurVisible,
|
|
450
|
-
onFocus: handleFocusVisible,
|
|
451
|
-
ref: focusVisibleRef
|
|
452
|
-
} = useIsFocusVisible();
|
|
453
|
-
// We don't necessarily care about the focusVisible state (which is safe to access via ref anyway).
|
|
454
|
-
// We just need to re-render the Tooltip if the focus-visible state changes.
|
|
455
447
|
const [, setChildIsFocusVisible] = React.useState(false);
|
|
456
448
|
const handleBlur = event => {
|
|
457
|
-
|
|
458
|
-
if (isFocusVisibleRef.current === false) {
|
|
449
|
+
if (!isFocusVisible(event.target)) {
|
|
459
450
|
setChildIsFocusVisible(false);
|
|
460
451
|
handleMouseLeave(event);
|
|
461
452
|
}
|
|
@@ -467,8 +458,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
467
458
|
if (!childNode) {
|
|
468
459
|
setChildNode(event.currentTarget);
|
|
469
460
|
}
|
|
470
|
-
|
|
471
|
-
if (isFocusVisibleRef.current === true) {
|
|
461
|
+
if (isFocusVisible(event.target)) {
|
|
472
462
|
setChildIsFocusVisible(true);
|
|
473
463
|
handleMouseOver(event);
|
|
474
464
|
}
|
|
@@ -520,7 +510,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
520
510
|
document.removeEventListener('keydown', handleKeyDown);
|
|
521
511
|
};
|
|
522
512
|
}, [handleClose, open]);
|
|
523
|
-
const handleRef = useForkRef(children.ref,
|
|
513
|
+
const handleRef = useForkRef(children.ref, setChildNode, ref);
|
|
524
514
|
|
|
525
515
|
// There is no point in displaying an empty tooltip.
|
|
526
516
|
// So we exclude all falsy values, except 0, which is valid.
|
package/modern/index.js
CHANGED
package/modern/utils/index.js
CHANGED
|
@@ -17,7 +17,6 @@ export { default as unsupportedProp } from './unsupportedProp';
|
|
|
17
17
|
export { default as useControlled } from './useControlled';
|
|
18
18
|
export { default as useEventCallback } from './useEventCallback';
|
|
19
19
|
export { default as useForkRef } from './useForkRef';
|
|
20
|
-
export { default as useIsFocusVisible } from './useIsFocusVisible';
|
|
21
20
|
// TODO: remove this export once ClassNameGenerator is stable
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23
22
|
export const unstable_ClassNameGenerator = {
|
|
@@ -12,11 +12,11 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
13
13
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("@mui/utils/elementTypeAcceptingRef"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
|
|
15
16
|
var _zeroStyled = require("../zero-styled");
|
|
16
17
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
17
18
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
18
19
|
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
|
19
|
-
var _useIsFocusVisible = _interopRequireDefault(require("../utils/useIsFocusVisible"));
|
|
20
20
|
var _TouchRipple = _interopRequireDefault(require("./TouchRipple"));
|
|
21
21
|
var _buttonBaseClasses = _interopRequireWildcard(require("./buttonBaseClasses"));
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -127,12 +127,6 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
127
127
|
const buttonRef = React.useRef(null);
|
|
128
128
|
const rippleRef = React.useRef(null);
|
|
129
129
|
const handleRippleRef = (0, _useForkRef.default)(rippleRef, touchRippleRef);
|
|
130
|
-
const {
|
|
131
|
-
isFocusVisibleRef,
|
|
132
|
-
onFocus: handleFocusVisible,
|
|
133
|
-
onBlur: handleBlurVisible,
|
|
134
|
-
ref: focusVisibleRef
|
|
135
|
-
} = (0, _useIsFocusVisible.default)();
|
|
136
130
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
137
131
|
if (disabled && focusVisible) {
|
|
138
132
|
setFocusVisible(false);
|
|
@@ -181,8 +175,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
181
175
|
const handleTouchEnd = useRippleHandler('stop', onTouchEnd);
|
|
182
176
|
const handleTouchMove = useRippleHandler('stop', onTouchMove);
|
|
183
177
|
const handleBlur = useRippleHandler('stop', event => {
|
|
184
|
-
|
|
185
|
-
if (isFocusVisibleRef.current === false) {
|
|
178
|
+
if (!(0, _isFocusVisible.default)(event.target)) {
|
|
186
179
|
setFocusVisible(false);
|
|
187
180
|
}
|
|
188
181
|
if (onBlur) {
|
|
@@ -194,8 +187,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
194
187
|
if (!buttonRef.current) {
|
|
195
188
|
buttonRef.current = event.currentTarget;
|
|
196
189
|
}
|
|
197
|
-
|
|
198
|
-
if (isFocusVisibleRef.current === true) {
|
|
190
|
+
if ((0, _isFocusVisible.default)(event.target)) {
|
|
199
191
|
setFocusVisible(true);
|
|
200
192
|
if (onFocusVisible) {
|
|
201
193
|
onFocusVisible(event);
|
|
@@ -264,7 +256,7 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
264
256
|
buttonProps['aria-disabled'] = disabled;
|
|
265
257
|
}
|
|
266
258
|
}
|
|
267
|
-
const handleRef = (0, _useForkRef.default)(ref,
|
|
259
|
+
const handleRef = (0, _useForkRef.default)(ref, buttonRef);
|
|
268
260
|
if (process.env.NODE_ENV !== 'production') {
|
|
269
261
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
270
262
|
React.useEffect(() => {
|
package/node/Dialog/Dialog.js
CHANGED
package/node/Link/Link.js
CHANGED
|
@@ -12,11 +12,10 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _colorManipulator = require("@mui/system/colorManipulator");
|
|
13
13
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("@mui/utils/elementTypeAcceptingRef"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
|
|
15
16
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
16
17
|
var _zeroStyled = require("../zero-styled");
|
|
17
18
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
18
|
-
var _useIsFocusVisible = _interopRequireDefault(require("../utils/useIsFocusVisible"));
|
|
19
|
-
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
20
19
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
21
20
|
var _linkClasses = _interopRequireWildcard(require("./linkClasses"));
|
|
22
21
|
var _getTextDecoration = _interopRequireWildcard(require("./getTextDecoration"));
|
|
@@ -143,17 +142,9 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
143
142
|
sx,
|
|
144
143
|
...other
|
|
145
144
|
} = props;
|
|
146
|
-
const {
|
|
147
|
-
isFocusVisibleRef,
|
|
148
|
-
onBlur: handleBlurVisible,
|
|
149
|
-
onFocus: handleFocusVisible,
|
|
150
|
-
ref: focusVisibleRef
|
|
151
|
-
} = (0, _useIsFocusVisible.default)();
|
|
152
145
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
153
|
-
const handlerRef = (0, _useForkRef.default)(ref, focusVisibleRef);
|
|
154
146
|
const handleBlur = event => {
|
|
155
|
-
|
|
156
|
-
if (isFocusVisibleRef.current === false) {
|
|
147
|
+
if (!(0, _isFocusVisible.default)(event.target)) {
|
|
157
148
|
setFocusVisible(false);
|
|
158
149
|
}
|
|
159
150
|
if (onBlur) {
|
|
@@ -161,8 +152,7 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
161
152
|
}
|
|
162
153
|
};
|
|
163
154
|
const handleFocus = event => {
|
|
164
|
-
|
|
165
|
-
if (isFocusVisibleRef.current === true) {
|
|
155
|
+
if ((0, _isFocusVisible.default)(event.target)) {
|
|
166
156
|
setFocusVisible(true);
|
|
167
157
|
}
|
|
168
158
|
if (onFocus) {
|
|
@@ -185,7 +175,7 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
|
|
|
185
175
|
component: component,
|
|
186
176
|
onBlur: handleBlur,
|
|
187
177
|
onFocus: handleFocus,
|
|
188
|
-
ref:
|
|
178
|
+
ref: ref,
|
|
189
179
|
ownerState: ownerState,
|
|
190
180
|
variant: variant,
|
|
191
181
|
...other,
|