@fumadocs/api-docs 0.0.3 → 0.1.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.
- package/css/generated/shared.css +1 -1
- package/dist/components/accordion.d.ts +9 -6
- package/dist/components/accordion.js +16 -12
- package/dist/components/collapsible.d.ts +16 -0
- package/dist/components/collapsible.js +16 -0
- package/dist/components/dialog.d.ts +9 -9
- package/dist/components/dialog.js +12 -12
- package/dist/components/input.d.ts +8 -3
- package/dist/components/input.js +3 -4
- package/dist/components/playground/inputs.js +42 -30
- package/dist/components/popover.d.ts +15 -0
- package/dist/components/popover.js +23 -0
- package/dist/components/schema/client.js +34 -32
- package/dist/components/select-tab.js +3 -5
- package/dist/components/select.d.ts +46 -12
- package/dist/components/select.js +78 -66
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +2 -2
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
- package/dist/ref-parser/bundle.d.ts +10 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/bundle.js +76 -6
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/normalize-args.js +2 -2
- package/dist/ref-parser/options.d.ts +28 -0
- package/dist/ref-parser/options.js +27 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parse.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/json.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/yaml.js +6 -12
- package/dist/ref-parser/pointer.d.ts +1 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/pointer.js +16 -54
- package/dist/ref-parser/ref.d.ts +1 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/ref.js +7 -49
- package/dist/ref-parser/refs.d.ts +1 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/refs.js +4 -41
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolve-external.js +3 -3
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolvers/file.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/types/index.d.ts +8 -40
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/convert-path-to-posix.js +1 -1
- package/dist/ref-parser/util/errors.d.ts +1 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/errors.js +16 -34
- package/dist/ref-parser/util/is-windows.js +5 -0
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/maybe.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/next.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/plugins.js +1 -1
- package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/schema-resources.js +1 -1
- package/dist/ref-parser/util/url.js +206 -0
- package/dist/schema/bundle.d.ts +1 -1
- package/dist/schema/bundle.js +1 -1
- package/dist/schema/ref.d.ts +3 -1
- package/dist/schema/ref.js +1 -1
- package/dist/schema/sample.js +5 -7
- package/dist/utils/cn.js +1 -1
- package/dist/utils/deep-merge.js +8 -0
- package/package.json +12 -14
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +0 -157
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +0 -166
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +0 -96
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +0 -190
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +0 -134
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -121
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +0 -34
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
- package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -381
package/css/generated/shared.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@source inline("!isDefined *:data-[collapsible=true]:order-last *:min-w-0 --
|
|
1
|
+
@source inline("!isDefined *:data-[collapsible=true]:order-last *:min-w-0 --anchor-width --available-height --available-width --collapsible-panel-height --min-height --transform-origin -mx-3 -translate-x-1/2 -translate-y-1/2 @container @default @fuma-translate/react @fumari/stf @md:grid-cols-2 @param [&[hidden]:not([hidden='until-found'])]:hidden [&_svg]:size-3.5 a absolute accordion actual additionalProperties again ajv aliasName align allOf always an anchor anchorIdStartsWith anchorSegments and animate-spin any anyFields anyOf applicable aria-label array as asSchema autoIds avoid backdrop-blur-lg backdrop-blur-sm be behavior bg-black/30 bg-fd-background/50 bg-fd-muted bg-fd-popover bg-fd-popover/60 bg-fd-primary bg-fd-secondary binary block blocks body boolean border border-b border-fd-primary/20 border-t both bottom button buttonVariants catch center children class-variance-authority className client clientHeight closed cn code col-span-full collapsible color const content createContext ctx current currentValue cva dark:text-yellow-400 data-[closed]:animate-fd-popover-out data-[disabled]:opacity-50 data-[disabled]:pointer-events-none data-[ending-style]:animate-fd-accordion-up data-[highlighted]:bg-fd-accent data-[highlighted]:text-fd-accent-foreground data-[open]:animate-fd-popover-in data-[popup-open]:text-fd-accent-foreground data-[starting-style]:animate-fd-accordion-down data-closed:animate-fd-dialog-out data-closed:animate-fd-fade-out data-collapsible data-ending-style:h-0 data-ending-style:opacity-0 data-object-search-input data-open:animate-fd-dialog-in data-open:animate-fd-fade-in data-placeholder:text-fd-muted-foreground data-starting-style:h-0 data-starting-style:opacity-0 dataEngine decoded default defaultCode defaultValue deferredValue define delete deprecated depth dereference dereferenceShallow dereferenced description disabled:cursor-not-allowed disabled:opacity-50 display div doc docRoot duplicated duration-200 dynamic element else empty empty:hidden end end-2 engine ensure enum example examples exclusiveMax exclusiveMin export extends fallback false fd-scroll-container field fieldData fieldLabelVariants fieldName fields file files filtered first first:border-t-0 firstItemRef fixed flex flex-1 flex-col flex-col-reverse flex-row flex-wrap focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring focus-within:[&_svg]:text-fd-primary focus-within:ring-2 focus-within:ring-fd-ring focus:outline-none focus:ring focus:ring-fd-ring font-medium font-mono font-semibold for format from function gap-0.5 gap-1 gap-1.5 gap-2 gap-4 generate generateDefault generated ghost grid grid-cols-1 group-data-[panel-open]/accordion:rotate-90 group/accordion h-(--collapsible-panel-height) h-10 h-9 h-[240px] h-px hash hidden hiddenProperties highlighted hook hover:bg-fd-accent hover:text-fd-accent-foreground hover:underline htmlFor i icon-sm icon-xs id idx if ignore import in in-popover include index indexItemMatch info infoTags initial inline-flex inlines input inset-0 instanceof integer interface invalid is isDefined isDuplicated isDynamic isLazy isNumber isRequired it item itemId items items-center j json justify-center key kind label labelVariants lang last:border-b-0 lazy leading-none left-1/2 length let line-through list-disc list-inside lucide-react marker:text-fd-muted-foreground matching max max-h-(--available-height) max-h-[460px] max-w-(--available-width) max-w-[98vw] max-w-full max-w-lg mb-auto md me-auto members merge mergeAllOf mergeRefs min min-h-(--min-height,200px) min-w-(--anchor-width) min-w-0 min-w-[240px] ms-auto mt-2 multiple must mx-1 my-1 my-2 my-2! name namespace nested never new next node not-prose note null number object objectSearchOverrides objects of omit onChange onClick onKeyDown onOpenChange onScrollEnd onValueChange oneOf only opacity-80 open opts or order-last origin-(--transform-origin) out outline outline-none overflow-hidden overflow-x-auto overflow-y-auto overflow-y-hidden overview p-1 p-1.5 p-2 p-4 param parentItem parentPathIndex part path pathIndex pathName pattern patternProperties pb-0 pe-2 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 placeholder placeholder:text-fd-muted-foreground playground popover popoverRef prev preventScroll primitive prop properties property props prose-no-margin ps-1 ps-2 ps-3 ps-6 pt-0 px px-2 px-3 px-4 py-0 py-1 py-1.5 py-2 py-4 querySelector quiet range raw rawRef rawSearch re-triggering react read readOnly ref refs remove removeItem render renderCodeblock renderMarkdown renderTypeInfoTrigger represents required resize-none resolver return role root rootId rotate-90 rounded-lg rounded-md rounded-sm rounded-xl s-highlight same sample satisfies schema schemaPropKeys schemaToString scroll scroll-m-20 scrollTop search secondary section segments select-none selected selectedType sep setError setInfo setNextName setPath setSearch setShow setValue shadow-lg shadow-md shadow-sm show showExample showSelect shrink-0 side sideOffset simplified single size size-3.5 size-4 skipNonRequired skipReadOnly slotType sm sm:flex-row sm:gap-2 sm:justify-end sm:text-start smooth stable start states status step stf sticky store strict string stringifyFieldKey such svg t tab tabDepth tabValues tags target text text-[0.8125rem] text-center text-end text-fd-foreground text-fd-muted-foreground text-fd-muted-foreground/70 text-fd-popover-foreground text-fd-primary text-fd-primary-foreground text-fd-secondary-foreground text-lg text-orange-400 text-red-400 text-red-400/80 text-sm text-start text-xs text-yellow-600 that the tiem to toolbar top top-0 top-1/2 top-10 top-2 tracking-tight transition-[height,opacity] transition-colors transition-transform translations trigger true truncate try type typeName typeVariants typeof types undefined underline union unionField unknown updateInfo updated url use useAnchorId useCopyButton useFieldValue useMemo useNamespace useObject useRef useState useTranslations v validateFormats validateSchema value valueSchema values variant variants w-0 w-[600px] w-fit w-full will with wrap-break-word write writeOnly x-playground-lazy z-20 z-50");
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
3
3
|
|
|
4
4
|
//#region src/components/accordion.d.ts
|
|
5
5
|
declare function Accordions({
|
|
6
6
|
type,
|
|
7
7
|
defaultValue,
|
|
8
8
|
...props
|
|
9
|
-
}: Omit<ComponentProps<typeof
|
|
9
|
+
}: Omit<ComponentProps<typeof Accordion.Root>, 'value' | 'defaultValue' | 'onValueChange'> & {
|
|
10
|
+
type?: 'single' | 'multiple';
|
|
11
|
+
defaultValue?: string | string[];
|
|
12
|
+
}): import("react").JSX.Element;
|
|
10
13
|
declare function AccordionItem({
|
|
11
14
|
value,
|
|
12
15
|
className,
|
|
13
16
|
anchorSegments,
|
|
14
17
|
...props
|
|
15
|
-
}: ComponentProps<typeof
|
|
18
|
+
}: ComponentProps<typeof Accordion.Item> & {
|
|
16
19
|
/** define the accordion as an anchor section */anchorSegments?: string[];
|
|
17
20
|
}): import("react").JSX.Element;
|
|
18
|
-
declare function AccordionContent(props: ComponentProps<typeof
|
|
19
|
-
declare function AccordionHeader(props: ComponentProps<typeof
|
|
20
|
-
declare function AccordionTrigger(props: ComponentProps<typeof
|
|
21
|
+
declare function AccordionContent(props: ComponentProps<typeof Accordion.Panel>): import("react").JSX.Element;
|
|
22
|
+
declare function AccordionHeader(props: ComponentProps<typeof Accordion.Header>): import("react").JSX.Element;
|
|
23
|
+
declare function AccordionTrigger(props: ComponentProps<typeof Accordion.Trigger>): import("react").JSX.Element;
|
|
21
24
|
//#endregion
|
|
22
25
|
export { AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, Accordions };
|
|
@@ -4,19 +4,23 @@ import { AnchorSection, useAnchorId } from "../auto-anchor/client.js";
|
|
|
4
4
|
import { cn } from "../utils/cn.js";
|
|
5
5
|
import { createContext, use, useEffect, useMemo, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
7
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
8
8
|
import { ChevronRight } from "lucide-react";
|
|
9
9
|
//#region src/components/accordion.tsx
|
|
10
10
|
const Context = createContext(null);
|
|
11
|
-
function Accordions({ type, defaultValue, ...props }) {
|
|
12
|
-
const [value, setValue] = useState(() =>
|
|
11
|
+
function Accordions({ type = "single", defaultValue, ...props }) {
|
|
12
|
+
const [value, setValue] = useState(() => {
|
|
13
|
+
if (Array.isArray(defaultValue)) return defaultValue;
|
|
14
|
+
if (defaultValue) return [defaultValue];
|
|
15
|
+
return [];
|
|
16
|
+
});
|
|
13
17
|
return /* @__PURE__ */ jsx(Context, {
|
|
14
18
|
value: useMemo(() => ({
|
|
15
19
|
type,
|
|
16
20
|
setValue
|
|
17
21
|
}), [type]),
|
|
18
|
-
children: /* @__PURE__ */ jsx(
|
|
19
|
-
type,
|
|
22
|
+
children: /* @__PURE__ */ jsx(Accordion.Root, {
|
|
23
|
+
multiple: type === "multiple",
|
|
20
24
|
value,
|
|
21
25
|
onValueChange: setValue,
|
|
22
26
|
...props
|
|
@@ -27,13 +31,13 @@ function AccordionItem({ value, className, anchorSegments, ...props }) {
|
|
|
27
31
|
const ctx = use(Context);
|
|
28
32
|
const id = useAnchorId(anchorSegments ?? false);
|
|
29
33
|
useEffect(() => {
|
|
30
|
-
if (id && anchorIdStartsWith(window.location.hash.slice(1), id)) ctx.setValue(
|
|
34
|
+
if (id && anchorIdStartsWith(window.location.hash.slice(1), id)) ctx.setValue([value]);
|
|
31
35
|
}, [
|
|
32
36
|
value,
|
|
33
37
|
id,
|
|
34
38
|
ctx
|
|
35
39
|
]);
|
|
36
|
-
const content = /* @__PURE__ */ jsx(
|
|
40
|
+
const content = /* @__PURE__ */ jsx(Accordion.Item, {
|
|
37
41
|
value,
|
|
38
42
|
className: cn("scroll-m-20 border-b last:border-b-0", className),
|
|
39
43
|
...props
|
|
@@ -44,23 +48,23 @@ function AccordionItem({ value, className, anchorSegments, ...props }) {
|
|
|
44
48
|
}) : content;
|
|
45
49
|
}
|
|
46
50
|
function AccordionContent(props) {
|
|
47
|
-
return /* @__PURE__ */ jsx(
|
|
51
|
+
return /* @__PURE__ */ jsx(Accordion.Panel, {
|
|
48
52
|
...props,
|
|
49
|
-
className: cn("overflow-hidden data-[
|
|
53
|
+
className: cn("overflow-hidden data-[ending-style]:animate-fd-accordion-up data-[starting-style]:animate-fd-accordion-down", props.className)
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
function AccordionHeader(props) {
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
+
return /* @__PURE__ */ jsx(Accordion.Header, {
|
|
54
58
|
...props,
|
|
55
59
|
className: cn("not-prose flex text-fd-foreground font-medium", props.className),
|
|
56
60
|
children: props.children
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
63
|
function AccordionTrigger(props) {
|
|
60
|
-
return /* @__PURE__ */ jsxs(
|
|
64
|
+
return /* @__PURE__ */ jsxs(Accordion.Trigger, {
|
|
61
65
|
...props,
|
|
62
66
|
className: cn("flex flex-1 items-center gap-1 text-start group/accordion py-2 focus-visible:outline-none", props.className),
|
|
63
|
-
children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 text-fd-muted-foreground shrink-0 transition-transform group-data-[
|
|
67
|
+
children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 text-fd-muted-foreground shrink-0 transition-transform group-data-[panel-open]/accordion:rotate-90" }), props.children]
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
70
|
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
3
|
+
|
|
4
|
+
//#region src/components/collapsible.d.ts
|
|
5
|
+
declare const Collapsible: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare function CollapsibleContent({
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof Collapsible$1.Panel>): import("react").JSX.Element;
|
|
12
|
+
type CollapsibleProps = Collapsible$1.Root.Props;
|
|
13
|
+
type CollapsibleContentProps = Collapsible$1.Panel.Props;
|
|
14
|
+
type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
5
|
+
//#region src/components/collapsible.tsx
|
|
6
|
+
const Collapsible = Collapsible$1.Root;
|
|
7
|
+
const CollapsibleTrigger = Collapsible$1.Trigger;
|
|
8
|
+
function CollapsibleContent({ children, className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
10
|
+
...props,
|
|
11
|
+
className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height,opacity] data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0 data-ending-style:opacity-0", typeof className === "function" ? className(s) : className),
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
3
3
|
|
|
4
4
|
//#region src/components/dialog.d.ts
|
|
5
|
-
declare const Dialog:
|
|
6
|
-
declare const DialogTrigger:
|
|
7
|
-
declare const DialogPortal: import("react").
|
|
8
|
-
declare const DialogClose: import("react").ForwardRefExoticComponent<
|
|
5
|
+
declare const Dialog: typeof Dialog$1.Root;
|
|
6
|
+
declare const DialogTrigger: Dialog$1.Trigger;
|
|
7
|
+
declare const DialogPortal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
9
|
declare function DialogOverlay({
|
|
10
10
|
className,
|
|
11
11
|
ref,
|
|
12
12
|
...props
|
|
13
|
-
}: ComponentProps<typeof
|
|
13
|
+
}: ComponentProps<typeof Dialog$1.Backdrop>): import("react").JSX.Element;
|
|
14
14
|
declare function DialogContent({
|
|
15
15
|
className,
|
|
16
16
|
children,
|
|
17
17
|
ref,
|
|
18
18
|
...props
|
|
19
|
-
}: ComponentProps<typeof
|
|
19
|
+
}: ComponentProps<typeof Dialog$1.Popup>): import("react").JSX.Element;
|
|
20
20
|
declare function DialogHeader({
|
|
21
21
|
className,
|
|
22
22
|
...props
|
|
@@ -29,11 +29,11 @@ declare function DialogTitle({
|
|
|
29
29
|
className,
|
|
30
30
|
ref,
|
|
31
31
|
...props
|
|
32
|
-
}: ComponentProps<typeof
|
|
32
|
+
}: ComponentProps<typeof Dialog$1.Title>): import("react").JSX.Element;
|
|
33
33
|
declare function DialogDescription({
|
|
34
34
|
className,
|
|
35
35
|
ref,
|
|
36
36
|
...props
|
|
37
|
-
}: ComponentProps<typeof
|
|
37
|
+
}: ComponentProps<typeof Dialog$1.Description>): import("react").JSX.Element;
|
|
38
38
|
//#endregion
|
|
39
39
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { X } from "lucide-react";
|
|
5
|
-
import
|
|
5
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
6
6
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
7
7
|
//#region src/components/dialog.tsx
|
|
8
|
-
const Dialog =
|
|
9
|
-
const DialogTrigger =
|
|
10
|
-
const DialogPortal =
|
|
11
|
-
const DialogClose =
|
|
8
|
+
const Dialog = Dialog$1.Root;
|
|
9
|
+
const DialogTrigger = Dialog$1.Trigger;
|
|
10
|
+
const DialogPortal = Dialog$1.Portal;
|
|
11
|
+
const DialogClose = Dialog$1.Close;
|
|
12
12
|
function DialogOverlay({ className, ref, ...props }) {
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
13
|
+
return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
|
|
14
14
|
ref,
|
|
15
|
-
className: cn("fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-
|
|
15
|
+
className: cn("fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-open:animate-fd-fade-in data-closed:animate-fd-fade-out", className),
|
|
16
16
|
...props
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
function DialogContent({ className, children, ref, ...props }) {
|
|
20
|
-
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(
|
|
20
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Popup, {
|
|
21
21
|
ref,
|
|
22
|
-
className: cn("fixed left-1/2 top-1/2 z-50 flex flex-col gap-4 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border bg-fd-popover p-4 shadow-lg rounded-xl duration-200 data-
|
|
22
|
+
className: cn("fixed left-1/2 top-1/2 z-50 flex flex-col gap-4 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border bg-fd-popover p-4 shadow-lg rounded-xl duration-200 data-open:animate-fd-dialog-in data-closed:animate-fd-dialog-out focus-visible:outline-none", className),
|
|
23
23
|
...props,
|
|
24
|
-
children: [children, /* @__PURE__ */ jsx(
|
|
24
|
+
children: [children, /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
25
25
|
"aria-label": "Close",
|
|
26
26
|
className: cn(buttonVariants({
|
|
27
27
|
size: "icon-sm",
|
|
@@ -44,14 +44,14 @@ function DialogFooter({ className, ...props }) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function DialogTitle({ className, ref, ...props }) {
|
|
47
|
-
return /* @__PURE__ */ jsx(
|
|
47
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
48
48
|
ref,
|
|
49
49
|
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
50
50
|
...props
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
function DialogDescription({ className, ref, ...props }) {
|
|
54
|
-
return /* @__PURE__ */ jsx(
|
|
54
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
55
55
|
ref,
|
|
56
56
|
className: cn("text-sm text-fd-muted-foreground", className),
|
|
57
57
|
...props
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/input.d.ts
|
|
4
|
-
type InputProps = React
|
|
4
|
+
type InputProps = React.ComponentProps<'input'>;
|
|
5
5
|
declare const labelVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
6
|
-
declare
|
|
6
|
+
declare function Input({
|
|
7
|
+
className,
|
|
8
|
+
type,
|
|
9
|
+
ref,
|
|
10
|
+
...props
|
|
11
|
+
}: InputProps): React.JSX.Element;
|
|
7
12
|
//#endregion
|
|
8
13
|
export { Input, InputProps, labelVariants };
|
package/dist/components/input.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { cn } from "../utils/cn.js";
|
|
2
|
-
import
|
|
2
|
+
import "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
//#region src/components/input.tsx
|
|
6
6
|
const labelVariants = cva("text-xs font-medium text-fd-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
7
|
-
|
|
7
|
+
function Input({ className, type, ref, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("input", {
|
|
9
9
|
type,
|
|
10
10
|
className: cn("flex h-9 w-full rounded-md border bg-fd-secondary px-2 py-1.5 text-[0.8125rem] text-fd-secondary-foreground transition-colors placeholder:text-fd-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
11
11
|
ref,
|
|
12
12
|
...props
|
|
13
13
|
});
|
|
14
|
-
}
|
|
15
|
-
Input.displayName = "Input";
|
|
14
|
+
}
|
|
16
15
|
//#endregion
|
|
17
16
|
export { Input, labelVariants };
|
|
@@ -43,7 +43,7 @@ function ObjectInput({ field: _field, fieldName, ...props }) {
|
|
|
43
43
|
children: [
|
|
44
44
|
isLazy && hiddenProperties.length > 0 && /* @__PURE__ */ jsxs(Select, {
|
|
45
45
|
value: "",
|
|
46
|
-
onValueChange: onAppend,
|
|
46
|
+
onValueChange: (v) => v !== null && onAppend(v),
|
|
47
47
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
48
48
|
className: "col-span-full",
|
|
49
49
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Show Property") })
|
|
@@ -160,50 +160,62 @@ function FieldInput({ field, fieldName, isRequired, ...props }) {
|
|
|
160
160
|
})] });
|
|
161
161
|
if (field.enum && field.enum.length > 0) {
|
|
162
162
|
const idx = field.enum.indexOf(value);
|
|
163
|
+
const items = [...field.enum.map((item, i) => ({
|
|
164
|
+
value: String(i),
|
|
165
|
+
label: typeof item === "string" ? item : JSON.stringify(item, null, 2)
|
|
166
|
+
})), ...!isRequired ? [{
|
|
167
|
+
value: "-1",
|
|
168
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
169
|
+
className: "text-fd-muted-foreground",
|
|
170
|
+
children: t("Unset")
|
|
171
|
+
})
|
|
172
|
+
}] : []];
|
|
163
173
|
return /* @__PURE__ */ jsxs(Select, {
|
|
174
|
+
items,
|
|
164
175
|
value: idx === -1 && isRequired ? "" : String(idx),
|
|
165
176
|
onValueChange: (v) => setValue(field.enum[Number(v)]),
|
|
166
177
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
167
178
|
id,
|
|
168
179
|
...props,
|
|
169
180
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Select") })
|
|
170
|
-
}), /* @__PURE__ */
|
|
171
|
-
value:
|
|
172
|
-
children:
|
|
173
|
-
},
|
|
174
|
-
value: "-1",
|
|
175
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
176
|
-
className: "text-fd-muted-foreground",
|
|
177
|
-
children: t("Unset")
|
|
178
|
-
})
|
|
179
|
-
})] })]
|
|
181
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
182
|
+
value: item.value,
|
|
183
|
+
children: item.label
|
|
184
|
+
}, item.value)) })]
|
|
180
185
|
});
|
|
181
186
|
}
|
|
182
|
-
if (field.type === "boolean")
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
186
|
-
id,
|
|
187
|
-
...props,
|
|
188
|
-
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
189
|
-
}), /* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
190
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
187
|
+
if (field.type === "boolean") {
|
|
188
|
+
const items = [
|
|
189
|
+
{
|
|
191
190
|
value: "true",
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
191
|
+
label: "True"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
195
194
|
value: "false",
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
195
|
+
label: "False"
|
|
196
|
+
},
|
|
197
|
+
...!isRequired ? [{
|
|
199
198
|
value: "undefined",
|
|
200
|
-
|
|
199
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
201
200
|
className: "text-fd-muted-foreground",
|
|
202
201
|
children: t("Unset")
|
|
203
202
|
})
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
|
|
203
|
+
}] : []
|
|
204
|
+
];
|
|
205
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
206
|
+
items,
|
|
207
|
+
value: value === void 0 && isRequired ? "" : String(value),
|
|
208
|
+
onValueChange: (value) => setValue(value === "undefined" ? void 0 : value === "true"),
|
|
209
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
210
|
+
id,
|
|
211
|
+
...props,
|
|
212
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
213
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
214
|
+
value: item.value,
|
|
215
|
+
children: item.label
|
|
216
|
+
}, item.value)) })]
|
|
217
|
+
});
|
|
218
|
+
}
|
|
207
219
|
const isNumber = field.type === "integer" || field.type === "number";
|
|
208
220
|
return /* @__PURE__ */ jsx(Input, {
|
|
209
221
|
id,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
3
|
+
|
|
4
|
+
//#region src/components/popover.d.ts
|
|
5
|
+
declare const Popover: typeof Popover$1.Root;
|
|
6
|
+
declare const PopoverTrigger: Popover$1.Trigger;
|
|
7
|
+
declare function PopoverContent({
|
|
8
|
+
className,
|
|
9
|
+
align,
|
|
10
|
+
sideOffset,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof Popover$1.Popup> & Pick<Popover$1.Positioner.Props, 'sideOffset' | 'align'>): React.JSX.Element;
|
|
13
|
+
declare const PopoverClose: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
6
|
+
//#region src/components/popover.tsx
|
|
7
|
+
const Popover = Popover$1.Root;
|
|
8
|
+
const PopoverTrigger = Popover$1.Trigger;
|
|
9
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
11
|
+
align,
|
|
12
|
+
side: "bottom",
|
|
13
|
+
sideOffset,
|
|
14
|
+
className: "z-50",
|
|
15
|
+
children: /* @__PURE__ */ jsx(Popover$1.Popup, {
|
|
16
|
+
className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
|
|
17
|
+
...props
|
|
18
|
+
})
|
|
19
|
+
}) });
|
|
20
|
+
}
|
|
21
|
+
const PopoverClose = Popover$1.Close;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useAnchorId } from "../../auto-anchor/client.js";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
|
|
4
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select.js";
|
|
5
6
|
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
6
7
|
import { Fragment, Suspense, createContext, use, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -9,10 +10,9 @@ import { CheckIcon, FilterIcon, LinkIcon } from "lucide-react";
|
|
|
9
10
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
10
11
|
import { cva } from "class-variance-authority";
|
|
11
12
|
import { useTranslations } from "@fuma-translate/react";
|
|
12
|
-
import { Popover, PopoverContent, PopoverTrigger } from "fumadocs-ui/components/ui/popover";
|
|
13
13
|
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
14
14
|
//#region src/components/schema/client.tsx
|
|
15
|
-
const typeVariants = cva("text-sm text-start text-fd-muted-foreground font-mono", { variants: { variant: { trigger: "underline hover:text-fd-accent-foreground data-[
|
|
15
|
+
const typeVariants = cva("text-sm text-start text-fd-muted-foreground font-mono", { variants: { variant: { trigger: "underline hover:text-fd-accent-foreground data-[popup-open]:text-fd-accent-foreground" } } });
|
|
16
16
|
const Context = createContext(null);
|
|
17
17
|
function useStates() {
|
|
18
18
|
return use(Context);
|
|
@@ -68,17 +68,10 @@ function SchemaUI({ name, required = false, as = "property", generated }) {
|
|
|
68
68
|
children
|
|
69
69
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
70
70
|
ref: popoverRef,
|
|
71
|
-
|
|
72
|
-
className: "w-[600px] max-w-(--radix-popover-content-available-width) min-h-(--min-height,200px) fd-scroll-container max-h-[460px] px-3 pt-0",
|
|
71
|
+
className: "w-[600px] max-w-(--available-width) min-h-(--min-height,200px) fd-scroll-container max-h-[460px] px-3 pt-0",
|
|
73
72
|
onScrollEnd: (e) => {
|
|
74
73
|
path.at(-1).scrollTop = e.target.scrollTop;
|
|
75
74
|
},
|
|
76
|
-
onOpenAutoFocus: (e) => {
|
|
77
|
-
const input = e.target.querySelector("input[data-object-search-input]");
|
|
78
|
-
if (!(input instanceof HTMLInputElement)) return;
|
|
79
|
-
input.focus({ preventScroll: true });
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
},
|
|
82
75
|
children: /* @__PURE__ */ jsx(SchemaUIPopover, {})
|
|
83
76
|
})]
|
|
84
77
|
})
|
|
@@ -195,8 +188,10 @@ function PathItemBody({ pathIndex, asSchema, tabDepth = 0, objectSearchOverrides
|
|
|
195
188
|
value: item.$type
|
|
196
189
|
}));
|
|
197
190
|
return /* @__PURE__ */ jsxs(Select, {
|
|
191
|
+
items,
|
|
198
192
|
value,
|
|
199
193
|
onValueChange: (v) => {
|
|
194
|
+
if (!v) return;
|
|
200
195
|
const next = [...path];
|
|
201
196
|
(next[pathIndex].tabValues ??= []).splice(tabDepth, 1, v);
|
|
202
197
|
setPath(next);
|
|
@@ -210,7 +205,7 @@ function PathItemBody({ pathIndex, asSchema, tabDepth = 0, objectSearchOverrides
|
|
|
210
205
|
}),
|
|
211
206
|
/* @__PURE__ */ jsx(SelectTrigger, {
|
|
212
207
|
className: "not-prose w-fit min-w-0 mb-auto *:min-w-0",
|
|
213
|
-
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
208
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
214
209
|
}),
|
|
215
210
|
/* @__PURE__ */ jsx(SelectContent, { children: items.map(({ label, value }) => /* @__PURE__ */ jsx(SelectItem, {
|
|
216
211
|
value,
|
|
@@ -322,7 +317,11 @@ function BlockTag({ label, children }) {
|
|
|
322
317
|
function SchemaUIPopover() {
|
|
323
318
|
const states = useStates();
|
|
324
319
|
const { path, setPath } = states;
|
|
325
|
-
|
|
320
|
+
const ref = useRef(null);
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
ref.current?.querySelector("input[data-object-search-input]")?.focus({ preventScroll: true });
|
|
323
|
+
}, [path]);
|
|
324
|
+
return /* @__PURE__ */ jsx(Context, {
|
|
326
325
|
value: useMemo(() => ({
|
|
327
326
|
...states,
|
|
328
327
|
renderTypeInfoTrigger: ({ $ref, pathName, children }) => /* @__PURE__ */ jsx("button", {
|
|
@@ -338,26 +337,29 @@ function SchemaUIPopover() {
|
|
|
338
337
|
setPath,
|
|
339
338
|
path
|
|
340
339
|
]),
|
|
341
|
-
children:
|
|
342
|
-
|
|
343
|
-
children:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
340
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
341
|
+
ref,
|
|
342
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
343
|
+
className: "sticky top-0 -mx-3 flex overflow-x-auto overflow-y-hidden items-center text-sm font-medium font-mono bg-fd-secondary text-fd-secondary-foreground px-3 h-10 border-b z-20",
|
|
344
|
+
children: path.map((item, i) => {
|
|
345
|
+
if (i === 0) return;
|
|
346
|
+
const isDuplicated = path.some((other, j) => j !== i && other.$ref === item.$ref);
|
|
347
|
+
let text;
|
|
348
|
+
const indexItemMatch = /^\[(\w+): (\w+)]$/.exec(item.name);
|
|
349
|
+
if (indexItemMatch) text = `[${indexItemMatch[1]}]`;
|
|
350
|
+
else if (i > 1) text = `.${item.name}`;
|
|
351
|
+
else text = item.name;
|
|
352
|
+
return /* @__PURE__ */ jsx("button", {
|
|
353
|
+
onClick: () => setPath(path.slice(0, i + 1)),
|
|
354
|
+
className: cn("hover:underline hover:text-fd-accent-foreground", isDuplicated && "text-orange-400"),
|
|
355
|
+
children: text
|
|
356
|
+
}, i);
|
|
357
|
+
})
|
|
358
|
+
}), /* @__PURE__ */ jsx(PathItemBody, {
|
|
359
|
+
pathIndex: path.length - 1,
|
|
360
|
+
objectSearchOverrides: { variant: "in-popover" }
|
|
361
|
+
})]
|
|
362
|
+
})
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
function TypeInfoTrigger({ pathName, $ref, children }) {
|
|
@@ -37,15 +37,13 @@ function SelectTab({ value, anchorSegments, ...props }) {
|
|
|
37
37
|
function SelectTabTrigger({ items, className, placeholder, ...props }) {
|
|
38
38
|
const { value, setValue } = use(Context);
|
|
39
39
|
return /* @__PURE__ */ jsxs(Select, {
|
|
40
|
-
|
|
40
|
+
items,
|
|
41
|
+
value,
|
|
41
42
|
onValueChange: setValue,
|
|
42
43
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
43
44
|
className: cn("not-prose w-fit min-w-0 *:min-w-0", className),
|
|
44
45
|
...props,
|
|
45
|
-
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
46
|
-
placeholder,
|
|
47
|
-
children: value && items.find((item) => item.value === value)?.label
|
|
48
|
-
})
|
|
46
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
49
47
|
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map(({ label, value }) => /* @__PURE__ */ jsx(SelectItem, {
|
|
50
48
|
value,
|
|
51
49
|
children: label
|