@cagatayfdn/flora-components 0.0.3 → 0.0.5

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
@@ -1,12 +1,42 @@
1
1
  /// <reference types="react" />
2
2
 
3
+ import { AxiosError } from 'axios';
3
4
  import { CustomLocale } from 'flatpickr/dist/types/locale';
5
+ import { Dispatch as Dispatch_2 } from 'react';
6
+ import { FC } from 'react';
4
7
  import i18n from 'i18next';
8
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
9
  import { LinkProps } from 'react-router-dom';
6
10
  import { MouseEvent as MouseEvent_2 } from 'react';
11
+ import NiceModal from '@ebay/nice-modal-react';
12
+ import { NiceModalHocProps } from '@ebay/nice-modal-react';
13
+ import { default as React_2 } from 'react';
7
14
  import { ReactNode } from 'react';
15
+ import { SetStateAction } from 'react';
8
16
  import { TFunction } from 'i18next';
9
17
 
18
+ declare type Actiontype = {
19
+ type: 'login_pending';
20
+ } | {
21
+ type: 'active_user_success';
22
+ payload: UserEntity;
23
+ } | {
24
+ type: 'login_failure';
25
+ payload: any;
26
+ } | {
27
+ type: 'active_user_failure';
28
+ payload: any;
29
+ } | {
30
+ type: 'register_pending';
31
+ } | {
32
+ type: 'register_failure';
33
+ payload: any;
34
+ } | {
35
+ type: 'no_active_user';
36
+ } | {
37
+ type: 'signout';
38
+ };
39
+
10
40
  export declare enum AppAndServicesStatusApperenceType {
11
41
  ADDONS_INITIALIZING = "addons_initializing",
12
42
  ADDONS_ADDONS_INITILIZATION_FAILED = "addons_initialization_failed",
@@ -74,6 +104,14 @@ export declare enum AppTypeEnum {
74
104
  APPLICATION = "application"
75
105
  }
76
106
 
107
+ declare type AuthContextType = [state: State & {
108
+ token?: string;
109
+ }, dispatch: Dispatch];
110
+
111
+ export declare const AuthProvider: (props: {
112
+ children: React_2.ReactNode;
113
+ }) => JSX_2.Element;
114
+
77
115
  export declare const Button: ({ children, size, isLoading, isDisabled, isBlock, noBorder, isSolid, type, className, prefixIcon, appearance, onClick, }: ButtonProps) => JSX.Element;
78
116
 
79
117
  declare type ButtonProps = {
@@ -106,11 +144,28 @@ declare type ColumnProps = {
106
144
  className?: string;
107
145
  };
108
146
 
147
+ export declare const Confirm: FC<ConfirmProps & NiceModalHocProps>;
148
+
149
+ declare type ConfirmProps = {
150
+ id: string;
151
+ onClose?: () => void;
152
+ okBtnCallback: () => void;
153
+ description: ReactNode;
154
+ descriptionClassName?: string;
155
+ isLoading?: boolean;
156
+ appearence?: ThemeAppearance;
157
+ title?: string;
158
+ okBtnText?: string;
159
+ cancelBtnText?: string;
160
+ };
161
+
109
162
  export declare enum CopyTextStatusEnum {
110
163
  SUCCESS = "success",
111
164
  ERROR = "error"
112
165
  }
113
166
 
167
+ declare type Dispatch = React_2.Dispatch<Actiontype>;
168
+
114
169
  export declare enum DividerAppearance {
115
170
  LIGHT = "light",
116
171
  GREY = "grey"
@@ -141,6 +196,10 @@ export declare function getCurrentLanguage(): string;
141
196
 
142
197
  export declare function getDatepickerLocale(): "en" | CustomLocale;
143
198
 
199
+ declare type HashMap<K extends string | number, V> = {
200
+ [key in K]: V
201
+ }
202
+
144
203
  export { i18n }
145
204
 
146
205
  export declare const Icon: (props: IconProps) => JSX.Element;
@@ -228,11 +287,33 @@ declare type LoadingProps = {
228
287
  layer?: boolean;
229
288
  };
230
289
 
290
+ declare type MappedObjectPermission = HashMap<PermissionsType, number[]>
291
+
292
+ export declare const Modal: (props: ModalProps) => JSX.Element;
293
+
231
294
  export declare enum ModalAppearanceType {
232
295
  DEFAULT = "default",
233
296
  SUCCESS = "success"
234
297
  }
235
298
 
299
+ declare type ModalEvents = {
300
+ onClose: () => void;
301
+ };
302
+
303
+ declare type ModalProps = {
304
+ children: ReactNode;
305
+ visible?: boolean;
306
+ title?: string;
307
+ header?: ReactNode;
308
+ headerClass?: any;
309
+ descriptionClass?: any;
310
+ description?: string;
311
+ className?: string;
312
+ appearance?: ThemeAppearance;
313
+ } & ModalEvents;
314
+
315
+ export { NiceModal }
316
+
236
317
  export declare enum NotificationAppearanceType {
237
318
  INFO = "info",
238
319
  SUCCESS = "success",
@@ -241,6 +322,78 @@ export declare enum NotificationAppearanceType {
241
322
  LOADING = "loading"
242
323
  }
243
324
 
325
+ declare interface Permissions_2 {
326
+ default: boolean
327
+ depends_on: PermissionsType[] | null
328
+ description: string
329
+ name: string
330
+ slug: PermItem
331
+ }
332
+
333
+ declare enum PermissionsSlug {
334
+ Read = 'read',
335
+ Write = 'write',
336
+ Edit = 'edit',
337
+ Delete = 'delete',
338
+ Build = 'build',
339
+ Deploy = 'deploy',
340
+ EditPermissions = 'edit_permissions',
341
+ ViewAddonInfo = 'view_addon_info',
342
+ SetStableVersion = 'set_stable_version',
343
+ AttachCertificate = 'attach_certificate',
344
+ ManageEnvironments = 'manage_environments',
345
+ ManageSecretEnvironments = 'manage_secret_environments',
346
+ Monitor = 'monitor',
347
+ Resend = 'resend',
348
+ ExportZonefile = 'export_zonefile',
349
+ }
350
+
351
+ declare type PermissionsType = `${PermItem}::${PermissionsSlug}`
352
+
353
+ declare interface PermissionTree {
354
+ users: PermissionTreeItem
355
+ roles: PermissionTreeItem
356
+ public_key: PermissionTreeItem
357
+ apps: PermissionTreeItem
358
+ app_versions: PermissionTreeItem
359
+ quality_assurance_report: PermissionTreeItem
360
+ addon_types: PermissionTreeItem
361
+ related_app: PermissionTreeItem
362
+ public_apps: PermissionTreeItem
363
+ public_services: PermissionTreeItem
364
+ projects: PermissionTreeItem
365
+ project_apps: PermissionTreeItem
366
+ export_project_app_log: PermissionTreeItem
367
+ project_app_deployments: PermissionTreeItem
368
+ related_project_app: PermissionTreeItem
369
+ project_app_email: PermissionTreeItem
370
+ addons: PermissionTreeItem
371
+ accounts: PermissionTreeItem
372
+ domain: PermissionTreeItem
373
+ certificate: PermissionTreeItem
374
+ email: PermissionTreeItem
375
+ mail_identity_domain: PermissionTreeItem
376
+ remote_group: PermissionTreeItem
377
+ remote_group_user: PermissionTreeItem
378
+ remote_group_application: PermissionTreeItem
379
+ app_bundle: PermissionTreeItem
380
+ app_bundle_app: PermissionTreeItem
381
+ app_bundle_base_app: PermissionTreeItem
382
+ monitoring: PermissionTreeItem
383
+ kubernetes: PermissionTreeItem
384
+ app_user: PermissionTreeItem
385
+ }
386
+
387
+ declare interface PermissionTreeItem {
388
+ depends_on: PermissionsType[] | null
389
+ description: string
390
+ name: string
391
+ permissions: Permissions_2[]
392
+ slug: PermItem
393
+ }
394
+
395
+ declare type PermItem = keyof PermissionTree
396
+
244
397
  export declare enum PodStatusEnum {
245
398
  TERMINATED = "Terminated",
246
399
  TERMINATING = "Terminating",
@@ -258,6 +411,15 @@ export declare enum ReportStatus {
258
411
  SUCCESS = "completed"
259
412
  }
260
413
 
414
+ declare interface Role {
415
+ pk: number
416
+ name: string
417
+ account: number
418
+ description: string | null
419
+ permission_tree: PermissionTree
420
+ permissions: PermissionsType[]
421
+ }
422
+
261
423
  export declare const Row: ({ children, className }: RowProps) => JSX.Element;
262
424
 
263
425
  declare type RowProps = {
@@ -273,6 +435,14 @@ export declare enum Size {
273
435
  XL = "xlarge"
274
436
  }
275
437
 
438
+ declare interface State {
439
+ user: UserEntity | null;
440
+ status: Status;
441
+ error: AxiosError | null;
442
+ }
443
+
444
+ declare type Status = 'idle' | 'pending' | 'success' | 'rejected';
445
+
276
446
  export declare enum StatusEnum {
277
447
  addons_initializing = "initializing",
278
448
  addons_initialization_failed = "failed",
@@ -322,4 +492,34 @@ export declare enum ThemeAppearance {
322
492
  DARK_BLUE = "dark_blue"
323
493
  }
324
494
 
495
+ export declare const useAuth: () => AuthContextType;
496
+
497
+ export declare function useDisclosure(isOpenInit?: boolean): {
498
+ isOpen: boolean;
499
+ setIsOpen: Dispatch_2<SetStateAction<boolean>>;
500
+ onOpen: () => void;
501
+ onClose: () => void;
502
+ onToggle: () => void;
503
+ };
504
+
505
+ declare type UseNiceModal = [() => void, () => void, string];
506
+
507
+ export declare function useNiceModal(modalId?: string): UseNiceModal;
508
+
509
+ declare interface UserEntity {
510
+ pk: number
511
+ email?: string
512
+ first_name?: string
513
+ last_name?: string
514
+ language?: string
515
+ account?: number
516
+ last_login?: string | null
517
+ permission_tree?: PermissionTree
518
+ is_active?: boolean
519
+ avatar?: string
520
+ role?: Role
521
+ object_permissions: MappedObjectPermission
522
+ permissions: PermissionsType[]
523
+ }
524
+
325
525
  export { }