@cleanweb/oore 2.0.0-beta.6 → 2.0.0-beta.8
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 +1 -3
- package/build/slots/types.d.ts +1 -0
- package/package.json +1 -1
package/build/slots/hook.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export declare const isPortalChild: (child: ReactNode) => child is ReactPortal;
|
|
|
17
17
|
* @see {@link SlotComponent} for more on how to use the returned slot nodes.
|
|
18
18
|
*/
|
|
19
19
|
export declare const useSlots: IUseSlots;
|
|
20
|
-
export type { SlottedComponent, TSlotsRecord, PotentialSlotComponent, } from './types';
|
|
20
|
+
export type { SlottedComponent, TSlotsRecord, SlotComponent, PotentialSlotComponent, } from './types';
|
package/build/slots/hook.js
CHANGED
|
@@ -47,9 +47,6 @@ var getComponentSlotName = function (TargetComponent, child) {
|
|
|
47
47
|
var keyTypes = ['string', 'number', 'symbol'];
|
|
48
48
|
var slotName = child.props['data-slot-name'];
|
|
49
49
|
if (keyTypes.includes(typeof slotName)) {
|
|
50
|
-
if (typeof child.type === 'string') {
|
|
51
|
-
child.props.tagName = child.type;
|
|
52
|
-
}
|
|
53
50
|
return slotName;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -96,6 +93,7 @@ var useSlots = function (children, Caller) {
|
|
|
96
93
|
});
|
|
97
94
|
return aliasLookup;
|
|
98
95
|
}, [Caller.Slots]);
|
|
96
|
+
// @todo Expose original source order of `children` with respect to slot aliases.
|
|
99
97
|
var result = (0, react_1.useMemo)(function () {
|
|
100
98
|
var _a;
|
|
101
99
|
var slotNodes = {};
|
package/build/slots/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, ComponentType, ReactPortal, JSX } from 'react';
|
|
2
|
+
/** @todo ComponentType force children to be ReactNode, but custom components can have any children type. */
|
|
2
3
|
type JSXTagLike = string | keyof JSX.IntrinsicElements | ComponentType<any>;
|
|
3
4
|
/** This fixes overly narrow T type used by React's ComponentProps type. */
|
|
4
5
|
export type ComponentProps<T extends JSXTagLike> = (T extends ComponentType<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {});
|