next-recomponents 2.0.39 → 2.0.41

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
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, ReactNode, Dispatch, SetStateAction, InputHTMLAttributes, TextareaHTMLAttributes, ReactElement, TableHTMLAttributes } from 'react';
3
- import { React as React$2 } from 'next/dist/server/route-modules/app-page/vendored/rsc/entrypoints';
4
3
  import { GridValidRowModel } from '@mui/x-data-grid';
5
4
 
6
5
  interface Props$5 extends React.HTMLAttributes<HTMLDivElement> {
@@ -48,11 +47,12 @@ declare function useFormValues<T>(initial: Partial<T>): [Partial<T>, React$1.Act
48
47
  declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$3): react_jsx_runtime.JSX.Element;
49
48
 
50
49
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
51
- label: React$2.ReactNode;
50
+ label: React.ReactNode;
52
51
  regex?: RegExp;
53
- invalidMessage?: React$2.ReactNode;
52
+ invalidMessage?: React.ReactNode;
53
+ icon?: React.ReactNode;
54
54
  }
55
- declare function Input({ label, className, regex, invalidMessage, ...props }: InputProps): react_jsx_runtime.JSX.Element;
55
+ declare function Input({ label, className, regex, invalidMessage, icon, ...props }: InputProps): react_jsx_runtime.JSX.Element;
56
56
 
57
57
  declare const regularExpresions: {
58
58
  email: RegExp;
@@ -118,8 +118,38 @@ interface Props$1<T extends Record<string, ItemsRecord>> {
118
118
  endpoints: T;
119
119
  onError?: (error: any) => void;
120
120
  }
121
+ interface ShowOptions {
122
+ limit?: number;
123
+ merge?: boolean;
124
+ page?: number;
125
+ [key: string | number]: string | number | undefined | null | boolean;
126
+ }
127
+ type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
128
+ [K in keyof T]: {
129
+ typeof: T[K]["typeof"];
130
+ state: "success" | "loading" | "error";
131
+ show: (props: ShowOptions) => Promise<Array<T[K]["typeof"]>>;
132
+ create: (data: Partial<T[K]["typeof"]> | Partial<T[K]["typeof"]>[]) => Promise<T[K]["typeof"]>;
133
+ update: (id: number | string, data: Partial<T[K]["typeof"]> | Partial<T[K]["typeof"]>[]) => Promise<T[K]["typeof"]>;
134
+ remove: (id: number | string) => Promise<T[K]["typeof"]>;
135
+ find: (id: number | string, props?: Record<string, string>) => Promise<T[K]["typeof"]>;
136
+ getAllPages: (limit: number) => Promise<Array<T[K]["typeof"]>>;
137
+ data: Array<T[K]["typeof"]>;
138
+ selectedItem: T[K]["typeof"];
139
+ params: Record<string, any>;
140
+ currentPage: number;
141
+ totalItems: number;
142
+ totalPages: number;
143
+ errorMessage: string | undefined;
144
+ autoLoad?: boolean;
145
+ defaultParams?: Record<string, any>;
146
+ id?: number | string;
147
+ loaded: boolean;
148
+ setLoaded: () => void;
149
+ };
150
+ };
121
151
 
122
- declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1<T>): any;
152
+ declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1<T>): EnhancedEndpoints<T>;
123
153
 
124
154
  interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
125
155
  label?: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, ReactNode, Dispatch, SetStateAction, InputHTMLAttributes, TextareaHTMLAttributes, ReactElement, TableHTMLAttributes } from 'react';
3
- import { React as React$2 } from 'next/dist/server/route-modules/app-page/vendored/rsc/entrypoints';
4
3
  import { GridValidRowModel } from '@mui/x-data-grid';
5
4
 
6
5
  interface Props$5 extends React.HTMLAttributes<HTMLDivElement> {
@@ -48,11 +47,12 @@ declare function useFormValues<T>(initial: Partial<T>): [Partial<T>, React$1.Act
48
47
  declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$3): react_jsx_runtime.JSX.Element;
49
48
 
50
49
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
51
- label: React$2.ReactNode;
50
+ label: React.ReactNode;
52
51
  regex?: RegExp;
53
- invalidMessage?: React$2.ReactNode;
52
+ invalidMessage?: React.ReactNode;
53
+ icon?: React.ReactNode;
54
54
  }
55
- declare function Input({ label, className, regex, invalidMessage, ...props }: InputProps): react_jsx_runtime.JSX.Element;
55
+ declare function Input({ label, className, regex, invalidMessage, icon, ...props }: InputProps): react_jsx_runtime.JSX.Element;
56
56
 
57
57
  declare const regularExpresions: {
58
58
  email: RegExp;
@@ -118,8 +118,38 @@ interface Props$1<T extends Record<string, ItemsRecord>> {
118
118
  endpoints: T;
119
119
  onError?: (error: any) => void;
120
120
  }
121
+ interface ShowOptions {
122
+ limit?: number;
123
+ merge?: boolean;
124
+ page?: number;
125
+ [key: string | number]: string | number | undefined | null | boolean;
126
+ }
127
+ type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
128
+ [K in keyof T]: {
129
+ typeof: T[K]["typeof"];
130
+ state: "success" | "loading" | "error";
131
+ show: (props: ShowOptions) => Promise<Array<T[K]["typeof"]>>;
132
+ create: (data: Partial<T[K]["typeof"]> | Partial<T[K]["typeof"]>[]) => Promise<T[K]["typeof"]>;
133
+ update: (id: number | string, data: Partial<T[K]["typeof"]> | Partial<T[K]["typeof"]>[]) => Promise<T[K]["typeof"]>;
134
+ remove: (id: number | string) => Promise<T[K]["typeof"]>;
135
+ find: (id: number | string, props?: Record<string, string>) => Promise<T[K]["typeof"]>;
136
+ getAllPages: (limit: number) => Promise<Array<T[K]["typeof"]>>;
137
+ data: Array<T[K]["typeof"]>;
138
+ selectedItem: T[K]["typeof"];
139
+ params: Record<string, any>;
140
+ currentPage: number;
141
+ totalItems: number;
142
+ totalPages: number;
143
+ errorMessage: string | undefined;
144
+ autoLoad?: boolean;
145
+ defaultParams?: Record<string, any>;
146
+ id?: number | string;
147
+ loaded: boolean;
148
+ setLoaded: () => void;
149
+ };
150
+ };
121
151
 
122
- declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1<T>): any;
152
+ declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$1<T>): EnhancedEndpoints<T>;
123
153
 
124
154
  interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
125
155
  label?: string;