@choice-ui/react 1.5.2 → 1.5.3

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.
@@ -1,13 +1,20 @@
1
1
  import React, { forwardRef, useMemo } from "react";
2
2
  import { jsx, Fragment } from "react/jsx-runtime";
3
+ var REACT_MAJOR = parseInt(React.version.split(".")[0], 10);
4
+ var IS_REACT_19 = REACT_MAJOR >= 19;
5
+ function getChildRef(children) {
6
+ if (IS_REACT_19) {
7
+ return children.props.ref;
8
+ }
9
+ return void 0;
10
+ }
3
11
  var Slot = forwardRef(
4
12
  ({ children, ...slotProps }, forwardedRef) => {
5
13
  const slottedChild = useMemo(() => {
6
14
  if (!React.isValidElement(children)) {
7
15
  return children;
8
16
  }
9
- const childProps = children.props;
10
- const childRef = childProps.ref;
17
+ const childRef = getChildRef(children);
11
18
  const mergedProps = mergeProps(slotProps, children.props);
12
19
  return React.cloneElement(children, {
13
20
  ...mergedProps,
@@ -24,8 +31,7 @@ var SlotClone = forwardRef(
24
31
  if (!React.isValidElement(children)) {
25
32
  return children;
26
33
  }
27
- const childProps = children.props;
28
- const childRef = childProps.ref;
34
+ const childRef = getChildRef(children);
29
35
  const mergedProps = mergeProps(slotProps, children.props);
30
36
  return React.cloneElement(children, {
31
37
  ...mergedProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choice-ui/react",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "A desktop-first React UI component library built for professional desktop applications with comprehensive documentation",
5
5
  "sideEffects": false,
6
6
  "type": "module",