@minimalstuff/ui 0.0.17 → 0.0.19

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/index.d.ts CHANGED
@@ -17,9 +17,12 @@ import { InputHTMLAttributes } from 'react';
17
17
  import { JSX as JSX_2 } from 'react';
18
18
  import { JSX as JSX_3 } from '@emotion/react/jsx-runtime';
19
19
  import { LiHTMLAttributes } from 'react';
20
+ import { MutableRefObject } from 'react';
20
21
  import { OptionsOrGroups } from 'react-select';
21
22
  import { PropsWithChildren } from 'react';
22
23
  import { ReactNode } from 'react';
24
+ import { RefObject } from 'react';
25
+ import { RefType } from 'react-hotkeys-hook/dist/types';
23
26
  import { StyledComponent } from '@emotion/styled';
24
27
  import { Theme } from '@emotion/react';
25
28
 
@@ -119,6 +122,15 @@ theme?: Theme | undefined;
119
122
  as?: ElementType<any, keyof JSX_2.IntrinsicElements> | undefined;
120
123
  }, DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
121
124
 
125
+ declare type GlobalHotkeysContext = {
126
+ globalHotkeysEnabled: boolean;
127
+ setGlobalHotkeysEnabled: (value: boolean) => void;
128
+ };
129
+
130
+ declare const GlobalHotkeysContext = createContext<GlobalHotkeysContext>(
131
+ iGlobalHotkeysContextState
132
+ );
133
+
122
134
  declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
123
135
  label: string;
124
136
  name: string;
@@ -135,6 +147,12 @@ declare interface InputProps_2 extends Omit<InputHTMLAttributes<HTMLInputElement
135
147
  onChange?: (name: string, value: string) => void;
136
148
  }
137
149
 
150
+ declare const KEYS = {
151
+ ARROW_DOWN,
152
+ ARROW_UP,
153
+ ESCAPE_KEY,
154
+ };
155
+
138
156
  declare type Medias = {
139
157
  [key in ScreenType]: string;
140
158
  };
@@ -211,6 +229,11 @@ declare interface SelectorProps extends Omit<InputHTMLAttributes<HTMLInputElemen
211
229
  formatOptionLabel?: (data: Option_2, formatOptionLabelMeta: FormatOptionLabelMeta<Option_2>) => ReactNode;
212
230
  }
213
231
 
232
+ declare type ShortcutOptions = {
233
+ enabled?: boolean;
234
+ disableGlobalCheck?: boolean;
235
+ };
236
+
214
237
  declare type SizeType = 'xs' | 's' | 'm' | 'l' | 'xl';
215
238
 
216
239
  declare type SpeedType = 'fast' | 'normal' | 'slow';
@@ -282,6 +305,27 @@ export declare interface UITheme {
282
305
  fontSizes: FontSizes;
283
306
  }
284
307
 
308
+ /**
309
+ * This Hook can be used for detecting clicks outside the Opened Menu
310
+ */
311
+ export declare function useClickOutside(ref: RefObject<HTMLElement>, onClickOutside: () => void): void;
312
+
313
+ export declare const useGlobalHotkeys: () => GlobalHotkeysContext;
314
+
315
+ export declare function useShortcut(key: keyof typeof KEYS, cb: () => void, { enabled, disableGlobalCheck }?: ShortcutOptions): MutableRefObject<RefType<HTMLElement>>;
316
+
317
+ export declare const useThemeSwitcher: () => {
318
+ isDarkTheme: boolean;
319
+ toggleDarkTheme: (_value: boolean) => void;
320
+ };
321
+
322
+ export declare const useToggle: (defaultValue?: boolean) => {
323
+ isShowing: boolean;
324
+ toggle: () => void;
325
+ open: () => void;
326
+ close: () => void;
327
+ };
328
+
285
329
  export { }
286
330
 
287
331