Skip to content

Commit c19278b

Browse files
calebpollmansreeramsamareesscotkwwendtzchenwei
authored
release: Next release/main (#4048)
Co-authored-by: Sreeram Sama <12038441+sreeramsama@users.noreply.github.com> Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com> Co-authored-by: kwwendt <78572512+kwwendt@users.noreply.github.com> Co-authored-by: Chenwei Zhang <40295569+zchenwei@users.noreply.github.com> Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>
1 parent 65a89fc commit c19278b

File tree

227 files changed

+8486
-23914
lines changed

Some content is hidden

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

227 files changed

+8486
-23914
lines changed

Diff for: .changeset/cyan-teachers-obey.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@aws-amplify/ui-react-storage': major
3+
---
4+
5+
What changed:
6+
7+
- Wrapped StorageManager with ForwardRef to allow for exposed imperative handles and potential future DOM manipulation.
8+
- This allows for clearing of the files list from a separate component where the Storage Manager component is being used.
9+
10+
Why was the change made:
11+
12+
- There was no easy way to clear the list of files without unmounting the component.
13+
- This capability is important when using Storage Manager inside a form. After submit, clear all entries including uploaded files.
14+
15+
How should a customer update their code:
16+
17+
- No changes are required by the customer since the added prop is optional in the Storage Manager component.
18+
- If customers want to take advantage of this change, they can create a files ref and include it in the Storage Manager component, then made calls to clearFiles from the ref.

Diff for: .changeset/dependabot-doggo.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@aws-amplify/ui-react": major
3+
"@aws-amplify/ui-react-liveness": patch
4+
"@aws-amplify/ui-react-notifications": patch
5+
---
6+
7+
**Breaking Changes**:
8+
9+
- `@aws-amplify/ui-react@5.x` removes the `to` prop on `Link` component and instead have it extended from the underlying rendered third-party `Link` if it contains a `to` prop ([PR](https://github.com/aws-amplify/amplify-ui/pull/4011)).
10+
11+
- `@aws-amplify/ui-react@5.x` strictly types the `View` component and updates all component types to include the underlying rendered HTML element's attributes ([PR](https://github.com/aws-amplify/amplify-ui/pull/4011)).

Diff for: .github/workflows/reusable-unit.yml

-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ jobs:
9191

9292
- name: Build react-core-notifications package
9393
if: |
94-
matrix.package == 'react' ||
9594
matrix.package == 'react-native' ||
96-
matrix.package == 'react-storage' ||
97-
matrix.package == 'react-liveness' ||
9895
matrix.package == 'react-notifications'
9996
run: yarn react-core-notifications build
10097

Diff for: docs/scripts/generate-props-tables-data.ts

+12
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,18 @@ function getPropertiesFromAllTypeData(sourceTypes: TypeFileName[]) {
198198
let targetProps: Properties;
199199

200200
sourceTypes.forEach((type) => {
201+
// as prop
202+
targetProps = {
203+
...targetProps,
204+
as: {
205+
name: 'as',
206+
type: 'React.ElementType',
207+
description: 'Changes the underlying rendered HTML element',
208+
category: 'BaseComponentProps',
209+
isOptional: true,
210+
},
211+
};
212+
201213
if (!allTypeFilesInterfaceData.get(type)) return;
202214
for (const [propName, property] of allTypeFilesInterfaceData
203215
.get(type)

Diff for: docs/scripts/util/getCatalog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function isPrimitive(node: Node): node is VariableDeclaration {
8585
return (
8686
Node.isVariableDeclaration(node) &&
8787
(typeName.startsWith('Primitive') ||
88-
typeName.startsWith('React.ForwardRef'))
88+
typeName.startsWith('ForwardRefPrimitive'))
8989
);
9090
}
9191

Diff for: docs/src/components/Layout/Footer.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ export const Footer = () => {
1717
gap="xs"
1818
>
1919
<Button
20-
as={Link}
20+
as="a"
2121
variation="link"
22-
// @ts-ignore // IGNORE
2322
href={GITHUB_REPO}
24-
isExternal
23+
rel="noopener noreferrer"
2524
gap="xs"
2625
>
2726
<GithubIcon ariaLabel="" />
2827
Contribute on GitHub
2928
</Button>
3029
<Button
31-
as={Link}
30+
as="a"
3231
variation="link"
33-
// @ts-ignore // IGNORE
3432
href={DISCORD}
35-
isExternal
33+
rel="noopener noreferrer"
3634
gap="xs"
3735
>
3836
<DiscordIcon ariaLabel="" />

Diff for: docs/src/components/Layout/Header.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ export const Header = ({
6868
<Button
6969
variation="link"
7070
size="small"
71-
as={Link}
72-
// @ts-ignore // IGNORE
71+
as="a"
7372
href={GITHUB_REPO}
74-
isExternal
73+
rel="noopener noreferrer"
7574
color="font.tertiary"
7675
fontSize="large"
7776
title="GitHub"

Diff for: docs/src/components/Theming/TokenBlocks.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type FontSizeBlockProps = {
6363
export function FontSizeBlock({ value }: FontSizeBlockProps) {
6464
return (
6565
<FontBlock>
66-
<View width="4rem" align="right" fontSize={value}>
66+
<View width="4rem" textAlign="right" fontSize={value}>
6767
Aa
6868
</View>
6969
</FontBlock>

Diff for: docs/src/pages/[platform]/components/table/examples/HighlightExample.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ export const HighlightExample = () => (
1010
<Table highlightOnHover={true}>
1111
<TableHead>
1212
<TableRow>
13-
<TableCell
14-
as="th"
15-
// @ts-ignore // IGNORE
16-
colspan="2"
17-
>
13+
<TableCell as="th" colSpan={2}>
1814
Not highlighted
1915
</TableCell>
2016
</TableRow>

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

+33-21
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,60 @@ import {
44
TextField,
55
SelectField,
66
SwitchField,
7-
TextAreaFieldProps,
7+
BaseTextAreaFieldProps,
88
} from '@aws-amplify/ui-react';
99

10-
export interface TextAreaFieldControlsProps extends TextAreaFieldProps {
10+
export interface TextAreaFieldControlsProps extends BaseTextAreaFieldProps {
1111
setAutoComplete: (
12-
value: React.SetStateAction<TextAreaFieldProps['autoComplete']>
12+
value: React.SetStateAction<BaseTextAreaFieldProps['autoComplete']>
1313
) => void;
1414
setDefaultValue: (
15-
value: React.SetStateAction<TextAreaFieldProps['defaultValue']>
15+
value: React.SetStateAction<BaseTextAreaFieldProps['defaultValue']>
1616
) => void;
1717
setDescriptiveText: (
18-
value: React.SetStateAction<TextAreaFieldProps['descriptiveText']>
18+
value: React.SetStateAction<BaseTextAreaFieldProps['descriptiveText']>
1919
) => void;
2020
setErrorMessage: (
21-
value: React.SetStateAction<TextAreaFieldProps['errorMessage']>
21+
value: React.SetStateAction<BaseTextAreaFieldProps['errorMessage']>
2222
) => void;
2323
setHasError: (
24-
value: React.SetStateAction<TextAreaFieldProps['hasError']>
24+
value: React.SetStateAction<BaseTextAreaFieldProps['hasError']>
2525
) => void;
2626
setIsDisabled: (
27-
value: React.SetStateAction<TextAreaFieldProps['isDisabled']>
27+
value: React.SetStateAction<BaseTextAreaFieldProps['isDisabled']>
2828
) => void;
2929
setIsReadOnly: (
30-
value: React.SetStateAction<TextAreaFieldProps['isReadOnly']>
30+
value: React.SetStateAction<BaseTextAreaFieldProps['isReadOnly']>
3131
) => void;
3232
setIsRequired: (
33-
value: React.SetStateAction<TextAreaFieldProps['isRequired']>
33+
value: React.SetStateAction<BaseTextAreaFieldProps['isRequired']>
34+
) => void;
35+
setLabel: (
36+
value: React.SetStateAction<BaseTextAreaFieldProps['label']>
3437
) => void;
35-
setLabel: (value: React.SetStateAction<TextAreaFieldProps['label']>) => void;
3638
setLabelHidden: (
37-
value: React.SetStateAction<TextAreaFieldProps['labelHidden']>
39+
value: React.SetStateAction<BaseTextAreaFieldProps['labelHidden']>
3840
) => void;
3941
setMaxLength: (
40-
value: React.SetStateAction<TextAreaFieldProps['maxLength']>
42+
value: React.SetStateAction<BaseTextAreaFieldProps['maxLength']>
43+
) => void;
44+
setName: (
45+
value: React.SetStateAction<BaseTextAreaFieldProps['name']>
4146
) => void;
42-
setName: (value: React.SetStateAction<TextAreaFieldProps['name']>) => void;
4347
setPlaceholder: (
44-
value: React.SetStateAction<TextAreaFieldProps['placeholder']>
48+
value: React.SetStateAction<BaseTextAreaFieldProps['placeholder']>
49+
) => void;
50+
setSize: (
51+
value: React.SetStateAction<BaseTextAreaFieldProps['size']>
52+
) => void;
53+
setRows: (
54+
value: React.SetStateAction<BaseTextAreaFieldProps['rows']>
55+
) => void;
56+
setValue: (
57+
value: React.SetStateAction<BaseTextAreaFieldProps['value']>
4558
) => void;
46-
setSize: (value: React.SetStateAction<TextAreaFieldProps['size']>) => void;
47-
setRows: (value: React.SetStateAction<TextAreaFieldProps['rows']>) => void;
48-
setValue: (value: React.SetStateAction<TextAreaFieldProps['value']>) => void;
4959
setVariation: (
50-
value: React.SetStateAction<TextAreaFieldProps['variation']>
60+
value: React.SetStateAction<BaseTextAreaFieldProps['variation']>
5161
) => void;
5262
}
5363

@@ -233,7 +243,7 @@ export const TextAreaFieldPropControls: TextAreaFieldControlsInterface = ({
233243
value={size}
234244
placeholder="default"
235245
onChange={(event) =>
236-
setSize(event.target.value as TextAreaFieldProps['size'])
246+
setSize(event.target.value as BaseTextAreaFieldProps['size'])
237247
}
238248
label="size"
239249
>
@@ -246,7 +256,9 @@ export const TextAreaFieldPropControls: TextAreaFieldControlsInterface = ({
246256
value={variation}
247257
placeholder="default"
248258
onChange={(event) =>
249-
setVariation(event.target.value as TextAreaFieldProps['variation'])
259+
setVariation(
260+
event.target.value as BaseTextAreaFieldProps['variation']
261+
)
250262
}
251263
label="variation"
252264
>

Diff for: docs/src/pages/[platform]/components/textareafield/demo.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
TextAreaField,
55
Flex,
66
FlexContainerStyleProps,
7-
TextAreaFieldProps,
7+
BaseTextAreaFieldProps,
88
} from '@aws-amplify/ui-react';
99

1010
import { Demo } from '@/components/Demo';
@@ -168,13 +168,13 @@ export const TextAreaFieldDemo = () => {
168168
<TextAreaField
169169
alignContent={alignContent as FlexContainerStyleProps['alignContent']}
170170
alignItems={alignItems as FlexContainerStyleProps['alignItems']}
171-
autoComplete={autoComplete as TextAreaFieldProps['autoComplete']}
171+
autoComplete={autoComplete as BaseTextAreaFieldProps['autoComplete']}
172172
descriptiveText={
173-
descriptiveText as TextAreaFieldProps['descriptiveText']
173+
descriptiveText as BaseTextAreaFieldProps['descriptiveText']
174174
}
175-
defaultValue={defaultValue as TextAreaFieldProps['defaultValue']}
175+
defaultValue={defaultValue as BaseTextAreaFieldProps['defaultValue']}
176176
direction={direction as FlexContainerStyleProps['direction']}
177-
errorMessage={errorMessage as TextAreaFieldProps['errorMessage']}
177+
errorMessage={errorMessage as BaseTextAreaFieldProps['errorMessage']}
178178
gap={gap as FlexContainerStyleProps['gap']}
179179
hasError={hasError as unknown as boolean}
180180
isDisabled={isDisabled as unknown as boolean}
@@ -183,15 +183,15 @@ export const TextAreaFieldDemo = () => {
183183
justifyContent={
184184
justifyContent as FlexContainerStyleProps['justifyContent']
185185
}
186-
label={label as TextAreaFieldProps['label']}
186+
label={label as BaseTextAreaFieldProps['label']}
187187
labelHidden={labelHidden as unknown as boolean}
188-
maxLength={maxLength as TextAreaFieldProps['maxLength']}
189-
name={name as TextAreaFieldProps['name']}
190-
placeholder={placeholder as TextAreaFieldProps['placeholder']}
191-
rows={rows as TextAreaFieldProps['rows']}
192-
size={size as TextAreaFieldProps['size']}
193-
value={value as TextAreaFieldProps['value']}
194-
variation={variation as TextAreaFieldProps['variation']}
188+
maxLength={maxLength as BaseTextAreaFieldProps['maxLength']}
189+
name={name as BaseTextAreaFieldProps['name']}
190+
placeholder={placeholder as BaseTextAreaFieldProps['placeholder']}
191+
rows={rows as BaseTextAreaFieldProps['rows']}
192+
size={size as BaseTextAreaFieldProps['size']}
193+
value={value as BaseTextAreaFieldProps['value']}
194+
variation={variation as BaseTextAreaFieldProps['variation']}
195195
wrap={wrap as FlexContainerStyleProps['wrap']}
196196
onChange={(e) => console.info(e.currentTarget.value)}
197197
onInput={(e) => console.info('input fired:', e.currentTarget.value)}

Diff for: docs/src/pages/[platform]/components/textareafield/useTextAreaFieldProps.tsx

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,76 @@
11
import * as React from 'react';
22

3-
import { TextAreaFieldProps } from '@aws-amplify/ui-react';
3+
import { BaseTextAreaFieldProps } from '@aws-amplify/ui-react';
44

5-
export const useTextAreaFieldProps = (initialValues: TextAreaFieldProps) => {
5+
export const useTextAreaFieldProps = (
6+
initialValues: BaseTextAreaFieldProps
7+
) => {
68
const [autoComplete, setAutoComplete] = React.useState<
7-
TextAreaFieldProps['autoComplete']
9+
BaseTextAreaFieldProps['autoComplete']
810
>(initialValues.autoComplete);
911

1012
const [defaultValue, setDefaultValue] = React.useState<
11-
TextAreaFieldProps['defaultValue']
13+
BaseTextAreaFieldProps['defaultValue']
1214
>(initialValues.defaultValue);
1315

1416
const [hasError, setHasError] = React.useState<
15-
TextAreaFieldProps['hasError']
17+
BaseTextAreaFieldProps['hasError']
1618
>(initialValues.hasError);
1719

18-
const [label, setLabel] = React.useState<TextAreaFieldProps['label']>(
20+
const [label, setLabel] = React.useState<BaseTextAreaFieldProps['label']>(
1921
initialValues.label
2022
);
2123

2224
const [descriptiveText, setDescriptiveText] = React.useState<
23-
TextAreaFieldProps['descriptiveText']
25+
BaseTextAreaFieldProps['descriptiveText']
2426
>(initialValues.descriptiveText);
2527

2628
const [errorMessage, setErrorMessage] = React.useState<
27-
TextAreaFieldProps['errorMessage']
29+
BaseTextAreaFieldProps['errorMessage']
2830
>(initialValues.errorMessage);
2931

3032
const [isDisabled, setIsDisabled] = React.useState<
31-
TextAreaFieldProps['isDisabled']
33+
BaseTextAreaFieldProps['isDisabled']
3234
>(initialValues.isDisabled);
3335

3436
const [isReadOnly, setIsReadOnly] = React.useState<
35-
TextAreaFieldProps['isReadOnly']
37+
BaseTextAreaFieldProps['isReadOnly']
3638
>(initialValues.isReadOnly);
3739

3840
const [isRequired, setIsRequired] = React.useState<
39-
TextAreaFieldProps['isRequired']
41+
BaseTextAreaFieldProps['isRequired']
4042
>(initialValues.isRequired);
4143

4244
const [labelHidden, setLabelHidden] = React.useState<
43-
TextAreaFieldProps['labelHidden']
45+
BaseTextAreaFieldProps['labelHidden']
4446
>(initialValues.labelHidden);
4547

4648
const [placeholder, setPlaceholder] = React.useState<
47-
TextAreaFieldProps['placeholder']
49+
BaseTextAreaFieldProps['placeholder']
4850
>(initialValues.placeholder);
4951

5052
const [maxLength, setMaxLength] = React.useState<
51-
TextAreaFieldProps['maxLength']
53+
BaseTextAreaFieldProps['maxLength']
5254
>(initialValues.maxLength);
5355

54-
const [name, setName] = React.useState<TextAreaFieldProps['name']>(
56+
const [name, setName] = React.useState<BaseTextAreaFieldProps['name']>(
5557
initialValues.name
5658
);
5759

58-
const [rows, setRows] = React.useState<TextAreaFieldProps['rows']>(
60+
const [rows, setRows] = React.useState<BaseTextAreaFieldProps['rows']>(
5961
initialValues.rows
6062
);
6163

62-
const [size, setSize] = React.useState<TextAreaFieldProps['size']>(
64+
const [size, setSize] = React.useState<BaseTextAreaFieldProps['size']>(
6365
initialValues.size
6466
);
6567

66-
const [value, setValue] = React.useState<TextAreaFieldProps['value']>(
68+
const [value, setValue] = React.useState<BaseTextAreaFieldProps['value']>(
6769
initialValues.value
6870
);
6971

7072
const [variation, setVariation] = React.useState<
71-
TextAreaFieldProps['variation']
73+
BaseTextAreaFieldProps['variation']
7274
>(initialValues.variation);
7375

7476
return {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as React from 'react';
2+
import { Button } from '@aws-amplify/ui-react';
3+
import { StorageManager } from '@aws-amplify/ui-react-storage';
4+
5+
export const StorageManagerHandleExample = () => {
6+
const ref = React.useRef(null);
7+
8+
return (
9+
<>
10+
<StorageManager
11+
acceptedFileTypes={['image/*']}
12+
accessLevel="public"
13+
maxFileCount={3}
14+
ref={ref}
15+
/>
16+
<Button onClick={() => ref.current.clearFiles()}>Clear Files</Button>
17+
</>
18+
);
19+
};

0 commit comments

Comments
 (0)