@coveord/plasma-mantine 47.4.0 → 47.5.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.
Files changed (33) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +8 -8
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/code-editor/CodeEditor.js +50 -12
  5. package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
  6. package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js +24 -0
  7. package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js.map +1 -0
  8. package/dist/cjs/components/modal-wizard/index.js.map +1 -1
  9. package/dist/cjs/index.js +0 -3
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/definitions/components/code-editor/CodeEditor.d.ts +7 -0
  12. package/dist/definitions/components/code-editor/CodeEditor.d.ts.map +1 -1
  13. package/dist/definitions/components/code-editor/__mocks__/monaco-editor.d.ts +8 -0
  14. package/dist/definitions/components/code-editor/__mocks__/monaco-editor.d.ts.map +1 -0
  15. package/dist/definitions/components/modal-wizard/index.d.ts +1 -0
  16. package/dist/definitions/components/modal-wizard/index.d.ts.map +1 -1
  17. package/dist/definitions/index.d.ts +1 -1
  18. package/dist/definitions/index.d.ts.map +1 -1
  19. package/dist/esm/components/code-editor/CodeEditor.js +49 -13
  20. package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
  21. package/dist/esm/components/code-editor/__mocks__/monaco-editor.js +14 -0
  22. package/dist/esm/components/code-editor/__mocks__/monaco-editor.js.map +1 -0
  23. package/dist/esm/components/modal-wizard/index.js.map +1 -1
  24. package/dist/esm/index.js +1 -1
  25. package/dist/esm/index.js.map +1 -1
  26. package/jest.config.js +0 -1
  27. package/package.json +3 -2
  28. package/src/components/code-editor/CodeEditor.tsx +32 -5
  29. package/src/components/code-editor/__mocks__/monaco-editor.ts +9 -0
  30. package/src/components/code-editor/__tests__/CodeEditor.spec.tsx +24 -5
  31. package/src/components/modal-wizard/index.ts +1 -0
  32. package/src/index.ts +1 -1
  33. package/tsconfig.json +6 -3
@@ -20,11 +20,8 @@ var _plasmaReactIcons = require("@coveord/plasma-react-icons");
20
20
  var _core = require("@mantine/core");
21
21
  var _hooks = require("@mantine/hooks");
22
22
  var _react = /*#__PURE__*/ _interopRequireWildcard(require("@monaco-editor/react"));
23
- var _monacoEditor = /*#__PURE__*/ _interopRequireWildcard(require("monaco-editor"));
23
+ var _react1 = require("react");
24
24
  var _hooks1 = require("../../hooks");
25
- _react.loader.config({
26
- monaco: _monacoEditor
27
- });
28
25
  var useStyles = (0, _core.createStyles)(function(theme) {
29
26
  return {
30
27
  root: {},
@@ -38,11 +35,12 @@ var useStyles = (0, _core.createStyles)(function(theme) {
38
35
  });
39
36
  var defaultProps = {
40
37
  language: "plaintext",
38
+ monacoLoader: "local",
41
39
  defaultValue: "",
42
40
  minHeight: 300
43
41
  };
44
42
  var CodeEditor = function(props) {
45
- var _ref = (0, _core.useComponentDefaultProps)("CodeEditor", defaultProps, props), language = _ref.language, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onFocus = _ref.onFocus, value = _ref.value, label = _ref.label, required = _ref.required, labelProps = _ref.labelProps, error = _ref.error, errorProps = _ref.errorProps, description = _ref.description, descriptionProps = _ref.descriptionProps, minHeight = _ref.minHeight, maxHeight = _ref.maxHeight, disabled = _ref.disabled, others = _objectWithoutProperties(_ref, [
43
+ var _ref = (0, _core.useComponentDefaultProps)("CodeEditor", defaultProps, props), language = _ref.language, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onFocus = _ref.onFocus, value = _ref.value, label = _ref.label, required = _ref.required, labelProps = _ref.labelProps, error = _ref.error, errorProps = _ref.errorProps, description = _ref.description, descriptionProps = _ref.descriptionProps, minHeight = _ref.minHeight, maxHeight = _ref.maxHeight, disabled = _ref.disabled, monacoLoader = _ref.monacoLoader, others = _objectWithoutProperties(_ref, [
46
44
  "language",
47
45
  "defaultValue",
48
46
  "onChange",
@@ -57,16 +55,53 @@ var CodeEditor = function(props) {
57
55
  "descriptionProps",
58
56
  "minHeight",
59
57
  "maxHeight",
60
- "disabled"
58
+ "disabled",
59
+ "monacoLoader"
61
60
  ]);
62
- var ref = useStyles(), classes = ref.classes, theme = ref.theme;
63
- var ref1 = _slicedToArray((0, _hooks.useUncontrolled)({
61
+ var ref = _slicedToArray((0, _react1.useState)(false), 2), loaded = ref[0], setLoaded = ref[1];
62
+ var ref1 = useStyles(), classes = ref1.classes, theme = ref1.theme;
63
+ var ref2 = _slicedToArray((0, _hooks.useUncontrolled)({
64
64
  value: value,
65
65
  defaultValue: defaultValue,
66
66
  onChange: onChange,
67
67
  finalValue: ""
68
- }), 2), _value = ref1[0], handleChange = ref1[1];
69
- var ref2 = _slicedToArray((0, _hooks1.useParentHeight)(), 2), parentHeight = ref2[0], ref3 = ref2[1];
68
+ }), 2), _value = ref2[0], handleChange = ref2[1];
69
+ var ref3 = _slicedToArray((0, _hooks1.useParentHeight)(), 2), parentHeight = ref3[0], ref4 = ref3[1];
70
+ var loadLocalMonaco = function() {
71
+ var _ref = _asyncToGenerator(function() {
72
+ var monaco;
73
+ return _tsGenerator(this, function(_state) {
74
+ switch(_state.label){
75
+ case 0:
76
+ return [
77
+ 4,
78
+ Promise.resolve().then(function() {
79
+ return /*#__PURE__*/ _interopRequireWildcard(require("monaco-editor"));
80
+ })
81
+ ];
82
+ case 1:
83
+ monaco = _state.sent();
84
+ _react.loader.config({
85
+ monaco: monaco
86
+ });
87
+ setLoaded(true);
88
+ return [
89
+ 2
90
+ ];
91
+ }
92
+ });
93
+ });
94
+ return function loadLocalMonaco() {
95
+ return _ref.apply(this, arguments);
96
+ };
97
+ }();
98
+ (0, _react1.useEffect)(function() {
99
+ if (monacoLoader === "local") {
100
+ loadLocalMonaco();
101
+ } else {
102
+ setLoaded(true);
103
+ }
104
+ }, []);
70
105
  var _label = label ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Input.Label, _objectSpreadProps(_objectSpread({
71
106
  required: required
72
107
  }, labelProps), {
@@ -112,7 +147,7 @@ var CodeEditor = function(props) {
112
147
  }
113
148
  })
114
149
  });
115
- var _editor = /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Box, {
150
+ var _editor = loaded ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Box, {
116
151
  p: "md",
117
152
  pl: "xs",
118
153
  className: classes.editor,
@@ -153,6 +188,9 @@ var CodeEditor = function(props) {
153
188
  }));
154
189
  }
155
190
  })
191
+ }) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Center, {
192
+ className: classes.editor,
193
+ children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Loader, {})
156
194
  });
157
195
  return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_core.Stack, _objectSpreadProps(_objectSpread({
158
196
  justify: "flex-start",
@@ -162,7 +200,7 @@ var CodeEditor = function(props) {
162
200
  height: Math.max(parentHeight, minHeight),
163
201
  maxHeight: maxHeight
164
202
  },
165
- ref: ref3
203
+ ref: ref4
166
204
  }, others), {
167
205
  children: [
168
206
  _header,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport * as monaco from 'monaco-editor';\nimport {FunctionComponent} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nloader.config({monaco});\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CodeEditor","loader","config","monaco","useStyles","createStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","defaultValue","minHeight","props","useComponentDefaultProps","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","classes","useUncontrolled","finalValue","_value","handleChange","useParentHeight","parentHeight","ref","_label","Input","Label","_description","Description","mt","_error","Error","_header","Box","_copyButton","Group","position","CopyButton","timeout","copied","copy","Tooltip","withArrow","ActionIcon","color","onClick","CheckSize16Px","CopySize16Px","_editor","p","pl","className","Editor","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","Stack","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;+BA4EaA,YAAU;;;eAAVA,UAAU;;;;;;;;;;;gCA5EmB,6BAA6B;oBAchE,eAAe;qBACQ,gBAAgB;2DACjB,sBAAsB;kEAC3B,eAAe;sBAGT,aAAa;AAE3CC,MAAM,OAAA,CAACC,MAAM,CAAC;IAACC,MAAM,EAANA,aAAM;CAAC,CAAC,CAAC;AAExB,IAAMC,SAAS,GAAGC,IAAAA,KAAY,aAAA,EAAC,SAACC,KAAK;WAAM;QACvCC,IAAI,EAAE,EAAE;QACRC,MAAM,EAAE;YACJC,MAAM,EAAE,AAAC,YAAU,CAAuB,MAAA,CAArBH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE;YAC3CC,YAAY,EAAEN,KAAK,CAACO,aAAa;YACjCC,eAAe,EAAER,KAAK,CAACS,WAAW,KAAK,OAAO,GAAGT,KAAK,CAACU,KAAK,GAAGV,KAAK,CAACW,KAAK;YAC1EC,MAAM,EAAE,MAAM;SACjB;KACJ;CAAC,CAAC,AAAC;AAsCJ,IAAMC,YAAY,GAA6B;IAC3CC,QAAQ,EAAE,WAAW;IACrBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE,GAAG;CACjB,AAAC;AAEK,IAAMtB,UAAU,GAAuC,SAACuB,KAAK,EAAK;IACrE,IAiBIC,IAA2D,GAA3DA,IAAAA,KAAwB,yBAAA,EAAC,YAAY,EAAEL,YAAY,EAAEI,KAAK,CAAC,EAhB3DH,QAAQ,GAgBRI,IAA2D,CAhB3DJ,QAAQ,EACRC,YAAY,GAeZG,IAA2D,CAf3DH,YAAY,EACZI,QAAQ,GAcRD,IAA2D,CAd3DC,QAAQ,EACRC,OAAO,GAaPF,IAA2D,CAb3DE,OAAO,EACPC,KAAK,GAYLH,IAA2D,CAZ3DG,KAAK,EACLC,KAAK,GAW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"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monaco = await import('monaco-editor');\n loader.config({monaco});\n setLoaded(true);\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CodeEditor","useStyles","createStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","props","useComponentDefaultProps","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","useState","loaded","setLoaded","classes","useUncontrolled","finalValue","_value","handleChange","useParentHeight","parentHeight","ref","loadLocalMonaco","monaco","loader","config","useEffect","_label","Input","Label","_description","Description","mt","_error","Error","_header","Box","_copyButton","Group","position","CopyButton","timeout","copied","copy","Tooltip","withArrow","ActionIcon","color","onClick","CheckSize16Px","CopySize16Px","_editor","p","pl","className","Editor","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","Center","Loader","Stack","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;+BAmFaA,YAAU;;;eAAVA,UAAU;;;;;;;;;;;gCAnFmB,6BAA6B;oBAgBhE,eAAe;qBACQ,gBAAgB;2DACjB,sBAAsB;sBACE,OAAO;sBAE9B,aAAa;AAE3C,IAAMC,SAAS,GAAGC,IAAAA,KAAY,aAAA,EAAC,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CAAC,CAAC;YACP,CAAC;UACH;MACA,iBAEN,qBAACC,KAAM,OAAA;QAACpB,SAAS,EAAExC,OAAO,CAAClC,MAAM;kBAC7B,cAAA,qBAAC+F,KAAM,OAAA,KAAG;MACL,AACZ,AAAC;IAEF,qBACI,sBAACC,KAAK,MAAA;QACFC,OAAO,EAAC,YAAY;QACpBvB,SAAS,EAAExC,OAAO,CAACnC,IAAI;QACvBmG,OAAO,EAAE,CAAC;QACVC,EAAE,EAAE;YAACzF,MAAM,EAAE0F,IAAI,CAACC,GAAG,CAAC7D,YAAY,EAAEzB,SAAS,CAAC;YAAEa,SAAS,EAATA,SAAS;SAAC;QAC1Da,GAAG,EAAEA,IAAG;OACJX,MAAM;;YAETyB,OAAO;YACPE,WAAW;YACXc,OAAO;YACPlB,MAAM;;OACH,CACV;AACN,CAAC,AAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "monaco", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return monaco;
9
+ }
10
+ });
11
+ var editor = {
12
+ create: function() {
13
+ return {
14
+ dispose: function() {
15
+ return null;
16
+ }
17
+ };
18
+ }
19
+ };
20
+ var monaco = {
21
+ editor: editor
22
+ };
23
+
24
+ //# sourceMappingURL=monaco-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/code-editor/__mocks__/monaco-editor.ts"],"sourcesContent":["const editor = {\n create: () => ({\n dispose: (): void => null,\n }),\n};\n\nexport const monaco = {\n editor,\n};\n"],"names":["monaco","editor","create","dispose"],"mappings":"AAAA;;;;+BAMaA,QAAM;;;eAANA,MAAM;;;AANnB,IAAMC,MAAM,GAAG;IACXC,MAAM,EAAE;eAAO;YACXC,OAAO,EAAE;uBAAY,IAAI;aAAA;SAC5B;KAAC;CACL,AAAC;AAEK,IAAMH,MAAM,GAAG;IAClBC,MAAM,EAANA,MAAM;CACT,AAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/index.ts"],"sourcesContent":["export * from './ModalWizard';\n"],"names":[],"mappings":"AAAA;;;;;oBAAc,eAAe"}
1
+ {"version":3,"sources":["../../../../src/components/modal-wizard/index.ts"],"sourcesContent":["export * from './ModalWizard';\nexport {type ModalWizardStepProps} from './ModalWizardStep';\n"],"names":[],"mappings":"AAAA;;;;;oBAAc,eAAe"}
package/dist/cjs/index.js CHANGED
@@ -9,9 +9,6 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- ColumnDef: function() {
13
- return _tableCore.ColumnDef;
14
- },
15
12
  createColumnHelper: function() {
16
13
  return _tableCore.createColumnHelper;
17
14
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport {ColumnDef, createColumnHelper} from '@tanstack/table-core';\n\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\n\nexport * from './components';\nexport * from './theme';\n\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["ColumnDef","createColumnHelper","Header","Table"],"mappings":"AAAA;;;;;;;;;;;IAIQA,SAAS;eAATA,UAAS,UAAA;;IAAEC,kBAAkB;eAAlBA,UAAkB,mBAAA;;IAW7BC,MAAM;eAANA,WAAM,OAAA;;IAAEC,KAAK;eAALA,WAAK,MAAA;;;;yBAXuB,sBAAsB;oBAEpD,eAAe;oBACf,eAAe;oBAEf,gBAAgB;sCAEhB,cAAc;oBACd,SAAS"}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport {type ColumnDef, createColumnHelper} from '@tanstack/table-core';\n\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\n\nexport * from './components';\nexport * from './theme';\n\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["createColumnHelper","Header","Table"],"mappings":"AAAA;;;;;;;;;;;IAIwBA,kBAAkB;eAAlBA,UAAkB,mBAAA;;IAWlCC,MAAM;eAANA,WAAM,OAAA;;IAAEC,KAAK;eAALA,WAAK,MAAA;;;;yBAX4B,sBAAsB;oBAEzD,eAAe;oBACf,eAAe;oBAEf,gBAAgB;sCAEhB,cAAc;oBACd,SAAS"}
@@ -37,6 +37,13 @@ interface CodeEditorProps extends Omit<InputWrapperBaseProps, 'inputContainer' |
37
37
  */
38
38
  maxHeight?: number;
39
39
  disabled?: boolean;
40
+ /**
41
+ * Defines how the monaco editor files will be loaded.
42
+ * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).
43
+ *
44
+ * @default 'local'
45
+ */
46
+ monacoLoader?: 'cdn' | 'local';
40
47
  }
41
48
  export declare const CodeEditor: FunctionComponent<CodeEditorProps>;
42
49
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AACA,OAAO,EAKH,YAAY,EAGZ,qBAAqB,EACrB,SAAS,EAIZ,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAMxC,QAAA,MAAM,SAAS;;;;CAQZ,CAAC;AAEJ,U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,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,qDAAqD;IACrD,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CAClC;AASD,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAkIzD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const monaco: {
2
+ editor: {
3
+ create: () => {
4
+ dispose: () => void;
5
+ };
6
+ };
7
+ };
8
+ //# sourceMappingURL=monaco-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monaco-editor.d.ts","sourceRoot":"","sources":["../../../../../src/components/code-editor/__mocks__/monaco-editor.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM;;;2BAJE,IAAI;;;CAMxB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './ModalWizard';
2
+ export { type ModalWizardStepProps } from './ModalWizardStep';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,KAAK,oBAAoB,EAAC,MAAM,mBAAmB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { Tuple } from '@mantine/core';
2
2
  import { PlasmaColors } from './theme/PlasmaColors';
3
- export { ColumnDef, createColumnHelper } from '@tanstack/table-core';
3
+ export { type ColumnDef, createColumnHelper } from '@tanstack/table-core';
4
4
  export * from '@mantine/core';
5
5
  export * from '@mantine/form';
6
6
  export type { FormValidateInput } from '@mantine/form/lib/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAC,SAAS,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAE3C,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QAEvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;KAChF;CACJ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAC,KAAK,SAAS,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAE3C,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QAEvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;KAChF;CACJ"}
@@ -6,14 +6,11 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
6
6
  import _ts_generator from "@swc/helpers/src/_ts_generator.mjs";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  import { CheckSize16Px, CopySize16Px } from "@coveord/plasma-react-icons";
9
- import { ActionIcon, Box, CopyButton, createStyles, Group, Input, Stack, Tooltip, useComponentDefaultProps } from "@mantine/core";
9
+ import { ActionIcon, Box, Center, CopyButton, createStyles, Group, Input, Loader, Stack, Tooltip, useComponentDefaultProps } from "@mantine/core";
10
10
  import { useUncontrolled } from "@mantine/hooks";
11
11
  import Editor, { loader } from "@monaco-editor/react";
12
- import * as monaco from "monaco-editor";
12
+ import { useEffect, useState } from "react";
13
13
  import { useParentHeight } from "../../hooks";
14
- loader.config({
15
- monaco: monaco
16
- });
17
14
  var useStyles = createStyles(function(theme) {
18
15
  return {
19
16
  root: {},
@@ -27,11 +24,12 @@ var useStyles = createStyles(function(theme) {
27
24
  });
28
25
  var defaultProps = {
29
26
  language: "plaintext",
27
+ monacoLoader: "local",
30
28
  defaultValue: "",
31
29
  minHeight: 300
32
30
  };
33
31
  export var CodeEditor = function(props) {
34
- var _ref = useComponentDefaultProps("CodeEditor", defaultProps, props), language = _ref.language, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onFocus = _ref.onFocus, value = _ref.value, label = _ref.label, required = _ref.required, labelProps = _ref.labelProps, error = _ref.error, errorProps = _ref.errorProps, description = _ref.description, descriptionProps = _ref.descriptionProps, minHeight = _ref.minHeight, maxHeight = _ref.maxHeight, disabled = _ref.disabled, others = _object_without_properties(_ref, [
32
+ var _ref = useComponentDefaultProps("CodeEditor", defaultProps, props), language = _ref.language, defaultValue = _ref.defaultValue, onChange = _ref.onChange, onFocus = _ref.onFocus, value = _ref.value, label = _ref.label, required = _ref.required, labelProps = _ref.labelProps, error = _ref.error, errorProps = _ref.errorProps, description = _ref.description, descriptionProps = _ref.descriptionProps, minHeight = _ref.minHeight, maxHeight = _ref.maxHeight, disabled = _ref.disabled, monacoLoader = _ref.monacoLoader, others = _object_without_properties(_ref, [
35
33
  "language",
36
34
  "defaultValue",
37
35
  "onChange",
@@ -46,16 +44,51 @@ export var CodeEditor = function(props) {
46
44
  "descriptionProps",
47
45
  "minHeight",
48
46
  "maxHeight",
49
- "disabled"
47
+ "disabled",
48
+ "monacoLoader"
50
49
  ]);
51
- var ref = useStyles(), classes = ref.classes, theme = ref.theme;
52
- var ref1 = _sliced_to_array(useUncontrolled({
50
+ var ref = _sliced_to_array(useState(false), 2), loaded = ref[0], setLoaded = ref[1];
51
+ var ref1 = useStyles(), classes = ref1.classes, theme = ref1.theme;
52
+ var ref2 = _sliced_to_array(useUncontrolled({
53
53
  value: value,
54
54
  defaultValue: defaultValue,
55
55
  onChange: onChange,
56
56
  finalValue: ""
57
- }), 2), _value = ref1[0], handleChange = ref1[1];
58
- var ref2 = _sliced_to_array(useParentHeight(), 2), parentHeight = ref2[0], ref3 = ref2[1];
57
+ }), 2), _value = ref2[0], handleChange = ref2[1];
58
+ var ref3 = _sliced_to_array(useParentHeight(), 2), parentHeight = ref3[0], ref4 = ref3[1];
59
+ var loadLocalMonaco = function() {
60
+ var _ref = _async_to_generator(function() {
61
+ var monaco;
62
+ return _ts_generator(this, function(_state) {
63
+ switch(_state.label){
64
+ case 0:
65
+ return [
66
+ 4,
67
+ import("monaco-editor")
68
+ ];
69
+ case 1:
70
+ monaco = _state.sent();
71
+ loader.config({
72
+ monaco: monaco
73
+ });
74
+ setLoaded(true);
75
+ return [
76
+ 2
77
+ ];
78
+ }
79
+ });
80
+ });
81
+ return function loadLocalMonaco() {
82
+ return _ref.apply(this, arguments);
83
+ };
84
+ }();
85
+ useEffect(function() {
86
+ if (monacoLoader === "local") {
87
+ loadLocalMonaco();
88
+ } else {
89
+ setLoaded(true);
90
+ }
91
+ }, []);
59
92
  var _label = label ? /*#__PURE__*/ _jsx(Input.Label, _object_spread_props(_object_spread({
60
93
  required: required
61
94
  }, labelProps), {
@@ -101,7 +134,7 @@ export var CodeEditor = function(props) {
101
134
  }
102
135
  })
103
136
  });
104
- var _editor = /*#__PURE__*/ _jsx(Box, {
137
+ var _editor = loaded ? /*#__PURE__*/ _jsx(Box, {
105
138
  p: "md",
106
139
  pl: "xs",
107
140
  className: classes.editor,
@@ -142,6 +175,9 @@ export var CodeEditor = function(props) {
142
175
  }));
143
176
  }
144
177
  })
178
+ }) : /*#__PURE__*/ _jsx(Center, {
179
+ className: classes.editor,
180
+ children: /*#__PURE__*/ _jsx(Loader, {})
145
181
  });
146
182
  return /*#__PURE__*/ _jsxs(Stack, _object_spread_props(_object_spread({
147
183
  justify: "flex-start",
@@ -151,7 +187,7 @@ export var CodeEditor = function(props) {
151
187
  height: Math.max(parentHeight, minHeight),
152
188
  maxHeight: maxHeight
153
189
  },
154
- ref: ref3
190
+ ref: ref4
155
191
  }, others), {
156
192
  children: [
157
193
  _header,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport * as monaco from 'monaco-editor';\nimport {FunctionComponent} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nloader.config({monaco});\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","CopyButton","createStyles","Group","Input","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","monaco","useParentHeight","config","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","classes","finalValue","_value","handleChange","parentHeight","ref","_label","Label","_description","Description","mt","_error","Error","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,6BAA6B,CAAC;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAGLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,eAAe,CAAC;AACvB,SAAQC,eAAe,QAAO,gBAAgB,CAAC;AAC/C,OAAOC,MAAM,IAAGC,MAAM,QAAO,sBAAsB,CAAC;AACpD,YAAYC,MAAM,MAAM,eAAe,CAAC;AAGxC,SAAQC,eAAe,QAAO,aAAa,CAAC;AAE5CF,MAAM,CAACG,MAAM,CAAC;IAACF,MAAM,EAANA,MAAM;CAAC,CAAC,CAAC;AAExB,IAAMG,SAAS,GAAGZ,YAAY,CAAC,SAACa,KAAK;WAAM;QACvCC,IAAI,EAAE,EAAE;QACRC,MAAM,EAAE;YACJC,MAAM,EAAE,AAAC,YAAU,CAAuB,MAAA,CAArBH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE;YAC3CC,YAAY,EAAEN,KAAK,CAACO,aAAa;YACjCC,eAAe,EAAER,KAAK,CAACS,WAAW,KAAK,OAAO,GAAGT,KAAK,CAACU,KAAK,GAAGV,KAAK,CAACW,KAAK;YAC1EC,MAAM,EAAE,MAAM;SACjB;KACJ;CAAC,CAAC,AAAC;AAsCJ,IAAMC,YAAY,GAA6B;IAC3CC,QAAQ,EAAE,WAAW;IACrBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE,GAAG;CACjB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BnB,SAAS,EAAEzB,OAAO,CAAC/B,IAAI;QACvB4E,OAAO,EAAE,CAAC;QACVC,EAAE,EAAE;YAAClE,MAAM,EAAEmE,IAAI,CAACC,GAAG,CAAC5C,YAAY,EAAEpB,SAAS,CAAC;YAAEa,SAAS,EAATA,SAAS;SAAC;QAC1DQ,GAAG,EAAEA,IAAG;OACJN,MAAM;;YAETc,OAAO;YACPC,WAAW;YACXQ,OAAO;YACPX,MAAM;;OACH,CACV;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monaco = await import('monaco-editor');\n loader.config({monaco});\n setLoaded(true);\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description mt=\"xs\" {...descriptionProps}>\n {description}\n </Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : null;\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor) => {\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","Center","CopyButton","createStyles","Group","Input","Loader","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useState","useParentHeight","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","classes","finalValue","_value","handleChange","parentHeight","ref","loadLocalMonaco","monaco","config","_label","Label","_description","Description","mt","_error","Error","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,6BAA6B,CAAC;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,eAAe,CAAC;AACvB,SAAQC,eAAe,QAAO,gBAAgB,CAAC;AAC/C,OAAOC,MAAM,IAAGC,MAAM,QAAO,sBAAsB,CAAC;AACpD,SAA2BC,SAAS,EAAEC,QAAQ,QAAO,OAAO,CAAC;AAE7D,SAAQC,eAAe,QAAO,aAAa,CAAC;AAE5C,IAAMC,SAAS,GAAGb,YAAY,CAAC,SAACc,KAAK;WAAM;QACvCC,IAAI,EAAE,EAAE;QACRC,MAAM,EAAE;YACJC,MAAM,EAAE,AAAC,YAAU,CAAuB,MAAA,CAArBH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE;YAC3CC,YAAY,EAAEN,KAAK,CAACO,aAAa;YACjCC,eAAe,EAAER,KAAK,CAACS,WAAW,KAAK,OAAO,GAAGT,KAAK,CAACU,KAAK,GAAGV,KAAK,CAACW,KAAK;YAC1EC,MAAM,EAAE,MAAM;SACjB;KACJ;CAAC,CAAC,AAAC;AA6CJ,IAAMC,YAAY,GAA6B;IAC3CC,QAAQ,EAAE,WAAW;IACrBC,YAAY,EAAE,OAAO;IACrBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE,GAAG;CACjB,AAAC;AAEF,OAAO,IAAMC,UAAU,GAAuC,SAACC,KAAK,EAAK;IACrE,IAkBI3B,IAA2D,GAA3DA,wBAAwB,CAAC,YAAY,EAAEqB,YAAY,EAAEM,KAAK,CAAC,EAjB3DL,QAAQ,G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E,IAAI;gBACnBC,QAAQ,EAAExE,KAAK,CAACyE,SAAS,CAACC,EAAE;gBAC5BC,QAAQ,EAAE5C,QAAQ;gBAClB6C,OAAO,EAAE,CAAC;aACb;YACDtD,KAAK,EAAEe,MAAM;YACbjB,QAAQ,EAAEkB,YAAY;YACtBuC,OAAO,EAAE,SAAC3E,MAAM,EAAK;gBACjBA,MAAM,CAAC4E,oBAAoB,CAACzD,OAAO,CAAC,CAAC;gBACrCnB,MAAM,CAAC6E,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAM7E,MAAM,CAAC8E,SAAS,CAAC,8BAA8B,CAAC,CAACC,GAAG,EAAE;kCAAA;;gCAA5D,aAA4D,CAAC;;;;;;gBACjE,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;UACH;MACA,iBAEN,KAACjG,MAAM;QAAC+E,SAAS,EAAE5B,OAAO,CAACjC,MAAM;kBAC7B,cAAA,KAACb,MAAM,KAAG;MACL,AACZ,AAAC;IAEF,qBACI,MAACC,KAAK;QACF4F,OAAO,EAAC,YAAY;QACpBnB,SAAS,EAAE5B,OAAO,CAAClC,IAAI;QACvBkF,OAAO,EAAE,CAAC;QACVC,EAAE,EAAE;YAACxE,MAAM,EAAEyE,IAAI,CAACC,GAAG,CAAC/C,YAAY,EAAEtB,SAAS,CAAC;YAAEa,SAAS,EAATA,SAAS;SAAC;QAC1DU,GAAG,EAAEA,IAAG;OACJR,MAAM;;YAETmB,OAAO;YACPC,WAAW;YACXQ,OAAO;YACPX,MAAM;;OACH,CACV;AACN,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ var editor = {
2
+ create: function() {
3
+ return {
4
+ dispose: function() {
5
+ return null;
6
+ }
7
+ };
8
+ }
9
+ };
10
+ export var monaco = {
11
+ editor: editor
12
+ };
13
+
14
+ //# sourceMappingURL=monaco-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/code-editor/__mocks__/monaco-editor.ts"],"sourcesContent":["const editor = {\n create: () => ({\n dispose: (): void => null,\n }),\n};\n\nexport const monaco = {\n editor,\n};\n"],"names":["editor","create","dispose","monaco"],"mappings":"AAAA,IAAMA,MAAM,GAAG;IACXC,MAAM,EAAE;eAAO;YACXC,OAAO,EAAE;uBAAY,IAAI;aAAA;SAC5B;KAAC;CACL,AAAC;AAEF,OAAO,IAAMC,MAAM,GAAG;IAClBH,MAAM,EAANA,MAAM;CACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/index.ts"],"sourcesContent":["export * from './ModalWizard';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/modal-wizard/index.ts"],"sourcesContent":["export * from './ModalWizard';\nexport {type ModalWizardStepProps} from './ModalWizardStep';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ColumnDef, createColumnHelper } from "@tanstack/table-core";
1
+ export { createColumnHelper } from "@tanstack/table-core";
2
2
  export * from "@mantine/core";
3
3
  export * from "@mantine/form";
4
4
  export * from "@mantine/hooks";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport {ColumnDef, createColumnHelper} from '@tanstack/table-core';\n\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\n\nexport * from './components';\nexport * from './theme';\n\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["ColumnDef","createColumnHelper","Header","Table"],"mappings":"AAIA,SAAQA,SAAS,EAAEC,kBAAkB,QAAO,sBAAsB,CAAC;AAEnE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,2CAA2C;AAC3C,SAAQC,MAAM,EAAEC,KAAK,QAAO,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport {type ColumnDef, createColumnHelper} from '@tanstack/table-core';\n\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\n\nexport * from './components';\nexport * from './theme';\n\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["createColumnHelper","Header","Table"],"mappings":"AAIA,SAAwBA,kBAAkB,QAAO,sBAAsB,CAAC;AAExE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,2CAA2C;AAC3C,SAAQC,MAAM,EAAEC,KAAK,QAAO,cAAc,CAAC"}
package/jest.config.js CHANGED
@@ -4,7 +4,6 @@ module.exports = {
4
4
  globalSetup: '<rootDir>/src/__tests__/GlobalSetup.ts',
5
5
  moduleNameMapper: {
6
6
  '^@test-utils$': '<rootDir>/src/__tests__/Utils.tsx',
7
- '^monaco-editor$': 'identity-obj-proxy',
8
7
  },
9
8
  testEnvironment: 'jsdom',
10
9
  transform: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "47.4.0",
3
+ "version": "47.5.0",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -80,6 +80,7 @@
80
80
  "build": "node ../../scripts/build",
81
81
  "clean": "rimraf dist",
82
82
  "start": "node ../../scripts/start",
83
- "test": "jest --maxWorkers=65%"
83
+ "test": "jest --maxWorkers=65%",
84
+ "test:watch": "jest --watchAll"
84
85
  }
85
86
  }