Skip to content

Commit

Permalink
feat(storage-browser): add storage browser (#6175)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris F <[email protected]>
Co-authored-by: Jordan Van Ness <[email protected]>
Co-authored-by: Scott Rees <[email protected]>
Co-authored-by: Pranav Malewadkar <[email protected]>
Co-authored-by: ManojNB <[email protected]>
Co-authored-by: Jim Blanchard <[email protected]>
Co-authored-by: Hui Zhao <[email protected]>
Co-authored-by: Hui Zhao <[email protected]>
Co-authored-by: Ashwin Kumar <[email protected]>
Co-authored-by: Ashwin Kumar <[email protected]>
Co-authored-by: ashika112 <[email protected]>
Co-authored-by: Danny Banks <[email protected]>
Co-authored-by: dindjarinjs <[email protected]>
Co-authored-by: AllanZhengYP <[email protected]>
Co-authored-by: Joon Choi <[email protected]>
Co-authored-by: Dustin <[email protected]>
Co-authored-by: Chris Fang <[email protected]>
  • Loading branch information
18 people authored Nov 20, 2024
1 parent 526b0f3 commit 70971f3
Show file tree
Hide file tree
Showing 516 changed files with 31,072 additions and 678 deletions.
45 changes: 45 additions & 0 deletions .changeset/sto-bro-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
"@aws-amplify/ui-react-storage": minor
"@aws-amplify/ui-react": minor
"@aws-amplify/ui-react-core": minor
"@aws-amplify/ui": minor
---

feat(storage-browser): add `StorageBrowser` and `createStorageBrowser`

```tsx
import { Amplify } from 'aws-amplify';

import { StorageBrowser } from '@aws-amplify/ui-react-storage';
import '@aws-amplify/ui-react-storage/styles.css';

import config from './aws-exports';

Amplify.configure(config);

function App() {
return <StorageBrowser />
}
```

```tsx
import { Amplify } from 'aws-amplify';

import {
createAmplifyAuthAdapter,
createStorageBrowser,
} from '@aws-amplify/ui-react-storage/browser';
import '@aws-amplify/ui-react-storage/styles.css';

import config from './aws-exports';

Amplify.configure(config);

const { StorageBrowser } = createStorageBrowser({
config: createAmplifyAuthAdapter(),
});

function App() {
return <StorageBrowser />
}
```
24 changes: 12 additions & 12 deletions docs/__tests__/__snapshots__/props-table.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -2692,7 +2692,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -7317,7 +7317,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -7679,7 +7679,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -8326,7 +8326,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -9457,7 +9457,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -9791,7 +9791,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -10272,7 +10272,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -10711,7 +10711,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -11220,7 +11220,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -13353,7 +13353,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down Expand Up @@ -13722,7 +13722,7 @@ exports[`Props Table 1`] = `
},
"errorMessage": {
"name": "errorMessage",
"type": "string | undefined",
"type": "React.ReactNode",
"description": " When defined and \`hasError\` is true, show error message",
"category": "BaseFieldProps",
"isOptional": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const PasswordFieldPropControls: PasswordFieldPropControlsInterface = ({
name="errorMessage"
id="errorMessage"
placeholder="set errorMessage"
value={errorMessage}
value={errorMessage as string}
onChange={(event) => {
setErrorMessage(
event.target.value as PasswordFieldProps['errorMessage']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const SelectFieldPropControls: SelectFieldPropControlsInterface = ({
label="errorMessage"
name="errorMessage"
placeholder="Specify error message"
value={errorMessage}
value={errorMessage as string}
onChange={(event) =>
setErrorMessage(
event.target.value as SelectFieldProps['errorMessage']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const TextAreaFieldPropControls: TextAreaFieldControlsInterface = ({
<TextField
placeholder="Set error message"
name="errorMessage"
value={errorMessage}
value={errorMessage as string}
onChange={(event: any) => {
setErrorMessage(event.target.value);
}}
Expand Down
15 changes: 13 additions & 2 deletions docs/storageMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {
getProperties,
copy,
getUrl,
isCancelError,
type UploadDataInput,
type UploadDataOutput,
} from '@aws-amplify/storage';
import type { UploadDataInput, UploadDataOutput } from '@aws-amplify/storage';

type UploadData = (props: UploadDataInput) => UploadDataOutput;

Expand Down Expand Up @@ -66,4 +68,13 @@ const uploadData: UploadData = (props) => {
};
};

export { uploadData, downloadData, copy, remove, list, getUrl, getProperties };
export {
isCancelError,
uploadData,
downloadData,
copy,
remove,
list,
getUrl,
getProperties,
};
7 changes: 7 additions & 0 deletions examples/next/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
NEXT_PUBLIC_BACKEND_API_URL=
# Set this .env to the beta/gamma endpoints to test locally
NEXT_PUBLIC_STREAMING_API_URL=
NEXT_PUBLIC_BACKEND_API_REGION=
NEXT_PUBLIC_DEBUG=

# StorageBrowser Managed Auth
NEXT_PUBLIC_MANAGED_AUTH_ACCOUNT_ID=
NEXT_PUBLIC_MANAGED_AUTH_ENDPOINT=
NEXT_PUBLIC_MANAGED_AUTH_REGION=
2 changes: 1 addition & 1 deletion examples/next/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["next", "next/babel", "next/core-web-vitals"]
"extends": ["next", "next/core-web-vitals"]
}
2 changes: 1 addition & 1 deletion examples/next/next-env.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions examples/next/pages/_document.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class MyDocument extends Document {
</Head>
<body>
<title>React Example App</title>
<h1>React Example App</h1>

<Main />
<NextScript />
</body>
Expand Down
Loading

0 comments on commit 70971f3

Please sign in to comment.