@importcsv/react 0.2.14 → 0.4.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/README.md +2 -0
- package/build/App.d.ts +2 -0
- package/build/bundled/index.esm.js +7797 -4626
- package/build/bundled/index.esm.js.map +1 -1
- package/build/bundled/index.js +58 -31
- package/build/bundled/index.js.map +1 -1
- package/build/bundled/index.umd.js +58 -31
- package/build/bundled/index.umd.js.map +1 -1
- package/build/components/CSVImporter/index.d.ts +55 -0
- package/build/components/CSVImporterHeadless.d.ts +46 -0
- package/build/components/ColumnMapper.d.ts +28 -0
- package/build/{preact/components → components}/Modal/index.d.ts +1 -1
- package/build/components/Uploader.d.ts +27 -0
- package/build/components/Validator.d.ts +28 -0
- package/build/components/__tests__/ColumnMapper.test.d.ts +1 -0
- package/build/components/__tests__/Uploader.test.d.ts +1 -0
- package/build/components/__tests__/Validator.test.d.ts +1 -0
- package/build/components/index.d.ts +3 -0
- package/build/config/index.d.ts +5 -0
- package/build/headless/__tests__/integration.test.d.ts +10 -0
- package/build/headless/__tests__/root.test.d.ts +1 -0
- package/build/headless/__tests__/root.types.test-d.d.ts +1 -0
- package/build/headless/__tests__/slot-components.test.d.ts +1 -0
- package/build/headless/__tests__/validator.test.d.ts +1 -0
- package/build/headless/back-button.d.ts +29 -0
- package/build/headless/index.d.ts +45 -0
- package/build/headless/next-button.d.ts +29 -0
- package/build/headless/root.d.ts +40 -0
- package/build/headless/submit-button.d.ts +29 -0
- package/build/headless/types.d.ts +52 -0
- package/build/headless/upload-trigger.d.ts +29 -0
- package/build/headless/utils/slot.d.ts +20 -0
- package/build/headless/utils/zodSchemaToColumns.d.ts +25 -0
- package/build/headless/utils/zodSchemaToColumns.test.d.ts +1 -0
- package/build/headless/validator.d.ts +28 -0
- package/build/importer/components/Box/index.d.ts +2 -0
- package/build/importer/components/Box/index.test.d.ts +1 -0
- package/build/{preact/importer → importer}/components/Box/types/index.d.ts +1 -0
- package/build/importer/components/Checkbox/index.d.ts +3 -0
- package/build/importer/components/Checkbox/index.test.d.ts +1 -0
- package/build/importer/components/Checkbox/types/index.d.ts +8 -0
- package/build/{bundled/importer → importer}/components/Errors/index.d.ts +1 -1
- package/build/{bundled/importer → importer}/components/Input/index.d.ts +2 -2
- package/build/importer/components/Input/index.test.d.ts +1 -0
- package/build/importer/components/Input/types/index.d.ts +24 -0
- package/build/importer/components/Root/index.d.ts +2 -0
- package/build/{bundled/importer → importer}/components/StepLayout/index.d.ts +3 -2
- package/build/importer/components/Stepper/hooks/useStepper.d.ts +4 -0
- package/build/importer/components/Stepper/hooks/useStepper.test.d.ts +1 -0
- package/build/importer/components/Stepper/index.d.ts +2 -0
- package/build/importer/components/Stepper/index.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/components/Stepper/types/index.d.ts +3 -3
- package/build/{bundled/importer → importer}/components/Table/index.d.ts +2 -2
- package/build/{bundled/importer → importer}/components/Table/types/index.d.ts +6 -5
- package/build/importer/components/ToggleFilter/index.d.ts +3 -0
- package/build/{bundled/importer → importer}/components/Tooltip/index.d.ts +2 -2
- package/build/{preact/importer → importer}/components/Tooltip/types/index.d.ts +3 -3
- package/build/{bundled/importer → importer}/components/UploaderWrapper/NativeDropzone.d.ts +3 -2
- package/build/importer/components/UploaderWrapper/UploaderWrapper.d.ts +2 -0
- package/build/{bundled/importer → importer}/components/UploaderWrapper/types/index.d.ts +1 -1
- package/build/{preact/importer → importer}/components/VirtualTable/index.d.ts +3 -3
- package/build/importer/components/VirtualTable/index.test.d.ts +1 -0
- package/build/importer/components/ui/alert.d.ts +15 -0
- package/build/{bundled/importer → importer}/components/ui/button.d.ts +8 -5
- package/build/importer/components/ui/card.d.ts +20 -0
- package/build/importer/components/ui/checkbox.d.ts +10 -0
- package/build/importer/components/ui/dialog.d.ts +39 -0
- package/build/importer/components/ui/flex.d.ts +24 -0
- package/build/importer/components/ui/input.d.ts +8 -0
- package/build/importer/components/ui/select.d.ts +17 -0
- package/build/importer/components/ui/switch.d.ts +11 -0
- package/build/importer/components/ui/toast.d.ts +22 -0
- package/build/importer/components/ui/toaster.d.ts +2 -0
- package/build/importer/components/ui/tooltip.d.ts +25 -0
- package/build/{preact/importer → importer}/components/ui/use-toast.d.ts +2 -2
- package/build/importer/features/complete/index.d.ts +2 -0
- package/build/{bundled/importer → importer}/features/configure-import/index.d.ts +2 -1
- package/build/importer/features/main/hooks/useMutableLocalStorage.test.d.ts +1 -0
- package/build/{preact/importer → importer}/features/main/hooks/useStepNavigation.d.ts +1 -1
- package/build/importer/features/main/hooks/useStepNavigation.test.d.ts +1 -0
- package/build/importer/features/main/index.d.ts +2 -0
- package/build/{bundled/importer → importer}/features/map-columns/components/DropDownFields.d.ts +3 -2
- package/build/{bundled/importer → importer}/features/map-columns/hooks/useMapColumnsTable.d.ts +6 -5
- package/build/importer/features/map-columns/index.d.ts +3 -0
- package/build/{bundled/importer → importer}/features/map-columns/types/index.d.ts +2 -2
- package/build/{bundled/importer → importer}/features/row-selection/index.d.ts +3 -2
- package/build/{preact/importer → importer}/features/row-selection/types/index.d.ts +1 -1
- package/build/importer/features/uploader/hooks/useTemplateTable.d.ts +10 -0
- package/build/{bundled/importer → importer}/features/uploader/index.d.ts +2 -2
- package/build/{bundled/importer → importer}/features/uploader/types/index.d.ts +3 -3
- package/build/importer/features/validation/Validation.d.ts +3 -0
- package/build/importer/features/validation/__tests__/Validation.zod.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/features/validation/components/TransformModal.d.ts +2 -1
- package/build/{bundled/importer → importer}/features/validation/components/TransformPanel.d.ts +2 -1
- package/build/{bundled/importer → importer}/features/validation/types.d.ts +5 -3
- package/build/importer/hooks/useClickOutside.test.d.ts +1 -0
- package/build/importer/hooks/useCustomStyles.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/hooks/useEventListener.d.ts +1 -1
- package/build/importer/hooks/useEventListener.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/build/importer/hooks/useIsomorphicLayoutEffect.test.d.ts +1 -0
- package/build/importer/hooks/useRect.test.d.ts +1 -0
- package/build/importer/hooks/useWindowSize.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/providers/Theme.d.ts +3 -3
- package/build/{bundled/importer → importer}/providers/index.d.ts +3 -3
- package/build/{preact/importer → importer}/providers/types/index.d.ts +1 -1
- package/build/importer/services/api.d.ts +1 -0
- package/build/importer/services/mapping.test.d.ts +1 -0
- package/build/importer/services/transformation.test.d.ts +1 -0
- package/build/importer/settings/theme/index.d.ts +2 -0
- package/build/{preact/importer → importer}/stores/theme.d.ts +3 -3
- package/build/{preact/importer → importer}/theme/runtime.d.ts +4 -0
- package/build/importer/utils/colorUtils.test.d.ts +1 -0
- package/build/importer/utils/errorAnalysis.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/utils/getStringLengthOfChildren.d.ts +1 -1
- package/build/importer/utils/getStringLengthOfChildren.test.d.ts +1 -0
- package/build/importer/utils/stringSimilarity.test.d.ts +1 -0
- package/build/{bundled/importer → importer}/utils/template.d.ts +1 -1
- package/build/importer/utils/template.test.d.ts +1 -0
- package/build/{preact/importer → importer}/utils/themeUtils.d.ts +4 -1
- package/build/importer/utils/themeUtils.test.d.ts +1 -0
- package/build/importer/utils/utils.test.d.ts +1 -0
- package/build/index.d.ts +10 -0
- package/build/index.dev.d.ts +1 -0
- package/build/js.d.ts +57 -0
- package/build/preact/index.esm.js +7219 -4047
- package/build/preact/index.esm.js.map +1 -1
- package/build/preact/index.js +58 -31
- package/build/preact/index.js.map +1 -1
- package/build/react/index.esm.js +7226 -4051
- package/build/react/index.esm.js.map +1 -1
- package/build/react/index.js +58 -31
- package/build/react/index.js.map +1 -1
- package/build/services/api.d.ts +50 -0
- package/build/services/apiClient.d.ts +55 -0
- package/build/{bundled/settings → settings}/defaults.d.ts +1 -1
- package/build/shims/react-compat-shim.d.ts +43 -0
- package/build/shims/react-hooks-shim.d.ts +2 -0
- package/build/test/helpers.d.ts +28 -0
- package/build/test/mocks/api.d.ts +8 -0
- package/build/test/mocks/localStorage.d.ts +6 -0
- package/build/test/setup.d.ts +1 -0
- package/build/{bundled/types → types}/index.d.ts +8 -3
- package/build/{bundled/utils → utils}/cn.d.ts +1 -1
- package/build/utils/cn.test.d.ts +1 -0
- package/package.json +35 -10
- package/build/bundled/components/CSVImporter/index.d.ts +0 -5
- package/build/bundled/components/Modal/index.d.ts +0 -12
- package/build/bundled/importer/components/Box/index.d.ts +0 -2
- package/build/bundled/importer/components/Box/types/index.d.ts +0 -5
- package/build/bundled/importer/components/Checkbox/index.d.ts +0 -2
- package/build/bundled/importer/components/Checkbox/types/index.d.ts +0 -4
- package/build/bundled/importer/components/Input/types/index.d.ts +0 -18
- package/build/bundled/importer/components/Root/index.d.ts +0 -10
- package/build/bundled/importer/components/Stepper/hooks/useStepper.d.ts +0 -2
- package/build/bundled/importer/components/Stepper/index.d.ts +0 -2
- package/build/bundled/importer/components/ToggleFilter/index.d.ts +0 -3
- package/build/bundled/importer/components/Tooltip/types/index.d.ts +0 -11
- package/build/bundled/importer/components/UploaderWrapper/UploaderWrapper.d.ts +0 -2
- package/build/bundled/importer/components/VirtualTable/index.d.ts +0 -17
- package/build/bundled/importer/components/ui/alert.d.ts +0 -13
- package/build/bundled/importer/components/ui/card.d.ts +0 -19
- package/build/bundled/importer/components/ui/checkbox.d.ts +0 -7
- package/build/bundled/importer/components/ui/dialog.d.ts +0 -38
- package/build/bundled/importer/components/ui/flex.d.ts +0 -23
- package/build/bundled/importer/components/ui/input.d.ts +0 -6
- package/build/bundled/importer/components/ui/select.d.ts +0 -13
- package/build/bundled/importer/components/ui/switch.d.ts +0 -7
- package/build/bundled/importer/components/ui/toast.d.ts +0 -22
- package/build/bundled/importer/components/ui/toaster.d.ts +0 -1
- package/build/bundled/importer/components/ui/tooltip.d.ts +0 -24
- package/build/bundled/importer/components/ui/use-toast.d.ts +0 -46
- package/build/bundled/importer/features/complete/index.d.ts +0 -2
- package/build/bundled/importer/features/main/hooks/useStepNavigation.d.ts +0 -17
- package/build/bundled/importer/features/main/index.d.ts +0 -2
- package/build/bundled/importer/features/map-columns/index.d.ts +0 -2
- package/build/bundled/importer/features/row-selection/types/index.d.ts +0 -8
- package/build/bundled/importer/features/uploader/hooks/useTemplateTable.d.ts +0 -10
- package/build/bundled/importer/features/validation/Validation.d.ts +0 -2
- package/build/bundled/importer/providers/types/index.d.ts +0 -10
- package/build/bundled/importer/settings/theme/index.d.ts +0 -2
- package/build/bundled/importer/stores/theme.d.ts +0 -17
- package/build/bundled/importer/theme/runtime.d.ts +0 -62
- package/build/bundled/importer/utils/themeUtils.d.ts +0 -21
- package/build/bundled/index.d.ts +0 -5
- package/build/bundled/js.d.ts +0 -12
- package/build/preact/bundled-styles.d.ts +0 -1
- package/build/preact/components/CSVImporter/index.d.ts +0 -5
- package/build/preact/i18n/de.d.ts +0 -32
- package/build/preact/i18n/es.d.ts +0 -32
- package/build/preact/i18n/fr.d.ts +0 -32
- package/build/preact/i18n/i18n.d.ts +0 -6
- package/build/preact/i18n/it.d.ts +0 -32
- package/build/preact/i18n/useTranslation.d.ts +0 -9
- package/build/preact/importer/components/Box/index.d.ts +0 -2
- package/build/preact/importer/components/Checkbox/index.d.ts +0 -2
- package/build/preact/importer/components/Checkbox/types/index.d.ts +0 -4
- package/build/preact/importer/components/Errors/index.d.ts +0 -4
- package/build/preact/importer/components/Input/index.d.ts +0 -2
- package/build/preact/importer/components/Input/types/index.d.ts +0 -18
- package/build/preact/importer/components/Root/index.d.ts +0 -10
- package/build/preact/importer/components/StepLayout/index.d.ts +0 -18
- package/build/preact/importer/components/Stepper/hooks/useStepper.d.ts +0 -2
- package/build/preact/importer/components/Stepper/index.d.ts +0 -2
- package/build/preact/importer/components/Stepper/types/index.d.ts +0 -14
- package/build/preact/importer/components/Table/index.d.ts +0 -9
- package/build/preact/importer/components/Table/types/index.d.ts +0 -42
- package/build/preact/importer/components/ToggleFilter/index.d.ts +0 -3
- package/build/preact/importer/components/ToggleFilter/types/index.d.ts +0 -11
- package/build/preact/importer/components/Tooltip/index.d.ts +0 -2
- package/build/preact/importer/components/UploaderWrapper/NativeDropzone.d.ts +0 -11
- package/build/preact/importer/components/UploaderWrapper/UploaderWrapper.d.ts +0 -2
- package/build/preact/importer/components/UploaderWrapper/types/index.d.ts +0 -2
- package/build/preact/importer/components/ui/alert.d.ts +0 -13
- package/build/preact/importer/components/ui/button.d.ts +0 -12
- package/build/preact/importer/components/ui/card.d.ts +0 -19
- package/build/preact/importer/components/ui/checkbox.d.ts +0 -7
- package/build/preact/importer/components/ui/dialog.d.ts +0 -38
- package/build/preact/importer/components/ui/flex.d.ts +0 -23
- package/build/preact/importer/components/ui/input.d.ts +0 -6
- package/build/preact/importer/components/ui/select.d.ts +0 -13
- package/build/preact/importer/components/ui/switch.d.ts +0 -7
- package/build/preact/importer/components/ui/toast.d.ts +0 -22
- package/build/preact/importer/components/ui/toaster.d.ts +0 -1
- package/build/preact/importer/components/ui/tooltip.d.ts +0 -24
- package/build/preact/importer/features/complete/index.d.ts +0 -2
- package/build/preact/importer/features/complete/types/index.d.ts +0 -5
- package/build/preact/importer/features/configure-import/index.d.ts +0 -13
- package/build/preact/importer/features/configure-import/types/index.d.ts +0 -13
- package/build/preact/importer/features/main/hooks/useMutableLocalStorage.d.ts +0 -1
- package/build/preact/importer/features/main/index.d.ts +0 -2
- package/build/preact/importer/features/main/types/index.d.ts +0 -16
- package/build/preact/importer/features/map-columns/components/DropDownFields.d.ts +0 -21
- package/build/preact/importer/features/map-columns/hooks/useMapColumnsTable.d.ts +0 -16
- package/build/preact/importer/features/map-columns/index.d.ts +0 -2
- package/build/preact/importer/features/map-columns/types/index.d.ts +0 -16
- package/build/preact/importer/features/row-selection/index.d.ts +0 -2
- package/build/preact/importer/features/uploader/hooks/useTemplateTable.d.ts +0 -10
- package/build/preact/importer/features/uploader/index.d.ts +0 -2
- package/build/preact/importer/features/uploader/types/index.d.ts +0 -9
- package/build/preact/importer/features/validation/Validation.d.ts +0 -2
- package/build/preact/importer/features/validation/components/TransformModal.d.ts +0 -18
- package/build/preact/importer/features/validation/components/TransformPanel.d.ts +0 -18
- package/build/preact/importer/features/validation/index.d.ts +0 -1
- package/build/preact/importer/features/validation/types.d.ts +0 -32
- package/build/preact/importer/hooks/useClickOutside.d.ts +0 -1
- package/build/preact/importer/hooks/useCustomStyles.d.ts +0 -1
- package/build/preact/importer/hooks/useEventListener.d.ts +0 -4
- package/build/preact/importer/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
- package/build/preact/importer/hooks/useRect.d.ts +0 -12
- package/build/preact/importer/hooks/useWindowSize.d.ts +0 -1
- package/build/preact/importer/providers/Theme.d.ts +0 -10
- package/build/preact/importer/providers/index.d.ts +0 -5
- package/build/preact/importer/services/mapping.d.ts +0 -31
- package/build/preact/importer/services/transformation.d.ts +0 -70
- package/build/preact/importer/settings/theme/colors.d.ts +0 -4
- package/build/preact/importer/settings/theme/index.d.ts +0 -2
- package/build/preact/importer/settings/theme/sizes.d.ts +0 -7
- package/build/preact/importer/theme/index.d.ts +0 -8
- package/build/preact/importer/theme/presets.d.ts +0 -314
- package/build/preact/importer/theme/styles.d.ts +0 -120
- package/build/preact/importer/types/index.d.ts +0 -9
- package/build/preact/importer/utils/colorUtils.d.ts +0 -48
- package/build/preact/importer/utils/errorAnalysis.d.ts +0 -25
- package/build/preact/importer/utils/getStringLengthOfChildren.d.ts +0 -2
- package/build/preact/importer/utils/stringSimilarity.d.ts +0 -1
- package/build/preact/importer/utils/template.d.ts +0 -2
- package/build/preact/importer/utils/utils.d.ts +0 -19
- package/build/preact/index.d.ts +0 -5
- package/build/preact/js.d.ts +0 -12
- package/build/preact/settings/defaults.d.ts +0 -3
- package/build/preact/styles.d.ts +0 -1
- package/build/preact/types/index.d.ts +0 -132
- package/build/preact/types/theme.d.ts +0 -153
- package/build/preact/utils/cn.d.ts +0 -6
- package/build/preact/validation/transformationStages.d.ts +0 -26
- package/build/preact/validation/transformer.d.ts +0 -17
- package/build/preact/validation/validator.d.ts +0 -23
- /package/build/{bundled/bundled-styles.d.ts → bundled-styles.d.ts} +0 -0
- /package/build/{bundled/importer/services/api.d.ts → components/CSVImporter/index.test.d.ts} +0 -0
- /package/build/{preact/importer/services/api.d.ts → components/__tests__/CSVImporterHeadless.test.d.ts} +0 -0
- /package/build/{bundled/i18n → i18n}/de.d.ts +0 -0
- /package/build/{bundled/i18n → i18n}/es.d.ts +0 -0
- /package/build/{bundled/i18n → i18n}/fr.d.ts +0 -0
- /package/build/{bundled/i18n → i18n}/i18n.d.ts +0 -0
- /package/build/{bundled/i18n → i18n}/it.d.ts +0 -0
- /package/build/{bundled/i18n → i18n}/useTranslation.d.ts +0 -0
- /package/build/{bundled/importer → importer}/components/ToggleFilter/types/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/features/complete/types/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/features/configure-import/types/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/features/main/hooks/useMutableLocalStorage.d.ts +0 -0
- /package/build/{bundled/importer → importer}/features/main/types/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/features/validation/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/hooks/useClickOutside.d.ts +0 -0
- /package/build/{bundled/importer → importer}/hooks/useCustomStyles.d.ts +0 -0
- /package/build/{bundled/importer → importer}/hooks/useRect.d.ts +0 -0
- /package/build/{bundled/importer → importer}/hooks/useWindowSize.d.ts +0 -0
- /package/build/{bundled/importer → importer}/services/mapping.d.ts +0 -0
- /package/build/{bundled/importer → importer}/services/transformation.d.ts +0 -0
- /package/build/{bundled/importer → importer}/settings/theme/colors.d.ts +0 -0
- /package/build/{bundled/importer → importer}/settings/theme/sizes.d.ts +0 -0
- /package/build/{bundled/importer → importer}/theme/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/theme/presets.d.ts +0 -0
- /package/build/{bundled/importer → importer}/theme/styles.d.ts +0 -0
- /package/build/{bundled/importer → importer}/types/index.d.ts +0 -0
- /package/build/{bundled/importer → importer}/utils/colorUtils.d.ts +0 -0
- /package/build/{bundled/importer → importer}/utils/errorAnalysis.d.ts +0 -0
- /package/build/{bundled/importer → importer}/utils/stringSimilarity.d.ts +0 -0
- /package/build/{bundled/importer → importer}/utils/utils.d.ts +0 -0
- /package/build/{bundled/styles.d.ts → styles.d.ts} +0 -0
- /package/build/{bundled/types → types}/theme.d.ts +0 -0
- /package/build/{bundled/validation → validation}/transformationStages.d.ts +0 -0
- /package/build/{bundled/validation → validation}/transformer.d.ts +0 -0
- /package/build/{bundled/validation → validation}/validator.d.ts +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { JSX } from 'preact/compat';
|
|
2
|
+
import { CSVImporterProps } from "../../types";
|
|
3
|
+
import "../../index.css";
|
|
4
|
+
import "./style/csv-importer.css";
|
|
5
|
+
import "./style/dark-mode.css";
|
|
6
|
+
import "../Modal/style.css";
|
|
7
|
+
declare const CSVImporter: <TSchema = any>(props: {
|
|
8
|
+
schema?: import("zod").ZodType<TSchema, import("zod").ZodTypeDef, TSchema> | undefined;
|
|
9
|
+
columns?: import("../../types").Column[] | undefined;
|
|
10
|
+
importerKey?: string | undefined;
|
|
11
|
+
onComplete?: ((data: TSchema[]) => void) | undefined;
|
|
12
|
+
backendUrl?: string | undefined;
|
|
13
|
+
user?: Record<string, any> | undefined;
|
|
14
|
+
metadata?: Record<string, any> | undefined;
|
|
15
|
+
theme?: "default" | "minimal" | "modern" | "compact" | "dark" | import("../../types/theme").ThemeConfig | undefined;
|
|
16
|
+
darkMode?: boolean | undefined;
|
|
17
|
+
primaryColor?: string | undefined;
|
|
18
|
+
className?: string | undefined;
|
|
19
|
+
customStyles?: string | Record<string, string> | undefined;
|
|
20
|
+
classNames?: {
|
|
21
|
+
root?: string | undefined;
|
|
22
|
+
modal?: string | undefined;
|
|
23
|
+
header?: string | undefined;
|
|
24
|
+
stepper?: string | undefined;
|
|
25
|
+
content?: string | undefined;
|
|
26
|
+
footer?: string | undefined;
|
|
27
|
+
button?: string | undefined;
|
|
28
|
+
input?: string | undefined;
|
|
29
|
+
table?: string | undefined;
|
|
30
|
+
dropzone?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
showDownloadTemplateButton?: boolean | undefined;
|
|
33
|
+
skipHeaderRowSelection?: boolean | undefined;
|
|
34
|
+
waitOnComplete?: boolean | undefined;
|
|
35
|
+
invalidRowHandling?: "include" | "exclude" | "block" | undefined;
|
|
36
|
+
includeUnmatchedColumns?: boolean | undefined;
|
|
37
|
+
language?: string | undefined;
|
|
38
|
+
customTranslations?: {
|
|
39
|
+
[language: string]: {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
} | undefined;
|
|
43
|
+
demoData?: {
|
|
44
|
+
fileName: string;
|
|
45
|
+
csvContent: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
} & {
|
|
48
|
+
isModal?: boolean | undefined;
|
|
49
|
+
modalIsOpen?: boolean | undefined;
|
|
50
|
+
modalOnCloseTriggered?: (() => void) | undefined;
|
|
51
|
+
modalCloseOnOutsideClick?: boolean | undefined;
|
|
52
|
+
} & {
|
|
53
|
+
ref?: any;
|
|
54
|
+
}) => JSX.Element;
|
|
55
|
+
export default CSVImporter;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INTERNAL EXAMPLE: Complete CSV Importer built with headless primitives
|
|
3
|
+
*
|
|
4
|
+
* This component demonstrates how to build a full-featured importer using
|
|
5
|
+
* only the headless primitives. It's kept as an internal reference and for tests.
|
|
6
|
+
*
|
|
7
|
+
* Users should either:
|
|
8
|
+
* - Use the main CSVImporter component (full-featured, production-ready)
|
|
9
|
+
* - Build custom importers using CSV.* primitives (maximum flexibility)
|
|
10
|
+
* - Use standalone Uploader/ColumnMapper components (pick what you need)
|
|
11
|
+
*
|
|
12
|
+
* This is NOT exported from the package - it serves as documentation
|
|
13
|
+
* and a comprehensive integration test of the headless architecture.
|
|
14
|
+
*/
|
|
15
|
+
import { h } from 'preact';
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
import type { Column } from '../headless/types';
|
|
18
|
+
export interface CSVImporterHeadlessProps {
|
|
19
|
+
schema?: z.ZodSchema<any>;
|
|
20
|
+
columns?: Column[];
|
|
21
|
+
onComplete: (data: any[]) => void | Promise<void>;
|
|
22
|
+
onError?: (error: {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
theme?: 'light' | 'dark';
|
|
28
|
+
appearance?: {
|
|
29
|
+
variables?: {
|
|
30
|
+
colorPrimary?: string;
|
|
31
|
+
borderRadius?: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
skipColumnMapping?: boolean;
|
|
35
|
+
skipValidation?: boolean;
|
|
36
|
+
autoSkipIfPerfectMatch?: boolean;
|
|
37
|
+
maxFileSize?: number;
|
|
38
|
+
acceptedFormats?: string[];
|
|
39
|
+
showPreview?: boolean;
|
|
40
|
+
previewRows?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Main CSVImporter component built with headless primitives
|
|
44
|
+
*/
|
|
45
|
+
export declare const CSVImporterHeadless: ({ schema, columns, onComplete, onError, className, theme, appearance, skipColumnMapping, skipValidation, autoSkipIfPerfectMatch, maxFileSize, acceptedFormats, showPreview, previewRows }: CSVImporterHeadlessProps) => h.JSX.Element;
|
|
46
|
+
export default CSVImporterHeadless;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { Column } from '../headless/types';
|
|
4
|
+
interface ColumnMapperProps {
|
|
5
|
+
schema?: z.ZodSchema<any>;
|
|
6
|
+
columns?: Column[];
|
|
7
|
+
data: {
|
|
8
|
+
rows: any[];
|
|
9
|
+
};
|
|
10
|
+
onComplete: (mapping: Record<string, string>) => void;
|
|
11
|
+
onError?: (error: {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
autoSuggest?: boolean;
|
|
16
|
+
showPreview?: boolean;
|
|
17
|
+
previewRows?: number;
|
|
18
|
+
autoSkipIfPerfectMatch?: boolean;
|
|
19
|
+
className?: string;
|
|
20
|
+
theme?: 'light' | 'dark';
|
|
21
|
+
appearance?: {
|
|
22
|
+
variables?: {
|
|
23
|
+
colorPrimary?: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare const ColumnMapper: ({ schema, columns: propColumns, data, onComplete, onError, autoSuggest, showPreview, previewRows, autoSkipIfPerfectMatch, className, theme, appearance }: ColumnMapperProps) => h.JSX.Element;
|
|
28
|
+
export default ColumnMapper;
|
|
@@ -8,5 +8,5 @@ interface ModalProps {
|
|
|
8
8
|
overlayClassName?: string;
|
|
9
9
|
contentClassName?: string;
|
|
10
10
|
}
|
|
11
|
-
declare const Modal: ({ isOpen, onClose, children, closeOnOutsideClick, className, overlayClassName, contentClassName }: ModalProps) => import(
|
|
11
|
+
declare const Modal: ({ isOpen, onClose, children, closeOnOutsideClick, className, overlayClassName, contentClassName }: ModalProps) => import("preact").VNode<any> | null;
|
|
12
12
|
export default Modal;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { Column } from '../headless/types';
|
|
4
|
+
interface UploaderProps {
|
|
5
|
+
schema?: z.ZodSchema<any>;
|
|
6
|
+
columns?: Column[];
|
|
7
|
+
onUpload: (data: {
|
|
8
|
+
rows: any[];
|
|
9
|
+
}) => void;
|
|
10
|
+
onError?: (error: {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
maxSize?: number;
|
|
16
|
+
acceptedFormats?: string[];
|
|
17
|
+
className?: string;
|
|
18
|
+
theme?: 'light' | 'dark';
|
|
19
|
+
appearance?: {
|
|
20
|
+
variables?: {
|
|
21
|
+
colorPrimary?: string;
|
|
22
|
+
borderRadius?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const Uploader: ({ schema, columns, onUpload, ...props }: UploaderProps) => h.JSX.Element;
|
|
27
|
+
export default Uploader;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { Column } from '../headless/types';
|
|
4
|
+
interface ValidatorProps {
|
|
5
|
+
schema?: z.ZodSchema<any>;
|
|
6
|
+
columns?: Column[];
|
|
7
|
+
data: {
|
|
8
|
+
rows: any[];
|
|
9
|
+
};
|
|
10
|
+
mapping?: Record<string, string>;
|
|
11
|
+
onComplete: (validData: any[]) => void;
|
|
12
|
+
autoValidate?: boolean;
|
|
13
|
+
allowInlineEdit?: boolean;
|
|
14
|
+
allowRemoveRows?: boolean;
|
|
15
|
+
allowSubmitWithErrors?: boolean;
|
|
16
|
+
allowExportErrors?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
theme?: 'light' | 'dark';
|
|
19
|
+
appearance?: {
|
|
20
|
+
variables?: {
|
|
21
|
+
colorError?: string;
|
|
22
|
+
colorSuccess?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
errorsPerPage?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const Validator: ({ schema, columns, data, mapping, onComplete, autoValidate, allowInlineEdit, allowRemoveRows, allowSubmitWithErrors, allowExportErrors, className, theme, appearance, errorsPerPage }: ValidatorProps) => h.JSX.Element;
|
|
28
|
+
export default Validator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for building a complete CSV importer using headless components
|
|
3
|
+
*
|
|
4
|
+
* These tests verify that:
|
|
5
|
+
* 1. Headless components can build a full CSV import workflow
|
|
6
|
+
* 2. The workflow matches the behavior of the existing CSVImporter
|
|
7
|
+
* 3. All features work together seamlessly
|
|
8
|
+
* 4. Backward compatibility with legacy API is maintained
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentChildren } from 'preact';
|
|
2
|
+
export interface BackButtonProps {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
children: ComponentChildren;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* BackButton component - Go to previous step
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Default button
|
|
13
|
+
* <BackButton onClick={goToPreviousStep}>Back</BackButton>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // With shadcn/ui Button
|
|
17
|
+
* import { Button } from '@/components/ui/button';
|
|
18
|
+
* <BackButton asChild>
|
|
19
|
+
* <Button variant="outline">Back</Button>
|
|
20
|
+
* </BackButton>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With Chakra UI Button
|
|
24
|
+
* import { Button } from '@chakra-ui/react';
|
|
25
|
+
* <BackButton asChild>
|
|
26
|
+
* <Button colorScheme="gray">Back</Button>
|
|
27
|
+
* </BackButton>
|
|
28
|
+
*/
|
|
29
|
+
export declare function BackButton({ asChild, children, onClick, ...props }: BackButtonProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless CSV Importer Components
|
|
3
|
+
*
|
|
4
|
+
* Domain logic primitives with no UI dependencies.
|
|
5
|
+
* Works with any design system (shadcn/ui, MUI, Chakra, etc.)
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // With Zod schema
|
|
9
|
+
* import * as CSV from '@importcsv/react/headless';
|
|
10
|
+
* import { z } from 'zod';
|
|
11
|
+
*
|
|
12
|
+
* const schema = z.object({
|
|
13
|
+
* name: z.string(),
|
|
14
|
+
* email: z.string().email()
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* <CSV.Root schema={schema} onComplete={handleComplete}>
|
|
18
|
+
* <CSV.Validator>
|
|
19
|
+
* {({ errors, validate }) => (
|
|
20
|
+
* // Your custom UI here
|
|
21
|
+
* )}
|
|
22
|
+
* </CSV.Validator>
|
|
23
|
+
* </CSV.Root>
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // With design system components (asChild pattern)
|
|
27
|
+
* import { Button } from '@/components/ui/button';
|
|
28
|
+
*
|
|
29
|
+
* <CSV.UploadTrigger asChild>
|
|
30
|
+
* <Button variant="primary">Upload CSV</Button>
|
|
31
|
+
* </CSV.UploadTrigger>
|
|
32
|
+
*/
|
|
33
|
+
export { Root, useCSV } from './root';
|
|
34
|
+
export { Validator } from './validator';
|
|
35
|
+
export { UploadTrigger } from './upload-trigger';
|
|
36
|
+
export { NextButton } from './next-button';
|
|
37
|
+
export { BackButton } from './back-button';
|
|
38
|
+
export { SubmitButton } from './submit-button';
|
|
39
|
+
export type { Column, ValidationError, CSVContextValue, RootProps, ValidatorProps, ValidatorChildProps } from './types';
|
|
40
|
+
export type { UploadTriggerProps } from './upload-trigger';
|
|
41
|
+
export type { NextButtonProps } from './next-button';
|
|
42
|
+
export type { BackButtonProps } from './back-button';
|
|
43
|
+
export type { SubmitButtonProps } from './submit-button';
|
|
44
|
+
export { zodSchemaToColumns } from './utils/zodSchemaToColumns';
|
|
45
|
+
export { Slot } from './utils/slot';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentChildren } from 'preact';
|
|
2
|
+
export interface NextButtonProps {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
children: ComponentChildren;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* NextButton component - Proceed to next step
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Default button
|
|
13
|
+
* <NextButton onClick={goToNextStep}>Next</NextButton>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // With shadcn/ui Button
|
|
17
|
+
* import { Button } from '@/components/ui/button';
|
|
18
|
+
* <NextButton asChild>
|
|
19
|
+
* <Button variant="primary">Next</Button>
|
|
20
|
+
* </NextButton>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With Material-UI Button
|
|
24
|
+
* import { Button } from '@mui/material';
|
|
25
|
+
* <NextButton asChild>
|
|
26
|
+
* <Button variant="contained">Next</Button>
|
|
27
|
+
* </NextButton>
|
|
28
|
+
*/
|
|
29
|
+
export declare function NextButton({ asChild, children, onClick, ...props }: NextButtonProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CSVContextValue, RootProps } from './types';
|
|
2
|
+
export declare const CSVContext: import("preact").Context<CSVContextValue<any> | null>;
|
|
3
|
+
/**
|
|
4
|
+
* CSV Root context provider with Zod schema support
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // With Zod schema (recommended)
|
|
8
|
+
* const schema = z.object({
|
|
9
|
+
* name: z.string(),
|
|
10
|
+
* email: z.string().email()
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* <CSV.Root schema={schema} onComplete={(data) => console.log(data)}>
|
|
14
|
+
* <CSV.Uploader />
|
|
15
|
+
* <CSV.Validator />
|
|
16
|
+
* </CSV.Root>
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // With legacy columns array (backward compatibility)
|
|
20
|
+
* <CSV.Root
|
|
21
|
+
* columns={[
|
|
22
|
+
* { id: 'name', label: 'Name', type: 'string', required: true },
|
|
23
|
+
* { id: 'email', label: 'Email', type: 'email', required: true }
|
|
24
|
+
* ]}
|
|
25
|
+
* onComplete={(data) => console.log(data)}
|
|
26
|
+
* >
|
|
27
|
+
* <CSV.Uploader />
|
|
28
|
+
* </CSV.Root>
|
|
29
|
+
*/
|
|
30
|
+
export declare function Root<TSchema = any>({ children, schema, columns, onComplete, data }: RootProps<TSchema>): import("preact").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Hook to access CSV context
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* function MyComponent() {
|
|
36
|
+
* const { columns, validate, schema } = useCSV();
|
|
37
|
+
* return <div>{columns.length} columns</div>;
|
|
38
|
+
* }
|
|
39
|
+
*/
|
|
40
|
+
export declare function useCSV(): CSVContextValue<any>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentChildren } from 'preact';
|
|
2
|
+
export interface SubmitButtonProps {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
children: ComponentChildren;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* SubmitButton component - Submit final data
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Default button
|
|
13
|
+
* <SubmitButton>Submit</SubmitButton>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // With shadcn/ui Button
|
|
17
|
+
* import { Button } from '@/components/ui/button';
|
|
18
|
+
* <SubmitButton asChild>
|
|
19
|
+
* <Button variant="primary">Submit</Button>
|
|
20
|
+
* </SubmitButton>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With Material-UI Button
|
|
24
|
+
* import { Button } from '@mui/material';
|
|
25
|
+
* <SubmitButton asChild>
|
|
26
|
+
* <Button variant="contained" type="submit">Submit</Button>
|
|
27
|
+
* </SubmitButton>
|
|
28
|
+
*/
|
|
29
|
+
export declare function SubmitButton({ asChild, children, onClick, ...props }: SubmitButtonProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ComponentChildren } from 'preact';
|
|
3
|
+
export interface Column {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
validators?: Array<{
|
|
9
|
+
type: string;
|
|
10
|
+
value?: any;
|
|
11
|
+
message?: string;
|
|
12
|
+
pattern?: string;
|
|
13
|
+
}>;
|
|
14
|
+
transformations?: Array<{
|
|
15
|
+
type: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>;
|
|
18
|
+
options?: string[];
|
|
19
|
+
description?: string;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ValidationError {
|
|
23
|
+
row: number;
|
|
24
|
+
column: string;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CSVContextValue<TSchema = any> {
|
|
28
|
+
columns: Column[];
|
|
29
|
+
schema?: z.ZodSchema<TSchema>;
|
|
30
|
+
validate: (row: any) => z.SafeParseReturnType<TSchema, TSchema>;
|
|
31
|
+
onComplete: (data: TSchema[]) => void | Promise<void>;
|
|
32
|
+
data?: {
|
|
33
|
+
rows: any[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface RootProps<TSchema = any> {
|
|
37
|
+
children: ComponentChildren;
|
|
38
|
+
schema?: z.ZodSchema<TSchema>;
|
|
39
|
+
columns?: Column[];
|
|
40
|
+
onComplete: (data: TSchema[]) => void | Promise<void>;
|
|
41
|
+
data?: {
|
|
42
|
+
rows: any[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ValidatorChildProps {
|
|
46
|
+
errors: ValidationError[];
|
|
47
|
+
validate: () => Promise<ValidationError[]>;
|
|
48
|
+
isValidating: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ValidatorProps {
|
|
51
|
+
children: (props: ValidatorChildProps) => any;
|
|
52
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentChildren } from 'preact';
|
|
2
|
+
export interface UploadTriggerProps {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
children: ComponentChildren;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* UploadTrigger component - Trigger file picker
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Default button
|
|
13
|
+
* <UploadTrigger>Upload CSV</UploadTrigger>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // With shadcn/ui Button
|
|
17
|
+
* import { Button } from '@/components/ui/button';
|
|
18
|
+
* <UploadTrigger asChild>
|
|
19
|
+
* <Button variant="primary">Upload CSV</Button>
|
|
20
|
+
* </UploadTrigger>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With Material-UI Button
|
|
24
|
+
* import { Button } from '@mui/material';
|
|
25
|
+
* <UploadTrigger asChild>
|
|
26
|
+
* <Button variant="contained">Upload CSV</Button>
|
|
27
|
+
* </UploadTrigger>
|
|
28
|
+
*/
|
|
29
|
+
export declare function UploadTrigger({ asChild, children, onClick, ...props }: UploadTriggerProps): import("preact").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ComponentChildren, type VNode } from 'preact';
|
|
2
|
+
interface SlotProps {
|
|
3
|
+
children: ComponentChildren;
|
|
4
|
+
onClick?: (...args: any[]) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Slot component for Preact - enables composition pattern (asChild)
|
|
10
|
+
*
|
|
11
|
+
* Merges props from parent to child element, similar to Radix UI's Slot
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const Comp = asChild ? Slot : 'button';
|
|
15
|
+
* <Comp onClick={handleClick} className="btn">
|
|
16
|
+
* <CustomButton>Click me</CustomButton>
|
|
17
|
+
* </Comp>
|
|
18
|
+
*/
|
|
19
|
+
export declare function Slot({ children, ...props }: SlotProps): VNode<any> | null;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Column } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Zod schema to Column[] with full validator/transformer extraction
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const schema = z.object({
|
|
8
|
+
* name: z.string().min(1, 'Name is required'),
|
|
9
|
+
* email: z.string().email('Must be a valid email'),
|
|
10
|
+
* age: z.number().min(18).optional(),
|
|
11
|
+
* department: z.enum(['engineering', 'sales', 'marketing'])
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* const columns = zodSchemaToColumns(schema);
|
|
15
|
+
* // Result: [
|
|
16
|
+
* // { id: 'name', label: 'Name', type: 'string', validators: [...] },
|
|
17
|
+
* // { id: 'email', label: 'Email', type: 'email', validators: [...] },
|
|
18
|
+
* // { id: 'age', label: 'Age', type: 'number', validators: [...] },
|
|
19
|
+
* // { id: 'department', label: 'Department', type: 'select', options: [...] }
|
|
20
|
+
* // ]
|
|
21
|
+
*
|
|
22
|
+
* @note Boolean fields are mapped to 'string' type for CSV compatibility,
|
|
23
|
+
* as CSV data is text-based and typically represents booleans as 'true'/'false' strings.
|
|
24
|
+
*/
|
|
25
|
+
export declare function zodSchemaToColumns<T>(schema: z.ZodSchema<T>): Column[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ValidatorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* CSV Validator component with Zod integration
|
|
4
|
+
*
|
|
5
|
+
* Provides validation functionality using Zod schemas or custom validation logic
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <CSV.Validator>
|
|
9
|
+
* {({ errors, validate, isValidating }) => (
|
|
10
|
+
* <div>
|
|
11
|
+
* <button onClick={validate} disabled={isValidating}>
|
|
12
|
+
* {isValidating ? 'Validating...' : 'Validate Data'}
|
|
13
|
+
* </button>
|
|
14
|
+
* {errors.length > 0 && (
|
|
15
|
+
* <div>
|
|
16
|
+
* <h3>Validation Errors:</h3>
|
|
17
|
+
* {errors.map((error, i) => (
|
|
18
|
+
* <div key={i}>
|
|
19
|
+
* Row {error.row + 1}, Column {error.column}: {error.message}
|
|
20
|
+
* </div>
|
|
21
|
+
* ))}
|
|
22
|
+
* </div>
|
|
23
|
+
* )}
|
|
24
|
+
* </div>
|
|
25
|
+
* )}
|
|
26
|
+
* </CSV.Validator>
|
|
27
|
+
*/
|
|
28
|
+
export declare function Validator({ children }: ValidatorProps): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSX, VNode } from "preact";
|
|
2
|
+
export type CheckboxProps = Omit<JSX.HTMLAttributes<HTMLInputElement>, 'label'> & {
|
|
3
|
+
label?: string | VNode;
|
|
4
|
+
name?: string;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onChange?: (e: JSX.TargetedEvent<HTMLInputElement, Event>) => void;
|
|
8
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InputProps } from
|
|
2
|
-
export default function Input({ as, label, icon, iconAfter, error, options, className, variants, children, ...props }: InputProps): import("
|
|
1
|
+
import { InputProps } from "./types";
|
|
2
|
+
export default function Input({ as, label, icon, iconAfter, error, options, className, variants, children, ...props }: InputProps): import("preact/compat").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX, VNode } from "preact";
|
|
2
|
+
export type inputTypes = "date" | "datetime-local" | "email" | "file" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
3
|
+
export type InputVariants = "fluid" | "small";
|
|
4
|
+
export type InputOption = JSX.HTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
required?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
};
|
|
8
|
+
export type InputProps = Omit<JSX.HTMLAttributes<HTMLInputElement>, 'label'> & Omit<JSX.HTMLAttributes<HTMLSelectElement>, 'label'> & Omit<JSX.HTMLAttributes<HTMLTextAreaElement>, 'label'> & {
|
|
9
|
+
as?: "input" | "textarea";
|
|
10
|
+
label?: string | VNode;
|
|
11
|
+
icon?: VNode;
|
|
12
|
+
iconAfter?: VNode;
|
|
13
|
+
error?: string;
|
|
14
|
+
options?: {
|
|
15
|
+
[key: string]: InputOption;
|
|
16
|
+
};
|
|
17
|
+
variants?: InputVariants[];
|
|
18
|
+
type?: inputTypes;
|
|
19
|
+
name?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
value?: string;
|
|
22
|
+
onChange?: (value: string) => void;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
};
|