'use client'; /* eslint-disable jsx-a11y/aria-role */ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import { useSlotProps } from '@mui/base/utils'; import composeClasses from '@mui/utils/composeClasses'; import { useRtl } from '@mui/system/RtlProvider'; import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft'; import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight'; import ButtonBase from '../ButtonBase'; import useThemeProps from '../styles/useThemeProps'; import styled from '../styles/styled'; import tabScrollButtonClasses, { getTabScrollButtonUtilityClass } from './tabScrollButtonClasses'; import { jsx as _jsx } from "react/jsx-runtime"; var useUtilityClasses = function useUtilityClasses(ownerState) { var classes = ownerState.classes, orientation = ownerState.orientation, disabled = ownerState.disabled; var slots = { root: ['root', orientation, disabled && 'disabled'] }; return composeClasses(slots, getTabScrollButtonUtilityClass, classes); }; var TabScrollButtonRoot = styled(ButtonBase, { name: 'MuiTabScrollButton', slot: 'Root', overridesResolver: function overridesResolver(props, styles) { var ownerState = props.ownerState; return [styles.root, ownerState.orientation && styles[ownerState.orientation]]; } })(function (_ref) { var ownerState = _ref.ownerState; return _extends(_defineProperty({ width: 40, flexShrink: 0, opacity: 0.8 }, "&.".concat(tabScrollButtonClasses.disabled), { opacity: 0 }), ownerState.orientation === 'vertical' && { width: '100%', height: 40, '& svg': { transform: "rotate(".concat(ownerState.isRtl ? -90 : 90, "deg)") } }); }); var TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(inProps, ref) { var _slots$StartScrollBut, _slots$EndScrollButto; var props = useThemeProps({ props: inProps, name: 'MuiTabScrollButton' }); var className = props.className, _props$slots = props.slots, slots = _props$slots === void 0 ? {} : _props$slots, _props$slotProps = props.slotProps, slotProps = _props$slotProps === void 0 ? {} : _props$slotProps, direction = props.direction, orientation = props.orientation, disabled = props.disabled, other = _objectWithoutProperties(props, ["className", "slots", "slotProps", "direction", "orientation", "disabled"]); var isRtl = useRtl(); var ownerState = _extends({ isRtl: isRtl }, props); var classes = useUtilityClasses(ownerState); var StartButtonIcon = (_slots$StartScrollBut = slots.StartScrollButtonIcon) != null ? _slots$StartScrollBut : KeyboardArrowLeft; var EndButtonIcon = (_slots$EndScrollButto = slots.EndScrollButtonIcon) != null ? _slots$EndScrollButto : KeyboardArrowRight; var startButtonIconProps = useSlotProps({ elementType: StartButtonIcon, externalSlotProps: slotProps.startScrollButtonIcon, additionalProps: { fontSize: 'small' }, ownerState: ownerState }); var endButtonIconProps = useSlotProps({ elementType: EndButtonIcon, externalSlotProps: slotProps.endScrollButtonIcon, additionalProps: { fontSize: 'small' }, ownerState: ownerState }); return /*#__PURE__*/_jsx(TabScrollButtonRoot, _extends({ component: "div", className: clsx(classes.root, className), ref: ref, role: null, ownerState: ownerState, tabIndex: null }, other, { children: direction === 'left' ? /*#__PURE__*/_jsx(StartButtonIcon, _extends({}, startButtonIconProps)) : /*#__PURE__*/_jsx(EndButtonIcon, _extends({}, endButtonIconProps)) })); }); process.env.NODE_ENV !== "production" ? TabScrollButton.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 content of the component. */ children: PropTypes.node, /** * Override or extend the styles applied to the component. */ classes: PropTypes.object, /** * @ignore */ className: PropTypes.string, /** * The direction the button should indicate. */ direction: PropTypes.oneOf(['left', 'right']).isRequired, /** * If `true`, the component is disabled. * @default false */ disabled: PropTypes.bool, /** * The component orientation (layout flow direction). */ orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired, /** * The extra props for the slot components. * You can override the existing props or add new ones. * @default {} */ slotProps: PropTypes.shape({ endScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), startScrollButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) }), /** * The components used for each slot inside. * @default {} */ slots: PropTypes.shape({ EndScrollButtonIcon: PropTypes.elementType, StartScrollButtonIcon: 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 TabScrollButton;