@jamsrui/clipboard 0.0.16 → 0.0.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/dist/clipboard-button.mjs +1 -1
- package/dist/clipboard-config.d.mts +2 -2
- package/dist/clipboard-config.mjs +1 -1
- package/dist/clipboard-context.mjs +1 -1
- package/dist/clipboard.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/styles.d.mts +3 -3
- package/dist/use-clipboard.d.mts +49 -49
- package/dist/use-clipboard.mjs +1 -1
- package/dist/use-copy-to-clipboard.mjs +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{useRenderElement as u}from"@jamsrui/hooks";import{CheckIcon as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{useRenderElement as u}from"@jamsrui/hooks";import{CheckIcon as c,CopyIcon as d}from"@jamsrui/icons";import{useClipboardContext as l}from"./clipboard-context.mjs";const b=e=>{const{getButtonProps:r,hideCopyButton:n,isCopied:p,getIconProps:o}=l(),s=p?t(c,{...o({})}):t(d,{...o({})}),i=u("button",{props:[r(e),{children:s}]});return n?null:i};export{b as ClipboardButton};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Clipboard } from './clipboard.mjs';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { WithGlobalConfig } from '@jamsrui/core';
|
|
4
4
|
import './use-clipboard.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import './use-copy-to-clipboard.mjs';
|
|
@@ -15,7 +15,7 @@ declare const ClipboardConfig: (props: Omit<Partial<ClipboardConfig.Props>, "chi
|
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
}) => react_jsx_runtime.JSX.Element;
|
|
17
17
|
declare namespace ClipboardConfig {
|
|
18
|
-
interface Props extends
|
|
18
|
+
interface Props extends WithGlobalConfig<Clipboard.Props> {
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createConfigContext as o}from"@jamsrui/utils";const[p
|
|
1
|
+
"use client";import{createConfigContext as o}from"@jamsrui/utils";const[r,p]=o({displayName:"ClipboardConfig"});export{r as ClipboardConfig,p as useClipboardConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as e,use as o}from"react";const r=e(null),n=()=>{const t=o(r);if(!t)throw new Error("useClipboardContext must be with with a ClipboardContext");return t};export{r as ClipboardContext,n as useClipboardContext};
|
|
1
|
+
"use client";import{createContext as e,use as o}from"react";const r=e(null),n=()=>{const t=o(r);if(!t)throw new Error("useClipboardContext must be with with a ClipboardContext");return t};export{r as ClipboardContext,n as useClipboardContext};
|
package/dist/clipboard.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
"use client";import{Fragment as u,jsx as e,jsxs as P}from"react/jsx-runtime";import{useRenderElement as l}from"@jamsrui/hooks";import{mergeConfigProps as d}from"@jamsrui/utils";import{ClipboardButton as m}from"./clipboard-button.mjs";import{useClipboardConfig as c}from"./clipboard-config.mjs";import{ClipboardContext as C}from"./clipboard-context.mjs";import{copyToClipboardVariants as b}from"./styles.mjs";import{useClipboard as f}from"./use-clipboard.mjs";const y=o=>{const t=c(),p=d(b.defaultVariants,t,o),r=f(p),{getRootProps:i}=r,{children:n}=o,s=P(u,{children:[n,e(m,{})]}),a=l("label",{props:[i(),{children:s}]});return e(C,{value:r,children:a})};export{y as Clipboard};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{Clipboard as i}from"./clipboard.mjs";import{ClipboardConfig as C,useClipboardConfig as f}from"./clipboard-config.mjs";export{i as Clipboard,C as ClipboardConfig,f as useClipboardConfig};
|
package/dist/styles.d.mts
CHANGED
|
@@ -6,16 +6,16 @@ declare const copyToClipboardVariants: _jamsrui_utils.TVReturnType<{
|
|
|
6
6
|
[key: string]: {
|
|
7
7
|
[key: string]: tailwind_merge.ClassNameValue | {
|
|
8
8
|
button?: tailwind_merge.ClassNameValue;
|
|
9
|
-
root?: tailwind_merge.ClassNameValue;
|
|
10
9
|
icon?: tailwind_merge.ClassNameValue;
|
|
10
|
+
root?: tailwind_merge.ClassNameValue;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
} | {
|
|
14
14
|
[x: string]: {
|
|
15
15
|
[x: string]: tailwind_merge.ClassNameValue | {
|
|
16
16
|
button?: tailwind_merge.ClassNameValue;
|
|
17
|
-
root?: tailwind_merge.ClassNameValue;
|
|
18
17
|
icon?: tailwind_merge.ClassNameValue;
|
|
18
|
+
root?: tailwind_merge.ClassNameValue;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
} | {}, {
|
|
@@ -26,8 +26,8 @@ declare const copyToClipboardVariants: _jamsrui_utils.TVReturnType<{
|
|
|
26
26
|
[key: string]: {
|
|
27
27
|
[key: string]: tailwind_merge.ClassNameValue | {
|
|
28
28
|
button?: tailwind_merge.ClassNameValue;
|
|
29
|
-
root?: tailwind_merge.ClassNameValue;
|
|
30
29
|
icon?: tailwind_merge.ClassNameValue;
|
|
30
|
+
root?: tailwind_merge.ClassNameValue;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
} | {}, {
|
package/dist/use-clipboard.d.mts
CHANGED
|
@@ -12,60 +12,23 @@ declare const useClipboard: (props: useClipboard.Props) => {
|
|
|
12
12
|
"data-slot": string | undefined;
|
|
13
13
|
"data-component": string | undefined;
|
|
14
14
|
className: string;
|
|
15
|
+
onChange?: react.FormEventHandler<HTMLLabelElement> | undefined;
|
|
15
16
|
form?: string | undefined | undefined;
|
|
16
17
|
style?: react.CSSProperties | undefined;
|
|
17
18
|
title?: string | undefined | undefined;
|
|
18
|
-
|
|
19
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
20
|
+
content?: string | undefined | undefined;
|
|
21
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
22
|
+
prefix?: string | undefined | undefined;
|
|
19
23
|
key?: react.Key | null | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
23
|
-
accessKey?: string | undefined | undefined;
|
|
24
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
25
|
-
autoFocus?: boolean | undefined | undefined;
|
|
26
|
-
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
27
|
-
contextMenu?: string | undefined | undefined;
|
|
28
|
-
dir?: string | undefined | undefined;
|
|
29
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
30
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
24
|
+
children?: react.ReactNode;
|
|
25
|
+
ref?: react.Ref<HTMLLabelElement> | undefined;
|
|
31
26
|
hidden?: boolean | undefined | undefined;
|
|
27
|
+
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
32
28
|
id?: string | undefined | undefined;
|
|
33
29
|
lang?: string | undefined | undefined;
|
|
34
|
-
nonce?: string | undefined | undefined;
|
|
35
|
-
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
36
|
-
tabIndex?: number | undefined | undefined;
|
|
37
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
38
|
-
radioGroup?: string | undefined | undefined;
|
|
39
30
|
role?: react.AriaRole | undefined;
|
|
40
|
-
|
|
41
|
-
content?: string | undefined | undefined;
|
|
42
|
-
datatype?: string | undefined | undefined;
|
|
43
|
-
inlist?: any;
|
|
44
|
-
prefix?: string | undefined | undefined;
|
|
45
|
-
property?: string | undefined | undefined;
|
|
46
|
-
rel?: string | undefined | undefined;
|
|
47
|
-
resource?: string | undefined | undefined;
|
|
48
|
-
rev?: string | undefined | undefined;
|
|
49
|
-
typeof?: string | undefined | undefined;
|
|
50
|
-
vocab?: string | undefined | undefined;
|
|
51
|
-
autoCorrect?: string | undefined | undefined;
|
|
52
|
-
autoSave?: string | undefined | undefined;
|
|
53
|
-
itemProp?: string | undefined | undefined;
|
|
54
|
-
itemScope?: boolean | undefined | undefined;
|
|
55
|
-
itemType?: string | undefined | undefined;
|
|
56
|
-
itemID?: string | undefined | undefined;
|
|
57
|
-
itemRef?: string | undefined | undefined;
|
|
58
|
-
results?: number | undefined | undefined;
|
|
59
|
-
security?: string | undefined | undefined;
|
|
60
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
61
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
62
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
63
|
-
popoverTarget?: string | undefined | undefined;
|
|
64
|
-
inert?: boolean | undefined | undefined;
|
|
65
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
66
|
-
is?: string | undefined | undefined;
|
|
67
|
-
exportparts?: string | undefined | undefined;
|
|
68
|
-
part?: string | undefined | undefined;
|
|
31
|
+
tabIndex?: number | undefined | undefined;
|
|
69
32
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
70
33
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
71
34
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
@@ -82,7 +45,6 @@ declare const useClipboard: (props: useClipboard.Props) => {
|
|
|
82
45
|
"aria-describedby"?: string | undefined | undefined;
|
|
83
46
|
"aria-description"?: string | undefined | undefined;
|
|
84
47
|
"aria-details"?: string | undefined | undefined;
|
|
85
|
-
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
86
48
|
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
87
49
|
"aria-errormessage"?: string | undefined | undefined;
|
|
88
50
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
@@ -119,7 +81,6 @@ declare const useClipboard: (props: useClipboard.Props) => {
|
|
|
119
81
|
"aria-valuemin"?: number | undefined | undefined;
|
|
120
82
|
"aria-valuenow"?: number | undefined | undefined;
|
|
121
83
|
"aria-valuetext"?: string | undefined | undefined;
|
|
122
|
-
children?: react.ReactNode;
|
|
123
84
|
dangerouslySetInnerHTML?: {
|
|
124
85
|
__html: string | TrustedHTML;
|
|
125
86
|
} | undefined | undefined;
|
|
@@ -139,7 +100,6 @@ declare const useClipboard: (props: useClipboard.Props) => {
|
|
|
139
100
|
onFocusCapture?: react.FocusEventHandler<HTMLLabelElement> | undefined;
|
|
140
101
|
onBlur?: react.FocusEventHandler<HTMLLabelElement> | undefined;
|
|
141
102
|
onBlurCapture?: react.FocusEventHandler<HTMLLabelElement> | undefined;
|
|
142
|
-
onChange?: react.FormEventHandler<HTMLLabelElement> | undefined;
|
|
143
103
|
onChangeCapture?: react.FormEventHandler<HTMLLabelElement> | undefined;
|
|
144
104
|
onBeforeInput?: react.FormEventHandler<HTMLLabelElement> | undefined;
|
|
145
105
|
onBeforeInputCapture?: react.FormEventHandler<HTMLLabelElement> | undefined;
|
|
@@ -292,6 +252,46 @@ declare const useClipboard: (props: useClipboard.Props) => {
|
|
|
292
252
|
onTransitionRunCapture?: react.TransitionEventHandler<HTMLLabelElement> | undefined;
|
|
293
253
|
onTransitionStart?: react.TransitionEventHandler<HTMLLabelElement> | undefined;
|
|
294
254
|
onTransitionStartCapture?: react.TransitionEventHandler<HTMLLabelElement> | undefined;
|
|
255
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
256
|
+
accessKey?: string | undefined | undefined;
|
|
257
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
258
|
+
autoFocus?: boolean | undefined | undefined;
|
|
259
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
260
|
+
contextMenu?: string | undefined | undefined;
|
|
261
|
+
dir?: string | undefined | undefined;
|
|
262
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
263
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
264
|
+
nonce?: string | undefined | undefined;
|
|
265
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
266
|
+
radioGroup?: string | undefined | undefined;
|
|
267
|
+
about?: string | undefined | undefined;
|
|
268
|
+
datatype?: string | undefined | undefined;
|
|
269
|
+
inlist?: any;
|
|
270
|
+
property?: string | undefined | undefined;
|
|
271
|
+
rel?: string | undefined | undefined;
|
|
272
|
+
resource?: string | undefined | undefined;
|
|
273
|
+
rev?: string | undefined | undefined;
|
|
274
|
+
typeof?: string | undefined | undefined;
|
|
275
|
+
vocab?: string | undefined | undefined;
|
|
276
|
+
autoCorrect?: string | undefined | undefined;
|
|
277
|
+
autoSave?: string | undefined | undefined;
|
|
278
|
+
itemProp?: string | undefined | undefined;
|
|
279
|
+
itemScope?: boolean | undefined | undefined;
|
|
280
|
+
itemType?: string | undefined | undefined;
|
|
281
|
+
itemID?: string | undefined | undefined;
|
|
282
|
+
itemRef?: string | undefined | undefined;
|
|
283
|
+
results?: number | undefined | undefined;
|
|
284
|
+
security?: string | undefined | undefined;
|
|
285
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
286
|
+
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
287
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
288
|
+
popoverTarget?: string | undefined | undefined;
|
|
289
|
+
inert?: boolean | undefined | undefined;
|
|
290
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
291
|
+
is?: string | undefined | undefined;
|
|
292
|
+
exportparts?: string | undefined | undefined;
|
|
293
|
+
part?: string | undefined | undefined;
|
|
294
|
+
htmlFor?: string | undefined | undefined;
|
|
295
295
|
render?: React.ReactElement;
|
|
296
296
|
};
|
|
297
297
|
getButtonProps: PropGetter<ClipboardButton.Props>;
|
package/dist/use-clipboard.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as r,useMemo as x}from"react";import{cn as p,dataAttrDev as n,mergeProps as d}from"@jamsrui/utils";import{copyToClipboardVariants as B}from"./styles.mjs";import{useCopyToClipboard as I}from"./use-copy-to-clipboard.mjs";const h=a=>{const{classNames:o,slotProps:t,hideCopyButton:l,text:P,message:y,onCopySuccess:N,onCopyError:f,ctx:g,timeout:T,...c}=a,{isCopied:m,onCopy:i}=I({text:P,onCopyError:f,onCopySuccess:N,ctx:g,message:y,timeout:T}),s=B(),u=r(()=>({...c,onClick:i,"data-slot":n("root"),"data-component":n("clipboard"),className:s.root({className:p(o?.root,a.classNames)})}),[o?.root,c,i,a.classNames,s]),C=r(e=>({...d(t?.button,e),"data-slot":"button",className:s.button({className:p(t?.button?.className,o?.button,e.className)})}),[o?.button,t?.button,s]),b=r(e=>({...d(t?.icon,e),"data-slot":n("icon"),className:s.icon({className:p(t?.icon?.className,o?.icon,e.className)})}),[o?.icon,t?.icon,s]);return x(()=>({getRootProps:u,getButtonProps:C,getIconProps:b,hideCopyButton:l,isCopied:m}),[C,b,u,l,m])};export{h as useClipboard};
|
|
1
|
+
"use client";import{useCallback as r,useMemo as x}from"react";import{cn as p,dataAttrDev as n,mergeProps as d}from"@jamsrui/utils";import{copyToClipboardVariants as B}from"./styles.mjs";import{useCopyToClipboard as I}from"./use-copy-to-clipboard.mjs";const h=a=>{const{classNames:o,slotProps:t,hideCopyButton:l,text:P,message:y,onCopySuccess:N,onCopyError:f,ctx:g,timeout:T,...c}=a,{isCopied:m,onCopy:i}=I({text:P,onCopyError:f,onCopySuccess:N,ctx:g,message:y,timeout:T}),s=B(),u=r(()=>({...c,onClick:i,"data-slot":n("root"),"data-component":n("clipboard"),className:s.root({className:p(o?.root,a.classNames)})}),[o?.root,c,i,a.classNames,s]),C=r(e=>({...d(t?.button,e),"data-slot":"button",className:s.button({className:p(t?.button?.className,o?.button,e.className)})}),[o?.button,t?.button,s]),b=r(e=>({...d(t?.icon,e),"data-slot":n("icon"),className:s.icon({className:p(t?.icon?.className,o?.icon,e.className)})}),[o?.icon,t?.icon,s]);return x(()=>({getRootProps:u,getButtonProps:C,getIconProps:b,hideCopyButton:l,isCopied:m}),[C,b,u,l,m])};export{h as useClipboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as x,useState as m}from"react";const g=
|
|
1
|
+
"use client";import{useRef as x,useState as m}from"react";const g=r=>{const[s,t]=m(!1),{text:e,onCopyError:c,onCopySuccess:i,ctx:u,message:p,timeout:a=1e3}=r,o=x(null),n={message:p,ctx:u,text:e};return{isCopied:s,onCopy:async()=>{try{await navigator.clipboard.writeText(e),t(!0),i?.(n),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(!1)},a)}catch(C){console.log(" err:->",C),c?.(n)}}}};export{g as useCopyToClipboard};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/clipboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=19"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@jamsrui/
|
|
9
|
-
"@jamsrui/
|
|
10
|
-
"@jamsrui/
|
|
11
|
-
"@jamsrui/
|
|
8
|
+
"@jamsrui/hooks": "^0.0.18",
|
|
9
|
+
"@jamsrui/icons": "^0.0.14",
|
|
10
|
+
"@jamsrui/utils": "^0.0.18",
|
|
11
|
+
"@jamsrui/core": "^0.0.14"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|