@gridui/clipboard 1.0.5 → 1.0.7

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/README.md CHANGED
@@ -18,3 +18,5 @@ uses the grid border color for the copy button's separator;
18
18
  standalone mode supplies a straight control border. Neither mode adds external
19
19
  padding or expands environment variables, usernames, or path placeholders.
20
20
 
21
+
22
+ [Component reference](docs/reference/README.md) contains focused API pages for each public component.
@@ -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
- variants: {
99
- frame: {
100
- standalone: "gridui-u-border gridui-u-border-solid gridui-u-border-control-border",
101
- integrated: ""
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({ frame }),
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({ frame }),
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 value: string;\n readonly label: string;\n readonly copiedLabel: string;\n readonly failedLabel: 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-min-w-0 gridui-u-rounded-none\", {\n variants: {\n frame: {\n standalone: \"gridui-u-border gridui-u-border-solid gridui-u-border-control-border\",\n integrated: \"\",\n },\n },\n defaultVariants: { frame: \"standalone\" },\n});\n\nexport const copyPathRowStyles = cva(\"gridui-u-grid gridui-u-min-w-0 gridui-u-grid-cols-[minmax(0,1fr)_auto] gridui-u-bg-surface\");\n\nexport const 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\");\n\nexport const 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\", {\n variants: {\n frame: {\n standalone: \"gridui-u-border-control-border\",\n integrated: \"gridui-u-border-border\",\n },\n },\n defaultVariants: { frame: \"standalone\" },\n});\n\nexport const copyPathStatusStyles = cva(\"gridui-u-px-gridui-24 gridui-u-py-gridui-8 gridui-u-type-supporting gridui-u-text-muted gridui-u-empty:hidden\");\n", "/**\n * @author WMXPY\n * @package Clipboard\n * @namespace CopyPath\n * @description Copy Path\n */\n\nimport { copyPath } from \"../shared/clipboard\";\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 = {\n readonly value: string;\n readonly label: string;\n readonly copyLabel: string;\n readonly copiedLabel: string;\n readonly failedLabel: 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({ 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({ frame })}\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;;;ACNA,SAAS,cAAqD;AAC9D,SAAS,gBAAgB;AACzB,SAAkB,WAAW,QAAQ,gBAAgB;AA6DzC,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,CAAC,aAAa,CAAC;AAClB,QAAM,YAAY,YAAY;AAC1B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A,kBAE9B;AAAA;AAAA,cACL;AAAA,cACA,gBAAAC;AAAA,gBAAC;AAAA;AAAA,kBACG,MAAK;AAAA,kBACL,WAAW,qBAAqB,EAAE,MAAM,CAAC;AAAA,kBACzC,UAAU;AAAA,kBACV,SAAS,MAAM;AACX,yBAAK,KAAK;AAAA,kBACd;AAAA,kBAEC;AAAA,6BAAS,SAAU,gBAAAD;AAAA,sBAAC;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;",
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,C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AAC;AAAA,gBAAC;AAAA;AAAA,kBACG,MAAK;AAAA,kBACL,WAAW,qBAAqB;AAAA,kBAChC,UAAU;AAAA,kBACV,SAAS,MAAM;AACX,yBAAK,KAAK;AAAA,kBACd;AAAA,kBAEC;AAAA,6BAAS,SAAU,gBAAAD;AAAA,sBAAC;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
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Clipboard
4
+ * @namespace Shared
5
+ * @description Copy Options
6
+ */
7
+ export type CopyOptions = {
8
+ readonly value: string;
9
+ readonly copiedLabel: string;
10
+ readonly failedLabel: string;
11
+ };
package/dist/styles.css CHANGED
@@ -1,5 +1,4 @@
1
- /*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
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-border {
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-\[\&_svg\]\:h-gridui-16 svg {
91
+ .gridui-u-clipboard--\[\&_svg\]\:h-gridui-16 svg {
115
92
  height: var(--gridui-space-16);
116
93
  }
117
- .gridui-u-\[\&_svg\]\:w-gridui-16 svg {
94
+ .gridui-u-clipboard--\[\&_svg\]\:w-gridui-16 svg {
118
95
  width: var(--gridui-space-16);
119
96
  }
120
- .gridui-u-\[\&_svg\]\:shrink-0 svg {
97
+ .gridui-u-clipboard--\[\&_svg\]\:shrink-0 svg {
121
98
  flex-shrink: 0;
122
99
  }
123
100
  }
124
- @property --tw-border-style {
125
- syntax: "*";
126
- inherits: false;
127
- initial-value: solid;
128
- }
129
- @layer properties {
130
- @supports ((-webkit-hyphens: none) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
131
- *, ::before, ::after, ::backdrop {
132
- --tw-border-style: solid;
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
  }
package/docs/catalog.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/clipboard",
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "category": "core",
6
6
  "description": "GridUI React clipboard",
7
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
8
  "documentation": [
9
- "README.md"
9
+ "README.md",
10
+ "docs/reference/README.md",
11
+ "docs/reference/copy-button.md",
12
+ "docs/reference/copy-path.md"
10
13
  ],
11
14
  "exports": [
12
15
  {
@@ -0,0 +1,5 @@
1
+ <!-- Generated by pnpm docs:storybook. -->
2
+ # Component reference
3
+
4
+ - [CopyButton](copy-button.md)
5
+ - [CopyPath](copy-path.md)
@@ -0,0 +1,105 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # CopyButton
3
+
4
+ Copies supplied text to the clipboard and reports the result. Use it beside content that users need to paste elsewhere.
5
+
6
+ Import from ``@gridui/clipboard`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { CopyButton } from "@gridui/clipboard";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/clipboard/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/stories/copy-button.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
17
+
18
+ ## API
19
+
20
+ The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
21
+
22
+ ### variant
23
+
24
+ ``"text" | "primary" | "secondary" | "quiet" | "highlight" | "underlined" | null | undefined`` · Optional
25
+
26
+ Visual variant.
27
+
28
+ ### size
29
+
30
+ ``"small" | "standard" | "large" | "extra-large" | null | undefined`` · Optional
31
+
32
+ Component size preset.
33
+
34
+ ### layout
35
+
36
+ ``"cell" | "standard" | "icon" | "entry" | "rail" | "divided" | null | undefined`` · Optional
37
+
38
+ Layout within the containing region.
39
+
40
+ ### iconMotion
41
+
42
+ ``"none" | "outward" | null | undefined`` · Optional
43
+
44
+ ### onFocus
45
+
46
+ ``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
47
+
48
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
49
+
50
+ ### onBlur
51
+
52
+ ``(event: FocusEvent<HTMLButtonElement, Element>): void`` · Optional
53
+
54
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
55
+
56
+ ### onChange
57
+
58
+ ``(event: ChangeEvent<HTMLButtonElement, Element>): void`` · Optional
59
+
60
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
61
+
62
+ ### onSubmit
63
+
64
+ ``(event: SubmitEvent<HTMLButtonElement>): void`` · Optional
65
+
66
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
67
+
68
+ ### loading
69
+
70
+ ``boolean | undefined`` · Optional
71
+
72
+ ### startIcon
73
+
74
+ ``ReactNode`` · Optional
75
+
76
+ ### startIconLayout
77
+
78
+ ``"divided" | "inline" | undefined`` · Optional
79
+
80
+ ### startIconSize
81
+
82
+ ``"standard" | "large" | "extra-large" | undefined`` · Optional
83
+
84
+ ### endIcon
85
+
86
+ ``ReactNode`` · Optional
87
+
88
+ ### value
89
+
90
+ ``string`` · Required
91
+
92
+ Controlled value. Pair with the corresponding change callback.
93
+
94
+ ### copiedLabel
95
+
96
+ ``string`` · Required
97
+
98
+ ### failedLabel
99
+
100
+ ``string`` · Required
101
+
102
+ ### label
103
+
104
+ ``string`` · Required
105
+
@@ -0,0 +1,49 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # CopyPath
3
+
4
+ Displays a path with a copy action. Use it for file locations or other path-like values that users need to reuse.
5
+
6
+ Import from ``@gridui/clipboard`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { CopyPath } from "@gridui/clipboard";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/clipboard/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/clipboard/stories/copy-path.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
17
+
18
+ ## API
19
+
20
+ The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
21
+
22
+ ### value
23
+
24
+ ``string`` · Required
25
+
26
+ Controlled value. Pair with the corresponding change callback.
27
+
28
+ ### copiedLabel
29
+
30
+ ``string`` · Required
31
+
32
+ ### failedLabel
33
+
34
+ ``string`` · Required
35
+
36
+ ### label
37
+
38
+ ``string`` · Required
39
+
40
+ ### copyLabel
41
+
42
+ ``string`` · Required
43
+
44
+ ### frame
45
+
46
+ ``"standalone" | "integrated" | undefined`` · Optional
47
+
48
+ Default: ``"standalone"``
49
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/clipboard",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "GridUI React clipboard",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/button": "^3.1.2",
31
- "@gridui/input": "^1.1.6",
30
+ "@gridui/button": "^4.0.0",
31
+ "@gridui/input": "^3.0.0",
32
32
  "@gridui/theme": "^2.5.3",
33
33
  "class-variance-authority": "0.7.1",
34
- "lucide-react": "1.69.0"
34
+ "lucide-react": "1.70.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@gridui-internal/configuration": "0.0.0-internal",