@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,19 +1,20 @@
1
1
  import { jsxs as y, jsx as n } from "react/jsx-runtime";
2
2
  import C from "../../node_modules/.pnpm/mermaid@11.12.2/node_modules/mermaid/dist/mermaid.core.js";
3
- import { useState as l, useRef as T, useId as F, useEffect as c } from "react";
3
+ import { useState as l, useRef as D, useId as F, useEffect as c } from "react";
4
4
  import { Classes as x } from "../../constants/selectors.js";
5
- import { useIsDarkTheme as Z } from "../../hooks/use-is-dark-theme.js";
5
+ import { useIsDarkTheme as H } from "../../hooks/use-is-dark-theme.js";
6
6
  import { cn as I } from "../../utils/cn.js";
7
- import { usePanZoom as D } from "./use-pan-zoom.js";
8
- import { ZoomControls as H } from "./zoom-controls.js";
9
- const L = 120, K = ({
7
+ import { makeMarkerIdsUnique as L } from "../../utils/make-marker-ids-unique.js";
8
+ import { usePanZoom as Z } from "./use-pan-zoom.js";
9
+ import { ZoomControls as q } from "./zoom-controls.js";
10
+ const j = 120, A = 800, V = ({
10
11
  chart: u,
11
12
  className: f,
12
- ariaLabel: O = "Mermaid diagram",
13
- placement: w = "bottom-right",
13
+ ariaLabel: T = "Mermaid diagram",
14
+ placement: k = "bottom-right",
14
15
  actions: o
15
16
  }) => {
16
- const [R, p] = l(""), [h, a] = l(null), [k, E] = l(!1), g = T(null), v = F(), { isDarkTheme: b } = Z(), { style: M, zoomIn: S, zoomOut: _, reset: s, pan: z, panStep: N } = D();
17
+ const [O, p] = l(""), [g, a] = l(null), [_, w] = l(!1), h = D(null), v = F(), { isDarkTheme: b } = H(), { style: E, zoomIn: M, zoomOut: R, reset: s, pan: S, panStep: N } = Z();
17
18
  return c(() => {
18
19
  s(), a(null);
19
20
  }, [s]), c(() => {
@@ -22,17 +23,23 @@ const L = 120, K = ({
22
23
  const m = {
23
24
  startOnLoad: !1,
24
25
  fontFamily: "inherit",
25
- theme: b ? "dark" : "default"
26
+ theme: b ? "dark" : "default",
27
+ gantt: {
28
+ useWidth: A
29
+ }
26
30
  }, e = document.createElement("div");
27
31
  e.style.position = "absolute", e.style.left = "-9999px", e.style.top = "-9999px", document.body.appendChild(e);
28
32
  try {
29
33
  C.initialize(m);
30
- const r = `mermaid-${v.replace(/:/g, "")}-${Date.now()}`, { svg: i } = await C.render(r, u, e);
31
- t || (p(i), a(null));
34
+ const r = `mermaid-${v.replace(/:/g, "")}-${Date.now()}`, { svg: d } = await C.render(r, u, e);
35
+ if (!t) {
36
+ const z = L(d, r);
37
+ p(z), a(null);
38
+ }
32
39
  } catch (r) {
33
40
  if (console.error("Error while rendering mermaid", r), !t) {
34
- const i = r instanceof Error ? r.message : "Failed to render diagram";
35
- a(i), p("");
41
+ const d = r instanceof Error ? r.message : "Failed to render diagram";
42
+ a(d), p("");
36
43
  }
37
44
  } finally {
38
45
  document.body.removeChild(e);
@@ -43,19 +50,19 @@ const L = 120, K = ({
43
50
  }, [u, v, b]), c(() => {
44
51
  if (o !== void 0)
45
52
  return;
46
- const t = g.current;
53
+ const t = h.current;
47
54
  if (!t)
48
55
  return;
49
- const d = new ResizeObserver((m) => {
56
+ const i = new ResizeObserver((m) => {
50
57
  for (const e of m) {
51
58
  const r = e.contentRect.height;
52
- E(r >= L);
59
+ w(r >= j);
53
60
  }
54
61
  });
55
- return d.observe(t), () => {
56
- d.disconnect();
62
+ return i.observe(t), () => {
63
+ i.disconnect();
57
64
  };
58
- }, [o]), h ? /* @__PURE__ */ y(
65
+ }, [o]), g ? /* @__PURE__ */ y(
59
66
  "div",
60
67
  {
61
68
  className: I(
@@ -67,7 +74,7 @@ const L = 120, K = ({
67
74
  role: "alert",
68
75
  children: [
69
76
  /* @__PURE__ */ n("p", { className: "font-medium", "data-component-part": "mermaid-error-title", children: "Failed to render diagram" }),
70
- /* @__PURE__ */ n("p", { className: "mt-1 text-xs", "data-component-part": "mermaid-error-message", children: h })
77
+ /* @__PURE__ */ n("p", { className: "mt-1 text-xs", "data-component-part": "mermaid-error-message", children: g })
71
78
  ]
72
79
  }
73
80
  ) : /* @__PURE__ */ y(
@@ -79,26 +86,26 @@ const L = 120, K = ({
79
86
  f
80
87
  ),
81
88
  children: [
82
- (o === !0 || o === void 0 && k) && /* @__PURE__ */ n(
83
- H,
89
+ (o === !0 || o === void 0 && _) && /* @__PURE__ */ n(
90
+ q,
84
91
  {
85
- onPan: z,
92
+ onPan: S,
86
93
  onReset: s,
87
- onZoomIn: S,
88
- onZoomOut: _,
94
+ onZoomIn: M,
95
+ onZoomOut: R,
89
96
  panStep: N,
90
- placement: w
97
+ placement: k
91
98
  }
92
99
  ),
93
100
  /* @__PURE__ */ n(
94
101
  "div",
95
102
  {
96
- "aria-label": O,
97
- dangerouslySetInnerHTML: { __html: R },
103
+ "aria-label": T,
104
+ dangerouslySetInnerHTML: { __html: O },
98
105
  "data-component-part": "mermaid-diagram",
99
- ref: g,
106
+ ref: h,
100
107
  role: "img",
101
- style: M
108
+ style: E
102
109
  }
103
110
  )
104
111
  ]
@@ -106,5 +113,5 @@ const L = 120, K = ({
106
113
  );
107
114
  };
108
115
  export {
109
- K as Mermaid
116
+ V as Mermaid
110
117
  };
@@ -1,4 +1,5 @@
1
1
  import { default as React, ReactNode } from 'react';
2
+ import { Rect } from 'react-use-rect';
2
3
  import { IconLibrary, IconType } from '../../utils/icon-utils';
3
4
  import { StepTitleSize } from './constants';
4
5
  type Numberish = number | `${number}`;
@@ -12,6 +13,13 @@ type StepsItemProps = {
12
13
  titleSize?: StepTitleSize;
13
14
  className?: string;
14
15
  isLast?: boolean;
16
+ id?: string;
17
+ noAnchor?: boolean;
18
+ scrollElementIntoView?: (id: string) => void;
19
+ onCopyAnchorLink?: (id: string | undefined) => void;
20
+ onRegisterHeading?: (id: string, rect: Rect) => void;
21
+ onUnregisterHeading?: (id: string) => void;
22
+ _hasContext?: boolean;
15
23
  };
16
24
  type StepsProps = {
17
25
  children: React.ReactElement<StepsItemProps> | React.ReactElement<StepsItemProps>[];
@@ -20,7 +28,7 @@ type StepsProps = {
20
28
  };
21
29
  declare const Steps: {
22
30
  ({ children, titleSize, className }: StepsProps): import("react/jsx-runtime").JSX.Element;
23
- Item: ({ stepNumber, icon, iconType, iconLibrary, title, children, titleSize, className, isLast, }: StepsItemProps) => import("react/jsx-runtime").JSX.Element;
31
+ Item: ({ stepNumber, icon, iconType, iconLibrary, title, children, titleSize, className, isLast, id, noAnchor, scrollElementIntoView, onRegisterHeading, onUnregisterHeading, _hasContext, onCopyAnchorLink, }: StepsItemProps) => import("react/jsx-runtime").JSX.Element;
24
32
  };
25
33
  export { Steps };
26
34
  export type { StepsItemProps, StepsProps };
@@ -1 +1 @@
1
- {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/components/steps/steps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnE,KAAK,SAAS,GAAG,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AAEtC,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA8GF,KAAK,UAAU,G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CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACrD,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqOF,KAAK,UAAU,GAAG;IAChB,QAAQ,EACJ,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,GAClC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;IACzC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,KAAK;yCAAwC,UAAU;oNA1N1D,cAAc;CAkPhB,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC"}
@@ -1,92 +1,190 @@
1
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { Classes as d } from "../../constants/selectors.js";
3
- import { cn as o } from "../../utils/cn.js";
4
- import { STEP_TITLE_SIZES as N } from "./constants.js";
5
- import { Icon as g } from "../icon/icon.js";
6
- const h = ({
7
- stepNumber: r = 1,
8
- icon: s,
9
- iconType: m,
10
- iconLibrary: n,
11
- title: t,
12
- children: a,
13
- titleSize: i = "p",
14
- className: b,
15
- isLast: f = !1
1
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
2
+ import { useState as E, useCallback as z, useEffect as C } from "react";
3
+ import { useRect as O } from "../../node_modules/.pnpm/react-use-rect@2.0.6_react@18.3.1/node_modules/react-use-rect/dist/index.esm.js";
4
+ import { Classes as j } from "../../constants/selectors.js";
5
+ import { LinkIcon as Z } from "../../icons/index.js";
6
+ import { cn as r } from "../../utils/cn.js";
7
+ import { copyToClipboard as _ } from "../../utils/copy-to-clipboard.js";
8
+ import { STEP_TITLE_SIZES as q } from "./constants.js";
9
+ import { Icon as F } from "../icon/icon.js";
10
+ const M = ({
11
+ stepNumber: c = 1,
12
+ icon: o,
13
+ iconType: v,
14
+ iconLibrary: m,
15
+ title: s,
16
+ children: n,
17
+ titleSize: k = "p",
18
+ className: $,
19
+ isLast: P = !1,
20
+ id: e,
21
+ noAnchor: l = !1,
22
+ scrollElementIntoView: N,
23
+ onRegisterHeading: i,
24
+ onUnregisterHeading: f,
25
+ _hasContext: y,
26
+ onCopyAnchorLink: u
16
27
  }) => {
17
- const u = N.includes(i) ? i : "p", v = typeof s == "string" ? /* @__PURE__ */ e(
18
- g,
28
+ const [x, R] = E(null), [S, B] = E(!1), [D] = O(R), I = q.includes(k) ? k : "p", p = ["h2", "h3"].includes(I), T = z(async () => {
29
+ if (!p || l || !e || typeof window > "u")
30
+ return;
31
+ await _(
32
+ `${window.location.href.split("#")[0]}#${encodeURIComponent(e)}`
33
+ ) === "success" && (window.location.hash = encodeURIComponent(e), u == null || u(e));
34
+ }, [p, e, l, u]);
35
+ C(() => {
36
+ if (y && e && x)
37
+ return i == null || i(e, x), () => {
38
+ f == null || f(e);
39
+ };
40
+ }, [x, e, y, i, f]), C(() => {
41
+ if (!(!e || l))
42
+ try {
43
+ decodeURIComponent(window.location.hash.substring(1)) === e && (N == null || N(e));
44
+ } catch {
45
+ }
46
+ }, []);
47
+ const d = z(
48
+ (a) => {
49
+ !p || l || !e || B(a);
50
+ },
51
+ [p, l, e]
52
+ ), h = {
53
+ onMouseEnter: () => d(!0),
54
+ onMouseLeave: () => d(!1),
55
+ onClick: T
56
+ }, L = typeof o == "string" ? /* @__PURE__ */ t(
57
+ F,
19
58
  {
20
59
  className: "size-3 bg-stone-900 dark:bg-stone-50",
21
- icon: s,
22
- iconLibrary: n,
23
- iconType: m,
60
+ icon: o,
61
+ iconLibrary: m,
62
+ iconType: v,
24
63
  overrideColor: !0,
25
64
  overrideSize: !0
26
65
  }
27
- ) : s ?? Number(r);
66
+ ) : o ?? Number(c);
28
67
  return (
29
68
  // biome-ignore lint/a11y/useSemanticElements: TODO
30
- /* @__PURE__ */ c(
69
+ /* @__PURE__ */ w(
31
70
  "div",
32
71
  {
33
- className: o(
34
- d.Step,
72
+ className: r(
73
+ j.Step,
35
74
  "group/step relative flex items-start pb-5",
36
- b
75
+ $
37
76
  ),
38
77
  "data-component-part": "step-item",
78
+ id: e,
79
+ ref: D,
39
80
  role: "listitem",
40
81
  children: [
41
- /* @__PURE__ */ e(
82
+ /* @__PURE__ */ t(
42
83
  "div",
43
84
  {
44
- className: o(
85
+ className: r(
45
86
  "absolute top-11 h-[calc(100%-2.75rem)] w-px",
46
- f ? 'bg-linear-to-b from-stone-200 via-80% via-stone-200 to-transparent group-has-[[data-component-part="step-content"]:empty]/step:hidden dark:from-white/10 dark:via-white/10' : "bg-stone-200/70 dark:bg-white/10"
87
+ P ? 'bg-linear-to-b from-stone-200 via-80% via-stone-200 to-transparent group-has-[[data-component-part="step-content"]:empty]/step:hidden dark:from-white/10 dark:via-white/10' : "bg-stone-200/70 dark:bg-white/10"
47
88
  ),
48
89
  contentEditable: !1,
49
90
  "data-component-part": "step-line"
50
91
  }
51
92
  ),
52
- /* @__PURE__ */ e(
93
+ /* @__PURE__ */ t(
53
94
  "div",
54
95
  {
55
96
  className: "absolute ml-[-13px] py-2",
56
97
  contentEditable: !1,
57
98
  "data-component-part": "step-number",
58
- children: /* @__PURE__ */ e("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-full bg-stone-50 font-semibold text-stone-900 text-xs dark:bg-white/10 dark:text-stone-50", children: v })
99
+ children: /* @__PURE__ */ w(
100
+ "div",
101
+ {
102
+ className: "relative flex size-7 shrink-0 items-center justify-center rounded-full bg-stone-50 font-semibold text-stone-900 text-xs dark:bg-white/10 dark:text-stone-50",
103
+ onMouseEnter: () => d(!0),
104
+ onMouseLeave: () => d(!1),
105
+ children: [
106
+ /* @__PURE__ */ t("div", { className: r(S && "opacity-0"), children: L }),
107
+ p && !l && e && /* @__PURE__ */ t(
108
+ "div",
109
+ {
110
+ className: "absolute",
111
+ "data-component-part": "step-number-anchor-link",
112
+ children: /* @__PURE__ */ t(
113
+ "a",
114
+ {
115
+ "aria-label": "Navigate to header",
116
+ className: r(
117
+ "flex items-center border-0 opacity-0",
118
+ S && "opacity-100"
119
+ ),
120
+ href: `#${encodeURIComponent(e)}`,
121
+ onClick: (a) => {
122
+ a.preventDefault(), T();
123
+ },
124
+ children: /* @__PURE__ */ t("div", { className: "flex size-6 items-center justify-center", children: /* @__PURE__ */ t(Z, {}) })
125
+ }
126
+ )
127
+ }
128
+ )
129
+ ]
130
+ }
131
+ )
59
132
  }
60
133
  ),
61
- /* @__PURE__ */ c("div", { className: "w-full overflow-hidden pr-px pl-8", children: [
62
- !!t && (() => {
63
- const l = "mt-2 text-stone-900 dark:text-stone-200", p = {
134
+ /* @__PURE__ */ w("div", { className: "w-full overflow-hidden pr-px pl-8", children: [
135
+ !!s && (() => {
136
+ const a = "mt-2 text-stone-900 dark:text-stone-200", b = {
64
137
  contentEditable: !1,
65
138
  "data-component-part": "step-title"
66
139
  };
67
140
  return {
68
- p: /* @__PURE__ */ e(
141
+ p: /* @__PURE__ */ t(
69
142
  "p",
70
143
  {
71
- className: o(
72
- l,
144
+ className: r(
145
+ a,
73
146
  "prose dark:prose-invert font-semibold"
74
147
  ),
75
- ...p,
76
- children: t
148
+ ...b,
149
+ ...h,
150
+ children: s
77
151
  }
78
152
  ),
79
- h2: /* @__PURE__ */ e("h2", { className: l, ...p, children: t }),
80
- h3: /* @__PURE__ */ e("h3", { className: l, ...p, children: t }),
81
- h4: /* @__PURE__ */ e("h4", { className: l, ...p, children: t })
82
- }[u];
153
+ h2: /* @__PURE__ */ t(
154
+ "h2",
155
+ {
156
+ className: a,
157
+ ...b,
158
+ ...h,
159
+ children: s
160
+ }
161
+ ),
162
+ h3: /* @__PURE__ */ t(
163
+ "h3",
164
+ {
165
+ className: a,
166
+ ...b,
167
+ ...h,
168
+ children: s
169
+ }
170
+ ),
171
+ h4: /* @__PURE__ */ t(
172
+ "h4",
173
+ {
174
+ className: a,
175
+ ...b,
176
+ ...h,
177
+ children: s
178
+ }
179
+ )
180
+ }[I];
83
181
  })(),
84
- /* @__PURE__ */ e(
182
+ /* @__PURE__ */ t(
85
183
  "div",
86
184
  {
87
- className: o("prose dark:prose-invert", !t && "mt-2"),
185
+ className: r("prose dark:prose-invert", !s && "mt-2"),
88
186
  "data-component-part": "step-content",
89
- children: a
187
+ children: n
90
188
  }
91
189
  )
92
190
  ] })
@@ -94,33 +192,33 @@ const h = ({
94
192
  }
95
193
  )
96
194
  );
97
- }, x = ({ children: r, titleSize: s, className: m }) => {
98
- const n = (Array.isArray(r) ? r : [r]).filter(
195
+ }, G = ({ children: c, titleSize: o, className: v }) => {
196
+ const m = (Array.isArray(c) ? c : [c]).filter(
99
197
  Boolean
100
198
  );
101
199
  return (
102
200
  // biome-ignore lint/a11y/useSemanticElements: TODO
103
- /* @__PURE__ */ e(
201
+ /* @__PURE__ */ t(
104
202
  "div",
105
203
  {
106
- className: o(d.Steps, "mt-10 mb-6 ml-3.5", m),
204
+ className: r(j.Steps, "mt-10 mb-6 ml-3.5", v),
107
205
  "data-component-part": "steps",
108
206
  role: "list",
109
- children: n.map(({ props: t }, a) => /* @__PURE__ */ e(
110
- h,
207
+ children: m.map(({ props: s }, n) => /* @__PURE__ */ t(
208
+ M,
111
209
  {
112
- ...t,
113
- isLast: a === n.length - 1,
114
- stepNumber: t.stepNumber ?? a + 1,
115
- titleSize: t.titleSize ?? s
210
+ ...s,
211
+ isLast: n === m.length - 1,
212
+ stepNumber: s.stepNumber ?? n + 1,
213
+ titleSize: s.titleSize ?? o
116
214
  },
117
- `step-${a}`
215
+ `step-${n}`
118
216
  ))
119
217
  }
120
218
  )
121
219
  );
122
220
  };
123
- x.Item = h;
221
+ G.Item = M;
124
222
  export {
125
- x as Steps
223
+ G as Steps
126
224
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAKhE,KAAK,aAAa,GAAG;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,uBAAuB,CAAC,CAAC,EAAE,MAAM,CAAC;IACnC,CAAC,2BAA2B,CAAC,CAAC,EAAE,MAAM,CAAC;CACxC,CAAC;AAMF;;;;;;;;GAQG;AACH,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACvC,CAAC;AAgMF,eAAO,MAAM,IAAI,gGAtLd,SAAS;yBA/BoB,aAAa;CAuN3C,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CAAC"}
@@ -1,36 +1,42 @@
1
- import { jsxs as h, jsx as p, Fragment as N } from "react/jsx-runtime";
2
- import { useRef as R, useId as $, Children as C, isValidElement as B, useState as H, useEffect as j, useCallback as x } from "react";
1
+ import { jsxs as y, jsx as p, Fragment as R } from "react/jsx-runtime";
2
+ import { useRef as $, useId as C, useMemo as I, Children as B, isValidElement as H, useState as j, useEffect as M, useCallback as h } from "react";
3
3
  import { CHILD_TAB_IDS_ATTRIBUTE as S, CHILD_HEADING_IDS_ATTRIBUTE as U } from "../../constants/index.js";
4
- import { Classes as y } from "../../constants/selectors.js";
5
- import { cn as f } from "../../utils/cn.js";
4
+ import { Classes as v } from "../../constants/selectors.js";
5
+ import { cn as u } from "../../utils/cn.js";
6
6
  import { slugify as F } from "../../utils/slugify.js";
7
7
  import { Icon as K } from "../icon/icon.js";
8
- const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children: u }), q = ({
9
- children: u,
10
- defaultTabIndex: v = 0,
11
- onTabChange: b,
12
- className: k,
13
- borderBottom: g,
14
- ariaLabel: A,
15
- panelsRef: D
8
+ const k = "Tab Title", q = ({ children: b }) => /* @__PURE__ */ p(R, { children: b }), z = ({
9
+ children: b,
10
+ defaultTabIndex: g = 0,
11
+ onTabChange: m,
12
+ className: A,
13
+ borderBottom: D,
14
+ ariaLabel: w,
15
+ panelsRef: E
16
16
  }) => {
17
- const m = R([]), w = $(), o = C.toArray(u).filter(
18
- (t) => B(t)
19
- ), s = o.map((t, e) => {
20
- if (t.props.id)
21
- return t.props.id;
22
- const r = t.props.title ?? I;
23
- return `${w}-${F(r)}-${e}`;
24
- }), E = o.length > 0 ? Math.max(0, Math.min(v, o.length - 1)) : 0, [i, T] = H(E);
25
- j(() => {
26
- o.length > 0 && i >= o.length && T(o.length - 1);
17
+ const f = $([]), T = C(), o = I(
18
+ () => B.toArray(b).filter(
19
+ (t) => H(t)
20
+ ),
21
+ [b]
22
+ ), s = I(
23
+ () => o.map((t, e) => {
24
+ if (t.props.id)
25
+ return t.props.id;
26
+ const r = t.props.title ?? k;
27
+ return `${T}-${F(r)}-${e}`;
28
+ }),
29
+ [o, T]
30
+ ), L = o.length > 0 ? Math.max(0, Math.min(g, o.length - 1)) : 0, [i, x] = j(L);
31
+ M(() => {
32
+ o.length > 0 && i >= o.length && x(o.length - 1);
27
33
  }, [o.length, i]);
28
- const l = x(
34
+ const l = h(
29
35
  (t) => {
30
- t !== i && (T(t), b == null || b(t));
36
+ t !== i && (x(t), m == null || m(t));
31
37
  },
32
- [i, b]
33
- ), L = x(
38
+ [i, m]
39
+ ), _ = h(
34
40
  (t, e) => {
35
41
  const r = o.length;
36
42
  if (r !== 0) {
@@ -39,46 +45,46 @@ const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children:
39
45
  const a = t.key === "ArrowLeft" ? (e - 1 + r) % r : (e + 1) % r;
40
46
  l(a), setTimeout(() => {
41
47
  var n;
42
- (n = m.current[a]) == null || n.focus();
48
+ (n = f.current[a]) == null || n.focus();
43
49
  }, 0);
44
50
  } else if (t.key === "Enter" || t.key === " ")
45
51
  t.preventDefault(), l(e);
46
52
  else if (t.key === "Home")
47
53
  t.preventDefault(), l(0), setTimeout(() => {
48
54
  var a;
49
- (a = m.current[0]) == null || a.focus();
55
+ (a = f.current[0]) == null || a.focus();
50
56
  }, 0);
51
57
  else if (t.key === "End") {
52
58
  t.preventDefault();
53
59
  const a = r - 1;
54
60
  l(a), setTimeout(() => {
55
61
  var n;
56
- (n = m.current[a]) == null || n.focus();
62
+ (n = f.current[a]) == null || n.focus();
57
63
  }, 0);
58
64
  }
59
65
  }
60
66
  },
61
67
  [o.length, l]
62
68
  );
63
- return /* @__PURE__ */ h(
69
+ return /* @__PURE__ */ y(
64
70
  "div",
65
71
  {
66
- className: f(
67
- y.Tabs,
72
+ className: u(
73
+ v.Tabs,
68
74
  "tabs tab-container",
69
- g && "border-stone-200 border-b pb-6 dark:border-stone-700",
70
- k
75
+ D && "border-stone-200 border-b pb-6 dark:border-stone-700",
76
+ A
71
77
  ),
72
78
  children: [
73
79
  /* @__PURE__ */ p(
74
80
  "ul",
75
81
  {
76
- "aria-label": A ?? "Tabs",
82
+ "aria-label": w ?? "Tabs",
77
83
  className: "not-prose mb-6 flex min-w-full flex-none gap-x-6 overflow-auto border-stone-200 border-b pb-px dark:border-stone-700",
78
84
  "data-component-part": "tabs-list",
79
85
  role: "tablist",
80
86
  children: o.map((t, e) => {
81
- const r = t.props.title ?? I, a = t.props.icon, n = t.props.iconType, _ = t.props.iconLibrary, c = e === i;
87
+ const r = t.props.title ?? k, a = t.props.icon, n = t.props.iconType, N = t.props.iconLibrary, c = e === i;
82
88
  return /* @__PURE__ */ p(
83
89
  "li",
84
90
  {
@@ -92,16 +98,16 @@ const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children:
92
98
  onClick: (d) => {
93
99
  d.stopPropagation(), l(e);
94
100
  },
95
- onKeyDown: (d) => L(d, e),
101
+ onKeyDown: (d) => _(d, e),
96
102
  ref: (d) => {
97
- m.current[e] = d;
103
+ f.current[e] = d;
98
104
  },
99
105
  role: "tab",
100
106
  tabIndex: c ? 0 : -1,
101
- children: /* @__PURE__ */ h(
107
+ children: /* @__PURE__ */ y(
102
108
  "div",
103
109
  {
104
- className: f(
110
+ className: u(
105
111
  "-mb-px flex max-w-max items-center gap-1.5 whitespace-nowrap border-b pt-3 pb-2.5 font-semibold text-sm leading-6",
106
112
  c ? "border-current text-primary dark:text-primary-light" : "border-transparent text-stone-900 hover:border-stone-300 dark:text-stone-200 dark:hover:border-stone-700"
107
113
  ),
@@ -112,13 +118,13 @@ const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children:
112
118
  a && /* @__PURE__ */ p(
113
119
  K,
114
120
  {
115
- className: f(
121
+ className: u(
116
122
  "size-4 shrink-0",
117
123
  c ? "bg-primary dark:bg-primary-light" : "bg-stone-900 dark:bg-stone-200",
118
- y.TabIcon
124
+ v.TabIcon
119
125
  ),
120
126
  icon: a,
121
- iconLibrary: _,
127
+ iconLibrary: N,
122
128
  iconType: n,
123
129
  overrideColor: !0
124
130
  }
@@ -133,14 +139,14 @@ const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children:
133
139
  })
134
140
  }
135
141
  ),
136
- /* @__PURE__ */ p("div", { "data-component-part": "tabs-panels", ref: D, children: o.map((t, e) => {
142
+ /* @__PURE__ */ p("div", { "data-component-part": "tabs-panels", ref: E, children: o.map((t, e) => {
137
143
  const r = e === i;
138
144
  return /* @__PURE__ */ p(
139
145
  "div",
140
146
  {
141
147
  "aria-hidden": !r,
142
148
  "aria-labelledby": s[e],
143
- className: f(
149
+ className: u(
144
150
  "prose dark:prose-invert overflow-x-auto",
145
151
  !r && "hidden"
146
152
  ),
@@ -156,9 +162,9 @@ const I = "Tab Title", M = ({ children: u }) => /* @__PURE__ */ p(N, { children:
156
162
  ]
157
163
  }
158
164
  );
159
- }, W = Object.assign(q, {
160
- Item: M
165
+ }, X = Object.assign(z, {
166
+ Item: q
161
167
  });
162
168
  export {
163
- W as Tabs
169
+ X as Tabs
164
170
  };