@zydon/common 2.0.21 → 2.0.22
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var p=()=>{let[o,e]=useState(null);return {copiedText:o,copy:async t=>{if(!navigator?.clipboard)return !1;try{return await navigator.clipboard.writeText(t),e(t),!0}catch{return e(null),!1}}}},l=p;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { l as default };
|
|
@@ -10,6 +10,6 @@ type UseLocalStorageOptions<T> = {
|
|
|
10
10
|
deserializer?: (value: string) => T;
|
|
11
11
|
initializeWithValue?: boolean;
|
|
12
12
|
};
|
|
13
|
-
declare
|
|
13
|
+
declare const useLocalStorage: <T>(key: string, initialValue: T | (() => T), options?: UseLocalStorageOptions<T>) => [T, Dispatch<SetStateAction<T>>, () => void];
|
|
14
14
|
|
|
15
15
|
export { useLocalStorage as default };
|
|
@@ -3,6 +3,6 @@ import '../chunk-3APKMSVD.js';
|
|
|
3
3
|
import { a as a$1 } from '../chunk-4INDXVIX.js';
|
|
4
4
|
import { useCallback, useState, useEffect } from 'react';
|
|
5
5
|
|
|
6
|
-
var h=typeof window>"u"
|
|
6
|
+
var h=typeof window>"u",p=(r,t,o={})=>{let{initializeWithValue:l=!0}=o,S=useCallback(e=>o.serializer?o.serializer(e):JSON.stringify(e),[o]),d=useCallback(e=>{if(o.deserializer)return o.deserializer(e);if(e==="undefined")return;let n=t instanceof Function?t():t,g;try{g=JSON.parse(e);}catch{return n}return g},[o,t]),a$2=useCallback(()=>{let e=t instanceof Function?t():t;if(h)return e;try{let n=window.localStorage.getItem(r);return n?d(n):e}catch{return e}},[t,r,d]),[w,s]=useState(()=>l?a$2():t instanceof Function?t():t),T=a(e=>{try{let n=e instanceof Function?e(a$2()):e;window.localStorage.setItem(r,S(n)),s(n),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));}catch{}}),m=a(()=>{let e=t instanceof Function?t():t;window.localStorage.removeItem(r),s(e),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));});useEffect(()=>{s(a$2());},[r]);let f=useCallback(e=>{e.key&&e.key!==r||s(a$2());},[r,a$2]);return a$1("storage",f),a$1("local-storage",f),[w,T,m]},I=p;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { I as default };
|
package/dist/hooks/useTabs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
|
|
3
|
-
declare
|
|
3
|
+
declare const useTabs: (defaultValue?: string | number) => {
|
|
4
4
|
currentTab: string | number;
|
|
5
5
|
onChangeTab: (_: React.SyntheticEvent<Element, Event>, newValue: string) => void;
|
|
6
6
|
setCurrentTab: react.Dispatch<react.SetStateAction<string | number>>;
|
package/dist/hooks/useTabs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var s=(e="")=>{let[n,t]=useState(e);return {currentTab:n,onChangeTab:(u,r)=>{t(r);},setCurrentTab:t}},b=s;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { b as default };
|