@zero-library/common 2.1.1 → 2.1.2

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.mts CHANGED
@@ -124,7 +124,7 @@ interface RenderWrapperProps<C, P> {
124
124
  ctx?: C;
125
125
  DefaultComponent?: React.ReactNode | ((props: P) => React.ReactNode);
126
126
  }
127
- declare function RenderWrapper<C = any, P = any>({ control, ctx, DefaultComponent }: RenderWrapperProps<C, P>): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
127
+ declare const RenderWrapper: react.ForwardRefExoticComponent<RenderWrapperProps<unknown, unknown> & react.RefAttributes<unknown>>;
128
128
  declare const shouldRender: (control?: RenderControl<any, any> | null) => boolean;
129
129
  declare function propsMerge(control?: RenderControl<any, any> | null, props?: ObjectType<any>): {
130
130
  props: any;
package/dist/index.d.ts CHANGED
@@ -124,7 +124,7 @@ interface RenderWrapperProps<C, P> {
124
124
  ctx?: C;
125
125
  DefaultComponent?: React.ReactNode | ((props: P) => React.ReactNode);
126
126
  }
127
- declare function RenderWrapper<C = any, P = any>({ control, ctx, DefaultComponent }: RenderWrapperProps<C, P>): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode>;
127
+ declare const RenderWrapper: react.ForwardRefExoticComponent<RenderWrapperProps<unknown, unknown> & react.RefAttributes<unknown>>;
128
128
  declare const shouldRender: (control?: RenderControl<any, any> | null) => boolean;
129
129
  declare function propsMerge(control?: RenderControl<any, any> | null, props?: ObjectType<any>): {
130
130
  props: any;
package/dist/index.esm.js CHANGED
@@ -5183,22 +5183,22 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5183
5183
  function isRenderFn(node) {
5184
5184
  return isFunction(node) || isObject(node) && !isNull(node) && "$$typeof" in node && node.$$typeof === Symbol.for("react.forward_ref");
5185
5185
  }
5186
- function renderDefault(DefaultComponent, props) {
5186
+ function renderDefault(DefaultComponent, ref, props) {
5187
5187
  if (!DefaultComponent) return null;
5188
- return isRenderFn(DefaultComponent) ? /* @__PURE__ */ jsx(DefaultComponent, { ...props }) : DefaultComponent;
5188
+ return isRenderFn(DefaultComponent) ? /* @__PURE__ */ jsx(DefaultComponent, { ref, ...props }) : DefaultComponent;
5189
5189
  }
5190
- function RenderWrapper({ control = true, ctx, DefaultComponent }) {
5190
+ var RenderWrapper = forwardRef(function RenderWrapper2({ control = true, ctx, DefaultComponent }, ref) {
5191
5191
  if (control === false || isNull(control)) return null;
5192
5192
  if (control === true || control === void 0) {
5193
- return renderDefault(DefaultComponent);
5193
+ return renderDefault(DefaultComponent, ref);
5194
5194
  }
5195
5195
  const { visible = true, render, props } = control;
5196
5196
  if (!visible) return null;
5197
5197
  if (render) {
5198
5198
  return typeof render === "function" ? render(ctx) : render;
5199
5199
  }
5200
- return renderDefault(DefaultComponent, props);
5201
- }
5200
+ return renderDefault(DefaultComponent, ref, props);
5201
+ });
5202
5202
  var shouldRender = (control) => control != null && (isBoolean(control) ? control : control?.visible !== false);
5203
5203
  function propsMerge(control, props) {
5204
5204
  if (control === true || control === void 0) {