@cagatayfdn/flora-components 0.0.70 → 0.0.71

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
@@ -210,7 +210,7 @@ export declare type ButtonProps = {
210
210
 
211
211
  declare type CanProps = {
212
212
  permItem: PermItem;
213
- permType: PermType | PermType[];
213
+ permType: PermItem | PermItem[];
214
214
  children: ReactNode;
215
215
  fallback?: JSX_2.Element | null;
216
216
  pk?: string;
@@ -296,8 +296,14 @@ export declare type ColumnsType = {
296
296
 
297
297
  export declare function Config({ config, scrollProps }: ConfigProps): JSX_2.Element;
298
298
 
299
+ declare function Config({ config, scrollProps }: ConfigProps): JSX_2.Element;
300
+
301
+ declare type Config_2 = {
302
+ [key: string]: any;
303
+ };
304
+
299
305
  export declare type ConfigProps = {
300
- config: ProjectAppAddon['config'];
306
+ config: Config_2;
301
307
  scrollProps?: Omit<React_2.ComponentProps<typeof ScrollContainer>, 'children'>;
302
308
  };
303
309
 
@@ -398,6 +404,11 @@ export declare type DatepickerProps = {
398
404
  onClose?: (s: any) => void;
399
405
  } & Omit<InputProps, 'onChange' | 'value'>;
400
406
 
407
+ export declare interface DateRange {
408
+ from: Date | undefined;
409
+ to: Date | undefined;
410
+ }
411
+
401
412
  export { dayjs }
402
413
 
403
414
  declare type Dispatch = React_2.Dispatch<Actiontype>;
@@ -438,7 +449,7 @@ export declare type DropdownListProps = {
438
449
  isDisabled?: boolean;
439
450
  };
440
451
 
441
- declare interface EventProps<T = HTMLElement> {
452
+ export declare interface EventProps<T = HTMLElement> {
442
453
  onClick?: (e: React.MouseEvent<T>) => void;
443
454
  onFocus?: (e: React.FocusEvent<T>) => void;
444
455
  onBlur?: (e: React.FocusEvent<T>) => void;
@@ -454,7 +465,7 @@ declare interface EventProps<T = HTMLElement> {
454
465
  }
455
466
 
456
467
  export declare const FileUpload: React_2.ForwardRefExoticComponent<{
457
- type?: "number" | "email" | "search" | "text" | "password" | "url" | "tel" | "hidden" | undefined;
468
+ type?: "number" | "email" | "search" | "text" | "url" | "tel" | "password" | "hidden" | undefined;
458
469
  id?: string | undefined;
459
470
  info?: string | undefined;
460
471
  accept?: "image/png, image/jpeg" | undefined;
@@ -497,7 +508,7 @@ export declare type FileUploadProps = {
497
508
  onChange?: (event: any) => void;
498
509
  } & Omit<FormElementProps, 'value'> & Omit<EventProps<HTMLInputElement>, 'onMouseUp' | 'onMouseDown' | 'onMouseEnter' | 'onMouseLeave' | 'onChange'>;
499
510
 
500
- declare interface FormElementProps {
511
+ export declare interface FormElementProps {
501
512
  name: string;
502
513
  placeholder?: string;
503
514
  label?: ReactNode;
@@ -515,13 +526,23 @@ export declare enum FormFieldAppearance {
515
526
  MORE_DARK = "more_dark"
516
527
  }
517
528
 
529
+ export declare type FormKeys = FormSubset<formKeys>;
530
+
531
+ declare type formKeys = Record<string, string>;
532
+
533
+ export declare type FormLabels = Labels<formKeys>;
534
+
535
+ export declare type FormSubset<T extends Record<string, any>> = {
536
+ [K in keyof T]?: K extends formKeys ? T[K] : string | boolean | number | OptionItem;
537
+ };
538
+
518
539
  export declare const friendlyDate: (v: any, mode?: "single" | "multiple" | "range" | "time" | "datetime", shortFormat?: boolean) => any;
519
540
 
520
541
  export declare const getAuth: ({ permType, user, permItem }: GetAuthProps) => boolean;
521
542
 
522
543
  declare type GetAuthProps = {
523
544
  permItem: PermItem;
524
- permType: PermType | PermType[];
545
+ permType: PermItem | PermItem[];
525
546
  pk?: string;
526
547
  user: UserEntity | null | undefined;
527
548
  };
@@ -530,10 +551,6 @@ export declare function getCurrentLanguage(): string;
530
551
 
531
552
  export declare function getDatepickerLocale(): "en" | CustomLocale;
532
553
 
533
- declare type HashMap<K extends string | number, V> = {
534
- [key in K]: V
535
- }
536
-
537
554
  export declare const Heading: React_2.FC<HeadingProps>;
538
555
 
539
556
  export declare type HeadingProps = {
@@ -662,7 +679,7 @@ export declare type InfoTextProps = {
662
679
  };
663
680
 
664
681
  export declare const Input: React_2.ForwardRefExoticComponent<{
665
- type?: "number" | "email" | "search" | "text" | "password" | "url" | "tel" | "hidden" | undefined;
682
+ type?: "number" | "email" | "search" | "text" | "url" | "tel" | "password" | "hidden" | undefined;
666
683
  prefix?: ReactNode;
667
684
  suffix?: ReactNode;
668
685
  suffixClickable?: boolean | undefined;
@@ -708,6 +725,10 @@ export declare enum isActiveColor {
708
725
  active = "#3f4b5c"
709
726
  }
710
727
 
728
+ export declare interface KeyValueParams {
729
+ [key: string]: string | string[] | number | number[] | undefined | Record<string, unknown>;
730
+ }
731
+
711
732
  export declare const Label: (props: LabelProps) => JSX.Element;
712
733
 
713
734
  export declare type LabelProps = {
@@ -717,6 +738,10 @@ export declare type LabelProps = {
717
738
  appearance?: FormFieldAppearance;
718
739
  };
719
740
 
741
+ export declare type Labels<FormKeys> = {
742
+ [K in keyof FormKeys]?: TFunctionResult;
743
+ };
744
+
720
745
  export declare type LayoutProps = {
721
746
  children: ReactNode;
722
747
  breadcrumbs: any[];
@@ -755,10 +780,6 @@ export declare type LoadingProps = {
755
780
  layer?: boolean;
756
781
  };
757
782
 
758
- declare type MappedObjectPermission = HashMap<PermissionsType, number[]>;
759
-
760
- declare type MappedObjectPermission_2 = HashMap<PermissionsType_2, number[]>
761
-
762
783
  export declare const MenuItem: ({ icon, title, to, visibleTooltip, }: MenuItemProps) => JSX.Element;
763
784
 
764
785
  export declare type MenuItemProps = {
@@ -831,7 +852,7 @@ export declare type NotificationProps = {
831
852
  closeTime?: number;
832
853
  };
833
854
 
834
- declare interface OptionItem {
855
+ export declare interface OptionItem {
835
856
  value: string | number;
836
857
  label: string;
837
858
  id?: string;
@@ -873,6 +894,10 @@ export declare type PanelProps = {
873
894
  bodyClass?: string;
874
895
  };
875
896
 
897
+ export declare type PayloadWithFormKeys<T> = T & {
898
+ [K in keyof formKeys]?: string;
899
+ };
900
+
876
901
  export declare const PermaLink: React_2.FC<PermalinkProps>;
877
902
 
878
903
  export declare type PermalinkProps = {
@@ -891,151 +916,13 @@ export declare const PermFallBack: () => JSX_2.Element;
891
916
 
892
917
  export declare function Permission(props: Props_3): JSX_2.Element;
893
918
 
894
- declare interface Permissions_2 {
895
- default: boolean;
896
- depends_on: PermissionsType[] | null;
897
- description: string;
898
- name: string;
899
- slug: PermItem;
900
- }
901
-
902
- declare interface Permissions_3 {
903
- default: boolean
904
- depends_on: PermissionsType_2[] | null
905
- description: string
906
- name: string
907
- slug: PermItem_2
908
- }
909
-
910
- declare enum PermissionsSlug {
911
- Read = "read",
912
- Write = "write",
913
- Edit = "edit",
914
- Delete = "delete",
915
- Build = "build",
916
- Deploy = "deploy",
917
- EditPermissions = "edit_permissions",
918
- ViewAddonInfo = "view_addon_info",
919
- SetStableVersion = "set_stable_version",
920
- AttachCertificate = "attach_certificate",
921
- ManageEnvironments = "manage_environments",
922
- ManageSecretEnvironments = "manage_secret_environments",
923
- Monitor = "monitor",
924
- Resend = "resend",
925
- ExportZonefile = "export_zonefile"
926
- }
927
-
928
- declare enum PermissionsSlug_2 {
929
- Read = 'read',
930
- Write = 'write',
931
- Edit = 'edit',
932
- Delete = 'delete',
933
- Build = 'build',
934
- Deploy = 'deploy',
935
- EditPermissions = 'edit_permissions',
936
- ViewAddonInfo = 'view_addon_info',
937
- SetStableVersion = 'set_stable_version',
938
- AttachCertificate = 'attach_certificate',
939
- ManageEnvironments = 'manage_environments',
940
- ManageSecretEnvironments = 'manage_secret_environments',
941
- Monitor = 'monitor',
942
- Resend = 'resend',
943
- ExportZonefile = 'export_zonefile',
944
- }
945
-
946
- declare type PermissionsType = `${PermItem}::${PermissionsSlug}`;
947
-
948
- declare type PermissionsType_2 = `${PermItem_2}::${PermissionsSlug_2}`
949
-
950
- declare interface PermissionTree {
951
- users: PermissionTreeItem;
952
- roles: PermissionTreeItem;
953
- public_key: PermissionTreeItem;
954
- apps: PermissionTreeItem;
955
- app_versions: PermissionTreeItem;
956
- quality_assurance_report: PermissionTreeItem;
957
- addon_types: PermissionTreeItem;
958
- related_app: PermissionTreeItem;
959
- public_apps: PermissionTreeItem;
960
- public_services: PermissionTreeItem;
961
- projects: PermissionTreeItem;
962
- project_apps: PermissionTreeItem;
963
- export_project_app_log: PermissionTreeItem;
964
- project_app_deployments: PermissionTreeItem;
965
- related_project_app: PermissionTreeItem;
966
- project_app_email: PermissionTreeItem;
967
- addons: PermissionTreeItem;
968
- accounts: PermissionTreeItem;
969
- domain: PermissionTreeItem;
970
- certificate: PermissionTreeItem;
971
- email: PermissionTreeItem;
972
- mail_identity_domain: PermissionTreeItem;
973
- remote_group: PermissionTreeItem;
974
- remote_group_user: PermissionTreeItem;
975
- remote_group_application: PermissionTreeItem;
976
- app_bundle: PermissionTreeItem;
977
- app_bundle_app: PermissionTreeItem;
978
- app_bundle_base_app: PermissionTreeItem;
979
- monitoring: PermissionTreeItem;
980
- kubernetes: PermissionTreeItem;
981
- app_user: PermissionTreeItem;
982
- }
983
-
984
- declare interface PermissionTree_2 {
985
- users: PermissionTreeItem_2
986
- roles: PermissionTreeItem_2
987
- public_key: PermissionTreeItem_2
988
- apps: PermissionTreeItem_2
989
- app_versions: PermissionTreeItem_2
990
- quality_assurance_report: PermissionTreeItem_2
991
- addon_types: PermissionTreeItem_2
992
- related_app: PermissionTreeItem_2
993
- public_apps: PermissionTreeItem_2
994
- public_services: PermissionTreeItem_2
995
- projects: PermissionTreeItem_2
996
- project_apps: PermissionTreeItem_2
997
- export_project_app_log: PermissionTreeItem_2
998
- project_app_deployments: PermissionTreeItem_2
999
- related_project_app: PermissionTreeItem_2
1000
- project_app_email: PermissionTreeItem_2
1001
- addons: PermissionTreeItem_2
1002
- accounts: PermissionTreeItem_2
1003
- domain: PermissionTreeItem_2
1004
- certificate: PermissionTreeItem_2
1005
- email: PermissionTreeItem_2
1006
- mail_identity_domain: PermissionTreeItem_2
1007
- remote_group: PermissionTreeItem_2
1008
- remote_group_user: PermissionTreeItem_2
1009
- remote_group_application: PermissionTreeItem_2
1010
- app_bundle: PermissionTreeItem_2
1011
- app_bundle_app: PermissionTreeItem_2
1012
- app_bundle_base_app: PermissionTreeItem_2
1013
- monitoring: PermissionTreeItem_2
1014
- kubernetes: PermissionTreeItem_2
1015
- app_user: PermissionTreeItem_2
1016
- }
1017
-
1018
- declare interface PermissionTreeItem {
1019
- depends_on: PermissionsType[] | null;
1020
- description: string;
1021
- name: string;
1022
- permissions: Permissions_2[];
1023
- slug: PermItem;
1024
- }
1025
-
1026
- declare interface PermissionTreeItem_2 {
1027
- depends_on: PermissionsType_2[] | null
1028
- description: string
1029
- name: string
1030
- permissions: Permissions_3[]
1031
- slug: PermItem_2
1032
- }
1033
-
1034
- declare type PermItem = keyof PermissionTree;
1035
-
1036
- declare type PermItem_2 = keyof PermissionTree_2
919
+ declare type PermItem = {
920
+ [key: string]: any;
921
+ };
1037
922
 
1038
- declare type PermType = `${PermissionsSlug}`;
923
+ declare type PermItem_2 = {
924
+ [key: string]: any;
925
+ };
1039
926
 
1040
927
  declare function Pie({ data, options }: PieProps): JSX_2.Element;
1041
928
 
@@ -1063,45 +950,6 @@ export declare type PreviewModalProps = {
1063
950
  onDelete: (imagePaths: string[], selectedImage: string) => void;
1064
951
  };
1065
952
 
1066
- declare interface ProjectAppAddon {
1067
- id: number
1068
- addon_type: {
1069
- pk: number
1070
- name: string
1071
- slug: ProjectAppAddonTypeSlugs
1072
- }
1073
- secret_config: any
1074
- addon_type_relation: {
1075
- id: number
1076
- app: number
1077
- addon_type: number
1078
- scope: string
1079
- used_as: string
1080
- options: {
1081
- instance_type: string
1082
- instance_count: number
1083
- }
1084
- }
1085
- config: {
1086
- HOST: string
1087
- ORGANIZATION_NAME?: string
1088
- SENTRY_URL?: any
1089
- }
1090
- is_active: boolean
1091
- cluster: number
1092
- status: string
1093
- update_date: string
1094
- }
1095
-
1096
- declare enum ProjectAppAddonTypeSlugs {
1097
- SENTRY = 'sentry',
1098
- POSTGRESQL = 'postgresql',
1099
- REDIS = 'redis',
1100
- ELASTICSEARCH = 'elasticsearch',
1101
- METRIC = 'metric',
1102
- MAIL = 'mail',
1103
- }
1104
-
1105
953
  declare type Props = Partial<SelectRenderer<OptionProps>> & {
1106
954
  text?: string;
1107
955
  };
@@ -1136,7 +984,7 @@ export declare type RadioListProps = {
1136
984
  setContext?: (v: OptionItem) => void;
1137
985
  } & Pick<EventProps<HTMLInputElement>, 'onChange'>;
1138
986
 
1139
- declare interface RadioOptionItem extends OptionItem {
987
+ export declare interface RadioOptionItem extends OptionItem {
1140
988
  name?: string;
1141
989
  isDisabled?: boolean;
1142
990
  suffixBtn?: ReactNode;
@@ -1168,24 +1016,6 @@ export declare type ResultErrorProps = {
1168
1016
  onClick?: () => void;
1169
1017
  };
1170
1018
 
1171
- declare interface Role {
1172
- pk: number;
1173
- name: string;
1174
- account: number;
1175
- description: string | null;
1176
- permission_tree: PermissionTree;
1177
- permissions: PermissionsType[];
1178
- }
1179
-
1180
- declare interface Role_2 {
1181
- pk: number
1182
- name: string
1183
- account: number
1184
- description: string | null
1185
- permission_tree: PermissionTree_2
1186
- permissions: PermissionsType_2[]
1187
- }
1188
-
1189
1019
  export declare const Row: ({ children, className }: RowProps) => JSX.Element;
1190
1020
 
1191
1021
  export declare type RowProps = {
@@ -1247,8 +1077,8 @@ export declare const Sidebar: ({ collapsed, items, className, isActiveSubMenu, }
1247
1077
  declare type SidebarChildItemType = {
1248
1078
  title: string;
1249
1079
  to?: string;
1250
- permItem?: PermItem;
1251
- permType?: PermType | PermType[];
1080
+ permItem?: PermItem_2;
1081
+ permType?: PermItem_2 | PermItem_2[];
1252
1082
  onClick?: () => void;
1253
1083
  };
1254
1084
 
@@ -1464,6 +1294,12 @@ export declare type TooltipProps = {
1464
1294
  onClick?: () => void;
1465
1295
  };
1466
1296
 
1297
+ export declare type ToOption<T, K extends keyof T, U extends keyof T> = {
1298
+ label: K extends keyof T ? T[K] : never;
1299
+ value: U extends keyof T ? T[U] : never;
1300
+ rest: T;
1301
+ };
1302
+
1467
1303
  export declare const TypographyText: (props: TypographyTextProps) => JSX.Element;
1468
1304
 
1469
1305
  export declare type TypographyTextProps = {
@@ -1496,37 +1332,13 @@ declare type UseNiceModal = [() => void, () => void, string];
1496
1332
 
1497
1333
  export declare function useNiceModal(modalId?: string): UseNiceModal;
1498
1334
 
1499
- declare interface UserEntity {
1500
- pk: number;
1501
- email?: string;
1502
- first_name?: string;
1503
- last_name?: string;
1504
- language?: string;
1505
- account?: number;
1506
- last_login?: string | null;
1507
- permission_tree?: PermissionTree;
1508
- is_active?: boolean;
1509
- avatar?: string;
1510
- role?: Role;
1511
- object_permissions: MappedObjectPermission;
1512
- permissions: PermissionsType[];
1513
- }
1335
+ declare type UserEntity = {
1336
+ [key: string]: any;
1337
+ };
1514
1338
 
1515
- declare interface UserEntity_2 {
1516
- pk: number
1517
- email?: string
1518
- first_name?: string
1519
- last_name?: string
1520
- language?: string
1521
- account?: number
1522
- last_login?: string | null
1523
- permission_tree?: PermissionTree_2
1524
- is_active?: boolean
1525
- avatar?: string
1526
- role?: Role_2
1527
- object_permissions: MappedObjectPermission_2
1528
- permissions: PermissionsType_2[]
1529
- }
1339
+ declare type UserEntity_2 = {
1340
+ [key: string]: any;
1341
+ };
1530
1342
 
1531
1343
  export declare const ValidationError: ({ message }: ValidationErrorProps) => JSX.Element;
1532
1344