@coveord/plasma-mantine 48.13.2 → 48.14.2
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 +6 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/code-editor/CodeEditor.js +3 -1
- package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/definitions/components/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/definitions/components/header/Header.d.ts +1 -2
- package/dist/definitions/components/header/Header.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +1 -1
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/esm/components/code-editor/CodeEditor.js +4 -2
- package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/code-editor/CodeEditor.tsx +4 -1
- package/src/components/header/Header.tsx +1 -1
- package/src/index.ts +1 -1
|
@@ -116,7 +116,9 @@ var CodeEditor = function(props) {
|
|
|
116
116
|
mt: "xs"
|
|
117
117
|
}, errorProps), {
|
|
118
118
|
children: error
|
|
119
|
-
})) :
|
|
119
|
+
})) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Space, {
|
|
120
|
+
h: "xs"
|
|
121
|
+
});
|
|
120
122
|
var _header = _label || _description ? /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_core.Box, {
|
|
121
123
|
children: [
|
|
122
124
|
_label,
|
|
@@ -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 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;;;eAAAA;;;;;;;;;;;gCAnF6B;oBAgBnC;qBACuB;2DACD;sBACwB;sBAEvB;AAE9B,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBH,MAAMI,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcN,MAAMO,aAAa;YACjCC,iBAAiBR,MAAMS,WAAW,KAAK,UAAUT,MAAM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K;gBAC3BC,eAAe,IAAI;gBACnBC,UAAUtF,MAAMuF,SAAS,CAACC,EAAE;gBAC5BC,UAAU1D;gBACV2D,SAAS;YACb;YACApE,OAAOiB;YACPnB,UAAUoB;YACVmD,SAAS,SAACzF,QAAW;gBACjBA,OAAO0F,oBAAoB,CAACvE;gBAC5BnB,OAAO2F,mBAAmB,eAAC,kBAAA,WAAY;;;;gCACnC;;oCAAM3F,OAAO4F,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,qBAACC,YAAM;QAACpB,WAAWxC,QAAQlC,MAAM;kBAC7B,cAAA,qBAAC+F,YAAM;MAEd;IAED,qBACI,sBAACC,WAAK;QACFC,SAAQ;QACRvB,WAAWxC,QAAQnC,IAAI;QACvBmG,SAAS;QACTC,IAAI;YAACzF,QAAQ0F,KAAKC,GAAG,CAAC7D,cAAczB;YAAYa,WAAAA;QAAS;QACzDa,KAAKA;OACDX;;YAEHyB;YACAE;YACAc;YACAlB;;;AAGb"}
|
|
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 Space,\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 ) : (\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 _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","Space","h","_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;;;;+BAoFaA;;;eAAAA;;;;;;;;;;;gCApF6B;oBAiBnC;qBACuB;2DACD;sBACwB;sBAEvB;AAE9B,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBH,MAAMI,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcN,MAAMO,aAAa;YACjCC,iBAAiBR,MAAMS,WAAW,KAAK,UAAUT,MAAMU,KAAK,GAAGV,MAAMW,KAAK;YAC1EC,QAAQ;QACZ;IACJ;;AA6CA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,cAAc;IACdC,cAAc;IACdC,WAAW;AACf;AAEO,IAAMpB,aAAiD,SAACqB,OAAU;IACrE,IAkBIC,4BAAAA,IAAAA,8BAAwB,EAAC,cAAcN,cAAcK,QAjBrDJ,WAiBAK,0BAjBAL,UACAE,eAgBAG,0BAhBAH,cACAI,WAeAD,0BAfAC,UACAC,UAcAF,0BAdAE,SACAC,QAaAH,0BAbAG,OACAC,QAYAJ,0BAZAI,OACAC,WAWAL,0BAXAK,UACAC,aAUAN,0BAVAM,YACAC,QASAP,0B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A,qBAACiG,YAAM;MAEd;IAED,qBACI,sBAACC,WAAK;QACFC,SAAQ;QACRvB,WAAW1C,QAAQnC,IAAI;QACvBqG,SAAS;QACTC,IAAI;YAAC3F,QAAQ4F,KAAKC,GAAG,CAAC/D,cAAczB;YAAYa,WAAAA;QAAS;QACzDa,KAAKA;OACDX;;YAEH2B;YACAE;YACAc;YACApB;;;AAGb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\nexport interface HeaderProps extends DefaultProps {\n /**\n * The description text displayed inside the header underneath the title\n */\n description?: ReactNode;\n /**\n * Action buttons that can be displayed on the right of the header\n */\n actions?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\n /**\n * A href pointing to documentation related to the current panel.\n * When provided, an info icon is rendered next to the title as link to this documentation\n */\n docLink?: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n docLinkTooltipLabel?: string;\n /**\n * The title of the header.\n * If more than one children are provided, each of them act as parts of a breadcrumb\n */\n children: ReactNode;\n}\n\nexport const Header: FunctionComponent<HeaderProps> = ({\n description,\n actions,\n borderBottom,\n docLink,\n docLinkTooltipLabel,\n children,\n ...others\n}) => (\n <>\n <Group position=\"apart\" py=\"md\" px=\"xl\" {...others}>\n <Stack spacing=\"xs\">\n <Title order={4}>\n <Group spacing={0}>\n <Breadcrumbs>{children}</Breadcrumbs>\n {docLink ? (\n <Tooltip label={docLinkTooltipLabel} position=\"bottom\">\n <Anchor href={docLink} target=\"_blank\" ml=\"xs\">\n <QuestionSize24Px height={24} />\n </Anchor>\n </Tooltip>\n ) : null}\n </Group>\n </Title>\n <Text size=\"sm\">{description}</Text>\n </Stack>\n <Group spacing=\"xs\">{actions}</Group>\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n);\n"],"names":["Header","description","actions","borderBottom","docLink","docLinkTooltipLabel","children","others","Group","position","py","px","Stack","spacing","Title","order","Breadcrumbs","Tooltip","label","Anchor","href","target","ml","QuestionSize24Px","height","Text","size","Divider"],"mappings":"AAAA;;;;+BAiCaA;;;eAAAA;;;;;;;gCAjCkB;oBAC8D;AAgCtF,IAAMA,SAAyC,+BASlD;QARAC,qBAAAA,aACAC,iBAAAA,SACAC,sBAAAA,cACAC,iBAAAA,SACAC,6BAAAA,qBACAC,kBAAAA,UACGC;QANHN;QACAC;QACAC;QACAC;QACAC;QACAC;;WAGA;;0BACI,sBAACE,WAAK;gBAACC,UAAS;gBAAQC,IAAG;gBAAKC,IAAG;eAASJ;;kCACxC,sBAACK,WAAK;wBAACC,SAAQ;;0CACX,qBAACC,WAAK;gCAACC,OAAO;0CACV,cAAA,sBAACP,WAAK;oCAACK,SAAS;;sDACZ,qBAACG,iBAAW;sDAAEV;;wCACbF,wBACG,qBAACa,aAAO;4CAACC,OAAOb;4CAAqBI,UAAS;sDAC1C,cAAA,qBAACU,YAAM;gDAACC,MAAMhB;gDAASiB,QAAO;gDAASC,IAAG;0DACtC,cAAA,qBAACC,kCAAgB;oDAACC,QAAQ;;;6CAGlC,IAAI;;;;0CAGhB,qBAACC,UAAI;gCAACC,MAAK;0CAAMzB;;;;kCAErB,qBAACO,WAAK;wBAACK,SAAQ;kCAAMX;;;;YAExBC,6BAAe,qBAACwB,aAAO;gBAACD,MAAK;iBAAU,IAAI;;;AAC9C"}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\nexport * from './theme';\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;;;;;;;;;;;IASQA,kBAAkB;eAAlBA,6BAAkB;;IAGlBC,MAAM;eAANA,kBAAM;;IAAEC,KAAK;eAALA,iBAAK;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\n// explicitly overriding mantine components\nexport {Header, Table, HeaderProps} from './components';\nexport * from './theme';\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","HeaderProps"],"mappings":"AAAA;;;;;;;;;;;IASQA,kBAAkB;eAAlBA,6BAAkB;;IAGlBC,MAAM;eAANA,kBAAM;;IAAEC,KAAK;eAALA,iBAAK;;IAAEC,WAAW;eAAXA,uBAAW;;;;oBARpB;oBACA;oBACA;oBAEA;yBACmC;sCACnC;oBAGA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AACA,OAAO,EAMH,YAAY,EAGZ,qBAAqB,EAErB,SAAS,
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AACA,OAAO,EAMH,YAAY,EAGZ,qBAAqB,EAErB,SAAS,EAKZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,iBAAiB,EAAsB,MAAM,OAAO,CAAC;AAI7D,QAAA,MAAM,SAAS;;;;CAQZ,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,CAAC;IACxD,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,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,CAoIzD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultProps } from '@mantine/core';
|
|
2
2
|
import { FunctionComponent, ReactNode } from 'react';
|
|
3
|
-
interface HeaderProps extends DefaultProps {
|
|
3
|
+
export interface HeaderProps extends DefaultProps {
|
|
4
4
|
/**
|
|
5
5
|
* The description text displayed inside the header underneath the title
|
|
6
6
|
*/
|
|
@@ -29,5 +29,4 @@ interface HeaderProps extends DefaultProps {
|
|
|
29
29
|
children: ReactNode;
|
|
30
30
|
}
|
|
31
31
|
export declare const Header: FunctionComponent<HeaderProps>;
|
|
32
|
-
export {};
|
|
33
32
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/header/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAA8C,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEnD,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/components/header/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAA8C,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEnD,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA8BjD,CAAC"}
|
|
@@ -7,7 +7,7 @@ export type { FormValidateInput } from '@mantine/form/lib/types';
|
|
|
7
7
|
export * from '@mantine/hooks';
|
|
8
8
|
export { createColumnHelper, type ColumnDef } from '@tanstack/table-core';
|
|
9
9
|
export * from './components';
|
|
10
|
-
export { Header, Table } from './components';
|
|
10
|
+
export { Header, Table, HeaderProps } from './components';
|
|
11
11
|
export * from './theme';
|
|
12
12
|
declare module '@mantine/core' {
|
|
13
13
|
interface MantineThemeColorsOverride {
|
|
@@ -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,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAE,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACxE,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;
|
|
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,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAE,KAAK,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACxE,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACxD,cAAc,SAAS,CAAC;AAExB,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,7 +6,7 @@ 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, Center, CopyButton, createStyles, Group, Input, Loader, Stack, Tooltip, useComponentDefaultProps } from "@mantine/core";
|
|
9
|
+
import { ActionIcon, Box, Center, CopyButton, createStyles, Group, Input, Loader, Space, Stack, Tooltip, useComponentDefaultProps } from "@mantine/core";
|
|
10
10
|
import { useUncontrolled } from "@mantine/hooks";
|
|
11
11
|
import Editor, { loader } from "@monaco-editor/react";
|
|
12
12
|
import { useEffect, useState } from "react";
|
|
@@ -103,7 +103,9 @@ export var CodeEditor = function(props) {
|
|
|
103
103
|
mt: "xs"
|
|
104
104
|
}, errorProps), {
|
|
105
105
|
children: error
|
|
106
|
-
})) :
|
|
106
|
+
})) : /*#__PURE__*/ _jsx(Space, {
|
|
107
|
+
h: "xs"
|
|
108
|
+
});
|
|
107
109
|
var _header = _label || _description ? /*#__PURE__*/ _jsxs(Box, {
|
|
108
110
|
children: [
|
|
109
111
|
_label,
|
|
@@ -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 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,8BAA8B;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,eAAe,QAAO,iBAAiB;AAC/C,OAAOC,UAASC,MAAM,QA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W5B,QAAQjC,MAAM;kBACzC,cAAA,KAACR;YACGsE,iBAAiBlD;YACjBd,OAAOA,MAAMS,WAAW,KAAK,UAAU,UAAU,SAAS;YAC1DwD,SAAS;gBACLC,SAAS;oBAACC,SAAS,KAAK;gBAAA;gBACxBC,UAAU;gBACVC,kBAAkB;gBAClBC,sBAAsB,KAAK;gBAC3BC,eAAe,IAAI;gBACnBC,UAAUxE,MAAMyE,SAAS,CAACC,EAAE;gBAC5BC,UAAU5C;gBACV6C,SAAS;YACb;YACAtD,OAAOe;YACPjB,UAAUkB;YACVuC,SAAS,SAAC3E,QAAW;gBACjBA,OAAO4E,oBAAoB,CAACzD;gBAC5BnB,OAAO6E,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAM7E,OAAO8E,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACjG;QAAO+E,WAAW5B,QAAQjC,MAAM;kBAC7B,cAAA,KAACb;MAER;IAED,qBACI,MAACC;QACG4F,SAAQ;QACRnB,WAAW5B,QAAQlC,IAAI;QACvBkF,SAAS;QACTC,IAAI;YAACxE,QAAQyE,KAAKC,GAAG,CAAC/C,cAActB;YAAYa,WAAAA;QAAS;QACzDU,KAAKA;OACDR;;YAEHmB;YACAC;YACAQ;YACAX;;;AAGb,EAAE"}
|
|
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 Space,\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 ) : (\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 _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","Space","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","h","_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,8BAA8B;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,eAAe,QAAO,iBAAiB;AAC/C,OAAOC,UAASC,MAAM,QAAO,uBAAuB;AACpD,SAA2BC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAE7D,SAAQC,eAAe,QAAO,cAAc;AAE5C,IAAMC,YAAYd,aAAa,SAACe;WAAW;QACvCC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBH,MAAMI,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcN,MAAMO,aA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BC,UAAUzE,MAAM0E,SAAS,CAACC,EAAE;gBAC5BC,UAAU7C;gBACV8C,SAAS;YACb;YACAvD,OAAOe;YACPjB,UAAUkB;YACVwC,SAAS,SAAC5E,QAAW;gBACjBA,OAAO6E,oBAAoB,CAAC1D;gBAC5BnB,OAAO8E,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAM9E,OAAO+E,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACnG;QAAOiF,WAAW7B,QAAQjC,MAAM;kBAC7B,cAAA,KAACd;MAER;IAED,qBACI,MAACE;QACG6F,SAAQ;QACRnB,WAAW7B,QAAQlC,IAAI;QACvBmF,SAAS;QACTC,IAAI;YAACzE,QAAQ0E,KAAKC,GAAG,CAAChD,cAActB;YAAYa,WAAAA;QAAS;QACzDU,KAAKA;OACDR;;YAEHoB;YACAC;YACAQ;YACAZ;;;AAGb,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\nexport interface HeaderProps extends DefaultProps {\n /**\n * The description text displayed inside the header underneath the title\n */\n description?: ReactNode;\n /**\n * Action buttons that can be displayed on the right of the header\n */\n actions?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\n /**\n * A href pointing to documentation related to the current panel.\n * When provided, an info icon is rendered next to the title as link to this documentation\n */\n docLink?: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n docLinkTooltipLabel?: string;\n /**\n * The title of the header.\n * If more than one children are provided, each of them act as parts of a breadcrumb\n */\n children: ReactNode;\n}\n\nexport const Header: FunctionComponent<HeaderProps> = ({\n description,\n actions,\n borderBottom,\n docLink,\n docLinkTooltipLabel,\n children,\n ...others\n}) => (\n <>\n <Group position=\"apart\" py=\"md\" px=\"xl\" {...others}>\n <Stack spacing=\"xs\">\n <Title order={4}>\n <Group spacing={0}>\n <Breadcrumbs>{children}</Breadcrumbs>\n {docLink ? (\n <Tooltip label={docLinkTooltipLabel} position=\"bottom\">\n <Anchor href={docLink} target=\"_blank\" ml=\"xs\">\n <QuestionSize24Px height={24} />\n </Anchor>\n </Tooltip>\n ) : null}\n </Group>\n </Title>\n <Text size=\"sm\">{description}</Text>\n </Stack>\n <Group spacing=\"xs\">{actions}</Group>\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n);\n"],"names":["QuestionSize24Px","Anchor","Breadcrumbs","Divider","Group","Stack","Text","Title","Tooltip","Header","description","actions","borderBottom","docLink","docLinkTooltipLabel","children","others","position","py","px","spacing","order","label","href","target","ml","height","size"],"mappings":"AAAA;;;;AAAA,SAAQA,gBAAgB,QAAO,8BAA8B;AAC7D,SAAQC,MAAM,EAAEC,WAAW,EAAgBC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,QAAO,gBAAgB;AAgC7G,OAAO,IAAMC,SAAyC,+BASlD;QARAC,qBAAAA,aACAC,iBAAAA,SACAC,sBAAAA,cACAC,iBAAAA,SACAC,6BAAAA,qBACAC,kBAAAA,UACGC;QANHN;QACAC;QACAC;QACAC;QACAC;QACAC;;WAGA;;0BACI,MAACX;gBAAMa,UAAS;gBAAQC,IAAG;gBAAKC,IAAG;eAASH;;kCACxC,MAACX;wBAAMe,SAAQ;;0CACX,KAACb;gCAAMc,OAAO;0CACV,cAAA,MAACjB;oCAAMgB,SAAS;;sDACZ,KAAClB;sDAAaa;;wCACbF,wBACG,KAACL;4CAAQc,OAAOR;4CAAqBG,UAAS;sDAC1C,cAAA,KAAChB;gDAAOsB,MAAMV;gDAASW,QAAO;gDAASC,IAAG;0DACtC,cAAA,KAACzB;oDAAiB0B,QAAQ;;;6CAGlC,IAAI;;;;0CAGhB,KAACpB;gCAAKqB,MAAK;0CAAMjB;;;;kCAErB,KAACN;wBAAMgB,SAAQ;kCAAMT;;;;YAExBC,6BAAe,KAACT;gBAAQwB,MAAK;iBAAU,IAAI;;;AAC9C,EACJ"}
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from "@mantine/hooks";
|
|
|
5
5
|
export { createColumnHelper } from "@tanstack/table-core";
|
|
6
6
|
export * from "./components";
|
|
7
7
|
// explicitly overriding mantine components
|
|
8
|
-
export { Header, Table } from "./components";
|
|
8
|
+
export { Header, Table, HeaderProps } from "./components";
|
|
9
9
|
export * from "./theme";
|
|
10
10
|
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\n// explicitly overriding mantine components\nexport {Header, Table} from './components';\nexport * from './theme';\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,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAE9B,cAAc,iBAAiB;AAC/B,SAAQA,kBAAkB,QAAuB,uBAAuB;AACxE,cAAc,eAAe;AAC7B,2CAA2C;AAC3C,SAAQC,MAAM,EAAEC,KAAK,QAAO,eAAe;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport * from '@mantine/form';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport {createColumnHelper, type ColumnDef} from '@tanstack/table-core';\nexport * from './components';\n// explicitly overriding mantine components\nexport {Header, Table, HeaderProps} from './components';\nexport * from './theme';\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","HeaderProps"],"mappings":"AAIA,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAE9B,cAAc,iBAAiB;AAC/B,SAAQA,kBAAkB,QAAuB,uBAAuB;AACxE,cAAc,eAAe;AAC7B,2CAA2C;AAC3C,SAAQC,MAAM,EAAEC,KAAK,EAAEC,WAAW,QAAO,eAAe;AACxD,cAAc,UAAU"}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
InputWrapperBaseProps,
|
|
12
12
|
Loader,
|
|
13
13
|
Selectors,
|
|
14
|
+
Space,
|
|
14
15
|
Stack,
|
|
15
16
|
Tooltip,
|
|
16
17
|
useComponentDefaultProps,
|
|
@@ -141,7 +142,9 @@ export const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {
|
|
|
141
142
|
<Input.Error mt="xs" {...errorProps}>
|
|
142
143
|
{error}
|
|
143
144
|
</Input.Error>
|
|
144
|
-
) :
|
|
145
|
+
) : (
|
|
146
|
+
<Space h="xs" />
|
|
147
|
+
);
|
|
145
148
|
|
|
146
149
|
const _header =
|
|
147
150
|
_label || _description ? (
|
|
@@ -2,7 +2,7 @@ import {QuestionSize24Px} from '@coveord/plasma-react-icons';
|
|
|
2
2
|
import {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';
|
|
3
3
|
import {FunctionComponent, ReactNode} from 'react';
|
|
4
4
|
|
|
5
|
-
interface HeaderProps extends DefaultProps {
|
|
5
|
+
export interface HeaderProps extends DefaultProps {
|
|
6
6
|
/**
|
|
7
7
|
* The description text displayed inside the header underneath the title
|
|
8
8
|
*/
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from '@mantine/hooks';
|
|
|
10
10
|
export {createColumnHelper, type ColumnDef} from '@tanstack/table-core';
|
|
11
11
|
export * from './components';
|
|
12
12
|
// explicitly overriding mantine components
|
|
13
|
-
export {Header, Table} from './components';
|
|
13
|
+
export {Header, Table, HeaderProps} from './components';
|
|
14
14
|
export * from './theme';
|
|
15
15
|
|
|
16
16
|
declare module '@mantine/core' {
|