@cleanweb/oore 2.0.0-alpha.36 → 2.0.0-alpha.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/slots/hook.d.ts +1 -1
- package/build/slots/hook.js +8 -6
- package/package.json +1 -1
package/build/slots/hook.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode, ReactPortal } from 'react';
|
|
|
2
2
|
import type { IUseSlots, PotentialSlotComponent } from './types';
|
|
3
3
|
export declare const isElementChild: (child: ReactNode) => child is ReactElement<any, any>;
|
|
4
4
|
interface IGetSlotName {
|
|
5
|
-
(TargetComponent: PotentialSlotComponent, child?: ReactElement):
|
|
5
|
+
(TargetComponent: PotentialSlotComponent, child?: ReactElement): keyof any | undefined;
|
|
6
6
|
}
|
|
7
7
|
export declare const getComponentSlotName: IGetSlotName;
|
|
8
8
|
export declare const isPortalChild: (child: ReactNode) => child is ReactPortal;
|
package/build/slots/hook.js
CHANGED
|
@@ -50,14 +50,16 @@ var getComponentSlotName = function (TargetComponent, child) {
|
|
|
50
50
|
return slotName;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
if (typeof TargetComponent
|
|
53
|
+
if (['string', 'symbol'].includes(typeof TargetComponent)) {
|
|
54
54
|
return TargetComponent;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
if (typeof TargetComponent === 'object' || typeof TargetComponent === 'function') {
|
|
57
|
+
if ('slotName' in TargetComponent) {
|
|
58
|
+
return TargetComponent.slotName;
|
|
59
|
+
}
|
|
60
|
+
else if ('displayName' in TargetComponent) {
|
|
61
|
+
return TargetComponent.displayName;
|
|
62
|
+
}
|
|
61
63
|
}
|
|
62
64
|
return undefined;
|
|
63
65
|
};
|
package/package.json
CHANGED