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

feat(file-uploader): Merge to main #3028

Merged
merged 155 commits into from Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
a3635aa
Added storage folder
Jul 25, 2022
ecbbd75
Creating scaffold
Jul 27, 2022
f05b50a
Merged main in
Sep 6, 2022
eec7f74
POC: Added drop area and button
Sep 7, 2022
2145b53
added file picker and cleaned up code
Sep 9, 2022
52816a1
Updated filetracker in POC
Sep 11, 2022
684031f
Merge branch 'main' into file-uploader
Sep 14, 2022
caf538a
Added pausing and resuming
Sep 14, 2022
cd84c75
Added hooks
Sep 15, 2022
257f579
Added more function override capabalities
Sep 15, 2022
e26309c
Added overriding components
Sep 19, 2022
1400d22
Added new uploading strategies
Sep 20, 2022
5a56166
Refactored to pass in pause resume upload
Sep 20, 2022
87592ac
added todo
Sep 30, 2022
b3b25b8
Merge branch 'main' into file-uploader
Oct 18, 2022
2674179
Moved packages to correct places
Oct 19, 2022
ff59f77
Moved files around, added storage environment
Oct 19, 2022
7a7b05d
renamed packages, more cleanup
Oct 19, 2022
1ce187c
Updated file uploader design
Oct 19, 2022
e69e526
added first test
Oct 20, 2022
98bb490
Added some basic test scaffolding
Oct 20, 2022
d4d036c
Added more tests
Oct 20, 2022
33d8674
Updated directory structure
Oct 20, 2022
4d569d0
Moved out of react-core
Oct 21, 2022
ec3e466
Added stubbs
Oct 24, 2022
216ed16
Stubbed out example
Oct 24, 2022
6c4a3ac
Added new variation, button and drop components
Oct 25, 2022
82b47a9
Fixed issue with types
Oct 25, 2022
765cf5e
feat(file-uploader): File Uploader Folder and Package Structure (#2771)
ErikCH Oct 26, 2022
8962ced
Updated based on comments
Oct 26, 2022
d0d4a98
Fixed conflicts
Oct 26, 2022
edf283d
Removed data- attributes
Oct 26, 2022
3ae96e0
Updated files
Oct 26, 2022
063367d
feat(file-uploader): File Uploader UploaderButton, UploaderDrop (#2820)
ErikCH Oct 27, 2022
b13e0a4
Fixed conflicts
Oct 27, 2022
429caef
Added updates based on feedback from last PR
Oct 27, 2022
4eac046
Update logic on dropping and adding files
Oct 27, 2022
f64296f
Added tests
Oct 27, 2022
0b1dc55
Added updates from code reviews
Oct 27, 2022
192e4e6
First attempt adding in previewer
Oct 27, 2022
2bc8caf
Added a few tests
Oct 27, 2022
347e0c7
feat(file-uploader): Previewer - Adding Files (#2839)
ErikCH Oct 27, 2022
0db3b37
Fixed conflicts
Oct 27, 2022
ee9c60e
feat(file-uploader): add dropzone styling and theming
dbanksdesign Oct 28, 2022
7bf5783
chore: updating tests
dbanksdesign Oct 28, 2022
44e670b
Added updates on code review
Oct 28, 2022
704d065
Added new file states and upload capabalities
Oct 28, 2022
7cd2bd8
Added in more file states
Oct 28, 2022
d2ceeaa
updated test snapshots
Oct 28, 2022
da31b94
feat(file-uploader): Tracker - Show Files (#2848)
ErikCH Oct 28, 2022
59375c3
Fixed conflicts
Oct 28, 2022
c85c05f
Fixed snapshot
Oct 28, 2022
583058e
Began work on upload validations
Oct 29, 2022
6d5a04a
Fixed bug with deleting files
Oct 29, 2022
a1cbf06
Updated tests
Oct 30, 2022
f10dff7
Merge pull request #2854 from aws-amplify/fileuploader/upload-to-server
ErikCH Oct 30, 2022
a13284b
Merge branch 'fileuploader/main' into fileuploader/validations
ErikCH Oct 30, 2022
03a19df
Fixed conflicts
Oct 30, 2022
2a6b417
Fixed LGTM issue
Oct 30, 2022
f6e704a
Removed onDelete and cancelAll for now
Oct 30, 2022
23a5616
Added error callback
Oct 30, 2022
b1b11ef
Added on success callback
Oct 30, 2022
f04b146
Updates from PR review
Oct 30, 2022
3abd1f8
Merge pull request #2861 from aws-amplify/fileuploader/validations
ErikCH Oct 30, 2022
dd08219
Fixed import
Oct 30, 2022
2a8e271
Merge pull request #2851 from aws-amplify/fileuploader/dropzone-styles
ErikCH Oct 30, 2022
5756e9c
fixed bug on success
Oct 30, 2022
24b7851
Fixed bug with input
Oct 30, 2022
eaedd0c
chore(ci): Setup fileuploader release (#2863)
wlee221 Oct 30, 2022
80ddbd2
Merge branch 'main' into fileuploader/main
Oct 30, 2022
bda50a5
Added filenames fix
Oct 31, 2022
a42f902
chore(ci): Add E2E test for fileuploader/main branch (#2880)
ErikCH Nov 2, 2022
dbd637f
Merge branch 'main' into fileuploader/main
Nov 3, 2022
cd83442
Merge branch 'main' into fileuploader/main
Nov 7, 2022
6f0da9f
Fixed reusable call
Nov 7, 2022
904ce84
Fixed bug in reusable-e2e
Nov 7, 2022
fb40e45
feat(file-uploader): Refactor (#2892)
ErikCH Nov 8, 2022
202861e
chore(fileuploader): adding theming and proper classnames (#2896)
dbanksdesign Nov 8, 2022
a2cf52c
feat: add resumable as a prop (#2925)
dbanksdesign Nov 10, 2022
f37eb76
chore(file-uploader): Add unit tests to main file uploader components…
ErikCH Nov 11, 2022
c4b1b5d
chore(fileuploader): starting docs (#2942)
dbanksdesign Nov 13, 2022
1849fb4
Added new overrides for Previewer and Tracker
Nov 14, 2022
fb64e55
feat(fileuploader): cancel file name edit, a11y improvements (#2957)
dbanksdesign Nov 14, 2022
5b87312
Merged main in
Nov 15, 2022
4dfcb6b
Merge branch 'fileuploader/main' into fileuploader/custom-overrides
Nov 15, 2022
eeade6a
Merge pull request #2980 from aws-amplify/fileuploader/custom-overrides
ErikCH Nov 15, 2022
4dc02a3
Added new turn off previewer image
Nov 15, 2022
769d6f8
Added new autoproceed prop
Nov 15, 2022
cf8a443
Fixed prop
Nov 15, 2022
2b16df0
Added null
Nov 16, 2022
e0ec2fe
Added cleanup pr for console warning
Nov 16, 2022
42e1a0b
Merge pull request #2990 from aws-amplify/fileuploader/autoproceed
ErikCH Nov 17, 2022
888df94
Added new TOC for docs
Nov 17, 2022
6b8f129
Fixed conflict
Nov 17, 2022
55e3015
Merge pull request #2988 from aws-amplify/fileuploader/turnoffpreview
ErikCH Nov 17, 2022
0a35547
Merge branch 'fileuploader/main' into fileuploader/docs-update
Nov 17, 2022
c178d0d
Added more examples
Nov 18, 2022
0861ae4
Merged main in
Nov 18, 2022
fbef484
Added test and updated logger
Nov 18, 2022
9e9b76c
Updated from code review
Nov 18, 2022
a0575ec
Fixed test
Nov 18, 2022
de29003
Added props
Nov 18, 2022
6adb628
Merge pull request #2998 from aws-amplify/fileuploader/cleanup
ErikCH Nov 18, 2022
1fd0e6a
updated links
Nov 18, 2022
df46256
Merge branch 'main' into fileuploader/main
dbanksdesign Nov 20, 2022
e8dde92
Merge branch 'main' into fileuploader/main
dbanksdesign Nov 20, 2022
61cf944
Updated based on comments
Nov 21, 2022
c8bee17
Merge pull request #3016 from aws-amplify/fileuploader/docs-update
ErikCH Nov 21, 2022
66b1e4c
Fixed test for uploader
Nov 21, 2022
803ecc6
Renamed isSuccess prop
Nov 21, 2022
26f0358
Renamed resumable to isResumable
Nov 21, 2022
7f34084
renamed shouldAutoProceed
Nov 21, 2022
b3d449c
Renamed multiple to hasMultipleFiles
Nov 21, 2022
8fe390e
Removed ref for hiddenInput
Nov 21, 2022
da953ba
Updated from code review
Nov 21, 2022
ffb09cb
Removed ref from file uploader component
Nov 21, 2022
81a7bd8
Updated from code review
Nov 22, 2022
89dfd48
Update variable names, added string literals, refactored some util fu…
Nov 22, 2022
2527296
Removed comments
Nov 22, 2022
f1b82cd
deleting un-needed variable
Nov 22, 2022
a778cbf
Fixed test
Nov 22, 2022
9c0abe1
Moved from ref to useState
Nov 22, 2022
3a9aef1
Merge branch 'main' into fileuploader/main
Nov 22, 2022
51dff4e
updated key for uploader
Nov 22, 2022
6393e86
Fixed bugs
Nov 22, 2022
74f62d8
fixed tests
Nov 22, 2022
bfd9447
Updated error in translation
Nov 22, 2022
0544ec9
Fixed test
Nov 22, 2022
7ea1d6c
Merge branch 'main' into fileuploader/main
Nov 22, 2022
28ca6d6
Merge branch 'fileuploader/main' into fileuploader/bug-fix
Nov 22, 2022
059a443
Fixed rendering issue
Nov 22, 2022
b6c93a3
Fixed percentage and other code review comments
Nov 22, 2022
38de413
Removed progesscallback
Nov 22, 2022
885920e
fixed isCancelEdit, updateEditStatus, and isDeterminate variable
Nov 23, 2022
b87cad5
Merged fileuploader/main in
Nov 23, 2022
d175e97
chore: fixing RN tests
dbanksdesign Nov 23, 2022
b0c47a7
updated snapshot
Nov 23, 2022
136b993
Updated components based on refactor from Caleb
Nov 23, 2022
f86e2e5
Created util function for valid extension
Nov 23, 2022
30bd640
Moved isValidExtension to utils
Nov 24, 2022
f282c57
Fixed tests
Nov 24, 2022
d23a487
Cleaned up types
Nov 25, 2022
6734314
Deleted UploadButton
Nov 25, 2022
c1b3b23
Added changeset
Nov 27, 2022
6b4980f
added storage keys
Nov 27, 2022
0d7400f
Merge pull request #3072 from aws-amplify/fileuploader/bug-fix
ErikCH Nov 28, 2022
df25024
Fixed tests
Nov 28, 2022
a8ad125
Merge branch 'main' into fileuploader/main
ErikCH Nov 28, 2022
032f403
Retrigger cicd
Nov 28, 2022
fa7db24
chore(docs): fileuploader docs updates (#3097)
dbanksdesign Nov 28, 2022
45e0595
chore(fileuploader): remove max width and set default variation to drop
dbanksdesign Nov 29, 2022
7286720
chore(docs): add feature flag for fileuploader component props
dbanksdesign Nov 29, 2022
966161b
chore(file-uploader): Rename components fix max files error (#3098)
ErikCH Nov 29, 2022
3e4faab
fix(fileuploader): fix snapshots (#3100)
calebpollman Nov 29, 2022
fc15c6d
chore(fileuploader): remove components api (#3102)
calebpollman Nov 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/small-dancers-cheer.md
@@ -0,0 +1,6 @@
---
'@aws-amplify/ui-react': minor
'@aws-amplify/ui': minor
---

Added the FileUploader component. The File Uploader lets your users upload files to the cloud. For more information follow the instructions. https://ui.docs.amplify.aws/react/connected-components/storage/fileuploader
17 changes: 17 additions & 0 deletions .github/workflows/publish-fileuploader.yml
@@ -0,0 +1,17 @@
# Description: This workflow runs unit + e2e tests
#
# Triggered by: merge to `fileuploader/main` branch

name: Publish / fileuploader

on:
push:
branches: [fileuploader/release]

jobs:
publish:
uses: ./.github/workflows/reusable-tagged-publish.yml
with:
dist-tag: fileuploader
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 8 additions & 0 deletions docs/next.config.js
@@ -1,6 +1,7 @@
const path = require('path');
const { execSync } = require('child_process');

const reHypeIgnoreLines = require('./src/plugins/rehype-ignore-code');
const gitHead = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();

const BRANCH = gitHead === 'HEAD' ? 'main' : gitHead;
Expand All @@ -14,6 +15,8 @@ module.exports = withNextPluginPreval({
DOCSEARCH_DOCS_APP_ID: process.env.DOCSEARCH_DOCS_APP_ID,
DOCSEARCH_DOCS_API_KEY: process.env.DOCSEARCH_DOCS_API_KEY,
DOCSEARCH_DOCS_INDEX_NAME: process.env.DOCSEARCH_DOCS_INDEX_NAME,
FF_FILEUPLOADER_COMPONENTS_ENABLED:
process.env.FF_FILEUPLOADER_COMPONENTS_ENABLED,
},
// Differentiate pages with frontmatter & layout vs. normal MD(X)
pageExtensions: ['page.mdx', 'page.tsx'],
Expand Down Expand Up @@ -158,6 +161,11 @@ module.exports = withNextPluginPreval({

webpack(config) {
const defaultRehypePlugins = [
// This is a custom plugin that removes lines that end in `// IGNORE`
// This allows us to include code necessary for an example to run
// but that should not be in customer's code. For example, using a
// plugin to make mock a connected component.
reHypeIgnoreLines,
require('mdx-prism'),
// TODO: these are older versions of these packages because the newer versions
// are ESM only.
Expand Down
4 changes: 3 additions & 1 deletion docs/src/components/ComponentVariableTable.tsx
Expand Up @@ -6,7 +6,9 @@ function extractClasses(themeObject) {
const themeKeys = Object.keys(themeObject);
let classNames = [];
themeKeys.forEach((key) => {
if (themeObject[key]?.name) {
// 'value' is a special attribute, only design tokens will have 'value'
// however, there could be a 'name' in part of the object
if (themeObject[key]?.value) {
classNames.push(themeObject[key].name);
} else if (typeof themeObject[key] === 'object') {
classNames = classNames.concat(extractClasses(themeObject[key]));
Expand Down
4 changes: 4 additions & 0 deletions docs/src/components/FeatureFlagSection.tsx
@@ -0,0 +1,4 @@
export const FeatureFlagSection = ({ children, featureFlag }) => {
if (!featureFlag) return null;
return children;
};
13 changes: 13 additions & 0 deletions docs/src/data/links.tsx
Expand Up @@ -134,6 +134,19 @@ export const connectedComponents: ComponentNavItem[] = [
body: 'Amplify UI Geo provides UI components for maps and location search built on top of Amazon Location Service.',
platforms: ['react'],
},
{
href: '/connected-components/storage',
label: 'Storage',
body: "Amplify UI Storage components allow you to store files in the cloud using Amplify's Storage category",
platforms: ['react'],
},
{
href: '/connected-components/storage/fileuploader',
label: 'File Uploader',
body: 'FileUploader component allows users to upload files to your Amplify backend.',
platforms: ['react'],
tertiary: true,
},
{
href: '/connected-components/in-app-messaging',
label: 'In-App Messaging',
Expand Down
@@ -0,0 +1,12 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const AcceptedFileTypesExample = () => {
return (
<FileUploader
acceptedFileTypes={['.gif', '.bmp', '.doc', '.jpeg', '.jpg']}
variation="drop"
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,12 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const AutoProceedExample = () => {
return (
<FileUploader
shouldAutoProceed={true}
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,10 @@
import { FileUploader } from '@aws-amplify/ui-react'; // IGNORE
export const DefaultFileUploaderExample = () => {
return (
<FileUploader
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,27 @@
import { FileUploader, View, Text } from '@aws-amplify/ui-react';

export const FileUploaderComponentsExample = () => {
return (
<FileUploader
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
// components={{
// UploadDropZone: ({ inDropZone, children, ...rest }) => {
// return (
// <View
// padding="xl"
// backgroundColor={
// inDropZone ? 'brand.secondary.40' : 'brand.secondary.20'
// }
// {...rest}
// >
// <Text textAlign="center">Drop files here</Text>
// </View>
// );
// },
// }}
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,23 @@
import * as React from 'react';
import { FileUploader } from '@aws-amplify/ui-react';

export const FileUploaderErrorExample = () => {
const [message, setMessage] = React.useState('');
const onError = (error) => {
setMessage(`${error}`);
};

return (
<>
<FileUploader
onError={onError}
isResumable={true}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="error" // IGNORE
/>
{message}
</>
);
};
@@ -0,0 +1,22 @@
import * as React from 'react';
import { FileUploader } from '@aws-amplify/ui-react';

export const FileUploaderSuccessExample = () => {
const [message, setMessage] = React.useState('');
const onSuccess = ({ key }) => {
setMessage(`Key: ${key}`);
};

return (
<>
<FileUploader
onSuccess={onSuccess}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
{message}
</>
);
};
@@ -0,0 +1,36 @@
import { FileUploader, ThemeProvider, View } from '@aws-amplify/ui-react';

const theme = {
name: 'my-theme',
tokens: {
colors: {},
borderWidths: {
small: { value: '2px' },
medium: { value: '4px' },
large: { value: '8px' },
},
radii: {
xs: { value: '1rem' },
small: { value: '2rem' },
medium: { value: '2rem' },
large: { value: '2rem' },
xl: { value: '3rem' },
},
},
};

export const FileUploaderThemeExample = () => {
return (
<ThemeProvider theme={theme}>
<FileUploader
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
hasMultipleFiles={true}
maxSize={100000000}
maxFiles={3}
provider="fast" // IGNORE
/>
</ThemeProvider>
);
};
@@ -0,0 +1,12 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const IsPreviewerVisibleExample = () => {
return (
<FileUploader
isPreviewerVisible={true}
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,12 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const LevelExample = () => {
return (
<FileUploader
variation="drop"
acceptedFileTypes={['image/*']}
level="private"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,13 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const MaxFilesExample = () => {
return (
<FileUploader
maxFiles={3}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,13 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const MaxSizeExample = () => {
return (
<FileUploader
maxSize={100000}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,13 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const MultipleExample = () => {
return (
<FileUploader
hasMultipleFiles={false}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,29 @@
import { FileUploader, View, Button, Text } from '@aws-amplify/ui-react';

export const PreviewerComponentsExample = () => {
return (
<FileUploader
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
// components={{
// Previewer: ({ onFileClick, fileStatuses }) => {
// return (
// <View padding="xl">
// {fileStatuses.map((file, idx) => {
// return (
// <View key={idx}>
// <Text>{file.name}</Text>
// <Text>{file.percentage}</Text>
// </View>
// );
// })}
// <Button onClick={onFileClick}>Start Upload</Button>
// </View>
// );
// },
// }}
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,13 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const ResumableExample = () => {
return (
<FileUploader
isResumable={true}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="slow" // IGNORE
/>
);
};
@@ -0,0 +1,13 @@
import { FileUploader } from '@aws-amplify/ui-react';

export const ShowImagesExample = () => {
return (
<FileUploader
showImages={false}
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
provider="fast" // IGNORE
/>
);
};
@@ -0,0 +1,22 @@
import { FileUploader, View, Text } from '@aws-amplify/ui-react';

export const TrackerComponentsExample = () => {
return (
<FileUploader
variation="drop"
acceptedFileTypes={['image/*']}
accessLevel="public"
// components={{
// Tracker: ({ file, percentage }) => {
// return (
// <View padding="xl">
// <Text textAlign="center">{file.name}</Text>
// <Text textAlign="center">{percentage}</Text>
// </View>
// );
// },
// }}
provider="fast" // IGNORE
/>
);
};