@devtron-labs/devtron-fe-common-lib 0.0.41-beta-6 → 0.0.41-beta-8

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.
Files changed (67) hide show
  1. package/dist/Common/DebouncedSearch/DebouncedSearch.d.ts +1 -1
  2. package/dist/Common/DebouncedSearch/Types.d.ts +1 -0
  3. package/dist/Common/Dialogs/Types.d.ts +1 -0
  4. package/dist/Common/Helper.d.ts +0 -7
  5. package/dist/Common/Types.d.ts +136 -0
  6. package/dist/Common/index.d.ts +0 -1
  7. package/dist/index.js +177 -2893
  8. package/package.json +1 -4
  9. package/src/Common/DebouncedSearch/DebouncedSearch.tsx +3 -2
  10. package/src/Common/DebouncedSearch/Types.ts +1 -0
  11. package/src/Common/Dialogs/DeleteDialog.tsx +18 -2
  12. package/src/Common/Dialogs/Types.ts +1 -0
  13. package/src/Common/Helper.tsx +0 -17
  14. package/src/Common/Types.ts +149 -0
  15. package/src/Common/index.ts +0 -1
  16. package/dist/Common/RJSF/Form.d.ts +0 -4
  17. package/dist/Common/RJSF/common/FieldRow.d.ts +0 -6
  18. package/dist/Common/RJSF/common/types.d.ts +0 -8
  19. package/dist/Common/RJSF/config.d.ts +0 -4
  20. package/dist/Common/RJSF/constants.d.ts +0 -7
  21. package/dist/Common/RJSF/index.d.ts +0 -3
  22. package/dist/Common/RJSF/templates/ArrayFieldItemTemplate.d.ts +0 -3
  23. package/dist/Common/RJSF/templates/ArrayFieldTemplate.d.ts +0 -3
  24. package/dist/Common/RJSF/templates/BaseInput.d.ts +0 -3
  25. package/dist/Common/RJSF/templates/ButtonTemplates/AddButton.d.ts +0 -3
  26. package/dist/Common/RJSF/templates/ButtonTemplates/RemoveButton.d.ts +0 -3
  27. package/dist/Common/RJSF/templates/ButtonTemplates/SubmitButton.d.ts +0 -3
  28. package/dist/Common/RJSF/templates/ButtonTemplates/index.d.ts +0 -3
  29. package/dist/Common/RJSF/templates/Description.d.ts +0 -3
  30. package/dist/Common/RJSF/templates/Field.d.ts +0 -3
  31. package/dist/Common/RJSF/templates/FieldErrorTemplate.d.ts +0 -3
  32. package/dist/Common/RJSF/templates/ObjectFieldTemplate.d.ts +0 -3
  33. package/dist/Common/RJSF/templates/TitleField.d.ts +0 -3
  34. package/dist/Common/RJSF/templates/WrapIfAdditionalTemplate.d.ts +0 -3
  35. package/dist/Common/RJSF/templates/index.d.ts +0 -10
  36. package/dist/Common/RJSF/types.d.ts +0 -3
  37. package/dist/Common/RJSF/utils.d.ts +0 -25
  38. package/dist/Common/RJSF/widgets/Checkbox.d.ts +0 -3
  39. package/dist/Common/RJSF/widgets/Select.d.ts +0 -3
  40. package/dist/Common/RJSF/widgets/index.d.ts +0 -2
  41. package/src/Assets/Icon/ic-chevron-down.svg +0 -5
  42. package/src/Common/RJSF/Form.tsx +0 -29
  43. package/src/Common/RJSF/common/FieldRow.tsx +0 -35
  44. package/src/Common/RJSF/common/types.ts +0 -9
  45. package/src/Common/RJSF/config.ts +0 -37
  46. package/src/Common/RJSF/constants.ts +0 -10
  47. package/src/Common/RJSF/index.ts +0 -3
  48. package/src/Common/RJSF/rjsfForm.scss +0 -18
  49. package/src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx +0 -31
  50. package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +0 -78
  51. package/src/Common/RJSF/templates/BaseInput.tsx +0 -16
  52. package/src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx +0 -18
  53. package/src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx +0 -10
  54. package/src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx +0 -18
  55. package/src/Common/RJSF/templates/ButtonTemplates/index.ts +0 -3
  56. package/src/Common/RJSF/templates/Description.tsx +0 -12
  57. package/src/Common/RJSF/templates/Field.tsx +0 -30
  58. package/src/Common/RJSF/templates/FieldErrorTemplate.tsx +0 -25
  59. package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +0 -105
  60. package/src/Common/RJSF/templates/TitleField.tsx +0 -9
  61. package/src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx +0 -51
  62. package/src/Common/RJSF/templates/index.ts +0 -10
  63. package/src/Common/RJSF/types.ts +0 -4
  64. package/src/Common/RJSF/utils.ts +0 -110
  65. package/src/Common/RJSF/widgets/Checkbox.tsx +0 -44
  66. package/src/Common/RJSF/widgets/Select.tsx +0 -77
  67. package/src/Common/RJSF/widgets/index.ts +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.41-beta-6",
3
+ "version": "0.0.41-beta-8",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -41,9 +41,6 @@
41
41
  "@sentry/browser": "^7.31.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "@rjsf/core": "^5.13.3",
45
- "@rjsf/utils": "^5.13.3",
46
- "@rjsf/validator-ajv8": "^5.13.3",
47
44
  "react": "^17.0.2",
48
45
  "react-dom": "^17.0.2",
49
46
  "react-router": "^5.3.0",
@@ -26,6 +26,7 @@ export default function DebouncedSearch({
26
26
  debounceTimeout = 500,
27
27
  clearSearch,
28
28
  showClearIcon = true,
29
+ autoFocus = true,
29
30
  }: DebouncedSearchProps) {
30
31
  const [searchText, setSearchText] = useState<string>('')
31
32
 
@@ -41,7 +42,7 @@ export default function DebouncedSearch({
41
42
  setSearchText('')
42
43
  }
43
44
 
44
- useDebouncedEffect(() => onSearch(searchText), debounceTimeout, [searchText, onSearch])
45
+ useDebouncedEffect(() => onSearch(searchText), debounceTimeout, [searchText])
45
46
 
46
47
  return (
47
48
  <div className={containerClass}>
@@ -53,7 +54,7 @@ export default function DebouncedSearch({
53
54
  placeholder={placeholder ?? 'Search'}
54
55
  value={searchText}
55
56
  onChange={handleSearchTextChange}
56
- autoFocus
57
+ autoFocus={autoFocus}
57
58
  data-testid="debounced-search"
58
59
  />
59
60
 
@@ -9,4 +9,5 @@ export interface DebouncedSearchProps {
9
9
  debounceTimeout?: number
10
10
  clearSearch?: boolean
11
11
  showClearIcon?: boolean
12
+ autoFocus?: boolean
12
13
  }
@@ -5,6 +5,22 @@ import ConfirmationDialog from './ConfirmationDialog'
5
5
  import { DeleteDialogProps } from './Types'
6
6
 
7
7
  export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = function (props) {
8
+ const handleDelete = (e: React.MouseEvent) => {
9
+ if (props.shouldStopPropagation) {
10
+ e.stopPropagation()
11
+ }
12
+
13
+ props.delete()
14
+ }
15
+
16
+ const handleModalClose = (e: React.MouseEvent) => {
17
+ if (props.shouldStopPropagation) {
18
+ e.stopPropagation()
19
+ }
20
+
21
+ props.closeDelete()
22
+ }
23
+
8
24
  return (
9
25
  <ConfirmationDialog className="confirmation-dialog__body--w-400">
10
26
  <ConfirmationDialog.Icon src={warn} />
@@ -19,7 +35,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
19
35
  <button
20
36
  type="button"
21
37
  className="cta cancel cta-cd-delete-modal ml-16"
22
- onClick={props.closeDelete}
38
+ onClick={handleModalClose}
23
39
  disabled={props.apiCallInProgress}
24
40
  data-testid="dialog-cancel"
25
41
  >
@@ -28,7 +44,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
28
44
  <button
29
45
  type="button"
30
46
  className="cta delete cta-cd-delete-modal ml-16"
31
- onClick={() => props.delete()}
47
+ onClick={handleDelete}
32
48
  disabled={props.apiCallInProgress}
33
49
  data-testid="dialog-delete"
34
50
  >
@@ -10,6 +10,7 @@ export interface DeleteDialogProps {
10
10
  apiCallInProgress?: boolean
11
11
  dataTestId?: string
12
12
  buttonPrimaryText?: string
13
+ shouldStopPropagation?: boolean
13
14
  }
14
15
 
15
16
  export interface ForceDeleteDialogType {
@@ -495,20 +495,3 @@ export const processDeployedTime = (lastDeployed, isArgoInstalled) => {
495
495
  return isArgoInstalled ? '' : 'Not deployed'
496
496
  }
497
497
  }
498
-
499
- /**
500
- * Appends search parameters to the url as a query string
501
- *
502
- * @param url URL to which the search params needs to be added
503
- * @param params Object for the search parameters
504
- */
505
- export const getUrlWithSearchParams = (url: string, params: Record<string | number, any>) => {
506
- const searchParams = new URLSearchParams()
507
- Object.keys(params).forEach((key) => {
508
- if (params[key]) {
509
- searchParams.append(key, params[key])
510
- }
511
- })
512
- const queryString = searchParams.toString()
513
- return url + (queryString ? `?${queryString}` : '')
514
- }
@@ -1,6 +1,8 @@
1
1
  import React, { ReactNode, CSSProperties } from 'react'
2
2
  import { Placement } from 'tippy.js'
3
3
  import { ImageComment, ReleaseTag } from './ImageTags.Types'
4
+ import { DockerConfigOverrideType, TaskErrorObj } from '.'
5
+
4
6
  export interface ResponseType {
5
7
  code: number
6
8
  status: string
@@ -315,6 +317,7 @@ export interface CommonNodeAttr {
315
317
  colorCode?: string
316
318
  isExternalCI?: boolean
317
319
  isLinkedCI?: boolean
320
+ isLinkedCD?: boolean
318
321
  isJobCI?: boolean // used for Job type CI in Devtron Apps
319
322
  environmentName?: string //used for CDs
320
323
  environmentId?: number
@@ -474,3 +477,149 @@ export interface AsyncState<T> {
474
477
  export interface AsyncOptions {
475
478
  resetOnChange: boolean
476
479
  }
480
+
481
+ export interface AppEnvironment {
482
+ environmentId: number
483
+ environmentName: string
484
+ appMetrics: boolean
485
+ infraMetrics: boolean
486
+ prod: boolean
487
+ chartRefId?: number
488
+ lastDeployed?: string
489
+ lastDeployedBy?: string
490
+ lastDeployedImage?: string
491
+ appStatus?: string
492
+ deploymentAppDeleteRequest?: boolean
493
+ isVirtualEnvironment?: boolean
494
+ isProtected?: boolean
495
+ pipelineId?: number
496
+ latestCdWorkflowRunnerId?: number
497
+ }
498
+
499
+ export interface Strategy {
500
+ deploymentTemplate: string
501
+ config: any
502
+ default?: boolean
503
+ }
504
+
505
+ export interface CDStage {
506
+ status: string
507
+ name: string
508
+ triggerType: 'AUTOMATIC' | 'MANUAL'
509
+ config: string
510
+ }
511
+
512
+ export interface CDStageConfigMapSecretNames {
513
+ configMaps: any[]
514
+ secrets: any[]
515
+ }
516
+
517
+ export interface PrePostDeployStageType {
518
+ isValid: boolean
519
+ steps: TaskErrorObj[]
520
+ triggerType: string
521
+ name: string
522
+ status: string
523
+ }
524
+
525
+ export interface CdPipeline {
526
+ id: number
527
+ environmentId: number
528
+ environmentName?: string
529
+ description?: string
530
+ ciPipelineId: number
531
+ triggerType: 'AUTOMATIC' | 'MANUAL'
532
+ name: string
533
+ strategies?: Strategy[]
534
+ namespace?: string
535
+ appWorkflowId?: number
536
+ deploymentTemplate?: string
537
+ preStage?: CDStage
538
+ postStage?: CDStage
539
+ preStageConfigMapSecretNames?: CDStageConfigMapSecretNames
540
+ postStageConfigMapSecretNames?: CDStageConfigMapSecretNames
541
+ runPreStageInEnv?: boolean
542
+ runPostStageInEnv?: boolean
543
+ isClusterCdActive?: boolean
544
+ parentPipelineId?: number
545
+ parentPipelineType?: string
546
+ deploymentAppDeleteRequest?: boolean
547
+ deploymentAppCreated?: boolean
548
+ userApprovalConfig?: UserApprovalConfigType
549
+ isVirtualEnvironment?: boolean
550
+ deploymentAppType: DeploymentAppTypes
551
+ helmPackageName?: string
552
+ preDeployStage?: PrePostDeployStageType
553
+ postDeployStage?: PrePostDeployStageType
554
+ isProdEnv?: boolean
555
+ }
556
+
557
+ export interface ExternalCiConfig {
558
+ id: number
559
+ webhookUrl: string
560
+ payload: string
561
+ accessKey: string
562
+ }
563
+
564
+ export interface Source {
565
+ type: string
566
+ value?: string
567
+ regex?: string
568
+ }
569
+
570
+ export interface CiMaterial {
571
+ source: Source
572
+ gitMaterialId: number
573
+ id: number
574
+ gitMaterialName: string
575
+ isRegex?: boolean
576
+ }
577
+
578
+ export interface Task {
579
+ name?: string
580
+ type?: string
581
+ cmd?: string
582
+ args?: Array<string>
583
+ }
584
+
585
+ export interface CiScript {
586
+ id: number
587
+ index: number
588
+ name: string
589
+ script: string
590
+ outputLocation?: string
591
+ }
592
+
593
+ export interface CiPipeline {
594
+ isManual: boolean
595
+ dockerArgs?: Map<string, string>
596
+ isExternal: boolean
597
+ parentCiPipeline: number
598
+ parentAppId: number
599
+ externalCiConfig: ExternalCiConfig
600
+ ciMaterial?: CiMaterial[]
601
+ name?: string
602
+ id?: number
603
+ active?: boolean
604
+ linkedCount: number
605
+ scanEnabled: boolean
606
+ deleted?: boolean
607
+ version?: string
608
+ beforeDockerBuild?: Array<Task>
609
+ afterDockerBuild?: Array<Task>
610
+ appWorkflowId?: number
611
+ beforeDockerBuildScripts?: Array<CiScript>
612
+ afterDockerBuildScripts?: Array<CiScript>
613
+ isDockerConfigOverridden?: boolean
614
+ dockerConfigOverride?: DockerConfigOverrideType
615
+ appName?: string
616
+ appId?: string
617
+ componentId?: number
618
+ isCITriggerBlocked?: boolean
619
+ ciBlockState?: {
620
+ action: any
621
+ metadataField: string
622
+ }
623
+ isOffendingMandatoryPlugin?: boolean
624
+ pipelineType?: string
625
+ }
@@ -40,4 +40,3 @@ export { default as Grid } from './Grid/Grid'
40
40
  export { default as ClipboardButton } from './ClipboardButton/ClipboardButton'
41
41
  export * from './Hooks'
42
42
  export { AppStatus } from './AppStatus'
43
- export * from './RJSF'
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormProps } from './types';
3
- import './rjsfForm.scss';
4
- export declare const RJSFForm: (props: FormProps) => JSX.Element;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { FieldRowProps } from './types';
3
- import { DO_NOT_SHOW_LABEL } from '../constants';
4
- export declare const FieldRowWithLabel: ({ showLabel, label, required, children, id, shouldAlignCenter, }: Omit<FieldRowProps, "label"> & {
5
- label: FieldRowProps['label'] | typeof DO_NOT_SHOW_LABEL;
6
- }) => JSX.Element;
@@ -1,8 +0,0 @@
1
- import { FieldTemplateProps } from '@rjsf/utils';
2
- export interface FieldRowProps extends Pick<FieldTemplateProps, 'children' | 'label' | 'required' | 'id'> {
3
- showLabel?: boolean;
4
- /**
5
- * @default true
6
- */
7
- shouldAlignCenter?: boolean;
8
- }
@@ -1,4 +0,0 @@
1
- import { RegistryWidgetsType } from '@rjsf/utils';
2
- import { FormProps } from './types';
3
- export declare const widgets: RegistryWidgetsType;
4
- export declare const templates: FormProps['templates'];
@@ -1,7 +0,0 @@
1
- export declare const PLACEHOLDERS: {
2
- SELECT: string;
3
- INPUT: string;
4
- OBJECT_KEY: string;
5
- };
6
- export declare const DEFAULT_FIELD_TITLE = "Key not available";
7
- export declare const DO_NOT_SHOW_LABEL: unique symbol;
@@ -1,3 +0,0 @@
1
- export { RJSFForm } from './Form';
2
- export * from './types';
3
- export { getInferredTypeFromValueType, getRedirectionProps } from './utils';
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { ArrayFieldTemplateItemType } from '@rjsf/utils';
3
- export declare const ArrayFieldItemTemplate: ({ children, className, disabled, hasToolbar, hasRemove, index, onDropIndexClick, readonly, registry, uiSchema, }: ArrayFieldTemplateItemType) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { ArrayFieldTemplateProps } from '@rjsf/utils';
3
- export declare const ArrayFieldTemplate: ({ canAdd, className, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, title, }: ArrayFieldTemplateProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { BaseInputTemplateProps } from '@rjsf/utils';
3
- export declare const BaseInput: ({ placeholder, ...props }: BaseInputTemplateProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { IconButtonProps } from '@rjsf/utils';
3
- export declare const AddButton: ({ icon, iconType, registry, uiSchema, ...props }: IconButtonProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { IconButtonProps } from '@rjsf/utils';
3
- export declare const RemoveButton: ({ icon, iconType, registry, uiSchema, ...props }: IconButtonProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { SubmitButtonProps } from '@rjsf/utils';
3
- export declare const SubmitButton: ({ uiSchema }: SubmitButtonProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- export { AddButton } from './AddButton';
2
- export { RemoveButton } from './RemoveButton';
3
- export { SubmitButton } from './SubmitButton';
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { DescriptionFieldProps } from '@rjsf/utils';
3
- export declare const Description: ({ id, description }: DescriptionFieldProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { FieldTemplateProps } from '@rjsf/utils';
3
- export declare const Field: (props: FieldTemplateProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { FieldErrorProps } from '@rjsf/utils';
3
- export declare const FieldErrorTemplate: ({ errors, idSchema }: FieldErrorProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { ObjectFieldTemplateProps } from '@rjsf/utils';
3
- export declare const ObjectFieldTemplate: (props: ObjectFieldTemplateProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { TitleFieldProps } from '@rjsf/utils';
3
- export declare const TitleField: ({ id, title, required }: TitleFieldProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { WrapIfAdditionalTemplateProps } from '@rjsf/utils';
3
- export declare const WrapIfAdditionalTemplate: ({ id, disabled, label, onKeyChange, onDropPropertyClick, readonly, schema, children, uiSchema, registry, }: WrapIfAdditionalTemplateProps) => JSX.Element;
@@ -1,10 +0,0 @@
1
- export { ArrayFieldTemplate } from './ArrayFieldTemplate';
2
- export { ArrayFieldItemTemplate } from './ArrayFieldItemTemplate';
3
- export { BaseInput as BaseInputTemplate } from './BaseInput';
4
- export * from './ButtonTemplates';
5
- export { Description as DescriptionFieldTemplate } from './Description';
6
- export { Field as FieldTemplate } from './Field';
7
- export { FieldErrorTemplate } from './FieldErrorTemplate';
8
- export { ObjectFieldTemplate } from './ObjectFieldTemplate';
9
- export { TitleField as TitleFieldTemplate } from './TitleField';
10
- export { WrapIfAdditionalTemplate } from './WrapIfAdditionalTemplate';
@@ -1,3 +0,0 @@
1
- import { ComponentProps } from 'react';
2
- import RJSFForm from '@rjsf/core';
3
- export type FormProps = Omit<ComponentProps<typeof RJSFForm>, 'validator'>;
@@ -1,25 +0,0 @@
1
- /// <reference types="react" />
2
- import { TranslatableString } from '@rjsf/utils';
3
- /**
4
- * Override for the TranslatableString from RJSF
5
- */
6
- export declare const translateString: (stringToTranslate: TranslatableString, params?: string[]) => string;
7
- export declare const getCommonSelectStyle: (styleOverrides?: {}) => {
8
- menuList: (base: any) => any;
9
- control: (base: any, state: any) => any;
10
- option: (base: any, state: any) => any;
11
- dropdownIndicator: (base: any, state: any) => any;
12
- valueContainer: (base: any) => any;
13
- loadingMessage: (base: any) => any;
14
- noOptionsMessage: (base: any) => any;
15
- };
16
- /**
17
- * Returns the redirection props for a url
18
- */
19
- export declare const getRedirectionProps: (url: string) => import("react").AnchorHTMLAttributes<HTMLAnchorElement> & {
20
- url: string;
21
- };
22
- /**
23
- * Infers the type for json schema from value type
24
- */
25
- export declare const getInferredTypeFromValueType: (value: any) => "string" | "number" | "boolean" | "object" | "array" | "null";
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { WidgetProps } from '@rjsf/utils';
3
- export declare const Checkbox: ({ id, onChange, value, required, disabled, readonly, autofocus, onBlur, onFocus, }: WidgetProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { WidgetProps } from '@rjsf/utils';
3
- export declare const Select: (props: WidgetProps) => JSX.Element;
@@ -1,2 +0,0 @@
1
- export { Checkbox as CheckboxWidget } from './Checkbox';
2
- export { Select as SelectWidget } from './Select';
@@ -1,5 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
- <g fill="none" fill-rule="evenodd">
3
- <path fill="#999" class="fill-color" fill-rule="nonzero" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/>
4
- </g>
5
- </svg>
@@ -1,29 +0,0 @@
1
- import React from 'react'
2
- import RJSF from '@rjsf/core'
3
- import RJSFValidator from '@rjsf/validator-ajv8'
4
-
5
- import { templates, widgets } from './config'
6
- import { FormProps } from './types'
7
- import { translateString } from './utils'
8
- import './rjsfForm.scss'
9
-
10
- // Need to use this way because the default import was not working as expected
11
- // The default import resolves to an object intead of a function
12
- const Form = (RJSF as any).default as typeof RJSF
13
- const validator = (RJSFValidator as any).default as typeof RJSFValidator
14
-
15
- export const RJSFForm = (props: FormProps) => (
16
- <Form
17
- noHtml5Validate
18
- showErrorList={false}
19
- autoComplete="off"
20
- {...props}
21
- validator={validator}
22
- templates={{
23
- ...templates,
24
- ...props.templates,
25
- }}
26
- widgets={{ ...widgets, ...props.widgets }}
27
- translateString={translateString}
28
- />
29
- )
@@ -1,35 +0,0 @@
1
- import React from 'react'
2
- import { FieldRowProps } from './types'
3
- import { DEFAULT_FIELD_TITLE, DO_NOT_SHOW_LABEL } from '../constants'
4
-
5
- export const FieldRowWithLabel = ({
6
- showLabel,
7
- label,
8
- required,
9
- children,
10
- id,
11
- shouldAlignCenter = true,
12
- }: Omit<FieldRowProps, 'label'> & {
13
- label: FieldRowProps['label'] | typeof DO_NOT_SHOW_LABEL
14
- }) => (
15
- <div
16
- className={
17
- showLabel
18
- ? `display-grid dc__gap-12 rjsf-form-template__field ${shouldAlignCenter ? 'flex-align-center' : ''}`
19
- : ''
20
- }
21
- >
22
- {showLabel && (
23
- <label className="cn-7 fs-13 lh-32 fw-4 flexbox mb-0" htmlFor={id}>
24
- {/* The check is added here intentionally for proper layout for array type field */}
25
- {label !== DO_NOT_SHOW_LABEL && (
26
- <>
27
- <span className="dc__ellipsis-right">{label || DEFAULT_FIELD_TITLE}</span>
28
- {required && <span className="cr-5">&nbsp;*</span>}
29
- </>
30
- )}
31
- </label>
32
- )}
33
- {children}
34
- </div>
35
- )
@@ -1,9 +0,0 @@
1
- import { FieldTemplateProps } from '@rjsf/utils'
2
-
3
- export interface FieldRowProps extends Pick<FieldTemplateProps, 'children' | 'label' | 'required' | 'id'> {
4
- showLabel?: boolean
5
- /**
6
- * @default true
7
- */
8
- shouldAlignCenter?: boolean
9
- }
@@ -1,37 +0,0 @@
1
- import React from 'react'
2
- import { RegistryWidgetsType } from '@rjsf/utils'
3
-
4
- import {
5
- AddButton,
6
- ArrayFieldItemTemplate,
7
- ArrayFieldTemplate,
8
- BaseInputTemplate,
9
- DescriptionFieldTemplate,
10
- FieldTemplate,
11
- FieldErrorTemplate,
12
- ObjectFieldTemplate,
13
- RemoveButton,
14
- SubmitButton,
15
- TitleFieldTemplate,
16
- WrapIfAdditionalTemplate,
17
- } from './templates'
18
- import { CheckboxWidget, SelectWidget } from './widgets'
19
- import { FormProps } from './types'
20
-
21
- export const widgets: RegistryWidgetsType = {
22
- CheckboxWidget,
23
- SelectWidget,
24
- }
25
-
26
- export const templates: FormProps['templates'] = {
27
- ArrayFieldItemTemplate,
28
- ArrayFieldTemplate,
29
- BaseInputTemplate,
30
- ButtonTemplates: { AddButton, RemoveButton, SubmitButton },
31
- DescriptionFieldTemplate,
32
- FieldTemplate,
33
- FieldErrorTemplate,
34
- ObjectFieldTemplate,
35
- TitleFieldTemplate,
36
- WrapIfAdditionalTemplate,
37
- }
@@ -1,10 +0,0 @@
1
- export const PLACEHOLDERS = {
2
- SELECT: 'Please select an option',
3
- INPUT: 'Please enter an input',
4
- OBJECT_KEY: 'Please enter a value for the key',
5
- }
6
-
7
- export const DEFAULT_FIELD_TITLE = 'Key not available'
8
-
9
- // Using symbol to ensure uniqueness across the fields
10
- export const DO_NOT_SHOW_LABEL = Symbol('Do not show label')
@@ -1,3 +0,0 @@
1
- export { RJSFForm } from './Form'
2
- export * from './types'
3
- export { getInferredTypeFromValueType, getRedirectionProps } from './utils'
@@ -1,18 +0,0 @@
1
- .rjsf-form-template {
2
- &__field {
3
- grid-template-columns: 250px 1fr;
4
- }
5
-
6
- &__additional-fields {
7
- grid-template-columns: 1fr 1fr minmax(20px, auto);
8
- }
9
-
10
- &__array-field-item {
11
- grid-template-columns: 1fr auto;
12
-
13
- & > :first-child {
14
- // This is added as the array field itself has a margin bottom
15
- margin: 0;
16
- }
17
- }
18
- }
@@ -1,31 +0,0 @@
1
- import React, { CSSProperties } from 'react'
2
- import { ArrayFieldTemplateItemType } from '@rjsf/utils'
3
-
4
- export const ArrayFieldItemTemplate = ({
5
- children,
6
- className,
7
- disabled,
8
- hasToolbar,
9
- hasRemove,
10
- index,
11
- onDropIndexClick,
12
- readonly,
13
- registry,
14
- uiSchema,
15
- }: ArrayFieldTemplateItemType) => {
16
- const { RemoveButton } = registry.templates.ButtonTemplates
17
-
18
- return (
19
- <div className="display-grid rjsf-form-template__array-field-item flex-align-center dc__gap-8 mb-12">
20
- {children}
21
- {hasToolbar && hasRemove && (
22
- <RemoveButton
23
- disabled={disabled || readonly}
24
- onClick={onDropIndexClick(index)}
25
- uiSchema={uiSchema}
26
- registry={registry}
27
- />
28
- )}
29
- </div>
30
- )
31
- }