UNPKG

@mui/material

Version:

Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.

129 lines (128 loc) 3.95 kB
'use client'; import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import composeClasses from '@mui/utils/composeClasses'; import { styled } from "../zero-styled/index.js"; import memoTheme from "../utils/memoTheme.js"; import { useDefaultProps } from "../DefaultPropsProvider/index.js"; import { getToolbarUtilityClass } from "./toolbarClasses.js"; import { jsx as _jsx } from "react/jsx-runtime"; const useUtilityClasses = ownerState => { const { classes, disableGutters, variant } = ownerState; const slots = { root: ['root', !disableGutters && 'gutters', variant] }; return composeClasses(slots, getToolbarUtilityClass, classes); }; const ToolbarRoot = styled('div', { name: 'MuiToolbar', slot: 'Root', overridesResolver: (props, styles) => { const { ownerState } = props; return [styles.root, !ownerState.disableGutters && styles.gutters, styles[ownerState.variant]]; } })(memoTheme(({ theme }) => ({ position: 'relative', display: 'flex', alignItems: 'center', variants: [{ props: ({ ownerState }) => !ownerState.disableGutters, style: { paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), [theme.breakpoints.up('sm')]: { paddingLeft: theme.spacing(3), paddingRight: theme.spacing(3) } } }, { props: { variant: 'dense' }, style: { minHeight: 48 } }, { props: { variant: 'regular' }, style: theme.mixins.toolbar }] }))); const Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(inProps, ref) { const props = useDefaultProps({ props: inProps, name: 'MuiToolbar' }); const { className, component = 'div', disableGutters = false, variant = 'regular', ...other } = props; const ownerState = { ...props, component, disableGutters, variant }; const classes = useUtilityClasses(ownerState); return /*#__PURE__*/_jsx(ToolbarRoot, { as: component, className: clsx(classes.root, className), ref: ref, ownerState: ownerState, ...other }); }); process.env.NODE_ENV !== "production" ? Toolbar.propTypes /* remove-proptypes */ = { // ┌────────────────────────────── Warning ──────────────────────────────┐ // │ These PropTypes are generated from the TypeScript type definitions. │ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │ // └─────────────────────────────────────────────────────────────────────┘ /** * The Toolbar children, usually a mixture of `IconButton`, `Button` and `Typography`. * The Toolbar is a flex container, allowing flex item properties to be used to lay out the children. */ children: PropTypes.node, /** * Override or extend the styles applied to the component. */ classes: PropTypes.object, /** * @ignore */ className: PropTypes.string, /** * The component used for the root node. * Either a string to use a HTML element or a component. */ component: PropTypes.elementType, /** * If `true`, disables gutter padding. * @default false */ disableGutters: PropTypes.bool, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]), /** * The variant to use. * @default 'regular' */ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['dense', 'regular']), PropTypes.string]) } : void 0; export default Toolbar;