UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

1 lines 1.35 kB
var t=this&&this.__assign||function(){return t=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},t.apply(this,arguments)},r=this&&this.__rest||function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]])}return e};import{jsx as e}from"react/jsx-runtime";import*as n from"react";import{componentWithForwardedRef as o,useDeterministicId as a,useForkedRefs as i}from"../../utils";import l from"../context";import{PanelRoot as s}from"../slots";var u=o((function(o,u){var c=o.children,f=o.id,p=o.className,d=r(o,["children","id","className"]),m=n.useContext(l),v=a(f,"styleless-ui__panel"),b=n.useRef(null),y=i(u,b);null==m||m.register(b);var h=Number(d["data-index"]);return!!m&&m.activeTab===h?e("div",t({},d,{id:v,ref:function(t){var r,e;if(y(t),t){var n=null===(e=null===(r=null==m?void 0:m.tabs[h])||void 0===r?void 0:r.current)||void 0===e?void 0:e.id;n&&t.setAttribute("aria-labelledby",n)}},className:p,role:"tabpanel","data-slot":s},{children:c})):null}));export default u;