New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mux/mux-uploader-react

Package Overview
Dependencies
Maintainers
2
Versions
558
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-uploader-react - npm Package Compare versions

Comparing version 0.1.0-canary.3-b05142f to 0.1.0-canary.30-473875f

CHANGELOG.md

81

dist/types-ts3.4/index.d.ts

@@ -6,17 +6,84 @@ import React from 'react';

import MuxUploaderElement from '@mux/mux-uploader';
import { MuxUploaderElementEventMap } from '@mux/mux-uploader';
export declare type MuxUploaderRefAttributes = MuxUploaderElement;
interface GenericEventListener<T extends Event = CustomEvent> {
(evt: T): void;
}
export declare type MuxUploaderProps = {
url: string;
id?: string;
endpoint?: MuxUploaderElement['endpoint'];
type?: string;
status?: boolean;
style?: CSSProperties;
style?: CSSProperties & {
['--uploader-font-family']?: CSSProperties['fontFamily'];
['--uploader-font-size']?: CSSProperties['fontSize'];
['--uploader-background-color']?: CSSProperties['backgroundColor'];
['--button-background-color']?: CSSProperties['backgroundColor'];
['--button-border-radius']?: CSSProperties['borderRadius'];
['--button-border']?: CSSProperties['border'];
['--button-padding']?: CSSProperties['padding'];
['--button-hover-text']?: CSSProperties['color'];
['--button-hover-background']?: CSSProperties['background'];
['--button-active-text']?: CSSProperties['color'];
['--button-active-background']?: CSSProperties['background'];
['--progress-bar-fill-color']?: CSSProperties['background'];
['--progress-radial-fill-color']?: CSSProperties['stroke'];
};
children?: React.ReactNode;
formatProgress?: (percent: number) => string;
onError?: EventListener;
onProgress?: EventListener;
onSuccess?: EventListener;
};
declare const MuxUploader: React.ForwardRefExoticComponent<MuxUploaderProps & React.RefAttributes<MuxUploaderElement>>;
dynamicChunkSize?: boolean;
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap['uploadstart']>;
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap['chunkattempt']>;
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap['chunksuccess']>;
onUploadError?: GenericEventListener<MuxUploaderElementEventMap['uploaderror']>;
onProgress?: GenericEventListener<MuxUploaderElementEventMap['progress']>;
onSuccess?: GenericEventListener<MuxUploaderElementEventMap['success']>;
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, 'ref'>>;
declare const MuxUploader: React.ForwardRefExoticComponent<{
id?: string | undefined;
endpoint?: MuxUploaderElement['endpoint'];
type?: string | undefined;
status?: boolean | undefined;
style?: (React.CSSProperties & {
"--uploader-font-family"?: CSSProperties['fontFamily'];
"--uploader-font-size"?: CSSProperties['fontSize'];
"--uploader-background-color"?: CSSProperties['backgroundColor'];
"--button-background-color"?: CSSProperties['backgroundColor'];
"--button-border-radius"?: CSSProperties['borderRadius'];
"--button-border"?: CSSProperties['border'];
"--button-padding"?: CSSProperties['padding'];
"--button-hover-text"?: CSSProperties['color'];
"--button-hover-background"?: CSSProperties['background'];
"--button-active-text"?: CSSProperties['color'];
"--button-active-background"?: CSSProperties['background'];
"--progress-bar-fill-color"?: CSSProperties['background'];
"--progress-radial-fill-color"?: CSSProperties['stroke'];
}) | undefined;
children?: React.ReactNode;
formatProgress?: ((percent: number) => string) | undefined;
dynamicChunkSize?: boolean | undefined;
onUploadStart?: GenericEventListener<CustomEvent<{
file: File;
chunkSize: number;
}>> | undefined;
onChunkAttempt?: GenericEventListener<CustomEvent<{
chunkNumber: number;
chunkSize: number;
}>> | undefined;
onChunkSuccess?: GenericEventListener<CustomEvent<{
chunk: number;
chunkSize: number;
attempts: number;
timeInterval: number;
response: any;
}>> | undefined;
onUploadError?: GenericEventListener<CustomEvent<{
message: string;
chunkNumber?: number | undefined;
attempts?: number | undefined;
}>> | undefined;
onProgress?: GenericEventListener<CustomEvent<number>> | undefined;
onSuccess?: GenericEventListener<CustomEvent<null | undefined>> | undefined;
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, Exclude<keyof React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">> & React.RefAttributes<MuxUploaderElement>>;
export { MuxUploaderDrop };
export default MuxUploader;

4

dist/types-ts3.4/mux-uploader-drop.d.ts

@@ -9,3 +9,5 @@ import React from 'react';

overlayText?: string;
style?: CSSProperties;
style?: CSSProperties & {
['--overlay-background-color']?: CSSProperties['backgroundColor'];
};
children?: React.ReactNode;

@@ -12,0 +14,0 @@ };

@@ -6,17 +6,84 @@ import React from 'react';

import type MuxUploaderElement from '@mux/mux-uploader';
import type { MuxUploaderElementEventMap } from '@mux/mux-uploader';
export declare type MuxUploaderRefAttributes = MuxUploaderElement;
interface GenericEventListener<T extends Event = CustomEvent> {
(evt: T): void;
}
export declare type MuxUploaderProps = {
url: string;
id?: string;
endpoint?: MuxUploaderElement['endpoint'];
type?: string;
status?: boolean;
style?: CSSProperties;
style?: CSSProperties & {
['--uploader-font-family']?: CSSProperties['fontFamily'];
['--uploader-font-size']?: CSSProperties['fontSize'];
['--uploader-background-color']?: CSSProperties['backgroundColor'];
['--button-background-color']?: CSSProperties['backgroundColor'];
['--button-border-radius']?: CSSProperties['borderRadius'];
['--button-border']?: CSSProperties['border'];
['--button-padding']?: CSSProperties['padding'];
['--button-hover-text']?: CSSProperties['color'];
['--button-hover-background']?: CSSProperties['background'];
['--button-active-text']?: CSSProperties['color'];
['--button-active-background']?: CSSProperties['background'];
['--progress-bar-fill-color']?: CSSProperties['background'];
['--progress-radial-fill-color']?: CSSProperties['stroke'];
};
children?: React.ReactNode;
formatProgress?: (percent: number) => string;
onError?: EventListener;
onProgress?: EventListener;
onSuccess?: EventListener;
};
declare const MuxUploader: React.ForwardRefExoticComponent<MuxUploaderProps & React.RefAttributes<MuxUploaderElement>>;
dynamicChunkSize?: boolean;
onUploadStart?: GenericEventListener<MuxUploaderElementEventMap['uploadstart']>;
onChunkAttempt?: GenericEventListener<MuxUploaderElementEventMap['chunkattempt']>;
onChunkSuccess?: GenericEventListener<MuxUploaderElementEventMap['chunksuccess']>;
onUploadError?: GenericEventListener<MuxUploaderElementEventMap['uploaderror']>;
onProgress?: GenericEventListener<MuxUploaderElementEventMap['progress']>;
onSuccess?: GenericEventListener<MuxUploaderElementEventMap['success']>;
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, 'ref'>;
declare const MuxUploader: React.ForwardRefExoticComponent<{
id?: string | undefined;
endpoint?: MuxUploaderElement['endpoint'];
type?: string | undefined;
status?: boolean | undefined;
style?: (React.CSSProperties & {
"--uploader-font-family"?: CSSProperties['fontFamily'];
"--uploader-font-size"?: CSSProperties['fontSize'];
"--uploader-background-color"?: CSSProperties['backgroundColor'];
"--button-background-color"?: CSSProperties['backgroundColor'];
"--button-border-radius"?: CSSProperties['borderRadius'];
"--button-border"?: CSSProperties['border'];
"--button-padding"?: CSSProperties['padding'];
"--button-hover-text"?: CSSProperties['color'];
"--button-hover-background"?: CSSProperties['background'];
"--button-active-text"?: CSSProperties['color'];
"--button-active-background"?: CSSProperties['background'];
"--progress-bar-fill-color"?: CSSProperties['background'];
"--progress-radial-fill-color"?: CSSProperties['stroke'];
}) | undefined;
children?: React.ReactNode;
formatProgress?: ((percent: number) => string) | undefined;
dynamicChunkSize?: boolean | undefined;
onUploadStart?: GenericEventListener<CustomEvent<{
file: File;
chunkSize: number;
}>> | undefined;
onChunkAttempt?: GenericEventListener<CustomEvent<{
chunkNumber: number;
chunkSize: number;
}>> | undefined;
onChunkSuccess?: GenericEventListener<CustomEvent<{
chunk: number;
chunkSize: number;
attempts: number;
timeInterval: number;
response: any;
}>> | undefined;
onUploadError?: GenericEventListener<CustomEvent<{
message: string;
chunkNumber?: number | undefined;
attempts?: number | undefined;
}>> | undefined;
onProgress?: GenericEventListener<CustomEvent<number>> | undefined;
onSuccess?: GenericEventListener<CustomEvent<null | undefined>> | undefined;
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<MuxUploaderElement>>;
export { MuxUploaderDrop };
export default MuxUploader;

@@ -9,3 +9,5 @@ import React from 'react';

overlayText?: string;
style?: CSSProperties;
style?: CSSProperties & {
['--overlay-background-color']?: CSSProperties['backgroundColor'];
};
children?: React.ReactNode;

@@ -12,0 +14,0 @@ };

{
"name": "@mux/mux-uploader-react",
"version": "0.1.0-canary.3-b05142f",
"version": "0.1.0-canary.30-473875f",
"type": "commonjs",
"description": "An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you",
"main": "dist/index.js",
"main": "./dist/index.cjs.js",
"module": "./dist/index.mjs",
"exports": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs.js",
"default": "./dist/index.cjs.js"
},
"types": "dist/types-ts3.4/index.d.ts",

@@ -25,9 +31,11 @@ "typesVersions": {

"dev:cjs": "open-process | yarn build:cjs --watch",
"dev:esm": "open-process | yarn build:esm --watch",
"dev:types": "yarn build:types -w",
"dev": "npm-run-all --parallel dev:types dev:cjs",
"build:cjs": "esbuild src/index.tsx --target=es2019 --minify --bundle --sourcemap --format=cjs --loader:.css=text --outdir=dist --external:react --external:prop-types",
"build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types' && downlevel-dts ./dist/types ./dist/types-ts3.4",
"build": "npm-run-all --parallel build:types 'build:cjs -- --minify'",
"dev": "npm-run-all --parallel dev:types dev:cjs dev:esm",
"build:cjs": "esbuild src/index.tsx --target=es2019 --minify --bundle --sourcemap --metafile=./dist/cjs.json --format=cjs --loader:.css=text --outdir=dist --out-extension:.js=.cjs.js --external:react --external:prop-types",
"build:esm": "esbuild src/index.tsx --target=es2019 --minify --bundle --sourcemap --metafile=./dist/esm.json --format=esm --loader:.css=text --outdir=dist --out-extension:.js=.mjs --external:react --external:prop-types",
"build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
"postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4",
"build": "npm-run-all --parallel build:types 'build:cjs -- --minify' 'build:esm -- --minify'",
"prebuild": "yarn clean",
"prepublishOnly": "yarn build",
"create-release-notes": "create-release-notes ./CHANGELOG.md",

@@ -50,3 +58,4 @@ "publish-release": "../../scripts/publish.sh"

"dependencies": {
"@mux/mux-uploader": "^0.1.0-beta.2",
"@mux/mux-elements-codemod": "1.1.2-canary.31-473875f",
"@mux/mux-uploader": "0.1.0-canary.30-473875f",
"prop-types": "^15.7.2"

@@ -53,0 +62,0 @@ },

@@ -70,9 +70,10 @@ <p align="center">

| Property | Type | Description | Default |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `url` | `string` | The authenticated URL that your file will be uploaded to. Check out the [direct uploads docs](https://docs.mux.com/guides/video/upload-files-directly#1-create-an-authenticated-mux-url) for how to create one. Required. | `undefined` |
| `id` | `string` | An ID that allows `<MuxUploaderDrop>` to locate `<MuxUploader>`. Required if you use `<MuxUploaderDrop>`. | N/A |
| `type` | `"bar"` | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
| `status` | `boolean` | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
| `formatProgress` | `function` | A function that accepts numeric percent and is expected to return a string. Allows for customizing how the progress should be rendered. | A function the yields a percent progress string |
| Property | Type | Description | Default |
| ------------------ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `endpoint` | `string \| Promise` | Either a) the authenticated URL that your file will be uploaded to or b) an async function that yields a promise that resolves to that url. Check out the [direct uploads docs](https://docs.mux.com/guides/video/upload-files-directly#1-create-an-authenticated-mux-url) for how to create one. Required. | `undefined` |
| `id` | `string` | An ID that allows `<MuxUploaderDrop>` to locate `<MuxUploader>`. Required if you use `<MuxUploaderDrop>`. | N/A |
| `type` | `"bar"` | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
| `status` | `boolean` | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
| `formatProgress` | `function` | A function that accepts numeric percent and is expected to return a string. Allows for customizing how the progress should be rendered - whether you want to display only the number, a sentence with the number etc. i.e. `formatProgress={(percent: number) => `${percent} percent uploaded`}` | A function that yields only the percent as a string i.e. `"60%"` |
| `dynamicChunkSize` | `boolean` | Toggles uploading with dynamic chunk sizes. Chunk sizes will change with upload speed to attempt to optimize upload. | `false` |

@@ -84,3 +85,3 @@ #### `<MuxUploaderDrop>`

| `overlay` | `boolean` | Toggles fullscreen overlay on dragover. | false |
| `overlayText` | `boolean` | Optional text to display on dragover when `overlay` is on. | `''` |
| `overlayText` | `string` | Optional text to display on dragover when `overlay` is on. | `''` |
| `muxUploader` | `string ` | Must match the `id` on `<MuxUploader>`. Required. | N/A |

@@ -92,8 +93,11 @@

`<MuxUploader>` has a handful of events to monitor uploading state.
`<MuxUploader>` has a handful of a number of callbacks associated with events to handle uploading state.
| Prop | Description |
| ------------ | -------------------------------------------------------------------------- |
| `onError` | Invoked when an error occurs in the chunked upload process. |
| `onProgress` | Invoked whenever a chunk of the file has successfully completed uploading. |
| `onSuccess` | Invoked when the entire file has successfully completed uploading. |
| Prop | Description |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onUploadStart` | Fired when the upload begins. |
| `onChunkAttempt` | Invoked immediately before a chunk upload is attempted. |
| `onChunkSuccess` | Invoked when an indvidual chunk is successfully uploaded. Sample response: `{ detail: { chunk: Integer, attempts: Integer, response: XhrResponse } }` |
| `onUploadError` | Invoked when an error occurs in the chunked upload process. |
| `onProgress` | Invoked continuously with incremental upload progress. This returns the current percentage of the file that's been uploaded. Sample response: `{ detail: [0..100] }` |
| `onSuccess` | Invoked when the entire file has successfully completed uploading. |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc