etudes 0.65.0 → 0.66.0

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.
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
7
  function Conditional(_a) {
8
8
  var children = _a.children, boolOrExpression = _a.if;
9
- if (typeof boolOrExpression === 'boolean' && boolOrExpression === true)
10
- return react_1.default.createElement(react_1.default.Fragment, null, children);
11
- if (typeof boolOrExpression === 'function' && boolOrExpression() === true)
12
- return react_1.default.createElement(react_1.default.Fragment, null, children);
13
- console.error("[etudes::Conditional] The type of provided condition ".concat(boolOrExpression, " is not supported."));
14
- return react_1.default.createElement(react_1.default.Fragment, null);
9
+ switch (typeof boolOrExpression) {
10
+ case 'boolean':
11
+ return boolOrExpression ? react_1.default.createElement(react_1.default.Fragment, null, children) : react_1.default.createElement(react_1.default.Fragment, null);
12
+ case 'function':
13
+ return boolOrExpression() ? react_1.default.createElement(react_1.default.Fragment, null, children) : react_1.default.createElement(react_1.default.Fragment, null);
14
+ default:
15
+ console.error("[etudes::Conditional] The type of provided condition ".concat(boolOrExpression, " is not supported."));
16
+ return react_1.default.createElement(react_1.default.Fragment, null);
17
+ }
15
18
  }
16
19
  exports.default = Conditional;
17
20
  //# sourceMappingURL=Conditional.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Conditional.js","sourceRoot":"/","sources":["Conditional.tsx"],"names":[],"mappings":";;;;;AAAA,gDAAgD;AAMhD,SAAwB,WAAW,CAAC,EAAyC;QAAvC,QAAQ,cAAA,EAAM,gBAAgB,QAAA;IAClE,IAAI,OAAO,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,IAAI;QAAE,OAAO,8DAAG,QAAQ,CAAI,CAAA;IAC9F,IAAI,OAAO,gBAAgB,KAAK,UAAU,IAAI,gBAAgB,EAAE,KAAK,IAAI;QAAE,OAAO,8DAAG,QAAQ,CAAI,CAAA;IACjG,OAAO,CAAC,KAAK,CAAC,+DAAwD,gBAAgB,uBAAoB,CAAC,CAAA;IAC3G,OAAO,6DAAK,CAAA;AACd,CAAC;AALD,8BAKC","sourcesContent":["import React, { PropsWithChildren } from 'react'\n\ntype Props = PropsWithChildren<{\n if: boolean | (() => boolean)\n}>\n\nexport default function Conditional({ children, if: boolOrExpression }: Props) {\n if (typeof boolOrExpression === 'boolean' && boolOrExpression === true) return <>{children}</>\n if (typeof boolOrExpression === 'function' && boolOrExpression() === true) return <>{children}</>\n console.error(`[etudes::Conditional] The type of provided condition ${boolOrExpression} is not supported.`)\n return <></>\n}\n"]}
1
+ {"version":3,"file":"Conditional.js","sourceRoot":"/","sources":["Conditional.tsx"],"names":[],"mappings":";;;;;AAAA,gDAAgD;AAMhD,SAAwB,WAAW,CAAC,EAAyC;QAAvC,QAAQ,cAAA,EAAM,gBAAgB,QAAA;IAClE,QAAQ,OAAO,gBAAgB,EAAE;QACjC,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACnD,KAAK,UAAU;YACb,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,6DAAK,CAAA;QACrD;YACE,OAAO,CAAC,KAAK,CAAC,+DAAwD,gBAAgB,uBAAoB,CAAC,CAAA;YAC3G,OAAO,6DAAK,CAAA;KACb;AACH,CAAC;AAVD,8BAUC","sourcesContent":["import React, { PropsWithChildren } from 'react'\n\ntype Props = PropsWithChildren<{\n if: boolean | (() => boolean)\n}>\n\nexport default function Conditional({ children, if: boolOrExpression }: Props) {\n switch (typeof boolOrExpression) {\n case 'boolean':\n return boolOrExpression ? <>{children}</> : <></>\n case 'function':\n return boolOrExpression() ? <>{children}</> : <></>\n default:\n console.error(`[etudes::Conditional] The type of provided condition ${boolOrExpression} is not supported.`)\n return <></>\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etudes",
3
- "version": "0.65.0",
3
+ "version": "0.66.0",
4
4
  "description": "A study of styled React components",
5
5
  "main": "lib",
6
6
  "scripts": {