@nolwenture/formik-jsonschema-form 0.22.0 → 0.22.2

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.
@@ -510,14 +510,15 @@ export const FileInfoText = styled.span `
510
510
  `;
511
511
  export const FileUploadFieldContainer = styled.div ``;
512
512
  export const FileUploadField = ({ name, uploadedFile, handleFileUpload, value, setFieldValue, className, uploadProgress, handleRemoveFile, removeButton, uploadButtonText, infoText, }) => {
513
- var _a, _b;
513
+ var _a, _b, _c;
514
514
  const uiSchema = {};
515
515
  return (_jsxs(FileUploadFieldContainer, { className: className, children: [_jsxs("div", { children: [_jsx(FileUploadButton, { type: "button", onClick: () => { var _a; return (_a = document.getElementById(name)) === null || _a === void 0 ? void 0 : _a.click(); }, children: uploadButtonText !== null && uploadButtonText !== void 0 ? uploadButtonText : "Choose File" }), _jsx(HiddenFileInput, { id: name, name: name, type: "file", onChange: (event) => {
516
516
  const file = event.currentTarget.files[0];
517
517
  if (file) {
518
518
  handleFileUpload(file, setFieldValue);
519
+ event.target.value = null;
519
520
  }
520
- } }), !value ? (_jsx(FileInfoText, { children: infoText !== null && infoText !== void 0 ? infoText : "No file chosen" })) : null] }), uploadedFile && value && (_jsx(FileItemContainer, { children: uploadProgress === 100 ? (_jsxs(_Fragment, { children: [_jsx("span", { children: uploadedFile.name }), _jsx(RemoveButton, Object.assign({ type: "button", onClick: () => handleRemoveFile(setFieldValue) }, ((_a = removeButton === null || removeButton === void 0 ? void 0 : removeButton.props) !== null && _a !== void 0 ? _a : {}), { children: (_b = removeButton === null || removeButton === void 0 ? void 0 : removeButton.content) !== null && _b !== void 0 ? _b : "X" }))] })) : (_jsxs(_Fragment, { children: [_jsx("span", { children: uploadedFile.name }), _jsxs(ProgressBarContainer, { children: [_jsx(ProgressBar, { "$progress": uploadProgress }), _jsxs(ProgressText, { children: [uploadProgress, "%"] })] })] })) }))] }));
521
+ } }), !value ? (_jsx(FileInfoText, { children: infoText !== null && infoText !== void 0 ? infoText : "No file chosen" })) : null] }), uploadedFile && value && (_jsx(FileItemContainer, { children: uploadProgress === 100 ? (_jsxs(_Fragment, { children: [_jsx("span", { children: uploadedFile.name }), _jsx(RemoveButton, Object.assign({ type: "button", onClick: () => handleRemoveFile(setFieldValue) }, removeButton === null || removeButton === void 0 ? void 0 : removeButton.props, { style: Object.assign({ color: "red", fontWeight: "bold" }, ((_b = (_a = removeButton === null || removeButton === void 0 ? void 0 : removeButton.props) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {})), children: (_c = removeButton === null || removeButton === void 0 ? void 0 : removeButton.content) !== null && _c !== void 0 ? _c : "X" }))] })) : (_jsxs(_Fragment, { children: [_jsx("span", { children: uploadedFile.name }), _jsxs(ProgressBarContainer, { children: [_jsx(ProgressBar, { "$progress": uploadProgress }), _jsxs(ProgressText, { children: [uploadProgress, "%"] })] })] })) }))] }));
521
522
  };
522
523
  FileUploadField.styles = {
523
524
  FileUploadFieldFileUploadFieldContainerStyle: FileUploadFieldContainer,
@@ -1,12 +1,12 @@
1
1
  import type { Schema, UiSchema } from "../types";
2
2
  export declare const getTitle: ({ title, uiSchema, schema, name, }: {
3
- title?: string | undefined;
4
- uiSchema?: UiSchema | undefined;
5
- schema?: import("json-schema").JSONSchema7 | undefined;
6
- name?: string | undefined;
3
+ title?: string;
4
+ uiSchema?: UiSchema;
5
+ schema?: Schema;
6
+ name?: string;
7
7
  }) => any;
8
8
  export declare const getDescription: ({ description, uiSchema, schema, }: {
9
- description?: string | undefined;
10
- uiSchema?: UiSchema | undefined;
11
- schema?: import("json-schema").JSONSchema7 | undefined;
9
+ description?: string;
10
+ uiSchema?: UiSchema;
11
+ schema?: Schema;
12
12
  }) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolwenture/formik-jsonschema-form",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "Formik form generation from json schema",
5
5
  "author": "Antti Vikman <antti.vikman@nolwenture.com>",
6
6
  "contributors": [
@@ -43,6 +43,7 @@
43
43
  "yup": "^1.4.0"
44
44
  },
45
45
  "devDependencies": {
46
+ "@babel/preset-env": "^7.25.4",
46
47
  "@babel/preset-react": "^7.24.1",
47
48
  "@babel/preset-typescript": "^7.24.1",
48
49
  "@storybook/addon-essentials": "^8.0.5",