@mui/joy
Version:
Joy UI is an open-source React component library that implements MUI's own design principles. It's comprehensive and can be used in production out of the box.
115 lines (114 loc) • 4 kB
JavaScript
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["component", "children", "buttonFlex", "orientation", "slots", "slotProps"];
import * as React from 'react';
import PropTypes from 'prop-types';
import { unstable_composeClasses as composeClasses } from '@mui/base';
import { useThemeProps } from '../styles';
import styled from '../styles/styled';
import { getDialogActionsUtilityClass } from './dialogActionsClasses';
import useSlot from '../utils/useSlot';
import { StyledCardActionsRoot } from '../CardActions/CardActions';
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = () => {
const slots = {
root: ['root']
};
return composeClasses(slots, getDialogActionsUtilityClass, {});
};
const DialogActionsRoot = styled(StyledCardActionsRoot, {
name: 'JoyDialogActions',
slot: 'Root',
overridesResolver: (props, styles) => styles.root
})({});
/**
*
* Demos:
*
* - [Modal](https://mui.com/joy-ui/react-modal/)
*
* API:
*
* - [DialogActions API](https://mui.com/joy-ui/api/dialog-actions/)
*/
const DialogActions = /*#__PURE__*/React.forwardRef(function DialogActions(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: 'JoyDialogActions'
});
const {
component = 'div',
children,
buttonFlex,
orientation = 'horizontal-reverse',
slots = {},
slotProps = {}
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const externalForwardedProps = _extends({}, other, {
component,
slots,
slotProps
});
const ownerState = _extends({}, props, {
component,
buttonFlex,
orientation
});
const classes = useUtilityClasses();
const [SlotRoot, rootProps] = useSlot('root', {
ref,
className: classes.root,
elementType: DialogActionsRoot,
externalForwardedProps,
ownerState
});
return /*#__PURE__*/_jsx(SlotRoot, _extends({}, rootProps, {
children: children
}));
});
process.env.NODE_ENV !== "production" ? DialogActions.propTypes /* remove-proptypes */ = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* The CSS `flex` for the Button and its wrapper.
*/
buttonFlex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* Used to render icon or text elements inside the DialogActions if `src` is not set.
* This can be an element, or just a string.
*/
children: PropTypes.node,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes.elementType,
/**
* The component orientation.
* @default 'horizontal-reverse'
*/
orientation: PropTypes.oneOf(['horizontal-reverse', 'horizontal', 'vertical']),
/**
* The props used for each slot inside.
* @default {}
*/
slotProps: PropTypes.shape({
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}),
/**
* The components used for each slot inside.
* @default {}
*/
slots: PropTypes.shape({
root: PropTypes.elementType
}),
/**
* 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])
} : void 0;
export default DialogActions;