) {
const {
className,
empty = -,
getKey,
items,
max = 2,
moreLabel,
renderItem,
...domProps
} = props
if (items.length === 0) {
return empty
}
const displayed = items.slice(0, max)
const remaining = items.length - max
return (
{displayed.map((item, index) => (
{renderItem(item, index)}
))}
{remaining > 0 && (
)}
)
}
export const statusPresets = {
active: {
variant: 'success' as const,
label: 'Active',
},
inactive: {
variant: 'neutral' as const,
label: 'Inactive',
},
invited: {
variant: 'info' as const,
label: 'Invited',
},
suspended: {
variant: 'danger' as const,
label: 'Suspended',
},
pending: {
variant: 'warning' as const,
label: 'Pending',
pulse: true,
},
} as const
export type StatusPreset = keyof typeof statusPresets