@ultraviolet/plus 0.1.2 → 0.2.0
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.
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { langs } from '@uiw/codemirror-extensions-langs';
|
|
3
|
+
import { material } from '@uiw/codemirror-theme-material';
|
|
4
|
+
import CodeMirror from '@uiw/react-codemirror';
|
|
5
|
+
import { Text } from '@ultraviolet/ui';
|
|
6
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const StyledText = /*#__PURE__*/_styled(Text, {
|
|
9
|
+
target: "e13pskxy0"
|
|
10
|
+
})("background-color:", _ref => {
|
|
11
|
+
let {
|
|
12
|
+
theme
|
|
13
|
+
} = _ref;
|
|
14
|
+
return theme.colors.neutral.backgroundStrong;
|
|
15
|
+
}, ";padding:", _ref2 => {
|
|
16
|
+
let {
|
|
17
|
+
theme
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return `${theme.space['1']} ${theme.space['2']}`;
|
|
20
|
+
}, ";border-radius:", _ref3 => {
|
|
21
|
+
let {
|
|
22
|
+
theme
|
|
23
|
+
} = _ref3;
|
|
24
|
+
return theme.radii.default;
|
|
25
|
+
}, ";width:100%;");
|
|
26
|
+
const CodeEditor = _ref4 => {
|
|
27
|
+
let {
|
|
28
|
+
title,
|
|
29
|
+
value,
|
|
30
|
+
onChange,
|
|
31
|
+
extensions = 'javascript',
|
|
32
|
+
onBlur,
|
|
33
|
+
height,
|
|
34
|
+
readOnly
|
|
35
|
+
} = _ref4;
|
|
36
|
+
return jsxs("div", {
|
|
37
|
+
children: [title ? jsx(StyledText, {
|
|
38
|
+
as: "h3",
|
|
39
|
+
variant: "headingSmall",
|
|
40
|
+
children: title
|
|
41
|
+
}) : null, jsx(CodeMirror, {
|
|
42
|
+
readOnly: readOnly,
|
|
43
|
+
width: "100%",
|
|
44
|
+
height: height,
|
|
45
|
+
theme: material,
|
|
46
|
+
onChange: onChange,
|
|
47
|
+
value: value,
|
|
48
|
+
extensions: [langs[extensions]()],
|
|
49
|
+
onBlur: onBlur,
|
|
50
|
+
basicSetup: {
|
|
51
|
+
highlightActiveLine: false,
|
|
52
|
+
highlightActiveLineGutter: false
|
|
53
|
+
}
|
|
54
|
+
})]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { CodeEditor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, MouseEventHandler } from 'react';
|
|
2
|
+
import { ReactNode, MouseEventHandler, ComponentProps } from 'react';
|
|
3
|
+
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
4
|
+
import { langs } from '@uiw/codemirror-extensions-langs';
|
|
5
|
+
import CodeMirror from '@uiw/react-codemirror';
|
|
3
6
|
|
|
4
7
|
type ContentCardProps = {
|
|
5
8
|
direction?: 'row' | 'column';
|
|
@@ -33,4 +36,15 @@ type ContentCardProps = {
|
|
|
33
36
|
*/
|
|
34
37
|
declare const ContentCard: react.ForwardRefExoticComponent<ContentCardProps & react.RefAttributes<HTMLAnchorElement & HTMLButtonElement & HTMLDivElement>>;
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
type CodeEditorProps = {
|
|
40
|
+
title?: string;
|
|
41
|
+
value: string;
|
|
42
|
+
onChange: ComponentProps<typeof CodeMirror>['onChange'];
|
|
43
|
+
extensions: keyof typeof langs;
|
|
44
|
+
onBlur?: () => void;
|
|
45
|
+
height?: string;
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
};
|
|
48
|
+
declare const CodeEditor: ({ title, value, onChange, extensions, onBlur, height, readOnly, }: CodeEditorProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
|
+
export { CodeEditor, ContentCard };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/plus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Ultraviolet Plus",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -38,21 +38,23 @@
|
|
|
38
38
|
"react-dom": "18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "7.23.
|
|
41
|
+
"@babel/core": "7.23.2",
|
|
42
42
|
"@emotion/babel-plugin": "11.11.0",
|
|
43
|
-
"@types/react": "18.2.
|
|
44
|
-
"@types/react-dom": "18.2.
|
|
45
|
-
"@ultraviolet/icons": "2.
|
|
43
|
+
"@types/react": "18.2.28",
|
|
44
|
+
"@types/react-dom": "18.2.13",
|
|
45
|
+
"@ultraviolet/icons": "2.4.1"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@formatjs/ecma402-abstract": "1.17.2",
|
|
49
49
|
"@formatjs/fast-memoize": "2.2.0",
|
|
50
|
+
"@uiw/codemirror-extensions-langs": "4.21.20",
|
|
51
|
+
"@uiw/codemirror-theme-material": "4.21.20",
|
|
52
|
+
"@uiw/react-codemirror": "4.21.20",
|
|
50
53
|
"deepmerge": "4.3.1",
|
|
51
|
-
"
|
|
52
|
-
"intl-messageformat": "10.5.3",
|
|
54
|
+
"intl-messageformat": "10.5.4",
|
|
53
55
|
"react-flatten-children": "1.1.2",
|
|
54
56
|
"react-intersection-observer": "9.5.2",
|
|
55
57
|
"@ultraviolet/themes": "1.2.1",
|
|
56
|
-
"@ultraviolet/ui": "1.
|
|
58
|
+
"@ultraviolet/ui": "1.20.0"
|
|
57
59
|
}
|
|
58
60
|
}
|