From e602d31e687c71a1b738ce0567e540d42ee69b30 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Tue, 3 May 2022 15:42:07 -0500 Subject: [PATCH 1/6] add listview ssr test --- .../list/test/ListView.ssr.test.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/@react-spectrum/list/test/ListView.ssr.test.js diff --git a/packages/@react-spectrum/list/test/ListView.ssr.test.js b/packages/@react-spectrum/list/test/ListView.ssr.test.js new file mode 100644 index 00000000000..999913b95db --- /dev/null +++ b/packages/@react-spectrum/list/test/ListView.ssr.test.js @@ -0,0 +1,31 @@ +/* + * Copyright 2020 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +import {testSSR} from '@react-spectrum/test-utils'; + +describe('ListView SSR', function () { + it('should render without errors', async function () { + await testSSR(__filename, ` + import {Provider} from '@react-spectrum/provider'; + import {theme} from '@react-spectrum/theme-default'; + import {ListView, Item} from '../'; + + + + One + Two + Three + + + `); + }); +}); From 8e5373084fcef35d95beb6c373c5272870058c99 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Tue, 3 May 2022 15:42:28 -0500 Subject: [PATCH 2/6] remove export of useListLayout --- packages/@react-spectrum/list/src/ListView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/list/src/ListView.tsx b/packages/@react-spectrum/list/src/ListView.tsx index db654c7c365..29553fd0975 100644 --- a/packages/@react-spectrum/list/src/ListView.tsx +++ b/packages/@react-spectrum/list/src/ListView.tsx @@ -64,7 +64,7 @@ const ROW_HEIGHTS = { } }; -export function useListLayout(state: ListState, density: ListViewProps['density']) { +function useListLayout(state: ListState, density: ListViewProps['density']) { let {scale} = useProvider(); let collator = useCollator({usage: 'search', sensitivity: 'base'}); let isEmpty = state.collection.size === 0; From 915a1fde7073d187ce605e393981d935b0be5812 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Tue, 3 May 2022 15:42:56 -0500 Subject: [PATCH 3/6] update export to * --- packages/@react-spectrum/list/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/list/src/index.ts b/packages/@react-spectrum/list/src/index.ts index 8830827bbb8..34319f303ce 100644 --- a/packages/@react-spectrum/list/src/index.ts +++ b/packages/@react-spectrum/list/src/index.ts @@ -1,2 +1,2 @@ -export {ListView} from './ListView'; +export * from './ListView'; export {Item} from '@react-stately/collections'; From 002abca9817d9c680b3b4d5eccdf03249777e979 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Tue, 3 May 2022 15:59:05 -0500 Subject: [PATCH 4/6] add aria-label --- packages/@react-spectrum/list/test/ListView.ssr.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/list/test/ListView.ssr.test.js b/packages/@react-spectrum/list/test/ListView.ssr.test.js index 999913b95db..9f2e6566a8e 100644 --- a/packages/@react-spectrum/list/test/ListView.ssr.test.js +++ b/packages/@react-spectrum/list/test/ListView.ssr.test.js @@ -20,7 +20,7 @@ describe('ListView SSR', function () { import {ListView, Item} from '../'; - + One Two Three From 5a69245ae07468dd02e07176b4dbcb82efdc97ae Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Tue, 3 May 2022 16:36:40 -0500 Subject: [PATCH 5/6] use explicit export --- packages/@react-spectrum/list/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/list/src/index.ts b/packages/@react-spectrum/list/src/index.ts index 34319f303ce..8830827bbb8 100644 --- a/packages/@react-spectrum/list/src/index.ts +++ b/packages/@react-spectrum/list/src/index.ts @@ -1,2 +1,2 @@ -export * from './ListView'; +export {ListView} from './ListView'; export {Item} from '@react-stately/collections'; From e2dfcb6159290a5134ccb62c4b863c7ad195b5d6 Mon Sep 17 00:00:00 2001 From: Reid Barber Date: Wed, 4 May 2022 13:24:00 -0500 Subject: [PATCH 6/6] rename css file to fix ssr test on mac --- packages/@react-spectrum/list/src/DragPreview.tsx | 2 +- packages/@react-spectrum/list/src/ListView.tsx | 2 +- packages/@react-spectrum/list/src/ListViewItem.tsx | 2 +- packages/@react-spectrum/list/src/{listview.css => styles.css} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename packages/@react-spectrum/list/src/{listview.css => styles.css} (100%) diff --git a/packages/@react-spectrum/list/src/DragPreview.tsx b/packages/@react-spectrum/list/src/DragPreview.tsx index dae423ce942..be332bfdac5 100644 --- a/packages/@react-spectrum/list/src/DragPreview.tsx +++ b/packages/@react-spectrum/list/src/DragPreview.tsx @@ -13,7 +13,7 @@ import {classNames, SlotProvider} from '@react-spectrum/utils'; import {Content} from '@react-spectrum/view'; import {Grid} from '@react-spectrum/layout'; import {GridNode} from '@react-types/grid'; -import listStyles from './listview.css'; +import listStyles from './styles.css'; import {Provider} from '@react-spectrum/provider'; import {ProviderContext} from '@react-types/provider'; import React from 'react'; diff --git a/packages/@react-spectrum/list/src/ListView.tsx b/packages/@react-spectrum/list/src/ListView.tsx index 0460ec51781..6ae2253a1d3 100644 --- a/packages/@react-spectrum/list/src/ListView.tsx +++ b/packages/@react-spectrum/list/src/ListView.tsx @@ -31,7 +31,7 @@ import {GridKeyboardDelegate, useGrid} from '@react-aria/grid'; import intlMessages from '../intl/*.json'; import {ListLayout} from '@react-stately/layout'; import {ListState, useListState} from '@react-stately/list'; -import listStyles from './listview.css'; +import listStyles from './styles.css'; import {ListViewItem} from './ListViewItem'; import {ProgressCircle} from '@react-spectrum/progress'; import React, {ReactElement, useContext, useMemo, useRef} from 'react'; diff --git a/packages/@react-spectrum/list/src/ListViewItem.tsx b/packages/@react-spectrum/list/src/ListViewItem.tsx index 69284ab0c5e..5743a06e653 100644 --- a/packages/@react-spectrum/list/src/ListViewItem.tsx +++ b/packages/@react-spectrum/list/src/ListViewItem.tsx @@ -18,7 +18,7 @@ import type {DraggableItemResult} from '@react-aria/dnd'; import {FocusRing, useFocusRing} from '@react-aria/focus'; import {Grid} from '@react-spectrum/layout'; import ListGripper from '@spectrum-icons/ui/ListGripper'; -import listStyles from './listview.css'; +import listStyles from './styles.css'; import {ListViewContext} from './ListView'; import {mergeProps} from '@react-aria/utils'; import React, {useContext, useRef} from 'react'; diff --git a/packages/@react-spectrum/list/src/listview.css b/packages/@react-spectrum/list/src/styles.css similarity index 100% rename from packages/@react-spectrum/list/src/listview.css rename to packages/@react-spectrum/list/src/styles.css