'use client'; import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import * as React from 'react'; import PropTypes from 'prop-types'; import { unstable_composeClasses as composeClasses } from '../composeClasses'; import { getOptionGroupUtilityClass } from './optionGroupClasses'; import { useSlotProps } from '../utils'; import { useClassNamesOverride } from '../utils/ClassNameConfigurator'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; function useUtilityClasses(disabled) { var slots = { root: ['root', disabled && 'disabled'], label: ['label'], list: ['list'] }; return composeClasses(slots, useClassNamesOverride(getOptionGroupUtilityClass)); } /** * An unstyled option group to be used within a Select. * * Demos: * * - [Select](https://mui.com/base-ui/react-select/) * * API: * * - [OptionGroup API](https://mui.com/base-ui/react-select/components-api/#option-group) */ var OptionGroup = /*#__PURE__*/React.forwardRef(function OptionGroup(props, forwardedRef) { var _props$disabled = props.disabled, disabled = _props$disabled === void 0 ? false : _props$disabled, _props$slotProps = props.slotProps, slotProps = _props$slotProps === void 0 ? {} : _props$slotProps, _props$slots = props.slots, slots = _props$slots === void 0 ? {} : _props$slots, other = _objectWithoutProperties(props, ["disabled", "slotProps", "slots"]); var Root = (slots == null ? void 0 : slots.root) || 'li'; var Label = (slots == null ? void 0 : slots.label) || 'span'; var List = (slots == null ? void 0 : slots.list) || 'ul'; var classes = useUtilityClasses(disabled); var rootProps = useSlotProps({ elementType: Root, externalSlotProps: slotProps.root, externalForwardedProps: other, additionalProps: { ref: forwardedRef }, ownerState: props, className: classes.root }); var labelProps = useSlotProps({ elementType: Label, externalSlotProps: slotProps.label, ownerState: props, className: classes.label }); var listProps = useSlotProps({ elementType: List, externalSlotProps: slotProps.list, ownerState: props, className: classes.list }); return /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, { children: [/*#__PURE__*/_jsx(Label, _extends({}, labelProps, { children: props.label })), /*#__PURE__*/_jsx(List, _extends({}, listProps, { children: props.children }))] })); }); process.env.NODE_ENV !== "production" ? OptionGroup.propTypes /* remove-proptypes */ = { // ┌────────────────────────────── Warning ──────────────────────────────┐ // │ These PropTypes are generated from the TypeScript type definitions. │ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │ // └─────────────────────────────────────────────────────────────────────┘ /** * @ignore */ children: PropTypes.node, /** * @ignore */ className: PropTypes.string, /** * If `true` all the options in the group will be disabled. * @default false */ disabled: PropTypes.bool, /** * The human-readable description of the group. */ label: PropTypes.node, /** * The props used for each slot inside the Input. * @default {} */ slotProps: PropTypes.shape({ label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), list: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) }), /** * The components used for each slot inside the OptionGroup. * Either a string to use a HTML element or a component. * @default {} */ slots: PropTypes.shape({ label: PropTypes.elementType, list: PropTypes.elementType, root: PropTypes.elementType }) } : void 0; export { OptionGroup };