@importcsv/react 0.2.3 → 0.2.5

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 (134) hide show
  1. package/build/App.d.ts +2 -0
  2. package/build/bundled/importer/components/ui/use-toast.d.ts +1 -1
  3. package/build/bundled/index.esm.js +3027 -3205
  4. package/build/bundled/index.esm.js.map +1 -1
  5. package/build/bundled/index.js +30 -30
  6. package/build/bundled/index.js.map +1 -1
  7. package/build/bundled/index.umd.js +30 -30
  8. package/build/bundled/index.umd.js.map +1 -1
  9. package/build/bundled/utils/injectStyles.d.ts +14 -0
  10. package/build/bundled-styles.d.ts +1 -0
  11. package/build/components/CSVImporter/index.d.ts +9 -0
  12. package/build/components/Modal/index.d.ts +12 -0
  13. package/build/config/index.d.ts +5 -0
  14. package/build/i18n/de.d.ts +32 -0
  15. package/build/i18n/es.d.ts +32 -0
  16. package/build/i18n/fr.d.ts +32 -0
  17. package/build/i18n/i18n.d.ts +6 -0
  18. package/build/i18n/it.d.ts +32 -0
  19. package/build/i18n/useTranslation.d.ts +9 -0
  20. package/build/importer/components/Box/index.d.ts +2 -0
  21. package/build/importer/components/Box/types/index.d.ts +5 -0
  22. package/build/importer/components/Checkbox/index.d.ts +2 -0
  23. package/build/importer/components/Checkbox/types/index.d.ts +4 -0
  24. package/build/importer/components/Errors/index.d.ts +4 -0
  25. package/build/importer/components/Input/index.d.ts +2 -0
  26. package/build/importer/components/Input/types/index.d.ts +18 -0
  27. package/build/importer/components/Root/index.d.ts +10 -0
  28. package/build/importer/components/StepLayout/index.d.ts +18 -0
  29. package/build/importer/components/Stepper/hooks/useStepper.d.ts +2 -0
  30. package/build/importer/components/Stepper/index.d.ts +2 -0
  31. package/build/importer/components/Stepper/types/index.d.ts +14 -0
  32. package/build/importer/components/Table/index.d.ts +9 -0
  33. package/build/importer/components/ToggleFilter/index.d.ts +3 -0
  34. package/build/importer/components/ToggleFilter/types/index.d.ts +11 -0
  35. package/build/importer/components/Tooltip/index.d.ts +2 -0
  36. package/build/importer/components/Tooltip/types/index.d.ts +11 -0
  37. package/build/importer/components/UploaderWrapper/NativeDropzone.d.ts +11 -0
  38. package/build/importer/components/UploaderWrapper/UploaderWrapper.d.ts +2 -0
  39. package/build/importer/components/UploaderWrapper/types/index.d.ts +2 -0
  40. package/build/importer/components/VirtualTable/index.d.ts +17 -0
  41. package/build/importer/components/ui/alert.d.ts +10 -0
  42. package/build/importer/components/ui/button.d.ts +12 -0
  43. package/build/importer/components/ui/card.d.ts +19 -0
  44. package/build/importer/components/ui/checkbox.d.ts +7 -0
  45. package/build/importer/components/ui/dialog.d.ts +39 -0
  46. package/build/importer/components/ui/flex.d.ts +23 -0
  47. package/build/importer/components/ui/input.d.ts +6 -0
  48. package/build/importer/components/ui/select.d.ts +13 -0
  49. package/build/importer/components/ui/switch.d.ts +7 -0
  50. package/build/importer/components/ui/toast.d.ts +23 -0
  51. package/build/importer/components/ui/toaster.d.ts +1 -0
  52. package/build/importer/components/ui/tooltip.d.ts +20 -0
  53. package/build/importer/components/ui/use-toast.d.ts +46 -0
  54. package/build/importer/features/complete/index.d.ts +2 -0
  55. package/build/importer/features/complete/types/index.d.ts +5 -0
  56. package/build/importer/features/configure-import/index.d.ts +13 -0
  57. package/build/importer/features/configure-import/types/index.d.ts +13 -0
  58. package/build/importer/features/main/hooks/useMutableLocalStorage.d.ts +1 -0
  59. package/build/importer/features/main/hooks/useStepNavigation.d.ts +17 -0
  60. package/build/importer/features/main/index.d.ts +2 -0
  61. package/build/importer/features/main/types/index.d.ts +16 -0
  62. package/build/importer/features/map-columns/components/DropDownFields.d.ts +21 -0
  63. package/build/importer/features/map-columns/hooks/useMapColumnsTable.d.ts +16 -0
  64. package/build/importer/features/map-columns/index.d.ts +2 -0
  65. package/build/importer/features/map-columns/types/index.d.ts +16 -0
  66. package/build/importer/features/row-selection/index.d.ts +2 -0
  67. package/build/importer/features/row-selection/types/index.d.ts +8 -0
  68. package/build/importer/features/uploader/hooks/useTemplateTable.d.ts +10 -0
  69. package/build/importer/features/uploader/index.d.ts +2 -0
  70. package/build/importer/features/uploader/types/index.d.ts +9 -0
  71. package/build/importer/features/validation/Validation.d.ts +2 -0
  72. package/build/importer/features/validation/components/TransformModal.d.ts +18 -0
  73. package/build/importer/features/validation/components/TransformPanel.d.ts +18 -0
  74. package/build/importer/features/validation/index.d.ts +1 -0
  75. package/build/importer/features/validation/types.d.ts +32 -0
  76. package/build/importer/hooks/useClickOutside.d.ts +1 -0
  77. package/build/importer/hooks/useCustomStyles.d.ts +1 -0
  78. package/build/importer/hooks/useEventListener.d.ts +4 -0
  79. package/build/importer/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  80. package/build/importer/hooks/useRect.d.ts +12 -0
  81. package/build/importer/hooks/useWindowSize.d.ts +1 -0
  82. package/build/importer/providers/Theme.d.ts +10 -0
  83. package/build/importer/providers/index.d.ts +5 -0
  84. package/build/importer/providers/types/index.d.ts +10 -0
  85. package/build/importer/services/api.d.ts +1 -0
  86. package/build/importer/services/mapping.d.ts +31 -0
  87. package/build/importer/services/transformation.d.ts +70 -0
  88. package/build/importer/settings/theme/colors.d.ts +4 -0
  89. package/build/importer/settings/theme/index.d.ts +2 -0
  90. package/build/importer/settings/theme/sizes.d.ts +7 -0
  91. package/build/importer/stores/theme.d.ts +17 -0
  92. package/build/importer/theme/index.d.ts +8 -0
  93. package/build/importer/theme/presets.d.ts +314 -0
  94. package/build/importer/theme/runtime.d.ts +66 -0
  95. package/build/importer/theme/styles.d.ts +120 -0
  96. package/build/importer/types/index.d.ts +9 -0
  97. package/build/importer/utils/colorUtils.d.ts +48 -0
  98. package/build/importer/utils/errorAnalysis.d.ts +25 -0
  99. package/build/importer/utils/getStringLengthOfChildren.d.ts +2 -0
  100. package/build/importer/utils/stringSimilarity.d.ts +1 -0
  101. package/build/importer/utils/template.d.ts +2 -0
  102. package/build/importer/utils/themeUtils.d.ts +24 -0
  103. package/build/importer/utils/utils.d.ts +19 -0
  104. package/build/index.d.ts +6 -0
  105. package/build/index.dev.d.ts +1 -0
  106. package/build/js.d.ts +12 -0
  107. package/build/preact/importer/components/ui/use-toast.d.ts +1 -1
  108. package/build/preact/index.esm.js +2053 -2231
  109. package/build/preact/index.esm.js.map +1 -1
  110. package/build/preact/index.js +30 -30
  111. package/build/preact/index.js.map +1 -1
  112. package/build/preact/utils/injectStyles.d.ts +14 -0
  113. package/build/react/components/Modal/index.d.ts +12 -0
  114. package/build/react/importer/components/Table/types/index.d.ts +42 -0
  115. package/build/react/importer/components/ui/alert.d.ts +4 -1
  116. package/build/react/importer/components/ui/tooltip.d.ts +6 -2
  117. package/build/react/index.d.ts +1 -0
  118. package/build/react/index.esm.js +3993 -3803
  119. package/build/react/index.esm.js.map +1 -1
  120. package/build/react/index.js +31 -31
  121. package/build/react/index.js.map +1 -1
  122. package/build/services/api.d.ts +50 -0
  123. package/build/services/apiClient.d.ts +55 -0
  124. package/build/settings/defaults.d.ts +3 -0
  125. package/build/shims/react-compat-shim.d.ts +2 -0
  126. package/build/shims/react-hooks-shim.d.ts +2 -0
  127. package/build/styles.d.ts +1 -0
  128. package/build/types/index.d.ts +132 -0
  129. package/build/types/theme.d.ts +153 -0
  130. package/build/utils/cn.d.ts +6 -0
  131. package/build/validation/transformationStages.d.ts +26 -0
  132. package/build/validation/transformer.d.ts +17 -0
  133. package/build/validation/validator.d.ts +23 -0
  134. package/package.json +2 -2
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Runtime theme utilities for dynamic styling
3
+ * Allows changing themes without re-rendering components
4
+ */
5
+ import { styles } from './styles';
6
+ export interface SimpleTheme {
7
+ colors?: {
8
+ primary?: string;
9
+ primaryHover?: string;
10
+ background?: string;
11
+ foreground?: string;
12
+ border?: string;
13
+ error?: string;
14
+ success?: string;
15
+ warning?: string;
16
+ };
17
+ typography?: {
18
+ fontFamily?: string;
19
+ fontSize?: {
20
+ base?: string;
21
+ small?: string;
22
+ large?: string;
23
+ };
24
+ };
25
+ spacing?: {
26
+ compact?: boolean;
27
+ scale?: number;
28
+ };
29
+ components?: {
30
+ button?: {
31
+ variant?: 'solid' | 'outline' | 'ghost';
32
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
33
+ };
34
+ table?: {
35
+ striped?: boolean;
36
+ bordered?: boolean;
37
+ compact?: boolean;
38
+ };
39
+ modal?: {
40
+ blur?: boolean;
41
+ shadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
42
+ };
43
+ input?: {
44
+ variant?: 'outline' | 'filled' | 'underline';
45
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
46
+ };
47
+ };
48
+ }
49
+ /**
50
+ * Apply a theme to the importer
51
+ * Can accept preset name, theme object, or partial overrides
52
+ */
53
+ export declare function applyTheme(container: HTMLElement, theme: string | SimpleTheme | typeof styles): void;
54
+ /**
55
+ * Get the current theme from a container
56
+ */
57
+ export declare function getCurrentTheme(container: HTMLElement): string | null;
58
+ /**
59
+ * Reset theme to default
60
+ */
61
+ export declare function resetTheme(container: HTMLElement): void;
62
+ /**
63
+ * Create a theme from a primary color
64
+ * Generates a full theme based on a single color
65
+ */
66
+ export declare function createThemeFromColor(primaryColor: string): SimpleTheme;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Core styles for the CSV Importer
3
+ * These styles ensure consistent appearance across all screens
4
+ * Can be overridden via the theme prop
5
+ */
6
+ export declare const styles: {
7
+ typography: {
8
+ title: string;
9
+ subtitle: string;
10
+ label: string;
11
+ body: string;
12
+ caption: string;
13
+ };
14
+ spacing: {
15
+ page: string;
16
+ header: string;
17
+ content: string;
18
+ footer: string;
19
+ section: string;
20
+ };
21
+ layout: {
22
+ header: string;
23
+ subHeader: string;
24
+ content: string;
25
+ footer: string;
26
+ container: string;
27
+ };
28
+ colors: {
29
+ borderDefault: string;
30
+ bgPrimary: string;
31
+ bgSecondary: string;
32
+ bgHover: string;
33
+ textPrimary: string;
34
+ textSecondary: string;
35
+ textMuted: string;
36
+ };
37
+ components: {
38
+ card: string;
39
+ input: string;
40
+ table: string;
41
+ tableHeader: string;
42
+ tableRow: string;
43
+ };
44
+ buttons: {
45
+ primary: string;
46
+ secondary: string;
47
+ outline: string;
48
+ };
49
+ };
50
+ export declare const cssVariables: {
51
+ '--csv-color-primary': string;
52
+ '--csv-color-primary-hover': string;
53
+ '--csv-color-primary-foreground': string;
54
+ '--csv-color-secondary': string;
55
+ '--csv-color-secondary-foreground': string;
56
+ '--csv-color-background': string;
57
+ '--csv-color-foreground': string;
58
+ '--csv-color-border': string;
59
+ '--csv-color-muted': string;
60
+ '--csv-color-muted-foreground': string;
61
+ '--csv-font-family': string;
62
+ '--csv-font-size-xs': string;
63
+ '--csv-font-size-sm': string;
64
+ '--csv-font-size-base': string;
65
+ '--csv-font-size-lg': string;
66
+ '--csv-font-size-xl': string;
67
+ '--csv-spacing-xs': string;
68
+ '--csv-spacing-sm': string;
69
+ '--csv-spacing-md': string;
70
+ '--csv-spacing-lg': string;
71
+ '--csv-spacing-xl': string;
72
+ '--csv-radius-sm': string;
73
+ '--csv-radius-md': string;
74
+ '--csv-radius-lg': string;
75
+ '--csv-radius-xl': string;
76
+ };
77
+ export declare const designTokens: {
78
+ typography: {
79
+ title: string;
80
+ subtitle: string;
81
+ label: string;
82
+ body: string;
83
+ caption: string;
84
+ };
85
+ spacing: {
86
+ page: string;
87
+ header: string;
88
+ content: string;
89
+ footer: string;
90
+ section: string;
91
+ };
92
+ layout: {
93
+ header: string;
94
+ subHeader: string;
95
+ content: string;
96
+ footer: string;
97
+ container: string;
98
+ };
99
+ colors: {
100
+ borderDefault: string;
101
+ bgPrimary: string;
102
+ bgSecondary: string;
103
+ bgHover: string;
104
+ textPrimary: string;
105
+ textSecondary: string;
106
+ textMuted: string;
107
+ };
108
+ components: {
109
+ card: string;
110
+ input: string;
111
+ table: string;
112
+ tableHeader: string;
113
+ tableRow: string;
114
+ };
115
+ buttons: {
116
+ primary: string;
117
+ secondary: string;
118
+ outline: string;
119
+ };
120
+ };
@@ -0,0 +1,9 @@
1
+ import { Column } from '../../types';
2
+ export type Template = {
3
+ columns: Column[];
4
+ };
5
+ export type UploadColumn = {
6
+ index: number;
7
+ name: string;
8
+ sample_data: string[];
9
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Color utility functions for theme customization
3
+ */
4
+ /**
5
+ * Validate hex color format
6
+ */
7
+ export declare function isValidColor(color: string): boolean;
8
+ /**
9
+ * Convert hex color to RGB
10
+ */
11
+ export declare function hexToRgb(hex: string): {
12
+ r: number;
13
+ g: number;
14
+ b: number;
15
+ } | null;
16
+ /**
17
+ * Convert RGB to hex color
18
+ */
19
+ export declare function rgbToHex(r: number, g: number, b: number): string;
20
+ /**
21
+ * Lighten a color by a percentage
22
+ */
23
+ export declare function lightenColor(hex: string, percent: number): string;
24
+ /**
25
+ * Darken a color by a percentage
26
+ */
27
+ export declare function darkenColor(hex: string, percent: number): string;
28
+ /**
29
+ * Generate color palette from a base color
30
+ */
31
+ export declare function generateColorPalette(baseColor: string): {
32
+ 50: string;
33
+ 100: string;
34
+ 200: string;
35
+ 300: string;
36
+ 400: string;
37
+ 500: string;
38
+ 600: string;
39
+ 700: string;
40
+ 800: string;
41
+ 900: string;
42
+ };
43
+ /**
44
+ * Apply color palette to CSS variables
45
+ * @param primaryColor - The primary color to generate palette from
46
+ * @param targetElement - The element to apply styles to (defaults to a scoped container, not document root)
47
+ */
48
+ export declare function applyColorPalette(primaryColor: string, targetElement?: HTMLElement): void;
@@ -0,0 +1,25 @@
1
+ export interface ValidationError {
2
+ rowIndex: number;
3
+ columnKey: string;
4
+ message: string;
5
+ value?: any;
6
+ }
7
+ export interface ErrorGroup {
8
+ type: string;
9
+ title: string;
10
+ description: string;
11
+ count: number;
12
+ columns: string[];
13
+ errors: ValidationError[];
14
+ example?: {
15
+ before: string;
16
+ after: string;
17
+ };
18
+ selected: boolean;
19
+ }
20
+ export declare function analyzeValidationErrors(errors: ValidationError[]): ErrorGroup[];
21
+ export declare function getErrorSummary(groups: ErrorGroup[]): string;
22
+ export declare function getSelectedErrors(groups: ErrorGroup[]): ValidationError[];
23
+ export declare function toggleErrorGroup(groups: ErrorGroup[], type: string): ErrorGroup[];
24
+ export declare function setAllErrorGroups(groups: ErrorGroup[], selected: boolean): ErrorGroup[];
25
+ export declare function countSelectedErrors(groups: ErrorGroup[]): number;
@@ -0,0 +1,2 @@
1
+ import type { ComponentChildren } from 'preact';
2
+ export default function getStringLengthOfChildren(children: ComponentChildren): number;
@@ -0,0 +1 @@
1
+ export default function stringsSimilarity(s1: string, s2: string): number;
@@ -0,0 +1,2 @@
1
+ import { Template } from "../types";
2
+ export declare function convertRawTemplate(rawTemplate?: Record<string, unknown> | string): [Template | null, string | null];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Theme utility functions for the CSV Importer
3
+ */
4
+ import { ThemeConfig } from "../../types/theme";
5
+ /**
6
+ * Deep merge two theme configurations
7
+ */
8
+ export declare function mergeThemes(base: ThemeConfig, override: ThemeConfig): ThemeConfig;
9
+ /**
10
+ * Generate CSS variables from theme configuration
11
+ */
12
+ export declare function generateThemeVariables(theme: ThemeConfig): Record<string, string>;
13
+ /**
14
+ * Apply CSS variables to an HTML element
15
+ */
16
+ export declare function applyThemeToElement(element: HTMLElement, variables: Record<string, string>): void;
17
+ /**
18
+ * Get computed theme value with fallback
19
+ */
20
+ export declare function getThemeValue(element: HTMLElement, variable: string, fallback?: string): string;
21
+ /**
22
+ * Create a theme from partial configuration
23
+ */
24
+ export declare function createTheme(partial: Partial<ThemeConfig>): ThemeConfig;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Parse JSON input that can be either an object or a string
3
+ * @param param - The parameter to parse (object or JSON string)
4
+ * @param options - Options for parsing
5
+ * @returns Parsed object or stringified JSON based on options
6
+ */
7
+ export declare function parseJSON<T extends 'object' | 'string' = 'object'>(param?: Record<string, unknown> | string, options?: {
8
+ returnType?: T;
9
+ escapePercent?: boolean;
10
+ }): T extends 'string' ? string : Record<string, unknown>;
11
+ export declare const parseObjectOrStringJSON: (name: string, param?: Record<string, unknown> | string) => string;
12
+ export declare const parseObjectOrStringJSONToRecord: (name: string, param?: Record<string, unknown> | string) => Record<string, unknown>;
13
+ export declare const validateJSON: (str: string, paramName: string) => string;
14
+ export declare const sanitizeKey: (input: string) => string;
15
+ export declare const parseOptionalBoolean: (val?: boolean) => "true" | "false" | "";
16
+ export declare const strToBoolean: (str: string) => boolean;
17
+ export declare const strToOptionalBoolean: (str: string) => boolean | undefined;
18
+ export declare const strToDefaultBoolean: (str: string, defaultValue: boolean) => boolean;
19
+ export { isValidColor, darkenColor } from './colorUtils';
@@ -0,0 +1,6 @@
1
+ import "./index.css";
2
+ import CSVImporter from "./components/CSVImporter";
3
+ export { CSVImporter };
4
+ export default CSVImporter;
5
+ export { importcsvStyles } from "./styles";
6
+ export type { Column, Validator, Transformer } from "./types";
@@ -0,0 +1 @@
1
+ export {};
package/build/js.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { CSVImporterProps } from "./types";
2
+ type CreateImporterProps = CSVImporterProps & {
3
+ domElement?: Element;
4
+ };
5
+ export declare function createCSVImporter(props: CreateImporterProps): {
6
+ instance: (import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<CSVImporterProps> & {
7
+ ref?: import("preact").Ref<unknown> | undefined;
8
+ }> & HTMLDialogElement) | null;
9
+ showModal: () => void;
10
+ closeModal: () => void;
11
+ };
12
+ export {};
@@ -36,7 +36,7 @@ type Toast = Omit<ToasterToast, "id">;
36
36
  declare function toast({ ...props }: Toast): {
37
37
  id: string;
38
38
  dismiss: () => void;
39
- update: (props: ToasterToast) => void;
39
+ update: () => void;
40
40
  };
41
41
  declare function useToast(): {
42
42
  toast: typeof toast;