UNPKG

2.84 kBJavaScriptView Raw
1'use client';
2
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import chainPropTypes from '@mui/utils/chainPropTypes';
7import composeClasses from '@mui/utils/composeClasses';
8import { styled } from "../zero-styled/index.js";
9import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10import Paper from "../Paper/index.js";
11import { getCardUtilityClass } from "./cardClasses.js";
12import { jsx as _jsx } from "react/jsx-runtime";
13const useUtilityClasses = ownerState => {
14 const {
15 classes
16 } = ownerState;
17 const slots = {
18 root: ['root']
19 };
20 return composeClasses(slots, getCardUtilityClass, classes);
21};
22const CardRoot = styled(Paper, {
23 name: 'MuiCard',
24 slot: 'Root',
25 overridesResolver: (props, styles) => styles.root
26})({
27 overflow: 'hidden'
28});
29const Card = /*#__PURE__*/React.forwardRef(function Card(inProps, ref) {
30 const props = useDefaultProps({
31 props: inProps,
32 name: 'MuiCard'
33 });
34 const {
35 className,
36 raised = false,
37 ...other
38 } = props;
39 const ownerState = {
40 ...props,
41 raised
42 };
43 const classes = useUtilityClasses(ownerState);
44 return /*#__PURE__*/_jsx(CardRoot, {
45 className: clsx(classes.root, className),
46 elevation: raised ? 8 : undefined,
47 ref: ref,
48 ownerState: ownerState,
49 ...other
50 });
51});
52process.env.NODE_ENV !== "production" ? Card.propTypes /* remove-proptypes */ = {
53 // ┌────────────────────────────── Warning ──────────────────────────────┐
54 // │ These PropTypes are generated from the TypeScript type definitions. │
55 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
56 // └─────────────────────────────────────────────────────────────────────┘
57 /**
58 * The content of the component.
59 */
60 children: PropTypes.node,
61 /**
62 * Override or extend the styles applied to the component.
63 */
64 classes: PropTypes.object,
65 /**
66 * @ignore
67 */
68 className: PropTypes.string,
69 /**
70 * If `true`, the card will use raised styling.
71 * @default false
72 */
73 raised: chainPropTypes(PropTypes.bool, props => {
74 if (props.raised && props.variant === 'outlined') {
75 return new Error('MUI: Combining `raised={true}` with `variant="outlined"` has no effect.');
76 }
77 return null;
78 }),
79 /**
80 * The system prop that allows defining system overrides as well as additional CSS styles.
81 */
82 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
83} : void 0;
84export default Card;
\No newline at end of file