@devtron-labs/devtron-fe-common-lib 0.4.6 → 0.5.0-beta-1
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/Common/Constants.d.ts +3 -0
- package/dist/Common/Types.d.ts +2 -6
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/DTApplicationMetricsFormField.d.ts +3 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/constants.d.ts +2 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/index.d.ts +4 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/service.d.ts +4 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/types.d.ts +171 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/OverrideStrategyTippyContent.d.ts +2 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/constants.d.ts +5 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/index.d.ts +5 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/types.d.ts +27 -0
- package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/utils.d.ts +2 -0
- package/dist/Pages/{CDPipeline → Applications/DevtronApps/Details/CDPipeline}/types.d.ts +4 -4
- package/dist/Pages/{App → Applications/DevtronApps/Details}/index.d.ts +1 -0
- package/dist/Pages/Applications/DevtronApps/index.d.ts +1 -0
- package/dist/Pages/Applications/index.d.ts +1 -0
- package/dist/Pages/index.d.ts +1 -2
- package/dist/Shared/Components/CICDHistory/DeploymentHistoryDiff/DeploymentHistoryDiffView.d.ts +1 -1
- package/dist/Shared/Components/CICDHistory/types.d.ts +4 -1
- package/dist/Shared/Components/DeploymentConfigDiff/DeploymentConfigDiff.types.d.ts +2 -1
- package/dist/Shared/Components/InvalidYAMLTippy/InvalidYAMLTippyWrapper.d.ts +3 -0
- package/dist/Shared/Components/InvalidYAMLTippy/constants.d.ts +1 -0
- package/dist/Shared/Components/InvalidYAMLTippy/index.d.ts +2 -0
- package/dist/Shared/Components/InvalidYAMLTippy/types.d.ts +6 -0
- package/dist/Shared/Components/InvalidYAMLTippy/utils.d.ts +2 -0
- package/dist/Shared/Components/SelectPicker/constants.d.ts +5 -0
- package/dist/Shared/Components/SelectPicker/type.d.ts +2 -2
- package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +9 -1
- package/dist/Shared/Components/index.d.ts +1 -0
- package/dist/Shared/Hooks/useForm/useForm.d.ts +29 -26
- package/dist/Shared/Hooks/useForm/useForm.types.d.ts +15 -8
- package/dist/Shared/Hooks/useForm/useForm.utils.d.ts +1 -1
- package/dist/Shared/Services/app.types.d.ts +35 -22
- package/dist/Shared/constants.d.ts +3 -1
- package/dist/Shared/types.d.ts +12 -0
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-C10rk8Cn.js → cssMode-CcDx4N1V.js} +1 -1
- package/dist/{freemarker2-D67_7glc.js → freemarker2-DeqGz2I9.js} +1 -1
- package/dist/{handlebars-BjuzR1TI.js → handlebars-DqyEZAW0.js} +1 -1
- package/dist/{html-CD4rBQ1p.js → html-Dbv5mKnu.js} +1 -1
- package/dist/{htmlMode-ChcH2Ueg.js → htmlMode-DKIS0Wp1.js} +1 -1
- package/dist/{index-Czrg-A8a.js → index-Bk95C8WS.js} +23102 -22942
- package/dist/index.js +538 -518
- package/dist/{javascript-B-PbsBVX.js → javascript-CcKm78Rp.js} +1 -1
- package/dist/{jsonMode-Bif4lid2.js → jsonMode-D9SaAYqJ.js} +1 -1
- package/dist/{liquid-ByZWrLBg.js → liquid-DYLkezXd.js} +1 -1
- package/dist/{mdx-BW4oCjP0.js → mdx-B8NW5l-H.js} +1 -1
- package/dist/{python-BeFHqQHi.js → python-fSby07Yv.js} +1 -1
- package/dist/{razor-BHD5-V8u.js → razor-fivLNmXW.js} +1 -1
- package/dist/{tsMode-NN8FSA45.js → tsMode-c6h3SHwD.js} +1 -1
- package/dist/{typescript-C0Qqxjrj.js → typescript-MiiYpzPG.js} +1 -1
- package/dist/{xml-B2M3oT9b.js → xml-DVLT2zo0.js} +1 -1
- package/dist/{yaml-azYGD9Hn.js → yaml-BGAuLRlJ.js} +1 -1
- package/package.json +1 -1
- package/dist/Pages/App/AppConfigurations/index.d.ts +0 -1
- package/dist/Pages/App/AppConfigurations/utils.d.ts +0 -2
- /package/dist/Pages/{CDPipeline → Applications/DevtronApps/Details/CDPipeline}/index.d.ts +0 -0
|
@@ -5,6 +5,7 @@ export declare const DOCUMENTATION_HOME_PAGE = "https://docs.devtron.ai";
|
|
|
5
5
|
export declare const DOCUMENTATION_VERSION = "/v/v0.7";
|
|
6
6
|
export declare const DISCORD_LINK = "https://discord.devtron.ai/";
|
|
7
7
|
export declare const DOCUMENTATION: {
|
|
8
|
+
APP_METRICS: string;
|
|
8
9
|
APP_TAGS: string;
|
|
9
10
|
APP_OVERVIEW_TAGS: string;
|
|
10
11
|
BLOB_STORAGE: string;
|
|
@@ -48,6 +49,7 @@ export declare const URLS: {
|
|
|
48
49
|
export declare const ROUTES: {
|
|
49
50
|
APP: string;
|
|
50
51
|
APP_ARTIFACT_PROMOTE_MATERIAL: string;
|
|
52
|
+
APP_TEMPLATE_DATA: string;
|
|
51
53
|
PROJECT_LIST_MIN: string;
|
|
52
54
|
USER_CHECK_ROLE: string;
|
|
53
55
|
IMAGE_TAGGING: string;
|
|
@@ -250,6 +252,7 @@ export declare const API_STATUS_CODES: {
|
|
|
250
252
|
PERMISSION_DENIED: number;
|
|
251
253
|
NOT_FOUND: number;
|
|
252
254
|
EXPECTATION_FAILED: number;
|
|
255
|
+
LOCKED: number;
|
|
253
256
|
};
|
|
254
257
|
export declare enum SERVER_MODE {
|
|
255
258
|
EA_ONLY = "EA_ONLY",
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -661,6 +661,8 @@ export interface AppEnvironment {
|
|
|
661
661
|
isProtected?: boolean;
|
|
662
662
|
pipelineId?: number;
|
|
663
663
|
latestCdWorkflowRunnerId?: number;
|
|
664
|
+
commits?: string[];
|
|
665
|
+
ciArtifactId?: number;
|
|
664
666
|
}
|
|
665
667
|
export interface Strategy {
|
|
666
668
|
deploymentTemplate: string;
|
|
@@ -779,12 +781,6 @@ export interface CiPipeline {
|
|
|
779
781
|
isOffendingMandatoryPlugin?: boolean;
|
|
780
782
|
pipelineType?: string;
|
|
781
783
|
}
|
|
782
|
-
export interface DeploymentChartVersionType {
|
|
783
|
-
chartRefId: number;
|
|
784
|
-
chartVersion: string;
|
|
785
|
-
chartType: string;
|
|
786
|
-
type: number;
|
|
787
|
-
}
|
|
788
784
|
export interface ChartVersionAndTypeSelectorProps {
|
|
789
785
|
setSelectedChartRefId: React.Dispatch<React.SetStateAction<number>>;
|
|
790
786
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DTApplicationMetricsFormFieldProps } from './types';
|
|
2
|
+
declare const DTApplicationMetricsFormField: ({ showApplicationMetrics, isLoading, selectedChart, isDisabled, toggleAppMetrics, isAppMetricsEnabled, onlyShowCurrentStatus, parsingError, restoreLastSavedYAML, }: DTApplicationMetricsFormFieldProps) => JSX.Element;
|
|
3
|
+
export default DTApplicationMetricsFormField;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ResponseType } from '../../../../../../Common/Types';
|
|
2
|
+
import { GetDeploymentManifestProps, GetResolvedDeploymentTemplateProps, GetResolvedDeploymentTemplateReturnType, ResolvedDeploymentTemplateDTO } from './types';
|
|
3
|
+
export declare const getDeploymentManifest: (params: GetDeploymentManifestProps, abortSignal?: AbortSignal) => Promise<ResponseType<ResolvedDeploymentTemplateDTO>>;
|
|
4
|
+
export declare const getResolvedDeploymentTemplate: (params: GetResolvedDeploymentTemplateProps, signal?: AbortSignal) => Promise<GetResolvedDeploymentTemplateReturnType>;
|
package/dist/Pages/Applications/DevtronApps/Details/AppConfigurations/DeploymentTemplate/types.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { DraftMetadataDTO, TemplateListType } from '../../../../../../Shared/Services';
|
|
2
|
+
import { OverrideMergeStrategyType } from '../types';
|
|
3
|
+
export type DeploymentChartOptionkind = 'base' | 'env' | 'chartVersion' | 'deployment';
|
|
4
|
+
export interface DeploymentChartVersionType {
|
|
5
|
+
id: number | string;
|
|
6
|
+
version: string;
|
|
7
|
+
/**
|
|
8
|
+
* BEWARE: This field may or may not exist, not sure why it was there in first place
|
|
9
|
+
*/
|
|
10
|
+
chartRefId?: number;
|
|
11
|
+
type: number;
|
|
12
|
+
deploymentTemplateHistoryId: number;
|
|
13
|
+
pipelineId: number;
|
|
14
|
+
environmentId: number;
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
isAppMetricsSupported: boolean;
|
|
18
|
+
userUploaded?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DeploymentChartOptionType extends DeploymentChartVersionType {
|
|
21
|
+
value: string | number;
|
|
22
|
+
label: string;
|
|
23
|
+
kind?: DeploymentChartOptionkind;
|
|
24
|
+
}
|
|
25
|
+
export interface ChartMetadataType {
|
|
26
|
+
chartDescription: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetResolvedDeploymentTemplateReturnType {
|
|
29
|
+
resolvedData: string;
|
|
30
|
+
data: string;
|
|
31
|
+
areVariablesPresent: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare enum ValuesAndManifestFlagDTO {
|
|
34
|
+
DEPLOYMENT_TEMPLATE = 1,
|
|
35
|
+
MANIFEST = 2
|
|
36
|
+
}
|
|
37
|
+
type GetResolvedDeploymentTemplateCustomValuesPayloadType = {
|
|
38
|
+
/**
|
|
39
|
+
* String to be resolved
|
|
40
|
+
*/
|
|
41
|
+
values: string;
|
|
42
|
+
type?: never;
|
|
43
|
+
deploymentTemplateHistoryId?: never;
|
|
44
|
+
pipelineId?: never;
|
|
45
|
+
};
|
|
46
|
+
type GetHistoricResolvedDeploymentTemplatePayloadType = {
|
|
47
|
+
values?: never;
|
|
48
|
+
type: TemplateListType;
|
|
49
|
+
deploymentTemplateHistoryId: number;
|
|
50
|
+
pipelineId: number;
|
|
51
|
+
};
|
|
52
|
+
type GetDeploymentTemplateAndManifestBasePayload = {
|
|
53
|
+
appId: number;
|
|
54
|
+
/**
|
|
55
|
+
* EnvId for the given VALUE
|
|
56
|
+
*/
|
|
57
|
+
envId?: number;
|
|
58
|
+
chartRefId: number;
|
|
59
|
+
} & (GetHistoricResolvedDeploymentTemplatePayloadType | GetResolvedDeploymentTemplateCustomValuesPayloadType);
|
|
60
|
+
export type GetResolvedDeploymentTemplatePayloadType = {
|
|
61
|
+
valuesAndManifestFlag: ValuesAndManifestFlagDTO.DEPLOYMENT_TEMPLATE;
|
|
62
|
+
} & GetDeploymentTemplateAndManifestBasePayload;
|
|
63
|
+
export type GetResolvedDeploymentTemplateProps = GetResolvedDeploymentTemplatePayloadType;
|
|
64
|
+
export type GetDeploymentManifestProps = GetDeploymentTemplateAndManifestBasePayload;
|
|
65
|
+
export type GetDeploymentManifestPayloadType = {
|
|
66
|
+
valuesAndManifestFlag: ValuesAndManifestFlagDTO.MANIFEST;
|
|
67
|
+
} & GetDeploymentTemplateAndManifestBasePayload;
|
|
68
|
+
export interface ResolvedDeploymentTemplateDTO {
|
|
69
|
+
/**
|
|
70
|
+
* Template with encoded variables
|
|
71
|
+
*/
|
|
72
|
+
data: string;
|
|
73
|
+
/**
|
|
74
|
+
* Template with resolved variables
|
|
75
|
+
*/
|
|
76
|
+
resolvedData: string;
|
|
77
|
+
variableSnapshot: Record<string, string>;
|
|
78
|
+
}
|
|
79
|
+
export interface ManifestTemplateDTO extends Pick<ResolvedDeploymentTemplateDTO, 'data'> {
|
|
80
|
+
}
|
|
81
|
+
interface DeploymentTemplateChartConfigType {
|
|
82
|
+
id: number;
|
|
83
|
+
/**
|
|
84
|
+
* Not consumed on UI just need to send in payload while update
|
|
85
|
+
*/
|
|
86
|
+
refChartTemplate: string;
|
|
87
|
+
/**
|
|
88
|
+
* Not consumed on UI just need to send in payload while update
|
|
89
|
+
*/
|
|
90
|
+
refChartTemplateVersion: string;
|
|
91
|
+
chartRefId: number;
|
|
92
|
+
readme: string;
|
|
93
|
+
}
|
|
94
|
+
export interface SelectedChartDetailsType {
|
|
95
|
+
selectedChartRefId: number;
|
|
96
|
+
selectedChart: DeploymentChartVersionType;
|
|
97
|
+
}
|
|
98
|
+
interface EnvironmentConfigType {
|
|
99
|
+
id: number;
|
|
100
|
+
status: number;
|
|
101
|
+
manualReviewed: boolean;
|
|
102
|
+
active: boolean;
|
|
103
|
+
namespace: string;
|
|
104
|
+
}
|
|
105
|
+
interface BaseDeploymentTemplateConfigState {
|
|
106
|
+
chartConfig: DeploymentTemplateChartConfigType;
|
|
107
|
+
isOverridden?: never;
|
|
108
|
+
environmentConfig?: never;
|
|
109
|
+
mergeStrategy?: never;
|
|
110
|
+
}
|
|
111
|
+
interface EnvironmentOverrideDeploymentTemplateConfigState {
|
|
112
|
+
chartConfig?: never;
|
|
113
|
+
isOverridden: boolean;
|
|
114
|
+
environmentConfig: EnvironmentConfigType;
|
|
115
|
+
mergeStrategy: OverrideMergeStrategyType;
|
|
116
|
+
}
|
|
117
|
+
export interface DeploymentTemplateConfigCommonState extends SelectedChartDetailsType {
|
|
118
|
+
/**
|
|
119
|
+
* The first ever state of the deployment template
|
|
120
|
+
*/
|
|
121
|
+
originalTemplate: Record<string, string>;
|
|
122
|
+
isAppMetricsEnabled: boolean;
|
|
123
|
+
readme: string;
|
|
124
|
+
schema: Record<string, string>;
|
|
125
|
+
guiSchema: string;
|
|
126
|
+
latestDraft?: DraftMetadataDTO;
|
|
127
|
+
editorTemplate: string;
|
|
128
|
+
editorTemplateWithoutLockedKeys: string;
|
|
129
|
+
}
|
|
130
|
+
export type DeploymentTemplateConfigState = DeploymentTemplateConfigCommonState & (BaseDeploymentTemplateConfigState | EnvironmentOverrideDeploymentTemplateConfigState);
|
|
131
|
+
type DTApplicationMetricsReadOnlyProps = {
|
|
132
|
+
isLoading?: never;
|
|
133
|
+
selectedChart?: never;
|
|
134
|
+
isDisabled?: never;
|
|
135
|
+
toggleAppMetrics?: never;
|
|
136
|
+
/**
|
|
137
|
+
* @default - false
|
|
138
|
+
* If true, would only text depicting the information whether the application metrics is enabled or not
|
|
139
|
+
*/
|
|
140
|
+
onlyShowCurrentStatus: true;
|
|
141
|
+
parsingError?: never;
|
|
142
|
+
restoreLastSavedYAML?: never;
|
|
143
|
+
};
|
|
144
|
+
type DTApplicationMetricsParseErrorProps = {
|
|
145
|
+
parsingError: string;
|
|
146
|
+
restoreLastSavedYAML: () => void;
|
|
147
|
+
} | {
|
|
148
|
+
parsingError?: never;
|
|
149
|
+
restoreLastSavedYAML?: never;
|
|
150
|
+
};
|
|
151
|
+
type DTApplicationMetricsActionProps = {
|
|
152
|
+
isLoading: boolean;
|
|
153
|
+
selectedChart: DeploymentChartVersionType;
|
|
154
|
+
isDisabled: boolean;
|
|
155
|
+
toggleAppMetrics: () => void;
|
|
156
|
+
onlyShowCurrentStatus?: false;
|
|
157
|
+
} & DTApplicationMetricsParseErrorProps;
|
|
158
|
+
export type DTApplicationMetricsFormFieldProps = {
|
|
159
|
+
isAppMetricsEnabled: boolean;
|
|
160
|
+
showApplicationMetrics: boolean;
|
|
161
|
+
} & (DTApplicationMetricsActionProps | DTApplicationMetricsReadOnlyProps);
|
|
162
|
+
export declare enum CompareFromApprovalOptionsValuesType {
|
|
163
|
+
APPROVAL_PENDING = 1,
|
|
164
|
+
VALUES_FROM_DRAFT = 2
|
|
165
|
+
}
|
|
166
|
+
export declare enum DryRunEditorMode {
|
|
167
|
+
APPROVAL_PENDING = "approvalPending",
|
|
168
|
+
VALUES_FROM_DRAFT = "valuesFromDraft",
|
|
169
|
+
PUBLISHED_VALUES = "publishedValues"
|
|
170
|
+
}
|
|
171
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode, SyntheticEvent } from 'react';
|
|
2
|
+
export declare enum ConfigHeaderTabType {
|
|
3
|
+
VALUES = "values",
|
|
4
|
+
INHERITED = "inherited",
|
|
5
|
+
DRY_RUN = "dryRun"
|
|
6
|
+
}
|
|
7
|
+
export declare enum ProtectConfigTabsType {
|
|
8
|
+
PUBLISHED = "published",
|
|
9
|
+
COMPARE = "compare",
|
|
10
|
+
EDIT_DRAFT = "editDraft"
|
|
11
|
+
}
|
|
12
|
+
export declare enum OverrideMergeStrategyType {
|
|
13
|
+
PATCH = "patch",
|
|
14
|
+
REPLACE = "replace"
|
|
15
|
+
}
|
|
16
|
+
export interface ConfigToolbarPopupMenuConfigType {
|
|
17
|
+
text: string;
|
|
18
|
+
onClick: (event: SyntheticEvent) => void;
|
|
19
|
+
dataTestId: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
icon?: ReactNode | null;
|
|
22
|
+
variant?: 'default' | 'negative';
|
|
23
|
+
}
|
|
24
|
+
export declare enum ConfigToolbarPopupNodeType {
|
|
25
|
+
DISCARD_DRAFT = "discardDraft",
|
|
26
|
+
EDIT_HISTORY = "editHistory"
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuildStageType, FormType } from '
|
|
2
|
-
import { DeploymentAppTypes, UserApprovalConfigType } from '
|
|
3
|
-
import { DeploymentStrategy } from '
|
|
4
|
-
import { EnvListMinDTO } from '
|
|
1
|
+
import { BuildStageType, FormType } from '../../../../../Common/CIPipeline.Types';
|
|
2
|
+
import { DeploymentAppTypes, UserApprovalConfigType } from '../../../../../Common/Types';
|
|
3
|
+
import { DeploymentStrategy } from '../../../../../Shared/Components';
|
|
4
|
+
import { EnvListMinDTO } from '../../../../../Shared/types';
|
|
5
5
|
interface ConfigSecretType {
|
|
6
6
|
label: string;
|
|
7
7
|
value: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Details';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DevtronApps';
|
package/dist/Pages/index.d.ts
CHANGED
package/dist/Shared/Components/CICDHistory/DeploymentHistoryDiff/DeploymentHistoryDiffView.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DeploymentTemplateHistoryType } from '../types';
|
|
2
|
-
declare const DeploymentHistoryDiffView: ({ currentConfiguration, baseTemplateConfiguration, previousConfigAvailable, isUnpublished, isDeleteDraft, rootClassName, comparisonBodyClassName,
|
|
2
|
+
declare const DeploymentHistoryDiffView: ({ currentConfiguration, baseTemplateConfiguration, previousConfigAvailable, isUnpublished, isDeleteDraft, rootClassName, comparisonBodyClassName, sortingConfig, }: DeploymentTemplateHistoryType) => JSX.Element;
|
|
3
3
|
export default DeploymentHistoryDiffView;
|
|
@@ -394,7 +394,10 @@ export interface DeploymentTemplateHistoryType {
|
|
|
394
394
|
isDeleteDraft?: boolean;
|
|
395
395
|
rootClassName?: string;
|
|
396
396
|
comparisonBodyClassName?: string;
|
|
397
|
-
|
|
397
|
+
sortingConfig?: {
|
|
398
|
+
sortBy: string;
|
|
399
|
+
sortOrder: SortingOrder;
|
|
400
|
+
};
|
|
398
401
|
}
|
|
399
402
|
export interface DeploymentHistoryDetailRes extends ResponseType {
|
|
400
403
|
result?: DeploymentHistoryDetail;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SortingOrder } from '../../../Common/Constants';
|
|
2
|
-
import { AppEnvDeploymentConfigDTO, ConfigMapSecretDataConfigDatumDTO, DeploymentTemplateDTO, EnvResourceType
|
|
2
|
+
import { AppEnvDeploymentConfigDTO, ConfigMapSecretDataConfigDatumDTO, DeploymentTemplateDTO, EnvResourceType } from '../../Services';
|
|
3
|
+
import { ManifestTemplateDTO } from '../../../Pages/Applications';
|
|
3
4
|
import { DeploymentHistoryDetail } from '../CICDHistory';
|
|
4
5
|
import { CollapsibleListConfig, CollapsibleListItem } from '../CollapsibleList';
|
|
5
6
|
import { SelectPickerProps } from '../SelectPicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_INVALID_YAML_ERROR = "The provided YAML is invalid. Please provide valid YAML.";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { SelectPickerProps } from './type';
|
|
3
|
+
export declare const SELECT_PICKER_FONT_SIZE_MAP: Record<SelectPickerProps['size'], CSSProperties['fontSize']>;
|
|
4
|
+
export declare const SELECT_PICKER_ICON_SIZE_MAP: Record<SelectPickerProps['size'], Pick<CSSProperties, 'width' | 'height'>>;
|
|
5
|
+
export declare const SELECT_PICKER_CONTROL_SIZE_MAP: Record<SelectPickerProps['size'], CSSProperties['minHeight']>;
|
|
@@ -74,11 +74,11 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
|
|
|
74
74
|
*/
|
|
75
75
|
customSelectedOptionsCount?: number;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* Size of select
|
|
78
78
|
*
|
|
79
79
|
* @default 'ComponentSizeType.medium'
|
|
80
80
|
*/
|
|
81
|
-
size?: Extract<ComponentSizeType, ComponentSizeType.medium | ComponentSizeType.large>;
|
|
81
|
+
size?: Extract<ComponentSizeType, ComponentSizeType.medium | ComponentSizeType.large | ComponentSizeType.small>;
|
|
82
82
|
/**
|
|
83
83
|
* Content to be shown in a tippy when disabled
|
|
84
84
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
2
2
|
import { ComponentSizeType } from '../../constants';
|
|
3
3
|
import { DataAttributes } from '../../types';
|
|
4
|
+
import { TooltipProps } from '@Common/Tooltip/types';
|
|
4
5
|
type TabComponentProps<TabTypeProps> = TabTypeProps & DataAttributes;
|
|
5
6
|
type ConditionalTabType = {
|
|
6
7
|
/**
|
|
@@ -56,6 +57,13 @@ type ConditionalTabType = {
|
|
|
56
57
|
*/
|
|
57
58
|
active?: never | false;
|
|
58
59
|
};
|
|
60
|
+
type TabTooltipProps = {
|
|
61
|
+
shouldWrapTooltip: boolean;
|
|
62
|
+
tooltipProps: TooltipProps;
|
|
63
|
+
} | {
|
|
64
|
+
shouldWrapTooltip?: never;
|
|
65
|
+
tooltipProps?: never;
|
|
66
|
+
};
|
|
59
67
|
export type TabProps = {
|
|
60
68
|
/**
|
|
61
69
|
* Unique identifier for the tab.
|
|
@@ -97,7 +105,7 @@ export type TabProps = {
|
|
|
97
105
|
* Disables the tab, preventing interaction and indicating an inactive state.
|
|
98
106
|
*/
|
|
99
107
|
disabled?: boolean;
|
|
100
|
-
} & ConditionalTabType;
|
|
108
|
+
} & ConditionalTabType & TabTooltipProps;
|
|
101
109
|
export interface TabGroupProps {
|
|
102
110
|
/**
|
|
103
111
|
* Array of tabs to be rendered.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseFormSubmitHandler, UseFormValidations } from './useForm.types';
|
|
1
|
+
import { BaseSyntheticEvent, ChangeEvent } from 'react';
|
|
2
|
+
import { UseFormSubmitHandler, UseFormValidations, UseFormErrorHandler } from './useForm.types';
|
|
3
3
|
/**
|
|
4
4
|
* A custom hook to manage form state, validation, and submission handling.
|
|
5
5
|
*
|
|
@@ -16,20 +16,19 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
|
|
|
16
16
|
* - 'onBlur': Validation occurs when the input loses focus.
|
|
17
17
|
* @default 'onChange'
|
|
18
18
|
*/
|
|
19
|
-
validationMode?: "onChange" | "onBlur";
|
|
19
|
+
validationMode?: "onChange" | "onBlur" | "onSubmit";
|
|
20
20
|
}) => {
|
|
21
21
|
/** The current form data. */
|
|
22
22
|
data: T;
|
|
23
23
|
/** An object containing validation errors for each form field. */
|
|
24
|
-
errors: Partial<Record<keyof T, string
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
register: <V extends unknown = string, S extends unknown = unknown>(name: keyof T, sanitizeFn?: (value: V) => S, registerOptions?: {
|
|
24
|
+
errors: Partial<Record<keyof T, string[]>>;
|
|
25
|
+
register: <Value extends unknown, SFnReturnType extends unknown, CustomComponent extends boolean>(name: keyof T, registerOptions?: {
|
|
26
|
+
/**
|
|
27
|
+
* A function to sanitize the input value.
|
|
28
|
+
* @param value The input value.
|
|
29
|
+
* @returns The sanitized value.
|
|
30
|
+
*/
|
|
31
|
+
sanitizeFn?: (value: CustomComponent extends true ? Value : string) => SFnReturnType;
|
|
33
32
|
/**
|
|
34
33
|
* Prevents the input value from being trimmed.
|
|
35
34
|
*
|
|
@@ -39,26 +38,30 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
|
|
|
39
38
|
* @default false - By default, the input will be trimmed.
|
|
40
39
|
*/
|
|
41
40
|
noTrim?: boolean;
|
|
41
|
+
/** A boolean flag indicating if the input is a custom component. */
|
|
42
|
+
isCustomComponent?: CustomComponent;
|
|
42
43
|
}) => {
|
|
43
|
-
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
44
|
+
onChange: (e: CustomComponent extends true ? Value : ChangeEvent<HTMLInputElement>) => void;
|
|
44
45
|
onBlur: () => void;
|
|
45
46
|
onFocus: () => void;
|
|
46
47
|
name: keyof T;
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
* Handles form submission, validates all form fields, and calls the provided `onValid` function if valid.
|
|
50
|
-
*
|
|
51
|
-
* @param onValid - A function to handle valid form data on submission.
|
|
52
|
-
* @returns The event handler for form submission.
|
|
53
|
-
*/
|
|
54
|
-
handleSubmit: (onValid: UseFormSubmitHandler<T>) => (e: FormEvent<HTMLFormElement>) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Manually triggers validation for specific form fields.
|
|
57
|
-
*
|
|
58
|
-
* @param name - The key(s) of the form field(s) to validate.
|
|
59
|
-
* @returns The validation error(s), if any.
|
|
60
|
-
*/
|
|
49
|
+
handleSubmit: (onValid: UseFormSubmitHandler<T>, onError?: UseFormErrorHandler<T>) => (e?: BaseSyntheticEvent) => Promise<void>;
|
|
61
50
|
trigger: (name: keyof T | (keyof T)[]) => (string | string[]) | (string | string[])[];
|
|
51
|
+
setValue: (name: keyof T, value: T[keyof T], valueOptions?: {
|
|
52
|
+
/** A boolean indicating whether to mark the field as dirty after setting the value. */
|
|
53
|
+
shouldDirty?: boolean;
|
|
54
|
+
/** A boolean indicating whether to mark the field as touched after setting the value. */
|
|
55
|
+
shouldTouch?: boolean;
|
|
56
|
+
}) => void;
|
|
57
|
+
reset: (formData: T, resetOptions?: {
|
|
58
|
+
/** A boolean indicating whether to retain the current dirty state of the form fields. */
|
|
59
|
+
keepDirty?: boolean;
|
|
60
|
+
/** A boolean indicating whether to retain the current touched state of the form fields. */
|
|
61
|
+
keepTouched?: boolean;
|
|
62
|
+
/** A boolean indicating whether to retain the current error state of the form fields. */
|
|
63
|
+
keepErrors?: boolean;
|
|
64
|
+
}) => void;
|
|
62
65
|
/** An object representing additional form state. */
|
|
63
66
|
formState: {
|
|
64
67
|
/** An object indicating which fields have been touched (interacted with). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseSyntheticEvent } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Describes the "required" validation rule.
|
|
4
4
|
* It can be a simple boolean or an object containing a boolean value and an error message.
|
|
@@ -24,10 +24,10 @@ type ValidationPattern = {
|
|
|
24
24
|
* If validation fails, an error message is provided.
|
|
25
25
|
*/
|
|
26
26
|
type ValidationCustom = {
|
|
27
|
-
isValid: (value:
|
|
27
|
+
isValid: (value: any) => boolean;
|
|
28
28
|
message: string;
|
|
29
29
|
} | {
|
|
30
|
-
isValid: (value:
|
|
30
|
+
isValid: (value: any) => boolean;
|
|
31
31
|
message: string;
|
|
32
32
|
}[];
|
|
33
33
|
/**
|
|
@@ -41,9 +41,9 @@ export interface UseFormValidation {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Represents the structure for form validation errors.
|
|
44
|
-
* Maps each field to an
|
|
44
|
+
* Maps each field to an array of error messages.
|
|
45
45
|
*/
|
|
46
|
-
export type UseFormErrors<T> = Partial<Record<keyof T, string
|
|
46
|
+
export type UseFormErrors<T> = Partial<Record<keyof T, string[]>>;
|
|
47
47
|
/**
|
|
48
48
|
* Represents the fields that have been modified ("dirty") in the form.
|
|
49
49
|
* Maps each field to a boolean value indicating whether it has been changed.
|
|
@@ -58,12 +58,19 @@ export type TouchedFields<T> = Partial<Record<keyof T, boolean>>;
|
|
|
58
58
|
* Defines the structure for form validations.
|
|
59
59
|
* Maps each form field to its corresponding validation rules.
|
|
60
60
|
*/
|
|
61
|
-
export type UseFormValidations<T extends {}> = Partial<Record<keyof T, UseFormValidation>>;
|
|
61
|
+
export type UseFormValidations<T extends {}> = ((formData: T) => Partial<Record<keyof T, UseFormValidation>>) | Partial<Record<keyof T, UseFormValidation>>;
|
|
62
62
|
/**
|
|
63
63
|
* Describes the function signature for handling form submission.
|
|
64
64
|
*
|
|
65
65
|
* @param data - The form data collected during submission.
|
|
66
|
-
* @param e - The
|
|
66
|
+
* @param e - The event, optionally passed when `handleSubmit` is called.
|
|
67
67
|
*/
|
|
68
|
-
export type UseFormSubmitHandler<T extends {}> = (data: T, e?:
|
|
68
|
+
export type UseFormSubmitHandler<T extends {}> = (data: T, e?: BaseSyntheticEvent) => void;
|
|
69
|
+
/**
|
|
70
|
+
* A type defining the function signature for handling form validation errors.
|
|
71
|
+
*
|
|
72
|
+
* @param errors - An object containing the validation errors for form fields.
|
|
73
|
+
* @param e - The event, optionally passed when `handleSubmit` is called.
|
|
74
|
+
*/
|
|
75
|
+
export type UseFormErrorHandler<T extends {}> = (errors: UseFormErrors<T>, e?: BaseSyntheticEvent) => void;
|
|
69
76
|
export {};
|
|
@@ -7,4 +7,4 @@ import { UseFormValidation } from './useForm.types';
|
|
|
7
7
|
* @param validation - The validation rules for the form field.
|
|
8
8
|
* @returns Returns error message(s) or null if valid.
|
|
9
9
|
*/
|
|
10
|
-
export declare const checkValidation: <T extends Record<keyof T, any> = {}>(value: T[keyof T], validation: UseFormValidation) => string
|
|
10
|
+
export declare const checkValidation: <T extends Record<keyof T, any> = {}>(value: T[keyof T], validation: UseFormValidation) => string[] | null;
|