next-recomponents 1.0.0
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 +122 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +50922 -0
- package/dist/index.mjs +50909 -0
- package/package.json +18 -0
- package/src/alert/index.tsx +24 -0
- package/src/button/colors.tsx +9 -0
- package/src/button/index.tsx +42 -0
- package/src/container/icons.tsx +65 -0
- package/src/container/index.tsx +175 -0
- package/src/form/index.tsx +95 -0
- package/src/index.tsx +10 -0
- package/src/input/index.tsx +43 -0
- package/src/regular-expresions/index.ts +11 -0
- package/src/select/close.tsx +15 -0
- package/src/select/icon.tsx +15 -0
- package/src/select/index.tsx +212 -0
- package/src/table/export.tsx +29 -0
- package/src/table/filter.menu.tsx +188 -0
- package/src/table/filters.tsx +77 -0
- package/src/table/h.tsx +185 -0
- package/src/table/index.tsx +55 -0
- package/src/table/td.tsx +75 -0
- package/src/text-area/index.tsx +52 -0
- package/src/use-resources/encode.decode.tsx +25 -0
- package/src/use-resources/functions.ts +0 -0
- package/src/use-resources/get.token.tsx +15 -0
- package/src/use-resources/http.codes.ts +77 -0
- package/src/use-resources/index.ts +189 -0
- package/src/use-resources/types.ts +41 -0
- package/tsconfig.json +15 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, Dispatch, SetStateAction, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface Props$4 {
|
|
5
|
+
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function Alert({ color, children, ...props }: Props$4): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
interface Props$3 extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
size?: "full" | "small";
|
|
13
|
+
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
14
|
+
}
|
|
15
|
+
declare function Button({ className, size, color, children, icon, ...props }: Props$3): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
type LocationItem = {
|
|
18
|
+
location: string;
|
|
19
|
+
name: React$1.ReactNode;
|
|
20
|
+
icon?: React$1.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function Container({ children, appName, menuList, navItems, leftPanel, footPanel, expandedFooter, expandedMenu, }: {
|
|
23
|
+
appName?: React$1.ReactNode;
|
|
24
|
+
children: React$1.ReactNode;
|
|
25
|
+
menuList?: Array<LocationItem>;
|
|
26
|
+
navItems?: Array<LocationItem>;
|
|
27
|
+
leftPanel?: React$1.ReactNode;
|
|
28
|
+
footPanel?: React$1.ReactNode;
|
|
29
|
+
expandedMenu?: boolean;
|
|
30
|
+
expandedFooter?: boolean;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
interface OnSubmitProps extends React$1.FormEvent<HTMLFormElement> {
|
|
34
|
+
values: Record<string, any>;
|
|
35
|
+
}
|
|
36
|
+
interface Props$2 {
|
|
37
|
+
onSubmit: (e: OnSubmitProps) => void;
|
|
38
|
+
children: React$1.ReactNode;
|
|
39
|
+
state?: [any, Dispatch<SetStateAction<any>>];
|
|
40
|
+
invalidMessage?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function Form({ onSubmit, state, invalidMessage, children, }: Props$2): react_jsx_runtime.JSX.Element;
|
|
43
|
+
|
|
44
|
+
interface InputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
45
|
+
label: React.ReactNode;
|
|
46
|
+
regex?: RegExp;
|
|
47
|
+
invalidMessage?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
declare function Input({ label, className, regex, invalidMessage, ...props }: InputProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
51
|
+
declare const regularExpresions: {
|
|
52
|
+
email: RegExp;
|
|
53
|
+
phone: RegExp;
|
|
54
|
+
number: RegExp;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
interface TableProps extends React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement> {
|
|
58
|
+
data: Record<string, any> | Array<Record<string, any>>;
|
|
59
|
+
dataTypes?: Record<string, any>;
|
|
60
|
+
mapedData?: any;
|
|
61
|
+
setMapedData?: any;
|
|
62
|
+
totals?: Array<string>;
|
|
63
|
+
symbols?: Record<string, ReactNode>;
|
|
64
|
+
exportName?: string;
|
|
65
|
+
}
|
|
66
|
+
declare function Table(props: TableProps): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
interface Props$1 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
69
|
+
label?: React$1.ReactNode;
|
|
70
|
+
maxLength?: number;
|
|
71
|
+
}
|
|
72
|
+
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$1): react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
interface ItemsRecord {
|
|
75
|
+
typeof: Object;
|
|
76
|
+
}
|
|
77
|
+
interface Props {
|
|
78
|
+
baseURI: string;
|
|
79
|
+
authURI?: string;
|
|
80
|
+
endpoints: Record<string, Partial<ItemsRecord>>;
|
|
81
|
+
}
|
|
82
|
+
interface ShowOptions {
|
|
83
|
+
limit?: number;
|
|
84
|
+
merge?: boolean;
|
|
85
|
+
page?: number;
|
|
86
|
+
[key: string | number]: string | number | undefined | null | boolean;
|
|
87
|
+
}
|
|
88
|
+
type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
|
|
89
|
+
[K in keyof T]: {
|
|
90
|
+
typeof: T[K]["typeof"];
|
|
91
|
+
state: "success" | "loading" | "error";
|
|
92
|
+
show: (props: ShowOptions) => Promise<Array<T[K]["typeof"]>>;
|
|
93
|
+
create: (data: Partial<T[K]["typeof"]>) => Promise<T[K]["typeof"]>;
|
|
94
|
+
update: (id: number | string, data: Partial<T[K]["typeof"]>) => Promise<T[K]["typeof"]>;
|
|
95
|
+
remove: (id: number | string) => Promise<T[K]["typeof"]>;
|
|
96
|
+
find: (id: number | string, props?: Record<string, string>) => Promise<T[K]["typeof"]>;
|
|
97
|
+
getAllPages: (limit: number) => Promise<Array<T[K]["typeof"]>>;
|
|
98
|
+
data: T[K]["typeof"][];
|
|
99
|
+
selectedItem: T[K]["typeof"];
|
|
100
|
+
params: Record<string, any>;
|
|
101
|
+
currentPage: number;
|
|
102
|
+
totalItems: number;
|
|
103
|
+
totalPages: number;
|
|
104
|
+
errorMessage: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, authURI, endpoints, }: Props): EnhancedEndpoints<T>;
|
|
109
|
+
|
|
110
|
+
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
111
|
+
label?: string;
|
|
112
|
+
placeholder?: string;
|
|
113
|
+
children: ReactNode;
|
|
114
|
+
name: string;
|
|
115
|
+
value?: string;
|
|
116
|
+
onChange?: any;
|
|
117
|
+
className?: string;
|
|
118
|
+
strictMode?: boolean;
|
|
119
|
+
}
|
|
120
|
+
declare function Select({ label, placeholder, children, strictMode, ...props }: CustomSelectProps): react_jsx_runtime.JSX.Element;
|
|
121
|
+
|
|
122
|
+
export { Alert, Button, Container, Form, Input, Select, Table, TextArea, regularExpresions, useResources };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, Dispatch, SetStateAction, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface Props$4 {
|
|
5
|
+
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function Alert({ color, children, ...props }: Props$4): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
interface Props$3 extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
size?: "full" | "small";
|
|
13
|
+
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
14
|
+
}
|
|
15
|
+
declare function Button({ className, size, color, children, icon, ...props }: Props$3): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
type LocationItem = {
|
|
18
|
+
location: string;
|
|
19
|
+
name: React$1.ReactNode;
|
|
20
|
+
icon?: React$1.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function Container({ children, appName, menuList, navItems, leftPanel, footPanel, expandedFooter, expandedMenu, }: {
|
|
23
|
+
appName?: React$1.ReactNode;
|
|
24
|
+
children: React$1.ReactNode;
|
|
25
|
+
menuList?: Array<LocationItem>;
|
|
26
|
+
navItems?: Array<LocationItem>;
|
|
27
|
+
leftPanel?: React$1.ReactNode;
|
|
28
|
+
footPanel?: React$1.ReactNode;
|
|
29
|
+
expandedMenu?: boolean;
|
|
30
|
+
expandedFooter?: boolean;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
interface OnSubmitProps extends React$1.FormEvent<HTMLFormElement> {
|
|
34
|
+
values: Record<string, any>;
|
|
35
|
+
}
|
|
36
|
+
interface Props$2 {
|
|
37
|
+
onSubmit: (e: OnSubmitProps) => void;
|
|
38
|
+
children: React$1.ReactNode;
|
|
39
|
+
state?: [any, Dispatch<SetStateAction<any>>];
|
|
40
|
+
invalidMessage?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function Form({ onSubmit, state, invalidMessage, children, }: Props$2): react_jsx_runtime.JSX.Element;
|
|
43
|
+
|
|
44
|
+
interface InputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
45
|
+
label: React.ReactNode;
|
|
46
|
+
regex?: RegExp;
|
|
47
|
+
invalidMessage?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
declare function Input({ label, className, regex, invalidMessage, ...props }: InputProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
51
|
+
declare const regularExpresions: {
|
|
52
|
+
email: RegExp;
|
|
53
|
+
phone: RegExp;
|
|
54
|
+
number: RegExp;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
interface TableProps extends React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement> {
|
|
58
|
+
data: Record<string, any> | Array<Record<string, any>>;
|
|
59
|
+
dataTypes?: Record<string, any>;
|
|
60
|
+
mapedData?: any;
|
|
61
|
+
setMapedData?: any;
|
|
62
|
+
totals?: Array<string>;
|
|
63
|
+
symbols?: Record<string, ReactNode>;
|
|
64
|
+
exportName?: string;
|
|
65
|
+
}
|
|
66
|
+
declare function Table(props: TableProps): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
interface Props$1 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
69
|
+
label?: React$1.ReactNode;
|
|
70
|
+
maxLength?: number;
|
|
71
|
+
}
|
|
72
|
+
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$1): react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
interface ItemsRecord {
|
|
75
|
+
typeof: Object;
|
|
76
|
+
}
|
|
77
|
+
interface Props {
|
|
78
|
+
baseURI: string;
|
|
79
|
+
authURI?: string;
|
|
80
|
+
endpoints: Record<string, Partial<ItemsRecord>>;
|
|
81
|
+
}
|
|
82
|
+
interface ShowOptions {
|
|
83
|
+
limit?: number;
|
|
84
|
+
merge?: boolean;
|
|
85
|
+
page?: number;
|
|
86
|
+
[key: string | number]: string | number | undefined | null | boolean;
|
|
87
|
+
}
|
|
88
|
+
type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
|
|
89
|
+
[K in keyof T]: {
|
|
90
|
+
typeof: T[K]["typeof"];
|
|
91
|
+
state: "success" | "loading" | "error";
|
|
92
|
+
show: (props: ShowOptions) => Promise<Array<T[K]["typeof"]>>;
|
|
93
|
+
create: (data: Partial<T[K]["typeof"]>) => Promise<T[K]["typeof"]>;
|
|
94
|
+
update: (id: number | string, data: Partial<T[K]["typeof"]>) => Promise<T[K]["typeof"]>;
|
|
95
|
+
remove: (id: number | string) => Promise<T[K]["typeof"]>;
|
|
96
|
+
find: (id: number | string, props?: Record<string, string>) => Promise<T[K]["typeof"]>;
|
|
97
|
+
getAllPages: (limit: number) => Promise<Array<T[K]["typeof"]>>;
|
|
98
|
+
data: T[K]["typeof"][];
|
|
99
|
+
selectedItem: T[K]["typeof"];
|
|
100
|
+
params: Record<string, any>;
|
|
101
|
+
currentPage: number;
|
|
102
|
+
totalItems: number;
|
|
103
|
+
totalPages: number;
|
|
104
|
+
errorMessage: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, authURI, endpoints, }: Props): EnhancedEndpoints<T>;
|
|
109
|
+
|
|
110
|
+
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
111
|
+
label?: string;
|
|
112
|
+
placeholder?: string;
|
|
113
|
+
children: ReactNode;
|
|
114
|
+
name: string;
|
|
115
|
+
value?: string;
|
|
116
|
+
onChange?: any;
|
|
117
|
+
className?: string;
|
|
118
|
+
strictMode?: boolean;
|
|
119
|
+
}
|
|
120
|
+
declare function Select({ label, placeholder, children, strictMode, ...props }: CustomSelectProps): react_jsx_runtime.JSX.Element;
|
|
121
|
+
|
|
122
|
+
export { Alert, Button, Container, Form, Input, Select, Table, TextArea, regularExpresions, useResources };
|