@genesislcap/foundation-react-utils 14.354.2-FUI-2341-3.1

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/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Genesis Foundation React Utils
2
+
3
+ The `@genesislcap/foundation-react-utils` package provides a collection of utility functions and helpers designed to facilitate React development within Genesis applications. It aims to enhance productivity by offering reusable React-specific solutions for patterns and problems encountered across different projects.
4
+
5
+ ## API Documentation
6
+
7
+ For more detailed information on API and configurations, please refer to the API documentation in the `docs/api` directory (to be generated).
8
+
9
+ ## Features
10
+
11
+ This is a new module. Features and utilities will be added as they are developed. This module will include:
12
+
13
+ - React-specific utilities for Genesis applications
14
+ - Helper functions for common React patterns
15
+ - Utilities for improving layout functionality in React applications
16
+
17
+ ## Installation
18
+
19
+ To include `@genesislcap/foundation-react-utils` in your project, add it as a dependency in your `package.json` file and follow your project's routine for dependency installation.
20
+
21
+ ```json
22
+ {
23
+ "dependencies": {
24
+ "@genesislcap/foundation-react-utils": "latest"
25
+ }
26
+ }
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```typescript
32
+ import { /* utilities will be exported here */ } from '@genesislcap/foundation-react-utils';
33
+ ```
34
+
35
+ ## License
36
+
37
+ Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
38
+
39
+ ### Licensed components
40
+
41
+ Genesis low-code platform
42
+
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../api-extractor.json"
4
+ }
5
+
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ /** Globs to analyze */
3
+ globs: ['src/**/*.ts'],
4
+ /** Directory to output CEM to */
5
+ outdir: './dist',
6
+ /** Run in dev mode, provides extra logging */
7
+ dev: false,
8
+ /** Enable special handling for FastElement */
9
+ fast: true,
10
+ /** Include third party custom elements manifests */
11
+ dependencies: true,
12
+ /** Output CEM path to `package.json`, defaults to true */
13
+ packagejson: true,
14
+ };
@@ -0,0 +1,48 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "VERSION",
12
+ "type": {
13
+ "text": "string"
14
+ },
15
+ "default": "'14.354.2'",
16
+ "description": "Package version",
17
+ "privacy": "public"
18
+ }
19
+ ],
20
+ "exports": [
21
+ {
22
+ "kind": "js",
23
+ "name": "VERSION",
24
+ "declaration": {
25
+ "name": "VERSION",
26
+ "module": "src/index.ts"
27
+ }
28
+ },
29
+ {
30
+ "kind": "js",
31
+ "name": "reactFactory",
32
+ "declaration": {
33
+ "name": "reactFactory",
34
+ "module": "./react-layout-factory"
35
+ }
36
+ },
37
+ {
38
+ "kind": "js",
39
+ "name": "reactFactoryWithProvider",
40
+ "declaration": {
41
+ "name": "reactFactoryWithProvider",
42
+ "module": "./react-layout-factory"
43
+ }
44
+ }
45
+ ]
46
+ }
47
+ ]
48
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @genesislcap/foundation-react-utils
3
+ *
4
+ * Utility functions and helpers for building React applications with Genesis Foundation.
5
+ *
6
+ * This module serves as a central location for React-specific utilities.
7
+ * Exports will be added here as utilities are developed.
8
+ */
9
+ /**
10
+ * Package version
11
+ * @public
12
+ */
13
+ export declare const VERSION = "14.354.2";
14
+ export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,OAAO,aAAa,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { ComponentFactory } from '@genesislcap/foundation-layout';
2
+ import * as React from 'react';
3
+ /**
4
+ * Creates a factory function for rendering React components in layout items.
5
+ *
6
+ * @param Component - React component to render
7
+ * @param props - Optional props to pass to the component
8
+ * @returns ComponentFactory compatible with foundation-layout
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <foundation-layout-item
13
+ * registration="my-component"
14
+ * title="My Component"
15
+ * factory={reactFactory(MyComponent, { someProp: 'value' })}
16
+ * />
17
+ * ```
18
+ */
19
+ export declare function reactFactory<P = {}>(Component: React.ComponentType<P>, props?: P): ComponentFactory;
20
+ /**
21
+ * Creates a factory function that wraps a React component with a provider (e.g., Redux Provider, Context Provider).
22
+ *
23
+ * @param Component - React component to render
24
+ * @param Wrapper - Wrapper component (e.g., Redux Provider, Context Provider)
25
+ * @param wrapperProps - Props for the wrapper component
26
+ * @param componentProps - Optional props for the component
27
+ * @returns ComponentFactory compatible with foundation-layout
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * import { Provider } from 'react-redux';
32
+ * import { store } from './store';
33
+ *
34
+ * <foundation-layout-item
35
+ * registration="my-component"
36
+ * title="My Component"
37
+ * factory={reactFactoryWithProvider(
38
+ * MyComponent,
39
+ * Provider,
40
+ * { store },
41
+ * { someProp: 'value' }
42
+ * )}
43
+ * />
44
+ * ```
45
+ */
46
+ export declare function reactFactoryWithProvider<CP = {}, WP = {}>(Component: React.ComponentType<CP>, Wrapper: React.ComponentType<WP & {
47
+ children: React.ReactNode;
48
+ }>, wrapperProps: WP, componentProps?: CP): ComponentFactory;
49
+ //# sourceMappingURL=react-layout-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-layout-factory.d.ts","sourceRoot":"","sources":["../../src/react-layout-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,EAAE,EACjC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,KAAK,CAAC,EAAE,CAAC,GACR,gBAAgB,CAUlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EACvD,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,EAClC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,EAChE,YAAY,EAAE,EAAE,EAChB,cAAc,CAAC,EAAE,EAAE,GAClB,gBAAgB,CAclB"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.52.10"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @genesislcap/foundation-react-utils
3
+ *
4
+ * Utility functions and helpers for building React applications with Genesis Foundation.
5
+ *
6
+ * This module serves as a central location for React-specific utilities.
7
+ * Exports will be added here as utilities are developed.
8
+ */
9
+ /**
10
+ * Package version
11
+ * @public
12
+ */
13
+ export const VERSION = '14.354.2';
14
+ export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createRoot } from 'react-dom/client';
3
+ /**
4
+ * Creates a factory function for rendering React components in layout items.
5
+ *
6
+ * @param Component - React component to render
7
+ * @param props - Optional props to pass to the component
8
+ * @returns ComponentFactory compatible with foundation-layout
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <foundation-layout-item
13
+ * registration="my-component"
14
+ * title="My Component"
15
+ * factory={reactFactory(MyComponent, { someProp: 'value' })}
16
+ * />
17
+ * ```
18
+ */
19
+ export function reactFactory(Component, props) {
20
+ return (container) => {
21
+ const root = createRoot(container);
22
+ root.render(_jsx(Component, Object.assign({}, (props || {}))));
23
+ // Return cleanup function
24
+ return () => {
25
+ root.unmount();
26
+ };
27
+ };
28
+ }
29
+ /**
30
+ * Creates a factory function that wraps a React component with a provider (e.g., Redux Provider, Context Provider).
31
+ *
32
+ * @param Component - React component to render
33
+ * @param Wrapper - Wrapper component (e.g., Redux Provider, Context Provider)
34
+ * @param wrapperProps - Props for the wrapper component
35
+ * @param componentProps - Optional props for the component
36
+ * @returns ComponentFactory compatible with foundation-layout
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * import { Provider } from 'react-redux';
41
+ * import { store } from './store';
42
+ *
43
+ * <foundation-layout-item
44
+ * registration="my-component"
45
+ * title="My Component"
46
+ * factory={reactFactoryWithProvider(
47
+ * MyComponent,
48
+ * Provider,
49
+ * { store },
50
+ * { someProp: 'value' }
51
+ * )}
52
+ * />
53
+ * ```
54
+ */
55
+ export function reactFactoryWithProvider(Component, Wrapper, wrapperProps, componentProps) {
56
+ return (container) => {
57
+ const root = createRoot(container);
58
+ root.render(_jsx(Wrapper, Object.assign({}, wrapperProps, { children: _jsx(Component, Object.assign({}, (componentProps || {}))) })));
59
+ // Return cleanup function
60
+ return () => {
61
+ root.unmount();
62
+ };
63
+ };
64
+ }