1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import { isHostComponent } from './isHostComponent';
|
3 |
|
4 | /**
|
5 | * Type of the ownerState based on the type of an element it applies to.
|
6 | * This resolves to the provided OwnerState for React components and `undefined` for host components.
|
7 | * Falls back to `OwnerState | undefined` when the exact type can't be determined in development time.
|
8 | */
|
9 |
|
10 | /**
|
11 | * Appends the ownerState object to the props, merging with the existing one if necessary.
|
12 | *
|
13 | * @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied.
|
14 | * @param otherProps Props of the element.
|
15 | * @param ownerState
|
16 | */
|
17 | export function appendOwnerState(elementType, otherProps, ownerState) {
|
18 | if (elementType === undefined || isHostComponent(elementType)) {
|
19 | return otherProps;
|
20 | }
|
21 | return _extends({}, otherProps, {
|
22 | ownerState: _extends({}, otherProps.ownerState, ownerState)
|
23 | });
|
24 | } |
\ | No newline at end of file |