@synerise/ds-code-area 1.3.1 → 1.3.3
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/CHANGELOG.md +8 -0
- package/README.md +3 -1
- package/dist/CodeArea.d.ts +2 -2
- package/dist/CodeArea.figma.d.ts +1 -0
- package/dist/CodeArea.figma.js +68 -0
- package/dist/CodeArea.js +31 -29
- package/dist/CodeArea.styles.d.ts +24 -24
- package/dist/CodeArea.styles.js +62 -55
- package/dist/CodeArea.types.d.ts +4 -4
- package/dist/CodeArea.types.js +1 -1
- package/dist/components/AriaContainer.d.ts +1 -1
- package/dist/components/AriaContainer.js +14 -13
- package/dist/components/BottomBar.d.ts +2 -2
- package/dist/components/BottomBar.js +25 -28
- package/dist/components/CodeAreaEditor.d.ts +5 -5
- package/dist/components/CodeAreaEditor.js +81 -104
- package/dist/components/CodeAreaEditorRaw.d.ts +2 -2
- package/dist/components/CodeAreaEditorRaw.js +118 -142
- package/dist/components/ContentAbove.d.ts +1 -1
- package/dist/components/ContentAbove.js +14 -11
- package/dist/components/ContentBelow.d.ts +2 -2
- package/dist/components/ContentBelow.js +22 -20
- package/dist/components/FullscreenHeader.d.ts +2 -2
- package/dist/components/FullscreenHeader.js +20 -21
- package/dist/components/index.js +14 -6
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +23 -17
- package/dist/index.js +25 -2
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/calculateRequiredSpace.js +8 -5
- package/dist/utils/getCharCount.js +6 -3
- package/dist/utils/getDefaultTexts.d.ts +1 -1
- package/dist/utils/getDefaultTexts.js +15 -19
- package/dist/utils/index.js +8 -3
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-area@1.3.2...@synerise/ds-code-area@1.3.3) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-code-area
|
|
9
|
+
|
|
10
|
+
## [1.3.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-area@1.3.1...@synerise/ds-code-area@1.3.2) (2026-03-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-code-area
|
|
13
|
+
|
|
6
14
|
## [1.3.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-area@1.3.0...@synerise/ds-code-area@1.3.1) (2026-03-09)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ const syntaxOptions = [
|
|
|
55
55
|
| allowFullscreen | renders fullscreen mode button | `boolean` | - |
|
|
56
56
|
| readOnly | renders readOnly mode | `boolean` | - |
|
|
57
57
|
| tooltip | tooltip text displayed next to label | `ReactNode` | - |
|
|
58
|
-
| tooltipProps | tooltip properties (see @synerise/ds-tooltip) | `
|
|
58
|
+
| tooltipProps | tooltip properties (see @synerise/ds-tooltip) | `TooltipProps` | - |
|
|
59
59
|
| style | custom style added to outermost div | `CSSProperties` | - |
|
|
60
60
|
| className | class name to add to outermost div | `string` | - |
|
|
61
61
|
| renderFooterContent | renders custom content in footer bar | `(CodeAreaStateProps) => ReactNode` | - |
|
|
@@ -66,6 +66,8 @@ const syntaxOptions = [
|
|
|
66
66
|
| getPopupContainer | customise where fullscreen layer is rendered into | getPopupContainer (@synerise/ds-utils) | - |
|
|
67
67
|
| placeholder | placeholder content | `ReactNode` | - |
|
|
68
68
|
| noBorder | remove border from wrapper | `boolean` | - |
|
|
69
|
+
| height | height of the editor wrapper | `string \| number` | `295px` |
|
|
70
|
+
| zIndex | z-index of the fullscreen overlay | `string \| number` | `zindex-modal` token |
|
|
69
71
|
|
|
70
72
|
### CodeAreaTexts
|
|
71
73
|
|
package/dist/CodeArea.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CodeAreaProps } from './CodeArea.types';
|
|
3
3
|
declare const CodeArea: ({ getPopupContainer, onFullscreenChange, ...codeAreaProps }: CodeAreaProps) => React.JSX.Element;
|
|
4
4
|
export default CodeArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import CodeArea from "./CodeArea.js";
|
|
4
|
+
const FIGMA_URL = "https://www.figma.com/design/fsSZONXpVvtrDsCgtu01Jb/Synerise-Design-System?node-id=3143:21126&m=dev";
|
|
5
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
6
|
+
variant: {
|
|
7
|
+
State: "Default",
|
|
8
|
+
Label: "True",
|
|
9
|
+
Border: "True"
|
|
10
|
+
},
|
|
11
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { label: "Label", description: "Description", currentSyntax: "json", value: "" })
|
|
12
|
+
});
|
|
13
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
14
|
+
variant: {
|
|
15
|
+
State: "Default",
|
|
16
|
+
Label: "False",
|
|
17
|
+
Border: "True"
|
|
18
|
+
},
|
|
19
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "" })
|
|
20
|
+
});
|
|
21
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
22
|
+
variant: {
|
|
23
|
+
State: "Default",
|
|
24
|
+
Label: "False",
|
|
25
|
+
Border: "False"
|
|
26
|
+
},
|
|
27
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "", noBorder: true })
|
|
28
|
+
});
|
|
29
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
30
|
+
variant: {
|
|
31
|
+
State: "Validated",
|
|
32
|
+
Label: "True",
|
|
33
|
+
Border: "True"
|
|
34
|
+
},
|
|
35
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { label: "Label", description: "Description", currentSyntax: "json", value: "", errorText: "Fill Code area" })
|
|
36
|
+
});
|
|
37
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
38
|
+
variant: {
|
|
39
|
+
State: "Validated",
|
|
40
|
+
Label: "False",
|
|
41
|
+
Border: "True"
|
|
42
|
+
},
|
|
43
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "", errorText: "Fill Code area" })
|
|
44
|
+
});
|
|
45
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
46
|
+
variant: {
|
|
47
|
+
State: "Validated",
|
|
48
|
+
Label: "False",
|
|
49
|
+
Border: "False"
|
|
50
|
+
},
|
|
51
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "", errorText: "Fill Code area", noBorder: true })
|
|
52
|
+
});
|
|
53
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
54
|
+
variant: {
|
|
55
|
+
State: "Read only",
|
|
56
|
+
Label: "False",
|
|
57
|
+
Border: "True"
|
|
58
|
+
},
|
|
59
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "", readOnly: true })
|
|
60
|
+
});
|
|
61
|
+
figma.connect(CodeArea, FIGMA_URL, {
|
|
62
|
+
variant: {
|
|
63
|
+
State: "Read only",
|
|
64
|
+
Label: "False",
|
|
65
|
+
Border: "False"
|
|
66
|
+
},
|
|
67
|
+
example: () => /* @__PURE__ */ jsx(CodeArea, { currentSyntax: "json", value: "", readOnly: true, noBorder: true })
|
|
68
|
+
});
|
package/dist/CodeArea.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { getPopupContainer } from "@synerise/ds-utils";
|
|
5
|
+
import "styled-components";
|
|
6
|
+
import "@synerise/ds-typography";
|
|
7
|
+
import "./components/ContentBelow.js";
|
|
8
|
+
import "@synerise/ds-button";
|
|
9
|
+
import "@synerise/ds-icon";
|
|
10
|
+
import "@monaco-editor/react";
|
|
11
|
+
import "@synerise/ds-inline-edit";
|
|
12
|
+
import "@synerise/ds-loader";
|
|
13
|
+
import "./constants.js";
|
|
14
|
+
import "react-intl";
|
|
15
|
+
import { CodeAreaEditor } from "./components/CodeAreaEditor.js";
|
|
16
|
+
const CodeArea = ({
|
|
17
|
+
getPopupContainer: getPopupContainer$1 = getPopupContainer,
|
|
18
|
+
onFullscreenChange,
|
|
19
|
+
...codeAreaProps
|
|
20
|
+
}) => {
|
|
21
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
22
|
+
const wrapperRef = useRef(null);
|
|
23
|
+
const toggleFullscreen = () => {
|
|
24
|
+
setIsFullscreen((prevState) => !prevState);
|
|
21
25
|
onFullscreenChange && onFullscreenChange(isFullscreen);
|
|
22
26
|
};
|
|
23
|
-
return
|
|
24
|
-
toggleFullscreen:
|
|
25
|
-
isFullscreen
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})), getPopupContainer(wrapperRef.current)));
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(CodeAreaEditor, { ...codeAreaProps, toggleFullscreen, isFullscreen: false, ref: wrapperRef }),
|
|
29
|
+
wrapperRef.current && isFullscreen && createPortal(/* @__PURE__ */ jsx(CodeAreaEditor, { ...codeAreaProps, toggleFullscreen, isFullscreen }), getPopupContainer$1(wrapperRef.current))
|
|
30
|
+
] });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
CodeArea as default
|
|
31
34
|
};
|
|
32
|
-
export default CodeArea;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
export declare const AriaContainer: import(
|
|
2
|
-
export declare const EditorPlaceholder: import(
|
|
1
|
+
export declare const AriaContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const EditorPlaceholder: import('styled-components').StyledComponent<"div", any, {
|
|
3
3
|
shouldShowPlaceholder?: boolean;
|
|
4
4
|
}, never>;
|
|
5
|
-
export declare const EditorInnerWrapper: import(
|
|
6
|
-
export declare const CodeAreaContent: import(
|
|
7
|
-
export declare const EditorWrapper: import(
|
|
5
|
+
export declare const EditorInnerWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const CodeAreaContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const EditorWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
8
8
|
hasError: boolean;
|
|
9
9
|
noBorder?: boolean;
|
|
10
10
|
}, never>;
|
|
11
|
-
export declare const FullscreenHeaderTitle: import(
|
|
12
|
-
export declare const FullscreenHeader: import(
|
|
13
|
-
export declare const CodeAreaWrapper: import(
|
|
11
|
+
export declare const FullscreenHeaderTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
|
12
|
+
export declare const FullscreenHeader: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const CodeAreaWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
14
14
|
readOnly: boolean;
|
|
15
15
|
isFullscreen: boolean;
|
|
16
16
|
requiredSpace: number;
|
|
17
17
|
customHeight?: number | string;
|
|
18
18
|
zIndex?: number | string;
|
|
19
19
|
}, never>;
|
|
20
|
-
export declare const AdditionalDescription: import(
|
|
21
|
-
export declare const ContentBelow: import(
|
|
20
|
+
export declare const AdditionalDescription: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
21
|
+
export declare const ContentBelow: import('styled-components').StyledComponent<"div", any, {
|
|
22
22
|
isEmpty?: boolean;
|
|
23
23
|
}, never>;
|
|
24
|
-
export declare const ContentAbove: import(
|
|
25
|
-
export declare const SyntaxTitle: import(
|
|
26
|
-
size?: import(
|
|
27
|
-
ellipsis?: import(
|
|
28
|
-
children?: import(
|
|
24
|
+
export declare const ContentAbove: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
25
|
+
export declare const SyntaxTitle: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
26
|
+
size?: import('@synerise/ds-typography').TextSize;
|
|
27
|
+
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
28
|
+
children?: import('react').ReactNode;
|
|
29
29
|
className?: string;
|
|
30
|
-
style?: import(
|
|
30
|
+
style?: import('react').CSSProperties;
|
|
31
31
|
}) => React.JSX.Element, any, {}, never>;
|
|
32
|
-
export declare const BottomBar: import(
|
|
32
|
+
export declare const BottomBar: import('styled-components').StyledComponent<"div", any, {
|
|
33
33
|
noBorder?: boolean;
|
|
34
34
|
hasError?: boolean;
|
|
35
35
|
}, never>;
|
|
36
|
-
export declare const LeftSide: import(
|
|
37
|
-
export declare const RightSide: import(
|
|
38
|
-
export declare const SyntaxSelect: import(
|
|
39
|
-
export declare const BottomBarElement: import(
|
|
40
|
-
export declare const Description: import(
|
|
41
|
-
export declare const Counter: import(
|
|
42
|
-
export declare const ErrorText: import(
|
|
36
|
+
export declare const LeftSide: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
37
|
+
export declare const RightSide: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
38
|
+
export declare const SyntaxSelect: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
39
|
+
export declare const BottomBarElement: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
40
|
+
export declare const Description: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
41
|
+
export declare const Counter: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
42
|
+
export declare const ErrorText: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/CodeArea.styles.js
CHANGED
|
@@ -1,114 +1,121 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { Title, Text } from "@synerise/ds-typography";
|
|
3
|
+
const FlexRow = /* @__PURE__ */ styled.div.withConfig({
|
|
4
4
|
displayName: "CodeAreastyles__FlexRow",
|
|
5
5
|
componentId: "sc-svoej2-0"
|
|
6
6
|
})(["display:flex;justify-content:space-between;align-items:center;"]);
|
|
7
|
-
|
|
7
|
+
const AriaContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "CodeAreastyles__AriaContainer",
|
|
9
9
|
componentId: "sc-svoej2-1"
|
|
10
10
|
})(["flex:0 0 0;"]);
|
|
11
|
-
|
|
11
|
+
const EditorPlaceholder = /* @__PURE__ */ styled.div.withConfig({
|
|
12
12
|
displayName: "CodeAreastyles__EditorPlaceholder",
|
|
13
13
|
componentId: "sc-svoej2-2"
|
|
14
|
-
})(["pointer-events:none;position:absolute;left:62px;right:0;top:0;bottom:0;display:", ";"],
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
export var EditorInnerWrapper = styled.div.withConfig({
|
|
14
|
+
})(["pointer-events:none;position:absolute;left:62px;right:0;top:0;bottom:0;display:", ";"], (props) => props.shouldShowPlaceholder ? "block" : "none");
|
|
15
|
+
const EditorInnerWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
18
16
|
displayName: "CodeAreastyles__EditorInnerWrapper",
|
|
19
17
|
componentId: "sc-svoej2-3"
|
|
20
18
|
})(["position:relative;"]);
|
|
21
|
-
|
|
19
|
+
const CodeAreaContent = /* @__PURE__ */ styled.div.withConfig({
|
|
22
20
|
displayName: "CodeAreastyles__CodeAreaContent",
|
|
23
21
|
componentId: "sc-svoej2-4"
|
|
24
22
|
})(["flex:1 1 100%;display:flex;min-height:0;flex-direction:column;"]);
|
|
25
|
-
|
|
23
|
+
const EditorWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
26
24
|
displayName: "CodeAreastyles__EditorWrapper",
|
|
27
25
|
componentId: "sc-svoej2-5"
|
|
28
|
-
})(["border:", ";border-radius:3px;display:flex;flex-direction:column;flex:1 1 100%;min-height:0;padding-top:12px;", ";canvas{opacity:0;}"],
|
|
29
|
-
|
|
30
|
-
}, function (props) {
|
|
31
|
-
return props.hasError && css(["background:", ";box-shadow:", ";"], props.theme.palette['red-050'], props.noBorder ? 'none' : "inset 0 0 0 1px " + props.theme.palette['red-600']);
|
|
32
|
-
});
|
|
33
|
-
export var FullscreenHeaderTitle = styled(Title).withConfig({
|
|
26
|
+
})(["border:", ";border-radius:3px;display:flex;flex-direction:column;flex:1 1 100%;min-height:0;padding-top:12px;", ";canvas{opacity:0;}"], (props) => props.noBorder ? "none" : `solid 1px ${props.hasError ? props.theme.palette["red-600"] : props.theme.palette["grey-200"]}`, (props) => props.hasError && css(["background:", ";box-shadow:", ";"], props.theme.palette["red-050"], props.noBorder ? "none" : `inset 0 0 0 1px ${props.theme.palette["red-600"]}`));
|
|
27
|
+
const FullscreenHeaderTitle = /* @__PURE__ */ styled(Title).withConfig({
|
|
34
28
|
displayName: "CodeAreastyles__FullscreenHeaderTitle",
|
|
35
29
|
componentId: "sc-svoej2-6"
|
|
36
30
|
})(["display:flex;gap:16px;align-items:center;margin-bottom:0;"]);
|
|
37
|
-
|
|
31
|
+
const FullscreenHeader = /* @__PURE__ */ styled(FlexRow).withConfig({
|
|
38
32
|
displayName: "CodeAreastyles__FullscreenHeader",
|
|
39
33
|
componentId: "sc-svoej2-7"
|
|
40
34
|
})(["padding:16px 24px;"]);
|
|
41
|
-
|
|
35
|
+
const CodeAreaWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
42
36
|
displayName: "CodeAreastyles__CodeAreaWrapper",
|
|
43
37
|
componentId: "sc-svoej2-8"
|
|
44
|
-
})(["", " ", "{", ";}"],
|
|
38
|
+
})(["", " ", "{", ";}"], (props) => {
|
|
45
39
|
if (props.isFullscreen) {
|
|
46
|
-
return css(["position:fixed;width:100vw;height:100vh;z-index:", ";left:0;top:0;background:", ";", "{height:calc(100vh - ", "px);}", "{margin:0 24px;}"], props.zIndex !==
|
|
40
|
+
return css(["position:fixed;width:100vw;height:100vh;z-index:", ";left:0;top:0;background:", ";", "{height:calc(100vh - ", "px);}", "{margin:0 24px;}"], props.zIndex !== void 0 ? props.zIndex : props.theme.variables["zindex-modal"], props.theme.palette.white, EditorInnerWrapper, props.requiredSpace, CodeAreaContent);
|
|
47
41
|
}
|
|
48
|
-
return css(["", " display:flex;flex-direction:column;margin-bottom:12px;"], props.customHeight ? css(["", "{flex:1 1 100%;min-height:0;}height:", ";"], EditorInnerWrapper, typeof props.customHeight ===
|
|
49
|
-
}, EditorWrapper,
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
export var AdditionalDescription = styled.div.withConfig({
|
|
42
|
+
return css(["", " display:flex;flex-direction:column;margin-bottom:12px;"], props.customHeight ? css(["", "{flex:1 1 100%;min-height:0;}height:", ";"], EditorInnerWrapper, typeof props.customHeight === "number" ? `${props.customHeight}px` : props.customHeight) : css(["", "{height:295px;}"], EditorInnerWrapper));
|
|
43
|
+
}, EditorWrapper, (props) => props.readOnly && css(["background:", ";.monaco-editor .cursors-layer > .cursor{display:none !important;}"], props.theme.palette["grey-050"]));
|
|
44
|
+
const AdditionalDescription = /* @__PURE__ */ styled.div.withConfig({
|
|
53
45
|
displayName: "CodeAreastyles__AdditionalDescription",
|
|
54
46
|
componentId: "sc-svoej2-9"
|
|
55
47
|
})(["margin-bottom:8px;"]);
|
|
56
|
-
|
|
48
|
+
const ContentBelow = /* @__PURE__ */ styled(FlexRow).withConfig({
|
|
57
49
|
displayName: "CodeAreastyles__ContentBelow",
|
|
58
50
|
componentId: "sc-svoej2-10"
|
|
59
|
-
})(["", " align-items:flex-start;"],
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
export var ContentAbove = styled(FlexRow).withConfig({
|
|
51
|
+
})(["", " align-items:flex-start;"], (props) => !props.isEmpty && `margin-top: 8px;`);
|
|
52
|
+
const ContentAbove = /* @__PURE__ */ styled(FlexRow).withConfig({
|
|
63
53
|
displayName: "CodeAreastyles__ContentAbove",
|
|
64
54
|
componentId: "sc-svoej2-11"
|
|
65
55
|
})(["margin-bottom:8px;flex:0 0 auto;"]);
|
|
66
|
-
|
|
56
|
+
const SyntaxTitle = /* @__PURE__ */ styled(Text).withConfig({
|
|
67
57
|
displayName: "CodeAreastyles__SyntaxTitle",
|
|
68
58
|
componentId: "sc-svoej2-12"
|
|
69
59
|
})([""]);
|
|
70
|
-
|
|
60
|
+
const BottomBar = /* @__PURE__ */ styled(FlexRow).withConfig({
|
|
71
61
|
displayName: "CodeAreastyles__BottomBar",
|
|
72
62
|
componentId: "sc-svoej2-13"
|
|
73
|
-
})(["padding:8px;flex:0 0 auto;background:", ";border-top:solid 1px ", ";", ""],
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return hasError && css(["background:", ";", ""], theme.palette['red-050'], noBorder ? css(["border:none;border-top:solid 1px ", ";"], theme.palette['grey-200']) : css(["border:solid 1px ", ";border-top-color:", ";"], theme.palette['red-600'], theme.palette['grey-200']));
|
|
84
|
-
});
|
|
85
|
-
export var LeftSide = styled.div.withConfig({
|
|
63
|
+
})(["padding:8px;flex:0 0 auto;background:", ";border-top:solid 1px ", ";", ""], ({
|
|
64
|
+
theme
|
|
65
|
+
}) => theme.palette["white"], ({
|
|
66
|
+
theme
|
|
67
|
+
}) => theme.palette["grey-200"], ({
|
|
68
|
+
hasError,
|
|
69
|
+
noBorder,
|
|
70
|
+
theme
|
|
71
|
+
}) => hasError && css(["background:", ";", ""], theme.palette["red-050"], noBorder ? css(["border:none;border-top:solid 1px ", ";"], theme.palette["grey-200"]) : css(["border:solid 1px ", ";border-top-color:", ";"], theme.palette["red-600"], theme.palette["grey-200"])));
|
|
72
|
+
const LeftSide = /* @__PURE__ */ styled.div.withConfig({
|
|
86
73
|
displayName: "CodeAreastyles__LeftSide",
|
|
87
74
|
componentId: "sc-svoej2-14"
|
|
88
75
|
})([""]);
|
|
89
|
-
|
|
76
|
+
const RightSide = /* @__PURE__ */ styled.div.withConfig({
|
|
90
77
|
displayName: "CodeAreastyles__RightSide",
|
|
91
78
|
componentId: "sc-svoej2-15"
|
|
92
79
|
})(["margin-left:auto;display:flex;gap:8px;"]);
|
|
93
|
-
|
|
80
|
+
const SyntaxSelect = /* @__PURE__ */ styled(LeftSide).withConfig({
|
|
94
81
|
displayName: "CodeAreastyles__SyntaxSelect",
|
|
95
82
|
componentId: "sc-svoej2-16"
|
|
96
83
|
})(["padding-left:8px;"]);
|
|
97
|
-
|
|
84
|
+
const BottomBarElement = /* @__PURE__ */ styled.div.withConfig({
|
|
98
85
|
displayName: "CodeAreastyles__BottomBarElement",
|
|
99
86
|
componentId: "sc-svoej2-17"
|
|
100
87
|
})([""]);
|
|
101
|
-
|
|
88
|
+
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
102
89
|
displayName: "CodeAreastyles__Description",
|
|
103
90
|
componentId: "sc-svoej2-18"
|
|
104
91
|
})([""]);
|
|
105
|
-
|
|
92
|
+
const Counter = /* @__PURE__ */ styled.div.withConfig({
|
|
106
93
|
displayName: "CodeAreastyles__Counter",
|
|
107
94
|
componentId: "sc-svoej2-19"
|
|
108
95
|
})(["font-weight:500;"]);
|
|
109
|
-
|
|
96
|
+
const ErrorText = /* @__PURE__ */ styled.div.withConfig({
|
|
110
97
|
displayName: "CodeAreastyles__ErrorText",
|
|
111
98
|
componentId: "sc-svoej2-20"
|
|
112
|
-
})(["color:", ";margin-bottom:4px;"],
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
})(["color:", ";margin-bottom:4px;"], (props) => props.theme.palette["red-600"]);
|
|
100
|
+
export {
|
|
101
|
+
AdditionalDescription,
|
|
102
|
+
AriaContainer,
|
|
103
|
+
BottomBar,
|
|
104
|
+
BottomBarElement,
|
|
105
|
+
CodeAreaContent,
|
|
106
|
+
CodeAreaWrapper,
|
|
107
|
+
ContentAbove,
|
|
108
|
+
ContentBelow,
|
|
109
|
+
Counter,
|
|
110
|
+
Description,
|
|
111
|
+
EditorInnerWrapper,
|
|
112
|
+
EditorPlaceholder,
|
|
113
|
+
EditorWrapper,
|
|
114
|
+
ErrorText,
|
|
115
|
+
FullscreenHeader,
|
|
116
|
+
FullscreenHeaderTitle,
|
|
117
|
+
LeftSide,
|
|
118
|
+
RightSide,
|
|
119
|
+
SyntaxSelect,
|
|
120
|
+
SyntaxTitle
|
|
121
|
+
};
|
package/dist/CodeArea.types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { editor } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { EditorProps, loader } from '@monaco-editor/react';
|
|
4
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
5
5
|
export type CodeAreaSyntax = 'json' | 'html' | 'css' | 'typescript' | 'javascript' | string;
|
|
6
6
|
export type CodeAreaSyntaxOption<SyntaxName extends CodeAreaSyntax = CodeAreaSyntax> = {
|
|
7
7
|
language: SyntaxName;
|
package/dist/CodeArea.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
import { AriaContainer as AriaContainer$1 } from "../CodeArea.styles.js";
|
|
4
|
+
const AriaContainer = ({
|
|
5
|
+
element
|
|
6
|
+
}) => {
|
|
7
|
+
const ariaContainerRef = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const container = ariaContainerRef.current;
|
|
8
10
|
if (container && element.childNodes.length > 0) {
|
|
9
11
|
container.appendChild(element);
|
|
10
12
|
}
|
|
11
13
|
}, [element]);
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
14
|
+
return /* @__PURE__ */ jsx(AriaContainer$1, { className: "monaco-aria-custom-container", "data-testid": "monaco-aria-container", ref: ariaContainerRef });
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
AriaContainer
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
import {
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { CodeAreaTexts } from '../CodeArea.types';
|
|
3
3
|
type BottomBarProps = {
|
|
4
4
|
texts: CodeAreaTexts;
|
|
5
5
|
allowFullscreen?: boolean;
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from
|
|
3
|
-
import Icon, { FullScreenM } from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"data-testid": "code-area-syntaxoptions"
|
|
27
|
-
}, syntaxSelect), (customFooterContent || fullscreenButton) && /*#__PURE__*/React.createElement(S.RightSide, null, customFooterContent, fullscreenButton));
|
|
28
|
-
};
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import Icon, { FullScreenM } from "@synerise/ds-icon";
|
|
4
|
+
import { BottomBar as BottomBar$1, SyntaxSelect, RightSide } from "../CodeArea.styles.js";
|
|
5
|
+
const BottomBar = ({
|
|
6
|
+
texts,
|
|
7
|
+
syntaxSelect,
|
|
8
|
+
customFooterContent,
|
|
9
|
+
allowFullscreen,
|
|
10
|
+
toggleFullscreen,
|
|
11
|
+
noBorder,
|
|
12
|
+
hasError
|
|
13
|
+
}) => {
|
|
14
|
+
const fullscreenButton = allowFullscreen && /* @__PURE__ */ jsx(Button, { type: "ghost", mode: "icon-label", icon: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(FullScreenM, {}) }), onClick: toggleFullscreen, children: texts.fullscreen });
|
|
15
|
+
return /* @__PURE__ */ jsxs(BottomBar$1, { noBorder, hasError, "data-testid": "code-area-bottombar", children: [
|
|
16
|
+
syntaxSelect && /* @__PURE__ */ jsx(SyntaxSelect, { "data-testid": "code-area-syntaxoptions", children: syntaxSelect }),
|
|
17
|
+
(customFooterContent || fullscreenButton) && /* @__PURE__ */ jsxs(RightSide, { children: [
|
|
18
|
+
customFooterContent,
|
|
19
|
+
fullscreenButton
|
|
20
|
+
] })
|
|
21
|
+
] });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
BottomBar
|
|
25
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const CodeAreaEditor: React.ForwardRefExoticComponent<Omit<import(
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const CodeAreaEditor: React.ForwardRefExoticComponent<Omit<import('@monaco-editor/react').EditorProps, "language" | "height"> & {
|
|
3
3
|
label?: React.ReactNode;
|
|
4
4
|
description?: React.ReactNode;
|
|
5
|
-
texts?: Partial<import(
|
|
5
|
+
texts?: Partial<import('../CodeArea.types').CodeAreaTexts>;
|
|
6
6
|
counter?: {
|
|
7
7
|
limit: number;
|
|
8
8
|
placement?: "bottom" | "top";
|
|
9
9
|
};
|
|
10
10
|
errorText?: React.ReactNode;
|
|
11
|
-
syntaxOptions?: import(
|
|
11
|
+
syntaxOptions?: import('../CodeArea.types').CodeAreaSyntaxOption<string>[] | undefined;
|
|
12
12
|
currentSyntax: string;
|
|
13
13
|
allowFullscreen?: boolean;
|
|
14
14
|
isFullscreen: boolean;
|
|
@@ -18,7 +18,7 @@ export declare const CodeAreaEditor: React.ForwardRefExoticComponent<Omit<import
|
|
|
18
18
|
defaultValue?: string;
|
|
19
19
|
readOnly?: boolean;
|
|
20
20
|
tooltip?: React.ReactNode;
|
|
21
|
-
tooltipProps?: import(
|
|
21
|
+
tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
|
|
22
22
|
style?: React.CSSProperties;
|
|
23
23
|
zIndex?: string | number;
|
|
24
24
|
noBorder?: boolean;
|