@coveord/plasma-mantine 52.21.0 → 52.23.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.
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +31 -31
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.d.ts +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/cjs/components/prompt/Prompt.d.ts.map +1 -1
- package/dist/cjs/components/prompt/Prompt.js +5 -3
- package/dist/cjs/components/prompt/Prompt.js.map +1 -1
- package/dist/esm/components/code-editor/CodeEditor.d.ts +1 -1
- package/dist/esm/components/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/esm/components/prompt/Prompt.d.ts.map +1 -1
- package/dist/esm/components/prompt/Prompt.js +5 -3
- package/dist/esm/components/prompt/Prompt.js.map +1 -1
- package/package.json +2 -2
- package/src/components/code-editor/CodeEditor.tsx +1 -1
- package/src/components/prompt/Prompt.tsx +3 -2
|
@@ -16,7 +16,7 @@ interface CodeEditorProps extends Omit<InputWrapperBaseProps, 'inputContainer' |
|
|
|
16
16
|
*
|
|
17
17
|
* @default 'plaintext'
|
|
18
18
|
*/
|
|
19
|
-
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml';
|
|
19
|
+
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml' | (string & unknown);
|
|
20
20
|
/** Default value for uncontrolled input */
|
|
21
21
|
defaultValue?: string;
|
|
22
22
|
/** Value for controlled input */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EAGZ,qBAAqB,EAGrB,SAAS,EAIZ,MAA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AAO,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,CAoJzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {\n Box,\n Center,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n px,\n Selectors,\n Space,\n Stack,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport {editor as monacoEditor} from 'monaco-editor';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useRef, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\nimport {CopyToClipboard} from '../copyToClipboard';\nimport {Search} from './search';\n\nconst useStyles = createStyles((theme, {error}: {error?: boolean}) => ({\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 outlineColor: error ? theme.colors.red[6] : null,\n outlineStyle: error ? 'solid' : 'none',\n outlineWidth: 'thin',\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' | 'xml';\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 search icon is clicked */\n onSearch?(): void;\n /** Called whenever the copy icon is clicked */\n onCopy?(): 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 onCopy,\n onSearch,\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 [containsError, setContainsError] = useState(false);\n const {classes, theme} = useStyles({error: containsError});\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n const editorRef = useRef(null);\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n const handleSearch = () => {\n if (editorRef.current) {\n editorRef.current.focus();\n editorRef.current.trigger('editor', 'actions.find', '');\n onSearch?.();\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const handleValidate = (markers: monacoEditor.IMarker[]) => {\n setContainsError(\n markers.some((marker) => marker.severity === loader.__getMonacoInstance().MarkerSeverity.Error),\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 {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _buttons = (\n <Group position=\"right\" spacing={0}>\n <Search handleSearch={handleSearch} />\n <CopyToClipboard value={_value} onCopy={() => onCopy?.()} />\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n onValidate={handleValidate}\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: px(theme.fontSizes.xs),\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n editorRef.current = editor;\n registerLanguages(monaco);\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 {_buttons}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CodeEditor","useStyles","createStyles","theme","error","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","outlineColor","red","outlineStyle","outlineWidth","defaultProps","language","monacoLoader","defaultValue","minHeight","props","useComponentDefaultProps","onChange","onCopy","onSearch","onFocus","value","label","required","labelProps","errorProps","description","descriptionProps","maxHeight","disabled","others","useState","loaded","setLoaded","containsError","setContainsError","classes","useUncontrolled","finalValue","_value","handleChange","useParentHeight","parentHeight","ref","editorRef","useRef","loadLocalMonaco","monacoInstance","loader","config","monaco","registerLanguages","XML","register","handleSearch","current","focus","trigger","useEffect","handleValidate","markers","some","marker","severity","__getMonacoInstance","MarkerSeverity","Error","_label","Input","Label","_description","Description","_error","mt","Space","h","_header","Box","_buttons","Group","position","spacing","Search","CopyToClipboard","_editor","p","pl","className","Editor","onValidate","defaultLanguage","options","minimap","enabled","wordWrap","scrollBeyondLastLine","formatOnPaste","fontSize","px","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","Center","Loader","Stack","justify","sx","Math","max"],"mappings":";;;;+BA4FaA;;;eAAAA;;;;;;;;;;;oBA9EN;qBACuB;+DAEO;sBACwB;sBAE/B;mBACZ;+BACY;sBACT;AAErB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;QAAQC,cAAAA;WAA+B;QACnEC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBJ,MAAMK,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcP,MAAMQ,aAAa;YACjCC,iBAAiBT,MAAMU,WAAW,KAAK,UAAUV,MAAMW,KAAK,GAAGX,MAAMY,KAAK;YAC1EC,QAAQ;YACRC,cAAcb,QAAQD,MAAMK,MAAM,CAACU,GAAG,CAAC,EAAE,GAAG;YAC5CC,cAAcf,QAAQ,UAAU;YAChCgB,cAAc;QAClB;IACJ;;AAiDA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,c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AAA,UAAAA,oBAAAA,8BAAAA;;;;;IAItD,IAAMkE,UAAUpD,uBACZ,qBAAC6C,SAAG;QAACQ,GAAE;QAAKC,IAAG;QAAKC,WAAWnD,QAAQzC,MAAM;kBACzC,cAAA,qBAAC6F,cAAM;YACHC,YAAY9B;YACZ+B,iBAAiB/E;YACjBnB,OAAOA,MAAMU,WAAW,KAAK,UAAU,UAAU;YACjDyF,SAAS;gBACLC,SAAS;oBAACC,SAAS;gBAAK;gBACxBC,UAAU;gBACVC,sBAAsB;gBACtBC,eAAe;gBACfC,UAAUC,IAAAA,QAAE,EAAC1G,MAAM2G,SAAS,CAACC,EAAE;gBAC/BC,UAAUxE;gBACVyE,SAAS;YACb;YACAjF,OAAOkB;YACPtB,UAAUuB;YACV+D,SAAS,SAAC5G,QAAQuD;gBACdN,UAAUW,OAAO,GAAG5D;gBACpBwD,kBAAkBD;gBAClBvD,OAAO6G,oBAAoB,CAAC;wBAAMpF;4BAAAA,WAAAA,qBAAAA,+BAAAA;;gBAClCzB,OAAO8G,mBAAmB,eAAC,sBAAA;;;;gCACvB;;oCAAM9G,OAAO+G,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,qBAACC,YAAM;QAACrB,WAAWnD,QAAQzC,MAAM;kBAC7B,cAAA,qBAACkH,YAAM;;IAIf,qBACI,sBAACC,WAAK;QACFC,SAAQ;QACRxB,WAAWnD,QAAQ1C,IAAI;QACvBuF,SAAS;QACT+B,IAAI;YAAC3G,QAAQ4G,KAAKC,GAAG,CAACxE,cAAc5B;YAAYc,WAAAA;QAAS;QACzDe,KAAKA;OACDb;;YAEH8C;YACAE;YACAM;YACAZ;;;AAGb"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {\n Box,\n Center,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n px,\n Selectors,\n Space,\n Stack,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport {editor as monacoEditor} from 'monaco-editor';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useRef, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\nimport {CopyToClipboard} from '../copyToClipboard';\nimport {Search} from './search';\n\nconst useStyles = createStyles((theme, {error}: {error?: boolean}) => ({\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 outlineColor: error ? theme.colors.red[6] : null,\n outlineStyle: error ? 'solid' : 'none',\n outlineWidth: 'thin',\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' | 'xml' | (string & unknown);\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 search icon is clicked */\n onSearch?(): void;\n /** Called whenever the copy icon is clicked */\n onCopy?(): 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 onCopy,\n onSearch,\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 [containsError, setContainsError] = useState(false);\n const {classes, theme} = useStyles({error: containsError});\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n const editorRef = useRef(null);\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n const handleSearch = () => {\n if (editorRef.current) {\n editorRef.current.focus();\n editorRef.current.trigger('editor', 'actions.find', '');\n onSearch?.();\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const handleValidate = (markers: monacoEditor.IMarker[]) => {\n setContainsError(\n markers.some((marker) => marker.severity === loader.__getMonacoInstance().MarkerSeverity.Error),\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 {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _buttons = (\n <Group position=\"right\" spacing={0}>\n <Search handleSearch={handleSearch} />\n <CopyToClipboard value={_value} onCopy={() => onCopy?.()} />\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n onValidate={handleValidate}\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: px(theme.fontSizes.xs),\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n editorRef.current = editor;\n registerLanguages(monaco);\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 {_buttons}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CodeEditor","useStyles","createStyles","theme","error","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","outlineColor","red","outlineStyle","outlineWidth","defaultProps","language","monacoLoader","defaultValue","minHeight","props","useComponentDefaultProps","onChange","onCopy","onSearch","onFocus","value","label","required","labelProps","errorProps","description","descriptionProps","maxHeight","disabled","others","useState","loaded","setLoaded","containsError","setContainsError","classes","useUncontrolled","finalValue","_value","handleChange","useParentHeight","parentHeight","ref","editorRef","useRef","loadLocalMonaco","monacoInstance","loader","config","monaco","registerLanguages","XML","register","handleSearch","current","focus","trigger","useEffect","handleValidate","markers","some","marker","severity","__getMonacoInstance","MarkerSeverity","Error","_label","Input","Label","_description","Description","_error","mt","Space","h","_header","Box","_buttons","Group","position","spacing","Search","CopyToClipboard","_editor","p","pl","className","Editor","onValidate","defaultLanguage","options","minimap","enabled","wordWrap","scrollBeyondLastLine","formatOnPaste","fontSize","px","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","Center","Loader","Stack","justify","sx","Math","max"],"mappings":";;;;+BA4FaA;;;eAAAA;;;;;;;;;;;oBA9EN;qBACuB;+DAEO;sBACwB;sBAE/B;mBACZ;+BACY;sBACT;AAErB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;QAAQC,cAAAA;WAA+B;QACnEC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBJ,MAAMK,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcP,MAAMQ,aAAa;YACjCC,iBAAiBT,MAAMU,WAAW,KAAK,UAAUV,MAAMW,KAAK,GAAGX,MAAMY,KAAK;YAC1EC,QAAQ;YACRC,cAAcb,QAAQD,MAAMK,MAAM,CAACU,GAAG,CAAC,EAAE,GAAG;YAC5CC,cAAcf,QAAQ,UAAU;YAChCgB,cAAc;QAClB;IACJ;;AAiDA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,cAAc;IACdC,cAAc;IACdC,WAAW;AACf;AAEO,IAAMzB,aAAiD,SAAC0B;IAC3D,IAoBIC,4BAAAA,IAAAA,8BAAwB,EAAC,cAAcN,cAAcK,QAnBrDJ,WAmBAK,0BAnBAL,UACAE,eAkBAG,0BAlBAH,cACAI,WAiBAD,0BAjBAC,UACAC,SAgBAF,0BAhBAE,QACAC,WAeAH,0BAfAG,UACAC,UAcAJ,0BAdAI,SACAC,QAaAL,0BAbAK,OACAC,QAYAN,0BAZAM,OACAC,WAWAP,0BAXAO,UACAC,aAUAR,0BAVAQ,YACA/B,QASAuB,0BATAvB,OACAgC,aAQAT,0BARAS,YACAC,cAOAV,0BAPAU,aACAC,mBAMAX,0BANAW,kBACAb,YAKAE,0BALAF,WACAc,YAIAZ,0BAJAY,WACAC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QuD;gBACdN,UAAUW,OAAO,GAAG5D;gBACpBwD,kBAAkBD;gBAClBvD,OAAO6G,oBAAoB,CAAC;wBAAMpF;4BAAAA,WAAAA,qBAAAA,+BAAAA;;gBAClCzB,OAAO8G,mBAAmB,eAAC,sBAAA;;;;gCACvB;;oCAAM9G,OAAO+G,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,qBAACC,YAAM;QAACrB,WAAWnD,QAAQzC,MAAM;kBAC7B,cAAA,qBAACkH,YAAM;;IAIf,qBACI,sBAACC,WAAK;QACFC,SAAQ;QACRxB,WAAWnD,QAAQ1C,IAAI;QACvBuF,SAAS;QACT+B,IAAI;YAAC3G,QAAQ4G,KAAKC,GAAG,CAACxE,cAAc5B;YAAYc,WAAAA;QAAS;QACzDe,KAAKA;OACDb;;YAEH8C;YACAE;YACAM;YACAZ;;;AAGb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA+B5C,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,UAAU,UAAU;IAChB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,MAAM,EAAE,OAAO,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA+B5C,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,UAAU,UAAU;IAChB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,MAAM,EAAE,OAAO,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,EAAE,UA4BpB,CAAC"}
|
|
@@ -68,7 +68,9 @@ var Prompt = function(_param) {
|
|
|
68
68
|
"children",
|
|
69
69
|
"variant"
|
|
70
70
|
]);
|
|
71
|
-
var
|
|
71
|
+
var classesProps = otherProps.classNames, otherPropsWithoutClasses = _object_without_properties._(otherProps, [
|
|
72
|
+
"classNames"
|
|
73
|
+
]);
|
|
72
74
|
var _useStyles = useStyles(), classes = _useStyles.classes, cx = _useStyles.cx;
|
|
73
75
|
var convertedChildren = _react.Children.toArray(children);
|
|
74
76
|
var otherChildren = convertedChildren.filter(function(child) {
|
|
@@ -87,9 +89,9 @@ var Prompt = function(_param) {
|
|
|
87
89
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Modal, _object_spread_props._(_object_spread._({
|
|
88
90
|
variant: "prompt",
|
|
89
91
|
padding: 0,
|
|
90
|
-
classNames: _object_spread._({}, classNames,
|
|
92
|
+
classNames: _object_spread._({}, classNames, classesProps),
|
|
91
93
|
size: "sm"
|
|
92
|
-
},
|
|
94
|
+
}, otherPropsWithoutClasses), {
|
|
93
95
|
children: [
|
|
94
96
|
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
95
97
|
className: classes.innerBody,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n overflowWrap: 'anywhere',\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal\n variant=\"prompt\"\n padding={0}\n classNames={{...classNames, ...
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n overflowWrap: 'anywhere',\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classNames: classesProps, ...otherPropsWithoutClasses} = otherProps;\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal\n variant=\"prompt\"\n padding={0}\n classNames={{...classNames, ...classesProps}}\n size={'sm'}\n {...otherPropsWithoutClasses}\n >\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["Prompt","useStyles","createStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","overflowWrap","success","backgroundColor","lime","color","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","children","variant","otherProps","classNames","classesProps","otherPropsWithoutClasses","classes","cx","convertedChildren","Children","toArray","otherChildren","filter","child","type","PromptFooter","footer","find","close","modal","Modal","size","div","className","Footer"],"mappings":";;;;+BAgDaA;;;eAAAA;;;;;;;4BAhDO;oBAC0B;qBACE;4BACrB;AAE3B,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAuBR,OAApBA,MAAMO,OAAO,CAACE,EAAE,EAAC,KAAoB,OAAjBT,MAAMO,OAAO,CAACG,EAAE;QACxE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAoB,OAAjBR,MAAMO,OAAO,CAACE,EAAE;YAChDJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,MAAM,CAACC,IAAI,CAAC,EAAE;YAC/CC,UAAUf,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,YAAYnB,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACC,UAAU;YAC9CC,cAAc;QAClB;QACAC,SAAS;YAACC,iBAAiB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b,QAAQtC,SAAS;QACxB+B,OAAOO,QAAQP,KAAK;IACxB;IAEA,qBACI,sBAACqB,WAAK;QACFnB,SAAQ;QACRlC,SAAS;QACToC,YAAY,qBAAIA,YAAeC;QAC/BiB,MAAM;OACFhB;;0BAEJ,qBAACiB;gBAAIC,WAAWjB,QAAQnC,SAAS;0BAAGwC;;YACnCK;;;AAGb;AAEAtD,OAAO8D,MAAM,GAAGT,0BAAY"}
|
|
@@ -16,7 +16,7 @@ interface CodeEditorProps extends Omit<InputWrapperBaseProps, 'inputContainer' |
|
|
|
16
16
|
*
|
|
17
17
|
* @default 'plaintext'
|
|
18
18
|
*/
|
|
19
|
-
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml';
|
|
19
|
+
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml' | (string & unknown);
|
|
20
20
|
/** Default value for uncontrolled input */
|
|
21
21
|
defaultValue?: string;
|
|
22
22
|
/** Value for controlled input */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EAGZ,qBAAqB,EAGrB,SAAS,EAIZ,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAC,iBAAiB,EAA8B,MAAM,OAAO,CAAC;AAOrE,QAAA,MAAM,SAAS;YAA0C,OAAO;;;;;;;;CAW7D,CAAC;AAEJ,UAAU,eACN,SAAQ,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,EACvE,YAAY,CAAC,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EAGZ,qBAAqB,EAGrB,SAAS,EAIZ,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAC,iBAAiB,EAA8B,MAAM,OAAO,CAAC;AAOrE,QAAA,MAAM,SAAS;YAA0C,OAAO;;;;;;;;CAW7D,CAAC;AAEJ,UAAU,eACN,SAAQ,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,EACvE,YAAY,CAAC,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IACrF,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,CAAC,IAAI,IAAI,CAAC;IAChB,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,CAoJzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {\n Box,\n Center,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n px,\n Selectors,\n Space,\n Stack,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport {editor as monacoEditor} from 'monaco-editor';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useRef, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\nimport {CopyToClipboard} from '../copyToClipboard';\nimport {Search} from './search';\n\nconst useStyles = createStyles((theme, {error}: {error?: boolean}) => ({\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 outlineColor: error ? theme.colors.red[6] : null,\n outlineStyle: error ? 'solid' : 'none',\n outlineWidth: 'thin',\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' | 'xml';\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 search icon is clicked */\n onSearch?(): void;\n /** Called whenever the copy icon is clicked */\n onCopy?(): 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 onCopy,\n onSearch,\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 [containsError, setContainsError] = useState(false);\n const {classes, theme} = useStyles({error: containsError});\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n const editorRef = useRef(null);\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n const handleSearch = () => {\n if (editorRef.current) {\n editorRef.current.focus();\n editorRef.current.trigger('editor', 'actions.find', '');\n onSearch?.();\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const handleValidate = (markers: monacoEditor.IMarker[]) => {\n setContainsError(\n markers.some((marker) => marker.severity === loader.__getMonacoInstance().MarkerSeverity.Error),\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 {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _buttons = (\n <Group position=\"right\" spacing={0}>\n <Search handleSearch={handleSearch} />\n <CopyToClipboard value={_value} onCopy={() => onCopy?.()} />\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n onValidate={handleValidate}\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: px(theme.fontSizes.xs),\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n editorRef.current = editor;\n registerLanguages(monaco);\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 {_buttons}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["Box","Center","createStyles","Group","Input","Loader","px","Space","Stack","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useRef","useState","useParentHeight","XML","CopyToClipboard","Search","useStyles","theme","error","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","outlineColor","red","outlineStyle","outlineWidth","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onCopy","onSearch","onFocus","value","label","required","labelProps","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","containsError","setContainsError","classes","finalValue","_value","handleChange","parentHeight","ref","editorRef","loadLocalMonaco","monacoInstance","config","monaco","registerLanguages","register","handleSearch","current","focus","trigger","handleValidate","markers","some","marker","severity","__getMonacoInstance","MarkerSeverity","Error","_label","Label","_description","Description","_error","mt","h","_header","_buttons","position","spacing","_editor","p","pl","className","onValidate","defaultLanguage","options","minimap","enabled","wordWrap","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","sx","Math","max"],"mappings":";;;;;;;AAAA,SACIA,GAAG,EACHC,MAAM,EACNC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EACNC,EAAE,EAEFC,KAAK,EACLC,KAAK,EACLC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,eAAe,QAAO,iBAAiB;AAE/C,OAAOC,UAASC,MAAM,QAAe,uBAAuB;AAC5D,SAA2BC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAO,QAAQ;AAErE,SAAQC,eAAe,QAAO,cAAc;AAC5C,SAAQC,GAAG,QAAO,kBAAkB;AACpC,SAAQC,eAAe,QAAO,qBAAqB;AACnD,SAAQC,MAAM,QAAO,WAAW;AAEhC,IAAMC,YAAYlB,aAAa,SAACmB;QAAQC,cAAAA;WAA+B;QACnEC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBJ,MAAMK,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcP,MAAMQ,aAAa;YACjCC,iBAAiBT,MAAMU,WAAW,KAAK,UAAUV,MAAMW,KAAK,GAAGX,MAAMY,KAAK;YAC1EC,QAAQ;YACRC,cAAcb,QAAQD,MAAMK,MAAM,CAACU,GAAG,CAAC,EAAE,GAAG;YAC5CC,cAAcf,QAAQ,UAAU;YAChCgB,cAAc;QAClB;IACJ;;AAiDA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,cAAc;IACdC,cAAc;IACdC,WAAW;AACf;AAEA,OAAO,IAAMC,aAAiD,SAACC;IAC3D,IAoBIpC,4BAAAA,yBAAyB,cAAc8B,cAAcM,QAnBrDL,WAmBA/B,0B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SAAS;gBACLC,SAAS;oBAACC,SAAS;gBAAK;gBACxBC,UAAU;gBACVC,sBAAsB;gBACtBC,eAAe;gBACfC,UAAU1G,GAAGe,MAAM4F,SAAS,CAACC,EAAE;gBAC/BC,UAAUzD;gBACV0D,SAAS;YACb;YACAlE,OAAOgB;YACPpB,UAAUqB;YACVkD,SAAS,SAAC7F,QAAQkD;gBACdJ,UAAUQ,OAAO,GAAGtD;gBACpBmD,kBAAkBD;gBAClBlD,OAAO8F,oBAAoB,CAAC;wBAAMrE;4BAAAA,WAAAA,qBAAAA,+BAAAA;;gBAClCzB,OAAO+F,mBAAmB,eAAC,oBAAA;;;;gCACvB;;oCAAM/F,OAAOgG,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACxH;QAAOsG,WAAWvC,QAAQxC,MAAM;kBAC7B,cAAA,KAACnB;;IAIT,qBACI,MAACG;QACGkH,SAAQ;QACRnB,WAAWvC,QAAQzC,IAAI;QACvB4E,SAAS;QACTwB,IAAI;YAACzF,QAAQ0F,KAAKC,GAAG,CAACzD,cAAczB;YAAYc,WAAAA;QAAS;QACzDY,KAAKA;OACDV;;YAEHqC;YACAC;YACAG;YACAP;;;AAGb,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {\n Box,\n Center,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n px,\n Selectors,\n Space,\n Stack,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport {editor as monacoEditor} from 'monaco-editor';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useRef, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\nimport {CopyToClipboard} from '../copyToClipboard';\nimport {Search} from './search';\n\nconst useStyles = createStyles((theme, {error}: {error?: boolean}) => ({\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 outlineColor: error ? theme.colors.red[6] : null,\n outlineStyle: error ? 'solid' : 'none',\n outlineWidth: 'thin',\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' | 'xml' | (string & unknown);\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 search icon is clicked */\n onSearch?(): void;\n /** Called whenever the copy icon is clicked */\n onCopy?(): 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 onCopy,\n onSearch,\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 [containsError, setContainsError] = useState(false);\n const {classes, theme} = useStyles({error: containsError});\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n const editorRef = useRef(null);\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n const handleSearch = () => {\n if (editorRef.current) {\n editorRef.current.focus();\n editorRef.current.trigger('editor', 'actions.find', '');\n onSearch?.();\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const handleValidate = (markers: monacoEditor.IMarker[]) => {\n setContainsError(\n markers.some((marker) => marker.severity === loader.__getMonacoInstance().MarkerSeverity.Error),\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 {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _buttons = (\n <Group position=\"right\" spacing={0}>\n <Search handleSearch={handleSearch} />\n <CopyToClipboard value={_value} onCopy={() => onCopy?.()} />\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n onValidate={handleValidate}\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: px(theme.fontSizes.xs),\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n editorRef.current = editor;\n registerLanguages(monaco);\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 {_buttons}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["Box","Center","createStyles","Group","Input","Loader","px","Space","Stack","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useRef","useState","useParentHeight","XML","CopyToClipboard","Search","useStyles","theme","error","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","outlineColor","red","outlineStyle","outlineWidth","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onCopy","onSearch","onFocus","value","label","required","labelProps","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","containsError","setContainsError","classes","finalValue","_value","handleChange","parentHeight","ref","editorRef","loadLocalMonaco","monacoInstance","config","monaco","registerLanguages","register","handleSearch","current","focus","trigger","handleValidate","markers","some","marker","severity","__getMonacoInstance","MarkerSeverity","Error","_label","Label","_description","Description","_error","mt","h","_header","_buttons","position","spacing","_editor","p","pl","className","onValidate","defaultLanguage","options","minimap","enabled","wordWrap","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","sx","Math","max"],"mappings":";;;;;;;AAAA,SACIA,GAAG,EACHC,MAAM,EACNC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EACNC,EA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rE;4BAAAA,WAAAA,qBAAAA,+BAAAA;;gBAClCzB,OAAO+F,mBAAmB,eAAC,oBAAA;;;;gCACvB;;oCAAM/F,OAAOgG,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACxH;QAAOsG,WAAWvC,QAAQxC,MAAM;kBAC7B,cAAA,KAACnB;;IAIT,qBACI,MAACG;QACGkH,SAAQ;QACRnB,WAAWvC,QAAQzC,IAAI;QACvB4E,SAAS;QACTwB,IAAI;YAACzF,QAAQ0F,KAAKC,GAAG,CAACzD,cAAczB;YAAYc,WAAAA;QAAS;QACzDY,KAAKA;OACDV;;YAEHqC;YACAC;YACAG;YACAP;;;AAGb,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA+B5C,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,UAAU,UAAU;IAChB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,MAAM,EAAE,OAAO,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA+B5C,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,UAAU,UAAU;IAChB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,MAAM,EAAE,OAAO,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,EAAE,UA4BpB,CAAC"}
|
|
@@ -58,7 +58,9 @@ export var Prompt = function(_param) {
|
|
|
58
58
|
"children",
|
|
59
59
|
"variant"
|
|
60
60
|
]);
|
|
61
|
-
var
|
|
61
|
+
var classesProps = otherProps.classNames, otherPropsWithoutClasses = _object_without_properties(otherProps, [
|
|
62
|
+
"classNames"
|
|
63
|
+
]);
|
|
62
64
|
var _useStyles = useStyles(), classes = _useStyles.classes, cx = _useStyles.cx;
|
|
63
65
|
var convertedChildren = Children.toArray(children);
|
|
64
66
|
var otherChildren = convertedChildren.filter(function(child) {
|
|
@@ -77,9 +79,9 @@ export var Prompt = function(_param) {
|
|
|
77
79
|
return /*#__PURE__*/ _jsxs(Modal, _object_spread_props(_object_spread({
|
|
78
80
|
variant: "prompt",
|
|
79
81
|
padding: 0,
|
|
80
|
-
classNames: _object_spread({}, classNames,
|
|
82
|
+
classNames: _object_spread({}, classNames, classesProps),
|
|
81
83
|
size: "sm"
|
|
82
|
-
},
|
|
84
|
+
}, otherPropsWithoutClasses), {
|
|
83
85
|
children: [
|
|
84
86
|
/*#__PURE__*/ _jsx("div", {
|
|
85
87
|
className: classes.innerBody,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n overflowWrap: 'anywhere',\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal\n variant=\"prompt\"\n padding={0}\n classNames={{...classNames, ...
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n overflowWrap: 'anywhere',\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classNames: classesProps, ...otherPropsWithoutClasses} = otherProps;\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal\n variant=\"prompt\"\n padding={0}\n classNames={{...classNames, ...classesProps}}\n size={'sm'}\n {...otherPropsWithoutClasses}\n >\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["color","createStyles","Modal","Children","PromptFooter","useStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","overflowWrap","success","backgroundColor","lime","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","Prompt","children","variant","otherProps","classNames","classesProps","otherPropsWithoutClasses","classes","cx","convertedChildren","toArray","otherChildren","filter","child","type","footer","find","close","modal","size","div","className","Footer"],"mappings":";;;;AAAA,SAAQA,KAAK,QAAO,yBAAyB;AAC7C,SAAQC,YAAY,EAAEC,KAAK,QAAmB,gBAAgB;AAC9D,SAAQC,QAAQ,QAAgC,QAAQ;AACxD,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,IAAMC,YAAYJ,aAAa,SAACK;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAuBR,OAApBA,MAAMO,OAAO,CAACE,EAAE,EAAC,KAAoB,OAAjBT,MAAMO,OAAO,CAACG,EAAE;QACxE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAoB,OAAjBR,MAAMO,OAAO,CAACE,EAAE;YAChDJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,MAAM,CAACC,IAAI,CAAC,EAAE;YAC/CC,UAAUf,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,YAAYnB,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACC,UAAU;YAC9CC,cAAc;QAClB;QACAC,SAAS;YAACC,iBAAiBtB,MAAMa,MAAM,CAACU,IAAI,CAAC,EAAE;YAAE7B,OAAOA,MAAM8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;QACToC,YAAY,mBAAIA,YAAeC;QAC/Bc,MAAM;OACFb;;0BAEJ,KAACc;gBAAIC,WAAWd,QAAQnC,SAAS;0BAAGuC;;YACnCI;;;AAGb,EAAE;AAEFf,OAAOsB,MAAM,GAAG1D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveord/plasma-mantine",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.23.0",
|
|
4
4
|
"description": "A Plasma flavoured Mantine theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plasma",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lodash.debounce": "4.0.8",
|
|
42
42
|
"lodash.defaultsdeep": "4.6.1",
|
|
43
43
|
"monaco-editor": "0.41.0",
|
|
44
|
-
"@coveord/plasma-react-icons": "52.
|
|
44
|
+
"@coveord/plasma-react-icons": "52.23.0",
|
|
45
45
|
"@coveord/plasma-tokens": "52.21.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
@@ -44,7 +44,7 @@ interface CodeEditorProps
|
|
|
44
44
|
*
|
|
45
45
|
* @default 'plaintext'
|
|
46
46
|
*/
|
|
47
|
-
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml';
|
|
47
|
+
language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml' | (string & unknown);
|
|
48
48
|
/** Default value for uncontrolled input */
|
|
49
49
|
defaultValue?: string;
|
|
50
50
|
/** Value for controlled input */
|
|
@@ -47,6 +47,7 @@ interface PromptType {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {
|
|
50
|
+
const {classNames: classesProps, ...otherPropsWithoutClasses} = otherProps;
|
|
50
51
|
const {classes, cx} = useStyles();
|
|
51
52
|
const convertedChildren = Children.toArray(children) as ReactElement[];
|
|
52
53
|
|
|
@@ -65,9 +66,9 @@ export const Prompt: PromptType = ({children, variant = 'info', ...otherProps})
|
|
|
65
66
|
<Modal
|
|
66
67
|
variant="prompt"
|
|
67
68
|
padding={0}
|
|
68
|
-
classNames={{...classNames, ...
|
|
69
|
+
classNames={{...classNames, ...classesProps}}
|
|
69
70
|
size={'sm'}
|
|
70
|
-
{...
|
|
71
|
+
{...otherPropsWithoutClasses}
|
|
71
72
|
>
|
|
72
73
|
<div className={classes.innerBody}>{otherChildren}</div>
|
|
73
74
|
{footer}
|