Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-lizards-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Update FilteredActionList and FilteredActionListLoaders components to no longer support sx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
flex-grow: 1;
}

.ActionList {
flex-grow: 1;
}

.ActionListItem:focus {
background: var(--control-transparent-bgColor-selected);

Expand Down
19 changes: 4 additions & 15 deletions packages/react/src/FilteredActionList/FilteredActionList.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be removing below as well?

const StyledHeader = styled.div`
  box-shadow: 0 1px 0 ${get('colors.border.default')};
  z-index: 1;
`

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {useProvidedRefOrCreate} from '../hooks/useProvidedRefOrCreate'
import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate'
import useScrollFlash from '../hooks/useScrollFlash'
import {VisuallyHidden} from '../VisuallyHidden'
import type {SxProp} from '../sx'
import type {FilteredActionListLoadingType} from './FilteredActionListLoaders'
import {FilteredActionListLoadingTypes, FilteredActionListBodyLoader} from './FilteredActionListLoaders'
import classes from './FilteredActionList.module.css'
Expand All @@ -26,14 +25,10 @@ import {isValidElementType} from 'react-is'
import {useAnnouncements} from './useAnnouncements'
import {clsx} from 'clsx'
import {useFeatureFlag} from '../FeatureFlags'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

const menuScrollMargins: ScrollIntoViewOptions = {startMargin: 0, endMargin: 8}

export interface FilteredActionListProps
extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>,
ListPropsBase,
SxProp {
export interface FilteredActionListProps extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>, ListPropsBase {
loading?: boolean
loadingType?: FilteredActionListLoadingType
placeholderText?: string
Expand Down Expand Up @@ -70,7 +65,6 @@ export function FilteredActionList({
items,
textInputProps,
inputRef: providedInputRef,
sx,
groupMetadata,
showItemDividers,
message,
Expand Down Expand Up @@ -284,7 +278,7 @@ export function FilteredActionList({
{...listProps}
role="listbox"
id={listId}
sx={{flexGrow: 1}}
className={classes.ActionList}
>
{groupMetadata?.length
? groupMetadata.map((group, index) => {
Expand Down Expand Up @@ -349,12 +343,7 @@ export function FilteredActionList({
}

return (
<BoxWithFallback
ref={inputAndListContainerRef}
sx={sx}
className={clsx(className, classes.Root)}
data-testid="filtered-action-list"
>
<div ref={inputAndListContainerRef} className={clsx(className, classes.Root)} data-testid="filtered-action-list">
<StyledHeader>
<TextInput
ref={inputRef}
Expand Down Expand Up @@ -396,7 +385,7 @@ export function FilteredActionList({
<div ref={scrollContainerRef} className={classes.Container}>
{getBodyContent()}
</div>
</BoxWithFallback>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
/* stylelint-disable-next-line primer/borders */
border-radius: 4px;
}

.LoadingSpinner {
padding: var(--base-size-16);
flex-grow: 1;
align-content: center;
text-align: center;
height: 100%;
}

.LoadingSkeletonContainer {
padding: var(--base-size-8);
display: flex;
flex-grow: 1;
flex-direction: column;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Box from '../Box'
import Spinner from '../Spinner'
import {Stack} from '../Stack/Stack'
import {SkeletonBox} from '../Skeleton/SkeletonBox'
Expand Down Expand Up @@ -44,15 +43,15 @@ export function FilteredActionListBodyLoader({

function LoadingSpinner({...props}): JSX.Element {
return (
<Box p={3} flexGrow={1} sx={{alignContent: 'center', textAlign: 'center', height: '100%'}}>
<div className={classes.LoadingSpinner}>
<Spinner {...props} />
</Box>
</div>
)
}

function LoadingSkeleton({rows = 10, ...props}: {rows: number}): JSX.Element {
return (
<Box p={2} display="flex" flexGrow={1} flexDirection="column">
<div className={classes.LoadingSkeletonContainer}>
<Stack direction="vertical" justify="center" gap="condensed" {...props}>
{Array.from({length: rows}, (_, i) => (
<Stack key={i} direction="horizontal" gap="condensed" align="center">
Expand All @@ -61,6 +60,6 @@ function LoadingSkeleton({rows = 10, ...props}: {rows: number}): JSX.Element {
</Stack>
))}
</Stack>
</Box>
</div>
)
}
Loading