@xyd-js/ui 0.0.0-build-b24fb82-20250813100124 → 0.0.0-build-9db7527-20250813112407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,5 +4,5 @@ import e,{useRef as t,useEffect as r,use as n,createContext as i,useState as a,u
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */var zt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(e,t,r){return Boolean(e)&&r.indexOf(e)===t}).join(" ")},Wt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Xt=["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"],Qt=s(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,i=e.size,a=void 0===i?24:i,o=e.strokeWidth,s=void 0===o?2:o,l=e.absoluteStrokeWidth,u=e.className,d=void 0===u?"":u,f=e.children,h=e.iconNode,p=w(e,Xt);return c("svg",E(E({ref:t},Wt),{},{width:a,height:a,stroke:n,strokeWidth:l?24*Number(s)/Number(a):s,className:zt("lucide",d)},p),[].concat(T(h.map(function(e){var t=x(e,2),r=t[0],n=t[1];return c(r,n)})),T(Array.isArray(f)?f:[f])))}),Zt=["className"],Jt=function(e,t){var r=s(function(r,n){var i,a=r.className,o=w(r,Zt);return c(Qt,E({ref:n,iconNode:t,className:zt("lucide-".concat((i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())),a)},o))});return r.displayName="".concat(e),r},Yt=Jt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Kt=Jt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$t="a1cbq3a5",er=s(function(t,r){var n=t.href,i=void 0===n?"":n,a=t.children,o=t.newWindow,s=t.as,c=B(t,["href","children","newWindow","as"]),l=s||tr;return o?e.createElement(l,Object.assign({ref:r,href:i,target:"_blank",rel:"noreferrer",className:$t},c),a):e.createElement(l,Object.assign({ref:r,className:$t,href:i||void 0},c),a)});function tr(t){var r=t.children,n=B(t,["children"]);return e.createElement("a",Object.assign({},n),r)}function rr(r,n,i){var o=Gt().tabsRef,s=void 0!==r&&void 0!==n,c=M(a(i.length>0&&e.isValidElement(i[0])?i[0].props.value:""),2),l=c[0],u=c[1],d=s?r:l,f=t(d),h=M(a("forward"),2),p=h[0],m=h[1];return[p,d,function(t){var r=i.findIndex(function(t){return e.isValidElement(t)&&t.props.value===f.current}),a=i.findIndex(function(r){return e.isValidElement(r)&&r.props.value===t})>r?"forward":"backward";if(m(a),f.current=t,s||u(t),n&&n(t),console.log(o),null==o?void 0:o.current){var c={value:t,previousValue:f.current,direction:a},l=new CustomEvent("components.tabs.change",{detail:c,bubbles:!0});o.current.dispatchEvent(l)}}]}er.displayName="Anchor";var nr=i({direction:"forward"});function ir(t){var n=t.children,i=t.value,a=t.onChange,o=t.slide,s=void 0===o||o,c=t.className,l=Gt(),d=e.Children.toArray(n),f=d.filter(function(t){return e.isValidElement(t)&&(t.type===ir.Item||"function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),h=d.filter(function(t){return!e.isValidElement(t)||t.type!==ir.Item&&!("function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),p=M(rr(i,a,f),3),m=p[0],g=p[1],v=p[2];return r(function(){l.setValue(g)},[g]),e.createElement(nr.Provider,{value:{direction:m}},e.createElement(u.Root,{value:g,onValueChange:v},e.createElement("xyd-tabs",{ref:l.tabsRef,className:"".concat("tk0mvkq"," ").concat(c||"")},e.createElement("nav",{part:"nav"},e.createElement(u.List,{asChild:!0},e.createElement("ul",{part:"list"},f))),e.createElement("div",{part:"content","data-slide":s?"true":"false"},h))))}function ar(t){var r=B(t,[]);return e.createElement("a",Object.assign({},r),r.children)}function or(n){var i=n.children,o=n.value,s=n.onChange,c=n.className,l=Gt(),d=M(a(!1),2),f=d[0],h=d[1],p=M(a(!1),2),m=p[0],g=p[1],v=t(null),b=e.Children.toArray(i),y=b.filter(function(t){return e.isValidElement(t)&&(t.type===or.Item||"function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),E=b.filter(function(t){return!e.isValidElement(t)||t.type!==or.Item&&!("function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),w=M(rr(o,s,y),3);w[0];var x=w[1],T=w[2];r(function(){l.setValue(x)},[x]);var S=function(){if(v.current){var e=v.current,t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;h(t>0),g(t<r-n)}};r(function(){return S(),window.addEventListener("resize",S),function(){return window.removeEventListener("resize",S)}},[]);var k=function(e){if(v.current){var t="left"===e?-200:200;v.current.scrollBy({left:t,behavior:"smooth"})}};return e.createElement(u.Root,{asChild:!0,value:x,onValueChange:T},e.createElement("xyd-tabs",{ref:l.tabsRef,"data-kind":"secondary",className:"".concat("t1gurlv3"," ").concat(c||"")},e.createElement("div",{part:"buttons"},f&&e.createElement("button",{onClick:function(){return k("left")},part:"arrow"},e.createElement(Yt,{part:"arrow-icon"})),e.createElement("div",{ref:v,onScroll:S,part:"scroller"},e.createElement("div",{part:"scroller-container"},e.createElement(u.List,null,y))),m&&e.createElement("button",{onClick:function(){return k("right")},part:"arrow"},e.createElement(Kt,{part:"arrow-icon"}))),e.createElement("div",{part:"content"},E)))}function sr(t){var r=B(t,[]);return e.createElement("a",Object.assign({},r),r.children)}ir.Item=function(t){var n=t.children,i=t.value,o=t.href,s=t.as,c=t.defaultActive,l=s||ar,d="boolean"==typeof c,f=M(a(d?c?"active":"inactive":void 0),2),h=f[0],p=f[1],m=d&&null!=h?{"data-state":h}:void 0;return r(function(){d&&p(void 0)},[]),e.createElement(u.Trigger,Object.assign({value:i,asChild:!0},m),e.createElement("li",{part:"item"},e.createElement(l,{part:"link",href:o},n)))},ir.Content=function(t){var n=t.children,i=t.value,s=t.defaultActive,c=o(nr).direction,l="boolean"==typeof s,d=M(a(l?s?"active":"inactive":void 0),2),f=d[0],h=d[1],p=l&&null!=f?{"data-state":f}:void 0;return r(function(){l&&h(void 0)},[]),e.createElement(u.Content,Object.assign({value:i,forceMount:!0,asChild:!0},p),e.createElement("div",{className:"t1o9m54","data-direction":c},e.createElement("div",{part:"child"},n)))},or.Item=function(t){var n=t.children,i=t.value,o=t.href,s=t.as,c=t.defaultActive,l=s||sr,d="boolean"==typeof c,f=M(a(d?c?"active":"inactive":void 0),2),h=f[0],p=f[1],m=d&&null!=h?{"data-state":h}:void 0;return r(function(){d&&p(void 0)},[]),e.createElement(u.Trigger,Object.assign({className:"tulm1r6",value:i,asChild:!0},m),e.createElement("div",null,e.createElement(l,{href:o},n)))},or.Content=function(t){var r=t.children,n=t.value;return e.createElement(u.Content,{asChild:!0,value:n},e.createElement("div",null,r))};var cr=i({kind:null});function lr(t){var r;return r="secondary"===t.kind?e.createElement(cr.Provider,{value:{kind:"secondary"}},e.createElement(or,Object.assign({},t))):e.createElement(cr.Provider,{value:{kind:null}},e.createElement(ir,Object.assign({},t))),e.createElement(Ft,null,r)}lr.Item=function(t){return"secondary"===o(cr).kind?e.createElement(or.Item,Object.assign({},t)):e.createElement(ir.Item,Object.assign({},t))},lr.Item.displayName="Tabs.Item",lr.Content=function(t){return"secondary"===o(cr).kind?e.createElement(or.Content,Object.assign({},t)):e.createElement(ir.Content,Object.assign({},t))},lr.Content.displayName="Tabs.Content";function ur(t){var r=t.options,n=t.value,i=r.find(function(e){return e.value===n})||r[0],o=x(a(!1),2),s=o[0],c=o[1];return e.createElement("xyd-sidebar-tabs-dropdown",{className:"d1vhwytf"},e.createElement(d.Root,{open:s,onOpenChange:c},e.createElement(d.Trigger,{asChild:!0,onClick:function(){return c(!0)}},e.createElement("button",{part:"dropdown-trigger",type:"button"},e.createElement(dr,{icon:null==i?void 0:i.icon}),e.createElement("span",{part:"dropdown-label-group"},(null==i?void 0:i.label)&&e.createElement("span",{part:"dropdown-label"},null==i?void 0:i.label),(null==i?void 0:i.description)&&e.createElement("span",{part:"dropdown-description"},null==i?void 0:i.description)),e.createElement("span",{part:"dropdown-chevron"},e.createElement(fr,null)))),e.createElement(d.Content,{part:"dropdown-list",align:"start",sideOffset:2},r.map(function(t){return e.createElement(h,{key:t.value,part:"dropdown-listitem","aria-selected":t.value===n,to:t.value,onClick:function(){return c(!1)}},e.createElement(dr,{icon:t.icon}),e.createElement("span",{part:"dropdown-label-group"},e.createElement("span",{part:"dropdown-label"},t.label),t.description&&e.createElement("span",{part:"dropdown-description"},t.description)),e.createElement("span",{part:"chevron-check"},t.value===n&&e.createElement(hr,null)))}))))}function dr(t){var r=t.icon;return r?"string"==typeof r?e.createElement("span",{part:"dropdown-icon"},e.createElement(Vt,{name:r,size:18})):e.createElement("span",{part:"dropdown-icon"},r):null}function fr(){return e.createElement("svg",{width:8,height:24,viewBox:"0 -9 3 24"},e.createElement("path",{d:"M0 0L3 3L0 6",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}))}function hr(){return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M20 6 9 17l-5-5"}))}function pr(t){var r=t.children,n=t.title,i=t.value,a=t.onChange,o=t.className;return e.createElement(u.Root,{asChild:!0,value:i,onValueChange:a},e.createElement("xyd-subnav",{className:"".concat("s4ah3ok"," ").concat(o||"")},n&&e.createElement("div",{part:"prefix"},n),e.createElement(u.List,{asChild:!0},e.createElement("ul",{part:"list"},r))))}function mr(t){var r=t.children,n=A(t,["children"]);return e.createElement("a",Object.assign({},n),r)}pr.Item=function(t){var r=t.children,n=t.value,i=t.href,a=t.as||mr;return e.createElement(u.Trigger,{asChild:!0,value:n},e.createElement("xyd-subnav-item",{className:"s1ncaln9"},e.createElement(a,{part:"link",href:i},r)))};var gr=i({value:"",onChange:function(){},registerActiveItem:function(){},unregisterActiveItem:function(){},ancestors:[]});function vr(n){var i=n.children,o=n.defaultValue,s=n.className,c=n.maxDepth,u=void 0===c?2:c,d=x(a(0),2),f=d[0],h=d[1],p=x(a(0),2),m=p[0],g=p[1],v=x(a(o||""),2),b=v[0],y=v[1],E=x(a([]),2),w=E[0],T=E[1],S=t(new Map),A=t([]),C=t(!1),N=l(function(e,t){S.current.set(t,e)},[]),q=l(function(e){S.current.delete(e)},[]),O=l(function(e){y(e),C.current=!0},[]);function D(){var e=Array.from({length:u},function(e,t){return"h".concat(t+2)}).join(",");A.current=Array.from(document.querySelectorAll(e)).map(function(e){return{id:e.id,depth:Number(e.tagName.charAt(1))}})}return r(function(){return D(),!o&&A.current.length&&y(A.current[0].id),window.addEventListener("resize",D),function(){return window.removeEventListener("resize",D)}},[o,u]),r(function(){var e=window;function t(){var t,r;if(C.current)C.current=!1;else{var n,i=e instanceof Window?window.pageYOffset:e.scrollTop,a=e instanceof Window?window.innerHeight:e.clientHeight,o=.2*a,s=(null===(t=A.current[0])||void 0===t?void 0:t.id)||"",c=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=k(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(A.current);try{for(c.s();!(n=c.n()).done;){var l=n.value.id,u=document.getElementById(l);if(u){if(!(u.getBoundingClientRect().top<=o))break;s=l}}}catch(e){c.e(e)}finally{c.f()}var d=e instanceof Window?document.documentElement.scrollHeight:e.scrollHeight;d>a&&i+a>=d-1&&(s=(null===(r=A.current[A.current.length-1])||void 0===r?void 0:r.id)||s),s!==b&&y(s)}}return e.addEventListener("scroll",t),t(),function(){return e.removeEventListener("scroll",t)}},[b]),r(function(){var e;(null==(e=S.current.get(b))?void 0:e.current)&&(h(e.current.offsetHeight),g(e.current.offsetTop))},[b]),r(function(){var e=A.current,t=e.findIndex(function(e){return e.id===b});if(-1!==t){for(var r=[],n=e[t].depth,i=t-1;i>=0&&n>2;i--){var a=e[i],o=a.id,s=a.depth;s<n&&(r.unshift(o),n=s)}T(r)}else T([])},[b]),e.createElement(gr.Provider,{value:{value:b,onChange:O,registerActiveItem:N,unregisterActiveItem:q,ancestors:w}},e.createElement("xyd-toc",{className:"".concat("t19g75q2"," ").concat(s||"")},e.createElement("div",{part:"scroller"},e.createElement("div",{part:"scroll",style:{"--xyd-toc-active-track-height":"".concat(f,"px"),"--xyd-toc-active-track-top":"".concat(m,"px")}})),e.createElement("ul",{part:"list"},i)))}vr.Item=function(n){var i=n.children,a=n.id,s=n.className,c=n.depth,l=o(gr),u=l.value,d=l.ancestors,f=l.onChange,p=l.registerActiveItem,m=l.unregisterActiveItem,g=t(null),v=u===a||d.includes(a);return r(function(){return v&&g.current&&p(g,a),function(){return m(a)}},[v,a,p,m]),e.createElement("xyd-toc-item",null,e.createElement("li",{ref:g,className:"".concat("teg7kxf"," ").concat(s||""),"data-active":String(v),"data-depth":c},e.createElement(h,{part:"link",to:"",onClick:function(e){var t;e.preventDefault(),f(a);var r=new URL(window.location.href);r.hash=a,history.replaceState(null,"",r.toString()),null===(t=document.getElementById(a))||void 0===t||t.scrollIntoView()}},i)))};export{C as Nav,q as ProgressBar,ur as SidebarTabsDropdown,pr as SubNav,vr as Toc,D as UISidebar};
7
+ */var zt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(e,t,r){return Boolean(e)&&r.indexOf(e)===t}).join(" ")},Wt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Xt=["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"],Qt=s(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,i=e.size,a=void 0===i?24:i,o=e.strokeWidth,s=void 0===o?2:o,l=e.absoluteStrokeWidth,u=e.className,d=void 0===u?"":u,f=e.children,h=e.iconNode,p=w(e,Xt);return c("svg",E(E({ref:t},Wt),{},{width:a,height:a,stroke:n,strokeWidth:l?24*Number(s)/Number(a):s,className:zt("lucide",d)},p),[].concat(T(h.map(function(e){var t=x(e,2),r=t[0],n=t[1];return c(r,n)})),T(Array.isArray(f)?f:[f])))}),Zt=["className"],Jt=function(e,t){var r=s(function(r,n){var i,a=r.className,o=w(r,Zt);return c(Qt,E({ref:n,iconNode:t,className:zt("lucide-".concat((i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())),a)},o))});return r.displayName="".concat(e),r},Yt=Jt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Kt=Jt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$t="a1cbq3a5",er=s(function(t,r){var n=t.href,i=void 0===n?"":n,a=t.children,o=t.newWindow,s=t.as,c=B(t,["href","children","newWindow","as"]),l=s||tr;return o?e.createElement(l,Object.assign({ref:r,href:i,target:"_blank",rel:"noreferrer",className:$t},c),a):e.createElement(l,Object.assign({ref:r,className:$t,href:i||void 0},c),a)});function tr(t){var r=t.children,n=B(t,["children"]);return e.createElement("a",Object.assign({},n),r)}function rr(r,n,i){var o=Gt().tabsRef,s=void 0!==r&&void 0!==n,c=M(a(i.length>0&&e.isValidElement(i[0])?i[0].props.value:""),2),l=c[0],u=c[1],d=s?r:l,f=t(d),h=M(a("forward"),2),p=h[0],m=h[1];return[p,d,function(t){var r=i.findIndex(function(t){return e.isValidElement(t)&&t.props.value===f.current}),a=i.findIndex(function(r){return e.isValidElement(r)&&r.props.value===t})>r?"forward":"backward";if(m(a),f.current=t,s||u(t),n&&n(t),null==o?void 0:o.current){var c={value:t,previousValue:f.current,direction:a},l=new CustomEvent("components.tabs.change",{detail:c,bubbles:!0});o.current.dispatchEvent(l)}}]}er.displayName="Anchor";var nr=i({direction:"forward"});function ir(t){var n=t.children,i=t.value,a=t.onChange,o=t.slide,s=void 0===o||o,c=t.className,l=Gt(),d=e.Children.toArray(n),f=d.filter(function(t){return e.isValidElement(t)&&(t.type===ir.Item||"function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),h=d.filter(function(t){return!e.isValidElement(t)||t.type!==ir.Item&&!("function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),p=M(rr(i,a,f),3),m=p[0],g=p[1],v=p[2];return r(function(){l.setValue(g)},[g]),e.createElement(nr.Provider,{value:{direction:m}},e.createElement(u.Root,{value:g,onValueChange:v},e.createElement("xyd-tabs",{ref:l.tabsRef,className:"".concat("tk0mvkq"," ").concat(c||"")},e.createElement("nav",{part:"nav"},e.createElement(u.List,{asChild:!0},e.createElement("ul",{part:"list"},f))),e.createElement("div",{part:"content","data-slide":s?"true":"false"},h))))}function ar(t){var r=B(t,[]);return e.createElement("a",Object.assign({},r),r.children)}function or(n){var i=n.children,o=n.value,s=n.onChange,c=n.className,l=Gt(),d=M(a(!1),2),f=d[0],h=d[1],p=M(a(!1),2),m=p[0],g=p[1],v=t(null),b=e.Children.toArray(i),y=b.filter(function(t){return e.isValidElement(t)&&(t.type===or.Item||"function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),E=b.filter(function(t){return!e.isValidElement(t)||t.type!==or.Item&&!("function"==typeof t.type&&"displayName"in t.type&&"Tabs.Item"===t.type.displayName)}),w=M(rr(o,s,y),3);w[0];var x=w[1],T=w[2];r(function(){l.setValue(x)},[x]);var S=function(){if(v.current){var e=v.current,t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;h(t>0),g(t<r-n)}};r(function(){return S(),window.addEventListener("resize",S),function(){return window.removeEventListener("resize",S)}},[]);var k=function(e){if(v.current){var t="left"===e?-200:200;v.current.scrollBy({left:t,behavior:"smooth"})}};return e.createElement(u.Root,{asChild:!0,value:x,onValueChange:T},e.createElement("xyd-tabs",{ref:l.tabsRef,"data-kind":"secondary",className:"".concat("t1gurlv3"," ").concat(c||"")},e.createElement("div",{part:"buttons"},f&&e.createElement("button",{onClick:function(){return k("left")},part:"arrow"},e.createElement(Yt,{part:"arrow-icon"})),e.createElement("div",{ref:v,onScroll:S,part:"scroller"},e.createElement("div",{part:"scroller-container"},e.createElement(u.List,null,y))),m&&e.createElement("button",{onClick:function(){return k("right")},part:"arrow"},e.createElement(Kt,{part:"arrow-icon"}))),e.createElement("div",{part:"content"},E)))}function sr(t){var r=B(t,[]);return e.createElement("a",Object.assign({},r),r.children)}ir.Item=function(t){var n=t.children,i=t.value,o=t.href,s=t.as,c=t.defaultActive,l=s||ar,d="boolean"==typeof c,f=M(a(d?c?"active":"inactive":void 0),2),h=f[0],p=f[1],m=d&&null!=h?{"data-state":h}:void 0;return r(function(){d&&p(void 0)},[]),e.createElement(u.Trigger,Object.assign({value:i,asChild:!0},m),e.createElement("li",{part:"item"},e.createElement(l,{part:"link",href:o},n)))},ir.Content=function(t){var n=t.children,i=t.value,s=t.defaultActive,c=o(nr).direction,l="boolean"==typeof s,d=M(a(l?s?"active":"inactive":void 0),2),f=d[0],h=d[1],p=l&&null!=f?{"data-state":f}:void 0;return r(function(){l&&h(void 0)},[]),e.createElement(u.Content,Object.assign({value:i,forceMount:!0,asChild:!0},p),e.createElement("div",{className:"t1o9m54","data-direction":c},e.createElement("div",{part:"child"},n)))},or.Item=function(t){var n=t.children,i=t.value,o=t.href,s=t.as,c=t.defaultActive,l=s||sr,d="boolean"==typeof c,f=M(a(d?c?"active":"inactive":void 0),2),h=f[0],p=f[1],m=d&&null!=h?{"data-state":h}:void 0;return r(function(){d&&p(void 0)},[]),e.createElement(u.Trigger,Object.assign({className:"tulm1r6",value:i,asChild:!0},m),e.createElement("div",null,e.createElement(l,{href:o},n)))},or.Content=function(t){var r=t.children,n=t.value;return e.createElement(u.Content,{asChild:!0,value:n},e.createElement("div",null,r))};var cr=i({kind:null});function lr(t){var r;return r="secondary"===t.kind?e.createElement(cr.Provider,{value:{kind:"secondary"}},e.createElement(or,Object.assign({},t))):e.createElement(cr.Provider,{value:{kind:null}},e.createElement(ir,Object.assign({},t))),e.createElement(Ft,null,r)}lr.Item=function(t){return"secondary"===o(cr).kind?e.createElement(or.Item,Object.assign({},t)):e.createElement(ir.Item,Object.assign({},t))},lr.Item.displayName="Tabs.Item",lr.Content=function(t){return"secondary"===o(cr).kind?e.createElement(or.Content,Object.assign({},t)):e.createElement(ir.Content,Object.assign({},t))},lr.Content.displayName="Tabs.Content";function ur(t){var r=t.options,n=t.value,i=r.find(function(e){return e.value===n})||r[0],o=x(a(!1),2),s=o[0],c=o[1];return e.createElement("xyd-sidebar-tabs-dropdown",{className:"d1vhwytf"},e.createElement(d.Root,{open:s,onOpenChange:c},e.createElement(d.Trigger,{asChild:!0,onClick:function(){return c(!0)}},e.createElement("button",{part:"dropdown-trigger",type:"button"},e.createElement(dr,{icon:null==i?void 0:i.icon}),e.createElement("span",{part:"dropdown-label-group"},(null==i?void 0:i.label)&&e.createElement("span",{part:"dropdown-label"},null==i?void 0:i.label),(null==i?void 0:i.description)&&e.createElement("span",{part:"dropdown-description"},null==i?void 0:i.description)),e.createElement("span",{part:"dropdown-chevron"},e.createElement(fr,null)))),e.createElement(d.Content,{part:"dropdown-list",align:"start",sideOffset:2},r.map(function(t){return e.createElement(h,{key:t.value,part:"dropdown-listitem","aria-selected":t.value===n,to:t.value,onClick:function(){return c(!1)}},e.createElement(dr,{icon:t.icon}),e.createElement("span",{part:"dropdown-label-group"},e.createElement("span",{part:"dropdown-label"},t.label),t.description&&e.createElement("span",{part:"dropdown-description"},t.description)),e.createElement("span",{part:"chevron-check"},t.value===n&&e.createElement(hr,null)))}))))}function dr(t){var r=t.icon;return r?"string"==typeof r?e.createElement("span",{part:"dropdown-icon"},e.createElement(Vt,{name:r,size:18})):e.createElement("span",{part:"dropdown-icon"},r):null}function fr(){return e.createElement("svg",{width:8,height:24,viewBox:"0 -9 3 24"},e.createElement("path",{d:"M0 0L3 3L0 6",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}))}function hr(){return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M20 6 9 17l-5-5"}))}function pr(t){var r=t.children,n=t.title,i=t.value,a=t.onChange,o=t.className;return e.createElement(u.Root,{asChild:!0,value:i,onValueChange:a},e.createElement("xyd-subnav",{className:"".concat("s4ah3ok"," ").concat(o||"")},n&&e.createElement("div",{part:"prefix"},n),e.createElement(u.List,{asChild:!0},e.createElement("ul",{part:"list"},r))))}function mr(t){var r=t.children,n=A(t,["children"]);return e.createElement("a",Object.assign({},n),r)}pr.Item=function(t){var r=t.children,n=t.value,i=t.href,a=t.as||mr;return e.createElement(u.Trigger,{asChild:!0,value:n},e.createElement("xyd-subnav-item",{className:"s1ncaln9"},e.createElement(a,{part:"link",href:i},r)))};var gr=i({value:"",onChange:function(){},registerActiveItem:function(){},unregisterActiveItem:function(){},ancestors:[]});function vr(n){var i=n.children,o=n.defaultValue,s=n.className,c=n.maxDepth,u=void 0===c?2:c,d=x(a(0),2),f=d[0],h=d[1],p=x(a(0),2),m=p[0],g=p[1],v=x(a(o||""),2),b=v[0],y=v[1],E=x(a([]),2),w=E[0],T=E[1],S=t(new Map),A=t([]),C=t(!1),N=l(function(e,t){S.current.set(t,e)},[]),q=l(function(e){S.current.delete(e)},[]),O=l(function(e){y(e),C.current=!0},[]);function D(){var e=Array.from({length:u},function(e,t){return"h".concat(t+2)}).join(",");A.current=Array.from(document.querySelectorAll(e)).map(function(e){return{id:e.id,depth:Number(e.tagName.charAt(1))}})}return r(function(){return D(),!o&&A.current.length&&y(A.current[0].id),window.addEventListener("resize",D),function(){return window.removeEventListener("resize",D)}},[o,u]),r(function(){var e=window;function t(){var t,r;if(C.current)C.current=!1;else{var n,i=e instanceof Window?window.pageYOffset:e.scrollTop,a=e instanceof Window?window.innerHeight:e.clientHeight,o=.2*a,s=(null===(t=A.current[0])||void 0===t?void 0:t.id)||"",c=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=k(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(A.current);try{for(c.s();!(n=c.n()).done;){var l=n.value.id,u=document.getElementById(l);if(u){if(!(u.getBoundingClientRect().top<=o))break;s=l}}}catch(e){c.e(e)}finally{c.f()}var d=e instanceof Window?document.documentElement.scrollHeight:e.scrollHeight;d>a&&i+a>=d-1&&(s=(null===(r=A.current[A.current.length-1])||void 0===r?void 0:r.id)||s),s!==b&&y(s)}}return e.addEventListener("scroll",t),t(),function(){return e.removeEventListener("scroll",t)}},[b]),r(function(){var e;(null==(e=S.current.get(b))?void 0:e.current)&&(h(e.current.offsetHeight),g(e.current.offsetTop))},[b]),r(function(){var e=A.current,t=e.findIndex(function(e){return e.id===b});if(-1!==t){for(var r=[],n=e[t].depth,i=t-1;i>=0&&n>2;i--){var a=e[i],o=a.id,s=a.depth;s<n&&(r.unshift(o),n=s)}T(r)}else T([])},[b]),e.createElement(gr.Provider,{value:{value:b,onChange:O,registerActiveItem:N,unregisterActiveItem:q,ancestors:w}},e.createElement("xyd-toc",{className:"".concat("t19g75q2"," ").concat(s||"")},e.createElement("div",{part:"scroller"},e.createElement("div",{part:"scroll",style:{"--xyd-toc-active-track-height":"".concat(f,"px"),"--xyd-toc-active-track-top":"".concat(m,"px")}})),e.createElement("ul",{part:"list"},i)))}vr.Item=function(n){var i=n.children,a=n.id,s=n.className,c=n.depth,l=o(gr),u=l.value,d=l.ancestors,f=l.onChange,p=l.registerActiveItem,m=l.unregisterActiveItem,g=t(null),v=u===a||d.includes(a);return r(function(){return v&&g.current&&p(g,a),function(){return m(a)}},[v,a,p,m]),e.createElement("xyd-toc-item",null,e.createElement("li",{ref:g,className:"".concat("teg7kxf"," ").concat(s||""),"data-active":String(v),"data-depth":c},e.createElement(h,{part:"link",to:"",onClick:function(e){var t;e.preventDefault(),f(a);var r=new URL(window.location.href);r.hash=a,history.replaceState(null,"",r.toString()),null===(t=document.getElementById(a))||void 0===t||t.scrollIntoView()}},i)))};export{C as Nav,q as ProgressBar,ur as SidebarTabsDropdown,pr as SubNav,vr as Toc,D as UISidebar};
8
8
  //# sourceMappingURL=index.js.map