({
items,
ariaLabel = 'Items',
size = 'S',
currentUrl,
onAction,
renderEmptyState
}: ComponentCardGridProps)
| 24 | } |
| 25 | |
| 26 | export function ComponentCardView({ |
| 27 | items, |
| 28 | ariaLabel = 'Items', |
| 29 | size = 'S', |
| 30 | currentUrl, |
| 31 | onAction, |
| 32 | renderEmptyState |
| 33 | }: ComponentCardGridProps) { |
| 34 | return ( |
| 35 | <InternalCardViewContext.Provider value={{ElementType: ListBoxItem as any, layout: 'grid'}}> |
| 36 | <ImageCoordinator> |
| 37 | <ListBox |
| 38 | aria-label={ariaLabel} |
| 39 | layout="grid" |
| 40 | selectionMode="single" |
| 41 | selectionBehavior="replace" |
| 42 | // @ts-ignore |
| 43 | linkBehavior="override" |
| 44 | autoFocus={!!currentUrl} |
| 45 | selectedKeys={currentUrl ? [currentUrl] : []} |
| 46 | disallowEmptySelection |
| 47 | onAction={onAction} |
| 48 | className={style({ |
| 49 | display: { |
| 50 | default: 'grid', |
| 51 | isEmpty: 'flex' |
| 52 | }, |
| 53 | gridTemplateColumns: { |
| 54 | default: 'repeat(auto-fill, minmax(150px, 1fr))', |
| 55 | md: 'repeat(auto-fill, minmax(200px, 1fr))' |
| 56 | }, |
| 57 | gridAutoRows: 'max-content', |
| 58 | gap: 16, |
| 59 | padding: { |
| 60 | default: 12, |
| 61 | md: 16 |
| 62 | }, |
| 63 | scrollPadding: 8, |
| 64 | marginX: { |
| 65 | default: -12, |
| 66 | md: 0 |
| 67 | }, |
| 68 | alignItems: { |
| 69 | isEmpty: 'center' |
| 70 | }, |
| 71 | justifyContent: { |
| 72 | default: 'space-between', |
| 73 | isEmpty: 'center' |
| 74 | }, |
| 75 | overflow: 'auto', |
| 76 | flexGrow: 1, |
| 77 | position: 'relative' |
| 78 | })} |
| 79 | renderEmptyState={renderEmptyState} |
| 80 | items={items}> |
| 81 | {item => ( |
| 82 | <ComponentCard |
| 83 | id={item.id} |
nothing calls this directly
no outgoing calls
no test coverage detected