1
0
Fork 0

Added Statistics calculation

Statistics now show calculated values
This commit is contained in:
Techognito 2025-09-04 17:30:00 +02:00
parent fe87374e47
commit fc0f69dacb
2147 changed files with 141321 additions and 39 deletions

View file

@ -0,0 +1 @@
export * from "./useComponentRenderer.js";

View file

@ -0,0 +1 @@
export * from "./useComponentRenderer.js";

View file

@ -0,0 +1,12 @@
import * as React from 'react';
export type RenderProp<Props, State = {}> = ((props: Props, state: State) => React.ReactElement<unknown>) | React.ReactElement<Props>;
/**
* Resolves the rendering logic for a component.
* Handles three scenarios:
* 1. A render function that receives props and state
* 2. A React element
* 3. A default element
*
* @ignore - internal hook.
*/
export declare function useComponentRenderer<Props extends React.HTMLAttributes<any>, State extends Record<string, any>>(defaultElement: keyof React.JSX.IntrinsicElements | React.ComponentType<Props>, render: RenderProp<Props, State> | undefined, props: Props, state?: State): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;

View file

@ -0,0 +1,32 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
/**
* Resolves the rendering logic for a component.
* Handles three scenarios:
* 1. A render function that receives props and state
* 2. A React element
* 3. A default element
*
* @ignore - internal hook.
*/
export function useComponentRenderer(defaultElement, render, props, state = {}) {
if (typeof render === 'function') {
return render(props, state);
}
if (render) {
if (render.props.className) {
props.className = mergeClassNames(render.props.className, props.className);
}
if (render.props.style || props.style) {
props.style = _extends({}, props.style, render.props.style);
}
return /*#__PURE__*/React.cloneElement(render, props);
}
return /*#__PURE__*/React.createElement(defaultElement, props);
}
function mergeClassNames(className, otherClassName) {
if (!className || !otherClassName) {
return className || otherClassName;
}
return `${className} ${otherClassName}`;
}