Skip to content

Commit 70971f3

Browse files
calebpollmancshfangjordanvnreesscotpranavosu
authored
feat(storage-browser): add storage browser (#6175)
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]>
1 parent 526b0f3 commit 70971f3

File tree

516 files changed

+31072
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

516 files changed

+31072
-678
lines changed

.changeset/sto-bro-release.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
"@aws-amplify/ui-react-storage": minor
3+
"@aws-amplify/ui-react": minor
4+
"@aws-amplify/ui-react-core": minor
5+
"@aws-amplify/ui": minor
6+
---
7+
8+
feat(storage-browser): add `StorageBrowser` and `createStorageBrowser`
9+
10+
```tsx
11+
import { Amplify } from 'aws-amplify';
12+
13+
import { StorageBrowser } from '@aws-amplify/ui-react-storage';
14+
import '@aws-amplify/ui-react-storage/styles.css';
15+
16+
import config from './aws-exports';
17+
18+
Amplify.configure(config);
19+
20+
function App() {
21+
return <StorageBrowser />
22+
}
23+
```
24+
25+
```tsx
26+
import { Amplify } from 'aws-amplify';
27+
28+
import {
29+
createAmplifyAuthAdapter,
30+
createStorageBrowser,
31+
} from '@aws-amplify/ui-react-storage/browser';
32+
import '@aws-amplify/ui-react-storage/styles.css';
33+
34+
import config from './aws-exports';
35+
36+
Amplify.configure(config);
37+
38+
const { StorageBrowser } = createStorageBrowser({
39+
config: createAmplifyAuthAdapter(),
40+
});
41+
42+
function App() {
43+
return <StorageBrowser />
44+
}
45+
```

docs/__tests__/__snapshots__/props-table.test.ts.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ exports[`Props Table 1`] = `
770770
},
771771
"errorMessage": {
772772
"name": "errorMessage",
773-
"type": "string | undefined",
773+
"type": "React.ReactNode",
774774
"description": " When defined and \`hasError\` is true, show error message",
775775
"category": "BaseFieldProps",
776776
"isOptional": true
@@ -2692,7 +2692,7 @@ exports[`Props Table 1`] = `
26922692
},
26932693
"errorMessage": {
26942694
"name": "errorMessage",
2695-
"type": "string | undefined",
2695+
"type": "React.ReactNode",
26962696
"description": " When defined and \`hasError\` is true, show error message",
26972697
"category": "BaseFieldProps",
26982698
"isOptional": true
@@ -7317,7 +7317,7 @@ exports[`Props Table 1`] = `
73177317
},
73187318
"errorMessage": {
73197319
"name": "errorMessage",
7320-
"type": "string | undefined",
7320+
"type": "React.ReactNode",
73217321
"description": " When defined and \`hasError\` is true, show error message",
73227322
"category": "BaseFieldProps",
73237323
"isOptional": true
@@ -7679,7 +7679,7 @@ exports[`Props Table 1`] = `
76797679
},
76807680
"errorMessage": {
76817681
"name": "errorMessage",
7682-
"type": "string | undefined",
7682+
"type": "React.ReactNode",
76837683
"description": " When defined and \`hasError\` is true, show error message",
76847684
"category": "BaseFieldProps",
76857685
"isOptional": true
@@ -8326,7 +8326,7 @@ exports[`Props Table 1`] = `
83268326
},
83278327
"errorMessage": {
83288328
"name": "errorMessage",
8329-
"type": "string | undefined",
8329+
"type": "React.ReactNode",
83308330
"description": " When defined and \`hasError\` is true, show error message",
83318331
"category": "BaseFieldProps",
83328332
"isOptional": true
@@ -9457,7 +9457,7 @@ exports[`Props Table 1`] = `
94579457
},
94589458
"errorMessage": {
94599459
"name": "errorMessage",
9460-
"type": "string | undefined",
9460+
"type": "React.ReactNode",
94619461
"description": " When defined and \`hasError\` is true, show error message",
94629462
"category": "BaseFieldProps",
94639463
"isOptional": true
@@ -9791,7 +9791,7 @@ exports[`Props Table 1`] = `
97919791
},
97929792
"errorMessage": {
97939793
"name": "errorMessage",
9794-
"type": "string | undefined",
9794+
"type": "React.ReactNode",
97959795
"description": " When defined and \`hasError\` is true, show error message",
97969796
"category": "BaseFieldProps",
97979797
"isOptional": true
@@ -10272,7 +10272,7 @@ exports[`Props Table 1`] = `
1027210272
},
1027310273
"errorMessage": {
1027410274
"name": "errorMessage",
10275-
"type": "string | undefined",
10275+
"type": "React.ReactNode",
1027610276
"description": " When defined and \`hasError\` is true, show error message",
1027710277
"category": "BaseFieldProps",
1027810278
"isOptional": true
@@ -10711,7 +10711,7 @@ exports[`Props Table 1`] = `
1071110711
},
1071210712
"errorMessage": {
1071310713
"name": "errorMessage",
10714-
"type": "string | undefined",
10714+
"type": "React.ReactNode",
1071510715
"description": " When defined and \`hasError\` is true, show error message",
1071610716
"category": "BaseFieldProps",
1071710717
"isOptional": true
@@ -11220,7 +11220,7 @@ exports[`Props Table 1`] = `
1122011220
},
1122111221
"errorMessage": {
1122211222
"name": "errorMessage",
11223-
"type": "string | undefined",
11223+
"type": "React.ReactNode",
1122411224
"description": " When defined and \`hasError\` is true, show error message",
1122511225
"category": "BaseFieldProps",
1122611226
"isOptional": true
@@ -13353,7 +13353,7 @@ exports[`Props Table 1`] = `
1335313353
},
1335413354
"errorMessage": {
1335513355
"name": "errorMessage",
13356-
"type": "string | undefined",
13356+
"type": "React.ReactNode",
1335713357
"description": " When defined and \`hasError\` is true, show error message",
1335813358
"category": "BaseFieldProps",
1335913359
"isOptional": true
@@ -13722,7 +13722,7 @@ exports[`Props Table 1`] = `
1372213722
},
1372313723
"errorMessage": {
1372413724
"name": "errorMessage",
13725-
"type": "string | undefined",
13725+
"type": "React.ReactNode",
1372613726
"description": " When defined and \`hasError\` is true, show error message",
1372713727
"category": "BaseFieldProps",
1372813728
"isOptional": true

docs/src/pages/[platform]/components/passwordfield/passwordFieldPropControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const PasswordFieldPropControls: PasswordFieldPropControlsInterface = ({
131131
name="errorMessage"
132132
id="errorMessage"
133133
placeholder="set errorMessage"
134-
value={errorMessage}
134+
value={errorMessage as string}
135135
onChange={(event) => {
136136
setErrorMessage(
137137
event.target.value as PasswordFieldProps['errorMessage']

docs/src/pages/[platform]/components/selectfield/SelectFieldPropControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const SelectFieldPropControls: SelectFieldPropControlsInterface = ({
116116
label="errorMessage"
117117
name="errorMessage"
118118
placeholder="Specify error message"
119-
value={errorMessage}
119+
value={errorMessage as string}
120120
onChange={(event) =>
121121
setErrorMessage(
122122
event.target.value as SelectFieldProps['errorMessage']

docs/src/pages/[platform]/components/textareafield/TextAreaFieldPropControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const TextAreaFieldPropControls: TextAreaFieldControlsInterface = ({
126126
<TextField
127127
placeholder="Set error message"
128128
name="errorMessage"
129-
value={errorMessage}
129+
value={errorMessage as string}
130130
onChange={(event: any) => {
131131
setErrorMessage(event.target.value);
132132
}}

docs/storageMock.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
getProperties,
66
copy,
77
getUrl,
8+
isCancelError,
9+
type UploadDataInput,
10+
type UploadDataOutput,
811
} from '@aws-amplify/storage';
9-
import type { UploadDataInput, UploadDataOutput } from '@aws-amplify/storage';
1012

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

@@ -66,4 +68,13 @@ const uploadData: UploadData = (props) => {
6668
};
6769
};
6870

69-
export { uploadData, downloadData, copy, remove, list, getUrl, getProperties };
71+
export {
72+
isCancelError,
73+
uploadData,
74+
downloadData,
75+
copy,
76+
remove,
77+
list,
78+
getUrl,
79+
getProperties,
80+
};

examples/next/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
NEXT_PUBLIC_BACKEND_API_URL=
12
# Set this .env to the beta/gamma endpoints to test locally
23
NEXT_PUBLIC_STREAMING_API_URL=
34
NEXT_PUBLIC_BACKEND_API_REGION=
5+
NEXT_PUBLIC_DEBUG=
6+
7+
# StorageBrowser Managed Auth
8+
NEXT_PUBLIC_MANAGED_AUTH_ACCOUNT_ID=
9+
NEXT_PUBLIC_MANAGED_AUTH_ENDPOINT=
10+
NEXT_PUBLIC_MANAGED_AUTH_REGION=

examples/next/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": ["next", "next/babel", "next/core-web-vitals"]
2+
"extends": ["next", "next/core-web-vitals"]
33
}

examples/next/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/next/pages/_document.page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class MyDocument extends Document {
2020
</Head>
2121
<body>
2222
<title>React Example App</title>
23-
<h1>React Example App</h1>
24-
2523
<Main />
2624
<NextScript />
2725
</body>

0 commit comments

Comments
 (0)