@mintlify/msft-sdk 1.1.33 → 1.1.35
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/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +6 -7
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -1
- package/dist/api-playground/EndpointFields/index.js +3 -4
- package/dist/api-playground/EndpointFields/index.js.map +1 -1
- package/dist/components/content-components/heading.js +45 -48
- package/dist/components/content-components/heading.js.map +1 -1
- package/dist/components/content-components/tabs/tabs.js +37 -34
- package/dist/components/content-components/tabs/tabs.js.map +1 -1
- package/dist/components/docsPage.js +103 -87
- package/dist/components/docsPage.js.map +1 -1
- package/dist/components/nav-tree/index.js +116 -118
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/toc/index.js +60 -50
- package/dist/components/toc/index.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/styles.css +1 -1
- package/package.json +10 -9
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`${r ? `${r}-` : ""}${e ? `${e}-` : ""}${t || ""}-`,
|
|
2
|
+
import $ from "@sindresorhus/slugify";
|
|
3
|
+
const c = (r, e, t, i) => $(
|
|
4
|
+
`${r ? `${r}-` : ""}${t ? `${t}-` : ""}${e || ""}-`,
|
|
6
5
|
{
|
|
7
6
|
decamelize: !0
|
|
8
7
|
}
|
|
9
|
-
),
|
|
8
|
+
), s = (r, e) => r ? `${e ? `${e}` : ""}${r}.` : "";
|
|
10
9
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
c as buildRecursiveParamFieldId,
|
|
11
|
+
s as getRecursiveParentName
|
|
13
12
|
};
|
|
14
13
|
//# sourceMappingURL=RecursiveParamField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":";;AAyNO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,GACAC,MAEOC;AAAA,EACL,GAAGJ,IAAY,GAAGA,CAAS,MAAM,EAAE,GAAGE,IAAa,GAAGA,CAAU,MAAM,EAAE,GAAGD,KAAc,EAAE;AAAA,EAC3F;AAAA,IACE,YAAY;AAAA,EAAA;AACd,GAISI,IAAyB,CAACJ,GAAsBC,MACtDD,IAIE,GAAGC,IAAa,GAAGA,CAAU,KAAK,EAAE,GAAGD,CAAI,MAHzC;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "../../
|
|
3
|
-
|
|
4
|
-
const i = () => (t(), null);
|
|
2
|
+
import { useOpenApiEndpoint as n } from "../../hooks/useEndpoint.js";
|
|
3
|
+
const p = () => (n(), null);
|
|
5
4
|
export {
|
|
6
|
-
|
|
5
|
+
p as default
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":";;AAUA,MAAMA,IAAiB,OACJC,EAAA,GAIR;"}
|
|
@@ -1,56 +1,53 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as x, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as C } from "react";
|
|
3
|
+
import { cn as a } from "../../utils/cn.js";
|
|
4
|
+
const B = ({ id: t, level: r, children: c, className: s = "" }) => {
|
|
5
|
+
const m = `h${r}`, [p, o] = C(!1), d = (u) => {
|
|
6
|
+
u.preventDefault();
|
|
7
|
+
const g = window.location.href.split("#")[0] + "#" + t;
|
|
8
|
+
navigator.clipboard.writeText(g).then(() => {
|
|
9
|
+
o(!0), setTimeout(() => o(!1), 2e3);
|
|
10
|
+
});
|
|
11
|
+
const e = document.getElementById("main-content"), i = document.getElementById(t);
|
|
12
|
+
if (e && i) {
|
|
13
|
+
const l = window.getComputedStyle(document.documentElement), f = parseFloat(l.getPropertyValue("--scroll-mt") || "0"), h = parseFloat(l.fontSize), w = f * h, y = e.getBoundingClientRect(), v = i.getBoundingClientRect().top - y.top + e.scrollTop - w;
|
|
14
|
+
e.scrollTo({
|
|
15
|
+
top: v,
|
|
16
|
+
behavior: "instant"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
history.replaceState(null, "", `#${t}`);
|
|
16
20
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
21
|
+
return /* @__PURE__ */ x(m, { id: t, className: a("mint:group mint:relative", s), children: [
|
|
22
|
+
c,
|
|
23
|
+
/* @__PURE__ */ n(
|
|
24
|
+
"a",
|
|
25
|
+
{
|
|
26
|
+
href: `#${t}`,
|
|
27
|
+
onClick: d,
|
|
28
|
+
className: a(
|
|
29
|
+
"mint:absolute mint:-left-6 mint:top-1/2 mint:-translate-y-1/2 mint:opacity-0 mint:transition-opacity mint:duration-200",
|
|
30
|
+
"mint:group-hover:opacity-100 mint:text-[#0078d4] mint:dark:text-[#75b6e7]",
|
|
31
|
+
"mint:no-underline mint:flex mint:items-center mint:justify-center mint:w-5 mint:h-5",
|
|
32
|
+
"hover:mint:text-[#005a9e] hover:mint:dark:text-[#9ed2f7]"
|
|
33
|
+
),
|
|
34
|
+
"aria-label": `Link to ${t}`,
|
|
35
|
+
title: p ? "Link copied!" : "Copy link",
|
|
36
|
+
children: /* @__PURE__ */ n(
|
|
37
|
+
"svg",
|
|
26
38
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"mint:no-underline mint:flex mint:items-center mint:justify-center mint:w-5 mint:h-5",
|
|
33
|
-
"hover:mint:text-[#005a9e] hover:mint:dark:text-[#9ed2f7]"
|
|
34
|
-
),
|
|
35
|
-
"aria-label": `Link to ${t}`,
|
|
36
|
-
title: m ? "Link copied!" : "Copy link",
|
|
37
|
-
children: /* @__PURE__ */ e(
|
|
38
|
-
"svg",
|
|
39
|
-
{
|
|
40
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
-
viewBox: "0 0 16 16",
|
|
42
|
-
fill: "currentColor",
|
|
43
|
-
className: "mint:w-4 mint:h-4",
|
|
44
|
-
children: /* @__PURE__ */ e("path", { d: "M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z" })
|
|
45
|
-
}
|
|
46
|
-
)
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
viewBox: "0 0 16 16",
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
className: "mint:w-4 mint:h-4",
|
|
43
|
+
children: /* @__PURE__ */ n("path", { d: "M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z" })
|
|
47
44
|
}
|
|
48
45
|
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] });
|
|
52
49
|
};
|
|
53
50
|
export {
|
|
54
|
-
|
|
51
|
+
B as Heading
|
|
55
52
|
};
|
|
56
53
|
//# sourceMappingURL=heading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","sources":["../../../src/components/content-components/heading.tsx"],"sourcesContent":["import React, { useState } from
|
|
1
|
+
{"version":3,"file":"heading.js","sources":["../../../src/components/content-components/heading.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { cn } from '../../utils/cn';\n\nexport interface HeadingProps {\n id: string;\n level: 1 | 2 | 3 | 4 | 5 | 6;\n children: React.ReactNode;\n className?: string;\n}\n\nexport const Heading = ({ id, level, children, className = '' }: HeadingProps) => {\n const Tag = `h${level}` as keyof JSX.IntrinsicElements;\n const [isCopied, setIsCopied] = useState(false);\n\n const handleAnchorClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n const url = window.location.href.split('#')[0] + '#' + id;\n navigator.clipboard.writeText(url).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n });\n\n const scrollContainer = document.getElementById('main-content');\n const targetElement = document.getElementById(id);\n\n if (scrollContainer && targetElement) {\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(style.getPropertyValue('--scroll-mt') || '0');\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize;\n\n const containerRect = scrollContainer.getBoundingClientRect();\n const targetRect = targetElement.getBoundingClientRect();\n const relativeTop =\n targetRect.top - containerRect.top + scrollContainer.scrollTop - scrollOffset;\n\n scrollContainer.scrollTo({\n top: relativeTop,\n behavior: 'instant',\n });\n }\n\n history.replaceState(null, '', `#${id}`);\n };\n\n return (\n <Tag id={id} className={cn('mint:group mint:relative', className)}>\n {children}\n <a\n href={`#${id}`}\n onClick={handleAnchorClick}\n className={cn(\n 'mint:absolute mint:-left-6 mint:top-1/2 mint:-translate-y-1/2 mint:opacity-0 mint:transition-opacity mint:duration-200',\n 'mint:group-hover:opacity-100 mint:text-[#0078d4] mint:dark:text-[#75b6e7]',\n 'mint:no-underline mint:flex mint:items-center mint:justify-center mint:w-5 mint:h-5',\n 'hover:mint:text-[#005a9e] hover:mint:dark:text-[#9ed2f7]'\n )}\n aria-label={`Link to ${id}`}\n title={isCopied ? 'Link copied!' : 'Copy link'}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n className=\"mint:w-4 mint:h-4\"\n >\n <path d=\"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z\" />\n </svg>\n </a>\n </Tag>\n );\n};\n"],"names":["Heading","id","level","children","className","Tag","isCopied","setIsCopied","useState","handleAnchorClick","e","url","scrollContainer","targetElement","style","scrollMtRem","fontSize","scrollOffset","containerRect","relativeTop","cn","jsx"],"mappings":";;;AAWO,MAAMA,IAAU,CAAC,EAAE,IAAAC,GAAI,OAAAC,GAAO,UAAAC,GAAU,WAAAC,IAAY,SAAuB;AAChF,QAAMC,IAAM,IAAIH,CAAK,IACf,CAACI,GAAUC,CAAW,IAAIC,EAAS,EAAK,GAExCC,IAAoB,CAACC,MAA2C;AACpE,IAAAA,EAAE,eAAA;AACF,UAAMC,IAAM,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,IAAI,MAAMV;AACvD,cAAU,UAAU,UAAUU,CAAG,EAAE,KAAK,MAAM;AAC5C,MAAAJ,EAAY,EAAI,GAChB,WAAW,MAAMA,EAAY,EAAK,GAAG,GAAI;AAAA,IAC3C,CAAC;AAED,UAAMK,IAAkB,SAAS,eAAe,cAAc,GACxDC,IAAgB,SAAS,eAAeZ,CAAE;AAEhD,QAAIW,KAAmBC,GAAe;AACpC,YAAMC,IAAQ,OAAO,iBAAiB,SAAS,eAAe,GACxDC,IAAc,WAAWD,EAAM,iBAAiB,aAAa,KAAK,GAAG,GACrEE,IAAW,WAAWF,EAAM,QAAQ,GACpCG,IAAeF,IAAcC,GAE7BE,IAAgBN,EAAgB,sBAAA,GAEhCO,IADaN,EAAc,sBAAA,EAEpB,MAAMK,EAAc,MAAMN,EAAgB,YAAYK;AAEnE,MAAAL,EAAgB,SAAS;AAAA,QACvB,KAAKO;AAAA,QACL,UAAU;AAAA,MAAA,CACX;AAAA,IACH;AAEA,YAAQ,aAAa,MAAM,IAAI,IAAIlB,CAAE,EAAE;AAAA,EACzC;AAEA,2BACGI,GAAA,EAAI,IAAAJ,GAAQ,WAAWmB,EAAG,4BAA4BhB,CAAS,GAC7D,UAAA;AAAA,IAAAD;AAAA,IACD,gBAAAkB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM,IAAIpB,CAAE;AAAA,QACZ,SAASQ;AAAA,QACT,WAAWW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,cAAY,WAAWnB,CAAE;AAAA,QACzB,OAAOK,IAAW,iBAAiB;AAAA,QAEnC,UAAA,gBAAAe;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YAEV,UAAA,gBAAAA,EAAC,QAAA,EAAK,GAAE,kWAAA,CAAkW;AAAA,UAAA;AAAA,QAAA;AAAA,MAC5W;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import m, { useState as k, useRef as w, useEffect as N } from "react";
|
|
3
|
+
import { cn as p } from "../../../utils/cn.js";
|
|
4
|
+
const x = m.createContext({
|
|
5
5
|
activeTab: 0,
|
|
6
6
|
setActiveTab: () => {
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
|
-
function E({ children: h, defaultTab: v = 0, defaultTabIndex: y, className: g, onClickTab:
|
|
10
|
-
const [
|
|
11
|
-
|
|
12
|
-
l.current = l.current.slice(0,
|
|
13
|
-
}, [
|
|
9
|
+
function E({ children: h, defaultTab: v = 0, defaultTabIndex: y, className: g, onClickTab: o, onChange: c }) {
|
|
10
|
+
const [s, b] = k(y ?? v), l = w([]), n = m.Children.toArray(h);
|
|
11
|
+
N(() => {
|
|
12
|
+
l.current = l.current.slice(0, n.length);
|
|
13
|
+
}, [n.length]);
|
|
14
14
|
const _ = (e, t) => {
|
|
15
15
|
var i;
|
|
16
|
-
let
|
|
16
|
+
let r = t;
|
|
17
17
|
switch (e.key) {
|
|
18
18
|
case "ArrowRight":
|
|
19
|
-
e.preventDefault(),
|
|
19
|
+
e.preventDefault(), r = (t + 1) % n.length;
|
|
20
20
|
break;
|
|
21
21
|
case "ArrowLeft":
|
|
22
|
-
e.preventDefault(),
|
|
22
|
+
e.preventDefault(), r = (t - 1 + n.length) % n.length;
|
|
23
23
|
break;
|
|
24
24
|
case "Home":
|
|
25
|
-
e.preventDefault(),
|
|
25
|
+
e.preventDefault(), r = 0;
|
|
26
26
|
break;
|
|
27
27
|
case "End":
|
|
28
|
-
e.preventDefault(),
|
|
28
|
+
e.preventDefault(), r = n.length - 1;
|
|
29
29
|
break;
|
|
30
30
|
default:
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
b(
|
|
33
|
+
b(r), (i = l.current[r]) == null || i.focus();
|
|
34
34
|
};
|
|
35
|
-
return /* @__PURE__ */ a(
|
|
35
|
+
return /* @__PURE__ */ a(x.Provider, { value: { activeTab: s, setActiveTab: b }, children: /* @__PURE__ */ u("div", { className: p("mint:my-6", g), children: [
|
|
36
36
|
/* @__PURE__ */ a(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
role: "tablist",
|
|
40
40
|
"aria-label": "Content tabs",
|
|
41
41
|
className: "mint:flex mint:gap-1 mint:border-b mint:border-gray-200 mint:mb-4 mint:overflow-x-auto mint:dark:border-b-gray-700",
|
|
42
|
-
children:
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
42
|
+
children: n.map((e, t) => {
|
|
43
|
+
if (!m.isValidElement(e)) return null;
|
|
44
|
+
const r = e.props.title || `Tab ${t + 1}`, i = e.props.icon, d = s === t;
|
|
45
45
|
return /* @__PURE__ */ a(
|
|
46
46
|
"button",
|
|
47
47
|
{
|
|
48
|
-
ref: (
|
|
49
|
-
l.current[t] =
|
|
48
|
+
ref: (f) => {
|
|
49
|
+
l.current[t] = f;
|
|
50
50
|
},
|
|
51
51
|
role: "tab",
|
|
52
52
|
"aria-selected": d,
|
|
@@ -54,16 +54,19 @@ function E({ children: h, defaultTab: v = 0, defaultTabIndex: y, className: g, o
|
|
|
54
54
|
id: `tab-${t}`,
|
|
55
55
|
tabIndex: d ? 0 : -1,
|
|
56
56
|
onClick: () => {
|
|
57
|
-
b(t),
|
|
57
|
+
b(t), o == null || o(t), c == null || c(t);
|
|
58
58
|
},
|
|
59
|
-
onKeyDown: (
|
|
60
|
-
className:
|
|
61
|
-
"mint:px-4 mint:py-2 mint:text-sm mint:font-medium mint:border-0 mint:border-b-2 mint:rounded-t mint:bg-transparent mint:cursor-pointer mint:
|
|
62
|
-
d ? "mint:border-b-[#
|
|
59
|
+
onKeyDown: (f) => _(f, t),
|
|
60
|
+
className: p(
|
|
61
|
+
"mint:px-4 mint:py-2 mint:text-sm mint:font-medium mint:border-0 mint:border-b-2 mint:rounded-t mint:bg-transparent mint:cursor-pointer mint:focus:outline-none mint:focus-visible:shadow-[0_0_0_2px_#fff,0_0_0_4px_#75b6e7] mint:focus-visible:outline-offset-2",
|
|
62
|
+
d ? "mint:border-b-[#8251ee] mint:text-[#242424] mint:dark:border-b-[#9263f1] mint:dark:text-[#ffffff] mint:font-semibold" : "mint:border-b-transparent mint:text-gray-600 mint:hover:text-gray-900 mint:hover:border-b-gray-300 mint:dark:text-gray-400 mint:dark:hover:text-gray-200 mint:dark:hover:border-b-gray-600"
|
|
63
63
|
),
|
|
64
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ u("span", { className: "mint:flex mint:items-center mint:gap-2", children: [
|
|
65
65
|
i && /* @__PURE__ */ a("span", { "aria-hidden": "true", children: i }),
|
|
66
|
-
|
|
66
|
+
/* @__PURE__ */ u("span", { className: "mint:relative", children: [
|
|
67
|
+
/* @__PURE__ */ a("span", { className: "mint:invisible mint:font-semibold", "aria-hidden": "true", children: r }),
|
|
68
|
+
/* @__PURE__ */ a("span", { className: "mint:absolute mint:inset-0", children: r })
|
|
69
|
+
] })
|
|
67
70
|
] })
|
|
68
71
|
},
|
|
69
72
|
t
|
|
@@ -71,19 +74,19 @@ function E({ children: h, defaultTab: v = 0, defaultTabIndex: y, className: g, o
|
|
|
71
74
|
})
|
|
72
75
|
}
|
|
73
76
|
),
|
|
74
|
-
/* @__PURE__ */ a("div", { children:
|
|
77
|
+
/* @__PURE__ */ a("div", { children: n.map((e, t) => /* @__PURE__ */ a(
|
|
75
78
|
"div",
|
|
76
79
|
{
|
|
77
80
|
role: "tabpanel",
|
|
78
81
|
id: `tabpanel-${t}`,
|
|
79
82
|
"aria-labelledby": `tab-${t}`,
|
|
80
83
|
tabIndex: 0,
|
|
81
|
-
hidden:
|
|
82
|
-
className:
|
|
84
|
+
hidden: s !== t,
|
|
85
|
+
className: p(
|
|
83
86
|
"mint:outline-none",
|
|
84
|
-
|
|
87
|
+
s !== t && "mint:hidden"
|
|
85
88
|
),
|
|
86
|
-
children:
|
|
89
|
+
children: m.isValidElement(e) ? e.props.children : null
|
|
87
90
|
},
|
|
88
91
|
t
|
|
89
92
|
)) })
|
|
@@ -91,6 +94,6 @@ function E({ children: h, defaultTab: v = 0, defaultTabIndex: y, className: g, o
|
|
|
91
94
|
}
|
|
92
95
|
export {
|
|
93
96
|
E as Tabs,
|
|
94
|
-
|
|
97
|
+
x as TabsContext
|
|
95
98
|
};
|
|
96
99
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sources":["../../../../src/components/content-components/tabs/tabs.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport { cn } from \"../../../utils/cn\";\n\ninterface TabsProps {\n children: React.ReactNode;\n defaultTab?: number;\n defaultTabIndex?: number;\n className?: string;\n onClickTab?: (index: number) => void;\n onChange?: (index: number) => void;\n}\n\ninterface TabsContextValue {\n activeTab: number;\n setActiveTab: (index: number) => void;\n}\n\nexport const TabsContext = React.createContext<TabsContextValue>({\n activeTab: 0,\n setActiveTab: () => {},\n});\n\nexport function Tabs({ children, defaultTab = 0, defaultTabIndex, className, onClickTab, onChange }: TabsProps) {\n const [activeTab, setActiveTab] = useState(defaultTabIndex ?? defaultTab);\n const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n const tabs = React.Children.toArray(children);\n\n useEffect(() => {\n tabRefs.current = tabRefs.current.slice(0, tabs.length);\n }, [tabs.length]);\n\n const handleKeyDown = (event: React.KeyboardEvent, currentIndex: number) => {\n let newIndex = currentIndex;\n\n switch (event.key) {\n case \"ArrowRight\":\n event.preventDefault();\n newIndex = (currentIndex + 1) % tabs.length;\n break;\n case \"ArrowLeft\":\n event.preventDefault();\n newIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n case \"Home\":\n event.preventDefault();\n newIndex = 0;\n break;\n case \"End\":\n event.preventDefault();\n newIndex = tabs.length - 1;\n break;\n default:\n return;\n }\n\n setActiveTab(newIndex);\n tabRefs.current[newIndex]?.focus();\n };\n\n return (\n <TabsContext.Provider value={{ activeTab, setActiveTab }}>\n <div className={cn(\"mint:my-6\", className)}>\n <div\n role=\"tablist\"\n aria-label=\"Content tabs\"\n className=\"mint:flex mint:gap-1 mint:border-b mint:border-gray-200 mint:mb-4 mint:overflow-x-auto mint:dark:border-b-gray-700\"\n >\n {tabs.map((tab, index) => {\n if (!React.isValidElement(tab)) return null;\n const title = tab.props.title || `Tab ${index + 1}`;\n const icon = tab.props.icon;\n const isActive = activeTab === index;\n\n return (\n <button\n key={index}\n ref={(el) => {tabRefs.current[index] = el}}\n role=\"tab\"\n aria-selected={isActive}\n aria-controls={`tabpanel-${index}`}\n id={`tab-${index}`}\n tabIndex={isActive ? 0 : -1}\n onClick={() => {\n setActiveTab(index);\n onClickTab?.(index);\n onChange?.(index);\n }}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={cn(\n \"mint:px-4 mint:py-2 mint:text-sm mint:font-medium mint:border-0 mint:border-b-2 mint:rounded-t mint:bg-transparent mint:cursor-pointer mint:
|
|
1
|
+
{"version":3,"file":"tabs.js","sources":["../../../../src/components/content-components/tabs/tabs.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport { cn } from \"../../../utils/cn\";\n\ninterface TabsProps {\n children: React.ReactNode;\n defaultTab?: number;\n defaultTabIndex?: number;\n className?: string;\n onClickTab?: (index: number) => void;\n onChange?: (index: number) => void;\n}\n\ninterface TabsContextValue {\n activeTab: number;\n setActiveTab: (index: number) => void;\n}\n\nexport const TabsContext = React.createContext<TabsContextValue>({\n activeTab: 0,\n setActiveTab: () => {},\n});\n\nexport function Tabs({ children, defaultTab = 0, defaultTabIndex, className, onClickTab, onChange }: TabsProps) {\n const [activeTab, setActiveTab] = useState(defaultTabIndex ?? defaultTab);\n const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n const tabs = React.Children.toArray(children);\n\n useEffect(() => {\n tabRefs.current = tabRefs.current.slice(0, tabs.length);\n }, [tabs.length]);\n\n const handleKeyDown = (event: React.KeyboardEvent, currentIndex: number) => {\n let newIndex = currentIndex;\n\n switch (event.key) {\n case \"ArrowRight\":\n event.preventDefault();\n newIndex = (currentIndex + 1) % tabs.length;\n break;\n case \"ArrowLeft\":\n event.preventDefault();\n newIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n case \"Home\":\n event.preventDefault();\n newIndex = 0;\n break;\n case \"End\":\n event.preventDefault();\n newIndex = tabs.length - 1;\n break;\n default:\n return;\n }\n\n setActiveTab(newIndex);\n tabRefs.current[newIndex]?.focus();\n };\n\n return (\n <TabsContext.Provider value={{ activeTab, setActiveTab }}>\n <div className={cn(\"mint:my-6\", className)}>\n <div\n role=\"tablist\"\n aria-label=\"Content tabs\"\n className=\"mint:flex mint:gap-1 mint:border-b mint:border-gray-200 mint:mb-4 mint:overflow-x-auto mint:dark:border-b-gray-700\"\n >\n {tabs.map((tab, index) => {\n if (!React.isValidElement(tab)) return null;\n const title = tab.props.title || `Tab ${index + 1}`;\n const icon = tab.props.icon;\n const isActive = activeTab === index;\n\n return (\n <button\n key={index}\n ref={(el) => {tabRefs.current[index] = el}}\n role=\"tab\"\n aria-selected={isActive}\n aria-controls={`tabpanel-${index}`}\n id={`tab-${index}`}\n tabIndex={isActive ? 0 : -1}\n onClick={() => {\n setActiveTab(index);\n onClickTab?.(index);\n onChange?.(index);\n }}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={cn(\n \"mint:px-4 mint:py-2 mint:text-sm mint:font-medium mint:border-0 mint:border-b-2 mint:rounded-t mint:bg-transparent mint:cursor-pointer mint:focus:outline-none mint:focus-visible:shadow-[0_0_0_2px_#fff,0_0_0_4px_#75b6e7] mint:focus-visible:outline-offset-2\",\n isActive\n ? \"mint:border-b-[#8251ee] mint:text-[#242424] mint:dark:border-b-[#9263f1] mint:dark:text-[#ffffff] mint:font-semibold\"\n : \"mint:border-b-transparent mint:text-gray-600 mint:hover:text-gray-900 mint:hover:border-b-gray-300 mint:dark:text-gray-400 mint:dark:hover:text-gray-200 mint:dark:hover:border-b-gray-600\"\n )}\n >\n <span className=\"mint:flex mint:items-center mint:gap-2\">\n {icon && <span aria-hidden=\"true\">{icon}</span>}\n <span className=\"mint:relative\">\n <span className=\"mint:invisible mint:font-semibold\" aria-hidden=\"true\">\n {title}\n </span>\n <span className=\"mint:absolute mint:inset-0\">\n {title}\n </span>\n </span>\n </span>\n </button>\n );\n })}\n </div>\n\n <div>\n {tabs.map((tab, index) => (\n <div\n key={index}\n role=\"tabpanel\"\n id={`tabpanel-${index}`}\n aria-labelledby={`tab-${index}`}\n tabIndex={0}\n hidden={activeTab !== index}\n className={cn(\n \"mint:outline-none\",\n activeTab !== index && \"mint:hidden\"\n )}\n >\n {React.isValidElement(tab) ? tab.props.children : null}\n </div>\n ))}\n </div>\n </div>\n </TabsContext.Provider>\n );\n}\n"],"names":["TabsContext","React","Tabs","children","defaultTab","defaultTabIndex","className","onClickTab","onChange","activeTab","setActiveTab","useState","tabRefs","useRef","tabs","useEffect","handleKeyDown","event","currentIndex","newIndex","_a","jsx","cn","tab","index","title","icon","isActive","el","e","jsxs"],"mappings":"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"}
|