fumadocs-openapi 9.7.2 → 10.0.0

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.
Files changed (148) hide show
  1. package/dist/generate-file.d.ts +3 -4
  2. package/dist/generate-file.d.ts.map +1 -1
  3. package/dist/generate-file.js +4 -34
  4. package/dist/playground/client.d.ts +43 -22
  5. package/dist/playground/client.d.ts.map +1 -1
  6. package/dist/playground/client.js +68 -63
  7. package/dist/playground/{inputs.d.ts → components/inputs.d.ts} +1 -1
  8. package/dist/playground/components/inputs.d.ts.map +1 -0
  9. package/dist/playground/{inputs.js → components/inputs.js} +7 -7
  10. package/dist/playground/components/oauth-dialog.d.ts.map +1 -0
  11. package/dist/playground/components/server-select.d.ts.map +1 -0
  12. package/dist/{ui → playground/components}/server-select.js +6 -7
  13. package/dist/playground/index.d.ts +1 -4
  14. package/dist/playground/index.d.ts.map +1 -1
  15. package/dist/playground/index.js +5 -3
  16. package/dist/playground/lazy.d.ts +2 -0
  17. package/dist/playground/lazy.d.ts.map +1 -0
  18. package/dist/playground/lazy.js +3 -0
  19. package/dist/requests/generators/index.d.ts +2 -2
  20. package/dist/requests/generators/index.d.ts.map +1 -1
  21. package/dist/requests/generators/index.js +6 -0
  22. package/dist/requests/media/adapter.d.ts +0 -6
  23. package/dist/requests/media/adapter.d.ts.map +1 -1
  24. package/dist/scalar/index.d.ts +5 -0
  25. package/dist/scalar/index.d.ts.map +1 -1
  26. package/dist/scalar/index.js +14 -0
  27. package/dist/server/create.d.ts +11 -59
  28. package/dist/server/create.d.ts.map +1 -1
  29. package/dist/server/create.js +5 -14
  30. package/dist/server/source-api.d.ts +1 -1
  31. package/dist/server/source-api.d.ts.map +1 -1
  32. package/dist/server/source-api.js +1 -1
  33. package/dist/types.d.ts +12 -4
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/ui/api-page.d.ts +145 -0
  36. package/dist/ui/api-page.d.ts.map +1 -0
  37. package/dist/ui/api-page.js +120 -0
  38. package/dist/ui/client/index.d.ts +29 -0
  39. package/dist/ui/client/index.d.ts.map +1 -0
  40. package/dist/ui/client/index.js +4 -0
  41. package/dist/ui/client/storage-key.d.ts +9 -0
  42. package/dist/ui/client/storage-key.d.ts.map +1 -0
  43. package/dist/ui/client/storage-key.js +12 -0
  44. package/dist/ui/components/method-label.d.ts +1 -1
  45. package/dist/ui/contexts/api.d.ts +12 -10
  46. package/dist/ui/contexts/api.d.ts.map +1 -1
  47. package/dist/ui/contexts/api.js +53 -37
  48. package/dist/ui/contexts/api.lazy.d.ts +2 -0
  49. package/dist/ui/contexts/api.lazy.d.ts.map +1 -0
  50. package/dist/ui/contexts/api.lazy.js +3 -0
  51. package/dist/ui/contexts/operation.d.ts +20 -0
  52. package/dist/ui/contexts/operation.d.ts.map +1 -0
  53. package/dist/ui/contexts/operation.js +48 -0
  54. package/dist/ui/contexts/operation.lazy.d.ts +2 -0
  55. package/dist/ui/contexts/operation.lazy.d.ts.map +1 -0
  56. package/dist/ui/contexts/operation.lazy.js +3 -0
  57. package/dist/ui/index.d.ts +1 -8
  58. package/dist/ui/index.d.ts.map +1 -1
  59. package/dist/ui/index.js +1 -26
  60. package/dist/ui/{select-tabs.d.ts → operation/client.d.ts} +5 -2
  61. package/dist/ui/operation/client.d.ts.map +1 -0
  62. package/dist/ui/{client.js → operation/client.js} +18 -1
  63. package/dist/ui/operation/example-panel/client.d.ts +4 -0
  64. package/dist/ui/operation/example-panel/client.d.ts.map +1 -0
  65. package/dist/ui/operation/example-panel/client.js +50 -0
  66. package/dist/ui/operation/example-panel/index.d.ts +58 -0
  67. package/dist/ui/operation/example-panel/index.d.ts.map +1 -0
  68. package/dist/ui/operation/example-panel/index.js +140 -0
  69. package/dist/ui/operation/example-panel/lazy.d.ts +3 -0
  70. package/dist/ui/operation/example-panel/lazy.d.ts.map +1 -0
  71. package/dist/ui/operation/example-panel/lazy.js +4 -0
  72. package/dist/ui/operation/get-request-data.d.ts.map +1 -0
  73. package/dist/ui/operation/index.d.ts +11 -0
  74. package/dist/ui/operation/index.d.ts.map +1 -0
  75. package/dist/{render → ui}/operation/index.js +50 -24
  76. package/dist/ui/schema/client.d.ts +11 -0
  77. package/dist/ui/schema/client.d.ts.map +1 -0
  78. package/dist/{render → ui}/schema/client.js +22 -12
  79. package/dist/{render/schema/server.d.ts → ui/schema/index.d.ts} +5 -4
  80. package/dist/ui/schema/index.d.ts.map +1 -0
  81. package/dist/{render/schema/server.js → ui/schema/index.js} +11 -5
  82. package/dist/ui/schema/lazy.d.ts +2 -0
  83. package/dist/ui/schema/lazy.d.ts.map +1 -0
  84. package/dist/ui/schema/lazy.js +3 -0
  85. package/dist/utils/get-typescript-schema.d.ts +3 -2
  86. package/dist/utils/get-typescript-schema.d.ts.map +1 -1
  87. package/dist/utils/get-typescript-schema.js +12 -7
  88. package/dist/utils/lazy.d.ts +5 -0
  89. package/dist/utils/lazy.d.ts.map +1 -0
  90. package/dist/utils/lazy.js +12 -0
  91. package/dist/utils/pages/builder.d.ts +1 -1
  92. package/dist/utils/pages/builder.d.ts.map +1 -1
  93. package/dist/utils/pages/to-body.d.ts +2 -3
  94. package/dist/utils/pages/to-body.d.ts.map +1 -1
  95. package/dist/utils/pages/to-body.js +7 -7
  96. package/dist/utils/pages/to-text.d.ts.map +1 -1
  97. package/dist/utils/process-document.d.ts +1 -0
  98. package/dist/utils/process-document.d.ts.map +1 -1
  99. package/dist/utils/process-document.js +7 -2
  100. package/package.json +18 -14
  101. package/dist/playground/auth/oauth-dialog.d.ts.map +0 -1
  102. package/dist/playground/inputs.d.ts.map +0 -1
  103. package/dist/render/api-page.d.ts +0 -33
  104. package/dist/render/api-page.d.ts.map +0 -1
  105. package/dist/render/api-page.js +0 -59
  106. package/dist/render/codeblock.d.ts +0 -9
  107. package/dist/render/codeblock.d.ts.map +0 -1
  108. package/dist/render/codeblock.js +0 -14
  109. package/dist/render/heading.d.ts +0 -4
  110. package/dist/render/heading.d.ts.map +0 -1
  111. package/dist/render/heading.js +0 -6
  112. package/dist/render/markdown.d.ts +0 -5
  113. package/dist/render/markdown.d.ts.map +0 -1
  114. package/dist/render/markdown.js +0 -31
  115. package/dist/render/operation/api-example.d.ts +0 -30
  116. package/dist/render/operation/api-example.d.ts.map +0 -1
  117. package/dist/render/operation/api-example.js +0 -103
  118. package/dist/render/operation/get-request-data.d.ts.map +0 -1
  119. package/dist/render/operation/index.d.ts +0 -27
  120. package/dist/render/operation/index.d.ts.map +0 -1
  121. package/dist/render/renderer.d.ts +0 -79
  122. package/dist/render/renderer.d.ts.map +0 -1
  123. package/dist/render/renderer.js +0 -25
  124. package/dist/render/schema/client.d.ts +0 -18
  125. package/dist/render/schema/client.d.ts.map +0 -1
  126. package/dist/render/schema/index.d.ts +0 -7
  127. package/dist/render/schema/index.d.ts.map +0 -1
  128. package/dist/render/schema/index.js +0 -11
  129. package/dist/render/schema/server.d.ts.map +0 -1
  130. package/dist/render/schema/ui.d.ts +0 -16
  131. package/dist/render/schema/ui.d.ts.map +0 -1
  132. package/dist/render/schema/ui.js +0 -14
  133. package/dist/ui/client.d.ts +0 -4
  134. package/dist/ui/client.d.ts.map +0 -1
  135. package/dist/ui/contexts/code-example.d.ts +0 -24
  136. package/dist/ui/contexts/code-example.d.ts.map +0 -1
  137. package/dist/ui/contexts/code-example.js +0 -97
  138. package/dist/ui/lazy.d.ts +0 -16
  139. package/dist/ui/lazy.d.ts.map +0 -1
  140. package/dist/ui/lazy.js +0 -22
  141. package/dist/ui/select-tabs.d.ts.map +0 -1
  142. package/dist/ui/select-tabs.js +0 -20
  143. package/dist/ui/server-select.d.ts.map +0 -1
  144. /package/dist/playground/{auth → components}/oauth-dialog.d.ts +0 -0
  145. /package/dist/playground/{auth → components}/oauth-dialog.js +0 -0
  146. /package/dist/{ui → playground/components}/server-select.d.ts +0 -0
  147. /package/dist/{render → ui}/operation/get-request-data.d.ts +0 -0
  148. /package/dist/{render → ui}/operation/get-request-data.js +0 -0
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
3
- import { cn } from 'fumadocs-ui/utils/cn';
4
- import { buttonVariants } from 'fumadocs-ui/components/ui/button';
5
- import { ChevronDown } from 'fumadocs-ui/internal/icons';
6
- import { Badge } from '../../ui/components/method-label.js';
7
- export function ObjectCollapsible(props) {
8
- return (_jsxs(Collapsible, { className: "my-2", ...props, children: [_jsxs(CollapsibleTrigger, { className: cn(buttonVariants({ color: 'secondary', size: 'sm' }), 'group px-3 py-2 data-[state=open]:rounded-b-none'), children: [props.name, _jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { className: "-mt-px *:bg-fd-card", children: props.children })] }));
9
- }
10
- export function Property({ name, type, required, deprecated, nested = false, ...props }) {
11
- return (_jsxs("div", { className: cn('text-sm border-t', nested
12
- ? 'p-3 border-x bg-fd-card last:rounded-b-xl first:rounded-tr-xl last:border-b'
13
- : 'py-4 first:border-t-0', props.className), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-3 not-prose", children: [_jsxs("span", { className: "font-medium font-mono text-fd-primary", children: [name, required === false && (_jsx("span", { className: "text-fd-muted-foreground", children: "?" }))] }), typeof type === 'string' ? (_jsx("span", { className: "text-sm font-mono text-fd-muted-foreground", children: type })) : (type), deprecated && (_jsx(Badge, { color: "yellow", className: "ms-auto text-xs", children: "Deprecated" }))] }), _jsx("div", { className: "prose-no-margin pt-2.5 empty:hidden", children: props.children })] }));
14
- }
@@ -1,4 +0,0 @@
1
- export declare function CopyResponseTypeScript({ code }: {
2
- code: string;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/ui/client.tsx"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAgChE"}
@@ -1,24 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { CodeSample } from '../../render/operation/index.js';
3
- import type { SamplesProps } from '../../render/renderer.js';
4
- import type { RawRequestData, RequestData } from '../../requests/types.js';
5
- export declare function CodeExampleProvider({ route, examples, initialKey, children, }: {
6
- route: string;
7
- examples: {
8
- key: string;
9
- data: RawRequestData;
10
- encoded: RequestData;
11
- }[];
12
- initialKey?: string;
13
- children: ReactNode;
14
- }): import("react/jsx-runtime").JSX.Element;
15
- export declare function CodeExample(sample: CodeSample): import("react/jsx-runtime").JSX.Element | null;
16
- export declare function CodeExampleSelector({ items }: SamplesProps): import("react/jsx-runtime").JSX.Element;
17
- export declare function useRequestInitialData(): {
18
- key: string;
19
- data: RawRequestData;
20
- };
21
- export declare function useRequestDataUpdater(): {
22
- setData: (data: RawRequestData, encoded: RequestData) => void;
23
- };
24
- //# sourceMappingURL=code-example.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-example.d.ts","sourceRoot":"","sources":["../../../src/ui/contexts/code-example.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AActD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAmBpE,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,cAAc,CAAC;QACrB,OAAO,EAAE,WAAW,CAAC;KACtB,EAAE,CAAC;IACJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CA6DA;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,kDA2C7C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,2CAoB1D;AAgBD,wBAAgB,qBAAqB;;;EAIpC;AAED,wBAAgB,qBAAqB;oBA1KnB,cAAc,WAAW,WAAW,KAAK,IAAI;EA6K9D"}
@@ -1,97 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
4
- import { useApiContext, useServerSelectContext } from '../../ui/contexts/api.js';
5
- import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';
6
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../../ui/components/select.js';
7
- import { joinURL, resolveRequestData, resolveServerUrl, withBase, } from '../../utils/url.js';
8
- const CodeExampleContext = createContext(null);
9
- export function CodeExampleProvider({ route, examples, initialKey, children, }) {
10
- const [key, setKey] = useState(initialKey ?? examples[0].key);
11
- const listeners = useRef([]);
12
- const examplesRef = useRef(examples);
13
- examplesRef.current = examples;
14
- return (_jsx(CodeExampleContext, { value: useMemo(() => ({
15
- key,
16
- route,
17
- setKey: (newKey) => {
18
- const example = examplesRef.current.find((example) => example.key === newKey);
19
- if (!example)
20
- return;
21
- setKey(newKey);
22
- for (const listener of listeners.current) {
23
- listener(example.data, example.encoded);
24
- }
25
- },
26
- getExample: (key) => {
27
- return examplesRef.current.find((example) => example.key === key);
28
- },
29
- setData: (data, encoded) => {
30
- for (const example of examplesRef.current) {
31
- if (example.key === key) {
32
- // persistent changes
33
- example.data = data;
34
- example.encoded = encoded;
35
- break;
36
- }
37
- }
38
- for (const listener of listeners.current) {
39
- listener(data, encoded);
40
- }
41
- },
42
- removeListener: (listener) => {
43
- listeners.current = listeners.current.filter((item) => item !== listener);
44
- },
45
- addListener: (listener) => {
46
- // initial call to listeners to ensure their data is the latest
47
- // this is necessary to avoid race conditions between `useEffect()`
48
- const example = examplesRef.current.find((example) => example.key === key);
49
- listener(example.data, example.encoded);
50
- listeners.current.push(listener);
51
- },
52
- }), [key, route]), children: children }));
53
- }
54
- export function CodeExample(sample) {
55
- const { shikiOptions, mediaAdapters } = useApiContext();
56
- const { getExample, key, route, addListener, removeListener } = useContext(CodeExampleContext);
57
- const { server } = useServerSelectContext();
58
- const [data, setData] = useState(() => getExample(key).encoded);
59
- useEffect(() => {
60
- const listener = (_, encoded) => setData(encoded);
61
- addListener(listener);
62
- return () => {
63
- removeListener(listener);
64
- };
65
- }, [addListener, removeListener]);
66
- const code = useMemo(() => {
67
- if (!sample.source)
68
- return;
69
- if (typeof sample.source === 'string')
70
- return sample.source;
71
- return sample.source(joinURL(withBase(server ? resolveServerUrl(server.url, server.variables) : '/', typeof window !== 'undefined'
72
- ? window.location.origin
73
- : 'https://loading'), resolveRequestData(route, data)), data, {
74
- server: sample.serverContext,
75
- mediaAdapters,
76
- });
77
- }, [mediaAdapters, sample, server, route, data]);
78
- if (!code || !sample)
79
- return null;
80
- return (_jsx(DynamicCodeBlock, { lang: sample.lang, code: code, options: shikiOptions }));
81
- }
82
- export function CodeExampleSelector({ items }) {
83
- const { key, setKey } = useContext(CodeExampleContext);
84
- const item = items.find((item) => item.value === key);
85
- return (_jsxs(Select, { value: key, onValueChange: setKey, children: [_jsx(SelectTrigger, { className: "not-prose mb-2", children: _jsx(SelectValue, { asChild: true, children: item ? _jsx(SelectDisplay, { item: item }) : null }) }), _jsx(SelectContent, { children: items.map((item) => (_jsx(SelectItem, { value: item.value, children: _jsx(SelectDisplay, { item: item }) }, item.value))) })] }));
86
- }
87
- function SelectDisplay({ item, ...props }) {
88
- return (_jsxs("div", { ...props, children: [_jsx("span", { className: "font-medium text-sm", children: item.title }), _jsx("span", { className: "text-fd-muted-foreground", children: item.description })] }));
89
- }
90
- export function useRequestInitialData() {
91
- const { getExample, key } = useContext(CodeExampleContext);
92
- return { key, data: getExample(key).data };
93
- }
94
- export function useRequestDataUpdater() {
95
- const { setData } = useContext(CodeExampleContext);
96
- return { setData };
97
- }
package/dist/ui/lazy.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { JSX } from 'react/jsx-runtime';
2
- export declare const CodeExampleProvider: (props: {
3
- route: string;
4
- examples: {
5
- key: string;
6
- data: import("../requests/types.js").RawRequestData;
7
- encoded: import("../requests/types.js").RequestData;
8
- }[];
9
- initialKey?: string;
10
- children: import("react").ReactNode;
11
- }) => JSX.Element;
12
- export declare const CodeExample: (props: import("../render/operation/index.js").CodeSample<unknown>) => JSX.Element;
13
- export declare const CodeExampleSelector: (props: import("../render/renderer.js").SamplesProps) => JSX.Element;
14
- export declare const ClientLazy: (props: import("../playground/client.js").ClientProps) => JSX.Element;
15
- export declare const ApiProvider: (props: import("./contexts/api.js").ApiProviderProps) => JSX.Element;
16
- //# sourceMappingURL=lazy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/ui/lazy.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAW7C,eAAO,MAAM,mBAAmB;;;;;;;;;iBAM/B,CAAC;AAEF,eAAO,MAAM,WAAW,2EAMvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mEAM/B,CAAC;AAEF,eAAO,MAAM,UAAU,mEAAkD,CAAC;AAE1E,eAAO,MAAM,WAAW,mEAIvB,CAAC"}
package/dist/ui/lazy.js DELETED
@@ -1,22 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { lazy } from 'react';
4
- // Waku wraps all export functions of a "use client" file in `React.lazy`, but `lazy(lazy(() => ...))` causes error.
5
- // we wrap another layer of component such that it is valid
6
- // TODO: perhaps we can remove it once Waku migrated to vite-rsc
7
- function wrap(V) {
8
- return function wrapper(props) {
9
- return _jsx(V, { ...props });
10
- };
11
- }
12
- export const CodeExampleProvider = wrap(lazy(() => import('./contexts/code-example.js').then((mod) => ({
13
- default: mod.CodeExampleProvider,
14
- }))));
15
- export const CodeExample = wrap(lazy(() => import('./contexts/code-example.js').then((mod) => ({
16
- default: mod.CodeExample,
17
- }))));
18
- export const CodeExampleSelector = wrap(lazy(() => import('./contexts/code-example.js').then((mod) => ({
19
- default: mod.CodeExampleSelector,
20
- }))));
21
- export const ClientLazy = wrap(lazy(() => import('../playground/client.js')));
22
- export const ApiProvider = wrap(lazy(() => import('./contexts/api.js').then((mod) => ({ default: mod.ApiProvider }))));
@@ -1 +0,0 @@
1
- {"version":3,"file":"select-tabs.d.ts","sourceRoot":"","sources":["../../src/ui/select-tabs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,aAAa,EAEd,MAAM,wBAAwB,CAAC;AAQhC,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAQA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;CACf,uDAKA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,2CAoB5D"}
@@ -1,20 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useMemo, useState, } from 'react';
4
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select.js';
5
- import { cn } from 'fumadocs-ui/utils/cn';
6
- const Context = createContext(null);
7
- export function SelectTabs({ defaultValue, children, }) {
8
- const [type, setType] = useState(defaultValue ?? null);
9
- return (_jsx(Context, { value: useMemo(() => ({ type, setType }), [type]), children: children }));
10
- }
11
- export function SelectTab({ value, ...props }) {
12
- const ctx = useContext(Context);
13
- if (value !== ctx?.type)
14
- return;
15
- return _jsx("div", { ...props, children: props.children });
16
- }
17
- export function SelectTabTrigger({ items, ...props }) {
18
- const { type, setType } = useContext(Context);
19
- return (_jsxs(Select, { value: type ?? '', onValueChange: setType, children: [_jsx(SelectTrigger, { ...props, className: cn('not-prose w-fit', props.className), children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: items.map((type) => (_jsx(SelectItem, { value: type, children: type }, type))) })] }));
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-select.d.ts","sourceRoot":"","sources":["../../src/ui/server-select.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,OAAO,CAAC;AAgBjE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,uDAwDzE"}