@jamsrui/clipboard 0.0.9 → 0.0.11

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.
@@ -0,0 +1 @@
1
+ import{b as t}from"./chunk-XUX7KG6K.mjs";import{useRenderElement as d}from"@jamsrui/hooks";import{CheckIcon as m,CopyIcon as c}from"@jamsrui/icons";import{jsx as r}from"react/jsx-runtime";var b=e=>{let{getButtonProps:n,hideCopyButton:p,isCopied:s,getIconProps:o}=t(),i=s?r(m,{...o({})}):r(c,{...o({})}),u=d("button",{props:[n(e),{children:i}]});return p?null:u};export{b as a};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-4IIX4CUZ.mjs";import{b as n}from"./chunk-DUMA3HP6.mjs";import{a as t}from"./chunk-XUX7KG6K.mjs";import{a as i}from"./chunk-YOZTTHNF.mjs";import{useRenderElement as a}from"@jamsrui/hooks";import{mergeConfigProps as b}from"@jamsrui/utils";import{Fragment as f,jsx as s,jsxs as g}from"react/jsx-runtime";var v=o=>{let r=n(),d=b(r,r,o),e=i(d),{getRootProps:l}=e,{children:m}=o,c=g(f,{children:[m,s(p,{})]}),C=a("label",{props:[l(),{children:c}]});return s(t,{value:e,children:C})};export{v as a};
@@ -0,0 +1 @@
1
+ import{createConfigContext as o}from"@jamsrui/utils";var[p,i]=o({displayName:"ClipboardConfig"});export{p as a,i as b};
@@ -0,0 +1 @@
1
+ import{useRef as x,useState as m}from"react";var g=n=>{let[s,t]=m(!1),{text:e,onCopyError:c,onCopySuccess:i,ctx:u,message:p,timeout:a=1e3}=n,o=x(null),r={message:p,ctx:u,text:e};return{isCopied:s,onCopy:async()=>{try{await navigator.clipboard.writeText(e),t(!0),i?.(r),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(!1)},a)}catch(C){console.log(" err:->",C),c?.(r)}}}};export{g as a};
@@ -0,0 +1 @@
1
+ import{tv as o}from"@jamsrui/utils";var t=o({slots:{root:"relative z-1 inline-flex cursor-copy items-center gap-0.5 hover:opacity-80",button:"cursor-copy aria-hidden:hidden",icon:"size-4"}});export{t as a};
@@ -0,0 +1 @@
1
+ import{createContext as e,use as o}from"react";var r=e(null),n=()=>{let t=o(r);if(!t)throw new Error("useClipboardContext must be with with a ClipboardContext");return t};export{r as a,n as b};
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-G75FKEIV.mjs";import{a as P}from"./chunk-DUSTTWAR.mjs";import{useCallback as r,useMemo as I}from"react";import{cn as p,dataAttrDev as n,mergeProps as y}from"@jamsrui/utils";var h=a=>{let{classNames:o,slotProps:t,hideCopyButton:l,text:N,message:f,onCopySuccess:g,onCopyError:T,ctx:x,timeout:B,...c}=a,{isCopied:m,onCopy:i}=P({text:N,onCopyError:T,onCopySuccess:g,ctx:x,message:f,timeout:B}),s=d(),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=>({...y(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=>({...y(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 I(()=>({getRootProps:u,getButtonProps:C,getIconProps:b,hideCopyButton:l,isCopied:m}),[C,b,u,l,m])};export{h as a};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{useRenderElement as u}from"@jamsrui/hooks";import{CheckIcon as d,CopyIcon as m}from"@jamsrui/icons";import{useClipboardContext as c}from"./clipboard-context";const b=r=>{const{getButtonProps:e,hideCopyButton:n,isCopied:p,getIconProps:o}=c(),s=p?t(d,{...o({})}):t(m,{...o({})}),i=u("button",{props:[e(r),{children:s}]});return n?null:i};export{b as ClipboardButton};
1
+ import{a}from"./chunk-4IIX4CUZ.mjs";import"./chunk-XUX7KG6K.mjs";export{a as ClipboardButton};
@@ -1 +1 @@
1
- import{createConfigContext as o}from"@jamsrui/utils";const[p,i]=o({displayName:"ClipboardConfig"});export{p as ClipboardConfig,i as useClipboardConfig};
1
+ import{a,b}from"./chunk-DUMA3HP6.mjs";export{a as ClipboardConfig,b 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
+ import{a,b}from"./chunk-XUX7KG6K.mjs";export{a as ClipboardContext,b as useClipboardContext};
@@ -1 +1 @@
1
- import{Fragment as f,jsx as t,jsxs as g}from"react/jsx-runtime";import{useRenderElement as l}from"@jamsrui/hooks";import{mergeConfigProps as m}from"@jamsrui/utils";import{ClipboardButton as c}from"./clipboard-button";import{useClipboardConfig as C}from"./clipboard-config";import{ClipboardContext as a}from"./clipboard-context";import{useClipboard as b}from"./use-clipboard";const v=o=>{const r=C(),p=m(r,r,o),e=b(p),{getRootProps:n}=e,{children:i}=o,s=g(f,{children:[i,t(c,{})]}),d=l("label",{props:[n(),{children:s}]});return t(a,{value:e,children:d})};export{v as Clipboard};
1
+ import{a}from"./chunk-CFC5ZATK.mjs";import"./chunk-4IIX4CUZ.mjs";import"./chunk-DUMA3HP6.mjs";import"./chunk-XUX7KG6K.mjs";import"./chunk-YOZTTHNF.mjs";import"./chunk-G75FKEIV.mjs";import"./chunk-DUSTTWAR.mjs";export{a as Clipboard};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{Clipboard as i}from"./clipboard";import{ClipboardConfig as p,useClipboardConfig as C}from"./clipboard-config";export{i as Clipboard,p as ClipboardConfig,C as useClipboardConfig};
1
+ "use client";import{a as i}from"./chunk-CFC5ZATK.mjs";import"./chunk-4IIX4CUZ.mjs";import{a as o,b as r}from"./chunk-DUMA3HP6.mjs";import"./chunk-XUX7KG6K.mjs";import"./chunk-YOZTTHNF.mjs";import"./chunk-G75FKEIV.mjs";import"./chunk-DUSTTWAR.mjs";export{i as Clipboard,o as ClipboardConfig,r as useClipboardConfig};
package/dist/styles.d.mts CHANGED
@@ -5,16 +5,16 @@ import * as tailwind_merge from 'tailwind-merge';
5
5
  declare const copyToClipboardVariants: _jamsrui_utils.TVReturnType<{
6
6
  [key: string]: {
7
7
  [key: string]: tailwind_merge.ClassNameValue | {
8
- button?: tailwind_merge.ClassNameValue;
9
8
  root?: tailwind_merge.ClassNameValue;
9
+ button?: tailwind_merge.ClassNameValue;
10
10
  icon?: tailwind_merge.ClassNameValue;
11
11
  };
12
12
  };
13
13
  } | {
14
14
  [x: string]: {
15
15
  [x: string]: tailwind_merge.ClassNameValue | {
16
- button?: tailwind_merge.ClassNameValue;
17
16
  root?: tailwind_merge.ClassNameValue;
17
+ button?: tailwind_merge.ClassNameValue;
18
18
  icon?: tailwind_merge.ClassNameValue;
19
19
  };
20
20
  };
@@ -25,8 +25,8 @@ declare const copyToClipboardVariants: _jamsrui_utils.TVReturnType<{
25
25
  }, undefined, {
26
26
  [key: string]: {
27
27
  [key: string]: tailwind_merge.ClassNameValue | {
28
- button?: tailwind_merge.ClassNameValue;
29
28
  root?: tailwind_merge.ClassNameValue;
29
+ button?: tailwind_merge.ClassNameValue;
30
30
  icon?: tailwind_merge.ClassNameValue;
31
31
  };
32
32
  };
package/dist/styles.mjs CHANGED
@@ -1 +1 @@
1
- import{tv as o}from"@jamsrui/utils";const t=o({slots:{root:"relative z-1 inline-flex cursor-copy items-center gap-0.5 hover:opacity-80",button:"cursor-copy aria-hidden:hidden",icon:"size-4"}});export{t as copyToClipboardVariants};
1
+ import{a}from"./chunk-G75FKEIV.mjs";export{a as copyToClipboardVariants};
@@ -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
- ref?: react.Ref<HTMLLabelElement> | undefined;
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
- htmlFor?: string | undefined | undefined;
21
- suppressContentEditableWarning?: boolean | undefined | undefined;
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
- about?: string | undefined | undefined;
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>;
@@ -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";import{useCopyToClipboard as I}from"./use-copy-to-clipboard";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
+ import{a}from"./chunk-YOZTTHNF.mjs";import"./chunk-G75FKEIV.mjs";import"./chunk-DUSTTWAR.mjs";export{a as useClipboard};
@@ -1 +1 @@
1
- import{useRef as x,useState as m}from"react";const g=n=>{const[s,t]=m(!1),{text:e,onCopyError:c,onCopySuccess:i,ctx:u,message:p,timeout:a=1e3}=n,o=x(null),r={message:p,ctx:u,text:e};return{isCopied:s,onCopy:async()=>{try{await navigator.clipboard.writeText(e),t(!0),i?.(r),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(!1)},a)}catch(C){console.log(" err:->",C),c?.(r)}}}};export{g as useCopyToClipboard};
1
+ import{a}from"./chunk-DUSTTWAR.mjs";export{a as useCopyToClipboard};
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@jamsrui/clipboard",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "peerDependencies": {
5
5
  "react": ">=19"
6
6
  },
7
7
  "dependencies": {
8
- "@jamsrui/icons": "^0.0.8",
9
- "@jamsrui/hooks": "^0.0.9",
10
- "@jamsrui/core": "^0.0.8",
11
- "@jamsrui/utils": "^0.0.9"
8
+ "@jamsrui/icons": "^0.0.10",
9
+ "@jamsrui/hooks": "^0.0.11",
10
+ "@jamsrui/core": "^0.0.10",
11
+ "@jamsrui/utils": "^0.0.11"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.js"
16
+ "import": "./dist/index.mjs"
18
17
  }
19
18
  },
20
19
  "description": "A modern and beautiful Next.js UI components library.",