Skip to content

Commit 7719ca0

Browse files
feat: allow code fields without label (#106)
* feat: allow code fields without label * bump minor version --------- Co-authored-by: Stanislav <[email protected]>
1 parent 79c8e96 commit 7719ca0

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cloudquery/plugin-config-ui-lib",
33
"description": "Plugin configuration UI library for CloudQuery Cloud App",
4-
"version": "11.0.0",
4+
"version": "11.1.0",
55
"private": false,
66
"main": "dist/index.cjs.js",
77
"module": "dist/index.esm.js",

src/components/form/controls/controlCodeField.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ export const ControlCodeField = forwardRef<MonacoEditor, ControlCodeFieldProps>(
108108
paddingY: 1,
109109
paddingX: 1.5,
110110
bgcolor: '#15202E',
111+
...(!label && {
112+
'& .monaco-editor': {
113+
outline: 'none',
114+
},
115+
}),
111116
}}
112117
>
113118
{!!label && <FormLabel sx={{ mb: 1 }}>{label}</FormLabel>}

src/context/utils/validateConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const isReservedLayoutComponent = (componentName: string) =>
1616
['control-table-selector', 'control-oauth', 'control-services-selector'].includes(componentName);
1717

1818
const componentRequiresLabel = (componentName: string) =>
19-
!['control-exclusive-toggle', 'control-services-selector'].includes(componentName);
19+
!['control-exclusive-toggle', 'control-services-selector', 'control-code-field'].includes(
20+
componentName,
21+
);
2022

2123
function checkForDuplicateNames(names: string[]): string[] {
2224
return names.filter((e, i, a) => a.indexOf(e) !== i);

src/stories/component-stories/CodeField.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Stack } from '@mui/material';
2+
13
import { ControlCodeField } from '../../components/form/controls/controlCodeField.js';
24
import { LayoutCodeField } from '../../components/form/renderer/types.js';
35
import { ComponentWrapper } from '../wrappers/component.js';
@@ -33,3 +35,18 @@ export const Primary = {
3335
),
3436
args: {},
3537
};
38+
39+
export const WithoutLabel = {
40+
render: () => (
41+
<Stack>
42+
<ComponentWrapper
43+
args={{
44+
component: 'control-code-field',
45+
name: 'option',
46+
}}
47+
yupBase="string().default(initialValues?.spec?.yaml || '')"
48+
/>
49+
</Stack>
50+
),
51+
args: {},
52+
};

0 commit comments

Comments
 (0)