@quietmind/mdx-docs 0.1.19 → 0.1.20
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/README.md +12 -0
- package/dist/assets/Avatar-BJ0S7JKg.js +1 -0
- package/dist/assets/Button-BXcSdEL6.js +1 -0
- package/dist/assets/Favorite-DeeoxvxH.js +1 -0
- package/dist/assets/advanced-D_Pa36Nk.js +38 -0
- package/dist/assets/alert-a7rj56bx.js +191 -0
- package/dist/assets/button-D0caik7C.js +97 -0
- package/dist/assets/card-Fe9yzzA9.js +230 -0
- package/dist/assets/chip-CHAwrwxa.js +204 -0
- package/dist/assets/colors-BwOy54bA.js +8 -0
- package/dist/assets/customization-DuuWhJ6e.js +111 -0
- package/dist/assets/examples-DBDWp4fA.js +11 -0
- package/dist/assets/home-9ybgeCk8.js +90 -0
- package/dist/assets/index-C5FzG5L5.js +153 -0
- package/dist/assets/prism-DjoQ0BfU.js +14 -0
- package/dist/assets/react-vendor-BVjvCnQb.js +56 -0
- package/dist/assets/router-d4Dt6g8h.js +12 -0
- package/dist/assets/tabs-D9qsbJnd.js +215 -0
- package/dist/assets/textfield-D0Z_oeqU.js +253 -0
- package/dist/assets/typography-hshX1pgi.js +429 -0
- package/dist/index.html +29 -0
- package/package.json +1 -1
- package/dist/index.js +0 -1580
- /package/dist/{index.css → assets/index-Do1AlBnD.css} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{r as i}from"./react-vendor-BVjvCnQb.js";/**
|
|
2
|
+
* react-router v7.13.1
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/var se="popstate";function ue(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Be(e={}){function t(n,a){let o=a.state?.masked,{pathname:l,search:u,hash:s}=o||n.location;return Q("",{pathname:l,search:u,hash:s},a.state&&a.state.usr||null,a.state&&a.state.key||"default",o?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,a){return typeof a=="string"?a:M(a)}return Me(t,r,null,e)}function E(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function L(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function _e(){return Math.random().toString(36).substring(2,10)}function ce(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Q(e,t,r=null,n,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?O(t):t,state:r,key:t&&t.key||n||_e(),unstable_mask:a}}function M({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function O(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function Me(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:o=!1}=n,l=a.history,u="POP",s=null,f=d();f==null&&(f=0,l.replaceState({...l.state,idx:f},""));function d(){return(l.state||{idx:null}).idx}function c(){u="POP";let h=d(),v=h==null?null:h-f;f=h,s&&s({action:u,location:m.location,delta:v})}function p(h,v){u="PUSH";let R=ue(h)?h:Q(m.location,h,v);f=d()+1;let w=ce(R,f),C=m.createHref(R.unstable_mask||R);try{l.pushState(w,"",C)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;a.location.assign(C)}o&&s&&s({action:u,location:m.location,delta:1})}function g(h,v){u="REPLACE";let R=ue(h)?h:Q(m.location,h,v);f=d();let w=ce(R,f),C=m.createHref(R.unstable_mask||R);l.replaceState(w,"",C),o&&s&&s({action:u,location:m.location,delta:0})}function y(h){return Ue(h)}let m={get action(){return u},get location(){return e(a,l)},listen(h){if(s)throw new Error("A history only accepts one active listener");return a.addEventListener(se,c),s=h,()=>{a.removeEventListener(se,c),s=null}},createHref(h){return t(a,h)},createURL:y,encodeLocation(h){let v=y(h);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:g,go(h){return l.go(h)}};return m}function Ue(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),E(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:M(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function me(e,t,r="/"){return Ae(e,t,r,!1)}function Ae(e,t,r,n){let a=typeof t=="string"?O(t):t,o=P(a.pathname||"/",r);if(o==null)return null;let l=ye(e);We(l);let u=null;for(let s=0;u==null&&s<l.length;++s){let f=Qe(o);u=qe(l[s],f,n)}return u}function ye(e,t=[],r=[],n="",a=!1){let o=(l,u,s=a,f)=>{let d={relativePath:f===void 0?l.path||"":f,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&s)return;E(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let c=S([n,d.relativePath]),p=r.concat(d);l.children&&l.children.length>0&&(E(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),ye(l.children,t,p,c,s)),!(l.path==null&&!l.index)&&t.push({path:c,score:Ye(c,l.index),routesMeta:p})};return e.forEach((l,u)=>{if(l.path===""||!l.path?.includes("?"))o(l,u);else for(let s of ge(l.path))o(l,u,!0,s)}),t}function ge(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let l=ge(n.join("/")),u=[];return u.push(...l.map(s=>s===""?o:[o,s].join("/"))),a&&u.push(...l),u.map(s=>e.startsWith("/")&&s===""?"/":s)}function We(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ge(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var He=/^:[\w-]+$/,ze=3,je=2,Ve=1,Je=10,Ke=-2,fe=e=>e==="*";function Ye(e,t){let r=e.split("/"),n=r.length;return r.some(fe)&&(n+=Ke),t&&(n+=je),r.filter(a=>!fe(a)).reduce((a,o)=>a+(He.test(o)?ze:o===""?Ve:Je),n)}function Ge(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function qe(e,t,r=!1){let{routesMeta:n}=e,a={},o="/",l=[];for(let u=0;u<n.length;++u){let s=n[u],f=u===n.length-1,d=o==="/"?t:t.slice(o.length)||"/",c=V({path:s.relativePath,caseSensitive:s.caseSensitive,end:f},d),p=s.route;if(!c&&f&&r&&!n[n.length-1].route.index&&(c=V({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},d)),!c)return null;Object.assign(a,c.params),l.push({params:a,pathname:S([o,c.pathname]),pathnameBase:rt(S([o,c.pathnameBase])),route:p}),c.pathnameBase!=="/"&&(o=S([o,c.pathnameBase]))}return l}function V(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Xe(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],l=o.replace(/(.)\/+$/,"$1"),u=a.slice(1);return{params:n.reduce((f,{paramName:d,isOptional:c},p)=>{if(d==="*"){let y=u[p]||"";l=o.slice(0,o.length-y.length).replace(/(.)\/+$/,"$1")}const g=u[p];return c&&!g?f[d]=void 0:f[d]=(g||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:l,pattern:e}}function Xe(e,t=!1,r=!0){L(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,s,f,d)=>{if(n.push({paramName:u,isOptional:s!=null}),s){let c=d.charAt(f+l.length);return c&&c!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Qe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return L(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function P(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}var Ze=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function et(e,t="/"){let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?O(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=de(r.substring(1),"/"):o=de(r,t)):o=t,{pathname:o,search:nt(n),hash:at(a)}}function de(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function G(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function tt(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ve(e){let t=tt(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function ee(e,t,r,n=!1){let a;typeof e=="string"?a=O(e):(a={...e},E(!a.pathname||!a.pathname.includes("?"),G("?","pathname","search",a)),E(!a.pathname||!a.pathname.includes("#"),G("#","pathname","hash",a)),E(!a.search||!a.search.includes("#"),G("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,u;if(l==null)u=r;else{let c=t.length-1;if(!n&&l.startsWith("..")){let p=l.split("/");for(;p[0]==="..";)p.shift(),c-=1;a.pathname=p.join("/")}u=c>=0?t[c]:"/"}let s=et(a,u),f=l&&l!=="/"&&l.endsWith("/"),d=(o||l===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(f||d)&&(s.pathname+="/"),s}var S=e=>e.join("/").replace(/\/\/+/g,"/"),rt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),nt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,at=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,ot=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function lt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function it(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Re=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e,t){let r=e;if(typeof r!="string"||!Ze.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,a=!1;if(Re)try{let o=new URL(window.location.href),l=r.startsWith("//")?new URL(o.protocol+r):new URL(r),u=P(l.pathname,t);l.origin===o.origin&&u!=null?r=u+l.search+l.hash:a=!0}catch{L(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:a,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ee=["POST","PUT","PATCH","DELETE"];new Set(Ee);var st=["GET",...Ee];new Set(st);var N=i.createContext(null);N.displayName="DataRouter";var J=i.createContext(null);J.displayName="DataRouterState";var ut=i.createContext(!1),xe=i.createContext({isTransitioning:!1});xe.displayName="ViewTransition";var ct=i.createContext(new Map);ct.displayName="Fetchers";var ft=i.createContext(null);ft.displayName="Await";var b=i.createContext(null);b.displayName="Navigation";var U=i.createContext(null);U.displayName="Location";var k=i.createContext({outlet:null,matches:[],isDataRoute:!1});k.displayName="Route";var te=i.createContext(null);te.displayName="RouteError";var Ce="REACT_ROUTER_ERROR",dt="REDIRECT",ht="ROUTE_ERROR_RESPONSE";function pt(e){if(e.startsWith(`${Ce}:${dt}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function mt(e){if(e.startsWith(`${Ce}:${ht}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new ot(t.status,t.statusText,t.data)}catch{}}function yt(e,{relative:t}={}){E(A(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=i.useContext(b),{hash:a,pathname:o,search:l}=W(e,{relative:t}),u=o;return r!=="/"&&(u=o==="/"?r:S([r,o])),n.createHref({pathname:u,search:l,hash:a})}function A(){return i.useContext(U)!=null}function D(){return E(A(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(U).location}var be="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Se(e){i.useContext(b).static||i.useLayoutEffect(e)}function gt(){let{isDataRoute:e}=i.useContext(k);return e?Tt():vt()}function vt(){E(A(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(N),{basename:t,navigator:r}=i.useContext(b),{matches:n}=i.useContext(k),{pathname:a}=D(),o=JSON.stringify(ve(n)),l=i.useRef(!1);return Se(()=>{l.current=!0}),i.useCallback((s,f={})=>{if(L(l.current,be),!l.current)return;if(typeof s=="number"){r.go(s);return}let d=ee(s,JSON.parse(o),a,f.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:S([t,d.pathname])),(f.replace?r.replace:r.push)(d,f.state,f)},[t,r,o,a,e])}i.createContext(null);function W(e,{relative:t}={}){let{matches:r}=i.useContext(k),{pathname:n}=D(),a=JSON.stringify(ve(r));return i.useMemo(()=>ee(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function Rt(e,t){return Le(e,t)}function Le(e,t,r){E(A(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=i.useContext(b),{matches:a}=i.useContext(k),o=a[a.length-1],l=o?o.params:{},u=o?o.pathname:"/",s=o?o.pathnameBase:"/",f=o&&o.route;{let h=f&&f.path||"";ke(u,!f||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
11
|
+
|
|
12
|
+
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let d=D(),c;if(t){let h=typeof t=="string"?O(t):t;E(s==="/"||h.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${h.pathname}" was given in the \`location\` prop.`),c=h}else c=d;let p=c.pathname||"/",g=p;if(s!=="/"){let h=s.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let y=me(e,{pathname:g});L(f||y!=null,`No routes matched location "${c.pathname}${c.search}${c.hash}" `),L(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${c.pathname}${c.search}${c.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let m=bt(y&&y.map(h=>Object.assign({},h,{params:Object.assign({},l,h.params),pathname:S([s,n.encodeLocation?n.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?s:S([s,n.encodeLocation?n.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),a,r);return t&&m?i.createElement(U.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...c},navigationType:"POP"}},m):m}function wt(){let e=$t(),t=lt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:o},"ErrorBoundary")," or"," ",i.createElement("code",{style:o},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),r?i.createElement("pre",{style:a},r):null,l)}var Et=i.createElement(wt,null),Pe=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=mt(e.digest);r&&(e=r)}let t=e!==void 0?i.createElement(k.Provider,{value:this.props.routeContext},i.createElement(te.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?i.createElement(xt,{error:e},t):t}};Pe.contextType=ut;var q=new WeakMap;function xt({children:e,error:t}){let{basename:r}=i.useContext(b);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=pt(t.digest);if(n){let a=q.get(t);if(a)throw a;let o=we(n.location,r);if(Re&&!q.get(t))if(o.isExternal||n.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:n.replace}));throw q.set(t,l),l}return i.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function Ct({routeContext:e,match:t,children:r}){let n=i.useContext(N);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(k.Provider,{value:e},r)}function bt(e,t=[],r){let n=r?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let d=a.findIndex(c=>c.route.id&&o?.[c.route.id]!==void 0);E(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,d+1))}let l=!1,u=-1;if(r&&n){l=n.renderFallback;for(let d=0;d<a.length;d++){let c=a[d];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(u=d),c.route.id){let{loaderData:p,errors:g}=n,y=c.route.loader&&!p.hasOwnProperty(c.route.id)&&(!g||g[c.route.id]===void 0);if(c.route.lazy||y){r.isStatic&&(l=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let s=r?.onError,f=n&&s?(d,c)=>{s(d,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:it(n.matches),errorInfo:c})}:void 0;return a.reduceRight((d,c,p)=>{let g,y=!1,m=null,h=null;n&&(g=o&&c.route.id?o[c.route.id]:void 0,m=c.route.errorElement||Et,l&&(u<0&&p===0?(ke("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,h=null):u===p&&(y=!0,h=c.route.hydrateFallbackElement||null)));let v=t.concat(a.slice(0,p+1)),R=()=>{let w;return g?w=m:y?w=h:c.route.Component?w=i.createElement(c.route.Component,null):c.route.element?w=c.route.element:w=d,i.createElement(Ct,{match:c,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(c.route.ErrorBoundary||c.route.errorElement||p===0)?i.createElement(Pe,{location:n.location,revalidation:n.revalidation,component:m,error:g,children:R(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:f}):R()},null)}function re(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function St(e){let t=i.useContext(N);return E(t,re(e)),t}function Lt(e){let t=i.useContext(J);return E(t,re(e)),t}function Pt(e){let t=i.useContext(k);return E(t,re(e)),t}function ne(e){let t=Pt(e),r=t.matches[t.matches.length-1];return E(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function kt(){return ne("useRouteId")}function $t(){let e=i.useContext(te),t=Lt("useRouteError"),r=ne("useRouteError");return e!==void 0?e:t.errors?.[r]}function Tt(){let{router:e}=St("useNavigate"),t=ne("useNavigate"),r=i.useRef(!1);return Se(()=>{r.current=!0}),i.useCallback(async(a,o={})=>{L(r.current,be),r.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var he={};function ke(e,t,r){!t&&!he[e]&&(he[e]=!0,L(!1,r))}i.memo(Ft);function Ft({routes:e,future:t,state:r,isStatic:n,onError:a}){return Le(e,void 0,{state:r,isStatic:n,onError:a})}function Dt(e){E(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function It({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:a,static:o=!1,unstable_useTransitions:l}){E(!A(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),s=i.useMemo(()=>({basename:u,navigator:a,static:o,unstable_useTransitions:l,future:{}}),[u,a,o,l]);typeof r=="string"&&(r=O(r));let{pathname:f="/",search:d="",hash:c="",state:p=null,key:g="default",unstable_mask:y}=r,m=i.useMemo(()=>{let h=P(f,u);return h==null?null:{location:{pathname:h,search:d,hash:c,state:p,key:g,unstable_mask:y},navigationType:n}},[u,f,d,c,p,g,n,y]);return L(m!=null,`<Router basename="${u}"> is not able to match the URL "${f}${d}${c}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:i.createElement(b.Provider,{value:s},i.createElement(U.Provider,{children:t,value:m}))}function hr({children:e,location:t}){return Rt(Z(e),t)}function Z(e,t=[]){let r=[];return i.Children.forEach(e,(n,a)=>{if(!i.isValidElement(n))return;let o=[...t,a];if(n.type===i.Fragment){r.push.apply(r,Z(n.props.children,o));return}E(n.type===Dt,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!n.props.index||!n.props.children,"An index route cannot have child routes.");let l={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(l.children=Z(n.props.children,o)),r.push(l)}),r}var z="get",j="application/x-www-form-urlencoded";function K(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Ot(e){return K(e)&&e.tagName.toLowerCase()==="button"}function Nt(e){return K(e)&&e.tagName.toLowerCase()==="form"}function Bt(e){return K(e)&&e.tagName.toLowerCase()==="input"}function _t(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Mt(e,t){return e.button===0&&(!t||t==="_self")&&!_t(e)}var H=null;function Ut(){if(H===null)try{new FormData(document.createElement("form"),0),H=!1}catch{H=!0}return H}var At=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function X(e){return e!=null&&!At.has(e)?(L(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${j}"`),null):e}function Wt(e,t){let r,n,a,o,l;if(Nt(e)){let u=e.getAttribute("action");n=u?P(u,t):null,r=e.getAttribute("method")||z,a=X(e.getAttribute("enctype"))||j,o=new FormData(e)}else if(Ot(e)||Bt(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(n=s?P(s,t):null,r=e.getAttribute("formmethod")||u.getAttribute("method")||z,a=X(e.getAttribute("formenctype"))||X(u.getAttribute("enctype"))||j,o=new FormData(u,e),!Ut()){let{name:f,type:d,value:c}=e;if(d==="image"){let p=f?`${f}.`:"";o.append(`${p}x`,"0"),o.append(`${p}y`,"0")}else f&&o.append(f,c)}}else{if(K(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=z,n=null,a=j,l=e}return o&&a==="text/plain"&&(l=o,o=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ae(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ht(e,t,r,n){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${n}`:a.pathname=`${a.pathname}.${n}`:a.pathname==="/"?a.pathname=`_root.${n}`:t&&P(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${n}`,a}async function zt(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function jt(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Vt(e,t,r){let n=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let l=await zt(o,r);return l.links?l.links():[]}return[]}));return Gt(n.flat(1).filter(jt).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function pe(e,t,r,n,a,o){let l=(s,f)=>r[f]?s.route.id!==r[f].route.id:!0,u=(s,f)=>r[f].pathname!==s.pathname||r[f].route.path?.endsWith("*")&&r[f].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,f)=>l(s,f)||u(s,f)):o==="data"?t.filter((s,f)=>{let d=n.routes[s.route.id];if(!d||!d.hasLoader)return!1;if(l(s,f)||u(s,f))return!0;if(s.route.shouldRevalidate){let c=s.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof c=="boolean")return c}return!0}):[]}function Jt(e,t,{includeHydrateFallback:r}={}){return Kt(e.map(n=>{let a=t.routes[n.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function Kt(e){return[...new Set(e)]}function Yt(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function Gt(e,t){let r=new Set;return new Set(t),e.reduce((n,a)=>{let o=JSON.stringify(Yt(a));return r.has(o)||(r.add(o),n.push({key:o,link:a})),n},[])}function $e(){let e=i.useContext(N);return ae(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function qt(){let e=i.useContext(J);return ae(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var oe=i.createContext(void 0);oe.displayName="FrameworkContext";function Te(){let e=i.useContext(oe);return ae(e,"You must render this element inside a <HydratedRouter> element"),e}function Xt(e,t){let r=i.useContext(oe),[n,a]=i.useState(!1),[o,l]=i.useState(!1),{onFocus:u,onBlur:s,onMouseEnter:f,onMouseLeave:d,onTouchStart:c}=t,p=i.useRef(null);i.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let m=v=>{v.forEach(R=>{l(R.isIntersecting)})},h=new IntersectionObserver(m,{threshold:.5});return p.current&&h.observe(p.current),()=>{h.disconnect()}}},[e]),i.useEffect(()=>{if(n){let m=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(m)}}},[n]);let g=()=>{a(!0)},y=()=>{a(!1),l(!1)};return r?e!=="intent"?[o,p,{}]:[o,p,{onFocus:_(u,g),onBlur:_(s,y),onMouseEnter:_(f,g),onMouseLeave:_(d,y),onTouchStart:_(c,g)}]:[!1,p,{}]}function _(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Qt({page:e,...t}){let{router:r}=$e(),n=i.useMemo(()=>me(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?i.createElement(er,{page:e,matches:n,...t}):null}function Zt(e){let{manifest:t,routeModules:r}=Te(),[n,a]=i.useState([]);return i.useEffect(()=>{let o=!1;return Vt(e,t,r).then(l=>{o||a(l)}),()=>{o=!0}},[e,t,r]),n}function er({page:e,matches:t,...r}){let n=D(),{future:a,manifest:o,routeModules:l}=Te(),{basename:u}=$e(),{loaderData:s,matches:f}=qt(),d=i.useMemo(()=>pe(e,t,f,o,n,"data"),[e,t,f,o,n]),c=i.useMemo(()=>pe(e,t,f,o,n,"assets"),[e,t,f,o,n]),p=i.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let m=new Set,h=!1;if(t.forEach(R=>{let w=o.routes[R.route.id];!w||!w.hasLoader||(!d.some(C=>C.route.id===R.route.id)&&R.route.id in s&&l[R.route.id]?.shouldRevalidate||w.hasClientLoader?h=!0:m.add(R.route.id))}),m.size===0)return[];let v=Ht(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return h&&m.size>0&&v.searchParams.set("_routes",t.filter(R=>m.has(R.route.id)).map(R=>R.route.id).join(",")),[v.pathname+v.search]},[u,a.unstable_trailingSlashAwareDataRequests,s,n,o,d,t,e,l]),g=i.useMemo(()=>Jt(c,o),[c,o]),y=Zt(c);return i.createElement(i.Fragment,null,p.map(m=>i.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...r})),g.map(m=>i.createElement("link",{key:m,rel:"modulepreload",href:m,...r})),y.map(({key:m,link:h})=>i.createElement("link",{key:m,nonce:r.nonce,...h,crossOrigin:h.crossOrigin??r.crossOrigin})))}function tr(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var rr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rr&&(window.__reactRouterVersion="7.13.1")}catch{}function pr({basename:e,children:t,unstable_useTransitions:r,window:n}){let a=i.useRef();a.current==null&&(a.current=Be({window:n,v5Compat:!0}));let o=a.current,[l,u]=i.useState({action:o.action,location:o.location}),s=i.useCallback(f=>{r===!1?u(f):i.startTransition(()=>u(f))},[r]);return i.useLayoutEffect(()=>o.listen(s),[o,s]),i.createElement(It,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,unstable_useTransitions:r})}var Fe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,De=i.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:o,replace:l,unstable_mask:u,state:s,target:f,to:d,preventScrollReset:c,viewTransition:p,unstable_defaultShouldRevalidate:g,...y},m){let{basename:h,navigator:v,unstable_useTransitions:R}=i.useContext(b),w=typeof d=="string"&&Fe.test(d),C=we(d,h);d=C.to;let x=yt(d,{relative:a}),$=D(),T=null;if(u){let F=ee(u,[],$.unstable_mask?$.unstable_mask.pathname:"/",!0);h!=="/"&&(F.pathname=F.pathname==="/"?h:S([h,F.pathname])),T=v.createHref(F)}let[I,B,Y]=Xt(n,y),Oe=lr(d,{replace:l,unstable_mask:u,state:s,target:f,preventScrollReset:c,relative:a,viewTransition:p,unstable_defaultShouldRevalidate:g,unstable_useTransitions:R});function Ne(F){t&&t(F),F.defaultPrevented||Oe(F)}let le=!(C.isExternal||o),ie=i.createElement("a",{...y,...Y,href:(le?T:void 0)||C.absoluteURL||x,onClick:le?Ne:t,ref:tr(m,B),target:f,"data-discover":!w&&r==="render"?"true":void 0});return I&&!w?i.createElement(i.Fragment,null,ie,i.createElement(Qt,{page:x})):ie});De.displayName="Link";var nr=i.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:l,viewTransition:u,children:s,...f},d){let c=W(l,{relative:f.relative}),p=D(),g=i.useContext(J),{navigator:y,basename:m}=i.useContext(b),h=g!=null&&fr(c)&&u===!0,v=y.encodeLocation?y.encodeLocation(c).pathname:c.pathname,R=p.pathname,w=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;r||(R=R.toLowerCase(),w=w?w.toLowerCase():null,v=v.toLowerCase()),w&&m&&(w=P(w,m)||w);const C=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let x=R===v||!a&&R.startsWith(v)&&R.charAt(C)==="/",$=w!=null&&(w===v||!a&&w.startsWith(v)&&w.charAt(v.length)==="/"),T={isActive:x,isPending:$,isTransitioning:h},I=x?t:void 0,B;typeof n=="function"?B=n(T):B=[n,x?"active":null,$?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let Y=typeof o=="function"?o(T):o;return i.createElement(De,{...f,"aria-current":I,className:B,ref:d,style:Y,to:l,viewTransition:u},typeof s=="function"?s(T):s)});nr.displayName="NavLink";var ar=i.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:o,method:l=z,action:u,onSubmit:s,relative:f,preventScrollReset:d,viewTransition:c,unstable_defaultShouldRevalidate:p,...g},y)=>{let{unstable_useTransitions:m}=i.useContext(b),h=ur(),v=cr(u,{relative:f}),R=l.toLowerCase()==="get"?"get":"post",w=typeof u=="string"&&Fe.test(u),C=x=>{if(s&&s(x),x.defaultPrevented)return;x.preventDefault();let $=x.nativeEvent.submitter,T=$?.getAttribute("formmethod")||l,I=()=>h($||x.currentTarget,{fetcherKey:t,method:T,navigate:r,replace:a,state:o,relative:f,preventScrollReset:d,viewTransition:c,unstable_defaultShouldRevalidate:p});m&&r!==!1?i.startTransition(()=>I()):I()};return i.createElement("form",{ref:y,method:R,action:v,onSubmit:n?s:C,...g,"data-discover":!w&&e==="render"?"true":void 0})});ar.displayName="Form";function or(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ie(e){let t=i.useContext(N);return E(t,or(e)),t}function lr(e,{target:t,replace:r,unstable_mask:n,state:a,preventScrollReset:o,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:s,unstable_useTransitions:f}={}){let d=gt(),c=D(),p=W(e,{relative:l});return i.useCallback(g=>{if(Mt(g,t)){g.preventDefault();let y=r!==void 0?r:M(c)===M(p),m=()=>d(e,{replace:y,unstable_mask:n,state:a,preventScrollReset:o,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:s});f?i.startTransition(()=>m()):m()}},[c,d,p,r,n,a,t,e,o,l,u,s,f])}var ir=0,sr=()=>`__${String(++ir)}__`;function ur(){let{router:e}=Ie("useSubmit"),{basename:t}=i.useContext(b),r=kt(),n=e.fetch,a=e.navigate;return i.useCallback(async(o,l={})=>{let{action:u,method:s,encType:f,formData:d,body:c}=Wt(o,t);if(l.navigate===!1){let p=l.fetcherKey||sr();await n(p,r,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:c,formMethod:l.method||s,formEncType:l.encType||f,flushSync:l.flushSync})}else await a(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:c,formMethod:l.method||s,formEncType:l.encType||f,replace:l.replace,state:l.state,fromRouteId:r,flushSync:l.flushSync,viewTransition:l.viewTransition})},[n,a,t,r])}function cr(e,{relative:t}={}){let{basename:r}=i.useContext(b),n=i.useContext(k);E(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),o={...W(e||".",{relative:t})},l=D();if(e==null){o.search=l.search;let u=new URLSearchParams(o.search),s=u.getAll("index");if(s.some(d=>d==="")){u.delete("index"),s.filter(c=>c).forEach(c=>u.append("index",c));let d=u.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:S([r,o.pathname])),M(o)}function fr(e,{relative:t}={}){let r=i.useContext(xe);E(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Ie("useViewTransitionState"),a=W(e,{relative:t});if(!r.isTransitioning)return!1;let o=P(r.currentLocation.pathname,n)||r.currentLocation.pathname,l=P(r.nextLocation.pathname,n)||r.nextLocation.pathname;return V(a.pathname,l)!=null||V(a.pathname,o)!=null}export{pr as B,De as L,hr as R,Dt as a,gt as b,D as u};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import{r as c,j as m,n as He,o as n,p as d,F as Cn}from"./react-vendor-BVjvCnQb.js";import{g as ge,a as Te,u as Se,d as Ue,e as xe,s as H,i as Xe,m as ye,c as ie,q as wn,v as Ke,w as Ye,x as qe,y as se,p as In,z as fe,b as Y,A as Bn,D as Pn,B as R,T as Mn}from"./index-C5FzG5L5.js";import{F as Ge}from"./Favorite-DeeoxvxH.js";import{c as L}from"./prism-DjoQ0BfU.js";import"./router-d4Dt6g8h.js";function En(t){return ge("MuiTab",t)}const y=Te("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper","icon"]),Rn=t=>{const{classes:e,textColor:o,fullWidth:a,wrapped:s,icon:h,label:v,selected:g,disabled:p}=t,S={root:["root",h&&v&&"labelIcon",`textColor${Ue(o)}`,a&&"fullWidth",s&&"wrapped",g&&"selected",p&&"disabled"],icon:["iconWrapper","icon"]};return xe(S,En,e)},zn=H(Xe,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.root,o.label&&o.icon&&e.labelIcon,e[`textColor${Ue(o.textColor)}`],o.fullWidth&&e.fullWidth,o.wrapped&&e.wrapped,{[`& .${y.iconWrapper}`]:e.iconWrapper},{[`& .${y.icon}`]:e.icon}]}})(ye(({theme:t})=>({...t.typography.button,maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center",lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition==="top"||e.iconPosition==="bottom"),style:{flexDirection:"column"}},{props:({ownerState:e})=>e.label&&e.iconPosition!=="top"&&e.iconPosition!=="bottom",style:{flexDirection:"row"}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:o})=>e.icon&&e.label&&o==="top",style:{[`& > .${y.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:o})=>e.icon&&e.label&&o==="bottom",style:{[`& > .${y.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:o})=>e.icon&&e.label&&o==="start",style:{[`& > .${y.icon}`]:{marginRight:t.spacing(1)}}},{props:({ownerState:e,iconPosition:o})=>e.icon&&e.label&&o==="end",style:{[`& > .${y.icon}`]:{marginLeft:t.spacing(1)}}},{props:{textColor:"inherit"},style:{color:"inherit",opacity:.6,[`&.${y.selected}`]:{opacity:1},[`&.${y.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}}},{props:{textColor:"primary"},style:{color:(t.vars||t).palette.text.secondary,[`&.${y.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${y.disabled}`]:{color:(t.vars||t).palette.text.disabled}}},{props:{textColor:"secondary"},style:{color:(t.vars||t).palette.text.secondary,[`&.${y.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${y.disabled}`]:{color:(t.vars||t).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:t.typography.pxToRem(12)}}]}))),u=c.forwardRef(function(e,o){const a=Se({props:e,name:"MuiTab"}),{className:s,disabled:h=!1,disableFocusRipple:v=!1,fullWidth:g,icon:p,iconPosition:S="top",indicator:I,label:x,onChange:T,onClick:B,onFocus:k,selected:P,selectionFollowsFocus:C,textColor:ee="inherit",value:z,wrapped:ce=!1,...N}=a,U={...a,disabled:h,disableFocusRipple:v,selected:P,icon:!!p,iconPosition:S,label:!!x,fullWidth:g,textColor:ee,wrapped:ce},q=Rn(U),G=p&&x&&c.isValidElement(p)?c.cloneElement(p,{className:L(q.icon,p.props.className)}):p,ne=j=>{!P&&T&&T(j,z),B&&B(j)},X=j=>{C&&!P&&T&&T(j,z),k&&k(j)};return m.jsxs(zn,{focusRipple:!v,className:L(q.root,s),ref:o,role:"tab","aria-selected":P,disabled:h,onClick:ne,onFocus:X,ownerState:U,tabIndex:P?0:-1,...N,children:[S==="top"||S==="start"?m.jsxs(c.Fragment,{children:[G,x]}):m.jsxs(c.Fragment,{children:[x,G]}),I]})}),Nn=ie(m.jsx("path",{d:"M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"})),jn=ie(m.jsx("path",{d:"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"}));function An(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function Wn(t,e,o,a={},s=()=>{}){const{ease:h=An,duration:v=300}=a;let g=null;const p=e[t];let S=!1;const I=()=>{S=!0},x=T=>{if(S){s(new Error("Animation cancelled"));return}g===null&&(g=T);const B=Math.min(1,(T-g)/v);if(e[t]=h(B)*(o-p)+p,B>=1){requestAnimationFrame(()=>{s(null)});return}requestAnimationFrame(x)};return p===o?(s(new Error("Element already at target position")),I):(requestAnimationFrame(x),I)}const Fn={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function On(t){const{onChange:e,...o}=t,a=c.useRef(),s=c.useRef(null),h=()=>{a.current=s.current.offsetHeight-s.current.clientHeight};return wn(()=>{const v=Ke(()=>{const p=a.current;h(),p!==a.current&&e(a.current)}),g=Ye(s.current);return g.addEventListener("resize",v),()=>{v.clear(),g.removeEventListener("resize",v)}},[e]),c.useEffect(()=>{h(),e(a.current)},[e]),m.jsx("div",{style:Fn,...o,ref:s})}function Ln(t){return ge("MuiTabScrollButton",t)}const kn=Te("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),Dn=t=>{const{classes:e,orientation:o,disabled:a}=t;return xe({root:["root",o,a&&"disabled"]},Ln,e)},Vn=H(Xe,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.root,o.orientation&&e[o.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${kn.disabled}`]:{opacity:0},variants:[{props:{orientation:"vertical"},style:{width:"100%",height:40,"& svg":{transform:"var(--TabScrollButton-svgRotate)"}}}]}),$n=c.forwardRef(function(e,o){const a=Se({props:e,name:"MuiTabScrollButton"}),{className:s,slots:h={},slotProps:v={},direction:g,orientation:p,disabled:S,...I}=a,x=qe(),T={isRtl:x,...a},B=Dn(T),k=h.StartScrollButtonIcon??Nn,P=h.EndScrollButtonIcon??jn,C=se({elementType:k,externalSlotProps:v.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:T}),ee=se({elementType:P,externalSlotProps:v.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:T});return m.jsx(Vn,{component:"div",className:L(B.root,s),ref:o,role:null,ownerState:T,tabIndex:null,...I,style:{...I.style,...p==="vertical"&&{"--TabScrollButton-svgRotate":`rotate(${x?-90:90}deg)`}},children:g==="left"?m.jsx(k,{...C}):m.jsx(P,{...ee})})});function Hn(t){return ge("MuiTabs",t)}const me=Te("MuiTabs",["root","vertical","list","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),ke=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,De=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,ae=(t,e,o)=>{let a=!1,s=o(t,e);for(;s;){if(s===t.firstChild){if(a)return;a=!0}const h=s.disabled||s.getAttribute("aria-disabled")==="true";if(!s.hasAttribute("tabindex")||h)s=o(t,s);else{s.focus();return}}},Un=t=>{const{vertical:e,fixed:o,hideScrollbar:a,scrollableX:s,scrollableY:h,centered:v,scrollButtonsHideMobile:g,classes:p}=t;return xe({root:["root",e&&"vertical"],scroller:["scroller",o&&"fixed",a&&"hideScrollbar",s&&"scrollableX",h&&"scrollableY"],list:["list","flexContainer",e&&"flexContainerVertical",e&&"vertical",v&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",g&&"scrollButtonsHideMobile"],scrollableX:[s&&"scrollableX"],hideScrollbar:[a&&"hideScrollbar"]},Hn,p)},Xn=H("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[{[`& .${me.scrollButtons}`]:e.scrollButtons},{[`& .${me.scrollButtons}`]:o.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,o.vertical&&e.vertical]}})(ye(({theme:t})=>({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex",variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:"column"}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${me.scrollButtons}`]:{[t.breakpoints.down("sm")]:{display:"none"}}}}]}))),Kn=H("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.scroller,o.fixed&&e.fixed,o.hideScrollbar&&e.hideScrollbar,o.scrollableX&&e.scrollableX,o.scrollableY&&e.scrollableY]}})({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap",variants:[{props:({ownerState:t})=>t.fixed,style:{overflowX:"hidden",width:"100%"}},{props:({ownerState:t})=>t.hideScrollbar,style:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}},{props:({ownerState:t})=>t.scrollableX,style:{overflowX:"auto",overflowY:"hidden"}},{props:({ownerState:t})=>t.scrollableY,style:{overflowY:"auto",overflowX:"hidden"}}]}),Yn=H("div",{name:"MuiTabs",slot:"List",overridesResolver:(t,e)=>{const{ownerState:o}=t;return[e.list,e.flexContainer,o.vertical&&e.flexContainerVertical,o.centered&&e.centered]}})({display:"flex",variants:[{props:({ownerState:t})=>t.vertical,style:{flexDirection:"column"}},{props:({ownerState:t})=>t.centered,style:{justifyContent:"center"}}]}),qn=H("span",{name:"MuiTabs",slot:"Indicator"})(ye(({theme:t})=>({position:"absolute",height:2,bottom:0,width:"100%",transition:t.transitions.create(),variants:[{props:{indicatorColor:"primary"},style:{backgroundColor:(t.vars||t).palette.primary.main}},{props:{indicatorColor:"secondary"},style:{backgroundColor:(t.vars||t).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:"100%",width:2,right:0}}]}))),Gn=H(On)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Ve={},F=c.forwardRef(function(e,o){const a=Se({props:e,name:"MuiTabs"}),s=In(),h=qe(),{"aria-label":v,"aria-labelledby":g,action:p,centered:S=!1,children:I,className:x,component:T="div",allowScrollButtonsMobile:B=!1,indicatorColor:k="primary",onChange:P,orientation:C="horizontal",ScrollButtonComponent:ee,scrollButtons:z="auto",selectionFollowsFocus:ce,slots:N={},slotProps:U={},TabIndicatorProps:q={},TabScrollButtonProps:G={},textColor:ne="primary",value:X,variant:j="standard",visibleScrollbar:de=!1,...Qe}=a,M=j==="scrollable",w=C==="vertical",_=w?"scrollTop":"scrollLeft",te=w?"top":"left",le=w?"bottom":"right",be=w?"clientHeight":"clientWidth",J=w?"height":"width",A={...a,component:T,allowScrollButtonsMobile:B,indicatorColor:k,orientation:C,vertical:w,scrollButtons:z,textColor:ne,variant:j,visibleScrollbar:de,fixed:!M,hideScrollbar:M&&!de,scrollableX:M&&!w,scrollableY:M&&w,centered:S&&!M,scrollButtonsHideMobile:!B},O=Un(A),Ze=se({elementType:N.StartScrollButtonIcon,externalSlotProps:U.startScrollButtonIcon,ownerState:A}),en=se({elementType:N.EndScrollButtonIcon,externalSlotProps:U.endScrollButtonIcon,ownerState:A}),[Ce,nn]=c.useState(!1),[D,we]=c.useState(Ve),[Ie,tn]=c.useState(!1),[Be,ln]=c.useState(!1),[Pe,on]=c.useState(!1),[Me,rn]=c.useState({overflow:"hidden",scrollbarWidth:0}),Ee=new Map,W=c.useRef(null),V=c.useRef(null),K={slots:N,slotProps:{indicator:q,scrollButtons:G,...U}},Re=()=>{const l=W.current;let r;if(l){const i=l.getBoundingClientRect();r={clientWidth:l.clientWidth,scrollLeft:l.scrollLeft,scrollTop:l.scrollTop,scrollWidth:l.scrollWidth,top:i.top,bottom:i.bottom,left:i.left,right:i.right}}let b;if(l&&X!==!1){const i=V.current.children;if(i.length>0){const f=i[Ee.get(X)];b=f?f.getBoundingClientRect():null}}return{tabsMeta:r,tabMeta:b}},Q=fe(()=>{const{tabsMeta:l,tabMeta:r}=Re();let b=0,i;w?(i="top",r&&l&&(b=r.top-l.top+l.scrollTop)):(i=h?"right":"left",r&&l&&(b=(h?-1:1)*(r[i]-l[i]+l.scrollLeft)));const f={[i]:b,[J]:r?r[J]:0};if(typeof D[i]!="number"||typeof D[J]!="number")we(f);else{const E=Math.abs(D[i]-f[i]),$=Math.abs(D[J]-f[J]);(E>=1||$>=1)&&we(f)}}),ue=(l,{animation:r=!0}={})=>{r?Wn(_,W.current,l,{duration:s.transitions.duration.standard}):W.current[_]=l},ze=l=>{let r=W.current[_];w?r+=l:r+=l*(h?-1:1),ue(r)},Ne=()=>{const l=W.current[be];let r=0;const b=Array.from(V.current.children);for(let i=0;i<b.length;i+=1){const f=b[i];if(r+f[be]>l){i===0&&(r=l);break}r+=f[be]}return r},an=()=>{ze(-1*Ne())},sn=()=>{ze(Ne())},[cn,{onChange:je,...dn}]=Y("scrollbar",{className:L(O.scrollableX,O.hideScrollbar),elementType:Gn,shouldForwardComponentProp:!0,externalForwardedProps:K,ownerState:A}),bn=c.useCallback(l=>{je?.(l),rn({overflow:null,scrollbarWidth:l})},[je]),[Ae,We]=Y("scrollButtons",{className:L(O.scrollButtons,G.className),elementType:$n,externalForwardedProps:K,ownerState:A,additionalProps:{orientation:C,slots:{StartScrollButtonIcon:N.startScrollButtonIcon||N.StartScrollButtonIcon,EndScrollButtonIcon:N.endScrollButtonIcon||N.EndScrollButtonIcon},slotProps:{startScrollButtonIcon:Ze,endScrollButtonIcon:en}}}),un=()=>{const l={};l.scrollbarSizeListener=M?m.jsx(cn,{...dn,onChange:bn}):null;const b=M&&(z==="auto"&&(Ie||Be)||z===!0);return l.scrollButtonStart=b?m.jsx(Ae,{direction:h?"right":"left",onClick:an,disabled:!Ie,...We}):null,l.scrollButtonEnd=b?m.jsx(Ae,{direction:h?"left":"right",onClick:sn,disabled:!Be,...We}):null,l},Fe=fe(l=>{const{tabsMeta:r,tabMeta:b}=Re();if(!(!b||!r)){if(b[te]<r[te]){const i=r[_]+(b[te]-r[te]);ue(i,{animation:l})}else if(b[le]>r[le]){const i=r[_]+(b[le]-r[le]);ue(i,{animation:l})}}}),oe=fe(()=>{M&&z!==!1&&on(!Pe)});c.useEffect(()=>{const l=Ke(()=>{W.current&&Q()});let r;const b=E=>{E.forEach($=>{$.removedNodes.forEach(Z=>{r?.unobserve(Z)}),$.addedNodes.forEach(Z=>{r?.observe(Z)})}),l(),oe()},i=Ye(W.current);i.addEventListener("resize",l);let f;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(l),Array.from(V.current.children).forEach(E=>{r.observe(E)})),typeof MutationObserver<"u"&&(f=new MutationObserver(b),f.observe(V.current,{childList:!0})),()=>{l.clear(),i.removeEventListener("resize",l),f?.disconnect(),r?.disconnect()}},[Q,oe]),c.useEffect(()=>{const l=Array.from(V.current.children),r=l.length;if(typeof IntersectionObserver<"u"&&r>0&&M&&z!==!1){const b=l[0],i=l[r-1],f={root:W.current,threshold:.99},E=pe=>{tn(!pe[0].isIntersecting)},$=new IntersectionObserver(E,f);$.observe(b);const Z=pe=>{ln(!pe[0].isIntersecting)},Le=new IntersectionObserver(Z,f);return Le.observe(i),()=>{$.disconnect(),Le.disconnect()}}},[M,z,Pe,I?.length]),c.useEffect(()=>{nn(!0)},[]),c.useEffect(()=>{Q()}),c.useEffect(()=>{Fe(Ve!==D)},[Fe,D]),c.useImperativeHandle(p,()=>({updateIndicator:Q,updateScrollButtons:oe}),[Q,oe]);const[hn,pn]=Y("indicator",{className:L(O.indicator,q.className),elementType:qn,externalForwardedProps:K,ownerState:A,additionalProps:{style:D}}),Oe=m.jsx(hn,{...pn});let re=0;const fn=c.Children.map(I,l=>{if(!c.isValidElement(l))return null;const r=l.props.value===void 0?re:l.props.value;Ee.set(r,re);const b=r===X;return re+=1,c.cloneElement(l,{fullWidth:j==="fullWidth",indicator:b&&!Ce&&Oe,selected:b,selectionFollowsFocus:ce,onChange:P,textColor:ne,value:r,...re===1&&X===!1&&!l.props.tabIndex?{tabIndex:0}:{}})}),mn=l=>{if(l.altKey||l.shiftKey||l.ctrlKey||l.metaKey)return;const r=V.current,b=Bn(Pn(r));if(b?.getAttribute("role")!=="tab")return;let f=C==="horizontal"?"ArrowLeft":"ArrowUp",E=C==="horizontal"?"ArrowRight":"ArrowDown";switch(C==="horizontal"&&h&&(f="ArrowRight",E="ArrowLeft"),l.key){case f:l.preventDefault(),ae(r,b,De);break;case E:l.preventDefault(),ae(r,b,ke);break;case"Home":l.preventDefault(),ae(r,null,ke);break;case"End":l.preventDefault(),ae(r,null,De);break}},he=un(),[vn,gn]=Y("root",{ref:o,className:L(O.root,x),elementType:Xn,externalForwardedProps:{...K,...Qe,component:T},ownerState:A}),[Tn,Sn]=Y("scroller",{ref:W,className:O.scroller,elementType:Kn,externalForwardedProps:K,ownerState:A,additionalProps:{style:{overflow:Me.overflow,[w?`margin${h?"Left":"Right"}`:"marginBottom"]:de?void 0:-Me.scrollbarWidth}}}),[xn,yn]=Y("list",{ref:V,className:L(O.list,O.flexContainer),elementType:Yn,externalForwardedProps:K,ownerState:A,getSlotProps:l=>({...l,onKeyDown:r=>{mn(r),l.onKeyDown?.(r)}})});return m.jsxs(vn,{...gn,children:[he.scrollButtonStart,he.scrollbarSizeListener,m.jsxs(Tn,{...Sn,children:[m.jsx(xn,{"aria-label":v,"aria-labelledby":g,"aria-orientation":C==="vertical"?"vertical":null,role:"tablist",...yn,children:fn}),Ce&&Oe]}),he.scrollButtonEnd]})}),_e=ie(m.jsx("path",{d:"M12 2c-4.97 0-9 4.03-9 9 0 4.17 2.84 7.67 6.69 8.69L12 22l2.31-2.31C18.16 18.67 21 15.17 21 11c0-4.97-4.03-9-9-9m0 2c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m0 14.3c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22"})),Je=ie(m.jsx("path",{d:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02z"})),ve=({children:t,value:e,index:o,...a})=>n("div",{role:"tabpanel",hidden:e!==o,id:`simple-tabpanel-${o}`,"aria-labelledby":`simple-tab-${o}`,...a,children:e===o&&n(R,{sx:{p:3},children:n(Mn,{children:t})})}),_n=()=>{const[t,e]=c.useState(0);return d(R,{sx:{width:"100%"},children:[n(R,{sx:{borderBottom:1,borderColor:"divider"},children:d(F,{value:t,onChange:(a,s)=>{e(s)},children:[n(u,{label:"Item One"}),n(u,{label:"Item Two"}),n(u,{label:"Item Three"})]})}),n(ve,{value:t,index:0,children:"Content for Item One"}),n(ve,{value:t,index:1,children:"Content for Item Two"}),n(ve,{value:t,index:2,children:"Content for Item Three"})]})},Jn=()=>{const[t,e]=c.useState(0);return n(R,{sx:{width:"100%"},children:d(F,{value:t,onChange:(o,a)=>e(a),children:[n(u,{icon:n(Je,{}),label:"Recents"}),n(u,{icon:n(Ge,{}),label:"Favorites"}),n(u,{icon:n(_e,{}),label:"Nearby"})]})})},Qn=()=>{const[t,e]=c.useState(0);return n(R,{sx:{width:"100%"},children:d(F,{value:t,onChange:(o,a)=>e(a),children:[n(u,{icon:n(Je,{})}),n(u,{icon:n(Ge,{})}),n(u,{icon:n(_e,{})})]})})};function $e(t){const e={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...He(),...t.components};return d(Cn,{children:[n(e.h1,{children:"Tabs"}),`
|
|
2
|
+
`,d(e.p,{children:["The ",n(e.code,{children:"Tabs"})," component provides a way to organize content into multiple panels that can be switched between. Material UI's Tabs component provides a consistent, accessible, and customizable navigation pattern."]}),`
|
|
3
|
+
`,n(e.p,{children:"Tabs are used to organize related content into separate views, allowing users to switch between different sections without navigating to different pages."}),`
|
|
4
|
+
`,n(e.h2,{children:"Basic Tabs"}),`
|
|
5
|
+
`,n(e.p,{children:"A simple tab navigation with text labels:"}),`
|
|
6
|
+
`,n(_n,{}),`
|
|
7
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`const [value, setValue] = useState(0);
|
|
8
|
+
|
|
9
|
+
const handleChange = (event, newValue) => {
|
|
10
|
+
setValue(newValue);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
<Box sx={{ width: "100%" }}>
|
|
14
|
+
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
|
15
|
+
<Tabs value={value} onChange={handleChange}>
|
|
16
|
+
<Tab label="Item One" />
|
|
17
|
+
<Tab label="Item Two" />
|
|
18
|
+
<Tab label="Item Three" />
|
|
19
|
+
</Tabs>
|
|
20
|
+
</Box>
|
|
21
|
+
<TabPanel value={value} index={0}>
|
|
22
|
+
Content for Item One
|
|
23
|
+
</TabPanel>
|
|
24
|
+
<TabPanel value={value} index={1}>
|
|
25
|
+
Content for Item Two
|
|
26
|
+
</TabPanel>
|
|
27
|
+
<TabPanel value={value} index={2}>
|
|
28
|
+
Content for Item Three
|
|
29
|
+
</TabPanel>
|
|
30
|
+
</Box>
|
|
31
|
+
`})}),`
|
|
32
|
+
`,n(e.h2,{children:"Tab Variants"}),`
|
|
33
|
+
`,n(e.p,{children:"Tabs support different visual variants:"}),`
|
|
34
|
+
`,n(e.h3,{children:"Standard (Default)"}),`
|
|
35
|
+
`,n(R,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:d(F,{value:0,children:[n(u,{label:"Standard"}),n(u,{label:"Tabs"})]})}),`
|
|
36
|
+
`,n(e.h3,{children:"Scrollable Tabs"}),`
|
|
37
|
+
`,n(e.p,{children:"When tabs don't fit in the available width, they become scrollable:"}),`
|
|
38
|
+
`,n(R,{sx:{borderBottom:1,borderColor:"divider",mb:3,maxWidth:400},children:d(F,{value:0,variant:"scrollable",scrollButtons:"auto",children:[n(u,{label:"Item One"}),n(u,{label:"Item Two"}),n(u,{label:"Item Three"}),n(u,{label:"Item Four"}),n(u,{label:"Item Five"}),n(u,{label:"Item Six"}),n(u,{label:"Item Seven"})]})}),`
|
|
39
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs
|
|
40
|
+
value={value}
|
|
41
|
+
variant="scrollable"
|
|
42
|
+
scrollButtons="auto"
|
|
43
|
+
onChange={handleChange}
|
|
44
|
+
>
|
|
45
|
+
<Tab label="Item One" />
|
|
46
|
+
<Tab label="Item Two" />
|
|
47
|
+
{/* More tabs */}
|
|
48
|
+
</Tabs>
|
|
49
|
+
`})}),`
|
|
50
|
+
`,n(e.h3,{children:"Full Width Tabs"}),`
|
|
51
|
+
`,n(e.p,{children:"Tabs that span the full width of their container:"}),`
|
|
52
|
+
`,n(R,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:d(F,{value:0,variant:"fullWidth",children:[n(u,{label:"Full Width"}),n(u,{label:"Tab Two"}),n(u,{label:"Tab Three"})]})}),`
|
|
53
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs value={value} variant="fullWidth" onChange={handleChange}>
|
|
54
|
+
<Tab label="Item One" />
|
|
55
|
+
<Tab label="Item Two" />
|
|
56
|
+
<Tab label="Item Three" />
|
|
57
|
+
</Tabs>
|
|
58
|
+
`})}),`
|
|
59
|
+
`,n(e.h2,{children:"Icons"}),`
|
|
60
|
+
`,n(e.h3,{children:"Icon with Label"}),`
|
|
61
|
+
`,n(e.p,{children:"Tabs can include icons along with labels:"}),`
|
|
62
|
+
`,n(Jn,{}),`
|
|
63
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs value={value} onChange={handleChange}>
|
|
64
|
+
<Tab icon={<PhoneIcon />} label="Recents" />
|
|
65
|
+
<Tab icon={<FavoriteIcon />} label="Favorites" />
|
|
66
|
+
<Tab icon={<PersonPinIcon />} label="Nearby" />
|
|
67
|
+
</Tabs>
|
|
68
|
+
`})}),`
|
|
69
|
+
`,n(e.h3,{children:"Icon Only"}),`
|
|
70
|
+
`,n(e.p,{children:"Tabs can display only icons:"}),`
|
|
71
|
+
`,n(Qn,{}),`
|
|
72
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs value={value} onChange={handleChange}>
|
|
73
|
+
<Tab icon={<PhoneIcon />} />
|
|
74
|
+
<Tab icon={<FavoriteIcon />} />
|
|
75
|
+
<Tab icon={<PersonPinIcon />} />
|
|
76
|
+
</Tabs>
|
|
77
|
+
`})}),`
|
|
78
|
+
`,n(e.h2,{children:"Vertical Tabs"}),`
|
|
79
|
+
`,n(e.p,{children:"Tabs can be displayed vertically:"}),`
|
|
80
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Box sx={{ flexGrow: 1, bgcolor: "background.paper", display: "flex", height: 224 }}>
|
|
81
|
+
<Tabs
|
|
82
|
+
orientation="vertical"
|
|
83
|
+
value={value}
|
|
84
|
+
onChange={handleChange}
|
|
85
|
+
sx={{ borderRight: 1, borderColor: "divider" }}
|
|
86
|
+
>
|
|
87
|
+
<Tab label="Item One" />
|
|
88
|
+
<Tab label="Item Two" />
|
|
89
|
+
<Tab label="Item Three" />
|
|
90
|
+
</Tabs>
|
|
91
|
+
<TabPanel value={value} index={0}>
|
|
92
|
+
Content for Item One
|
|
93
|
+
</TabPanel>
|
|
94
|
+
<TabPanel value={value} index={1}>
|
|
95
|
+
Content for Item Two
|
|
96
|
+
</TabPanel>
|
|
97
|
+
<TabPanel value={value} index={2}>
|
|
98
|
+
Content for Item Three
|
|
99
|
+
</TabPanel>
|
|
100
|
+
</Box>
|
|
101
|
+
`})}),`
|
|
102
|
+
`,n(e.h2,{children:"Disabled Tabs"}),`
|
|
103
|
+
`,n(e.p,{children:"Individual tabs can be disabled:"}),`
|
|
104
|
+
`,n(R,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:d(F,{value:0,children:[n(u,{label:"Active"}),n(u,{label:"Disabled",disabled:!0}),n(u,{label:"Active"})]})}),`
|
|
105
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs value={value} onChange={handleChange}>
|
|
106
|
+
<Tab label="Active" />
|
|
107
|
+
<Tab label="Disabled" disabled />
|
|
108
|
+
<Tab label="Active" />
|
|
109
|
+
</Tabs>
|
|
110
|
+
`})}),`
|
|
111
|
+
`,n(e.h2,{children:"Colored Tabs"}),`
|
|
112
|
+
`,n(e.p,{children:"Tabs support different color schemes:"}),`
|
|
113
|
+
`,d(R,{sx:{display:"flex",flexDirection:"column",gap:2,mb:3},children:[d(F,{value:0,textColor:"primary",indicatorColor:"primary",children:[n(u,{label:"Primary"}),n(u,{label:"Tabs"})]}),d(F,{value:0,textColor:"secondary",indicatorColor:"secondary",children:[n(u,{label:"Secondary"}),n(u,{label:"Tabs"})]})]}),`
|
|
114
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs
|
|
115
|
+
value={value}
|
|
116
|
+
textColor="primary"
|
|
117
|
+
indicatorColor="primary"
|
|
118
|
+
onChange={handleChange}
|
|
119
|
+
>
|
|
120
|
+
<Tab label="Item One" />
|
|
121
|
+
<Tab label="Item Two" />
|
|
122
|
+
</Tabs>
|
|
123
|
+
`})}),`
|
|
124
|
+
`,n(e.h2,{children:"Common Props"}),`
|
|
125
|
+
`,n(e.p,{children:"The Tabs component accepts various props to customize its appearance and behavior:"}),`
|
|
126
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`<Tabs
|
|
127
|
+
value={0} // number - index of selected tab
|
|
128
|
+
onChange={handleChange} // function - called when tab changes
|
|
129
|
+
variant="standard" // 'standard' | 'scrollable' | 'fullWidth'
|
|
130
|
+
orientation="horizontal" // 'horizontal' | 'vertical'
|
|
131
|
+
textColor="inherit" // 'inherit' | 'primary' | 'secondary'
|
|
132
|
+
indicatorColor="primary" // 'primary' | 'secondary'
|
|
133
|
+
scrollButtons="auto" // false | true | 'auto'
|
|
134
|
+
centered={false} // boolean - center tabs
|
|
135
|
+
sx={{}} // object - custom styles
|
|
136
|
+
>
|
|
137
|
+
<Tab
|
|
138
|
+
label="Label" // string | ReactNode
|
|
139
|
+
icon={<Icon />} // ReactNode
|
|
140
|
+
disabled={false} // boolean
|
|
141
|
+
value={0} // number - tab index (if different from position)
|
|
142
|
+
/>
|
|
143
|
+
</Tabs>
|
|
144
|
+
`})}),`
|
|
145
|
+
`,n(e.h2,{children:"Accessibility"}),`
|
|
146
|
+
`,n(e.p,{children:"Material UI Tabs are built with accessibility in mind:"}),`
|
|
147
|
+
`,d(e.ul,{children:[`
|
|
148
|
+
`,d(e.li,{children:[n(e.strong,{children:"ARIA attributes"}),": Proper ARIA roles and attributes for screen readers"]}),`
|
|
149
|
+
`,d(e.li,{children:[n(e.strong,{children:"Keyboard navigation"}),": Arrow keys can be used to navigate between tabs"]}),`
|
|
150
|
+
`,d(e.li,{children:[n(e.strong,{children:"Focus management"}),": Proper focus handling when switching tabs"]}),`
|
|
151
|
+
`,d(e.li,{children:[n(e.strong,{children:"Screen reader support"}),": Tab labels and content are properly announced"]}),`
|
|
152
|
+
`,d(e.li,{children:[n(e.strong,{children:"Tab panels"}),': Use proper role="tabpanel" for tab content']}),`
|
|
153
|
+
`,d(e.li,{children:[n(e.strong,{children:"Active indicator"}),": Clear visual indication of the active tab"]}),`
|
|
154
|
+
`]}),`
|
|
155
|
+
`,n(e.h2,{children:"Best Practices"}),`
|
|
156
|
+
`,d(e.ol,{children:[`
|
|
157
|
+
`,d(e.li,{children:[n(e.strong,{children:"Keep tab labels concise"})," - Short, clear labels work best"]}),`
|
|
158
|
+
`,d(e.li,{children:[n(e.strong,{children:"Limit the number of tabs"})," - Too many tabs can be overwhelming"]}),`
|
|
159
|
+
`,d(e.li,{children:[n(e.strong,{children:"Use scrollable tabs for many items"})," - Enable scrolling when you have many tabs"]}),`
|
|
160
|
+
`,d(e.li,{children:[n(e.strong,{children:"Provide clear content"})," - Each tab panel should have distinct, relevant content"]}),`
|
|
161
|
+
`,d(e.li,{children:[n(e.strong,{children:"Consider mobile experience"})," - Scrollable tabs work well on mobile devices"]}),`
|
|
162
|
+
`,d(e.li,{children:[n(e.strong,{children:"Use icons appropriately"})," - Icons can enhance understanding but shouldn't replace clear labels"]}),`
|
|
163
|
+
`,d(e.li,{children:[n(e.strong,{children:"Maintain state properly"})," - Use controlled components for predictable behavior"]}),`
|
|
164
|
+
`,d(e.li,{children:[n(e.strong,{children:"Group related content"})," - Tabs should contain related information"]}),`
|
|
165
|
+
`]}),`
|
|
166
|
+
`,n(e.h2,{children:"Examples"}),`
|
|
167
|
+
`,n(e.h3,{children:"Controlled Tabs"}),`
|
|
168
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`const [value, setValue] = useState(0);
|
|
169
|
+
|
|
170
|
+
const handleChange = (event, newValue) => {
|
|
171
|
+
setValue(newValue);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
<Box sx={{ width: "100%" }}>
|
|
175
|
+
<Tabs value={value} onChange={handleChange}>
|
|
176
|
+
<Tab label="Overview" />
|
|
177
|
+
<Tab label="Details" />
|
|
178
|
+
<Tab label="Settings" />
|
|
179
|
+
</Tabs>
|
|
180
|
+
{/* Tab content */}
|
|
181
|
+
</Box>
|
|
182
|
+
`})}),`
|
|
183
|
+
`,n(e.h3,{children:"Tabs with Navigation"}),`
|
|
184
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`const [value, setValue] = useState(0);
|
|
185
|
+
|
|
186
|
+
const handleChange = (event, newValue) => {
|
|
187
|
+
setValue(newValue);
|
|
188
|
+
// Navigate or update content based on tab
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
<Tabs value={value} onChange={handleChange}>
|
|
192
|
+
<Tab label="Home" />
|
|
193
|
+
<Tab label="Products" />
|
|
194
|
+
<Tab label="About" />
|
|
195
|
+
<Tab label="Contact" />
|
|
196
|
+
</Tabs>
|
|
197
|
+
`})}),`
|
|
198
|
+
`,n(e.h3,{children:"Tabs with Badges"}),`
|
|
199
|
+
`,n(e.pre,{children:n(e.code,{className:"language-jsx",children:`import { Badge } from "@mui/material";
|
|
200
|
+
|
|
201
|
+
<Tabs value={value} onChange={handleChange}>
|
|
202
|
+
<Tab
|
|
203
|
+
label={
|
|
204
|
+
<Badge badgeContent={4} color="primary">
|
|
205
|
+
Messages
|
|
206
|
+
</Badge>
|
|
207
|
+
}
|
|
208
|
+
/>
|
|
209
|
+
<Tab label="Notifications" />
|
|
210
|
+
</Tabs>
|
|
211
|
+
`})}),`
|
|
212
|
+
`,n(e.h2,{children:"Documentation"}),`
|
|
213
|
+
`,d(e.ul,{children:[`
|
|
214
|
+
`,n(e.li,{children:n(e.a,{href:"https://mui.com/material-ui/react-tabs/",children:"Material UI - Tabs"})}),`
|
|
215
|
+
`]})]})}function ot(t={}){const{wrapper:e}={...He(),...t.components};return e?n(e,{...t,children:n($e,{...t})}):$e(t)}export{_n as BasicTabs,Qn as IconOnlyTabs,Jn as IconTabs,ve as TabPanel,ot as default};
|