@primitiv-ui/react 0.1.20 → 0.1.21
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/package.json +1 -1
- package/src/Slot/Slot.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitiv-ui/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Headless, accessible React components built on the WAI-ARIA authoring patterns. Zero styles ship with this package — bring your own (CSS, Tailwind, CSS-in-JS, design tokens).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
package/src/Slot/Slot.tsx
CHANGED
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
cloneElement,
|
|
21
21
|
Children,
|
|
22
22
|
RefObject,
|
|
23
|
+
type ForwardRefExoticComponent,
|
|
24
|
+
type PropsWithoutRef,
|
|
25
|
+
type RefAttributes,
|
|
23
26
|
} from "react";
|
|
24
27
|
import { SlotProps } from "./types";
|
|
25
28
|
import { AnyProps, PossibleRef } from "../types";
|
|
@@ -137,7 +140,9 @@ function mergeProps(slotProps: AnyProps, childProps: AnyProps): AnyProps {
|
|
|
137
140
|
* return <button {...buttonProps}>{children}</button>;
|
|
138
141
|
* ```
|
|
139
142
|
*/
|
|
140
|
-
export const Slot
|
|
143
|
+
export const Slot: ForwardRefExoticComponent<
|
|
144
|
+
PropsWithoutRef<SlotProps> & RefAttributes<HTMLElement>
|
|
145
|
+
> = forwardRef<HTMLElement, SlotProps>(
|
|
141
146
|
({ children, ...slotProps }, forwardedRef) => {
|
|
142
147
|
if (Children.count(children) !== 1 || !isValidElement(children)) {
|
|
143
148
|
throw new Error("Slot requires exactly one React element child.");
|