@mintlify/components 1.0.1 → 1.0.2

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,3 +1,4 @@
1
+ import { TooltipPositionerProps } from '@base-ui/react/tooltip';
1
2
  import { ReactNode } from 'react';
2
3
  type TooltipProps = {
3
4
  description?: string;
@@ -6,8 +7,8 @@ type TooltipProps = {
6
7
  cta?: string;
7
8
  href?: string;
8
9
  className?: string;
9
- };
10
- declare const Tooltip: ({ description, children, title, cta, href, className, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
10
+ } & Pick<TooltipPositionerProps, "side" | "align">;
11
+ declare const Tooltip: ({ description, children, title, cta, href, className, side, align, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
11
12
  export { Tooltip };
12
13
  export type { TooltipProps };
13
14
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAO1E,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,OAAO,GAAI,yDAOd,YAAY,mDA0Gd,CAAC;AAyCF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGrE,OAAO,EAAkB,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAO1E,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAEnD,QAAA,MAAM,OAAO,GAAI,sEASd,YAAY,mDA+Gd,CAAC;AAyCF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -1,110 +1,121 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import { useState as h, useMemo as _, isValidElement as d } from "react";
3
- import { Classes as k } from "../../constants/selectors.js";
4
- import { useHasHover as T } from "../../hooks/use-has-hover.js";
2
+ import { useState as k, useMemo as T, isValidElement as d } from "react";
3
+ import { Classes as C } from "../../constants/selectors.js";
4
+ import { useHasHover as N } from "../../hooks/use-has-hover.js";
5
5
  import { cn as u } from "../../utils/cn.js";
6
- import { isRemoteUrl as C } from "../../utils/is-remote-url.js";
7
- import { renderAsChild as N } from "../../utils/render-as-child.js";
8
- import P from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/chevron-right.js";
9
- import { TooltipProvider as w } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js";
10
- import { TooltipRoot as O } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js";
11
- import { TooltipTrigger as j } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js";
12
- import { TooltipPortal as H } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js";
13
- import { TooltipPositioner as R } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js";
14
- import { TooltipPopup as z } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js";
15
- const K = ({
6
+ import { isRemoteUrl as P } from "../../utils/is-remote-url.js";
7
+ import { renderAsChild as w } from "../../utils/render-as-child.js";
8
+ import O from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/chevron-right.js";
9
+ import { TooltipProvider as j } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js";
10
+ import { TooltipRoot as H } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js";
11
+ import { TooltipTrigger as R } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js";
12
+ import { TooltipPortal as z } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js";
13
+ import { TooltipPositioner as E } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js";
14
+ import { TooltipPopup as I } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js";
15
+ const X = ({
16
16
  description: e,
17
17
  children: n,
18
18
  title: o,
19
19
  cta: p,
20
20
  href: a,
21
- className: c
21
+ className: c,
22
+ side: x = "top",
23
+ align: g = "center"
22
24
  }) => {
23
- const [x, i] = h(!1), m = T(), r = E(n), g = m ? void 0 : () => {
25
+ const [b, i] = k(!1), m = N(), r = L(n), v = m ? void 0 : () => {
24
26
  i((s) => !s);
25
- }, b = (s, y) => {
26
- const { reason: f } = y;
27
+ }, y = (s, _) => {
28
+ const { reason: f } = _;
27
29
  if (m) {
28
30
  i(s);
29
31
  return;
30
32
  }
31
33
  s ? i(!0) : (f === "escape-key" || f === "outside-press") && i(!1);
32
- }, v = _(() => {
34
+ }, h = T(() => {
33
35
  if (!r)
34
36
  return o && e ? `${o}: ${e}` : o || e;
35
37
  }, [o, e, r]);
36
- return n == null ? null : /* @__PURE__ */ t(w, { delay: 0, children: /* @__PURE__ */ l(O, { onOpenChange: b, open: x, children: [
38
+ return n == null ? null : /* @__PURE__ */ t(j, { delay: 0, children: /* @__PURE__ */ l(H, { onOpenChange: y, open: b, children: [
37
39
  /* @__PURE__ */ t(
38
- j,
40
+ R,
39
41
  {
40
- "aria-label": v,
42
+ "aria-label": h,
41
43
  className: u(
42
44
  c,
43
45
  !r && "rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"
44
46
  ),
45
- onClick: g,
46
- render: r ? N(n) : void 0,
47
- children: r ? null : I(n)
47
+ onClick: v,
48
+ render: r ? w(n) : void 0,
49
+ children: r ? null : W(n)
48
50
  }
49
51
  ),
50
- /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(R, { collisionPadding: 8, sideOffset: 4, children: /* @__PURE__ */ l(
51
- z,
52
+ /* @__PURE__ */ t(z, { children: /* @__PURE__ */ t(
53
+ E,
52
54
  {
53
- className: "z-50 flex max-w-[16rem] flex-col gap-1 rounded-xl border border-stone-200 bg-white px-4 py-3 shadow-[0_10px_16px_-3px_rgb(10_10_10/0.05),0_3px_10px_-2px_rgb(10_10_10/0.02)] dark:border-stone-900 dark:bg-stone-950",
54
- "data-component-part": "tooltip-content",
55
- children: [
56
- !!o && /* @__PURE__ */ t(
57
- "p",
58
- {
59
- className: "font-medium text-stone-900 text-xs leading-4 dark:text-stone-200",
60
- "data-component-part": "tooltip-title",
61
- children: o
62
- }
63
- ),
64
- !!e && /* @__PURE__ */ t(
65
- "p",
66
- {
67
- className: "text-stone-600 text-xs leading-4 dark:text-stone-400",
68
- "data-component-part": "tooltip-description",
69
- children: e
70
- }
71
- ),
72
- p && a && /* @__PURE__ */ l(
73
- "a",
74
- {
75
- href: a,
76
- ...C(a) ? { target: "_blank", rel: "noreferrer" } : {},
77
- className: "mt-2! flex items-center gap-0.5 rounded-sm font-medium text-stone-600 text-xs leading-4 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 dark:text-stone-400 dark:hover:text-primary-light",
78
- "data-component-part": "tooltip-cta",
79
- children: [
80
- p,
81
- /* @__PURE__ */ t(
82
- P,
83
- {
84
- "aria-hidden": "true",
85
- className: "size-3",
86
- strokeWidth: 2.5
87
- }
88
- )
89
- ]
90
- }
91
- )
92
- ]
55
+ align: g,
56
+ collisionPadding: 8,
57
+ side: x,
58
+ sideOffset: 4,
59
+ children: /* @__PURE__ */ l(
60
+ I,
61
+ {
62
+ className: "z-50 flex max-w-[16rem] flex-col gap-1 rounded-xl border border-stone-200 bg-white px-4 py-3 shadow-[0_10px_16px_-3px_rgb(10_10_10/0.05),0_3px_10px_-2px_rgb(10_10_10/0.02)] dark:border-stone-900 dark:bg-stone-950",
63
+ "data-component-part": "tooltip-content",
64
+ children: [
65
+ !!o && /* @__PURE__ */ t(
66
+ "p",
67
+ {
68
+ className: "font-medium text-stone-900 text-xs leading-4 dark:text-stone-200",
69
+ "data-component-part": "tooltip-title",
70
+ children: o
71
+ }
72
+ ),
73
+ !!e && /* @__PURE__ */ t(
74
+ "p",
75
+ {
76
+ className: "text-stone-600 text-xs leading-4 dark:text-stone-400",
77
+ "data-component-part": "tooltip-description",
78
+ children: e
79
+ }
80
+ ),
81
+ p && a && /* @__PURE__ */ l(
82
+ "a",
83
+ {
84
+ href: a,
85
+ ...P(a) ? { target: "_blank", rel: "noreferrer" } : {},
86
+ className: "mt-2! flex items-center gap-0.5 rounded-sm font-medium text-stone-600 text-xs leading-4 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 dark:text-stone-400 dark:hover:text-primary-light",
87
+ "data-component-part": "tooltip-cta",
88
+ children: [
89
+ p,
90
+ /* @__PURE__ */ t(
91
+ O,
92
+ {
93
+ "aria-hidden": "true",
94
+ className: "size-3",
95
+ strokeWidth: 2.5
96
+ }
97
+ )
98
+ ]
99
+ }
100
+ )
101
+ ]
102
+ }
103
+ )
93
104
  }
94
- ) }) })
105
+ ) })
95
106
  ] }) });
96
- }, E = (e) => d(e) ? typeof e.type == "function" || typeof e.type == "object" ? !0 : typeof e.type == "string" ? ["button", "a", "input", "select", "textarea"].includes(
107
+ }, L = (e) => d(e) ? typeof e.type == "function" || typeof e.type == "object" ? !0 : typeof e.type == "string" ? ["button", "a", "input", "select", "textarea"].includes(
97
108
  e.type.toLowerCase()
98
- ) : !1 : !1, I = (e) => d(e) ? e : /* @__PURE__ */ t(
109
+ ) : !1 : !1, W = (e) => d(e) ? e : /* @__PURE__ */ t(
99
110
  "span",
100
111
  {
101
112
  className: u(
102
- k.Tooltip,
113
+ C.Tooltip,
103
114
  "underline decoration-2 decoration-stone-400 decoration-dotted underline-offset-4 dark:decoration-stone-500"
104
115
  ),
105
116
  children: e
106
117
  }
107
118
  );
108
119
  export {
109
- K as Tooltip
120
+ X as Tooltip
110
121
  };
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/components/view/view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAuB,MAAM,OAAO,CAAC;AAI3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG,aAAa,GAC5B,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC,CAAC;AAE7D,QAAA,MAAM,IAAI,sPAwBT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/components/view/view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAwB,MAAM,OAAO,CAAC;AAK5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG,aAAa,GAC5B,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC,CAAC;AAE7D,QAAA,MAAM,IAAI,sPA4BT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EAAE,SAAS,EAAE,CAAC"}
@@ -1,26 +1,32 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as f, useMemo as l } from "react";
3
- import { Classes as p } from "../../constants/selectors.js";
4
- import { cn as u } from "../../utils/cn.js";
5
- const c = f(
6
- ({ children: o, title: r, items: e, className: s, ...t }, m) => l(() => {
7
- var i;
8
- return (i = e.find((n) => n.title === r)) == null ? void 0 : i.active;
9
- }, [e, r]) ? /* @__PURE__ */ a(
10
- "div",
11
- {
12
- className: u(
13
- p.MultiViewItem,
14
- "prose dark:prose-invert",
15
- s
16
- ),
17
- ref: m,
18
- ...t,
19
- children: o
20
- }
21
- ) : null
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { forwardRef as l, useState as c } from "react";
3
+ import { Classes as d } from "../../constants/selectors.js";
4
+ import { useIsomorphicLayoutEffect as w } from "../../hooks/use-isomorphic-layout-effect.js";
5
+ import { cn as V } from "../../utils/cn.js";
6
+ const v = l(
7
+ ({ children: t, title: r, items: o, className: i, ...s }, m) => {
8
+ var e;
9
+ const [f, a] = c(!1);
10
+ w(() => {
11
+ a(!0);
12
+ }, []);
13
+ const n = (e = o.find((p) => p.title === r)) == null ? void 0 : e.active;
14
+ return f && n ? /* @__PURE__ */ u(
15
+ "div",
16
+ {
17
+ className: V(
18
+ d.MultiViewItem,
19
+ "prose dark:prose-invert",
20
+ i
21
+ ),
22
+ ref: m,
23
+ ...s,
24
+ children: t
25
+ }
26
+ ) : null;
27
+ }
22
28
  );
23
- c.displayName = "View";
29
+ v.displayName = "View";
24
30
  export {
25
- c as View
31
+ v as View
26
32
  };