"use client"; /* * Documentation: * Tabs — https://app.subframe.com/f023064a5ca0/library?component=Tabs_e1ad5091-8ad8-4319-b1f7-3e47f0256c20 */ import React from "react"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; export interface ItemProps extends React.HTMLAttributes { active?: boolean; disabled?: boolean; pill?: boolean; icon?: React.ReactNode; children?: React.ReactNode; className?: string; } const Item = React.forwardRef(function Item( { active = false, disabled = false, pill = false, icon = null, children, className, onClick, onKeyDown, role, tabIndex, ...otherProps }: ItemProps, ref ) { const interactive = typeof onClick === "function"; return (
{ onKeyDown?.(event); if (!interactive || disabled || event.defaultPrevented) return; if (event.key === "Enter" || event.key === " ") { event.preventDefault(); event.currentTarget.click(); } }} {...otherProps} > {icon ? ( {icon} ) : null} {children ? ( {children} ) : null}
); }); export interface TabsRootProps extends React.HTMLAttributes { children?: React.ReactNode; className?: string; } const TabsRoot = React.forwardRef( function TabsRoot( { children, className, ...otherProps }: TabsRootProps, ref ) { return (
{children ? (
{children}
) : null}
); } ); export const Tabs = Object.assign(TabsRoot, { Item, });