@j2inn/resolvable-ui-elements 0.0.2-beta.5 → 0.0.2-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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { type FunctionResult } from './resolvableElements/elements/function/FunctionElement';
2
2
  export { isSectionData, type ParametersOfSection, type ResolvedSection, } from './resolvableElements/elements/section/SectionElementMeta';
3
3
  export { type UiElementData } from './resolvableElements/elements/UiElement';
4
+ export * from './resolvableElements/react/SectionChecker';
4
5
  export * from './resolvableElements/react/useResolverContext';
5
6
  export * from './resolvableElements/react/useResolveSection';
6
7
  export * from './useCurrentUser';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "isSectionData", { enumerable: true, get: functio
23
23
  //////////////////////////////////////////////////////////////////////////
24
24
  // React
25
25
  //////////////////////////////////////////////////////////////////////////
26
+ __exportStar(require("./resolvableElements/react/SectionChecker"), exports);
26
27
  __exportStar(require("./resolvableElements/react/useResolverContext"), exports);
27
28
  __exportStar(require("./resolvableElements/react/useResolveSection"), exports);
28
29
  //////////////////////////////////////////////////////////////////////////
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAMH,+FAIiE;AAHhE,mHAAA,aAAa,OAAA;AAKd,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,gFAA6D;AAC7D,+EAA4D;AAC5D,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,mDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAMH,+FAIiE;AAHhE,mHAAA,aAAa,OAAA;AAKd,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,4EAAyD;AACzD,gFAA6D;AAC7D,+EAA4D;AAC5D,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,mDAAgC"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { UiElementData } from 'resolvableElements/elements/UiElement';
3
+ /**
4
+ * An utility type that allows a component to accept props with or without a 'section' property.
5
+ */
6
+ export declare type OptionalSection<P> = P | (Omit<P, 'section'> & {
7
+ section?: undefined;
8
+ });
9
+ /**
10
+ * Higher-Order Component that takes a section based component as an argument and returns a new component
11
+ * that checks if the 'section' prop is defined before rendering the SectionComponent.
12
+ * If the 'section' prop is undefined, it returns an empty element.
13
+ *
14
+ *
15
+ *
16
+ * @template P - Props of the original SectionComponent
17
+ * @param {React.FC<P>} SectionComponent - The original component that will be wrapped
18
+ * @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
19
+ *
20
+ * @example
21
+ * const CheckedComponent = SectionChecker(({section, ...props}) => {
22
+ * return <div>{section.title}</div>
23
+ * })
24
+ */
25
+ export declare const SectionChecker: <P extends {
26
+ section: UiElementData;
27
+ }>(SectionComponent: React.FC<P>) => (props: OptionalSection<P>) => JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SectionChecker = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ /**
9
+ * Higher-Order Component that takes a section based component as an argument and returns a new component
10
+ * that checks if the 'section' prop is defined before rendering the SectionComponent.
11
+ * If the 'section' prop is undefined, it returns an empty element.
12
+ *
13
+ *
14
+ *
15
+ * @template P - Props of the original SectionComponent
16
+ * @param {React.FC<P>} SectionComponent - The original component that will be wrapped
17
+ * @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
18
+ *
19
+ * @example
20
+ * const CheckedComponent = SectionChecker(({section, ...props}) => {
21
+ * return <div>{section.title}</div>
22
+ * })
23
+ */
24
+ const SectionChecker = (SectionComponent) => {
25
+ const CheckedSectionComponent = (props) => {
26
+ return !props.section ? <></> : <SectionComponent {...props}/>;
27
+ };
28
+ return CheckedSectionComponent;
29
+ };
30
+ exports.SectionChecker = SectionChecker;
31
+ //# sourceMappingURL=SectionChecker.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB;;;;;;;;;;;;;;;GAeG;AACI,MAAM,cAAc,GAAG,CAC7B,gBAA6B,EAC5B,EAAE;IACH,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,EAAE;QAC7D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAA;IAChE,CAAC,CAAA;IAED,OAAO,uBAAuB,CAAA;AAC/B,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}
@@ -1,6 +1,7 @@
1
1
  export { type FunctionResult } from './resolvableElements/elements/function/FunctionElement';
2
2
  export { isSectionData, type ParametersOfSection, type ResolvedSection, } from './resolvableElements/elements/section/SectionElementMeta';
3
3
  export { type UiElementData } from './resolvableElements/elements/UiElement';
4
+ export * from './resolvableElements/react/SectionChecker';
4
5
  export * from './resolvableElements/react/useResolverContext';
5
6
  export * from './resolvableElements/react/useResolveSection';
6
7
  export * from './useCurrentUser';
package/dist_es/index.js CHANGED
@@ -5,6 +5,7 @@ export { isSectionData, } from './resolvableElements/elements/section/SectionEle
5
5
  //////////////////////////////////////////////////////////////////////////
6
6
  // React
7
7
  //////////////////////////////////////////////////////////////////////////
8
+ export * from './resolvableElements/react/SectionChecker';
8
9
  export * from './resolvableElements/react/useResolverContext';
9
10
  export * from './resolvableElements/react/useResolveSection';
10
11
  //////////////////////////////////////////////////////////////////////////
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EACN,aAAa,GAGb,MAAM,0DAA0D,CAAA;AAEjE,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,cAAc,+CAA+C,CAAA;AAC7D,cAAc,8CAA8C,CAAA;AAC5D,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EACN,aAAa,GAGb,MAAM,0DAA0D,CAAA;AAEjE,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,cAAc,2CAA2C,CAAA;AACzD,cAAc,+CAA+C,CAAA;AAC7D,cAAc,8CAA8C,CAAA;AAC5D,0EAA0E;AAC1E,QAAQ;AACR,0EAA0E;AAC1E,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { UiElementData } from 'resolvableElements/elements/UiElement';
3
+ /**
4
+ * An utility type that allows a component to accept props with or without a 'section' property.
5
+ */
6
+ export declare type OptionalSection<P> = P | (Omit<P, 'section'> & {
7
+ section?: undefined;
8
+ });
9
+ /**
10
+ * Higher-Order Component that takes a section based component as an argument and returns a new component
11
+ * that checks if the 'section' prop is defined before rendering the SectionComponent.
12
+ * If the 'section' prop is undefined, it returns an empty element.
13
+ *
14
+ *
15
+ *
16
+ * @template P - Props of the original SectionComponent
17
+ * @param {React.FC<P>} SectionComponent - The original component that will be wrapped
18
+ * @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
19
+ *
20
+ * @example
21
+ * const CheckedComponent = SectionChecker(({section, ...props}) => {
22
+ * return <div>{section.title}</div>
23
+ * })
24
+ */
25
+ export declare const SectionChecker: <P extends {
26
+ section: UiElementData;
27
+ }>(SectionComponent: React.FC<P>) => (props: OptionalSection<P>) => JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ /**
3
+ * Higher-Order Component that takes a section based component as an argument and returns a new component
4
+ * that checks if the 'section' prop is defined before rendering the SectionComponent.
5
+ * If the 'section' prop is undefined, it returns an empty element.
6
+ *
7
+ *
8
+ *
9
+ * @template P - Props of the original SectionComponent
10
+ * @param {React.FC<P>} SectionComponent - The original component that will be wrapped
11
+ * @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
12
+ *
13
+ * @example
14
+ * const CheckedComponent = SectionChecker(({section, ...props}) => {
15
+ * return <div>{section.title}</div>
16
+ * })
17
+ */
18
+ export const SectionChecker = (SectionComponent) => {
19
+ const CheckedSectionComponent = (props) => {
20
+ return !props.section ? <></> : <SectionComponent {...props}/>;
21
+ };
22
+ return CheckedSectionComponent;
23
+ };
24
+ //# sourceMappingURL=SectionChecker.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,gBAA6B,EAC5B,EAAE;IACH,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,EAAE;QAC7D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAA;IAChE,CAAC,CAAA;IAED,OAAO,uBAAuB,CAAA;AAC/B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j2inn/resolvable-ui-elements",
3
- "version": "0.0.2-beta.5",
3
+ "version": "0.0.2-beta.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",