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 memoTheme from "../utils/memoTheme.js";
|
9 | import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
10 | import { getToolbarUtilityClass } from "./toolbarClasses.js";
|
11 | import { jsx as _jsx } from "react/jsx-runtime";
|
12 | const useUtilityClasses = ownerState => {
|
13 | const {
|
14 | classes,
|
15 | disableGutters,
|
16 | variant
|
17 | } = ownerState;
|
18 | const slots = {
|
19 | root: ['root', !disableGutters && 'gutters', variant]
|
20 | };
|
21 | return composeClasses(slots, getToolbarUtilityClass, classes);
|
22 | };
|
23 | const ToolbarRoot = styled('div', {
|
24 | name: 'MuiToolbar',
|
25 | slot: 'Root',
|
26 | overridesResolver: (props, styles) => {
|
27 | const {
|
28 | ownerState
|
29 | } = props;
|
30 | return [styles.root, !ownerState.disableGutters && styles.gutters, styles[ownerState.variant]];
|
31 | }
|
32 | })(memoTheme(({
|
33 | theme
|
34 | }) => ({
|
35 | position: 'relative',
|
36 | display: 'flex',
|
37 | alignItems: 'center',
|
38 | variants: [{
|
39 | props: ({
|
40 | ownerState
|
41 | }) => !ownerState.disableGutters,
|
42 | style: {
|
43 | paddingLeft: theme.spacing(2),
|
44 | paddingRight: theme.spacing(2),
|
45 | [theme.breakpoints.up('sm')]: {
|
46 | paddingLeft: theme.spacing(3),
|
47 | paddingRight: theme.spacing(3)
|
48 | }
|
49 | }
|
50 | }, {
|
51 | props: {
|
52 | variant: 'dense'
|
53 | },
|
54 | style: {
|
55 | minHeight: 48
|
56 | }
|
57 | }, {
|
58 | props: {
|
59 | variant: 'regular'
|
60 | },
|
61 | style: theme.mixins.toolbar
|
62 | }]
|
63 | })));
|
64 | const Toolbar = React.forwardRef(function Toolbar(inProps, ref) {
|
65 | const props = useDefaultProps({
|
66 | props: inProps,
|
67 | name: 'MuiToolbar'
|
68 | });
|
69 | const {
|
70 | className,
|
71 | component = 'div',
|
72 | disableGutters = false,
|
73 | variant = 'regular',
|
74 | ...other
|
75 | } = props;
|
76 | const ownerState = {
|
77 | ...props,
|
78 | component,
|
79 | disableGutters,
|
80 | variant
|
81 | };
|
82 | const classes = useUtilityClasses(ownerState);
|
83 | return _jsx(ToolbarRoot, {
|
84 | as: component,
|
85 | className: clsx(classes.root, className),
|
86 | ref: ref,
|
87 | ownerState: ownerState,
|
88 | ...other
|
89 | });
|
90 | });
|
91 | process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | |
97 |
|
98 |
|
99 |
|
100 | children: PropTypes.node,
|
101 | |
102 |
|
103 |
|
104 | classes: PropTypes.object,
|
105 | |
106 |
|
107 |
|
108 | className: PropTypes.string,
|
109 | |
110 |
|
111 |
|
112 |
|
113 | component: PropTypes.elementType,
|
114 | |
115 |
|
116 |
|
117 |
|
118 | disableGutters: PropTypes.bool,
|
119 | |
120 |
|
121 |
|
122 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
123 | |
124 |
|
125 |
|
126 |
|
127 | variant: PropTypes .oneOfType([PropTypes.oneOf(['dense', 'regular']), PropTypes.string])
|
128 | } : void 0;
|
129 | export default Toolbar; |
\ | No newline at end of file |