@importcsv/react 0.2.13 → 0.2.14
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/build/react/index.d.ts +153 -0
- package/package.json +2 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface Column {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type?: 'string' | 'number' | 'email' | 'date' | 'phone' | 'select';
|
|
7
|
+
validators?: Validator[];
|
|
8
|
+
transformations?: Transformer[];
|
|
9
|
+
options?: string[];
|
|
10
|
+
description?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type Validator = {
|
|
15
|
+
type: 'required';
|
|
16
|
+
message?: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'unique';
|
|
19
|
+
message?: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'regex';
|
|
22
|
+
pattern: string;
|
|
23
|
+
message?: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'min';
|
|
26
|
+
value: number;
|
|
27
|
+
message?: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'max';
|
|
30
|
+
value: number;
|
|
31
|
+
message?: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'min_length';
|
|
34
|
+
value: number;
|
|
35
|
+
message?: string;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'max_length';
|
|
38
|
+
value: number;
|
|
39
|
+
message?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type TransformationStage = 'pre' | 'post';
|
|
43
|
+
|
|
44
|
+
export type Transformer = {
|
|
45
|
+
type: 'trim';
|
|
46
|
+
stage?: TransformationStage;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'uppercase';
|
|
49
|
+
stage?: TransformationStage;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'lowercase';
|
|
52
|
+
stage?: TransformationStage;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'capitalize';
|
|
55
|
+
stage?: TransformationStage;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'remove_special_chars';
|
|
58
|
+
stage?: TransformationStage;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'normalize_phone';
|
|
61
|
+
stage?: TransformationStage;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'normalize_date';
|
|
64
|
+
format?: string;
|
|
65
|
+
stage?: TransformationStage;
|
|
66
|
+
} | {
|
|
67
|
+
type: 'default';
|
|
68
|
+
value: string;
|
|
69
|
+
stage?: TransformationStage;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'replace';
|
|
72
|
+
find: string;
|
|
73
|
+
replace: string;
|
|
74
|
+
stage?: TransformationStage;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'custom';
|
|
77
|
+
fn: (value: any) => any;
|
|
78
|
+
stage?: TransformationStage;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export interface ThemeConfig {
|
|
82
|
+
font?: {
|
|
83
|
+
family?: string;
|
|
84
|
+
size?: string;
|
|
85
|
+
};
|
|
86
|
+
colors?: {
|
|
87
|
+
primary?: string;
|
|
88
|
+
secondary?: string;
|
|
89
|
+
background?: string;
|
|
90
|
+
text?: string;
|
|
91
|
+
border?: string;
|
|
92
|
+
hover?: string;
|
|
93
|
+
disabled?: string;
|
|
94
|
+
};
|
|
95
|
+
borderRadius?: string;
|
|
96
|
+
spacing?: {
|
|
97
|
+
small?: string;
|
|
98
|
+
medium?: string;
|
|
99
|
+
large?: string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface CSVImporterProps {
|
|
104
|
+
columns?: Column[];
|
|
105
|
+
importerKey?: string;
|
|
106
|
+
onComplete?: (data: any) => void;
|
|
107
|
+
backendUrl?: string;
|
|
108
|
+
user?: Record<string, any>;
|
|
109
|
+
metadata?: Record<string, any>;
|
|
110
|
+
theme?: ThemeConfig | 'default' | 'minimal' | 'modern' | 'compact' | 'dark';
|
|
111
|
+
darkMode?: boolean;
|
|
112
|
+
primaryColor?: string;
|
|
113
|
+
className?: string;
|
|
114
|
+
customStyles?: Record<string, string> | string;
|
|
115
|
+
classNames?: {
|
|
116
|
+
root?: string;
|
|
117
|
+
modal?: string;
|
|
118
|
+
header?: string;
|
|
119
|
+
stepper?: string;
|
|
120
|
+
content?: string;
|
|
121
|
+
footer?: string;
|
|
122
|
+
button?: string;
|
|
123
|
+
input?: string;
|
|
124
|
+
table?: string;
|
|
125
|
+
dropzone?: string;
|
|
126
|
+
};
|
|
127
|
+
showDownloadTemplateButton?: boolean;
|
|
128
|
+
skipHeaderRowSelection?: boolean;
|
|
129
|
+
waitOnComplete?: boolean;
|
|
130
|
+
invalidRowHandling?: 'include' | 'exclude' | 'block';
|
|
131
|
+
includeUnmatchedColumns?: boolean;
|
|
132
|
+
language?: string;
|
|
133
|
+
customTranslations?: {
|
|
134
|
+
[language: string]: {
|
|
135
|
+
[key: string]: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
demoData?: {
|
|
139
|
+
fileName: string;
|
|
140
|
+
csvContent: string;
|
|
141
|
+
};
|
|
142
|
+
isModal?: boolean;
|
|
143
|
+
modalIsOpen?: boolean;
|
|
144
|
+
modalOnCloseTriggered?: () => void;
|
|
145
|
+
modalCloseOnOutsideClick?: boolean;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare const CSVImporter: React.FC<CSVImporterProps>;
|
|
149
|
+
|
|
150
|
+
export { CSVImporter };
|
|
151
|
+
export default CSVImporter;
|
|
152
|
+
|
|
153
|
+
export declare const importcsvStyles: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@importcsv/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "AI-powered CSV importer for React. Smart column mapping with OpenAI, natural language transformations. Self-hosted.",
|
|
5
5
|
"main": "build/react/index.js",
|
|
6
6
|
"module": "build/react/index.esm.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"homepage": "https://github.com/importcsv/importcsv#readme",
|
|
53
53
|
"types": "build/react/index.d.ts",
|
|
54
54
|
"scripts": {
|
|
55
|
-
"build:react": "vite build --mode react",
|
|
55
|
+
"build:react": "vite build --mode react && cp types/index.d.ts build/react/index.d.ts",
|
|
56
56
|
"build:preact": "vite build --mode preact",
|
|
57
57
|
"build:bundled": "vite build --mode bundled",
|
|
58
58
|
"build": "npm-run-all --parallel build:react build:preact build:bundled",
|