@tecsinapse/cortex-react 1.14.1-beta.4 → 1.14.1-beta.6
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/dist/cjs/components/Input/Face.js +7 -3
- package/dist/cjs/components/Popover/Trigger.js +1 -1
- package/dist/cjs/components/Stepper/Root.js +8 -4
- package/dist/cjs/components/TextArea/Face.js +3 -2
- package/dist/esm/components/Input/Face.js +7 -3
- package/dist/esm/components/Popover/Trigger.js +1 -1
- package/dist/esm/components/Stepper/Root.js +8 -4
- package/dist/esm/components/TextArea/Face.js +3 -2
- package/dist/types/utils/react.d.ts +1 -1
- package/package.json +3 -3
|
@@ -13,15 +13,19 @@ const getValidChildren = (children) => {
|
|
|
13
13
|
const InputFace = React.forwardRef(
|
|
14
14
|
({ children, variants, className, ...rest }, ref) => {
|
|
15
15
|
const clones = getValidChildren(children).map((el) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const element = el;
|
|
17
|
+
const elProps = element.props || {};
|
|
18
|
+
return React.cloneElement(element, { ...elProps, variants });
|
|
18
19
|
});
|
|
19
20
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20
21
|
"div",
|
|
21
22
|
{
|
|
22
23
|
"data-testid": "input-face",
|
|
23
24
|
...rest,
|
|
24
|
-
className: clsx(
|
|
25
|
+
className: clsx(
|
|
26
|
+
cortexCore.input(variants),
|
|
27
|
+
className
|
|
28
|
+
),
|
|
25
29
|
ref,
|
|
26
30
|
children: clones
|
|
27
31
|
}
|
|
@@ -13,7 +13,7 @@ const isDisabledProps = {
|
|
|
13
13
|
};
|
|
14
14
|
const PopoverTrigger = ({ children, disabled }) => {
|
|
15
15
|
const { triggerProps } = Context.usePopoverContext();
|
|
16
|
-
const isDisabled = disabled ?? children
|
|
16
|
+
const isDisabled = disabled ?? children.props.disabled;
|
|
17
17
|
return react.cloneWithProps(children, {
|
|
18
18
|
...triggerProps,
|
|
19
19
|
...isDisabled ? isDisabledProps : {}
|
|
@@ -14,8 +14,11 @@ const Root = ({
|
|
|
14
14
|
const initialSelectedIndex = React.useMemo(() => {
|
|
15
15
|
let initialIndex = null;
|
|
16
16
|
React.Children.forEach(children, (child, index) => {
|
|
17
|
-
if (React.isValidElement(child)
|
|
18
|
-
|
|
17
|
+
if (React.isValidElement(child)) {
|
|
18
|
+
const element = child;
|
|
19
|
+
if (element.props.selected) {
|
|
20
|
+
initialIndex = index;
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
});
|
|
21
24
|
return initialIndex;
|
|
@@ -41,13 +44,14 @@ const Root = ({
|
|
|
41
44
|
const renderNode = React.useMemo(
|
|
42
45
|
() => (child, index) => {
|
|
43
46
|
if (React.isValidElement(child) && child.type === Node.Node) {
|
|
44
|
-
|
|
47
|
+
const element = child;
|
|
48
|
+
return React.cloneElement(element, {
|
|
45
49
|
isFirst: index === 0,
|
|
46
50
|
isLast: index === childrenCount - 1,
|
|
47
51
|
selected: selectedNode === index,
|
|
48
52
|
segmented,
|
|
49
53
|
interactive,
|
|
50
|
-
onClick: () => handleNodeClick(index,
|
|
54
|
+
onClick: () => handleNodeClick(index, element.props.onClick)
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
return null;
|
|
@@ -9,8 +9,9 @@ var utils = require('./utils.js');
|
|
|
9
9
|
const TextAreaFace = React.forwardRef(
|
|
10
10
|
({ children, variants, className, ...rest }, ref) => {
|
|
11
11
|
const clones = utils.getValidChildren(children).map((el) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const element = el;
|
|
13
|
+
const elProps = element.props || {};
|
|
14
|
+
return React.cloneElement(element, { ...elProps, variants });
|
|
14
15
|
});
|
|
15
16
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16
17
|
"div",
|
|
@@ -11,15 +11,19 @@ const getValidChildren = (children) => {
|
|
|
11
11
|
const InputFace = React.forwardRef(
|
|
12
12
|
({ children, variants, className, ...rest }, ref) => {
|
|
13
13
|
const clones = getValidChildren(children).map((el) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const element = el;
|
|
15
|
+
const elProps = element.props || {};
|
|
16
|
+
return React.cloneElement(element, { ...elProps, variants });
|
|
16
17
|
});
|
|
17
18
|
return /* @__PURE__ */ jsx(
|
|
18
19
|
"div",
|
|
19
20
|
{
|
|
20
21
|
"data-testid": "input-face",
|
|
21
22
|
...rest,
|
|
22
|
-
className: clsx(
|
|
23
|
+
className: clsx(
|
|
24
|
+
input(variants),
|
|
25
|
+
className
|
|
26
|
+
),
|
|
23
27
|
ref,
|
|
24
28
|
children: clones
|
|
25
29
|
}
|
|
@@ -11,7 +11,7 @@ const isDisabledProps = {
|
|
|
11
11
|
};
|
|
12
12
|
const PopoverTrigger = ({ children, disabled }) => {
|
|
13
13
|
const { triggerProps } = usePopoverContext();
|
|
14
|
-
const isDisabled = disabled ?? children
|
|
14
|
+
const isDisabled = disabled ?? children.props.disabled;
|
|
15
15
|
return cloneWithProps(children, {
|
|
16
16
|
...triggerProps,
|
|
17
17
|
...isDisabled ? isDisabledProps : {}
|
|
@@ -12,8 +12,11 @@ const Root = ({
|
|
|
12
12
|
const initialSelectedIndex = useMemo(() => {
|
|
13
13
|
let initialIndex = null;
|
|
14
14
|
React.Children.forEach(children, (child, index) => {
|
|
15
|
-
if (React.isValidElement(child)
|
|
16
|
-
|
|
15
|
+
if (React.isValidElement(child)) {
|
|
16
|
+
const element = child;
|
|
17
|
+
if (element.props.selected) {
|
|
18
|
+
initialIndex = index;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
22
|
return initialIndex;
|
|
@@ -39,13 +42,14 @@ const Root = ({
|
|
|
39
42
|
const renderNode = useMemo(
|
|
40
43
|
() => (child, index) => {
|
|
41
44
|
if (React.isValidElement(child) && child.type === Node) {
|
|
42
|
-
|
|
45
|
+
const element = child;
|
|
46
|
+
return React.cloneElement(element, {
|
|
43
47
|
isFirst: index === 0,
|
|
44
48
|
isLast: index === childrenCount - 1,
|
|
45
49
|
selected: selectedNode === index,
|
|
46
50
|
segmented,
|
|
47
51
|
interactive,
|
|
48
|
-
onClick: () => handleNodeClick(index,
|
|
52
|
+
onClick: () => handleNodeClick(index, element.props.onClick)
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
return null;
|
|
@@ -7,8 +7,9 @@ import { getValidChildren } from './utils.js';
|
|
|
7
7
|
const TextAreaFace = React.forwardRef(
|
|
8
8
|
({ children, variants, className, ...rest }, ref) => {
|
|
9
9
|
const clones = getValidChildren(children).map((el) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const element = el;
|
|
11
|
+
const elProps = element.props || {};
|
|
12
|
+
return React.cloneElement(element, { ...elProps, variants });
|
|
12
13
|
});
|
|
13
14
|
return /* @__PURE__ */ jsx(
|
|
14
15
|
"div",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function cloneWithProps(children: React.ReactElement, props:
|
|
2
|
+
export declare function cloneWithProps(children: React.ReactElement, props: React.HTMLAttributes<HTMLDivElement>): React.FunctionComponentElement<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.14.1-beta.
|
|
3
|
+
"version": "1.14.1-beta.6",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "3.7.0",
|
|
23
|
-
"@tecsinapse/cortex-core": "1.2.0-beta.
|
|
23
|
+
"@tecsinapse/cortex-core": "1.2.0-beta.14",
|
|
24
24
|
"clsx": "2.1.1",
|
|
25
25
|
"currency.js": "2.0.4",
|
|
26
26
|
"embla-carousel-autoplay": "^8.0.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-icons": ">=5.2.0",
|
|
49
49
|
"tailwindcss": "^4.1.16"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a6fdde978ccee1839aa8c3e18561ea17af68a59a"
|
|
52
52
|
}
|