
Research
/Security News
Intercom’s npm Package Compromised in Ongoing Mini Shai-Hulud Worm Attack
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.
@asphalt-react/file-uploader
Advanced tools
The FileUploader component is a tool for simplifying file uploads in React applications. It supports file selection through a traditional file picker or drag-and-drop functionality, with customizable intents and multiple variants to suit different use cases. The component offers flexible sizing, accessibility features like keyboard navigation and screen reader support. It handles file validation errors, supports multiple file uploads, and allows customization of labels and qualifiers, making it adaptable to a wide range of file upload scenarios.
import { FileUploader } from '@asphalt-react/file-uploader'
const accept = {
'image/png': ['.png'],
'text/html': ['.html', '.htm']
}
const onChange = (acceptedFiles, {rejectedFiles, event}) => {}
<FileUploader drop onChange={onChange} accept={accept} multiple />
There are 2 variations of FileUploader:
The inline version is a simpler variant that does not support drag and drop functionality. It provides a straightforward file selection interface where users can click a button to open the native file picker dialog. This variant is ideal for use cases where drag and drop is not necessary or desired.
The drag and drop version includes a dropzone area where users can drag and drop files for upload. This variant enhances the user experience by providing a visual cue for file upload and supports multiple file selection simultaneously.
Drag and drop variant comes with 2 different intents:
There are multiple combinations of the action button that can be used in both variants:
By providing accept prop you can make the component accept specific file types and reject the others. The value must be an object with a common MIME type as keys and an array of file extensions as values.
const accept = {
'image/png': ['.png'],
'text/html': ['.html', '.htm']
}
<FileUploader accept={accept} />
The component will render native input type=file in the HTML. It will be read by screen reader as an input element.
FileUploader works with keyboard navigation. Pressing enter when the component is on focused, will trigger opening the file explorer window.
aria-invalid and aria-disabled according to the invalid and disabled prop values.
FileUploader accepts the input form aria-* attributes.
The value must be an object with a common MIME type as keys and an array of file extensions as values. For example:
accept={{ 'image/*': ['.jpg', '.png'], 'video/*': ['.mp4'] }}
| type | required | default |
|---|---|---|
| objectOf | false | {} |
Applies brand styling.
| type | required | default |
|---|---|---|
| bool | false | false |
Applies system styling.
| type | required | default |
|---|---|---|
| bool | false | false |
Applies secondary styling.
| type | required | default |
|---|---|---|
| bool | false | false |
Applies tertiary styling.
| type | required | default |
|---|---|---|
| bool | false | false |
Caption text for the file uploader action button.
| type | required | default |
|---|---|---|
| string | false | "Browse File" |
Description text for the file uploader.
| type | required | default |
|---|---|---|
| string | false | "Choose file to upload" |
Title text for the file uploader.
| type | required | default |
|---|---|---|
| string | false | "Upload Files" |
Disable the file uploader.
| type | required | default |
|---|---|---|
| bool | false | false |
Enable or disable drag and drop functionality.
| type | required | default |
|---|---|---|
| bool | false | false |
Marks the file uploader as invalid.
| type | required | default |
|---|---|---|
| bool | false | false |
Maximum number of files that can be selected.
| type | required | default |
|---|---|---|
| number | false | 0 |
Maximum file size in bytes. In case of multiple files, the size is checked for each file.
| type | required | default |
|---|---|---|
| number | false | N/A |
Minimum file size in bytes. In case of multiple files, the size is checked for each file.
| type | required | default |
|---|---|---|
| number | false | 0 |
Allow multiple file selection.
| type | required | default |
|---|---|---|
| bool | false | false |
Callback function when file(s) are selected. It returns these values:
acceptedFiles: FileListrejectedFiles: Array
file: Fileerrors: Array
code: stringmessage: stringevent: DragEventfunction onChange(acceptedFiles, { rejectedFiles, event }) {}
| type | required | default |
|---|---|---|
| func | false | N/A |
Displays an image on top of the dropzone area.
By default, an image qualifier is displayed.
Use false to hide the default qualifier.
Provide an SVG or icon to render a custom qualifier.
| type | required | default |
|---|---|---|
| union | false | true |
Add SVG or icon qualifier for action button.
| type | required | default |
|---|---|---|
| element | false | null |
Controls size of FileUploader. Possible values are "xs", "s", "m", "l".
| type | required | default |
|---|---|---|
| enum | false | "m" |
Show the file name after selection.
| type | required | default |
|---|---|---|
| bool | false | true |
Applies primary surface styling.
| type | required | default |
|---|---|---|
| bool | false | false |
Applies secondary surface styling.
| type | required | default |
|---|---|---|
| bool | false | false |
FAQs
FileUploader
The npm package @asphalt-react/file-uploader receives a total of 58 weekly downloads. As such, @asphalt-react/file-uploader popularity was classified as not popular.
We found that @asphalt-react/file-uploader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

Research
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.