@mintlify/components 1.0.4 → 1.0.6

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,7 +1,7 @@
1
1
  import { jsx as r, jsxs as w } from "react/jsx-runtime";
2
2
  import I from "../../_virtual/index.js";
3
3
  import { Classes as v } from "../../constants/selectors.js";
4
- import { DangerIcon as $, CheckIcon as A, TipIcon as T, NoteIcon as _, WarningIcon as D, InfoIcon as L } from "../../icons/index.js";
4
+ import { DangerIcon as $, CheckIcon as A, TipIcon as _, NoteIcon as T, WarningIcon as D, InfoIcon as L } from "../../icons/index.js";
5
5
  import { cn as x } from "../../utils/cn.js";
6
6
  import { Icon as W } from "../icon/icon.js";
7
7
  const j = {
@@ -18,13 +18,13 @@ const j = {
18
18
  childrenClassName: "text-yellow-800 dark:text-yellow-300"
19
19
  },
20
20
  note: {
21
- icon: _,
21
+ icon: T,
22
22
  defaultAriaLabel: "Note",
23
23
  className: "border border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-600/20",
24
24
  childrenClassName: "text-blue-800 dark:text-blue-300"
25
25
  },
26
26
  tip: {
27
- icon: T,
27
+ icon: _,
28
28
  defaultAriaLabel: "Tip",
29
29
  className: 'border border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-600/20 **:data-[component-part="callout-icon"]:mt-px',
30
30
  childrenClassName: "text-green-800 dark:text-green-300"
@@ -109,7 +109,7 @@ const j = {
109
109
  "div",
110
110
  {
111
111
  className: x(
112
- "prose dark:prose-invert w-full min-w-0 text-sm [&_a]:border-current [&_a]:text-current! [&_code]:text-current! [&_kbd]:bg-stone-100 [&_kbd]:text-current! dark:[&_kbd]:bg-stone-800",
112
+ "prose dark:prose-invert w-full min-w-0 text-sm [&_a]:border-current [&_a]:text-current! [&_code]:text-current! [&_kbd]:bg-stone-100 [&_kbd]:text-current! dark:[&_kbd]:bg-stone-800 [&_strong]:text-current!",
113
113
  d
114
114
  ),
115
115
  "data-component-part": "callout-content",
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAG5B,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,IAAI,GAAI,kIAaX,SAAS,mDAwHX,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAG5B,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,IAAI,GAAI,kIAaX,SAAS,mDAyHX,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EAAE,SAAS,EAAE,CAAC"}
@@ -2,12 +2,12 @@ import { jsx as n } from "react/jsx-runtime";
2
2
  import { MINTLIFY_ICONS_CDN_URL as C } from "../../constants/index.js";
3
3
  import { Classes as N } from "../../constants/selectors.js";
4
4
  import { cn as i } from "../../utils/cn.js";
5
- import { getIconUrl as y, ICON_TYPES as M } from "../../utils/icon-utils.js";
6
- import { isAbsoluteUrl as $ } from "../../utils/is-absolute-url.js";
7
- const w = ({
5
+ import { getIconUrl as y, ICON_TYPES as M, isBrandsIcon as $ } from "../../utils/icon-utils.js";
6
+ import { isAbsoluteUrl as v } from "../../utils/is-absolute-url.js";
7
+ const x = ({
8
8
  icon: t,
9
9
  iconType: a,
10
- color: s,
10
+ color: e,
11
11
  colorLight: g,
12
12
  colorDark: p,
13
13
  size: k,
@@ -22,22 +22,22 @@ const w = ({
22
22
  ...!I && { width: k || 16, height: k || 16 },
23
23
  display: "inline-block",
24
24
  verticalAlign: "middle"
25
- }, e = g && p, r = e ? {
25
+ }, s = g && p, r = s ? {
26
26
  ...b,
27
27
  "--color-light": g,
28
28
  "--color-dark": p
29
29
  } : b, o = i(
30
30
  N.Icon,
31
31
  "inline",
32
- !(s || e || l) && "bg-primary dark:bg-primary-light",
33
- e && "bg-(--color-light) dark:bg-(--color-dark)",
32
+ !(e || s || l) && "bg-primary dark:bg-primary-light",
33
+ s && "bg-(--color-light) dark:bg-(--color-dark)",
34
34
  f
35
35
  ), W = h === "pdf", m = y(t.toLowerCase(), a, d);
36
36
  if (a && !M.includes(a))
37
37
  return console.log(
38
38
  `Invalid iconType ${a} expected a string equal to one of: brands, duotone, light, regular, sharp-solid, solid, thin`
39
39
  ), null;
40
- if (typeof t == "string" && ($(t) || t.startsWith("/"))) {
40
+ if (typeof t == "string" && (v(t) || t.startsWith("/"))) {
41
41
  if (t.startsWith(C) || t.startsWith("https://mintlify.b-cdn.net"))
42
42
  return /* @__PURE__ */ n(
43
43
  "svg",
@@ -52,7 +52,7 @@ const w = ({
52
52
  maskRepeat: "no-repeat",
53
53
  maskPosition: "center",
54
54
  maskSize: "100%",
55
- ...!e && { backgroundColor: "currentColor" },
55
+ ...!s && { backgroundColor: "currentColor" },
56
56
  ...r
57
57
  }
58
58
  }
@@ -78,7 +78,7 @@ const w = ({
78
78
  alt: t,
79
79
  className: i(
80
80
  o,
81
- !(s || l || e) && "bg-stone-800 dark:bg-stone-100"
81
+ !(e || l || s) && "bg-stone-800 dark:bg-stone-100"
82
82
  ),
83
83
  "data-component-part": "icon-image",
84
84
  src: m,
@@ -93,7 +93,7 @@ const w = ({
93
93
  {
94
94
  className: i(
95
95
  o,
96
- !(s || l || e) && "bg-stone-800 dark:bg-stone-100"
96
+ !(e || l || s) && "bg-stone-800 dark:bg-stone-100"
97
97
  ),
98
98
  "data-component-part": "icon-svg",
99
99
  style: {
@@ -103,13 +103,13 @@ const w = ({
103
103
  maskImage: `url(${m})`,
104
104
  maskRepeat: "no-repeat",
105
105
  maskPosition: "center",
106
- maskSize: d === "lucide" ? "100%" : void 0,
107
- backgroundColor: s,
106
+ maskSize: d === "lucide" && !$(t) ? "100%" : void 0,
107
+ backgroundColor: e,
108
108
  ...r
109
109
  }
110
110
  }
111
111
  );
112
112
  };
113
113
  export {
114
- w as Icon
114
+ x as Icon
115
115
  };
@@ -1,3 +1,5 @@
1
+ export type { ParamHeadProps } from './param-head';
2
+ export { ParamHead } from './param-head';
1
3
  export type { PropertyProps } from './property';
2
4
  export { Property } from './property';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/property/index.tsx"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/property/index.tsx"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { PropertyProps } from './property';
2
2
  type ParamHeadProps = Omit<PropertyProps, "children">;
3
3
  declare const ParamHead: ({ name, type, location, required, deprecated, default: defaultValue, id, pre, post, onMount, navigateToHeaderAriaLabel, defaultLabel, requiredLabel, deprecatedLabel, }: ParamHeadProps) => import("react/jsx-runtime").JSX.Element | null;
4
- export { ParamHead };
4
+ export { ParamHead, type ParamHeadProps };
5
5
  //# sourceMappingURL=param-head.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"param-head.d.ts","sourceRoot":"","sources":["../../../src/components/property/param-head.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AAEtD,QAAA,MAAM,SAAS,GAAI,yKAehB,cAAc,mDA4HhB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"param-head.d.ts","sourceRoot":"","sources":["../../../src/components/property/param-head.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AAEtD,QAAA,MAAM,SAAS,GAAI,yKAehB,cAAc,mDA4HhB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/search/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,OAAO,CAAC;AAI9D,KAAK,iBAAiB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACjE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,YAAY;mBAJD,OAAO;mBACP,MAAM;qDAsDtB,CAAC;AAIF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/search/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,OAAO,CAAC;AAI9D,KAAK,iBAAiB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACjE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,QAAA,MAAM,YAAY;mBAJD,OAAO;mBACP,MAAM;qDAwDtB,CAAC;AAIF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as x } from "react";
3
- import { cn as l } from "../../utils/cn.js";
4
- import { useSearch as p } from "./provider.js";
3
+ import { cn as p } from "../../utils/cn.js";
4
+ import { useSearch as l } from "./provider.js";
5
5
  import u from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/search.js";
6
- const b = x(
6
+ const h = x(
7
7
  ({
8
8
  showShortcut: o = !0,
9
9
  shortcutText: s = "⌘K",
@@ -12,20 +12,22 @@ const b = x(
12
12
  onClick: e,
13
13
  ...d
14
14
  }, i) => {
15
- const t = p(), m = (c) => {
15
+ const t = l(), m = (c) => {
16
16
  t == null || t.open(), e == null || e(c);
17
17
  };
18
18
  return /* @__PURE__ */ f(
19
19
  "button",
20
20
  {
21
- className: l(
21
+ className: p(
22
22
  "flex w-full items-center gap-2 px-3 py-2 text-left text-sm",
23
- "bg-white dark:bg-stone-900",
24
- "border border-stone-200 dark:border-stone-700",
23
+ "bg-transparent",
24
+ "border border-stone-200 dark:border-white/10",
25
25
  "rounded-xl",
26
- "hover:bg-stone-50 dark:hover:bg-stone-800",
27
- "focus:outline-none focus:ring-2 focus:ring-stone-400 dark:focus:ring-stone-600",
26
+ "text-stone-500",
27
+ "hover:border-stone-300 dark:hover:border-white/20",
28
+ "focus:outline-none focus:ring-0 focus:ring-offset-0",
28
29
  "transition-colors",
30
+ "cursor-pointer",
29
31
  n
30
32
  ),
31
33
  onClick: m,
@@ -36,18 +38,18 @@ const b = x(
36
38
  /* @__PURE__ */ r(
37
39
  u,
38
40
  {
39
- className: "shrink-0 text-stone-400 dark:text-stone-500",
41
+ className: "shrink-0 text-stone-800 dark:text-stone-500",
40
42
  size: 16
41
43
  }
42
44
  ),
43
45
  /* @__PURE__ */ r("span", { className: "flex-1 text-stone-500 dark:text-stone-400", children: a || "Search..." }),
44
- o && /* @__PURE__ */ r("kbd", { className: "hidden items-center gap-0.5 rounded border border-stone-200 bg-stone-100 px-1.5 py-0.5 font-medium font-sans text-stone-500 text-xs sm:inline-flex dark:border-stone-700 dark:bg-stone-800 dark:text-stone-400", children: s })
46
+ o && /* @__PURE__ */ r("kbd", { className: "hidden items-center gap-0.5 rounded px-1.5 py-0.5 font-medium font-sans text-stone-500 text-xs sm:inline-flex dark:text-stone-400", children: s })
45
47
  ]
46
48
  }
47
49
  );
48
50
  }
49
51
  );
50
- b.displayName = "SearchButton";
52
+ h.displayName = "SearchButton";
51
53
  export {
52
- b as SearchButton
54
+ h as SearchButton
53
55
  };
@@ -4,6 +4,7 @@ type SearchResult = {
4
4
  header: string;
5
5
  content: string;
6
6
  link: string;
7
+ icon?: ReactNode;
7
8
  metadata?: {
8
9
  breadcrumbs?: string[];
9
10
  [key: string]: unknown;
@@ -22,14 +23,16 @@ type SearchProps = {
22
23
  emptyState?: ReactNode;
23
24
  loadingState?: ReactNode;
24
25
  position?: "top" | "center";
26
+ paddingTop?: string;
25
27
  };
26
28
  type SearchHitProps = {
27
29
  isActive: boolean;
28
30
  header: string;
29
31
  description: string;
32
+ icon?: ReactNode;
30
33
  metadata?: SearchResult["metadata"];
31
34
  };
32
- declare const SearchHit: ({ isActive, header, description, metadata, }: SearchHitProps) => import("react/jsx-runtime").JSX.Element;
35
+ declare const SearchHit: ({ isActive, header, description, icon, metadata, }: SearchHitProps) => import("react/jsx-runtime").JSX.Element;
33
36
  declare const Search: import('react').ForwardRefExoticComponent<SearchProps & import('react').RefAttributes<HTMLInputElement>>;
34
37
  export type { SearchResult, SearchProps };
35
38
  export { Search, SearchHit };
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/search/search.tsx"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAGf,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ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useImperativeHandle as M, useEffect as O, useCallback as x, useMemo as b, Fragment as f } from "react";
3
- import { cn as d } from "../../utils/cn.js";
4
- import { Combobox as P, ComboboxInput as X, ComboboxOptions as B, ComboboxOption as T } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/combobox/combobox.js";
5
- import J from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/search.js";
6
- import U from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/loader-circle.js";
7
- import V from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/search-x.js";
8
- import { Transition as W, TransitionChild as C } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/transition/transition.js";
9
- import { Dialog as Y, DialogPanel as Z } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/dialog/dialog.js";
10
- const F = ({
11
- isActive: m,
1
+ import { jsxs as s, jsx as t, Fragment as g } from "react/jsx-runtime";
2
+ import { forwardRef as G, useState as T, useRef as M, useImperativeHandle as O, useEffect as P, useCallback as p, useMemo as b, Fragment as x } from "react";
3
+ import { cn as m } from "../../utils/cn.js";
4
+ import { Combobox as X, ComboboxInput as B, ComboboxOptions as J, ComboboxOption as C } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/combobox/combobox.js";
5
+ import U from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/search.js";
6
+ import V from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/loader-circle.js";
7
+ import W from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/search-x.js";
8
+ import { Transition as Y, TransitionChild as F } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/transition/transition.js";
9
+ import { Dialog as Z, DialogPanel as _ } from "../../node_modules/.pnpm/@headlessui_react@2.2.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@headlessui/react/dist/components/dialog/dialog.js";
10
+ import L from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/chevron-right.js";
11
+ const j = ({
12
+ isActive: d,
12
13
  header: r,
13
- description: c,
14
- metadata: o
15
- }) => /* @__PURE__ */ n(
14
+ description: i,
15
+ icon: o,
16
+ metadata: n
17
+ }) => /* @__PURE__ */ s(
16
18
  "div",
17
19
  {
18
- className: d(
19
- "flex w-full cursor-pointer flex-col gap-1 rounded-md px-2.5 py-2 transition-colors",
20
- m && "bg-stone-100 dark:bg-white/5"
20
+ className: m(
21
+ "flex w-full cursor-pointer items-start gap-2 rounded-xl border border-transparent bg-transparent px-3 py-2 text-stone-500 transition-colors focus:ring-0 focus:ring-offset-0",
22
+ d && "bg-stone-100 dark:bg-white/5"
21
23
  ),
22
24
  children: [
23
- (o == null ? void 0 : o.breadcrumbs) && o.breadcrumbs.length > 0 && /* @__PURE__ */ t("div", { className: "flex items-center gap-1 truncate text-stone-500 text-xs dark:text-stone-400", children: o.breadcrumbs.map((s, h) => (
24
- // biome-ignore lint/suspicious/noArrayIndexKey: Breadcrumbs are positional and may contain duplicates
25
- /* @__PURE__ */ n(f, { children: [
26
- h > 0 && /* @__PURE__ */ t("span", { className: "text-stone-400", children: " > " }),
27
- /* @__PURE__ */ t("span", { className: "truncate", children: s })
28
- ] }, h)
29
- )) }),
30
- /* @__PURE__ */ t("div", { className: "truncate font-medium text-sm text-stone-900 dark:text-white", children: r }),
31
- c && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-sm text-stone-600 dark:text-stone-400", children: c })
25
+ o && /* @__PURE__ */ t("div", { className: "shrink-0 self-center text-stone-700 dark:text-stone-300", children: o }),
26
+ /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col gap-1", children: [
27
+ (n == null ? void 0 : n.breadcrumbs) && n.breadcrumbs.length > 0 && /* @__PURE__ */ t("div", { className: "flex items-center gap-1 truncate text-stone-500 text-xs dark:text-stone-400", children: n.breadcrumbs.map((f, c) => (
28
+ // biome-ignore lint/suspicious/noArrayIndexKey: Breadcrumbs are positional and may contain duplicates
29
+ /* @__PURE__ */ s(x, { children: [
30
+ c > 0 && /* @__PURE__ */ t("span", { className: "text-stone-400", children: " > " }),
31
+ /* @__PURE__ */ t("span", { className: "truncate", children: f })
32
+ ] }, c)
33
+ )) }),
34
+ /* @__PURE__ */ t("div", { className: "truncate font-medium text-sm text-stone-900 dark:text-white", children: r }),
35
+ i && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-sm text-stone-600 dark:text-stone-400", children: i })
36
+ ] }),
37
+ d && /* @__PURE__ */ t(L, { className: "size-5 shrink-0 self-center text-stone-400 dark:text-stone-500" })
32
38
  ]
33
39
  }
34
- ), _ = q(
40
+ ), ee = G(
35
41
  ({
36
- onSearch: m,
42
+ onSearch: d,
37
43
  results: r,
38
- isOpen: c,
44
+ isOpen: i,
39
45
  onClose: o,
40
- isLoading: s = !1,
41
- placeholder: h = "Search...",
42
- recentSearches: l = [],
43
- onSelectResult: p,
44
- className: j,
45
- emptyState: z,
46
- loadingState: S,
47
- position: D = "top"
48
- }, E) => {
49
- const [a, y] = N(""), [v, k] = N(!1), w = G(null);
50
- M(E, () => w.current), O(() => {
51
- c || (y(""), k(!1));
52
- }, [c]);
53
- const K = x(
46
+ isLoading: n = !1,
47
+ placeholder: f = "Search...",
48
+ recentSearches: c = [],
49
+ onSelectResult: h,
50
+ className: z,
51
+ emptyState: S,
52
+ loadingState: D,
53
+ position: y = "top",
54
+ paddingTop: E = "64px"
55
+ }, K) => {
56
+ const [a, k] = T(""), [v, N] = T(!1), w = M(null);
57
+ O(K, () => w.current), P(() => {
58
+ i || (k(""), N(!1));
59
+ }, [i]);
60
+ const R = p(
54
61
  (e) => {
55
- y(e), m(e);
62
+ k(e), d(e);
56
63
  },
57
- [m]
58
- ), u = x(
64
+ [d]
65
+ ), u = p(
59
66
  (e) => {
60
- e && (p == null || p(e, a), o());
67
+ e && (h == null || h(e, a), o());
61
68
  },
62
- [p, a, o]
63
- ), H = x(
69
+ [h, a, o]
70
+ ), H = p(
64
71
  (e) => {
65
72
  if (e.key === "Escape") {
66
73
  e.preventDefault(), o();
67
74
  return;
68
75
  }
69
- if (e.key === "Tab" && (r.length > 0 || l.length > 0) && (e.preventDefault(), e.currentTarget.setSelectionRange(
76
+ if (e.key === "Tab" && (r.length > 0 || c.length > 0) && (e.preventDefault(), e.currentTarget.setSelectionRange(
70
77
  e.currentTarget.value.length,
71
78
  e.currentTarget.value.length
72
- )), e.key === "Enter" && (e.metaKey || e.ctrlKey) && a && r.length > 0 && !s) {
73
- const i = r[0];
74
- i && u(i);
79
+ )), e.key === "Enter" && (e.metaKey || e.ctrlKey) && a && r.length > 0 && !n) {
80
+ const l = r[0];
81
+ l && u(l);
75
82
  }
76
83
  },
77
- [r, l, u, o, a, s]
78
- ), I = x((e) => {
79
- k(e.currentTarget.scrollTop > 0);
80
- }, []), R = b(
81
- () => !a && l.length > 0 && r.length === 0,
82
- [a, l.length, r.length]
83
- ), A = b(
84
- () => a && r.length > 0 && !s,
85
- [a, r.length, s]
86
- ), Q = b(
87
- () => a && !s && r.length === 0,
88
- [a, s, r.length]
89
- ), $ = /* @__PURE__ */ n(
90
- P,
84
+ [r, c, u, o, a, n]
85
+ ), I = p((e) => {
86
+ N(e.currentTarget.scrollTop > 0);
87
+ }, []), Q = b(
88
+ () => !a && c.length > 0 && r.length === 0,
89
+ [a, c.length, r.length]
90
+ ), $ = b(
91
+ () => a && r.length > 0 && !n,
92
+ [a, r.length, n]
93
+ ), q = b(
94
+ () => a && !n && r.length === 0,
95
+ [a, n, r.length]
96
+ ), A = /* @__PURE__ */ s(
97
+ X,
91
98
  {
92
99
  onChange: (e) => {
93
100
  e && u(e);
94
101
  },
95
102
  value: null,
96
103
  children: [
97
- /* @__PURE__ */ n(
104
+ /* @__PURE__ */ s(
98
105
  "div",
99
106
  {
100
- className: d(
107
+ className: m(
101
108
  "relative z-10 h-14 border-transparent border-b p-1.5 transition",
102
109
  v && "border-stone-200 dark:border-white/10"
103
110
  ),
104
111
  children: [
105
112
  /* @__PURE__ */ t(
106
- X,
113
+ B,
107
114
  {
108
115
  autoComplete: "off",
109
116
  autoFocus: !0,
110
- className: d(
111
- "peer h-full w-full rounded-md bg-white pr-14 pl-11 text-stone-950 tracking-tight shadow-sm outline-none ring ring-black/5 transition placeholder:text-stone-400 focus:ring-black/90 dark:bg-stone-900 dark:text-white dark:focus:ring-white placeholder:dark:text-white/50",
117
+ className: m(
118
+ "peer h-full w-full rounded-xl bg-white pr-14 pl-11 text-stone-950 tracking-tight shadow-sm outline-none ring ring-black/5 transition placeholder:text-stone-400 focus:ring-black/90 dark:bg-stone-900 dark:text-white dark:focus:ring-white placeholder:dark:text-white/50",
112
119
  "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none",
113
120
  !v && a && "shadow-lg"
114
121
  ),
115
- onChange: (e) => K(e.target.value),
122
+ onChange: (e) => R(e.target.value),
116
123
  onKeyDown: H,
117
- placeholder: h,
124
+ placeholder: f,
118
125
  ref: w,
119
126
  type: "search",
120
127
  value: a
121
128
  }
122
129
  ),
123
130
  /* @__PURE__ */ t(
124
- J,
131
+ U,
125
132
  {
126
133
  className: "absolute top-1/2 left-5 -translate-y-1/2 text-stone-950 opacity-50 peer-focus:opacity-100 dark:text-white",
127
134
  size: 18
@@ -131,26 +138,27 @@ const F = ({
131
138
  ]
132
139
  }
133
140
  ),
134
- /* @__PURE__ */ n(
135
- B,
141
+ /* @__PURE__ */ s(
142
+ J,
136
143
  {
137
144
  className: "mx-1.5 max-h-[calc(100vh-10rem)] overflow-y-auto",
138
145
  onScroll: I,
139
146
  static: !0,
140
147
  children: [
141
- R && /* @__PURE__ */ n(g, { children: [
148
+ Q && /* @__PURE__ */ s(g, { children: [
142
149
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between px-2.5 py-2", children: /* @__PURE__ */ t("span", { className: "truncate text-sm text-stone-500", children: "Recent searches" }) }),
143
- l.map((e) => /* @__PURE__ */ t(
144
- T,
150
+ c.map((e) => /* @__PURE__ */ t(
151
+ C,
145
152
  {
146
- className: "last:mb-1.5",
153
+ className: "last:mb-2",
147
154
  value: e,
148
- children: ({ focus: i }) => /* @__PURE__ */ t(
149
- F,
155
+ children: ({ focus: l }) => /* @__PURE__ */ t(
156
+ j,
150
157
  {
151
158
  description: e.content,
152
159
  header: e.header,
153
- isActive: i,
160
+ icon: e.icon,
161
+ isActive: l,
154
162
  metadata: e.metadata
155
163
  }
156
164
  )
@@ -158,37 +166,38 @@ const F = ({
158
166
  e.id
159
167
  ))
160
168
  ] }),
161
- A && r.map((e) => /* @__PURE__ */ t(
162
- T,
169
+ $ && r.map((e) => /* @__PURE__ */ t(
170
+ C,
163
171
  {
164
- className: "last:mb-1.5",
172
+ className: "last:mb-2",
165
173
  value: e,
166
- children: ({ focus: i }) => /* @__PURE__ */ t(
167
- F,
174
+ children: ({ focus: l }) => /* @__PURE__ */ t(
175
+ j,
168
176
  {
169
177
  description: e.content,
170
178
  header: e.header,
171
- isActive: i,
179
+ icon: e.icon,
180
+ isActive: l,
172
181
  metadata: e.metadata
173
182
  }
174
183
  )
175
184
  },
176
185
  e.id
177
186
  )),
178
- s && a && /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center gap-3 px-2.5 py-12", children: S || /* @__PURE__ */ n(g, { children: [
179
- /* @__PURE__ */ t(U, { className: "size-6 animate-spin text-stone-400 dark:text-stone-500" }),
180
- /* @__PURE__ */ n("div", { className: "text-center", children: [
187
+ n && a && /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center gap-3 px-2.5 py-12", children: D || /* @__PURE__ */ s(g, { children: [
188
+ /* @__PURE__ */ t(V, { className: "size-6 animate-spin text-stone-400 dark:text-stone-500" }),
189
+ /* @__PURE__ */ s("div", { className: "text-center", children: [
181
190
  /* @__PURE__ */ t("p", { className: "font-medium text-sm text-stone-700 dark:text-stone-300", children: "Searching..." }),
182
- /* @__PURE__ */ n("p", { className: "mt-1 text-stone-500 text-xs dark:text-stone-400", children: [
191
+ /* @__PURE__ */ s("p", { className: "mt-1 text-stone-500 text-xs dark:text-stone-400", children: [
183
192
  'Finding results for "',
184
193
  a,
185
194
  '"'
186
195
  ] })
187
196
  ] })
188
197
  ] }) }),
189
- Q && /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center gap-3 px-2.5 py-12", children: z || /* @__PURE__ */ n(g, { children: [
190
- /* @__PURE__ */ t(V, { className: "size-6 text-stone-300 dark:text-stone-600" }),
191
- /* @__PURE__ */ n("div", { className: "text-center", children: [
198
+ q && /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center gap-3 px-2.5 py-12", children: S || /* @__PURE__ */ s(g, { children: [
199
+ /* @__PURE__ */ t(W, { className: "size-6 text-stone-300 dark:text-stone-600" }),
200
+ /* @__PURE__ */ s("div", { className: "text-center", children: [
192
201
  /* @__PURE__ */ t("p", { className: "font-medium text-sm text-stone-700 dark:text-stone-300", children: "No results found" }),
193
202
  /* @__PURE__ */ t("p", { className: "mt-1 text-stone-500 text-xs dark:text-stone-400", children: "Try searching with different keywords" })
194
203
  ] })
@@ -199,17 +208,17 @@ const F = ({
199
208
  ]
200
209
  }
201
210
  );
202
- return /* @__PURE__ */ t(W, { appear: !0, as: f, show: c, children: /* @__PURE__ */ n(
203
- Y,
211
+ return /* @__PURE__ */ t(Y, { appear: !0, as: x, show: i, children: /* @__PURE__ */ s(
212
+ Z,
204
213
  {
205
214
  as: "div",
206
- className: d("relative z-50", j),
215
+ className: m("relative z-50", z),
207
216
  onClose: o,
208
217
  children: [
209
218
  /* @__PURE__ */ t(
210
- C,
219
+ F,
211
220
  {
212
- as: f,
221
+ as: x,
213
222
  enter: "ease-out duration-100",
214
223
  enterFrom: "opacity-0",
215
224
  enterTo: "opacity-100",
@@ -222,21 +231,22 @@ const F = ({
222
231
  /* @__PURE__ */ t(
223
232
  "div",
224
233
  {
225
- className: d(
234
+ className: m(
226
235
  "fixed inset-0 z-10 flex justify-center p-4",
227
- D === "top" ? "items-start pt-16" : "items-center"
236
+ y === "top" ? "items-start" : "items-center"
228
237
  ),
238
+ style: y === "top" ? { paddingTop: E } : void 0,
229
239
  children: /* @__PURE__ */ t(
230
- C,
240
+ F,
231
241
  {
232
- as: f,
242
+ as: x,
233
243
  enter: "ease-out duration-100",
234
244
  enterFrom: "opacity-0 scale-95",
235
245
  enterTo: "opacity-100 scale-100",
236
246
  leave: "ease-in duration-50",
237
247
  leaveFrom: "opacity-100 scale-100",
238
248
  leaveTo: "opacity-0 scale-95",
239
- children: /* @__PURE__ */ t(Z, { className: "flex w-full max-w-[640px] flex-col overflow-hidden rounded-xl border border-stone-200 bg-white shadow-2xl dark:border-white/10 dark:bg-stone-900", children: $ })
249
+ children: /* @__PURE__ */ t(_, { className: "flex w-full max-w-[640px] flex-col overflow-hidden rounded-2xl border border-stone-200 bg-white shadow-2xl dark:border-white/10 dark:bg-stone-900", children: A })
240
250
  }
241
251
  )
242
252
  }
@@ -246,8 +256,8 @@ const F = ({
246
256
  ) });
247
257
  }
248
258
  );
249
- _.displayName = "Search";
259
+ ee.displayName = "Search";
250
260
  export {
251
- _ as Search,
252
- F as SearchHit
261
+ ee as Search,
262
+ j as SearchHit
253
263
  };