1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import composeClasses from '@mui/utils/composeClasses';
|
7 | import { styled } from "../zero-styled/index.js";
|
8 | import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
9 | import ListContext from "../List/ListContext.js";
|
10 | import { getListItemSecondaryActionClassesUtilityClass } from "./listItemSecondaryActionClasses.js";
|
11 | import { jsx as _jsx } from "react/jsx-runtime";
|
12 | const useUtilityClasses = ownerState => {
|
13 | const {
|
14 | disableGutters,
|
15 | classes
|
16 | } = ownerState;
|
17 | const slots = {
|
18 | root: ['root', disableGutters && 'disableGutters']
|
19 | };
|
20 | return composeClasses(slots, getListItemSecondaryActionClassesUtilityClass, classes);
|
21 | };
|
22 | const ListItemSecondaryActionRoot = styled('div', {
|
23 | name: 'MuiListItemSecondaryAction',
|
24 | slot: 'Root',
|
25 | overridesResolver: (props, styles) => {
|
26 | const {
|
27 | ownerState
|
28 | } = props;
|
29 | return [styles.root, ownerState.disableGutters && styles.disableGutters];
|
30 | }
|
31 | })({
|
32 | position: 'absolute',
|
33 | right: 16,
|
34 | top: '50%',
|
35 | transform: 'translateY(-50%)',
|
36 | variants: [{
|
37 | props: ({
|
38 | ownerState
|
39 | }) => ownerState.disableGutters,
|
40 | style: {
|
41 | right: 0
|
42 | }
|
43 | }]
|
44 | });
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | const ListItemSecondaryAction = React.forwardRef(function ListItemSecondaryAction(inProps, ref) {
|
52 | const props = useDefaultProps({
|
53 | props: inProps,
|
54 | name: 'MuiListItemSecondaryAction'
|
55 | });
|
56 | const {
|
57 | className,
|
58 | ...other
|
59 | } = props;
|
60 | const context = React.useContext(ListContext);
|
61 | const ownerState = {
|
62 | ...props,
|
63 | disableGutters: context.disableGutters
|
64 | };
|
65 | const classes = useUtilityClasses(ownerState);
|
66 | return _jsx(ListItemSecondaryActionRoot, {
|
67 | className: clsx(classes.root, className),
|
68 | ownerState: ownerState,
|
69 | ref: ref,
|
70 | ...other
|
71 | });
|
72 | });
|
73 | process.env.NODE_ENV !== "production" ? ListItemSecondaryAction.propTypes = {
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | |
79 |
|
80 |
|
81 | children: PropTypes.node,
|
82 | |
83 |
|
84 |
|
85 | classes: PropTypes.object,
|
86 | |
87 |
|
88 |
|
89 | className: PropTypes.string,
|
90 | |
91 |
|
92 |
|
93 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
94 | } : void 0;
|
95 | ListItemSecondaryAction.muiName = 'ListItemSecondaryAction';
|
96 | export default ListItemSecondaryAction; |
\ | No newline at end of file |