1 | 'use client';
|
2 |
|
3 | import _extends from "@babel/runtime/helpers/esm/extends";
|
4 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
5 | const _excluded = ["elementType", "externalSlotProps", "ownerState", "skipResolvingSlotProps"];
|
6 | import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
7 | import { appendOwnerState } from './appendOwnerState';
|
8 | import { mergeSlotProps } from './mergeSlotProps';
|
9 | import { resolveComponentProps } from './resolveComponentProps';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export function useSlotProps(parameters) {
|
19 | var _parameters$additiona;
|
20 | const {
|
21 | elementType,
|
22 | externalSlotProps,
|
23 | ownerState,
|
24 | skipResolvingSlotProps = false
|
25 | } = parameters,
|
26 | rest = _objectWithoutPropertiesLoose(parameters, _excluded);
|
27 | const resolvedComponentsProps = skipResolvingSlotProps ? {} : resolveComponentProps(externalSlotProps, ownerState);
|
28 | const {
|
29 | props: mergedProps,
|
30 | internalRef
|
31 | } = mergeSlotProps(_extends({}, rest, {
|
32 | externalSlotProps: resolvedComponentsProps
|
33 | }));
|
34 | const ref = useForkRef(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, (_parameters$additiona = parameters.additionalProps) == null ? void 0 : _parameters$additiona.ref);
|
35 | const props = appendOwnerState(elementType, _extends({}, mergedProps, {
|
36 | ref
|
37 | }), ownerState);
|
38 | return props;
|
39 | } |
\ | No newline at end of file |