@mui/material 7.0.0-alpha.1 → 7.0.0-alpha.2

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.
Files changed (105) hide show
  1. package/Accordion/Accordion.d.ts +12 -6
  2. package/Backdrop/Backdrop.d.ts +12 -6
  3. package/Button/Button.js +3 -3
  4. package/CHANGELOG.md +31 -0
  5. package/Dialog/Dialog.d.ts +2 -2
  6. package/IconButton/IconButton.js +3 -3
  7. package/InputBase/inputBaseClasses.d.ts +15 -6
  8. package/InputLabel/InputLabel.d.ts +2 -2
  9. package/InputLabel/InputLabel.js +3 -3
  10. package/Popover/Popover.d.ts +1 -1
  11. package/Snackbar/Snackbar.d.ts +2 -2
  12. package/SpeedDial/SpeedDial.d.ts +8 -6
  13. package/StepContent/StepContent.d.ts +2 -2
  14. package/Tooltip/Tooltip.d.ts +19 -3
  15. package/esm/Accordion/Accordion.d.ts +12 -6
  16. package/esm/Backdrop/Backdrop.d.ts +12 -6
  17. package/esm/Button/Button.js +3 -3
  18. package/esm/Dialog/Dialog.d.ts +2 -2
  19. package/esm/IconButton/IconButton.js +3 -3
  20. package/esm/InputBase/inputBaseClasses.d.ts +15 -6
  21. package/esm/InputLabel/InputLabel.d.ts +2 -2
  22. package/esm/InputLabel/InputLabel.js +3 -3
  23. package/esm/Popover/Popover.d.ts +1 -1
  24. package/esm/Snackbar/Snackbar.d.ts +2 -2
  25. package/esm/SpeedDial/SpeedDial.d.ts +8 -6
  26. package/esm/StepContent/StepContent.d.ts +2 -2
  27. package/esm/Tooltip/Tooltip.d.ts +19 -3
  28. package/esm/index.d.ts +0 -2
  29. package/esm/index.js +1 -3
  30. package/esm/useAutocomplete/useAutocomplete.js +0 -1
  31. package/esm/utils/mergeSlotProps.d.ts +1 -1
  32. package/esm/version/index.js +2 -2
  33. package/index.d.ts +0 -2
  34. package/index.js +1 -20
  35. package/modern/Accordion/Accordion.d.ts +12 -6
  36. package/modern/Backdrop/Backdrop.d.ts +12 -6
  37. package/modern/Button/Button.js +3 -3
  38. package/modern/Dialog/Dialog.d.ts +2 -2
  39. package/modern/IconButton/IconButton.js +3 -3
  40. package/modern/InputBase/inputBaseClasses.d.ts +15 -6
  41. package/modern/InputLabel/InputLabel.d.ts +2 -2
  42. package/modern/InputLabel/InputLabel.js +3 -3
  43. package/modern/Popover/Popover.d.ts +1 -1
  44. package/modern/Snackbar/Snackbar.d.ts +2 -2
  45. package/modern/SpeedDial/SpeedDial.d.ts +8 -6
  46. package/modern/StepContent/StepContent.d.ts +2 -2
  47. package/modern/Tooltip/Tooltip.d.ts +19 -3
  48. package/modern/index.d.ts +0 -2
  49. package/modern/index.js +1 -3
  50. package/modern/useAutocomplete/useAutocomplete.js +0 -1
  51. package/modern/utils/mergeSlotProps.d.ts +1 -1
  52. package/modern/version/index.js +2 -2
  53. package/package.json +9 -7
  54. package/tsconfig.build.tsbuildinfo +1 -1
  55. package/useAutocomplete/useAutocomplete.js +0 -1
  56. package/utils/mergeSlotProps.d.ts +1 -1
  57. package/version/index.js +2 -2
  58. package/Hidden/Hidden.d.ts +0 -96
  59. package/Hidden/Hidden.js +0 -145
  60. package/Hidden/HiddenCss.d.ts +0 -17
  61. package/Hidden/HiddenCss.js +0 -189
  62. package/Hidden/HiddenJs.d.ts +0 -18
  63. package/Hidden/HiddenJs.js +0 -127
  64. package/Hidden/hiddenCssClasses.d.ts +0 -3
  65. package/Hidden/hiddenCssClasses.js +0 -15
  66. package/Hidden/index.d.ts +0 -2
  67. package/Hidden/index.js +0 -13
  68. package/Hidden/withWidth.d.ts +0 -17
  69. package/Hidden/withWidth.js +0 -118
  70. package/PigmentHidden/PigmentHidden.d.ts +0 -100
  71. package/PigmentHidden/PigmentHidden.js +0 -287
  72. package/PigmentHidden/index.d.ts +0 -2
  73. package/PigmentHidden/index.js +0 -25
  74. package/esm/Hidden/Hidden.d.ts +0 -96
  75. package/esm/Hidden/Hidden.js +0 -140
  76. package/esm/Hidden/HiddenCss.d.ts +0 -17
  77. package/esm/Hidden/HiddenCss.js +0 -182
  78. package/esm/Hidden/HiddenJs.d.ts +0 -18
  79. package/esm/Hidden/HiddenJs.js +0 -121
  80. package/esm/Hidden/hiddenCssClasses.d.ts +0 -3
  81. package/esm/Hidden/hiddenCssClasses.js +0 -7
  82. package/esm/Hidden/index.d.ts +0 -2
  83. package/esm/Hidden/index.js +0 -1
  84. package/esm/Hidden/withWidth.d.ts +0 -17
  85. package/esm/Hidden/withWidth.js +0 -109
  86. package/esm/PigmentHidden/PigmentHidden.d.ts +0 -100
  87. package/esm/PigmentHidden/PigmentHidden.js +0 -279
  88. package/esm/PigmentHidden/index.d.ts +0 -2
  89. package/esm/PigmentHidden/index.js +0 -2
  90. package/modern/Hidden/Hidden.d.ts +0 -96
  91. package/modern/Hidden/Hidden.js +0 -140
  92. package/modern/Hidden/HiddenCss.d.ts +0 -17
  93. package/modern/Hidden/HiddenCss.js +0 -182
  94. package/modern/Hidden/HiddenJs.d.ts +0 -18
  95. package/modern/Hidden/HiddenJs.js +0 -121
  96. package/modern/Hidden/hiddenCssClasses.d.ts +0 -3
  97. package/modern/Hidden/hiddenCssClasses.js +0 -7
  98. package/modern/Hidden/index.d.ts +0 -2
  99. package/modern/Hidden/index.js +0 -1
  100. package/modern/Hidden/withWidth.d.ts +0 -17
  101. package/modern/Hidden/withWidth.js +0 -109
  102. package/modern/PigmentHidden/PigmentHidden.d.ts +0 -100
  103. package/modern/PigmentHidden/PigmentHidden.js +0 -279
  104. package/modern/PigmentHidden/index.d.ts +0 -2
  105. package/modern/PigmentHidden/index.js +0 -2
@@ -1,140 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PropTypes from 'prop-types';
5
- import HiddenJs from "./HiddenJs.js";
6
- import HiddenCss from "./HiddenCss.js";
7
-
8
- /**
9
- * Responsively hides children based on the selected implementation.
10
- *
11
- * @deprecated The Hidden component was deprecated in Material UI v5. To learn more, see [the Hidden section](https://mui.com/material-ui/migration/v5-component-changes/#hidden) of the migration docs.
12
- */
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- function Hidden(props) {
15
- const {
16
- implementation = 'js',
17
- lgDown = false,
18
- lgUp = false,
19
- mdDown = false,
20
- mdUp = false,
21
- smDown = false,
22
- smUp = false,
23
- xlDown = false,
24
- xlUp = false,
25
- xsDown = false,
26
- xsUp = false,
27
- ...other
28
- } = props;
29
- if (implementation === 'js') {
30
- return /*#__PURE__*/_jsx(HiddenJs, {
31
- lgDown: lgDown,
32
- lgUp: lgUp,
33
- mdDown: mdDown,
34
- mdUp: mdUp,
35
- smDown: smDown,
36
- smUp: smUp,
37
- xlDown: xlDown,
38
- xlUp: xlUp,
39
- xsDown: xsDown,
40
- xsUp: xsUp,
41
- ...other
42
- });
43
- }
44
- return /*#__PURE__*/_jsx(HiddenCss, {
45
- lgDown: lgDown,
46
- lgUp: lgUp,
47
- mdDown: mdDown,
48
- mdUp: mdUp,
49
- smDown: smDown,
50
- smUp: smUp,
51
- xlDown: xlDown,
52
- xlUp: xlUp,
53
- xsDown: xsDown,
54
- xsUp: xsUp,
55
- ...other
56
- });
57
- }
58
- process.env.NODE_ENV !== "production" ? Hidden.propTypes /* remove-proptypes */ = {
59
- // ┌────────────────────────────── Warning ──────────────────────────────┐
60
- // │ These PropTypes are generated from the TypeScript type definitions. │
61
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
62
- // └─────────────────────────────────────────────────────────────────────┘
63
- /**
64
- * The content of the component.
65
- */
66
- children: PropTypes.node,
67
- /**
68
- * Specify which implementation to use. 'js' is the default, 'css' works better for
69
- * server-side rendering.
70
- * @default 'js'
71
- */
72
- implementation: PropTypes.oneOf(['css', 'js']),
73
- /**
74
- * You can use this prop when choosing the `js` implementation with server-side rendering.
75
- *
76
- * As `window.innerWidth` is unavailable on the server,
77
- * we default to rendering an empty component during the first mount.
78
- * You might want to use a heuristic to approximate
79
- * the screen width of the client browser screen width.
80
- *
81
- * For instance, you could be using the user-agent or the client-hints.
82
- * https://caniuse.com/#search=client%20hint
83
- */
84
- initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
85
- /**
86
- * If `true`, component is hidden on screens below (but not including) this size.
87
- * @default false
88
- */
89
- lgDown: PropTypes.bool,
90
- /**
91
- * If `true`, component is hidden on screens this size and above.
92
- * @default false
93
- */
94
- lgUp: PropTypes.bool,
95
- /**
96
- * If `true`, component is hidden on screens below (but not including) this size.
97
- * @default false
98
- */
99
- mdDown: PropTypes.bool,
100
- /**
101
- * If `true`, component is hidden on screens this size and above.
102
- * @default false
103
- */
104
- mdUp: PropTypes.bool,
105
- /**
106
- * Hide the given breakpoint(s).
107
- */
108
- only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']).isRequired)]),
109
- /**
110
- * If `true`, component is hidden on screens below (but not including) this size.
111
- * @default false
112
- */
113
- smDown: PropTypes.bool,
114
- /**
115
- * If `true`, component is hidden on screens this size and above.
116
- * @default false
117
- */
118
- smUp: PropTypes.bool,
119
- /**
120
- * If `true`, component is hidden on screens below (but not including) this size.
121
- * @default false
122
- */
123
- xlDown: PropTypes.bool,
124
- /**
125
- * If `true`, component is hidden on screens this size and above.
126
- * @default false
127
- */
128
- xlUp: PropTypes.bool,
129
- /**
130
- * If `true`, component is hidden on screens below (but not including) this size.
131
- * @default false
132
- */
133
- xsDown: PropTypes.bool,
134
- /**
135
- * If `true`, component is hidden on screens this size and above.
136
- * @default false
137
- */
138
- xsUp: PropTypes.bool
139
- } : void 0;
140
- export default Hidden;
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { Breakpoint } from '@mui/system';
3
- export interface HiddenCssProps {
4
- lgDown?: boolean;
5
- lgUp?: boolean;
6
- mdDown?: boolean;
7
- mdUp?: boolean;
8
- only?: Breakpoint | Breakpoint[];
9
- smDown?: boolean;
10
- smUp?: boolean;
11
- xlDown?: boolean;
12
- xlUp?: boolean;
13
- xsDown?: boolean;
14
- xsUp?: boolean;
15
- }
16
- declare const HiddenCss: React.JSXElementConstructor<HiddenCssProps>;
17
- export default HiddenCss;
@@ -1,182 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import clsx from 'clsx';
5
- import PropTypes from 'prop-types';
6
- import composeClasses from '@mui/utils/composeClasses';
7
- import capitalize from "../utils/capitalize.js";
8
- import styled from "../styles/styled.js";
9
- import useTheme from "../styles/useTheme.js";
10
- import { getHiddenCssUtilityClass } from "./hiddenCssClasses.js";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- const useUtilityClasses = ownerState => {
13
- const {
14
- classes,
15
- breakpoints
16
- } = ownerState;
17
- const slots = {
18
- root: ['root', ...breakpoints.map(({
19
- breakpoint,
20
- dir
21
- }) => {
22
- return dir === 'only' ? `${dir}${capitalize(breakpoint)}` : `${breakpoint}${capitalize(dir)}`;
23
- })]
24
- };
25
- return composeClasses(slots, getHiddenCssUtilityClass, classes);
26
- };
27
-
28
- // FIXME(romgrk): Can't use memoTheme here, should we memo also on ownerState?
29
- const HiddenCssRoot = styled('div', {
30
- name: 'PrivateHiddenCss',
31
- slot: 'Root'
32
- })(({
33
- theme,
34
- ownerState
35
- }) => {
36
- const hidden = {
37
- display: 'none'
38
- };
39
- return {
40
- ...ownerState.breakpoints.map(({
41
- breakpoint,
42
- dir
43
- }) => {
44
- if (dir === 'only') {
45
- return {
46
- [theme.breakpoints.only(breakpoint)]: hidden
47
- };
48
- }
49
- return dir === 'up' ? {
50
- [theme.breakpoints.up(breakpoint)]: hidden
51
- } : {
52
- [theme.breakpoints.down(breakpoint)]: hidden
53
- };
54
- }).reduce((r, o) => {
55
- Object.keys(o).forEach(k => {
56
- r[k] = o[k];
57
- });
58
- return r;
59
- }, {})
60
- };
61
- });
62
-
63
- /**
64
- * @ignore - internal component.
65
- */
66
- function HiddenCss(props) {
67
- const {
68
- children,
69
- className,
70
- only,
71
- ...other
72
- } = props;
73
- const theme = useTheme();
74
- if (process.env.NODE_ENV !== 'production') {
75
- const unknownProps = Object.keys(other).filter(propName => {
76
- const isUndeclaredBreakpoint = !theme.breakpoints.keys.some(breakpoint => {
77
- return `${breakpoint}Up` === propName || `${breakpoint}Down` === propName;
78
- });
79
- return !['classes', 'theme', 'isRtl', 'sx'].includes(propName) && isUndeclaredBreakpoint;
80
- });
81
- if (unknownProps.length > 0) {
82
- 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?`);
83
- }
84
- }
85
- const breakpoints = [];
86
- for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
87
- const breakpoint = theme.breakpoints.keys[i];
88
- const breakpointUp = other[`${breakpoint}Up`];
89
- const breakpointDown = other[`${breakpoint}Down`];
90
- if (breakpointUp) {
91
- breakpoints.push({
92
- breakpoint,
93
- dir: 'up'
94
- });
95
- }
96
- if (breakpointDown) {
97
- breakpoints.push({
98
- breakpoint,
99
- dir: 'down'
100
- });
101
- }
102
- }
103
- if (only) {
104
- const onlyBreakpoints = Array.isArray(only) ? only : [only];
105
- onlyBreakpoints.forEach(breakpoint => {
106
- breakpoints.push({
107
- breakpoint,
108
- dir: 'only'
109
- });
110
- });
111
- }
112
- const ownerState = {
113
- ...props,
114
- breakpoints
115
- };
116
- const classes = useUtilityClasses(ownerState);
117
- return /*#__PURE__*/_jsx(HiddenCssRoot, {
118
- className: clsx(classes.root, className),
119
- ownerState: ownerState,
120
- children: children
121
- });
122
- }
123
- process.env.NODE_ENV !== "production" ? HiddenCss.propTypes = {
124
- /**
125
- * The content of the component.
126
- */
127
- children: PropTypes.node,
128
- /**
129
- * @ignore
130
- */
131
- className: PropTypes.string,
132
- /**
133
- * Specify which implementation to use. 'js' is the default, 'css' works better for
134
- * server-side rendering.
135
- */
136
- implementation: PropTypes.oneOf(['js', 'css']),
137
- /**
138
- * If `true`, screens this size and down are hidden.
139
- */
140
- lgDown: PropTypes.bool,
141
- /**
142
- * If `true`, screens this size and up are hidden.
143
- */
144
- lgUp: PropTypes.bool,
145
- /**
146
- * If `true`, screens this size and down are hidden.
147
- */
148
- mdDown: PropTypes.bool,
149
- /**
150
- * If `true`, screens this size and up are hidden.
151
- */
152
- mdUp: PropTypes.bool,
153
- /**
154
- * Hide the given breakpoint(s).
155
- */
156
- only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),
157
- /**
158
- * If `true`, screens this size and down are hidden.
159
- */
160
- smDown: PropTypes.bool,
161
- /**
162
- * If `true`, screens this size and up are hidden.
163
- */
164
- smUp: PropTypes.bool,
165
- /**
166
- * If `true`, screens this size and down are hidden.
167
- */
168
- xlDown: PropTypes.bool,
169
- /**
170
- * If `true`, screens this size and up are hidden.
171
- */
172
- xlUp: PropTypes.bool,
173
- /**
174
- * If `true`, screens this size and down are hidden.
175
- */
176
- xsDown: PropTypes.bool,
177
- /**
178
- * If `true`, screens this size and up are hidden.
179
- */
180
- xsUp: PropTypes.bool
181
- } : void 0;
182
- export default HiddenCss;
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import { Breakpoint } from '@mui/system';
3
- export interface HiddenJsProps {
4
- width?: Breakpoint;
5
- lgDown?: boolean;
6
- lgUp?: boolean;
7
- mdDown?: boolean;
8
- mdUp?: boolean;
9
- only?: Breakpoint | Breakpoint[];
10
- smDown?: boolean;
11
- smUp?: boolean;
12
- xlDown?: boolean;
13
- xlUp?: boolean;
14
- xsDown?: boolean;
15
- xsUp?: boolean;
16
- }
17
- declare const HiddenJs: React.JSXElementConstructor<HiddenJsProps>;
18
- export default HiddenJs;
@@ -1,121 +0,0 @@
1
- 'use client';
2
-
3
- import PropTypes from 'prop-types';
4
- import exactProp from '@mui/utils/exactProp';
5
- import withWidth, { isWidthDown, isWidthUp } from "./withWidth.js";
6
- import useTheme from "../styles/useTheme.js";
7
-
8
- /**
9
- * @ignore - internal component.
10
- */
11
- function HiddenJs(props) {
12
- const {
13
- children,
14
- only,
15
- width
16
- } = props;
17
- const theme = useTheme();
18
- let visible = true;
19
-
20
- // `only` check is faster to get out sooner if used.
21
- if (only) {
22
- if (Array.isArray(only)) {
23
- for (let i = 0; i < only.length; i += 1) {
24
- const breakpoint = only[i];
25
- if (width === breakpoint) {
26
- visible = false;
27
- break;
28
- }
29
- }
30
- } else if (only && width === only) {
31
- visible = false;
32
- }
33
- }
34
-
35
- // Allow `only` to be combined with other props. If already hidden, no need to check others.
36
- if (visible) {
37
- // determine visibility based on the smallest size up
38
- for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
39
- const breakpoint = theme.breakpoints.keys[i];
40
- const breakpointUp = props[`${breakpoint}Up`];
41
- const breakpointDown = props[`${breakpoint}Down`];
42
- if (breakpointUp && isWidthUp(breakpoint, width) || breakpointDown && isWidthDown(breakpoint, width)) {
43
- visible = false;
44
- break;
45
- }
46
- }
47
- }
48
- if (!visible) {
49
- return null;
50
- }
51
- return children;
52
- }
53
- HiddenJs.propTypes = {
54
- /**
55
- * The content of the component.
56
- */
57
- children: PropTypes.node,
58
- /**
59
- * If `true`, screens this size and down are hidden.
60
- */
61
- // eslint-disable-next-line react/no-unused-prop-types
62
- lgDown: PropTypes.bool,
63
- /**
64
- * If `true`, screens this size and up are hidden.
65
- */
66
- // eslint-disable-next-line react/no-unused-prop-types
67
- lgUp: PropTypes.bool,
68
- /**
69
- * If `true`, screens this size and down are hidden.
70
- */
71
- // eslint-disable-next-line react/no-unused-prop-types
72
- mdDown: PropTypes.bool,
73
- /**
74
- * If `true`, screens this size and up are hidden.
75
- */
76
- // eslint-disable-next-line react/no-unused-prop-types
77
- mdUp: PropTypes.bool,
78
- /**
79
- * Hide the given breakpoint(s).
80
- */
81
- only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),
82
- /**
83
- * If `true`, screens this size and down are hidden.
84
- */
85
- // eslint-disable-next-line react/no-unused-prop-types
86
- smDown: PropTypes.bool,
87
- /**
88
- * If `true`, screens this size and up are hidden.
89
- */
90
- // eslint-disable-next-line react/no-unused-prop-types
91
- smUp: PropTypes.bool,
92
- /**
93
- * @ignore
94
- * width prop provided by withWidth decorator.
95
- */
96
- width: PropTypes.string.isRequired,
97
- /**
98
- * If `true`, screens this size and down are hidden.
99
- */
100
- // eslint-disable-next-line react/no-unused-prop-types
101
- xlDown: PropTypes.bool,
102
- /**
103
- * If `true`, screens this size and up are hidden.
104
- */
105
- // eslint-disable-next-line react/no-unused-prop-types
106
- xlUp: PropTypes.bool,
107
- /**
108
- * If `true`, screens this size and down are hidden.
109
- */
110
- // eslint-disable-next-line react/no-unused-prop-types
111
- xsDown: PropTypes.bool,
112
- /**
113
- * If `true`, screens this size and up are hidden.
114
- */
115
- // eslint-disable-next-line react/no-unused-prop-types
116
- xsUp: PropTypes.bool
117
- };
118
- if (process.env.NODE_ENV !== 'production') {
119
- HiddenJs.propTypes = exactProp(HiddenJs.propTypes);
120
- }
121
- export default withWidth()(HiddenJs);
@@ -1,3 +0,0 @@
1
- export declare function getHiddenCssUtilityClass(slot: string): string;
2
- declare const hiddenCssClasses: Record<"root" | "xlDown" | "xlUp" | "onlyXl" | "lgDown" | "lgUp" | "onlyLg" | "mdDown" | "mdUp" | "onlyMd" | "smDown" | "smUp" | "onlySm" | "xsDown" | "xsUp" | "onlyXs", string>;
3
- export default hiddenCssClasses;
@@ -1,7 +0,0 @@
1
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
- export function getHiddenCssUtilityClass(slot) {
4
- return generateUtilityClass('PrivateHiddenCss', slot);
5
- }
6
- const hiddenCssClasses = generateUtilityClasses('PrivateHiddenCss', ['root', 'xlDown', 'xlUp', 'onlyXl', 'lgDown', 'lgUp', 'onlyLg', 'mdDown', 'mdUp', 'onlyMd', 'smDown', 'smUp', 'onlySm', 'xsDown', 'xsUp', 'onlyXs']);
7
- export default hiddenCssClasses;
@@ -1,2 +0,0 @@
1
- export { default } from "./Hidden.js";
2
- export * from "./Hidden.js";
@@ -1 +0,0 @@
1
- export { default } from "./Hidden.js";
@@ -1,17 +0,0 @@
1
- import { Breakpoint } from '@mui/system';
2
- import { PropInjector } from '@mui/types';
3
- export interface WithWidthOptions {
4
- withTheme?: boolean;
5
- noSSR?: boolean;
6
- initialWidth?: Breakpoint;
7
- resizeInterval?: number;
8
- }
9
- export interface WithWidth {
10
- width: Breakpoint;
11
- }
12
- export interface WithWidthProps extends Partial<WithWidth> {
13
- innerRef?: React.Ref<any>;
14
- }
15
- export function isWidthDown(breakpoint: Breakpoint, screenWidth: Breakpoint, inclusive?: boolean): boolean;
16
- export function isWidthUp(breakpoint: Breakpoint, screenWidth: Breakpoint, inclusive?: boolean): boolean;
17
- export default function withWidth(options?: WithWidthOptions): PropInjector<WithWidth, WithWidthProps>;
@@ -1,109 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import PropTypes from 'prop-types';
5
- import getDisplayName from '@mui/utils/getDisplayName';
6
- import { getThemeProps } from '@mui/system/useThemeProps';
7
- import useTheme from "../styles/useTheme.js";
8
- import useEnhancedEffect from "../utils/useEnhancedEffect.js";
9
- import useMediaQuery from "../useMediaQuery/index.js";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
12
-
13
- // By default, returns true if screen width is the same or greater than the given breakpoint.
14
- export const isWidthUp = (breakpoint, width, inclusive = true) => {
15
- if (inclusive) {
16
- return breakpointKeys.indexOf(breakpoint) <= breakpointKeys.indexOf(width);
17
- }
18
- return breakpointKeys.indexOf(breakpoint) < breakpointKeys.indexOf(width);
19
- };
20
-
21
- // By default, returns true if screen width is less than the given breakpoint.
22
- export const isWidthDown = (breakpoint, width, inclusive = false) => {
23
- if (inclusive) {
24
- return breakpointKeys.indexOf(width) <= breakpointKeys.indexOf(breakpoint);
25
- }
26
- return breakpointKeys.indexOf(width) < breakpointKeys.indexOf(breakpoint);
27
- };
28
- const withWidth = (options = {}) => Component => {
29
- const {
30
- withTheme: withThemeOption = false,
31
- noSSR = false,
32
- initialWidth: initialWidthOption
33
- } = options;
34
- function WithWidth(props) {
35
- const contextTheme = useTheme();
36
- const theme = props.theme || contextTheme;
37
- const {
38
- initialWidth,
39
- width,
40
- ...other
41
- } = getThemeProps({
42
- theme,
43
- name: 'MuiWithWidth',
44
- props
45
- });
46
- const [mountedState, setMountedState] = React.useState(false);
47
- useEnhancedEffect(() => {
48
- setMountedState(true);
49
- }, []);
50
-
51
- /**
52
- * innerWidth |xs sm md lg xl
53
- * |-------|-------|-------|-------|------>
54
- * width | xs | sm | md | lg | xl
55
- */
56
- const keys = theme.breakpoints.keys.slice().reverse();
57
- const widthComputed = keys.reduce((output, key) => {
58
- // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
59
- // eslint-disable-next-line react-hooks/rules-of-hooks
60
- const matches = useMediaQuery(theme.breakpoints.up(key));
61
- return !output && matches ? key : output;
62
- }, null);
63
- const more = {
64
- width: width || (mountedState || noSSR ? widthComputed : undefined) || initialWidth || initialWidthOption,
65
- ...(withThemeOption ? {
66
- theme
67
- } : {}),
68
- ...other
69
- };
70
-
71
- // When rendering the component on the server,
72
- // we have no idea about the client browser screen width.
73
- // In order to prevent blinks and help the reconciliation of the React tree
74
- // we are not rendering the child component.
75
- //
76
- // An alternative is to use the `initialWidth` property.
77
- if (more.width === undefined) {
78
- return null;
79
- }
80
- return /*#__PURE__*/_jsx(Component, {
81
- ...more
82
- });
83
- }
84
- process.env.NODE_ENV !== "production" ? WithWidth.propTypes = {
85
- /**
86
- * As `window.innerWidth` is unavailable on the server,
87
- * we default to rendering an empty component during the first mount.
88
- * You might want to use a heuristic to approximate
89
- * the screen width of the client browser screen width.
90
- *
91
- * For instance, you could be using the user-agent or the client-hints.
92
- * https://caniuse.com/#search=client%20hint
93
- */
94
- initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
95
- /**
96
- * @ignore
97
- */
98
- theme: PropTypes.object,
99
- /**
100
- * Bypass the width calculation logic.
101
- */
102
- width: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
103
- } : void 0;
104
- if (process.env.NODE_ENV !== 'production') {
105
- WithWidth.displayName = `WithWidth(${getDisplayName(Component)})`;
106
- }
107
- return WithWidth;
108
- };
109
- export default withWidth;