@e-burgos/tucu-ui 2.7.0 → 2.7.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.7.2] - 2026-07-15
9
+
10
+ ### Fixed
11
+
12
+ - lazy-load prismjs in CodeBlock to fix dev-mode crash for consumers
13
+ ## [2.7.1] - 2026-07-15
14
+
15
+ ### Fixed
16
+
17
+ - work around esbuild CJS-interop bug breaking react-use hooks
8
18
  ## [2.7.0] - 2026-07-15
9
19
 
10
20
  ### Added
@@ -1,16 +1,16 @@
1
1
  import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
2
  import { useState as f, useEffect as h } from "react";
3
- import { useTheme as p } from "../../themes/hooks/use-theme.mjs";
3
+ import { useMeasure as p } from "../../hooks/use-measure.mjs";
4
+ import { useTheme as b } from "../../themes/hooks/use-theme.mjs";
4
5
  import { LAYOUT_OPTIONS as a } from "../../themes/config/index.mjs";
5
- import { Plus as b } from "../icons/plus.mjs";
6
- import O from "react-use/lib/useMeasure";
6
+ import { Plus as O } from "../icons/plus.mjs";
7
7
  function M({
8
8
  label: n,
9
9
  children: d,
10
10
  initialOpen: s = !1,
11
11
  className: l
12
12
  }) {
13
- const [e, o] = f(!1), [c, { height: m }] = O(), { layout: t } = p(), u = t === a.MACOS || t === a.MACOS_TAHOE || t === a.MACOS_TAHOE_DOCK ? 24 : 0;
13
+ const [e, o] = f(!1), [c, { height: m }] = p(), { layout: t } = b(), u = t === a.MACOS || t === a.MACOS_TAHOE || t === a.MACOS_TAHOE_DOCK ? 24 : 0;
14
14
  return h(() => {
15
15
  s && o(!0);
16
16
  }, [s]), /* @__PURE__ */ i(
@@ -33,7 +33,7 @@ function M({
33
33
  "span",
34
34
  {
35
35
  className: `shrink-0 transition-transform duration-200 ltr:ml-4 rtl:mr-4 ${e ? "rotate-45" : ""}`,
36
- children: /* @__PURE__ */ r(b, { className: "" })
36
+ children: /* @__PURE__ */ r(O, { className: "" })
37
37
  }
38
38
  )
39
39
  ]
@@ -5,7 +5,7 @@ import { motion as g } from "framer-motion";
5
5
  import { ActiveLink as w } from "../../links/active-link.mjs";
6
6
  import { ChevronDown as k } from "../../icons/chevron-down.mjs";
7
7
  import { useLocation as E, useNavigate as L } from "react-router-dom";
8
- import M from "react-use/lib/useMeasure";
8
+ import { useMeasure as M } from "../../../hooks/use-measure.mjs";
9
9
  function G({
10
10
  name: h,
11
11
  icon: m,
@@ -9,7 +9,7 @@ import { Close as C } from "../../icons/close.mjs";
9
9
  import { TagIcon as f } from "../../icons/tag-icon.mjs";
10
10
  import { MenuItem as u } from "./menu-item.mjs";
11
11
  import { useIsMobile as M } from "../../../hooks/use-is-mobile.mjs";
12
- import j from "react-use/lib/useClickAway";
12
+ import { useClickAway as j } from "../../../hooks/use-click-away.mjs";
13
13
  const s = (p) => p.map((l) => ({
14
14
  name: l.name,
15
15
  icon: l.icon,
@@ -6,7 +6,7 @@ import { ActiveLink as u } from "../../links/active-link.mjs";
6
6
  import { ChevronDown as U } from "../../icons/chevron-down.mjs";
7
7
  import { useLocation as D, useNavigate as O } from "react-router-dom";
8
8
  import { useIsMobile as H } from "../../../hooks/use-is-mobile.mjs";
9
- import I from "react-use/lib/useMeasure";
9
+ import { useMeasure as I } from "../../../hooks/use-measure.mjs";
10
10
  function W({
11
11
  name: c,
12
12
  icon: w,
@@ -1,99 +1,133 @@
1
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
- import { useState as l, useEffect as x } from "react";
3
- import { Scrollbar as k } from "../common/scrollbar.mjs";
4
- import { Check as v, Copy as C, ChevronUp as w, ChevronDown as N } from "lucide-react";
5
- import d from "prismjs";
6
- import e from "classnames";
7
- import "prismjs/components/prism-javascript";
8
- import "prismjs/components/prism-typescript";
9
- import "prismjs/components/prism-jsx";
10
- import "prismjs/components/prism-tsx";
11
- import "prismjs/components/prism-css";
12
- import "prismjs/components/prism-bash";
13
- import "prismjs/components/prism-json";
14
- import "prismjs/components/prism-python";
15
- import "prismjs/components/prism-java";
16
- import "prismjs/components/prism-sql";
17
- import { useIsMobile as j } from "../../hooks/use-is-mobile.mjs";
18
- const G = ({
19
- code: t,
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { useState as c, useEffect as C } from "react";
3
+ import { Scrollbar as N } from "../common/scrollbar.mjs";
4
+ import { Check as j, Copy as M, ChevronUp as P, ChevronDown as E } from "lucide-react";
5
+ import a from "classnames";
6
+ import { useIsMobile as I } from "../../hooks/use-is-mobile.mjs";
7
+ const b = {
8
+ markup: { load: () => import("prismjs/components/prism-markup") },
9
+ clike: { load: () => import("prismjs/components/prism-clike") },
10
+ javascript: {
11
+ deps: ["clike"],
12
+ load: () => import("prismjs/components/prism-javascript")
13
+ },
14
+ typescript: {
15
+ deps: ["javascript"],
16
+ load: () => import("prismjs/components/prism-typescript")
17
+ },
18
+ jsx: {
19
+ deps: ["markup", "javascript"],
20
+ load: () => import("prismjs/components/prism-jsx")
21
+ },
22
+ tsx: {
23
+ deps: ["jsx", "typescript"],
24
+ load: () => import("prismjs/components/prism-tsx")
25
+ },
26
+ css: { load: () => import("prismjs/components/prism-css") },
27
+ bash: { load: () => import("prismjs/components/prism-bash") },
28
+ json: { load: () => import("prismjs/components/prism-json") },
29
+ python: { load: () => import("prismjs/components/prism-python") },
30
+ java: {
31
+ deps: ["clike"],
32
+ load: () => import("prismjs/components/prism-java")
33
+ },
34
+ sql: { load: () => import("prismjs/components/prism-sql") }
35
+ };
36
+ let p = null;
37
+ const m = /* @__PURE__ */ new Map();
38
+ function y(r) {
39
+ const o = b[r];
40
+ if (!o) return Promise.resolve();
41
+ let t = m.get(r);
42
+ return t || (t = Promise.all((o.deps ?? []).map(y)).then(
43
+ () => o.load()
44
+ ), m.set(r, t)), t;
45
+ }
46
+ async function L(r) {
47
+ p || (p = import("prismjs"));
48
+ const { default: o } = await p;
49
+ return r && b[r] && await y(r).catch(() => {
50
+ m.delete(r);
51
+ }), o;
52
+ }
53
+ const z = ({
54
+ code: r,
20
55
  language: o,
21
- expanded: f = !0,
22
- noExpand: c = !1,
23
- className: m
56
+ expanded: t = !0,
57
+ noExpand: f = !1,
58
+ className: x
24
59
  }) => {
25
- const { isMobile: a } = j(), [i, g] = l(!1), [s, h] = l(
26
- !!(!c && f)
27
- ), [b, p] = l("");
28
- x(() => {
29
- if (o && d.languages[o]) {
30
- const y = d.highlight(
31
- t,
32
- d.languages[o],
33
- o
34
- );
35
- p(y);
36
- } else
37
- p(t);
38
- }, [t, o]);
39
- const u = () => {
40
- navigator.clipboard.writeText(t).then(() => {
60
+ const { isMobile: s } = I(), [i, g] = c(!1), [l, k] = c(
61
+ !!(!f && t)
62
+ ), [v, h] = c("");
63
+ C(() => {
64
+ let u = !1;
65
+ return L(o).then((n) => {
66
+ u || (o && n.languages[o] ? h(
67
+ n.highlight(r, n.languages[o], o)
68
+ ) : h(r));
69
+ }), () => {
70
+ u = !0;
71
+ };
72
+ }, [r, o]);
73
+ const w = () => {
74
+ navigator.clipboard.writeText(r).then(() => {
41
75
  g(!0), setTimeout(() => g(!1), 2e3);
42
76
  });
43
77
  };
44
- return /* @__PURE__ */ n(
78
+ return /* @__PURE__ */ d(
45
79
  "div",
46
80
  {
47
81
  "data-tucu": "code-block",
48
- className: e(
82
+ className: a(
49
83
  "overflow-x-auto min-h-[150px] relative rounded-xl border mt-4",
50
84
  "bg-gray-100 dark:bg-gray-800 border-border hover:border-gray-400 dark:hover:border-gray-600",
51
- s ? "h-fit max-h-[300px] transition-all duration-300" : "h-full transition-all duration-300",
52
- m
85
+ l ? "h-fit max-h-[300px] transition-all duration-300" : "h-full transition-all duration-300",
86
+ x
53
87
  ),
54
88
  children: [
55
- /* @__PURE__ */ n(
89
+ /* @__PURE__ */ d(
56
90
  "div",
57
91
  {
58
- className: e(
92
+ className: a(
59
93
  "absolute z-10 top-1 right-1 p-2 flex justify-end items-center w-full gap-1",
60
- a && "flex-col items-end"
94
+ s && "flex-col items-end"
61
95
  ),
62
96
  children: [
63
- /* @__PURE__ */ n(
97
+ /* @__PURE__ */ d(
64
98
  "button",
65
99
  {
66
- onClick: u,
100
+ onClick: w,
67
101
  "aria-label": i ? "Copied to clipboard" : "Copy to clipboard",
68
- className: e(
102
+ className: a(
69
103
  "code-block-btn p-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 dark:focus:ring-offset-gray-800",
70
- a && "p-1 w-8 h-8"
104
+ s && "p-1 w-8 h-8"
71
105
  ),
72
106
  title: "Copy to clipboard",
73
107
  children: [
74
- i ? /* @__PURE__ */ r(v, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ r(C, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" }),
75
- /* @__PURE__ */ r("span", { className: "sr-only", children: i ? "Copied!" : "Copy code" })
108
+ i ? /* @__PURE__ */ e(j, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ e(M, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" }),
109
+ /* @__PURE__ */ e("span", { className: "sr-only", children: i ? "Copied!" : "Copy code" })
76
110
  ]
77
111
  }
78
112
  ),
79
- !c && /* @__PURE__ */ r(
113
+ !f && /* @__PURE__ */ e(
80
114
  "button",
81
115
  {
82
- onClick: () => h(!s),
83
- className: e(
116
+ onClick: () => k(!l),
117
+ className: a(
84
118
  "code-block-btn p-2 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 dark:focus:ring-offset-gray-800",
85
- a && "p-1 w-8 h-8"
119
+ s && "p-1 w-8 h-8"
86
120
  ),
87
121
  title: "Expand/Collapse",
88
- children: s ? /* @__PURE__ */ r(N, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" }) : /* @__PURE__ */ r(w, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" })
122
+ children: l ? /* @__PURE__ */ e(E, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" }) : /* @__PURE__ */ e(P, { className: "w-4 h-4 text-gray-600 dark:text-gray-300" })
89
123
  }
90
124
  ),
91
- o && /* @__PURE__ */ r(
125
+ o && /* @__PURE__ */ e(
92
126
  "div",
93
127
  {
94
- className: e(
128
+ className: a(
95
129
  "code-block-btn p-2 text-sm font-mono bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:pointer dark:hover:bg-gray-600 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 dark:focus:ring-offset-gray-800",
96
- a && "w-max max-w-11 h-8"
130
+ s && "w-max max-w-11 h-8"
97
131
  ),
98
132
  children: o
99
133
  }
@@ -101,15 +135,15 @@ const G = ({
101
135
  ]
102
136
  }
103
137
  ),
104
- /* @__PURE__ */ r(
105
- k,
138
+ /* @__PURE__ */ e(
139
+ N,
106
140
  {
107
141
  className: "overflow-x-auto h-full p-4 pr-16 pt-4 lg:pr-4 lg:pt-16 transition-all duration-300",
108
- children: /* @__PURE__ */ r("pre", { className: "text-xs whitespace-pre-wrap font-mono block", children: /* @__PURE__ */ r(
142
+ children: /* @__PURE__ */ e("pre", { className: "text-xs whitespace-pre-wrap font-mono block", children: /* @__PURE__ */ e(
109
143
  "code",
110
144
  {
111
145
  className: `language-${o || "text"}`,
112
- dangerouslySetInnerHTML: { __html: b }
146
+ dangerouslySetInnerHTML: { __html: v }
113
147
  }
114
148
  ) })
115
149
  }
@@ -119,6 +153,6 @@ const G = ({
119
153
  );
120
154
  };
121
155
  export {
122
- G as CodeBlock,
123
- G as default
156
+ z as CodeBlock,
157
+ z as default
124
158
  };
@@ -0,0 +1,9 @@
1
+ function e(n) {
2
+ const f = n;
3
+ if (typeof n == "function") return n;
4
+ const t = f.default;
5
+ return typeof t?.default == "function" ? t.default : typeof t == "function" ? t : n;
6
+ }
7
+ export {
8
+ e as unwrapCjsDefault
9
+ };
@@ -1,5 +1,6 @@
1
- import o from "react-use/lib/factory/createBreakpoint";
2
- const t = {
1
+ import * as o from "react-use/lib/factory/createBreakpoint";
2
+ import { unwrapCjsDefault as t } from "./internal/cjs-esm-interop.mjs";
3
+ const e = t(o), r = {
3
4
  xs: 480,
4
5
  sm: 640,
5
6
  md: 768,
@@ -8,7 +9,7 @@ const t = {
8
9
  "2xl": 1440,
9
10
  "3xl": 1780,
10
11
  "4xl": 2160
11
- }, r = o(t);
12
+ }, s = e(r);
12
13
  export {
13
- r as useBreakpoint
14
+ s as useBreakpoint
14
15
  };
@@ -0,0 +1,8 @@
1
+ import * as o from "react-use/lib/useClickAway";
2
+ import { unwrapCjsDefault as r } from "./internal/cjs-esm-interop.mjs";
3
+ const e = r(
4
+ o
5
+ );
6
+ export {
7
+ e as useClickAway
8
+ };
@@ -0,0 +1,8 @@
1
+ import * as o from "react-use/lib/useCopyToClipboard";
2
+ import { unwrapCjsDefault as p } from "./internal/cjs-esm-interop.mjs";
3
+ const a = p(
4
+ o
5
+ );
6
+ export {
7
+ a as useCopyToClipboard
8
+ };
@@ -0,0 +1,6 @@
1
+ import * as e from "react-use/lib/useMeasure";
2
+ import { unwrapCjsDefault as r } from "./internal/cjs-esm-interop.mjs";
3
+ const s = r(e);
4
+ export {
5
+ s as useMeasure
6
+ };
package/index.d.ts CHANGED
@@ -47,13 +47,12 @@ import * as TanstackTable from '@tanstack/react-table';
47
47
  import { TooltipContentProps } from 'recharts';
48
48
  import { Updater } from '@tanstack/react-table';
49
49
  import { UseBoundStore } from 'zustand';
50
- import { default as useClickAway } from 'react-use/lib/useClickAway';
51
- import { default as useCopyToClipboard } from 'react-use/lib/useCopyToClipboard';
50
+ import * as useCopyToClipboardModule from 'react-use/lib/useCopyToClipboard';
52
51
  import { useEffect } from 'react';
53
52
  import { useFormContext } from 'react-hook-form';
54
53
  import { UseFormProps } from 'react-hook-form';
55
54
  import { UseFormReturn } from 'react-hook-form';
56
- import { default as useMeasure } from 'react-use/lib/useMeasure';
55
+ import * as useMeasureModule from 'react-use/lib/useMeasure';
57
56
  import { VisibilityState } from '@tanstack/react-table';
58
57
 
59
58
  export declare const acceptedFileType: {
@@ -5272,7 +5271,7 @@ export declare const useBreakpoint: () => string;
5272
5271
 
5273
5272
  export declare function useChartTheme(): ChartTheme;
5274
5273
 
5275
- export { useClickAway }
5274
+ export declare const useClickAway: <E extends Event = Event>(ref: RefObject<HTMLElement | null>, onClickAway: (event: E) => void, events?: string[]) => void;
5276
5275
 
5277
5276
  /**
5278
5277
  * useComponentEventListener
@@ -5295,7 +5294,7 @@ export declare const useComponentEventListener: (id: string) => {
5295
5294
  };
5296
5295
  };
5297
5296
 
5298
- export { useCopyToClipboard }
5297
+ export declare const useCopyToClipboard: () => [useCopyToClipboardModule.CopyToClipboardState, (value: string) => void];
5299
5298
 
5300
5299
  /**
5301
5300
  * Hook for the data table context.
@@ -5419,7 +5418,7 @@ export declare const useIsomorphicLayoutEffect: typeof useEffect;
5419
5418
 
5420
5419
  export declare function useLockBodyScroll(freezeBodyScroll: boolean): void;
5421
5420
 
5422
- export { useMeasure }
5421
+ export declare const useMeasure: <E extends Element = Element>() => useMeasureModule.UseMeasureResult<E>;
5423
5422
 
5424
5423
  export declare const usePublicErrorRoutesConfig: () => {
5425
5424
  key: AppErrorPage;