Skip to content

Commit b53a493

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/text-area
2 parents 6caf674 + e3c08ce commit b53a493

40 files changed

+4928
-978
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ src/Common/CIPipeline.Types.ts
1111
src/Common/ChartVersionAndTypeSelector.tsx
1212
src/Common/Checkbox.tsx
1313
src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx
14-
src/Common/CodeEditor/CodeEditor.tsx
1514
src/Common/Common.service.ts
1615
src/Common/CustomInput/CustomInput.tsx
1716
src/Common/CustomTagSelector/PropagateTagInfo.tsx

package-lock.json

Lines changed: 1120 additions & 158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.5.11",
3+
"version": "1.5.14",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -43,6 +43,7 @@
4343
"@tippyjs/react": "^4.2.0",
4444
"@typeform/embed-react": "2.20.0",
4545
"@types/dompurify": "^3.0.5",
46+
"@types/json-schema": "^7.0.15",
4647
"@types/react": "17.0.39",
4748
"@types/react-dom": "17.0.13",
4849
"@types/react-router-dom": "^5.3.3",
@@ -60,10 +61,9 @@
6061
"eslint-plugin-react-hooks": "^4.6.0",
6162
"glob": "^10.3.3",
6263
"husky": "^7.0.4",
64+
"json-schema": "^0.4.0",
6365
"lint-staged": "^12.5.0",
6466
"moment": "^2.29.4",
65-
"monaco-editor": "0.44.0",
66-
"monaco-yaml": "5.1.1",
6767
"prettier": "^3.1.1",
6868
"react-ga4": "^1.4.1",
6969
"react-toastify": "9.1.3",
@@ -94,17 +94,27 @@
9494
"yaml": "^2.4.1"
9595
},
9696
"dependencies": {
97+
"@codemirror/lang-json": "6.0.1",
98+
"@codemirror/lang-yaml": "6.1.2",
99+
"@codemirror/language": "6.10.8",
100+
"@codemirror/legacy-modes": "6.4.2",
101+
"@codemirror/lint": "6.8.4",
102+
"@codemirror/search": "6.5.8",
103+
"@replit/codemirror-vscode-keymap": "6.0.2",
97104
"@types/react-dates": "^21.8.6",
105+
"@uiw/codemirror-theme-github": "^4.23.7",
106+
"@uiw/react-codemirror": "4.23.7",
98107
"ansi_up": "^5.2.1",
108+
"codemirror-json-schema": "0.8.0",
99109
"dayjs": "^1.11.13",
100110
"fast-json-patch": "^3.1.1",
101111
"framer-motion": "^6.5.1",
102112
"jsonpath-plus": "^10.0.0",
103113
"marked": "^13.0.3",
104114
"nanoid": "^3.3.8",
115+
"react-codemirror-merge": "4.23.6",
105116
"react-dates": "^21.8.0",
106117
"react-diff-viewer-continued": "^3.4.0",
107-
"react-monaco-editor": "^0.54.0",
108118
"react-virtualized-sticky-tree": "^3.0.0-beta18",
109119
"sass": "^1.69.7",
110120
"tslib": "2.7.0",
@@ -116,9 +126,6 @@
116126
"react": "^17.0.2",
117127
"react-dom": "^17.0.2"
118128
},
119-
"react-monaco-editor": {
120-
"monaco-editor": "0.44.0"
121-
},
122129
"vite-plugin-svgr": {
123130
"vite": "5.4.11"
124131
},

patches/codemirror-json-schema+0.8.0.patch

Lines changed: 2069 additions & 0 deletions
Large diffs are not rendered by default.

src/Assets/Icon/ic-match-case.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/Icon/ic-match-word.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/Assets/Icon/ic-replace-text.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Common/ClipboardButton/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './ClipboardButton'
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { ReactNode } from 'react'
2+
3+
import { ReactComponent as ICWarningY5 } from '@Icons/ic-warning-y5.svg'
4+
import { ReactComponent as Info } from '@Icons/ic-info-filled.svg'
5+
import { ReactComponent as ErrorIcon } from '@Icons/ic-error-exclamation.svg'
6+
import { ReactComponent as ICCompare } from '@Icons/ic-compare.svg'
7+
import { ClipboardButton } from '@Common/ClipboardButton'
8+
9+
import { useCodeEditorContext } from './CodeEditor.context'
10+
import { CodeEditorHeaderProps, CodeEditorStatusBarProps } from './types'
11+
12+
const SplitPane = () => {
13+
const { state, dispatch, readOnly } = useCodeEditorContext()
14+
15+
const handleToggle = () => {
16+
if (readOnly) {
17+
return
18+
}
19+
dispatch({ type: 'setDiff', value: !state.diffMode })
20+
}
21+
22+
return (
23+
<div className="code-editor__split-pane flex pointer cn-7 fcn-7 ml-auto" onClick={handleToggle}>
24+
<ICCompare className="icon-dim-20 mr-4" />
25+
{state.diffMode ? 'Hide comparison' : 'Compare with default'}
26+
</div>
27+
)
28+
}
29+
30+
export const Header = ({ children, className, hideDefaultSplitHeader }: CodeEditorHeaderProps) => {
31+
const { state, hasCodeEditorContainer } = useCodeEditorContext()
32+
33+
return (
34+
<div
35+
data-code-editor-header
36+
className={`${hasCodeEditorContainer ? 'dc__top-radius-4' : ''} ${className || 'code-editor__header flex right bcn-1 pt-10 pb-9 px-16 dc__border-bottom'}`}
37+
>
38+
{children}
39+
{!hideDefaultSplitHeader && state.lhsCode && <SplitPane />}
40+
</div>
41+
)
42+
}
43+
44+
export const Warning = ({ className, text, children }: CodeEditorStatusBarProps) => (
45+
<div
46+
className={`code-editor__warning fs-12 fw-4 lh-16 cn-9 py-8 px-16 bcy-1 bw-1 ey-2 dc__height-auto ${className || ''}`}
47+
>
48+
<ICWarningY5 className="code-editor__status-info-icon" />
49+
{text}
50+
{children}
51+
</div>
52+
)
53+
54+
export const ErrorBar = ({ className, text, children }: CodeEditorStatusBarProps) => (
55+
<div className={`code-editor__error fs-12 fw-4 lh-16 py-8 px-16 dc__border-bottom bco-1 co-5 ${className || ''}`}>
56+
<ErrorIcon className="code-editor__status-info-icon" />
57+
{text}
58+
{children}
59+
</div>
60+
)
61+
62+
export const Information = ({ className, children, text }: CodeEditorStatusBarProps) => (
63+
<div
64+
className={`code-editor__information fs-12 fw-4 lh-16 cn-9 dc__height-auto py-8 px-16 dc__border-bottom bcb-1 ${className || ''}`}
65+
>
66+
<Info className="code-editor__status-info-icon" />
67+
{text}
68+
{children}
69+
</div>
70+
)
71+
72+
export const Clipboard = () => {
73+
const { state } = useCodeEditorContext()
74+
75+
return <ClipboardButton content={state.code} iconSize={16} />
76+
}
77+
78+
export const Container = ({ children, flexExpand }: { children: ReactNode; flexExpand?: boolean }) => (
79+
<div
80+
data-code-editor-container
81+
className={`code-editor__container w-100 dc__border br-4
82+
${flexExpand ? 'flex-grow-1 flexbox-col' : ''}`}
83+
>
84+
{children}
85+
</div>
86+
)

0 commit comments

Comments
 (0)