@wwog/react 1.1.2 → 1.1.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.
package/dist/index.js CHANGED
@@ -134,15 +134,13 @@ const If = ({
134
134
  if (condition) {
135
135
  return thenChild ? /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, thenChild.props.children) : null;
136
136
  }
137
- const matchedElseIf = elseIfChildren.find((child) => {
138
- const elseIfProps = child.props;
139
- return elseIfProps.condition;
140
- });
141
- if (matchedElseIf) {
142
- return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, matchedElseIf.props.children);
137
+ for (const elseIf of elseIfChildren) {
138
+ if (elseIf.props.condition) {
139
+ return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, elseIf.props.children);
140
+ }
143
141
  }
144
142
  if (elseChild) {
145
- return elseChild ? /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, elseChild.props.children) : null;
143
+ return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, elseChild.props.children);
146
144
  }
147
145
  return null;
148
146
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwog/react",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "wwog",
@@ -72,19 +72,14 @@ export const If = ({
72
72
  return thenChild ? <>{thenChild.props.children}</> : null;
73
73
  }
74
74
 
75
- const matchedElseIf = elseIfChildren.find((child) => {
76
- const elseIfProps = child.props as ElseIfProps;
77
- return elseIfProps.condition;
78
- });
79
-
80
- if (matchedElseIf) {
81
- return <>{matchedElseIf.props.children}</>;
75
+ for (const elseIf of elseIfChildren) {
76
+ if (elseIf.props.condition) {
77
+ return <>{elseIf.props.children}</>;
78
+ }
82
79
  }
83
80
 
84
81
  if (elseChild) {
85
- return elseChild ? (
86
- <>{(elseChild as React.ReactElement<ElseProps>).props.children}</>
87
- ) : null;
82
+ return <>{(elseChild as React.ReactElement<ElseProps>).props.children}</>;
88
83
  }
89
84
 
90
85
  return null;