@gridui/clipboard 1.0.3 → 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.
- package/dist/copy-button/copy-button.d.ts +2 -4
- package/dist/copy-path/copy-path.d.ts +2 -4
- package/dist/copy-path/style.d.ts +2 -6
- package/dist/index.js +8 -23
- package/dist/index.js.map +2 -2
- package/dist/shared/copy-options.d.ts +11 -0
- package/dist/styles.css +43 -63
- package/docs/catalog.json +44 -0
- package/package.json +8 -7
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
* @namespace CopyButton
|
|
5
5
|
* @description Copy Button
|
|
6
6
|
*/
|
|
7
|
+
import type { CopyOptions } from "../shared/copy-options";
|
|
7
8
|
import { type ButtonProps, type ButtonVariants } from "@gridui/button";
|
|
8
9
|
import { type FC } from "react";
|
|
9
|
-
export type CopyButtonProps = Omit<ButtonProps, "children" | "onClick" | "value"> & ButtonVariants & {
|
|
10
|
-
readonly value: string;
|
|
10
|
+
export type CopyButtonProps = Omit<ButtonProps, "children" | "onClick" | "value"> & ButtonVariants & CopyOptions & {
|
|
11
11
|
readonly label: string;
|
|
12
|
-
readonly copiedLabel: string;
|
|
13
|
-
readonly failedLabel: string;
|
|
14
12
|
};
|
|
15
13
|
export declare const CopyButton: FC<CopyButtonProps>;
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* @namespace CopyPath
|
|
5
5
|
* @description Copy Path
|
|
6
6
|
*/
|
|
7
|
+
import type { CopyOptions } from "../shared/copy-options";
|
|
7
8
|
import { type FC } from "react";
|
|
8
|
-
export type CopyPathProps = {
|
|
9
|
-
readonly value: string;
|
|
9
|
+
export type CopyPathProps = CopyOptions & {
|
|
10
10
|
readonly label: string;
|
|
11
11
|
readonly copyLabel: string;
|
|
12
|
-
readonly copiedLabel: string;
|
|
13
|
-
readonly failedLabel: string;
|
|
14
12
|
readonly frame?: "standalone" | "integrated";
|
|
15
13
|
};
|
|
16
14
|
export declare const CopyPath: FC<CopyPathProps>;
|
|
@@ -4,12 +4,8 @@
|
|
|
4
4
|
* @namespace CopyPath
|
|
5
5
|
* @description Style
|
|
6
6
|
*/
|
|
7
|
-
export declare const copyPathStyles: (props?: (
|
|
8
|
-
frame?: "standalone" | "integrated" | null | undefined;
|
|
9
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const copyPathStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
8
|
export declare const copyPathRowStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
9
|
export declare const copyPathValueStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
12
|
-
export declare const copyPathActionStyles: (props?: (
|
|
13
|
-
frame?: "standalone" | "integrated" | null | undefined;
|
|
14
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const copyPathActionStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
11
|
export declare const copyPathStatusStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/dist/index.js
CHANGED
|
@@ -94,27 +94,11 @@ var CopyButton = (props) => {
|
|
|
94
94
|
|
|
95
95
|
// src/copy-path/style.ts
|
|
96
96
|
import { cva } from "class-variance-authority";
|
|
97
|
-
var copyPathStyles = cva("gridui-copy-path gridui-u-min-w-0 gridui-u-rounded-none"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
defaultVariants: { frame: "standalone" }
|
|
105
|
-
});
|
|
106
|
-
var copyPathRowStyles = cva("gridui-u-grid gridui-u-min-w-0 gridui-u-grid-cols-[minmax(0,1fr)_auto] gridui-u-bg-surface");
|
|
107
|
-
var copyPathValueStyles = cva("gridui-u-min-w-0 gridui-u-self-center gridui-u-px-gridui-24 gridui-u-py-gridui-16 gridui-u-type-code gridui-u-text-foreground gridui-u-wrap-anywhere gridui-u-select-text");
|
|
108
|
-
var copyPathActionStyles = cva("gridui-u-flex gridui-u-min-h-11 gridui-u-items-center gridui-u-justify-center gridui-u-gap-gridui-8 gridui-u-rounded-none gridui-u-border-0 gridui-u-border-l gridui-u-border-solid gridui-u-bg-background gridui-u-px-gridui-16 gridui-u-py-gridui-8 gridui-u-text-foreground gridui-u-type-ui gridui-u-cursor-pointer gridui-u-[&_svg]:h-gridui-16 gridui-u-[&_svg]:w-gridui-16 gridui-u-[&_svg]:shrink-0 gridui-u-disabled:cursor-wait", {
|
|
109
|
-
variants: {
|
|
110
|
-
frame: {
|
|
111
|
-
standalone: "gridui-u-border-control-border",
|
|
112
|
-
integrated: "gridui-u-border-border"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
defaultVariants: { frame: "standalone" }
|
|
116
|
-
});
|
|
117
|
-
var copyPathStatusStyles = cva("gridui-u-px-gridui-24 gridui-u-py-gridui-8 gridui-u-type-supporting gridui-u-text-muted gridui-u-empty:hidden");
|
|
97
|
+
var copyPathStyles = cva("gridui-copy-path gridui-u-clipboard--min-w-0 gridui-u-clipboard--rounded-none");
|
|
98
|
+
var copyPathRowStyles = cva("gridui-u-clipboard--grid gridui-u-clipboard--min-w-0 gridui-u-clipboard--grid-cols-[minmax(0,1fr)_auto] gridui-u-clipboard--bg-surface");
|
|
99
|
+
var copyPathValueStyles = cva("gridui-u-clipboard--min-w-0 gridui-u-clipboard--self-center gridui-u-clipboard--px-gridui-24 gridui-u-clipboard--py-gridui-16 gridui-u-clipboard--type-code gridui-u-clipboard--text-foreground gridui-u-clipboard--wrap-anywhere gridui-u-clipboard--select-text");
|
|
100
|
+
var copyPathActionStyles = cva("gridui-copy-path-action gridui-u-clipboard--flex gridui-u-clipboard--min-h-11 gridui-u-clipboard--items-center gridui-u-clipboard--justify-center gridui-u-clipboard--gap-gridui-8 gridui-u-clipboard--rounded-none gridui-u-clipboard--bg-background gridui-u-clipboard--px-gridui-16 gridui-u-clipboard--py-gridui-8 gridui-u-clipboard--text-foreground gridui-u-clipboard--type-ui gridui-u-clipboard--cursor-pointer gridui-u-clipboard--[&_svg]:h-gridui-16 gridui-u-clipboard--[&_svg]:w-gridui-16 gridui-u-clipboard--[&_svg]:shrink-0 gridui-u-clipboard--disabled:cursor-wait");
|
|
101
|
+
var copyPathStatusStyles = cva("gridui-u-clipboard--px-gridui-24 gridui-u-clipboard--py-gridui-8 gridui-u-clipboard--type-supporting gridui-u-clipboard--text-muted gridui-u-clipboard--empty:hidden");
|
|
118
102
|
|
|
119
103
|
// src/copy-path/copy-path.tsx
|
|
120
104
|
import { Check, Copy } from "lucide-react";
|
|
@@ -165,7 +149,8 @@ var CopyPath = (props) => {
|
|
|
165
149
|
return /* @__PURE__ */ jsxs2(
|
|
166
150
|
"div",
|
|
167
151
|
{
|
|
168
|
-
className: copyPathStyles(
|
|
152
|
+
className: copyPathStyles(),
|
|
153
|
+
"data-frame": frame,
|
|
169
154
|
role: "group",
|
|
170
155
|
"aria-label": label,
|
|
171
156
|
children: [
|
|
@@ -186,7 +171,7 @@ var CopyPath = (props) => {
|
|
|
186
171
|
"button",
|
|
187
172
|
{
|
|
188
173
|
type: "button",
|
|
189
|
-
className: copyPathActionStyles(
|
|
174
|
+
className: copyPathActionStyles(),
|
|
190
175
|
disabled: pending,
|
|
191
176
|
onClick: () => {
|
|
192
177
|
void copy();
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/shared/clipboard.ts", "../src/copy-button/copy-button.tsx", "../src/copy-path/style.ts", "../src/copy-path/copy-path.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Clipboard\n * @namespace Shared\n * @description Clipboard\n */\n\nexport const copyPath = async (value: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(value);\n return true;\n } catch {\n return false;\n }\n};\n", "/**\n * @author WMXPY\n * @package Clipboard\n * @namespace CopyButton\n * @description Copy Button\n */\n\nimport { copyPath } from \"../shared/clipboard\";\nimport { Button, type ButtonProps, type ButtonVariants } from \"@gridui/button\";\nimport { Textarea } from \"@gridui/input\";\nimport { type FC, useEffect, useRef, useState } from \"react\";\n\nexport type CopyButtonProps = Omit<ButtonProps, \"children\" | \"onClick\" | \"value\"> & ButtonVariants & {\n readonly
|
|
5
|
-
"mappings": ";AAOO,IAAM,WAAW,OAAO,UAAoC;AAC/D,MAAI;AACA,UAAM,UAAU,UAAU,UAAU,KAAK;AACzC,WAAO;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;;;
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Clipboard\n * @namespace Shared\n * @description Clipboard\n */\n\nexport const copyPath = async (value: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(value);\n return true;\n } catch {\n return false;\n }\n};\n", "/**\n * @author WMXPY\n * @package Clipboard\n * @namespace CopyButton\n * @description Copy Button\n */\n\nimport { copyPath } from \"../shared/clipboard\";\nimport type { CopyOptions } from \"../shared/copy-options\";\nimport { Button, type ButtonProps, type ButtonVariants } from \"@gridui/button\";\nimport { Textarea } from \"@gridui/input\";\nimport { type FC, useEffect, useRef, useState } from \"react\";\n\nexport type CopyButtonProps = Omit<ButtonProps, \"children\" | \"onClick\" | \"value\"> & ButtonVariants & CopyOptions & {\n readonly label: string;\n};\n\nexport const CopyButton: FC<CopyButtonProps> = (props: CopyButtonProps) => {\n const { value, label, copiedLabel, failedLabel, disabled, ...restProps } = props;\n const [\n result,\n setResult,\n ] = useState<{\n value: string;\n success: boolean;\n } | null>(null);\n const [\n busy,\n setBusy,\n ] = useState(false);\n const manualCopyInput = useRef<HTMLTextAreaElement>(null);\n const isMounted = useRef(true);\n const currentValue = useRef(value);\n currentValue.current = value;\n const copyInFlight = useRef(false);\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n const visibleResult = result?.value === value ? result : null;\n useEffect(() => {\n if (visibleResult && !visibleResult.success) {\n manualCopyInput.current?.focus();\n manualCopyInput.current?.select();\n }\n }, [visibleResult]);\n const copyValue = async () => {\n if (disabled || copyInFlight.current) {\n return;\n }\n copyInFlight.current = true;\n setBusy(true);\n setResult(null);\n const success = await copyPath(value);\n copyInFlight.current = false;\n if (isMounted.current) {\n setBusy(false);\n // A completed request must not report success for a newer value.\n if (value === currentValue.current) {\n setResult({\n value,\n success,\n });\n }\n }\n };\n const message = visibleResult?.success ? copiedLabel : failedLabel;\n return (<span>\n <Button\n {...restProps}\n disabled={disabled || busy}\n onClick={() => {\n void copyValue();\n }}\n >\n {label}\n </Button>\n <span\n role=\"status\"\n >\n {visibleResult ? message : \"\"}\n </span>\n {visibleResult && !visibleResult.success && (<Textarea\n ref={manualCopyInput}\n aria-label={failedLabel}\n value={value}\n readOnly\n />)}\n </span>);\n};\n", "/**\n * @author WMXPY\n * @package Clipboard\n * @namespace CopyPath\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const copyPathStyles = cva(\"gridui-copy-path gridui-u-clipboard--min-w-0 gridui-u-clipboard--rounded-none\");\n\nexport const copyPathRowStyles = cva(\"gridui-u-clipboard--grid gridui-u-clipboard--min-w-0 gridui-u-clipboard--grid-cols-[minmax(0,1fr)_auto] gridui-u-clipboard--bg-surface\");\n\nexport const copyPathValueStyles = cva(\"gridui-u-clipboard--min-w-0 gridui-u-clipboard--self-center gridui-u-clipboard--px-gridui-24 gridui-u-clipboard--py-gridui-16 gridui-u-clipboard--type-code gridui-u-clipboard--text-foreground gridui-u-clipboard--wrap-anywhere gridui-u-clipboard--select-text\");\n\nexport const copyPathActionStyles = cva(\"gridui-copy-path-action gridui-u-clipboard--flex gridui-u-clipboard--min-h-11 gridui-u-clipboard--items-center gridui-u-clipboard--justify-center gridui-u-clipboard--gap-gridui-8 gridui-u-clipboard--rounded-none gridui-u-clipboard--bg-background gridui-u-clipboard--px-gridui-16 gridui-u-clipboard--py-gridui-8 gridui-u-clipboard--text-foreground gridui-u-clipboard--type-ui gridui-u-clipboard--cursor-pointer gridui-u-clipboard--[&_svg]:h-gridui-16 gridui-u-clipboard--[&_svg]:w-gridui-16 gridui-u-clipboard--[&_svg]:shrink-0 gridui-u-clipboard--disabled:cursor-wait\");\n\nexport const copyPathStatusStyles = cva(\"gridui-u-clipboard--px-gridui-24 gridui-u-clipboard--py-gridui-8 gridui-u-clipboard--type-supporting gridui-u-clipboard--text-muted gridui-u-clipboard--empty:hidden\");\n", "/**\n * @author WMXPY\n * @package Clipboard\n * @namespace CopyPath\n * @description Copy Path\n */\n\nimport { copyPath } from \"../shared/clipboard\";\nimport type { CopyOptions } from \"../shared/copy-options\";\nimport { copyPathActionStyles, copyPathRowStyles, copyPathStatusStyles, copyPathStyles, copyPathValueStyles } from \"./style\";\nimport { Check, Copy } from \"lucide-react\";\nimport { type FC, useRef, useState } from \"react\";\n\nexport type CopyPathProps = CopyOptions & {\n readonly label: string;\n readonly copyLabel: string;\n readonly frame?: \"standalone\" | \"integrated\";\n};\n\nexport const CopyPath: FC<CopyPathProps> = (props: CopyPathProps) => {\n const {\n value,\n label,\n copyLabel,\n copiedLabel,\n failedLabel,\n frame = \"standalone\",\n } = props;\n const [\n result,\n setResult,\n ] = useState<{\n value: string;\n copied: boolean;\n } | null>(null);\n const [\n pending,\n setPending,\n ] = useState(false);\n const code = useRef<HTMLElement>(null);\n const current = result?.value === value ? result : null;\n let statusLabel = \"\";\n if (current) {\n statusLabel = current.copied ? copiedLabel : failedLabel;\n }\n const copy = async (): Promise<void> => {\n if (pending) {\n return;\n }\n setPending(true);\n const copied = await copyPath(value);\n if (!copied && code.current?.textContent === value) {\n const range = document.createRange();\n range.selectNodeContents(code.current);\n const selection = window.getSelection();\n selection?.removeAllRanges();\n selection?.addRange(range);\n }\n setResult({\n value,\n copied,\n });\n setPending(false);\n };\n return (<div\n className={copyPathStyles()}\n data-frame={frame}\n role=\"group\"\n aria-label={label}\n >\n <div\n className={copyPathRowStyles()}\n >\n <code\n ref={code}\n className={copyPathValueStyles()}\n >\n {value}\n </code>\n <button\n type=\"button\"\n className={copyPathActionStyles()}\n disabled={pending}\n onClick={() => {\n void copy();\n }}\n >\n {current?.copied ? (<Check\n aria-hidden=\"true\"\n />) : (<Copy\n aria-hidden=\"true\"\n />)}\n {copyLabel}\n </button>\n </div>\n <p\n role=\"status\"\n aria-live=\"polite\"\n className={copyPathStatusStyles()}\n >\n {statusLabel}\n </p>\n </div>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,WAAW,OAAO,UAAoC;AAC/D,MAAI;AACA,UAAM,UAAU,UAAU,UAAU,KAAK;AACzC,WAAO;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;;;ACLA,SAAS,cAAqD;AAC9D,SAAS,gBAAgB;AACzB,SAAkB,WAAW,QAAQ,gBAAgB;AA0DzC,SACJ,KADI;AApDL,IAAM,aAAkC,CAAC,UAA2B;AACvE,QAAM,EAAE,OAAO,OAAO,aAAa,aAAa,UAAU,GAAG,UAAU,IAAI;AAC3E,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAGM,IAAI;AACd,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,KAAK;AAClB,QAAM,kBAAkB,OAA4B,IAAI;AACxD,QAAM,YAAY,OAAO,IAAI;AAC7B,QAAM,eAAe,OAAO,KAAK;AACjC,eAAa,UAAU;AACvB,QAAM,eAAe,OAAO,KAAK;AACjC,YAAU,MAAM;AACZ,cAAU,UAAU;AACpB,WAAO,MAAM;AACT,gBAAU,UAAU;AAAA,IACxB;AAAA,EACJ,GAAG,CAAC,CAAC;AACL,QAAM,gBAAgB,QAAQ,UAAU,QAAQ,SAAS;AACzD,YAAU,MAAM;AACZ,QAAI,iBAAiB,CAAC,cAAc,SAAS;AACzC,sBAAgB,SAAS,MAAM;AAC/B,sBAAgB,SAAS,OAAO;AAAA,IACpC;AAAA,EACJ,GAAG,CA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C;AAAA;AAAA,wBACjB,eAAY;AAAA;AAAA,oBAChB,IAAO,gBAAAA;AAAA,sBAAC;AAAA;AAAA,wBACJ,eAAY;AAAA;AAAA,oBAChB;AAAA,oBACC;AAAA;AAAA;AAAA,cACL;AAAA;AAAA;AAAA,QACJ;AAAA,QACA,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACG,MAAK;AAAA,YACL,aAAU;AAAA,YACV,WAAW,qBAAqB;AAAA,YAE/B;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": ["useRef", "useState", "jsx", "jsxs"]
|
|
7
7
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
2
|
-
@layer properties;
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
3
2
|
@layer theme, base, components, utilities;
|
|
4
3
|
@layer theme {
|
|
5
4
|
:root, :host {
|
|
@@ -7,129 +6,110 @@
|
|
|
7
6
|
}
|
|
8
7
|
}
|
|
9
8
|
@layer utilities {
|
|
10
|
-
.gridui-u-flex {
|
|
9
|
+
.gridui-u-clipboard--flex {
|
|
11
10
|
display: flex;
|
|
12
11
|
}
|
|
13
|
-
.gridui-u-grid {
|
|
12
|
+
.gridui-u-clipboard--grid {
|
|
14
13
|
display: grid;
|
|
15
14
|
}
|
|
16
|
-
.gridui-u-min-h-11 {
|
|
15
|
+
.gridui-u-clipboard--min-h-11 {
|
|
17
16
|
min-height: calc(var(--spacing) * 11);
|
|
18
17
|
}
|
|
19
|
-
.gridui-u-min-w-0 {
|
|
18
|
+
.gridui-u-clipboard--min-w-0 {
|
|
20
19
|
min-width: 0px;
|
|
21
20
|
}
|
|
22
|
-
.gridui-u-cursor-pointer {
|
|
21
|
+
.gridui-u-clipboard--cursor-pointer {
|
|
23
22
|
cursor: pointer;
|
|
24
23
|
}
|
|
25
|
-
.gridui-u-grid-cols-\[minmax\(0\,1fr\)_auto\] {
|
|
24
|
+
.gridui-u-clipboard--grid-cols-\[minmax\(0\,1fr\)_auto\] {
|
|
26
25
|
grid-template-columns: minmax(0,1fr) auto;
|
|
27
26
|
}
|
|
28
|
-
.gridui-u-items-center {
|
|
27
|
+
.gridui-u-clipboard--items-center {
|
|
29
28
|
align-items: center;
|
|
30
29
|
}
|
|
31
|
-
.gridui-u-justify-center {
|
|
30
|
+
.gridui-u-clipboard--justify-center {
|
|
32
31
|
justify-content: center;
|
|
33
32
|
}
|
|
34
|
-
.gridui-u-gap-gridui-8 {
|
|
33
|
+
.gridui-u-clipboard--gap-gridui-8 {
|
|
35
34
|
gap: var(--gridui-space-8);
|
|
36
35
|
}
|
|
37
|
-
.gridui-u-self-center {
|
|
36
|
+
.gridui-u-clipboard--self-center {
|
|
38
37
|
align-self: center;
|
|
39
38
|
}
|
|
40
|
-
.gridui-u-rounded-none {
|
|
39
|
+
.gridui-u-clipboard--rounded-none {
|
|
41
40
|
border-radius: 0;
|
|
42
41
|
}
|
|
43
|
-
.gridui-u-
|
|
44
|
-
border-style: var(--tw-border-style);
|
|
45
|
-
border-width: 1px;
|
|
46
|
-
}
|
|
47
|
-
.gridui-u-border-0 {
|
|
48
|
-
border-style: var(--tw-border-style);
|
|
49
|
-
border-width: 0px;
|
|
50
|
-
}
|
|
51
|
-
.gridui-u-border-l {
|
|
52
|
-
border-left-style: var(--tw-border-style);
|
|
53
|
-
border-left-width: 1px;
|
|
54
|
-
}
|
|
55
|
-
.gridui-u-border-solid {
|
|
56
|
-
--tw-border-style: solid;
|
|
57
|
-
border-style: solid;
|
|
58
|
-
}
|
|
59
|
-
.gridui-u-border-border {
|
|
60
|
-
border-color: var(--gridui-border);
|
|
61
|
-
}
|
|
62
|
-
.gridui-u-border-control-border {
|
|
63
|
-
border-color: var(--gridui-control-border);
|
|
64
|
-
}
|
|
65
|
-
.gridui-u-bg-background {
|
|
42
|
+
.gridui-u-clipboard--bg-background {
|
|
66
43
|
background-color: var(--gridui-background);
|
|
67
44
|
}
|
|
68
|
-
.gridui-u-bg-surface {
|
|
45
|
+
.gridui-u-clipboard--bg-surface {
|
|
69
46
|
background-color: var(--gridui-surface);
|
|
70
47
|
}
|
|
71
|
-
.gridui-u-px-gridui-16 {
|
|
48
|
+
.gridui-u-clipboard--px-gridui-16 {
|
|
72
49
|
padding-inline: var(--gridui-space-16);
|
|
73
50
|
}
|
|
74
|
-
.gridui-u-px-gridui-24 {
|
|
51
|
+
.gridui-u-clipboard--px-gridui-24 {
|
|
75
52
|
padding-inline: var(--gridui-space-24);
|
|
76
53
|
}
|
|
77
|
-
.gridui-u-py-gridui-8 {
|
|
54
|
+
.gridui-u-clipboard--py-gridui-8 {
|
|
78
55
|
padding-block: var(--gridui-space-8);
|
|
79
56
|
}
|
|
80
|
-
.gridui-u-py-gridui-16 {
|
|
57
|
+
.gridui-u-clipboard--py-gridui-16 {
|
|
81
58
|
padding-block: var(--gridui-space-16);
|
|
82
59
|
}
|
|
83
|
-
.gridui-u-type-code {
|
|
60
|
+
.gridui-u-clipboard--type-code {
|
|
84
61
|
font: var(--gridui-type-code);
|
|
85
62
|
letter-spacing: normal;
|
|
86
63
|
}
|
|
87
|
-
.gridui-u-type-supporting {
|
|
64
|
+
.gridui-u-clipboard--type-supporting {
|
|
88
65
|
font: var(--gridui-type-supporting);
|
|
89
66
|
letter-spacing: normal;
|
|
90
67
|
}
|
|
91
|
-
.gridui-u-type-ui {
|
|
68
|
+
.gridui-u-clipboard--type-ui {
|
|
92
69
|
font: var(--gridui-type-ui);
|
|
93
70
|
letter-spacing: normal;
|
|
94
71
|
}
|
|
95
|
-
.gridui-u-wrap-anywhere {
|
|
72
|
+
.gridui-u-clipboard--wrap-anywhere {
|
|
96
73
|
overflow-wrap: anywhere;
|
|
97
74
|
}
|
|
98
|
-
.gridui-u-text-foreground {
|
|
75
|
+
.gridui-u-clipboard--text-foreground {
|
|
99
76
|
color: var(--gridui-foreground);
|
|
100
77
|
}
|
|
101
|
-
.gridui-u-text-muted {
|
|
78
|
+
.gridui-u-clipboard--text-muted {
|
|
102
79
|
color: var(--gridui-muted);
|
|
103
80
|
}
|
|
104
|
-
.gridui-u-select-text {
|
|
81
|
+
.gridui-u-clipboard--select-text {
|
|
105
82
|
-webkit-user-select: text;
|
|
106
83
|
user-select: text;
|
|
107
84
|
}
|
|
108
|
-
.gridui-u-empty\:hidden:empty {
|
|
85
|
+
.gridui-u-clipboard--empty\:hidden:empty {
|
|
109
86
|
display: none;
|
|
110
87
|
}
|
|
111
|
-
.gridui-u-disabled\:cursor-wait:disabled {
|
|
88
|
+
.gridui-u-clipboard--disabled\:cursor-wait:disabled {
|
|
112
89
|
cursor: wait;
|
|
113
90
|
}
|
|
114
|
-
.gridui-u
|
|
91
|
+
.gridui-u-clipboard--\[\&_svg\]\:h-gridui-16 svg {
|
|
115
92
|
height: var(--gridui-space-16);
|
|
116
93
|
}
|
|
117
|
-
.gridui-u
|
|
94
|
+
.gridui-u-clipboard--\[\&_svg\]\:w-gridui-16 svg {
|
|
118
95
|
width: var(--gridui-space-16);
|
|
119
96
|
}
|
|
120
|
-
.gridui-u
|
|
97
|
+
.gridui-u-clipboard--\[\&_svg\]\:shrink-0 svg {
|
|
121
98
|
flex-shrink: 0;
|
|
122
99
|
}
|
|
123
100
|
}
|
|
124
|
-
@
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
101
|
+
@layer components {
|
|
102
|
+
.gridui-copy-path {
|
|
103
|
+
--_gridui-copy-path-border: var(--gridui-control-border);
|
|
104
|
+
}
|
|
105
|
+
.gridui-copy-path[data-frame="standalone"] {
|
|
106
|
+
border: 1px solid var(--_gridui-copy-path-border);
|
|
107
|
+
}
|
|
108
|
+
.gridui-copy-path[data-frame="integrated"] {
|
|
109
|
+
--_gridui-copy-path-border: var(--gridui-border);
|
|
110
|
+
}
|
|
111
|
+
.gridui-copy-path-action {
|
|
112
|
+
border: 0;
|
|
113
|
+
border-inline-start: 1px solid var(--_gridui-copy-path-border);
|
|
134
114
|
}
|
|
135
115
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"name": "@gridui/clipboard",
|
|
4
|
+
"version": "1.0.6",
|
|
5
|
+
"category": "core",
|
|
6
|
+
"description": "GridUI React clipboard",
|
|
7
|
+
"usage": "`CopyPath` displays an exact `value` and an explicit copy button. Callers supply its accessible `label`, `copyLabel`, `copiedLabel`, and `failedLabel`. Clipboard success is announced only after the write resolves; unavailable or denied clipboard access selects the visible path for manual copying and reports failure. `frame=\"integrated\"` omits outer borders so a parent grid owns its seams and uses the grid border color for the copy button's separator; standalone mode supplies a straight control border. Neither mode adds external padding or expands environment variables, usernames, or path placeholders.",
|
|
8
|
+
"documentation": [
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": [
|
|
12
|
+
{
|
|
13
|
+
"name": "CopyButton",
|
|
14
|
+
"kind": "component",
|
|
15
|
+
"importPath": "@gridui/clipboard"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "CopyButtonProps",
|
|
19
|
+
"kind": "type",
|
|
20
|
+
"importPath": "@gridui/clipboard"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "CopyPath",
|
|
24
|
+
"kind": "component",
|
|
25
|
+
"importPath": "@gridui/clipboard"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "CopyPathProps",
|
|
29
|
+
"kind": "type",
|
|
30
|
+
"importPath": "@gridui/clipboard"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"styles": [
|
|
34
|
+
"@gridui/theme/styles.css",
|
|
35
|
+
"@gridui/button/styles.css",
|
|
36
|
+
"@gridui/overlay/styles.css",
|
|
37
|
+
"@gridui/input/styles.css",
|
|
38
|
+
"@gridui/clipboard/styles.css"
|
|
39
|
+
],
|
|
40
|
+
"examples": [
|
|
41
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/stories/copy-button.stories.tsx",
|
|
42
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/stories/copy-path.stories.tsx"
|
|
43
|
+
]
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/clipboard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "GridUI React clipboard",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs"
|
|
10
11
|
],
|
|
11
12
|
"sideEffects": [
|
|
12
13
|
"**/*.css"
|
|
@@ -26,16 +27,16 @@
|
|
|
26
27
|
"react-dom": "^19.2.0"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@gridui/button": "^
|
|
30
|
-
"@gridui/input": "^
|
|
31
|
-
"@gridui/theme": "^2.
|
|
30
|
+
"@gridui/button": "^4.0.0",
|
|
31
|
+
"@gridui/input": "^2.0.0",
|
|
32
|
+
"@gridui/theme": "^2.5.3",
|
|
32
33
|
"class-variance-authority": "0.7.1",
|
|
33
|
-
"lucide-react": "1.
|
|
34
|
+
"lucide-react": "1.70.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
37
38
|
"@jest/globals": "30.5.2",
|
|
38
|
-
"@storybook/react-vite": "10.6.
|
|
39
|
+
"@storybook/react-vite": "10.6.6",
|
|
39
40
|
"@types/jest": "30.0.0",
|
|
40
41
|
"@types/node": "26.6.6",
|
|
41
42
|
"@types/react": "19.3.0",
|