@mindlogic-ai/logician-ui 2.0.0-alpha.5 → 2.0.0-alpha.7

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/dist/index.d.mts CHANGED
@@ -9,7 +9,7 @@ import { RangeDatepickerProps, SingleDatepickerProps } from 'chakra-dayzed-datep
9
9
  import { IconType as IconType$1 } from 'react-icons/lib';
10
10
  import { DataKey as DataKey$1 } from 'recharts/types/util/types.d';
11
11
  import { Options } from 'react-markdown';
12
- import { MDXEditorProps as MDXEditorProps$1 } from '@mdxeditor/editor';
12
+ import { MDXEditorProps as MDXEditorProps$1, MDXEditorMethods } from '@mdxeditor/editor';
13
13
  import { GroupBase, Props } from 'react-select';
14
14
 
15
15
  declare const Accordion: (props: AccordionProps) => react_jsx_runtime.JSX.Element;
@@ -572,11 +572,12 @@ declare const MaxLengthIndicator: ({ value, maxLength, ...rest }: {
572
572
  maxLength: number;
573
573
  } & TextProps) => react_jsx_runtime.JSX.Element;
574
574
 
575
- interface MDXEditorProps extends MDXEditorProps$1 {
575
+ interface MDXEditorProps extends Omit<MDXEditorProps$1, 'onError'> {
576
576
  containerProps?: BoxProps;
577
+ onError?: (error: string) => void;
577
578
  }
578
579
 
579
- declare function MDXEditor({ containerProps, autoFocus, ...rest }: MDXEditorProps): react_jsx_runtime.JSX.Element;
580
+ declare const MDXEditor: react.ForwardRefExoticComponent<MDXEditorProps & react.RefAttributes<MDXEditorProps$1 & MDXEditorMethods>>;
580
581
 
581
582
  interface ButtonMenuButtonProps extends MenuButtonProps {
582
583
  as: typeof Button$1;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { RangeDatepickerProps, SingleDatepickerProps } from 'chakra-dayzed-datep
9
9
  import { IconType as IconType$1 } from 'react-icons/lib';
10
10
  import { DataKey as DataKey$1 } from 'recharts/types/util/types.d';
11
11
  import { Options } from 'react-markdown';
12
- import { MDXEditorProps as MDXEditorProps$1 } from '@mdxeditor/editor';
12
+ import { MDXEditorProps as MDXEditorProps$1, MDXEditorMethods } from '@mdxeditor/editor';
13
13
  import { GroupBase, Props } from 'react-select';
14
14
 
15
15
  declare const Accordion: (props: AccordionProps) => react_jsx_runtime.JSX.Element;
@@ -572,11 +572,12 @@ declare const MaxLengthIndicator: ({ value, maxLength, ...rest }: {
572
572
  maxLength: number;
573
573
  } & TextProps) => react_jsx_runtime.JSX.Element;
574
574
 
575
- interface MDXEditorProps extends MDXEditorProps$1 {
575
+ interface MDXEditorProps extends Omit<MDXEditorProps$1, 'onError'> {
576
576
  containerProps?: BoxProps;
577
+ onError?: (error: string) => void;
577
578
  }
578
579
 
579
- declare function MDXEditor({ containerProps, autoFocus, ...rest }: MDXEditorProps): react_jsx_runtime.JSX.Element;
580
+ declare const MDXEditor: react.ForwardRefExoticComponent<MDXEditorProps & react.RefAttributes<MDXEditorProps$1 & MDXEditorMethods>>;
580
581
 
581
582
  interface ButtonMenuButtonProps extends MenuButtonProps {
582
583
  as: typeof Button$1;
package/dist/index.js CHANGED
@@ -3747,44 +3747,46 @@ var MaxLengthIndicator = ({
3747
3747
  maxLength
3748
3748
  ] });
3749
3749
  };
3750
- function MDXEditor({
3751
- containerProps,
3752
- autoFocus = true,
3753
- ...rest
3754
- }) {
3750
+ var MDXEditor = React7.forwardRef(({ containerProps, autoFocus = true, onError, ...rest }, ref) => {
3755
3751
  const theme = react.useTheme();
3752
+ const [error, setError] = React7.useState(null);
3756
3753
  const editorRef = React7.useRef(null);
3754
+ React7.useImperativeHandle(ref, () => editorRef.current, []);
3757
3755
  const handleContainerClick = (e) => {
3758
3756
  const target = e.target;
3759
- const isToolbarClick = target.closest(".toolbar");
3760
- if (!isToolbarClick && editorRef.current) {
3761
- editorRef.current.focus();
3757
+ const isToolbarClick = target.closest(".mdxeditor-toolbar");
3758
+ const isTableClick = target.closest("table");
3759
+ if (!isToolbarClick && !isTableClick) {
3760
+ editorRef.current?.focus();
3762
3761
  }
3763
3762
  };
3764
- return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { ...containerProps, children: /* @__PURE__ */ jsxRuntime.jsx(
3763
+ return /* @__PURE__ */ jsxRuntime.jsx(
3765
3764
  react.Box,
3766
3765
  {
3767
3766
  width: "100%",
3767
+ height: "100%",
3768
3768
  borderWidth: "1px",
3769
3769
  borderRadius: "lg",
3770
3770
  overflow: "hidden",
3771
3771
  onClick: handleContainerClick,
3772
3772
  cursor: "text",
3773
+ ...containerProps,
3773
3774
  sx: {
3774
3775
  ...containerProps?.sx,
3775
3776
  ".mdxeditor": {
3776
3777
  width: "100%",
3777
3778
  minHeight: "300px",
3778
- bg: theme.colors.white,
3779
+ height: "100%",
3780
+ bg: "white",
3779
3781
  display: "flex",
3780
3782
  flexDirection: "column"
3781
3783
  },
3782
- ".toolbar": {
3784
+ ".mdxeditor-toolbar": {
3783
3785
  display: "flex",
3784
3786
  gap: theme.space[2],
3785
3787
  p: theme.space[2],
3786
3788
  borderBottomWidth: "1px",
3787
- bg: theme.colors.gray[50],
3789
+ bg: "gray.50",
3788
3790
  flexShrink: 0,
3789
3791
  cursor: "default"
3790
3792
  },
@@ -3793,7 +3795,9 @@ function MDXEditor({
3793
3795
  flex: 1,
3794
3796
  display: "flex",
3795
3797
  flexDirection: "column",
3796
- minHeight: 0
3798
+ minHeight: 0,
3799
+ height: "100%",
3800
+ overflow: "auto"
3797
3801
  },
3798
3802
  // Target the actual contenteditable element
3799
3803
  '[contenteditable="true"]': {
@@ -3809,12 +3813,12 @@ function MDXEditor({
3809
3813
  },
3810
3814
  ".content-editable": {
3811
3815
  padding: theme.space[4],
3812
- color: theme.colors.black,
3816
+ color: "black",
3813
3817
  display: "flex",
3814
3818
  flexDirection: "column",
3815
3819
  gap: theme.space[1.5],
3816
3820
  flex: 1,
3817
- minHeight: "100%",
3821
+ height: "100%",
3818
3822
  "h1, h2, h3, h4, h5": {
3819
3823
  marginBottom: theme.space[0.5],
3820
3824
  fontWeight: "bold"
@@ -3847,23 +3851,29 @@ function MDXEditor({
3847
3851
  },
3848
3852
  blockquote: {
3849
3853
  borderLeftWidth: "4px",
3850
- borderLeftColor: theme.colors.blue[200],
3851
- bg: theme.colors.blue[50],
3854
+ borderLeftColor: "primary.light",
3855
+ bg: "primary.lighter",
3852
3856
  pl: theme.space[4],
3853
3857
  py: theme.space[2],
3854
3858
  my: theme.space[4],
3855
- color: theme.colors.gray[700]
3859
+ color: "gray.800"
3856
3860
  },
3857
3861
  a: {
3858
- color: theme.colors.blue[500],
3862
+ color: "primary.main",
3859
3863
  textDecoration: "underline"
3860
3864
  },
3861
3865
  code: {
3862
3866
  fontFamily: "mono",
3863
- bg: theme.colors.gray[100],
3867
+ bg: "gray.100",
3864
3868
  px: theme.space[1],
3865
- borderRadius: theme.radii.sm
3869
+ borderRadius: theme.radii.sm,
3870
+ span: {
3871
+ bg: "transparent"
3872
+ }
3866
3873
  }
3874
+ },
3875
+ ".mdxeditor-diff-source-wrapper": {
3876
+ overflow: "auto"
3867
3877
  }
3868
3878
  },
3869
3879
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3873,19 +3883,36 @@ function MDXEditor({
3873
3883
  contentEditableClassName: "content-editable",
3874
3884
  overlayContainer: typeof document !== "undefined" ? document.body : void 0,
3875
3885
  autoFocus,
3886
+ onError: ({ error: error2 }) => {
3887
+ setError(error2);
3888
+ onError?.(error2);
3889
+ },
3876
3890
  plugins: [
3877
3891
  editor.headingsPlugin({
3878
3892
  allowedHeadingLevels: [2, 3, 4, 5]
3879
3893
  }),
3894
+ editor.linkPlugin(),
3880
3895
  editor.listsPlugin(),
3896
+ editor.imagePlugin(),
3881
3897
  editor.quotePlugin(),
3882
3898
  editor.thematicBreakPlugin(),
3883
3899
  editor.markdownShortcutPlugin(),
3900
+ editor.tablePlugin(),
3901
+ editor.diffSourcePlugin(),
3884
3902
  editor.toolbarPlugin({
3885
3903
  toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3886
3904
  /* @__PURE__ */ jsxRuntime.jsx(editor.UndoRedo, {}),
3905
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
3887
3906
  /* @__PURE__ */ jsxRuntime.jsx(editor.BoldItalicUnderlineToggles, {}),
3888
- /* @__PURE__ */ jsxRuntime.jsx(editor.BlockTypeSelect, {})
3907
+ /* @__PURE__ */ jsxRuntime.jsx(editor.CodeToggle, {}),
3908
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
3909
+ /* @__PURE__ */ jsxRuntime.jsx(editor.ListsToggle, {}),
3910
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
3911
+ /* @__PURE__ */ jsxRuntime.jsx(editor.BlockTypeSelect, {}),
3912
+ /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
3913
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertTable, {}),
3914
+ /* @__PURE__ */ jsxRuntime.jsx(editor.InsertThematicBreak, {}),
3915
+ error && /* @__PURE__ */ jsxRuntime.jsx(editor.DiffSourceToggleWrapper, { options: ["rich-text", "source"], children: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) })
3889
3916
  ] })
3890
3917
  })
3891
3918
  ],
@@ -3893,8 +3920,9 @@ function MDXEditor({
3893
3920
  }
3894
3921
  )
3895
3922
  }
3896
- ) });
3897
- }
3923
+ );
3924
+ });
3925
+ MDXEditor.displayName = "MDXEditor";
3898
3926
  var MenuButton = ({ as, ...rest }) => {
3899
3927
  return /* @__PURE__ */ jsxRuntime.jsx(react.MenuButton, { as, ...rest });
3900
3928
  };