Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99728070
OptionGroupUnstyled.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 26, 08:44
Size
3 KB
Mime Type
text/x-java
Expires
Tue, Jan 28, 08:44 (2 d)
Engine
blob
Format
Raw Data
Handle
23814535
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
OptionGroupUnstyled.js
View Options
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["component", "disabled", "slotProps", "slots"];
import * as React from 'react';
import PropTypes from 'prop-types';
import composeClasses from '../composeClasses';
import { getOptionGroupUnstyledUtilityClass } from './optionGroupUnstyledClasses';
import { useSlotProps } from '../utils';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
function useUtilityClasses(disabled) {
const slots = {
root: ['root', disabled && 'disabled'],
label: ['label'],
list: ['list']
};
return composeClasses(slots, getOptionGroupUnstyledUtilityClass, {});
}
/**
* An unstyled option group to be used within a SelectUnstyled.
*
* Demos:
*
* - [Unstyled Select](https://mui.com/base/react-select/)
*
* API:
*
* - [OptionGroupUnstyled API](https://mui.com/base/api/option-group-unstyled/)
*/
const OptionGroupUnstyled = /*#__PURE__*/React.forwardRef(function OptionGroupUnstyled(props, ref) {
const {
component,
disabled = false,
slotProps = {},
slots = {}
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const Root = component || slots?.root || 'li';
const Label = slots?.label || 'span';
const List = slots?.list || 'ul';
const classes = useUtilityClasses(disabled);
const rootProps = useSlotProps({
elementType: Root,
externalSlotProps: slotProps.root,
externalForwardedProps: other,
additionalProps: {
ref
},
ownerState: props,
className: classes.root
});
const labelProps = useSlotProps({
elementType: Label,
externalSlotProps: slotProps.label,
ownerState: props,
className: classes.label
});
const 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" ? OptionGroupUnstyled.propTypes /* remove-proptypes */ = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* @ignore
*/
children: PropTypes.node,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes.elementType,
/**
* 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 OptionGroupUnstyled.
* 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 default OptionGroupUnstyled;
Event Timeline
Log In to Comment