Skip to content

Commit bb5e8bb

Browse files
committed
Revert "chore: Vendor react-keyed-flatten-children dependency (#3997)"
This reverts commit aae4707.
1 parent cee57ab commit bb5e8bb

File tree

9 files changed

+26
-89
lines changed

9 files changed

+26
-89
lines changed

THIRD-PARTY-LICENSES

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -277,38 +277,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
277277
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
278278
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
279279
SOFTWARE.
280-
281-
---
282-
283-
Name: react-keyed-flatten-children
284-
Version: 3.2.0
285-
License: MIT
286-
Private: false
287-
Description: Flattens React children and fragments to an array with predictable and stable keys
288-
Repository: git+https://github.com/grrowl/react-keyed-flatten-children.git
289-
Homepage: https://github.com/grrowl/react-keyed-flatten-children
290-
Author: Tom McKenzie <[email protected]>
291-
License Copyright:
292-
===
293-
294-
MIT License
295-
296-
Copyright (c) 2019 Tom McKenzie
297-
298-
Permission is hereby granted, free of charge, to any person obtaining a copy
299-
of this software and associated documentation files (the "Software"), to deal
300-
in the Software without restriction, including without limitation the rights
301-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
302-
copies of the Software, and to permit persons to whom the Software is
303-
furnished to do so, subject to the following conditions:
304-
305-
The above copyright notice and this permission notice shall be included in all
306-
copies or substantial portions of the Software.
307-
308-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
309-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
310-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
311-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
312-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
313-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
314-
SOFTWARE.

package-lock.json

Lines changed: 16 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"date-fns": "^2.25.0",
4242
"intl-messageformat": "^10.3.1",
4343
"mnth": "^2.0.0",
44-
"react-is": ">=16.8.0",
44+
"react-keyed-flatten-children": "^2.2.1",
4545
"react-transition-group": "^4.4.2",
4646
"tslib": "^2.4.0",
4747
"weekstart": "^1.1.0"
@@ -75,7 +75,6 @@
7575
"@types/node": "^20.17.14",
7676
"@types/react": "^16.14.20",
7777
"@types/react-dom": "^16.9.14",
78-
"@types/react-is": "^19.2.0",
7978
"@types/react-router": "^5.1.18",
8079
"@types/react-router-dom": "^5.3.2",
8180
"@types/react-test-renderer": "^16.9.12",

pages/flashbar/runtime-content.page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import React, { isValidElement, ReactNode, useContext, useState } from 'react';
4+
import React, { ReactNode, useContext, useState } from 'react';
5+
import flattenChildren from 'react-keyed-flatten-children';
56

67
import {
78
Box,
@@ -15,7 +16,6 @@ import {
1516
SpaceBetween,
1617
} from '~components';
1718
import awsuiPlugins from '~components/internal/plugins';
18-
import flattenChildren from '~components/internal/vendor/react-keyed-flatten-children';
1919
import { mount, unmount } from '~mount';
2020

2121
import AppContext, { AppContextType } from '../app/app-context';
@@ -27,7 +27,7 @@ type PageContext = React.Context<
2727

2828
const nodeAsString = (node: ReactNode) =>
2929
flattenChildren(node)
30-
.map(node => (isValidElement(node) ? node.props.children : node))
30+
.map(node => (typeof node === 'object' ? node.props.children : node))
3131
.filter(node => typeof node === 'string')
3232
.join('');
3333

src/column-layout/flexible-column-layout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import React from 'react';
4+
import flattenChildren from 'react-keyed-flatten-children';
45
import clsx from 'clsx';
56

67
import { useContainerQuery } from '@cloudscape-design/component-toolkit';
78

8-
import flattenChildren from '../../internal/vendor/react-keyed-flatten-children';
99
import { InternalColumnLayoutProps } from '../interfaces';
1010

1111
import styles from './styles.css.js';

src/column-layout/grid-column-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import React from 'react';
4+
import flattenChildren from 'react-keyed-flatten-children';
45
import clsx from 'clsx';
56

67
import { GridProps } from '../grid/interfaces';
78
import InternalGrid from '../grid/internal';
89
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
9-
import flattenChildren from '../internal/vendor/react-keyed-flatten-children';
1010
import { InternalColumnLayoutProps } from './interfaces';
1111
import { COLUMN_TRIGGERS, ColumnLayoutBreakpoint } from './internal';
1212
import { repeat } from './util';

src/grid/internal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import React from 'react';
4+
import flattenChildren from 'react-keyed-flatten-children';
45
import clsx, { ClassValue } from 'clsx';
56

67
import { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';
@@ -10,7 +11,6 @@ import { Breakpoint, matchBreakpointMapping } from '../internal/breakpoints';
1011
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
1112
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
1213
import { isDevelopment } from '../internal/is-development';
13-
import flattenChildren from '../internal/vendor/react-keyed-flatten-children';
1414
import { GridProps } from './interfaces';
1515

1616
import styles from './styles.css.js';

src/internal/vendor/react-keyed-flatten-children/index.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/space-between/internal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import React, { forwardRef, isValidElement } from 'react';
3+
import React, { forwardRef } from 'react';
4+
import flattenChildren from 'react-keyed-flatten-children';
45
import clsx from 'clsx';
56

67
import { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';
78

89
import { getBaseProps } from '../internal/base-component';
910
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
1011
import WithNativeAttributes from '../internal/utils/with-native-attributes';
11-
import flattenChildren from '../internal/vendor/react-keyed-flatten-children';
1212
import { SpaceBetweenProps } from './interfaces';
1313

1414
import styles from './styles.css.js';
@@ -52,7 +52,7 @@ const InternalSpaceBetween = forwardRef(
5252
ref={mergedRef}
5353
>
5454
{flattenedChildren.map(child => {
55-
const key = isValidElement(child) ? child.key : undefined;
55+
const key = typeof child === 'object' ? child.key : undefined;
5656

5757
return (
5858
<div key={key} className={styles.child}>

0 commit comments

Comments
 (0)