-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/sync-version
- Loading branch information
Showing
54 changed files
with
953 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Fix experimental SelectPanel anchoring behavior |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
[SelectPanel] Implement loading states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Pagination: Optimize the page rendering algorithm and prevent layout shifts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+185 Bytes
(100%)
...ponents/Pagination.test.ts-snapshots/Pagehead-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+173 Bytes
(100%)
.../components/Pagination.test.ts-snapshots/Pagehead-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+176 Bytes
(100%)
...ents/Pagination.test.ts-snapshots/Pagehead-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
...apshots/components/Pagination.test.ts-snapshots/Pagehead-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
...ponents/Pagination.test.ts-snapshots/Pagehead-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...onents/Pagination.test.ts-snapshots/Pagehead-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+178 Bytes
(100%)
...nts/Pagination.test.ts-snapshots/Pagehead-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...pshots/components/Pagination.test.ts-snapshots/Pagehead-Default-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...onents/Pagination.test.ts-snapshots/Pagehead-Default-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
...nts/Pagination.test.ts-snapshots/Pagehead-Dev-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+173 Bytes
(100%)
...ponents/Pagination.test.ts-snapshots/Pagehead-Dev-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+176 Bytes
(100%)
.../Pagination.test.ts-snapshots/Pagehead-Dev-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
...ots/components/Pagination.test.ts-snapshots/Pagehead-Dev-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
...nts/Pagination.test.ts-snapshots/Pagehead-Dev-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...ts/Pagination.test.ts-snapshots/Pagehead-Dev-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+178 Bytes
(100%)
...Pagination.test.ts-snapshots/Pagehead-Dev-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...ts/components/Pagination.test.ts-snapshots/Pagehead-Dev-Default-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+184 Bytes
(100%)
...ts/Pagination.test.ts-snapshots/Pagehead-Dev-Default-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5 Bytes
(100%)
...tPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5 Bytes
(100%)
...h-Underflowing-Items-After-Fetch-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...Height-Initial-with-Underflowing-Items-After-Fetch-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...flowing-Items-After-Fetch-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...s/SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...ial-with-Underflowing-Items-After-Fetch-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file modified
BIN
+10 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+10 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file modified
BIN
-4 Bytes
(100%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-colorblind-linux.png
Oops, something went wrong.
Binary file modified
BIN
-9 Bytes
(100%)
...erflowing-Items-After-Fetch-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file modified
BIN
-7 Bytes
(100%)
...eight-Initial-with-Underflowing-Items-After-Fetch-light-high-contrast-linux.png
Oops, something went wrong.
Binary file modified
BIN
-6 Bytes
(100%)
...lowing-Items-After-Fetch-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file modified
BIN
-9 Bytes
(100%)
.../SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-light-linux.png
Oops, something went wrong.
Binary file modified
BIN
-9 Bytes
(100%)
...al-with-Underflowing-Items-After-Fetch-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file modified
BIN
-9 Bytes
(100%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
-9 Bytes
(100%)
...erflowing-Items-After-Fetch-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
packages/react/src/FilteredActionList/FilteredActionListLoaders.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react' | ||
import Box from '../Box' | ||
import Spinner from '../Spinner' | ||
import {Stack} from '../Stack/Stack' | ||
import {SkeletonBox} from '../experimental/Skeleton/SkeletonBox' | ||
|
||
export class FilteredActionListLoadingType { | ||
public name: string | ||
public appearsInBody: boolean | ||
|
||
constructor(name: string, appearsInBody: boolean) { | ||
this.name = name | ||
this.appearsInBody = appearsInBody | ||
} | ||
} | ||
|
||
export const FilteredActionListLoadingTypes = { | ||
bodySpinner: new FilteredActionListLoadingType('body-spinner', true), | ||
bodySkeleton: new FilteredActionListLoadingType('body-skeleton', true), | ||
input: new FilteredActionListLoadingType('input', false), | ||
} | ||
|
||
const SKELETON_ROW_HEIGHT = 24 | ||
const SKELETON_MIN_ROWS = 3 | ||
|
||
export function FilteredActionListBodyLoader({ | ||
loadingType, | ||
height, | ||
}: { | ||
loadingType: FilteredActionListLoadingType | ||
height: number | ||
}): JSX.Element { | ||
switch (loadingType) { | ||
case FilteredActionListLoadingTypes.bodySpinner: | ||
return <LoadingSpinner data-testid="filtered-action-list-spinner" /> | ||
case FilteredActionListLoadingTypes.bodySkeleton: { | ||
const rows = height < SKELETON_ROW_HEIGHT ? SKELETON_MIN_ROWS : height / SKELETON_ROW_HEIGHT | ||
return <LoadingSkeleton data-testid="filtered-action-list-skeleton" rows={rows} /> | ||
} | ||
default: | ||
return <></> | ||
} | ||
} | ||
|
||
function LoadingSpinner({...props}): JSX.Element { | ||
return ( | ||
<Box p={3} flexGrow={1} sx={{alignContent: 'center', textAlign: 'center', height: '100%'}}> | ||
<Spinner {...props} /> | ||
</Box> | ||
) | ||
} | ||
|
||
function LoadingSkeleton({rows = 10, ...props}: {rows: number}): JSX.Element { | ||
return ( | ||
<Box p={2} display="flex" flexGrow={1} flexDirection="column"> | ||
<Stack direction="vertical" justify="center" gap="condensed" {...props}> | ||
{Array.from({length: rows}, (_, i) => ( | ||
<Stack key={i} direction="horizontal" gap="condensed" align="center"> | ||
<SkeletonBox width="16px" height="16px" /> | ||
<SkeletonBox height="10px" width={`${Math.random() * 60 + 20}%`} sx={{borderRadius: '4px'}} /> | ||
</Stack> | ||
))} | ||
</Stack> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.