@layers-app/shared 0.0.2

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,478 @@
1
+ /// <reference types="react" />
2
+
3
+ import { AvatarProps } from '@mantine/core';
4
+ import { BoxProps } from '@mantine/core';
5
+ import { ButtonProps } from '@mantine/core';
6
+ import { default as default_2 } from 'react';
7
+ import { DropzoneProps } from '@mantine/dropzone';
8
+ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
9
+ import { FileWithPath } from '@mantine/dropzone';
10
+ import { FloatingPosition } from '@mantine/core';
11
+ import { FunctionComponent } from 'react';
12
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
13
+ import { MemoExoticComponent } from 'react';
14
+ import { NotificationData } from '@mantine/notifications';
15
+ import { OpenConfirmModal } from '@mantine/modals/lib/context';
16
+ import { PersistOptions } from 'zustand/middleware';
17
+ import { PolymorphicComponentProps } from '@mantine/core';
18
+ import { PopoverProps } from '@mantine/core';
19
+ import { PropsWithChildren } from 'react';
20
+ import { ReactNode } from 'react';
21
+ import { StackProps } from '@mantine/core';
22
+ import { StoreApi } from 'zustand';
23
+ import { SVGProps } from 'react';
24
+ import { TextProps } from '@mantine/core';
25
+ import { TitleProps } from '@mantine/core';
26
+ import { TouchEventHandler } from 'react';
27
+ import { UseBoundStore } from 'zustand';
28
+
29
+ export declare const AlertsBlock: (props: AlertType) => JSX_2.Element;
30
+
31
+ export declare type AlertType = {
32
+ trigger: any;
33
+ message: string | React.ReactNode;
34
+ type?: 'error' | 'success' | 'info';
35
+ onClose?: () => void;
36
+ autoClose?: boolean;
37
+ };
38
+
39
+ export declare const AppContainer: (({ header, content, navbar, navbarTitle, }: AppContainerProps) => JSX_2.Element) & {
40
+ NavbarContent: ({ children }: {
41
+ children?: ReactNode;
42
+ }) => JSX_2.Element;
43
+ NavbarFooter: ({ children }: {
44
+ children?: ReactNode;
45
+ }) => JSX_2.Element;
46
+ NavbarHeader: ({ children }: {
47
+ children?: ReactNode;
48
+ }) => JSX_2.Element;
49
+ };
50
+
51
+ export declare type AppContainerActionsStore = {
52
+ readNotificationsFunc: (data: ReadNotificationsRequest) => void;
53
+ };
54
+
55
+ export declare type AppContainerDataStore = {
56
+ tools: ToolDef[];
57
+ workspaceMenu: WorkspaceMenuProps;
58
+ user: MenuUser;
59
+ userMenuItems?: ReactNode;
60
+ notifications: UserNotifications[];
61
+ };
62
+
63
+ export declare type AppContainerProps = {
64
+ content?: ReactNode;
65
+ navbar?: ReactNode;
66
+ header?: ReactNode;
67
+ navbarTitle?: string;
68
+ };
69
+
70
+ export declare type AppContainerStore = {
71
+ navbarWidth: number;
72
+ onNavbarWidthChange: (width: number) => void;
73
+ opened: boolean;
74
+ toggle: () => void;
75
+ close: () => void;
76
+ open: () => void;
77
+ theme: string;
78
+ hiddenTools: string[];
79
+ toggleToolVisibility: (id: string) => void;
80
+ withoutNavbar: boolean;
81
+ withoutHeader: boolean;
82
+ };
83
+
84
+ export declare const appFeature: (value: string) => void;
85
+
86
+ export declare enum AuthErrors {
87
+ g_access_denied = "GOAuthFailed",
88
+ f_access_denied = "FOAuthFailed"
89
+ }
90
+
91
+ declare const baseTabsList: readonly ["gallery", "upload", "link", "unsplash", "giphy"];
92
+
93
+ export declare const closeAppMenu: () => void;
94
+
95
+ export declare const closeSearchModal: () => void;
96
+
97
+ export declare const CustomKBD: ({ value, miw, w, mr, fz, fontFamily, fw, bbw, br, onClick, ...props }: CustomKBDProps & BoxProps) => JSX_2.Element;
98
+
99
+ declare interface CustomKBDProps {
100
+ value: string | ReactNode;
101
+ miw?: number;
102
+ w?: number;
103
+ mr?: number;
104
+ fz?: number;
105
+ h?: number;
106
+ color?: string;
107
+ onClick?: () => void;
108
+ fontFamily?: string;
109
+ fw?: number;
110
+ c?: string;
111
+ br?: number;
112
+ bbw?: number;
113
+ }
114
+
115
+ export declare const EmojiPicker: ({ value, children, onChange, onRemove, hasIcon, position, popoverProps, locales, }: PropsWithChildren<EmojiPickerProps>) => JSX_2.Element;
116
+
117
+ export declare type EmojiPickerLocales = {
118
+ emojis?: string;
119
+ search?: string;
120
+ searchResults?: string;
121
+ searchNoResults?: string;
122
+ remove?: string;
123
+ emojiCategory?: Record<string, string>;
124
+ };
125
+
126
+ export declare type EmojiPickerProps = {
127
+ value?: string;
128
+ onChange?: (v: string) => void;
129
+ onRemove?: () => void;
130
+ hasIcon?: boolean;
131
+ position?: FloatingPosition;
132
+ popoverProps?: PopoverProps;
133
+ locales?: EmojiPickerLocales;
134
+ };
135
+
136
+ export declare const ErrorPage: ({ error, closeAction }: Props) => JSX_2.Element;
137
+
138
+ export declare const getAccessToken: () => string | null;
139
+
140
+ export declare const getCookie: (name: string) => string | null;
141
+
142
+ export declare const getCurrentUserId: () => number;
143
+
144
+ export declare const illustrationMap: {
145
+ empty: FunctionComponent<SVGProps<SVGSVGElement> & {
146
+ title?: string | undefined;
147
+ titleId?: string | undefined;
148
+ desc?: string | undefined;
149
+ descId?: string | undefined;
150
+ }>;
151
+ noAccess: FunctionComponent<SVGProps<SVGSVGElement> & {
152
+ title?: string | undefined;
153
+ titleId?: string | undefined;
154
+ desc?: string | undefined;
155
+ descId?: string | undefined;
156
+ }>;
157
+ trash: FunctionComponent<SVGProps<SVGSVGElement> & {
158
+ title?: string | undefined;
159
+ titleId?: string | undefined;
160
+ desc?: string | undefined;
161
+ descId?: string | undefined;
162
+ }>;
163
+ noImage: FunctionComponent<SVGProps<SVGSVGElement> & {
164
+ title?: string | undefined;
165
+ titleId?: string | undefined;
166
+ desc?: string | undefined;
167
+ descId?: string | undefined;
168
+ }>;
169
+ noResults: FunctionComponent<SVGProps<SVGSVGElement> & {
170
+ title?: string | undefined;
171
+ titleId?: string | undefined;
172
+ desc?: string | undefined;
173
+ descId?: string | undefined;
174
+ }>;
175
+ noTasks: FunctionComponent<SVGProps<SVGSVGElement> & {
176
+ title?: string | undefined;
177
+ titleId?: string | undefined;
178
+ desc?: string | undefined;
179
+ descId?: string | undefined;
180
+ }>;
181
+ noComments: FunctionComponent<SVGProps<SVGSVGElement> & {
182
+ title?: string | undefined;
183
+ titleId?: string | undefined;
184
+ desc?: string | undefined;
185
+ descId?: string | undefined;
186
+ }>;
187
+ noData: FunctionComponent<SVGProps<SVGSVGElement> & {
188
+ title?: string | undefined;
189
+ titleId?: string | undefined;
190
+ desc?: string | undefined;
191
+ descId?: string | undefined;
192
+ }>;
193
+ addDataR7: FunctionComponent<SVGProps<SVGSVGElement> & {
194
+ title?: string | undefined;
195
+ titleId?: string | undefined;
196
+ desc?: string | undefined;
197
+ descId?: string | undefined;
198
+ }>;
199
+ addDataLayers: FunctionComponent<SVGProps<SVGSVGElement> & {
200
+ title?: string | undefined;
201
+ titleId?: string | undefined;
202
+ desc?: string | undefined;
203
+ descId?: string | undefined;
204
+ }>;
205
+ emptyFolder: FunctionComponent<SVGProps<SVGSVGElement> & {
206
+ title?: string | undefined;
207
+ titleId?: string | undefined;
208
+ desc?: string | undefined;
209
+ descId?: string | undefined;
210
+ }>;
211
+ emptyBoard: FunctionComponent<SVGProps<SVGSVGElement> & {
212
+ title?: string | undefined;
213
+ titleId?: string | undefined;
214
+ desc?: string | undefined;
215
+ descId?: string | undefined;
216
+ }>;
217
+ noTaskResults: FunctionComponent<SVGProps<SVGSVGElement> & {
218
+ title?: string | undefined;
219
+ titleId?: string | undefined;
220
+ desc?: string | undefined;
221
+ descId?: string | undefined;
222
+ }>;
223
+ '404': FunctionComponent<SVGProps<SVGSVGElement> & {
224
+ title?: string | undefined;
225
+ titleId?: string | undefined;
226
+ desc?: string | undefined;
227
+ descId?: string | undefined;
228
+ }>;
229
+ '500': FunctionComponent<SVGProps<SVGSVGElement> & {
230
+ title?: string | undefined;
231
+ titleId?: string | undefined;
232
+ desc?: string | undefined;
233
+ descId?: string | undefined;
234
+ }>;
235
+ };
236
+
237
+ declare type IllustrationType = keyof typeof illustrationMap | string;
238
+
239
+ export declare const ImagePicker: ({ onChange, onRemove, onUpload, uploading, showTabs, children, width, position, readOnly, hasImage, giphyToken, unsplashClientId, galleryCollection, popoverProps, dropZoneProps, locales, }: PropsWithChildren<ImagePickerProps>) => JSX_2.Element;
240
+
241
+ declare type ImagePickerGalleryCollection = {
242
+ title: string;
243
+ path: string;
244
+ id: string;
245
+ url: string;
246
+ items: string[];
247
+ };
248
+
249
+ declare type ImagePickerLocales = {
250
+ gallery?: string;
251
+ link?: string;
252
+ error?: string;
253
+ search?: string;
254
+ upload?: string;
255
+ uploadFile?: string;
256
+ change?: string;
257
+ remove?: string;
258
+ dragOrClickToChoose?: string;
259
+ maxFileSize?: string;
260
+ pasteLink?: string;
261
+ submitLink?: string;
262
+ worksWithAnyImage?: string;
263
+ noImages?: string;
264
+ errors: {
265
+ typeIsNotAllowed?: string;
266
+ shouldNotExceed?: string;
267
+ doNotUploadMoreThanSingleFile?: string;
268
+ invalidLink?: string;
269
+ };
270
+ };
271
+
272
+ export declare type ImagePickerProps = PropsWithChildren<{
273
+ onChange?: (v: string) => void;
274
+ onRemove?: () => void;
275
+ onUpload?: (files: FileWithPath[], setOpened: (state: boolean) => void) => void;
276
+ uploading?: boolean;
277
+ showTabs?: readonly TabType[];
278
+ position?: FloatingPosition;
279
+ width?: number;
280
+ readOnly?: boolean;
281
+ hasImage?: boolean;
282
+ giphyToken?: string;
283
+ unsplashClientId?: string;
284
+ galleryCollection?: ImagePickerGalleryCollection[];
285
+ popoverProps?: PopoverProps;
286
+ dropZoneProps?: Omit<DropzoneProps, 'onDrop'>;
287
+ locales?: ImagePickerLocales;
288
+ }>;
289
+
290
+ export declare const isFeature: () => boolean;
291
+
292
+ declare type Language = {
293
+ value: string;
294
+ label: string;
295
+ };
296
+
297
+ export declare const LanguagePicker: ({ data, value, onChange, }: LanguagePickerProps) => JSX_2.Element;
298
+
299
+ declare interface LanguagePickerProps {
300
+ data: Language[];
301
+ value: string;
302
+ onChange: (value: string) => void;
303
+ }
304
+
305
+ export declare type MenuUser = {
306
+ id: string;
307
+ avatar: string | null;
308
+ email: string | null;
309
+ name: string;
310
+ };
311
+
312
+ export declare const MenuUserDropdown: ({ position, children, user, menuItems, }: MenuUserDropdownProps) => JSX_2.Element;
313
+
314
+ export declare type MenuUserDropdownProps = PropsWithChildren<{
315
+ position?: FloatingPosition;
316
+ menuItems?: ReactNode;
317
+ user: MenuUser;
318
+ }>;
319
+
320
+ export declare type MenuWorkspace = {
321
+ workspaceId: string;
322
+ workspaceName: string;
323
+ workspaceIcon: string;
324
+ };
325
+
326
+ declare type MessageType = string | number | NotificationData;
327
+
328
+ export declare const NavbarResizer: MemoExoticComponent<({ width, onChange, showResizer, }: {
329
+ width?: number;
330
+ onChange?: (v: number) => void;
331
+ showResizer?: boolean;
332
+ }) => JSX_2.Element>;
333
+
334
+ export declare const NoData: React.FC<NoDataProps & StackProps>;
335
+
336
+ declare interface NoDataProps {
337
+ title?: ReactNode;
338
+ titleProps?: TitleProps;
339
+ description?: ReactNode;
340
+ descriptionProps?: TextProps;
341
+ buttons?: PolymorphicComponentProps<'button', ButtonProps>[];
342
+ illustration?: IllustrationType;
343
+ size?: number;
344
+ }
345
+
346
+ export declare const openSearchModal: () => void;
347
+
348
+ export declare const openSubmitModal: (props: OpenConfirmModal & {
349
+ children?: React.ReactNode;
350
+ }) => void;
351
+
352
+ export declare type ProfilePictureType = {
353
+ url: string;
354
+ };
355
+
356
+ declare type Props = {
357
+ error: FetchBaseQueryError | SerializedError | undefined;
358
+ closeAction?: () => void;
359
+ };
360
+
361
+ declare type ReadNotificationsRequest = {
362
+ messageIds: number[];
363
+ markAll: boolean;
364
+ action: 1;
365
+ };
366
+
367
+ declare interface SearchModalState {
368
+ opened: boolean;
369
+ }
370
+
371
+ declare interface SerializedError {
372
+ name?: string;
373
+ message?: string;
374
+ stack?: string;
375
+ code?: string;
376
+ }
377
+
378
+ export declare const setWithoutNavbar: (v: boolean) => void;
379
+
380
+ export declare const showErrorNotification: (props: NotificationData) => void;
381
+
382
+ export declare const showRequestNotifications: <Response, Request extends Promise<Response> = Promise<Response>>(request: Request, options?: {
383
+ notifyId?: string;
384
+ successMsg?: ((res: Response) => MessageType) | MessageType;
385
+ errorMsg?: ((err: any) => MessageType) | MessageType;
386
+ }) => Promise<any>;
387
+
388
+ export declare const showSuccessNotification: (props: NotificationData) => void;
389
+
390
+ declare type TabType = (typeof baseTabsList)[number];
391
+
392
+ export declare const toggleAppMenu: () => void;
393
+
394
+ export declare type ToolDef = {
395
+ id: string;
396
+ name: string;
397
+ icon: ReactNode;
398
+ path: string;
399
+ onClick?: () => void;
400
+ };
401
+
402
+ export declare const useAppContainer: ({ user, workspaceMenu, tools, userMenuItems, notifications, readNotificationsFunc, }: AppContainerDataStore & AppContainerActionsStore) => void;
403
+
404
+ export declare const useAppContainerStore: UseBoundStore<Omit<StoreApi<AppContainerStore>, "persist"> & {
405
+ persist: {
406
+ setOptions: (options: Partial<PersistOptions<AppContainerStore, AppContainerStore>>) => void;
407
+ clearStorage: () => void;
408
+ rehydrate: () => void | Promise<void>;
409
+ hasHydrated: () => boolean;
410
+ onHydrate: (fn: (state: AppContainerStore) => void) => () => void;
411
+ onFinishHydration: (fn: (state: AppContainerStore) => void) => () => void;
412
+ getOptions: () => Partial<PersistOptions<AppContainerStore, AppContainerStore>>;
413
+ };
414
+ }>;
415
+
416
+ export declare const useDateFnsLocale: () => void;
417
+
418
+ export declare const useFormatDistance: () => (timestamp: string) => string;
419
+
420
+ export declare const useHideHeader: () => void;
421
+
422
+ export declare const useIsDarkTheme: () => boolean;
423
+
424
+ export declare const useMenu: () => {
425
+ isMobile: boolean | undefined;
426
+ opened: boolean;
427
+ };
428
+
429
+ export declare const useOAuthErrorParams: () => void;
430
+
431
+ export declare const UserAvatar: default_2.ForwardRefExoticComponent<UserAvatarProps & default_2.RefAttributes<HTMLDivElement>>;
432
+
433
+ declare interface UserAvatarProps extends AvatarProps, Omit<default_2.ComponentPropsWithoutRef<'div'>, keyof AvatarProps> {
434
+ user?: MenuUser | null;
435
+ }
436
+
437
+ declare interface UserAvatarProps_2 extends AvatarProps, Omit<default_2.ComponentPropsWithoutRef<'div'>, keyof AvatarProps> {
438
+ workspace?: MenuWorkspace | null;
439
+ }
440
+
441
+ export declare type UserNotifications = {
442
+ createdAt: string;
443
+ read: boolean;
444
+ link: string;
445
+ description: string;
446
+ id: number;
447
+ type: number;
448
+ projectName: string;
449
+ pageIcon: string;
450
+ pageName: string;
451
+ projectIcon: number;
452
+ taskName?: string;
453
+ pageId?: number;
454
+ taskId?: number;
455
+ };
456
+
457
+ export declare const useSearchModalStore: UseBoundStore<StoreApi<SearchModalState>>;
458
+
459
+ export declare const useSwipeDetect: (callback: (side: 'left' | 'right') => void) => {
460
+ onTouchStart: TouchEventHandler<HTMLDivElement>;
461
+ onTouchMove: TouchEventHandler<HTMLDivElement>;
462
+ onTouchEnd: TouchEventHandler<HTMLDivElement>;
463
+ };
464
+
465
+ export declare const WorkspaceAvatar: default_2.ForwardRefExoticComponent<UserAvatarProps_2 & default_2.RefAttributes<HTMLDivElement>>;
466
+
467
+ export declare const WorkspaceMenu: <W extends MenuWorkspace>({ children, onCreate, onClick, active, items, settingsLink, membersLink, }: WorkspaceMenuProps<W>) => JSX_2.Element;
468
+
469
+ export declare type WorkspaceMenuProps<W extends MenuWorkspace = MenuWorkspace> = PropsWithChildren<{
470
+ onCreate?: () => void;
471
+ onClick?: (w: W) => void;
472
+ items: W[];
473
+ active?: W | null;
474
+ settingsLink?: string;
475
+ membersLink?: string;
476
+ }>;
477
+
478
+ export { }