@importcsv/react 0.4.5 → 0.4.7

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.
Files changed (182) hide show
  1. package/README.md +47 -84
  2. package/build/preact/index.esm.js +2180 -2259
  3. package/build/preact/index.esm.js.map +1 -1
  4. package/build/preact/index.js +16 -117
  5. package/build/preact/index.js.map +1 -1
  6. package/build/react/index.esm.js +2473 -2522
  7. package/build/react/index.esm.js.map +1 -1
  8. package/build/react/index.js +16 -117
  9. package/build/react/index.js.map +1 -1
  10. package/package.json +11 -10
  11. package/build/App.d.ts +0 -2
  12. package/build/bundled/index.esm.js +0 -11531
  13. package/build/bundled/index.esm.js.map +0 -1
  14. package/build/bundled/index.js +0 -139
  15. package/build/bundled/index.js.map +0 -1
  16. package/build/bundled/index.umd.js +0 -139
  17. package/build/bundled/index.umd.js.map +0 -1
  18. package/build/bundled-styles.d.ts +0 -1
  19. package/build/components/CSVImporter/index.d.ts +0 -55
  20. package/build/components/CSVImporter/index.test.d.ts +0 -1
  21. package/build/components/CSVImporterHeadless.d.ts +0 -46
  22. package/build/components/ColumnMapper.d.ts +0 -28
  23. package/build/components/Modal/index.d.ts +0 -12
  24. package/build/components/Uploader.d.ts +0 -27
  25. package/build/components/Validator.d.ts +0 -28
  26. package/build/components/__tests__/CSVImporterHeadless.test.d.ts +0 -1
  27. package/build/components/__tests__/ColumnMapper.test.d.ts +0 -1
  28. package/build/components/__tests__/Uploader.test.d.ts +0 -1
  29. package/build/components/__tests__/Validator.test.d.ts +0 -1
  30. package/build/components/index.d.ts +0 -3
  31. package/build/config/index.d.ts +0 -5
  32. package/build/headless/__tests__/integration.test.d.ts +0 -10
  33. package/build/headless/__tests__/root.test.d.ts +0 -1
  34. package/build/headless/__tests__/root.types.test-d.d.ts +0 -1
  35. package/build/headless/__tests__/slot-components.test.d.ts +0 -1
  36. package/build/headless/__tests__/validator.test.d.ts +0 -1
  37. package/build/headless/back-button.d.ts +0 -29
  38. package/build/headless/index.d.ts +0 -45
  39. package/build/headless/next-button.d.ts +0 -29
  40. package/build/headless/root.d.ts +0 -40
  41. package/build/headless/submit-button.d.ts +0 -29
  42. package/build/headless/types.d.ts +0 -52
  43. package/build/headless/upload-trigger.d.ts +0 -29
  44. package/build/headless/utils/slot.d.ts +0 -20
  45. package/build/headless/utils/zodSchemaToColumns.d.ts +0 -25
  46. package/build/headless/utils/zodSchemaToColumns.test.d.ts +0 -1
  47. package/build/headless/validator.d.ts +0 -28
  48. package/build/i18n/de.d.ts +0 -32
  49. package/build/i18n/es.d.ts +0 -32
  50. package/build/i18n/fr.d.ts +0 -32
  51. package/build/i18n/i18n.d.ts +0 -6
  52. package/build/i18n/it.d.ts +0 -32
  53. package/build/i18n/useTranslation.d.ts +0 -9
  54. package/build/importer/components/Box/index.d.ts +0 -2
  55. package/build/importer/components/Box/index.test.d.ts +0 -1
  56. package/build/importer/components/Box/types/index.d.ts +0 -6
  57. package/build/importer/components/Checkbox/index.d.ts +0 -3
  58. package/build/importer/components/Checkbox/index.test.d.ts +0 -1
  59. package/build/importer/components/Checkbox/types/index.d.ts +0 -8
  60. package/build/importer/components/Errors/index.d.ts +0 -4
  61. package/build/importer/components/Input/index.d.ts +0 -2
  62. package/build/importer/components/Input/index.test.d.ts +0 -1
  63. package/build/importer/components/Input/types/index.d.ts +0 -24
  64. package/build/importer/components/Root/index.d.ts +0 -2
  65. package/build/importer/components/StepLayout/index.d.ts +0 -19
  66. package/build/importer/components/Stepper/hooks/useStepper.d.ts +0 -4
  67. package/build/importer/components/Stepper/hooks/useStepper.test.d.ts +0 -1
  68. package/build/importer/components/Stepper/index.d.ts +0 -2
  69. package/build/importer/components/Stepper/index.test.d.ts +0 -1
  70. package/build/importer/components/Stepper/types/index.d.ts +0 -14
  71. package/build/importer/components/Table/index.d.ts +0 -9
  72. package/build/importer/components/Table/types/index.d.ts +0 -43
  73. package/build/importer/components/ToggleFilter/index.d.ts +0 -3
  74. package/build/importer/components/ToggleFilter/types/index.d.ts +0 -11
  75. package/build/importer/components/Tooltip/index.d.ts +0 -2
  76. package/build/importer/components/Tooltip/types/index.d.ts +0 -11
  77. package/build/importer/components/UploaderWrapper/NativeDropzone.d.ts +0 -12
  78. package/build/importer/components/UploaderWrapper/UploaderWrapper.d.ts +0 -2
  79. package/build/importer/components/UploaderWrapper/types/index.d.ts +0 -2
  80. package/build/importer/components/VirtualTable/index.d.ts +0 -17
  81. package/build/importer/components/VirtualTable/index.test.d.ts +0 -1
  82. package/build/importer/components/ui/alert.d.ts +0 -15
  83. package/build/importer/components/ui/button.d.ts +0 -15
  84. package/build/importer/components/ui/card.d.ts +0 -20
  85. package/build/importer/components/ui/checkbox.d.ts +0 -10
  86. package/build/importer/components/ui/dialog.d.ts +0 -39
  87. package/build/importer/components/ui/flex.d.ts +0 -24
  88. package/build/importer/components/ui/input.d.ts +0 -8
  89. package/build/importer/components/ui/select.d.ts +0 -17
  90. package/build/importer/components/ui/switch.d.ts +0 -11
  91. package/build/importer/components/ui/toast.d.ts +0 -22
  92. package/build/importer/components/ui/toaster.d.ts +0 -2
  93. package/build/importer/components/ui/tooltip.d.ts +0 -25
  94. package/build/importer/components/ui/use-toast.d.ts +0 -46
  95. package/build/importer/features/complete/index.d.ts +0 -2
  96. package/build/importer/features/complete/types/index.d.ts +0 -5
  97. package/build/importer/features/configure-import/index.d.ts +0 -14
  98. package/build/importer/features/configure-import/types/index.d.ts +0 -13
  99. package/build/importer/features/main/hooks/useMutableLocalStorage.d.ts +0 -1
  100. package/build/importer/features/main/hooks/useMutableLocalStorage.test.d.ts +0 -1
  101. package/build/importer/features/main/hooks/useStepNavigation.d.ts +0 -17
  102. package/build/importer/features/main/hooks/useStepNavigation.test.d.ts +0 -1
  103. package/build/importer/features/main/index.d.ts +0 -2
  104. package/build/importer/features/main/types/index.d.ts +0 -16
  105. package/build/importer/features/map-columns/components/DropDownFields.d.ts +0 -22
  106. package/build/importer/features/map-columns/hooks/useMapColumnsTable.d.ts +0 -17
  107. package/build/importer/features/map-columns/index.d.ts +0 -3
  108. package/build/importer/features/map-columns/types/index.d.ts +0 -16
  109. package/build/importer/features/row-selection/index.d.ts +0 -3
  110. package/build/importer/features/row-selection/types/index.d.ts +0 -8
  111. package/build/importer/features/uploader/hooks/useTemplateTable.d.ts +0 -10
  112. package/build/importer/features/uploader/index.d.ts +0 -2
  113. package/build/importer/features/uploader/types/index.d.ts +0 -9
  114. package/build/importer/features/validation/Validation.d.ts +0 -3
  115. package/build/importer/features/validation/__tests__/Validation.zod.test.d.ts +0 -1
  116. package/build/importer/features/validation/components/TransformModal.d.ts +0 -19
  117. package/build/importer/features/validation/components/TransformPanel.d.ts +0 -19
  118. package/build/importer/features/validation/index.d.ts +0 -1
  119. package/build/importer/features/validation/types.d.ts +0 -34
  120. package/build/importer/hooks/useClickOutside.d.ts +0 -1
  121. package/build/importer/hooks/useClickOutside.test.d.ts +0 -1
  122. package/build/importer/hooks/useCustomStyles.d.ts +0 -1
  123. package/build/importer/hooks/useCustomStyles.test.d.ts +0 -1
  124. package/build/importer/hooks/useEventListener.d.ts +0 -4
  125. package/build/importer/hooks/useEventListener.test.d.ts +0 -1
  126. package/build/importer/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
  127. package/build/importer/hooks/useIsomorphicLayoutEffect.test.d.ts +0 -1
  128. package/build/importer/hooks/useRect.d.ts +0 -12
  129. package/build/importer/hooks/useRect.test.d.ts +0 -1
  130. package/build/importer/hooks/useWindowSize.d.ts +0 -1
  131. package/build/importer/hooks/useWindowSize.test.d.ts +0 -1
  132. package/build/importer/providers/Theme.d.ts +0 -10
  133. package/build/importer/providers/index.d.ts +0 -5
  134. package/build/importer/providers/types/index.d.ts +0 -10
  135. package/build/importer/services/api.d.ts +0 -1
  136. package/build/importer/services/mapping.d.ts +0 -31
  137. package/build/importer/services/mapping.test.d.ts +0 -1
  138. package/build/importer/services/transformation.d.ts +0 -70
  139. package/build/importer/services/transformation.test.d.ts +0 -1
  140. package/build/importer/settings/theme/colors.d.ts +0 -4
  141. package/build/importer/settings/theme/index.d.ts +0 -2
  142. package/build/importer/settings/theme/sizes.d.ts +0 -7
  143. package/build/importer/stores/theme.d.ts +0 -17
  144. package/build/importer/theme/index.d.ts +0 -8
  145. package/build/importer/theme/presets.d.ts +0 -314
  146. package/build/importer/theme/runtime.d.ts +0 -66
  147. package/build/importer/theme/styles.d.ts +0 -120
  148. package/build/importer/types/index.d.ts +0 -9
  149. package/build/importer/utils/colorUtils.d.ts +0 -48
  150. package/build/importer/utils/colorUtils.test.d.ts +0 -1
  151. package/build/importer/utils/errorAnalysis.d.ts +0 -25
  152. package/build/importer/utils/errorAnalysis.test.d.ts +0 -1
  153. package/build/importer/utils/getStringLengthOfChildren.d.ts +0 -2
  154. package/build/importer/utils/getStringLengthOfChildren.test.d.ts +0 -1
  155. package/build/importer/utils/stringSimilarity.d.ts +0 -1
  156. package/build/importer/utils/stringSimilarity.test.d.ts +0 -1
  157. package/build/importer/utils/template.d.ts +0 -2
  158. package/build/importer/utils/template.test.d.ts +0 -1
  159. package/build/importer/utils/themeUtils.d.ts +0 -24
  160. package/build/importer/utils/themeUtils.test.d.ts +0 -1
  161. package/build/importer/utils/utils.d.ts +0 -19
  162. package/build/importer/utils/utils.test.d.ts +0 -1
  163. package/build/index.d.ts +0 -10
  164. package/build/index.dev.d.ts +0 -1
  165. package/build/js.d.ts +0 -57
  166. package/build/services/api.d.ts +0 -50
  167. package/build/services/apiClient.d.ts +0 -55
  168. package/build/settings/defaults.d.ts +0 -3
  169. package/build/shims/react-compat-shim.d.ts +0 -43
  170. package/build/shims/react-hooks-shim.d.ts +0 -2
  171. package/build/styles.d.ts +0 -1
  172. package/build/test/helpers.d.ts +0 -28
  173. package/build/test/mocks/api.d.ts +0 -8
  174. package/build/test/mocks/localStorage.d.ts +0 -6
  175. package/build/test/setup.d.ts +0 -1
  176. package/build/types/index.d.ts +0 -137
  177. package/build/types/theme.d.ts +0 -153
  178. package/build/utils/cn.d.ts +0 -6
  179. package/build/utils/cn.test.d.ts +0 -1
  180. package/build/validation/transformationStages.d.ts +0 -26
  181. package/build/validation/transformer.d.ts +0 -17
  182. package/build/validation/validator.d.ts +0 -23
package/build/js.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import { CSVImporterProps } from "./types";
2
- type CreateImporterProps = CSVImporterProps & {
3
- domElement?: Element;
4
- };
5
- export declare function createCSVImporter(props: CreateImporterProps): {
6
- instance: ((<TSchema = any>(props: {
7
- schema?: import("zod").ZodType<TSchema, import("zod").ZodTypeDef, TSchema> | undefined;
8
- columns?: import("./types").Column[] | undefined;
9
- importerKey?: string | undefined;
10
- onComplete?: ((data: TSchema[]) => void) | undefined;
11
- backendUrl?: string | undefined;
12
- user?: Record<string, any> | undefined;
13
- metadata?: Record<string, any> | undefined;
14
- theme?: "default" | "minimal" | "modern" | "compact" | "dark" | import("./types/theme").ThemeConfig | undefined;
15
- darkMode?: boolean | undefined;
16
- primaryColor?: string | undefined;
17
- className?: string | undefined;
18
- customStyles?: string | Record<string, string> | undefined;
19
- classNames?: {
20
- root?: string | undefined;
21
- modal?: string | undefined;
22
- header?: string | undefined;
23
- stepper?: string | undefined;
24
- content?: string | undefined;
25
- footer?: string | undefined;
26
- button?: string | undefined;
27
- input?: string | undefined;
28
- table?: string | undefined;
29
- dropzone?: string | undefined;
30
- } | undefined;
31
- showDownloadTemplateButton?: boolean | undefined;
32
- skipHeaderRowSelection?: boolean | undefined;
33
- waitOnComplete?: boolean | undefined;
34
- invalidRowHandling?: "include" | "exclude" | "block" | undefined;
35
- includeUnmatchedColumns?: boolean | undefined;
36
- language?: string | undefined;
37
- customTranslations?: {
38
- [language: string]: {
39
- [key: string]: string;
40
- };
41
- } | undefined;
42
- demoData?: {
43
- fileName: string;
44
- csvContent: string;
45
- } | undefined;
46
- } & {
47
- isModal?: boolean | undefined;
48
- modalIsOpen?: boolean | undefined;
49
- modalOnCloseTriggered?: (() => void) | undefined;
50
- modalCloseOnOutsideClick?: boolean | undefined;
51
- } & {
52
- ref?: any;
53
- }) => import("preact").JSX.Element) & HTMLDialogElement) | null;
54
- showModal: () => void;
55
- closeModal: () => void;
56
- };
57
- export {};
@@ -1,50 +0,0 @@
1
- export function createApi(backendUrl: any, importerKey: any): {
2
- auth: {
3
- /**
4
- * Login to get access token
5
- * @param {string} email - User email
6
- * @param {string} password - User password
7
- * @returns {Promise<Object>} - Response with access token
8
- */
9
- login: (email: string, password: string) => Promise<Object>;
10
- /**
11
- * Get current user information
12
- * @param {string} token - Access token
13
- * @returns {Promise<Object>} - User information
14
- */
15
- getCurrentUser: (token: string) => Promise<Object>;
16
- };
17
- schema: {
18
- /**
19
- * Get all schemas
20
- * @param {string} token - Access token
21
- * @returns {Promise<Array>} - List of schemas
22
- */
23
- getSchemas: (token: string) => Promise<any[]>;
24
- /**
25
- * Get schema template for CSV importer
26
- * @param {string} token - Access token
27
- * @param {number} schemaId - Schema ID
28
- * @returns {Promise<Object>} - Schema template
29
- */
30
- getSchemaTemplate: (token: string, schemaId: number) => Promise<Object>;
31
- };
32
- import: {
33
- /**
34
- * Process CSV data from the frontend importer
35
- * @param {string} token - Access token
36
- * @param {number} schemaId - Schema ID
37
- * @param {Object} importData - Data from CSV importer
38
- * @returns {Promise<Object>} - Import job information
39
- */
40
- processCSVData: (token: string, schemaId: number, importData: Object) => Promise<Object>;
41
- /**
42
- * Get import job status
43
- * @param {string} token - Access token
44
- * @param {number} jobId - Import job ID
45
- * @returns {Promise<Object>} - Import job status
46
- */
47
- getImportJobStatus: (token: string, jobId: number) => Promise<Object>;
48
- };
49
- };
50
- export default createApi;
@@ -1,55 +0,0 @@
1
- export default createApiMethods;
2
- /**
3
- * Authentication API
4
- */
5
- export function createApiMethods(backendUrl: any, importerKey: any): {
6
- client: any;
7
- auth: {
8
- /**
9
- * Login to get access token
10
- * @param {string} email - User email
11
- * @param {string} password - User password
12
- * @returns {Promise<Object>} - Response with access token
13
- */
14
- login: (email: string, password: string) => Promise<Object>;
15
- /**
16
- * Logout the current user
17
- */
18
- logout: () => Promise<void>;
19
- /**
20
- * Get current user information
21
- * @returns {Promise<Object>} - User information
22
- */
23
- getCurrentUser: () => Promise<Object>;
24
- };
25
- schema: {
26
- /**
27
- * Get all schemas
28
- * @returns {Promise<Array>} - List of schemas
29
- */
30
- getSchemas: () => Promise<any[]>;
31
- /**
32
- * Get schema template for CSV importer
33
- * @param {number} schemaId - Schema ID
34
- * @returns {Promise<Object>} - Schema template
35
- */
36
- getSchemaTemplate: (schemaId: number) => Promise<Object>;
37
- };
38
- import: {
39
- /**
40
- * Process CSV data from the frontend importer
41
- * @param {number} schemaId - Schema ID
42
- * @param {Object} importData - Data from CSV importer
43
- * @returns {Promise<Object>} - Import job information
44
- */
45
- processCSVData: (schemaId: number, importData: Object) => Promise<Object>;
46
- /**
47
- * Get import job status
48
- * @param {number} jobId - Import job ID
49
- * @returns {Promise<Object>} - Import job status
50
- */
51
- getImportJobStatus: (jobId: number) => Promise<Object>;
52
- };
53
- };
54
- export function createApiClient(backendUrl: any, importerKey: any): any;
55
- export function setupInterceptors(apiClient: any, baseUrl: any): any;
@@ -1,3 +0,0 @@
1
- import { CSVImporterProps } from "../types";
2
- declare const defaults: CSVImporterProps;
3
- export default defaults;
@@ -1,43 +0,0 @@
1
- export * from "react";
2
- export { default } from "react";
3
- export const useState: typeof React.useState;
4
- export const useEffect: typeof React.useEffect;
5
- export const useContext: typeof React.useContext;
6
- export const useReducer: typeof React.useReducer;
7
- export const useCallback: typeof React.useCallback;
8
- export const useMemo: typeof React.useMemo;
9
- export const useRef: typeof React.useRef;
10
- export const useImperativeHandle: typeof React.useImperativeHandle;
11
- export const useLayoutEffect: typeof React.useLayoutEffect;
12
- export const useDebugValue: typeof React.useDebugValue;
13
- export const createContext: typeof React.createContext;
14
- export const createElement: typeof React.createElement;
15
- export const createRef: typeof React.createRef;
16
- export const Component: typeof React.Component;
17
- export const PureComponent: typeof React.PureComponent;
18
- export const memo: typeof React.memo;
19
- export const forwardRef: typeof React.forwardRef;
20
- export const lazy: typeof React.lazy;
21
- export const Suspense: React.ExoticComponent<React.SuspenseProps>;
22
- export const Fragment: React.ExoticComponent<{
23
- children?: React.ReactNode;
24
- }>;
25
- export const StrictMode: React.ExoticComponent<{
26
- children?: React.ReactNode;
27
- }>;
28
- export const isValidElement: typeof React.isValidElement;
29
- export const cloneElement: typeof React.cloneElement;
30
- export const Children: {
31
- map<T, C>(children: C | readonly C[], fn: (child: C, index: number) => T): C extends null | undefined ? C : Exclude<T, boolean | null | undefined>[];
32
- forEach<C_1>(children: C_1 | readonly C_1[], fn: (child: C_1, index: number) => void): void;
33
- count(children: any): number;
34
- only<C_2>(children: C_2): C_2 extends any[] ? never : C_2;
35
- toArray(children: React.ReactNode | React.ReactNode[]): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal)[];
36
- };
37
- export const createPortal: typeof ReactDOM.createPortal;
38
- export const render: ReactDOM.Renderer;
39
- export const hydrate: ReactDOM.Renderer;
40
- export const unmountComponentAtNode: typeof ReactDOM.unmountComponentAtNode;
41
- export const findDOMNode: typeof ReactDOM.findDOMNode;
42
- import * as React from "react";
43
- import * as ReactDOM from "react-dom";
@@ -1,2 +0,0 @@
1
- export * from "react";
2
- export { useState, useEffect, useContext, useReducer, useRef, useMemo, useCallback, useImperativeHandle, useLayoutEffect, useDebugValue, useId } from "react";
package/build/styles.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const importcsvStyles: string;
@@ -1,28 +0,0 @@
1
- /**
2
- * Loads a CSV fixture file and parses it into rows
3
- */
4
- export declare function loadCSVFixture(filename: string): {
5
- headers: string[];
6
- rows: Record<string, any>[];
7
- };
8
- /**
9
- * Sample data generators for common use cases
10
- */
11
- export declare const fixtures: {
12
- valid: () => {
13
- headers: string[];
14
- rows: Record<string, any>[];
15
- };
16
- malformed: () => {
17
- headers: string[];
18
- rows: Record<string, any>[];
19
- };
20
- empty: () => {
21
- headers: string[];
22
- rows: Record<string, any>[];
23
- };
24
- large: () => {
25
- headers: string[];
26
- rows: Record<string, any>[];
27
- };
28
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Mock fetch for API tests
3
- */
4
- export declare function mockFetch(response: any, ok?: boolean): import("@vitest/spy").Mock<(...args: any[]) => any>;
5
- /**
6
- * Mock fetch with error
7
- */
8
- export declare function mockFetchError(error: Error): import("@vitest/spy").Mock<(...args: any[]) => any>;
@@ -1,6 +0,0 @@
1
- export declare function mockLocalStorage(): {
2
- getItem: import("@vitest/spy").Mock<(key: string) => string | null>;
3
- setItem: import("@vitest/spy").Mock<(key: string, value: string) => void>;
4
- removeItem: import("@vitest/spy").Mock<(key: string) => void>;
5
- clear: import("@vitest/spy").Mock<() => void>;
6
- };
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,137 +0,0 @@
1
- export interface Column {
2
- id: string;
3
- label: string;
4
- type?: 'string' | 'number' | 'email' | 'date' | 'phone' | 'select';
5
- validators?: Validator[];
6
- transformations?: Transformer[];
7
- options?: string[];
8
- description?: string;
9
- placeholder?: string;
10
- }
11
- export type Validator = {
12
- type: 'required';
13
- message?: string;
14
- } | {
15
- type: 'unique';
16
- message?: string;
17
- } | {
18
- type: 'regex';
19
- pattern: string;
20
- message?: string;
21
- } | {
22
- type: 'min';
23
- value: number;
24
- message?: string;
25
- } | {
26
- type: 'max';
27
- value: number;
28
- message?: string;
29
- } | {
30
- type: 'min_length';
31
- value: number;
32
- message?: string;
33
- } | {
34
- type: 'max_length';
35
- value: number;
36
- message?: string;
37
- };
38
- export type TransformationStage = 'pre' | 'post';
39
- export type Transformer = {
40
- type: 'trim';
41
- stage?: TransformationStage;
42
- } | {
43
- type: 'uppercase';
44
- stage?: TransformationStage;
45
- } | {
46
- type: 'lowercase';
47
- stage?: TransformationStage;
48
- } | {
49
- type: 'capitalize';
50
- stage?: TransformationStage;
51
- } | {
52
- type: 'remove_special_chars';
53
- stage?: TransformationStage;
54
- } | {
55
- type: 'normalize_phone';
56
- stage?: TransformationStage;
57
- } | {
58
- type: 'normalize_date';
59
- format?: string;
60
- stage?: TransformationStage;
61
- } | {
62
- type: 'default';
63
- value: string;
64
- stage?: TransformationStage;
65
- } | {
66
- type: 'replace';
67
- find: string;
68
- replace: string;
69
- stage?: TransformationStage;
70
- } | {
71
- type: 'custom';
72
- fn: (value: any) => any;
73
- stage?: TransformationStage;
74
- };
75
- export interface ColumnMapping {
76
- id: string;
77
- label?: string;
78
- include: boolean;
79
- selected?: boolean;
80
- }
81
- export interface ColumnMappingDictionary {
82
- [uploadColumnIndex: number]: ColumnMapping;
83
- }
84
- type ModalParams = {
85
- isModal?: boolean;
86
- modalIsOpen?: boolean;
87
- modalOnCloseTriggered?: () => void;
88
- modalCloseOnOutsideClick?: boolean;
89
- };
90
- type CustomTranslationResource = {
91
- [language: string]: {
92
- [key: string]: string;
93
- };
94
- };
95
- import { ThemeConfig } from './theme';
96
- import { z } from 'zod';
97
- export type CSVImporterProps<TSchema = any> = {
98
- schema?: z.ZodSchema<TSchema>;
99
- /**
100
- * @deprecated Use `schema` prop instead for better type safety
101
- */
102
- columns?: Column[];
103
- importerKey?: string;
104
- onComplete?: (data: TSchema[]) => void;
105
- backendUrl?: string;
106
- user?: Record<string, any>;
107
- metadata?: Record<string, any>;
108
- theme?: ThemeConfig | 'default' | 'minimal' | 'modern' | 'compact' | 'dark';
109
- darkMode?: boolean;
110
- primaryColor?: string;
111
- className?: string;
112
- customStyles?: Record<string, string> | string;
113
- classNames?: {
114
- root?: string;
115
- modal?: string;
116
- header?: string;
117
- stepper?: string;
118
- content?: string;
119
- footer?: string;
120
- button?: string;
121
- input?: string;
122
- table?: string;
123
- dropzone?: string;
124
- };
125
- showDownloadTemplateButton?: boolean;
126
- skipHeaderRowSelection?: boolean;
127
- waitOnComplete?: boolean;
128
- invalidRowHandling?: 'include' | 'exclude' | 'block';
129
- includeUnmatchedColumns?: boolean;
130
- language?: string;
131
- customTranslations?: CustomTranslationResource;
132
- demoData?: {
133
- fileName: string;
134
- csvContent: string;
135
- };
136
- } & ModalParams;
137
- export {};
@@ -1,153 +0,0 @@
1
- /**
2
- * Theme configuration types for CSV Importer
3
- */
4
- export interface ThemeConfig {
5
- colors?: {
6
- primary?: string;
7
- primaryHover?: string;
8
- primaryForeground?: string;
9
- secondary?: string;
10
- secondaryHover?: string;
11
- secondaryForeground?: string;
12
- background?: string;
13
- foreground?: string;
14
- card?: string;
15
- cardForeground?: string;
16
- border?: string;
17
- input?: string;
18
- ring?: string;
19
- muted?: string;
20
- mutedForeground?: string;
21
- accent?: string;
22
- accentForeground?: string;
23
- destructive?: string;
24
- destructiveForeground?: string;
25
- success?: string;
26
- successForeground?: string;
27
- warning?: string;
28
- warningForeground?: string;
29
- info?: string;
30
- infoForeground?: string;
31
- };
32
- typography?: {
33
- fontFamily?: string;
34
- fontFamilyMono?: string;
35
- fontSize?: {
36
- xs?: string;
37
- sm?: string;
38
- base?: string;
39
- lg?: string;
40
- xl?: string;
41
- '2xl'?: string;
42
- '3xl'?: string;
43
- };
44
- fontWeight?: {
45
- light?: number;
46
- normal?: number;
47
- medium?: number;
48
- semibold?: number;
49
- bold?: number;
50
- };
51
- lineHeight?: {
52
- tight?: string;
53
- normal?: string;
54
- relaxed?: string;
55
- };
56
- };
57
- spacing?: {
58
- xs?: string;
59
- sm?: string;
60
- md?: string;
61
- lg?: string;
62
- xl?: string;
63
- '2xl'?: string;
64
- '3xl'?: string;
65
- };
66
- borders?: {
67
- radius?: {
68
- none?: string;
69
- sm?: string;
70
- md?: string;
71
- lg?: string;
72
- xl?: string;
73
- full?: string;
74
- };
75
- width?: {
76
- none?: string;
77
- thin?: string;
78
- medium?: string;
79
- thick?: string;
80
- };
81
- };
82
- components?: {
83
- button?: {
84
- padding?: string;
85
- fontSize?: string;
86
- fontWeight?: string;
87
- borderRadius?: string;
88
- height?: string;
89
- minWidth?: string;
90
- };
91
- input?: {
92
- padding?: string;
93
- fontSize?: string;
94
- borderRadius?: string;
95
- borderWidth?: string;
96
- height?: string;
97
- background?: string;
98
- };
99
- modal?: {
100
- width?: string;
101
- maxWidth?: string;
102
- maxHeight?: string;
103
- padding?: string;
104
- borderRadius?: string;
105
- backdropOpacity?: string;
106
- };
107
- table?: {
108
- headerBackground?: string;
109
- headerForeground?: string;
110
- rowHoverBackground?: string;
111
- borderColor?: string;
112
- cellPadding?: string;
113
- };
114
- stepper?: {
115
- activeColor?: string;
116
- inactiveColor?: string;
117
- completedColor?: string;
118
- lineColor?: string;
119
- dotSize?: string;
120
- };
121
- dropzone?: {
122
- borderStyle?: string;
123
- borderColor?: string;
124
- borderColorHover?: string;
125
- backgroundColor?: string;
126
- backgroundColorHover?: string;
127
- padding?: string;
128
- borderRadius?: string;
129
- };
130
- };
131
- shadows?: {
132
- sm?: string;
133
- md?: string;
134
- lg?: string;
135
- xl?: string;
136
- };
137
- animations?: {
138
- duration?: {
139
- fast?: string;
140
- normal?: string;
141
- slow?: string;
142
- };
143
- easing?: string;
144
- };
145
- }
146
- export declare const defaultTheme: ThemeConfig;
147
- export declare const presetThemes: {
148
- default: ThemeConfig;
149
- minimal: ThemeConfig;
150
- modern: ThemeConfig;
151
- compact: ThemeConfig;
152
- dark: ThemeConfig;
153
- };
@@ -1,6 +0,0 @@
1
- import { type ClassValue } from 'clsx';
2
- /**
3
- * Utility function to merge Tailwind CSS classes with proper precedence
4
- * Combines clsx for conditional classes and tailwind-merge for deduplication
5
- */
6
- export declare function cn(...inputs: ClassValue[]): string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- /**
2
- * Transformation stage definitions for smart auto-detection
3
- *
4
- * Pre-validation transformations clean and normalize data before validation rules are applied.
5
- * Post-validation transformations enrich and format data after validation passes.
6
- */
7
- /**
8
- * Transformations that should run BEFORE validation
9
- * These typically clean or normalize input to prepare it for validation
10
- */
11
- export declare const PRE_VALIDATION_TRANSFORMS: readonly ["trim", "uppercase", "lowercase", "remove_special_chars", "normalize_phone", "normalize_date"];
12
- /**
13
- * Transformations that should run AFTER validation
14
- * These typically format, enrich, or provide defaults for valid data
15
- */
16
- export declare const POST_VALIDATION_TRANSFORMS: readonly ["default", "capitalize", "replace", "custom"];
17
- export type PreValidationTransform = typeof PRE_VALIDATION_TRANSFORMS[number];
18
- export type PostValidationTransform = typeof POST_VALIDATION_TRANSFORMS[number];
19
- /**
20
- * Check if a transformation type should run before validation
21
- */
22
- export declare function isPreValidationTransform(type: string): boolean;
23
- /**
24
- * Check if a transformation type should run after validation
25
- */
26
- export declare function isPostValidationTransform(type: string): boolean;
@@ -1,17 +0,0 @@
1
- import { Transformer } from '../types';
2
- /**
3
- * Apply transformations to a value
4
- * @param value The value to transform
5
- * @param transformations Array of transformations to apply
6
- * @returns Transformed value
7
- */
8
- export declare function applyTransformations(value: any, transformations?: Transformer[]): any;
9
- /**
10
- * Categorize transformations into pre-validation and post-validation stages
11
- * @param transformations Array of transformations to categorize
12
- * @returns Object with pre and post transformation arrays
13
- */
14
- export declare function categorizeTransformations(transformations?: Transformer[]): {
15
- pre: Transformer[];
16
- post: Transformer[];
17
- };
@@ -1,23 +0,0 @@
1
- import { Column } from '../types';
2
- /**
3
- * Validates a single value against a column's validators
4
- * @param value The value to validate
5
- * @param column The column definition with validators
6
- * @returns Error message if validation fails, null if valid
7
- */
8
- export declare function validateColumn(value: any, column: Column): string | null;
9
- /**
10
- * Validates uniqueness across all rows for a column
11
- * @param rows All data rows
12
- * @param columnIndex The column index to check
13
- * @param column The column definition
14
- * @returns Array of row indices that have duplicate values
15
- */
16
- export declare function validateUniqueness(rows: any[][], columnIndex: number, column: Column): number[];
17
- /**
18
- * Batch validation for all rows
19
- * @param rows Data rows to validate
20
- * @param columns Column definitions
21
- * @returns Validation results with errors per cell
22
- */
23
- export declare function validateBatch(rows: any[][], columns: Column[]): Map<string, string>;