fumadocs-ui 16.0.9 → 16.0.10

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.
@@ -1,13 +1,19 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
2
- export declare const Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ export type CalloutType = 'info' | 'warn' | 'error' | 'success' | 'warning';
3
+ export declare function Callout({ children, title, ...props }: {
3
4
  title?: ReactNode;
5
+ } & Omit<CalloutContainerProps, 'title'>): import("react/jsx-runtime").JSX.Element;
6
+ export interface CalloutContainerProps extends ComponentProps<'div'> {
4
7
  /**
5
8
  * @defaultValue info
6
9
  */
7
- type?: "info" | "warn" | "error" | "success" | "warning";
10
+ type?: CalloutType;
8
11
  /**
9
12
  * Force an icon
10
13
  */
11
14
  icon?: ReactNode;
12
- } & import("react").RefAttributes<HTMLDivElement>>;
15
+ }
16
+ export declare function CalloutContainer({ type: inputType, icon, children, className, style, ...props }: CalloutContainerProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function CalloutTitle({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function CalloutDescription({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
13
19
  //# sourceMappingURL=callout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAqBxE,eAAO,MAAM,OAAO;YAdV,SAAS;IACjB;;OAEG;WACI,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS;IAExD;;OAEG;WACI,SAAS;kDA0CjB,CAAC"}
1
+ {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAI5E,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,2CAO9D;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EAAE,SAAkB,EACxB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA4BvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAMrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAYrB"}
@@ -1,22 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CircleCheck, CircleX, Info, TriangleAlert } from '../icons.js';
3
- import { forwardRef } from 'react';
4
3
  import { cn } from '../utils/cn.js';
5
4
  const iconClass = 'size-5 -me-0.5 fill-(--callout-color) text-fd-card';
6
- export const Callout = forwardRef(({ className, children, title, type = 'info', icon, ...props }, ref) => {
5
+ export function Callout({ children, title, ...props }) {
6
+ return (_jsxs(CalloutContainer, { ...props, children: [title && _jsx(CalloutTitle, { children: title }), _jsx(CalloutDescription, { children: children })] }));
7
+ }
8
+ function resolveAlias(type) {
7
9
  if (type === 'warn')
8
- type = 'warning';
10
+ return 'warning';
9
11
  if (type === 'tip')
10
- type = 'info';
11
- return (_jsxs("div", { ref: ref, className: cn('flex gap-2 my-4 rounded-xl border bg-fd-card p-3 ps-1 text-sm text-fd-card-foreground shadow-md', className), ...props, style: {
12
+ return 'info';
13
+ return type;
14
+ }
15
+ export function CalloutContainer({ type: inputType = 'info', icon, children, className, style, ...props }) {
16
+ const type = resolveAlias(inputType);
17
+ return (_jsxs("div", { className: cn('flex gap-2 my-4 rounded-xl border bg-fd-card p-3 ps-1 text-sm text-fd-card-foreground shadow-md', className), style: {
12
18
  '--callout-color': `var(--color-fd-${type}, var(--color-fd-muted))`,
13
- ...props.style,
14
- }, children: [_jsx("div", { role: "none", className: "w-0.5 bg-(--callout-color)/50 rounded-sm" }), icon ??
19
+ ...style,
20
+ }, ...props, children: [_jsx("div", { role: "none", className: "w-0.5 bg-(--callout-color)/50 rounded-sm" }), icon ??
15
21
  {
16
22
  info: _jsx(Info, { className: iconClass }),
17
23
  warning: _jsx(TriangleAlert, { className: iconClass }),
18
24
  error: _jsx(CircleX, { className: iconClass }),
19
25
  success: _jsx(CircleCheck, { className: iconClass }),
20
- }[type], _jsxs("div", { className: "flex flex-col gap-2 min-w-0 flex-1", children: [title && _jsx("p", { className: "font-medium !my-0", children: title }), _jsx("div", { className: "text-fd-muted-foreground prose-no-margin empty:hidden", children: children })] })] }));
21
- });
22
- Callout.displayName = 'Callout';
26
+ }[type], _jsx("div", { className: "flex flex-col gap-2 min-w-0 flex-1", children: children })] }));
27
+ }
28
+ export function CalloutTitle({ children, className, ...props }) {
29
+ return (_jsx("p", { className: cn('font-medium my-0!', className), ...props, children: children }));
30
+ }
31
+ export function CalloutDescription({ children, className, ...props }) {
32
+ return (_jsx("div", { className: cn('text-fd-muted-foreground prose-no-margin empty:hidden', className), ...props, children: children }));
33
+ }
@@ -6,5 +6,5 @@ export function Cards(props) {
6
6
  }
7
7
  export function Card({ icon, title, description, ...props }) {
8
8
  const E = props.href ? Link : 'div';
9
- return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "!my-0 text-sm text-fd-muted-foreground", children: description })) : null, _jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden", children: props.children })] }));
9
+ return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "my-0! text-sm text-fd-muted-foreground", children: description })) : null, _jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden", children: props.children })] }));
10
10
  }
package/dist/mdx.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { AnchorHTMLAttributes, FC, HTMLAttributes, ImgHTMLAttributes, TableHTMLAttributes } from 'react';
2
2
  import { Card, Cards } from './components/card.js';
3
+ import { Callout, CalloutContainer, CalloutDescription, CalloutTitle } from './components/callout.js';
3
4
  import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger } from './components/codeblock.js';
4
5
  declare function Image(props: ImgHTMLAttributes<HTMLImageElement> & {
5
6
  sizes?: string;
@@ -22,11 +23,10 @@ declare const defaultMdxComponents: {
22
23
  h5: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
23
24
  h6: (props: HTMLAttributes<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
24
25
  table: typeof Table;
25
- Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
26
- title?: import("react").ReactNode;
27
- type?: "info" | "warn" | "error" | "success" | "warning";
28
- icon?: import("react").ReactNode;
29
- } & import("react").RefAttributes<HTMLDivElement>>;
26
+ Callout: typeof Callout;
27
+ CalloutContainer: typeof CalloutContainer;
28
+ CalloutTitle: typeof CalloutTitle;
29
+ CalloutDescription: typeof CalloutDescription;
30
30
  };
31
31
  export declare const createRelativeLink: typeof import('./mdx.server.js').createRelativeLink;
32
32
  export { defaultMdxComponents as default };
package/dist/mdx.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAEL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,wBAAwB,CAAC;AAEhC,iBAAS,KAAK,CACZ,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAUF;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;;;;;iBAKX,cAAc,CAAC,cAAc,CAAC;;;OAOhC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC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CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;CAQ/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,cAAc,EAAE,kBAK5D,CAAC;AAEJ,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
package/dist/mdx.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Link from 'fumadocs-core/link';
3
3
  import { Image as FrameworkImage } from 'fumadocs-core/framework';
4
4
  import { Card, Cards } from './components/card.js';
5
- import { Callout } from './components/callout.js';
5
+ import { Callout, CalloutContainer, CalloutDescription, CalloutTitle, } from './components/callout.js';
6
6
  import { Heading } from './components/heading.js';
7
7
  import { cn } from './utils/cn.js';
8
8
  import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre, } from './components/codeblock.js';
@@ -30,6 +30,9 @@ const defaultMdxComponents = {
30
30
  h6: (props) => (_jsx(Heading, { as: "h6", ...props })),
31
31
  table: Table,
32
32
  Callout,
33
+ CalloutContainer,
34
+ CalloutTitle,
35
+ CalloutDescription,
33
36
  };
34
37
  export const createRelativeLink = () => {
35
38
  throw new Error('`createRelativeLink` is only supported in Node.js environment');
package/dist/style.css CHANGED
@@ -447,12 +447,12 @@
447
447
  .mx-auto {
448
448
  margin-inline: auto;
449
449
  }
450
- .\!my-0 {
451
- margin-block: calc(var(--spacing) * 0) !important;
452
- }
453
450
  .my-0 {
454
451
  margin-block: calc(var(--spacing) * 0);
455
452
  }
453
+ .my-0\! {
454
+ margin-block: calc(var(--spacing) * 0) !important;
455
+ }
456
456
  .my-4 {
457
457
  margin-block: calc(var(--spacing) * 4);
458
458
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "16.0.9",
3
+ "version": "16.0.10",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -121,7 +121,7 @@
121
121
  "react-medium-image-zoom": "^5.4.0",
122
122
  "scroll-into-view-if-needed": "^3.1.0",
123
123
  "tailwind-merge": "^3.3.1",
124
- "fumadocs-core": "16.0.9"
124
+ "fumadocs-core": "16.0.10"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@next/eslint-plugin-next": "16.0.1",
@@ -135,7 +135,7 @@
135
135
  "tsc-alias": "^1.8.16",
136
136
  "@fumadocs/cli": "1.0.3",
137
137
  "eslint-config-custom": "0.0.0",
138
- "fumadocs-core": "16.0.9",
138
+ "fumadocs-core": "16.0.10",
139
139
  "tsconfig": "0.0.0"
140
140
  },
141
141
  "peerDependencies": {