@trackunit/react-components 1.20.16-alpha-192bcb42ded.0 → 1.20.18
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/index.cjs.js +2083 -2055
- package/index.esm.js +2100 -2072
- package/package.json +5 -5
- package/src/components/CopyableText/CopyableText.d.ts +36 -17
- package/src/components/CopyableText/CopyableText.variants.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.18",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@floating-ui/react": "^0.26.25",
|
|
14
14
|
"string-ts": "^2.0.0",
|
|
15
15
|
"tailwind-merge": "^2.0.0",
|
|
16
|
-
"@trackunit/ui-design-tokens": "1.11.84
|
|
17
|
-
"@trackunit/css-class-variance-utilities": "1.11.87
|
|
18
|
-
"@trackunit/shared-utils": "1.13.87
|
|
19
|
-
"@trackunit/ui-icons": "1.11.83
|
|
16
|
+
"@trackunit/ui-design-tokens": "1.11.84",
|
|
17
|
+
"@trackunit/css-class-variance-utilities": "1.11.87",
|
|
18
|
+
"@trackunit/shared-utils": "1.13.87",
|
|
19
|
+
"@trackunit/ui-icons": "1.11.83",
|
|
20
20
|
"es-toolkit": "^1.39.10",
|
|
21
21
|
"@tanstack/react-virtual": "3.13.12",
|
|
22
22
|
"fflate": "^0.8.2",
|
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { Refable } from "../../common/Refable";
|
|
4
|
-
export interface CopyableTextProps extends CommonProps, Refable<
|
|
4
|
+
export interface CopyableTextProps extends CommonProps, Refable<HTMLButtonElement> {
|
|
5
5
|
/**
|
|
6
|
-
* The text
|
|
7
|
-
* By default this is also the text that gets copied when component is clicked.
|
|
6
|
+
* The text displayed in the UI and copied to clipboard on click.
|
|
8
7
|
*/
|
|
9
|
-
text
|
|
8
|
+
text: string;
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* When true, renders a copy icon (Square2Stack) next to the text.
|
|
11
|
+
* The text is automatically truncated with an ellipsis.
|
|
12
|
+
*
|
|
13
|
+
* @default true
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
withIcon?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Controls the text size of the component.
|
|
18
|
+
* - `sm` (default): standard text size
|
|
19
|
+
* - `xs`: smaller text size
|
|
20
|
+
*
|
|
21
|
+
* @default "sm"
|
|
22
|
+
*/
|
|
23
|
+
size?: "sm" | "xs";
|
|
24
|
+
/**
|
|
25
|
+
* Accessible label prefix for screen readers. Rendered as `aria-label="{copyLabel} {text}"`.
|
|
26
|
+
*
|
|
27
|
+
* @default "Copy"
|
|
28
|
+
*/
|
|
29
|
+
copyLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Label shown in the tooltip after a successful copy.
|
|
32
|
+
*
|
|
33
|
+
* @default "Copied!"
|
|
34
|
+
*/
|
|
35
|
+
copiedLabel?: string;
|
|
15
36
|
}
|
|
16
37
|
/**
|
|
17
38
|
* CopyableText displays a text value that the user can click to copy to the clipboard.
|
|
18
|
-
* It shows a brief animation
|
|
39
|
+
* It shows a brief animation and tooltip feedback on copy. What you see is what gets copied.
|
|
19
40
|
*
|
|
20
41
|
* ### When to use
|
|
21
42
|
* Use CopyableText for identifiers, serial numbers, URLs, or any value the user may want to copy (e.g., asset IDs, error codes).
|
|
22
43
|
*
|
|
23
44
|
* ### When not to use
|
|
24
|
-
* Do not use CopyableText for long paragraphs or content that doesn't need to be copied.
|
|
45
|
+
* - Do not use CopyableText for long paragraphs or content that doesn't need to be copied.
|
|
46
|
+
* - If you need a custom-looking copy button (different display text than copied value), use `useCopyToClipboard` directly.
|
|
25
47
|
*
|
|
26
48
|
* @example Copyable serial number
|
|
27
49
|
* ```tsx
|
|
@@ -31,18 +53,15 @@ export interface CopyableTextProps extends CommonProps, Refable<HTMLSpanElement>
|
|
|
31
53
|
* <CopyableText text="SN-2024-00142" data-testid="serial-number" />
|
|
32
54
|
* );
|
|
33
55
|
* ```
|
|
34
|
-
* @example Copyable text with
|
|
56
|
+
* @example Copyable text with small size
|
|
35
57
|
* ```tsx
|
|
36
58
|
* import { CopyableText } from "@trackunit/react-components";
|
|
37
59
|
*
|
|
38
|
-
* const
|
|
39
|
-
* <CopyableText
|
|
40
|
-
* text="Excavator #1234"
|
|
41
|
-
* alternativeText="https://app.trackunit.com/assets/1234"
|
|
42
|
-
* />
|
|
60
|
+
* const CopyableId = () => (
|
|
61
|
+
* <CopyableText text="ABC-123" size="xs" />
|
|
43
62
|
* );
|
|
44
63
|
* ```
|
|
45
64
|
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
46
65
|
* @returns {ReactElement} CopyableText component
|
|
47
66
|
*/
|
|
48
|
-
export declare const CopyableText: ({ text,
|
|
67
|
+
export declare const CopyableText: ({ text, withIcon, size, copyLabel, copiedLabel, "data-testid": dataTestId, className, ref, }: CopyableTextProps) => ReactElement | null;
|