-
- {tabs.map((t) => {
- if ('hidden' in t && t.hidden) {
- return null;
- }
-
- const isActive = t.value === value;
-
- const btnProps: Partial = {
- color: 'custom',
- justify: layout === 'horizontal' ? 'start' : 'center',
- onClick: isActive ? undefined : () => onChangeValue(t.value),
- className: classNames(
- 'flex items-center rounded whitespace-nowrap',
- '!px-2 ml-[1px]',
- 'outline-none',
- 'ring-none',
- 'focus-visible-or-class:outline-2',
- addBorders && 'border focus-visible:bg-surface-highlight',
- isActive ? 'text-text' : 'text-text-subtle',
- isActive && addBorders
- ? 'border-surface-active bg-surface-active'
- : layout === 'vertical'
- ? 'border-border-subtle'
- : 'border-transparent',
- layout === 'horizontal' && 'min-w-[10rem]',
- ),
- };
-
- if ('options' in t) {
- const option = t.options.items.find(
- (i) => 'value' in i && i.value === t.options?.value,
- );
- return (
-
-
- }
- {...btnProps}
- >
- {option && 'shortLabel' in option && option.shortLabel
- ? option.shortLabel
- : (option?.label ?? 'Unknown')}
-
-
- );
- }
- return (
-
- );
- })}
-