@zonos/amino 5.0.0 → 5.0.1
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 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../icons/SearchIcon.js"),r=require("../../styles/constants/theme.js");function a(e){return e&&e.__esModule?e:{default:e}}require("react"),require("../../icons/icon-base/_IconBase.js");var i,l,
|
|
1
|
+
"use strict";var e=require("../../_tslib-ccfac372.js"),n=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../icons/SearchIcon.js"),r=require("../../styles/constants/theme.js");function a(e){return e&&e.__esModule?e:{default:e}}require("react"),require("../../icons/icon-base/_IconBase.js");var i,l,u,s=a(t),d=s.default.div(i||(i=e.__makeTemplateObject(["\n position: relative;\n border: ",";\n border-radius: ",";\n width: 100%;\n"],["\n position: relative;\n border: ",";\n border-radius: ",";\n width: 100%;\n"])),r.theme.border,r.theme.radius6),c=s.default.label(l||(l=e.__makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: ",";\n"],["\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: ",";\n"])),r.theme.space40),h=s.default.input(u||(u=e.__makeTemplateObject(["\n padding-left: ",";\n padding-right: ",";\n height: 40px;\n font-weight: 500;\n line-height: 40px;\n border-radius: ",";\n outline: none;\n width: 100%;\n background: ",";\n :focus {\n outline: none;\n box-shadow: ",";\n }\n &:-webkit-autofill,\n &:-moz-autofill {\n background-color: ",";\n color: ",";\n }\n\n /* The native X on the right of the input */\n &:not([value=''])::-webkit-search-cancel-button {\n opacity: 1 !important;\n cursor: pointer;\n }\n"],["\n padding-left: ",";\n padding-right: ",";\n height: 40px;\n font-weight: 500;\n line-height: 40px;\n border-radius: ",";\n outline: none;\n width: 100%;\n background: ",";\n :focus {\n outline: none;\n box-shadow: ",";\n }\n &:-webkit-autofill,\n &:-moz-autofill {\n background-color: ",";\n color: ",";\n }\n\n /* The native X on the right of the input */\n &:not([value=''])::-webkit-search-cancel-button {\n opacity: 1 !important;\n cursor: pointer;\n }\n"])),r.theme.space40,r.theme.space16,r.theme.radius6,r.theme.inputBackground,r.theme.glowBlue,r.theme.inputBackground,r.theme.textColor);exports.SearchInput=function(t){var r=t.autoFocus,a=t.className,i=t.disabled,l=t.inputMode,u=t.onChange,s=t.onKeyDown,p=t.pattern,b=t.placeholder,m=t.readOnly,g=t.required,f=t.tabIndex,w=t.value,x=e.__rest(t,["autoFocus","className","disabled","inputMode","onChange","onKeyDown","pattern","placeholder","readOnly","required","tabIndex","value"]);return n.jsxs(d,{className:a,children:[n.jsx(c,{htmlFor:h,children:n.jsx(o.SearchIcon,{color:"gray600",size:20})}),n.jsx(h,e.__assign({autoFocus:r,disabled:i,inputMode:l,onChange:u,onKeyDown:s,pattern:p,placeholder:b||"Search...",readOnly:m,required:g,tabIndex:f,type:"search",value:w||""},x))]})};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type StorageParams } from '../storage';
|
|
2
2
|
type AminoLocalStorageKey = 'current-schema';
|
|
3
3
|
/** Storage key that's being used in Amino */
|
|
4
4
|
export type AminoStorageKey = `amino:${AminoLocalStorageKey}` | (string & Record<never, never>);
|
|
5
|
-
type
|
|
5
|
+
export type UseStorageParams<TValue extends unknown, TKey extends AminoStorageKey> = StorageParams<TValue, TKey> & {
|
|
6
6
|
defaultValue: TValue;
|
|
7
7
|
};
|
|
8
8
|
type Return<T> = [value: T, setValue: (value: T) => void];
|
|
9
|
-
export declare const useStorage: <TValue extends unknown, TKey extends AminoStorageKey = AminoStorageKey>({ defaultValue, json, key, type, }:
|
|
9
|
+
export declare const useStorage: <TValue extends unknown, TKey extends AminoStorageKey = AminoStorageKey>({ defaultValue, json, key, type, }: UseStorageParams<TValue, TKey>) => Return<TValue>;
|
|
10
10
|
export {};
|
package/utils/storage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Schema } from 'zod';
|
|
2
2
|
export type StorageType = 'session' | 'local';
|
|
3
|
-
export type
|
|
3
|
+
export type StorageParams<Value, Key extends string = string> = {
|
|
4
4
|
/**
|
|
5
5
|
* @param json - If true, the value will be set/parsed as JSON
|
|
6
6
|
* @default false
|
|
@@ -14,9 +14,9 @@ export type StorageProps<Value, Key extends string = string> = {
|
|
|
14
14
|
schema?: Schema<Value>;
|
|
15
15
|
type: StorageType;
|
|
16
16
|
};
|
|
17
|
-
type
|
|
17
|
+
type SetParams<Value> = StorageParams<Value> & {
|
|
18
18
|
value: Value;
|
|
19
19
|
};
|
|
20
|
-
export declare const getStorageItem: <Value extends unknown>({ json, key, schema, type, }:
|
|
21
|
-
export declare const setStorageItem: <Value extends unknown>({ json, key, type, value, }:
|
|
20
|
+
export declare const getStorageItem: <Value extends unknown>({ json, key, schema, type, }: StorageParams<Value, string>) => Value | null;
|
|
21
|
+
export declare const setStorageItem: <Value extends unknown>({ json, key, type, value, }: SetParams<Value>) => void;
|
|
22
22
|
export {};
|