@fumadocs/base-ui 16.8.7 → 16.8.8

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.
@@ -88,7 +88,6 @@
88
88
  @source inline("application/json");
89
89
  @source inline("areaRef");
90
90
  @source inline("aria-describedby");
91
- @source inline("aria-hidden");
92
91
  @source inline("aria-label");
93
92
  @source inline("aria-selected");
94
93
  @source inline("as");
@@ -429,6 +428,8 @@
429
428
  @source inline("group-data-[open]:rotate-180");
430
429
  @source inline("group-data-[panel-open]:rotate-90");
431
430
  @source inline("group-data-active:bg-fd-primary");
431
+ @source inline("group-hover/heading:opacity-100");
432
+ @source inline("group/heading");
432
433
  @source inline("groupListeners");
433
434
  @source inline("guides");
434
435
  @source inline("h");
@@ -675,6 +676,7 @@
675
676
  @source inline("onChange");
676
677
  @source inline("onClick");
677
678
  @source inline("onCompute");
679
+ @source inline("onCopy");
678
680
  @source inline("onKey");
679
681
  @source inline("onOpenChange");
680
682
  @source inline("onOpenChangeCallback");
@@ -740,8 +742,6 @@
740
742
  @source inline("pb-0");
741
743
  @source inline("pb-2");
742
744
  @source inline("pe-2");
743
- @source inline("peer");
744
- @source inline("peer-hover:opacity-100");
745
745
  @source inline("performing");
746
746
  @source inline("persist");
747
747
  @source inline("persistent");
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import { useCopyButton } from "../utils/use-copy-button.js";
4
3
  import { buttonVariants } from "./ui/button.js";
4
+ import { useCopyButton } from "../utils/use-copy-button.js";
5
5
  import { mergeRefs } from "../utils/merge-refs.js";
6
6
  import { Accordion as Accordion$1, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger } from "./ui/accordion.js";
7
7
  import { useEffect, useRef, useState } from "react";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import { useCopyButton } from "../utils/use-copy-button.js";
4
3
  import { buttonVariants } from "./ui/button.js";
4
+ import { useCopyButton } from "../utils/use-copy-button.js";
5
5
  import { mergeRefs } from "../utils/merge-refs.js";
6
6
  import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs.js";
7
7
  import { createContext, use, useMemo, useRef } from "react";
@@ -1,4 +1,5 @@
1
1
  import { ComponentPropsWithoutRef } from "react";
2
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
3
 
3
4
  //#region src/components/heading.d.ts
4
5
  type Types = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
@@ -7,8 +8,7 @@ type HeadingProps<T extends Types> = Omit<ComponentPropsWithoutRef<T>, 'as'> & {
7
8
  };
8
9
  declare function Heading<T extends Types = 'h1'>({
9
10
  as,
10
- className,
11
11
  ...props
12
- }: HeadingProps<T>): React.ReactElement;
12
+ }: HeadingProps<T>): _$react_jsx_runtime0.JSX.Element;
13
13
  //#endregion
14
14
  export { Heading };
@@ -1,24 +1,34 @@
1
+ "use client";
1
2
  import { cn } from "../utils/cn.js";
3
+ import { buttonVariants } from "./ui/button.js";
4
+ import { useCopyButton } from "../utils/use-copy-button.js";
2
5
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { LinkIcon } from "lucide-react";
6
+ import { CopyCheckIcon, LinkIcon } from "lucide-react";
4
7
  //#region src/components/heading.tsx
5
- function Heading({ as, className, ...props }) {
8
+ function Heading({ as, ...props }) {
6
9
  const As = as ?? "h1";
7
- if (!props.id) return /* @__PURE__ */ jsx(As, {
8
- className,
9
- ...props
10
+ const [isChecked, onCopy] = useCopyButton(() => {
11
+ if (!props.id) return;
12
+ const url = new URL(window.location.href);
13
+ url.hash = props.id;
14
+ return navigator.clipboard.writeText(url.href);
10
15
  });
16
+ if (!props.id) return /* @__PURE__ */ jsx(As, { ...props });
11
17
  return /* @__PURE__ */ jsxs(As, {
12
- className: cn("flex scroll-m-28 flex-row items-center gap-2", className),
13
18
  ...props,
19
+ className: cn("group/heading flex scroll-m-28 flex-row items-center gap-1", props.className),
14
20
  children: [/* @__PURE__ */ jsx("a", {
15
21
  "data-card": "",
16
22
  href: `#${props.id}`,
17
- className: "peer",
18
23
  children: props.children
19
- }), /* @__PURE__ */ jsx(LinkIcon, {
20
- "aria-hidden": true,
21
- className: "size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100"
24
+ }), /* @__PURE__ */ jsx("button", {
25
+ "aria-label": "Copy Anchor Link",
26
+ className: cn(buttonVariants({
27
+ variant: "ghost",
28
+ size: "icon-xs"
29
+ }), "not-prose shrink-0 text-fd-muted-foreground opacity-0 transition-opacity group-hover/heading:opacity-100"),
30
+ onClick: onCopy,
31
+ children: isChecked ? /* @__PURE__ */ jsx(CopyCheckIcon, {}) : /* @__PURE__ */ jsx(LinkIcon, {})
22
32
  })]
23
33
  });
24
34
  }
@@ -5,7 +5,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
7
7
  color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
8
- size?: "sm" | "icon" | "icon-sm" | "icon-xs" | null | undefined;
8
+ size?: "icon" | "sm" | "icon-sm" | "icon-xs" | null | undefined;
9
9
  } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
10
10
  type ButtonProps = VariantProps<typeof buttonVariants>;
11
11
  //#endregion
@@ -14,7 +14,7 @@ function useSearchContext() {
14
14
  function MetaOrControl() {
15
15
  const [key, setKey] = useState("⌘");
16
16
  useEffect(() => {
17
- if (window.navigator.userAgent.includes("Windows")) setKey("Ctrl");
17
+ if (/Windows|Linux/i.test(window.navigator.userAgent)) setKey("Ctrl");
18
18
  }, []);
19
19
  return key;
20
20
  }
@@ -4,7 +4,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
4
4
 
5
5
  //#region src/layouts/home/slots/header.d.ts
6
6
  declare const navItemVariants: (props?: ({
7
- variant?: "main" | "icon" | "button" | null | undefined;
7
+ variant?: "icon" | "main" | "button" | null | undefined;
8
8
  } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
9
9
  declare function Header(props: ComponentProps<'header'>): _$react_jsx_runtime0.JSX.Element;
10
10
  //#endregion
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import { useCopyButton } from "../../utils/use-copy-button.js";
4
3
  import { buttonVariants } from "../../components/ui/button.js";
4
+ import { useCopyButton } from "../../utils/use-copy-button.js";
5
5
  import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
6
6
  import { useMemo, useState } from "react";
7
7
  import { usePathname } from "fumadocs-core/framework";
@@ -19,4 +19,4 @@ declare function generate({
19
19
  ...props
20
20
  }: GenerateProps): _$react_jsx_runtime0.JSX.Element;
21
21
  //#endregion
22
- export { generate, generateOGImage };
22
+ export { GenerateProps, generate, generateOGImage };
package/dist/style.css CHANGED
@@ -2088,6 +2088,13 @@
2088
2088
  margin-bottom: calc(var(--spacing) * 2);
2089
2089
  }
2090
2090
  }
2091
+ .group-hover\/heading\:opacity-100 {
2092
+ &:is(:where(.group\/heading):hover *) {
2093
+ @media (hover: hover) {
2094
+ opacity: 100%;
2095
+ }
2096
+ }
2097
+ }
2091
2098
  .group-data-active\:bg-fd-primary {
2092
2099
  &:is(:where(.group)[data-active] *) {
2093
2100
  background-color: var(--color-fd-primary);
@@ -2103,13 +2110,6 @@
2103
2110
  rotate: 90deg;
2104
2111
  }
2105
2112
  }
2106
- .peer-hover\:opacity-100 {
2107
- &:is(:where(.peer):hover ~ *) {
2108
- @media (hover: hover) {
2109
- opacity: 100%;
2110
- }
2111
- }
2112
- }
2113
2113
  .placeholder\:text-fd-muted-foreground {
2114
2114
  &::placeholder {
2115
2115
  color: var(--color-fd-muted-foreground);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fumadocs/base-ui",
3
- "version": "16.8.7",
3
+ "version": "16.8.8",
4
4
  "description": "The Base UI version of Fumadocs UI",
5
5
  "keywords": [
6
6
  "Docs",
@@ -144,7 +144,7 @@
144
144
  "tsdown": "0.21.10",
145
145
  "unified": "^11.0.5",
146
146
  "@fumadocs/cli": "1.3.10",
147
- "fumadocs-core": "16.8.7",
147
+ "fumadocs-core": "16.8.8",
148
148
  "tsconfig": "0.0.0"
149
149
  },
150
150
  "peerDependencies": {
@@ -154,7 +154,7 @@
154
154
  "next": "16.x.x",
155
155
  "react": "^19.2.0",
156
156
  "react-dom": "^19.2.0",
157
- "fumadocs-core": "16.8.7"
157
+ "fumadocs-core": "16.8.8"
158
158
  },
159
159
  "peerDependenciesMeta": {
160
160
  "next": {