UNPKG

4.36 kBJavaScriptView Raw
1'use client';
2
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import HiddenJs from "./HiddenJs.js";
6import 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 */
13import { jsx as _jsx } from "react/jsx-runtime";
14function 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}
58process.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;
140export default Hidden;
\No newline at end of file