Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/file-input: refactor to TypeScript #4954

Merged
merged 13 commits into from Feb 24, 2024
Merged

@uppy/file-input: refactor to TypeScript #4954

merged 13 commits into from Feb 24, 2024

Conversation

aduh95
Copy link
Member

@aduh95 aduh95 commented Feb 23, 2024

Extracted from #4921

Copy link
Contributor

github-actions bot commented Feb 23, 2024

Diff output files
diff --git a/packages/@uppy/file-input/lib/FileInput.js b/packages/@uppy/file-input/lib/FileInput.js
index f42cfa3..d688deb 100644
--- a/packages/@uppy/file-input/lib/FileInput.js
+++ b/packages/@uppy/file-input/lib/FileInput.js
@@ -5,22 +5,20 @@ const packageJson = {
   "version": "3.0.4",
 };
 import locale from "./locale.js";
+const defaultOptions = {
+  pretty: true,
+  inputName: "files[]",
+};
 export default class FileInput extends UIPlugin {
   constructor(uppy, opts) {
-    super(uppy, opts);
+    super(uppy, {
+      ...defaultOptions,
+      ...opts,
+    });
     this.id = this.opts.id || "FileInput";
     this.title = "File Input";
     this.type = "acquirer";
     this.defaultLocale = locale;
-    const defaultOptions = {
-      target: null,
-      pretty: true,
-      inputName: "files[]",
-    };
-    this.opts = {
-      ...defaultOptions,
-      ...opts,
-    };
     this.i18nInit();
     this.render = this.render.bind(this);
     this.handleInputChange = this.handleInputChange.bind(this);
@@ -60,7 +58,7 @@ export default class FileInput extends UIPlugin {
     const {
       restrictions,
     } = this.uppy.opts;
-    const accept = restrictions.allowedFileTypes ? restrictions.allowedFileTypes.join(",") : null;
+    const accept = restrictions.allowedFileTypes ? restrictions.allowedFileTypes.join(",") : undefined;
     return h(
       "div",
       {
@@ -68,7 +66,7 @@ export default class FileInput extends UIPlugin {
       },
       h("input", {
         className: "uppy-FileInput-input",
-        style: this.opts.pretty && hiddenInputStyle,
+        style: this.opts.pretty ? hiddenInputStyle : undefined,
         type: "file",
         name: this.opts.inputName,
         onChange: this.handleInputChange,

packages/@uppy/file-input/.npmignore Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
mifi and others added 2 commits February 24, 2024 17:24
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
packages/@uppy/file-input/src/FileInput.tsx Outdated Show resolved Hide resolved
mifi and others added 3 commits February 24, 2024 17:38
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
Copy link
Member Author

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM

@aduh95 aduh95 merged commit 1fe7297 into main Feb 24, 2024
16 checks passed
@aduh95 aduh95 deleted the progress-bar-ts branch February 24, 2024 10:13
Murderlon added a commit that referenced this pull request Feb 26, 2024
* main:
  @uppy/file-input: refactor to TypeScript (#4954)
Murderlon added a commit that referenced this pull request Feb 26, 2024
* main:
  @uppy/file-input: refactor to TypeScript (#4954)
  Release: uppy@3.22.2 (#4952)
  @uppy/core: fix plugin detection (#4951)
  Introduce `ValidateableFile` & move `MinimalRequiredUppyFile` into utils (#4944)
  uppy: fix bundle builder (#4950)
  @uppy/core: improve `UIPluginOptions` types (#4946)
  @uppy/companion-client: fix body/url on upload-success (#4922)
  @uppy/utils: remove EventManager circular reference (#4949)
  MetaEditor + ImageEditor - new state machine logic (#4939)
  meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (#4945)
  remove unnecessary `'use strict'` directives (#4943)
  @uppy/companion-client: type changes for provider-views (#4938)
  meta: bump ip from 1.1.8 to 1.1.9 (#4941)
@github-actions github-actions bot mentioned this pull request Feb 28, 2024
github-actions bot added a commit that referenced this pull request Feb 28, 2024
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/box              |   2.2.1 | @uppy/onedrive         |   3.2.1 |
| @uppy/companion-client |   3.7.4 | @uppy/progress-bar     |   3.1.0 |
| @uppy/core             |   3.9.3 | @uppy/provider-views   |  3.10.0 |
| @uppy/dashboard        |   3.7.5 | @uppy/status-bar       |   3.3.0 |
| @uppy/file-input       |   3.1.0 | @uppy/utils            |   5.7.4 |
| @uppy/form             |   3.2.0 | @uppy/xhr-upload       |   3.6.4 |
| @uppy/image-editor     |   2.4.4 | uppy                   |  3.23.0 |
| @uppy/informer         |   3.1.0 |                        |         |

- @uppy/form: migrate to TS (Merlijn Vos / #4937)
- @uppy/box: fetchPreAuthToken in box too (Mikael Finstad / #4969)
- @uppy/progress-bar: refactor to TypeScript (Mikael Finstad / #4921)
- @uppy/onedrive: fix custom oauth2 credentials for onedrive (Mikael Finstad / #4968)
- @uppy/companion-client,@uppy/utils,@uppy/xhr-upload: improvements for #4922 (Mikael Finstad / #4960)
- @uppy/utils: fix various type issues (Mikael Finstad / #4958)
- @uppy/provider-views: migrate to TS (Merlijn Vos / #4919)
- @uppy/utils: simplify `findDOMElements` (Mikael Finstad / #4957)
- @uppy/xhr-upload: fix getResponseData regression (Merlijn Vos / #4964)
- @uppy/informer: migrate to TS (Merlijn Vos / #4967)
- @uppy/core: remove unused import (Antoine du Hamel / #4972)
- @uppy/image-editor: remove default target (Merlijn Vos / #4966)
- @uppy/angular: Build fixes (Mikael Finstad / #4959)
- meta: Fix flaky e2e test (Murderlon)
- meta: fix e2e flake (Mikael Finstad / #4961)
- meta: add support for `Fragment` short syntax (Antoine du Hamel / #4953)
- @uppy/file-input: refactor to TypeScript (Antoine du Hamel / #4954)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants