@e-burgos/tucu-ui 2.7.2 → 2.7.3
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 +10 -0
- package/components/utils/code-block.mjs +1 -1
- package/hooks/use-breakpoint.mjs +21 -5
- package/hooks/use-click-away.mjs +17 -6
- package/hooks/use-copy-to-clipboard.mjs +45 -6
- package/hooks/use-measure.mjs +24 -4
- package/index.d.ts +29 -6
- package/index.js +9 -9
- package/package.json +1 -2
- package/hooks/internal/cjs-esm-interop.mjs +0 -9
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.3] - 2026-07-15
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- replace react-use with native React implementations
|
|
13
|
+
- bump @e-burgos/tucu-ui to ^2.7.2
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- resolve typecheck errors in CodeBlock's lazy prismjs loading
|
|
8
18
|
## [2.7.2] - 2026-07-15
|
|
9
19
|
|
|
10
20
|
### Fixed
|
package/hooks/use-breakpoint.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const e = t(o), r = {
|
|
1
|
+
import { useState as s, useEffect as d } from "react";
|
|
2
|
+
const a = {
|
|
4
3
|
xs: 480,
|
|
5
4
|
sm: 640,
|
|
6
5
|
md: 768,
|
|
@@ -9,7 +8,24 @@ const e = t(o), r = {
|
|
|
9
8
|
"2xl": 1440,
|
|
10
9
|
"3xl": 1780,
|
|
11
10
|
"4xl": 2160
|
|
12
|
-
},
|
|
11
|
+
}, i = Object.entries(a).sort(
|
|
12
|
+
(n, e) => n[1] - e[1]
|
|
13
|
+
);
|
|
14
|
+
function r(n) {
|
|
15
|
+
let e = i[0][0];
|
|
16
|
+
for (const [t, o] of i)
|
|
17
|
+
n >= o && (e = t);
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
function f() {
|
|
21
|
+
const [n, e] = s(
|
|
22
|
+
() => r(typeof window < "u" ? window.innerWidth : 0)
|
|
23
|
+
);
|
|
24
|
+
return d(() => {
|
|
25
|
+
const t = () => e(r(window.innerWidth));
|
|
26
|
+
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
27
|
+
}, []), n;
|
|
28
|
+
}
|
|
13
29
|
export {
|
|
14
|
-
|
|
30
|
+
f as useBreakpoint
|
|
15
31
|
};
|
package/hooks/use-click-away.mjs
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
)
|
|
1
|
+
import { useRef as s, useEffect as a } from "react";
|
|
2
|
+
const d = ["mousedown", "touchstart"];
|
|
3
|
+
function i(r, n, e = d) {
|
|
4
|
+
const c = s(n);
|
|
5
|
+
c.current = n, a(() => {
|
|
6
|
+
const o = (t) => {
|
|
7
|
+
const u = r.current;
|
|
8
|
+
u && !u.contains(t.target) && c.current(t);
|
|
9
|
+
};
|
|
10
|
+
return e.forEach((t) => document.addEventListener(t, o)), () => {
|
|
11
|
+
e.forEach(
|
|
12
|
+
(t) => document.removeEventListener(t, o)
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
}, [r, e]);
|
|
16
|
+
}
|
|
6
17
|
export {
|
|
7
|
-
|
|
18
|
+
i as useClickAway
|
|
8
19
|
};
|
|
@@ -1,8 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useState as c, useCallback as i } from "react";
|
|
2
|
+
function s(t) {
|
|
3
|
+
const e = document.createElement("textarea");
|
|
4
|
+
e.value = t, e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.focus(), e.select();
|
|
5
|
+
let r = !1;
|
|
6
|
+
try {
|
|
7
|
+
r = document.execCommand("copy");
|
|
8
|
+
} catch {
|
|
9
|
+
r = !1;
|
|
10
|
+
}
|
|
11
|
+
return document.body.removeChild(e), r;
|
|
12
|
+
}
|
|
13
|
+
function d() {
|
|
14
|
+
const [t, e] = c({
|
|
15
|
+
value: void 0,
|
|
16
|
+
error: void 0,
|
|
17
|
+
noUserInteraction: !0
|
|
18
|
+
}), r = i((o) => {
|
|
19
|
+
if (typeof o != "string") {
|
|
20
|
+
e({
|
|
21
|
+
value: o,
|
|
22
|
+
error: new Error(
|
|
23
|
+
`Cannot copy typeof ${typeof o} to clipboard, must be a string`
|
|
24
|
+
),
|
|
25
|
+
noUserInteraction: !0
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
30
|
+
navigator.clipboard.writeText(o).then(
|
|
31
|
+
() => e({ value: o, error: void 0, noUserInteraction: !1 }),
|
|
32
|
+
(a) => e({ value: o, error: a, noUserInteraction: !1 })
|
|
33
|
+
);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const n = s(o);
|
|
37
|
+
e({
|
|
38
|
+
value: o,
|
|
39
|
+
error: n ? void 0 : new Error("Copy failed"),
|
|
40
|
+
noUserInteraction: !1
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
return [t, r];
|
|
44
|
+
}
|
|
6
45
|
export {
|
|
7
|
-
|
|
46
|
+
d as useCopyToClipboard
|
|
8
47
|
};
|
package/hooks/use-measure.mjs
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useState as n, useEffect as m } from "react";
|
|
2
|
+
const p = {
|
|
3
|
+
x: 0,
|
|
4
|
+
y: 0,
|
|
5
|
+
width: 0,
|
|
6
|
+
height: 0,
|
|
7
|
+
top: 0,
|
|
8
|
+
right: 0,
|
|
9
|
+
bottom: 0,
|
|
10
|
+
left: 0
|
|
11
|
+
};
|
|
12
|
+
function a() {
|
|
13
|
+
const [e, o] = n(null), [s, i] = n(p);
|
|
14
|
+
return m(() => {
|
|
15
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
16
|
+
const t = new ResizeObserver(([r]) => {
|
|
17
|
+
if (!r) return;
|
|
18
|
+
const { x: c, y: u, width: f, height: h, top: l, right: d, bottom: g, left: b } = r.target.getBoundingClientRect();
|
|
19
|
+
i({ x: c, y: u, width: f, height: h, top: l, right: d, bottom: g, left: b });
|
|
20
|
+
});
|
|
21
|
+
return t.observe(e), () => t.disconnect();
|
|
22
|
+
}, [e]), [o, s];
|
|
23
|
+
}
|
|
4
24
|
export {
|
|
5
|
-
|
|
25
|
+
a as useMeasure
|
|
6
26
|
};
|
package/index.d.ts
CHANGED
|
@@ -47,12 +47,10 @@ 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 * as useCopyToClipboardModule from 'react-use/lib/useCopyToClipboard';
|
|
51
50
|
import { useEffect } from 'react';
|
|
52
51
|
import { useFormContext } from 'react-hook-form';
|
|
53
52
|
import { UseFormProps } from 'react-hook-form';
|
|
54
53
|
import { UseFormReturn } from 'react-hook-form';
|
|
55
|
-
import * as useMeasureModule from 'react-use/lib/useMeasure';
|
|
56
54
|
import { VisibilityState } from '@tanstack/react-table';
|
|
57
55
|
|
|
58
56
|
export declare const acceptedFileType: {
|
|
@@ -911,6 +909,8 @@ export declare function CleanLayout({ children, className, }: {
|
|
|
911
909
|
className?: string;
|
|
912
910
|
}): JSX.Element;
|
|
913
911
|
|
|
912
|
+
declare type ClickAwayEvent = MouseEvent | TouchEvent;
|
|
913
|
+
|
|
914
914
|
export declare function Close(props: React.SVGAttributes<SVGElement>): JSX.Element;
|
|
915
915
|
|
|
916
916
|
export declare const CodeBlock: ({ code, language, expanded, noExpand, className, }: {
|
|
@@ -1119,6 +1119,12 @@ export declare function convertColumns<TData extends RowData, TValue = unknown>(
|
|
|
1119
1119
|
|
|
1120
1120
|
export declare const Copy: React.FC<React.SVGAttributes<SVGElement>>;
|
|
1121
1121
|
|
|
1122
|
+
export declare type CopyToClipboardState = {
|
|
1123
|
+
value?: string;
|
|
1124
|
+
error?: Error;
|
|
1125
|
+
noUserInteraction: boolean;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1122
1128
|
export declare function CurrencySwapIcons({ from, to }: CurrencySwapIconsProps): JSX.Element;
|
|
1123
1129
|
|
|
1124
1130
|
export declare interface CurrencySwapIconsProps {
|
|
@@ -3604,6 +3610,17 @@ export declare interface ManualPaginationState {
|
|
|
3604
3610
|
pagination?: PaginationState;
|
|
3605
3611
|
}
|
|
3606
3612
|
|
|
3613
|
+
export declare type MeasureRect = {
|
|
3614
|
+
x: number;
|
|
3615
|
+
y: number;
|
|
3616
|
+
width: number;
|
|
3617
|
+
height: number;
|
|
3618
|
+
top: number;
|
|
3619
|
+
right: number;
|
|
3620
|
+
bottom: number;
|
|
3621
|
+
left: number;
|
|
3622
|
+
};
|
|
3623
|
+
|
|
3607
3624
|
export declare function MediaPlayIcon(props: React.SVGAttributes<SVGElement>): JSX.Element;
|
|
3608
3625
|
|
|
3609
3626
|
export declare function MenuItem({ name, icon, path, href, dropdownItems, isActive: isActiveProps, hide, onClick, }: MenuItemProps): JSX.Element;
|
|
@@ -5267,11 +5284,11 @@ export declare function Usdc(props: React.SVGAttributes<SVGElement>): JSX.Elemen
|
|
|
5267
5284
|
|
|
5268
5285
|
export declare const useAnchorScroll: () => null;
|
|
5269
5286
|
|
|
5270
|
-
export declare
|
|
5287
|
+
export declare function useBreakpoint(): string;
|
|
5271
5288
|
|
|
5272
5289
|
export declare function useChartTheme(): ChartTheme;
|
|
5273
5290
|
|
|
5274
|
-
export declare
|
|
5291
|
+
export declare function useClickAway<T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>, onClickAway: (event: ClickAwayEvent) => void, events?: string[]): void;
|
|
5275
5292
|
|
|
5276
5293
|
/**
|
|
5277
5294
|
* useComponentEventListener
|
|
@@ -5294,7 +5311,10 @@ export declare const useComponentEventListener: (id: string) => {
|
|
|
5294
5311
|
};
|
|
5295
5312
|
};
|
|
5296
5313
|
|
|
5297
|
-
export declare
|
|
5314
|
+
export declare function useCopyToClipboard(): [
|
|
5315
|
+
CopyToClipboardState,
|
|
5316
|
+
(text: string) => void
|
|
5317
|
+
];
|
|
5298
5318
|
|
|
5299
5319
|
/**
|
|
5300
5320
|
* Hook for the data table context.
|
|
@@ -5418,7 +5438,10 @@ export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
|
5418
5438
|
|
|
5419
5439
|
export declare function useLockBodyScroll(freezeBodyScroll: boolean): void;
|
|
5420
5440
|
|
|
5421
|
-
export declare
|
|
5441
|
+
export declare function useMeasure<T extends HTMLElement = HTMLElement>(): [
|
|
5442
|
+
(node: T | null) => void,
|
|
5443
|
+
MeasureRect
|
|
5444
|
+
];
|
|
5422
5445
|
|
|
5423
5446
|
export declare const usePublicErrorRoutesConfig: () => {
|
|
5424
5447
|
key: AppErrorPage;
|