@cere/cere-design-system 0.0.6 → 0.0.9

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.mjs CHANGED
@@ -2453,7 +2453,7 @@ var ListItem3 = ({
2453
2453
  }
2454
2454
  ),
2455
2455
  children,
2456
- action && /* @__PURE__ */ jsx29(ListItemSecondaryAction, { children: action })
2456
+ action && action
2457
2457
  ] });
2458
2458
  };
2459
2459
 
@@ -2524,7 +2524,7 @@ var TableHeader = ({
2524
2524
  };
2525
2525
 
2526
2526
  // src/components/layout/Grid.tsx
2527
- import { Grid } from "@mui/material";
2527
+ import { Grid2 } from "@mui/material";
2528
2528
 
2529
2529
  // src/components/layout/Breadcrumbs.tsx
2530
2530
  import MuiBreadcrumbs from "@mui/material/Breadcrumbs";
@@ -3027,9 +3027,12 @@ var FlowEditor = ({
3027
3027
  // src/components/third-party/CodeEditor.tsx
3028
3028
  import { useCallback as useCallback4, useEffect, useState as useState4, useRef } from "react";
3029
3029
  import Editor from "@monaco-editor/react";
3030
- import { Box as Box12, IconButton as IconButton6, Tooltip as Tooltip3, Alert as Alert2 } from "@mui/material";
3030
+ import { Box as Box12, IconButton as IconButton6, Tooltip as Tooltip3 } from "@mui/material";
3031
3031
  import FullscreenIcon from "@mui/icons-material/Fullscreen";
3032
3032
  import FullscreenExitIcon from "@mui/icons-material/FullscreenExit";
3033
+ import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
3034
+ import ExpandMoreIcon2 from "@mui/icons-material/ExpandMore";
3035
+ import ExpandLessIcon from "@mui/icons-material/ExpandLess";
3033
3036
  import { jsx as jsx44, jsxs as jsxs17 } from "react/jsx-runtime";
3034
3037
  var configureTypeScript = (monaco) => {
3035
3038
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
@@ -3081,6 +3084,16 @@ var CodeEditor = ({
3081
3084
  const [actualHeight, setActualHeight] = useState4(
3082
3085
  typeof height === "number" ? `${height}px` : height
3083
3086
  );
3087
+ const [showProblems, setShowProblems] = useState4(false);
3088
+ const [hasUserToggledProblems, setHasUserToggledProblems] = useState4(false);
3089
+ useEffect(() => {
3090
+ if (hasUserToggledProblems) return;
3091
+ if (validationErrors.length > 0) {
3092
+ setShowProblems(true);
3093
+ } else {
3094
+ setShowProblems(false);
3095
+ }
3096
+ }, [validationErrors, hasUserToggledProblems]);
3084
3097
  const internalEditorRef = useRef(null);
3085
3098
  const internalMonacoRef = useRef(null);
3086
3099
  const finalEditorRef = editorRef || internalEditorRef;
@@ -3099,6 +3112,21 @@ var CodeEditor = ({
3099
3112
  onFullscreenChange(newFullscreenState);
3100
3113
  }
3101
3114
  }, [isFullscreen, onFullscreenChange]);
3115
+ const gotoMarker = useCallback4(
3116
+ (marker) => {
3117
+ const ed = finalEditorRef?.current;
3118
+ if (!ed) return;
3119
+ const position = { lineNumber: marker.startLineNumber, column: marker.startColumn || 1 };
3120
+ try {
3121
+ ed.revealPositionInCenter(position);
3122
+ ed.setPosition(position);
3123
+ ed.focus();
3124
+ } catch (e) {
3125
+ console.error("CodeEditor: Failed to navigate to marker", e);
3126
+ }
3127
+ },
3128
+ [finalEditorRef]
3129
+ );
3102
3130
  useEffect(() => {
3103
3131
  if (!isFullscreen) return;
3104
3132
  function escapeHandler(event) {
@@ -3281,14 +3309,16 @@ var CodeEditor = ({
3281
3309
  sx: {
3282
3310
  flex: 1,
3283
3311
  display: "flex",
3312
+ flexDirection: "column",
3284
3313
  overflow: "hidden",
3285
3314
  minHeight: editorMinHeight,
3286
- position: "relative"
3315
+ position: "relative",
3316
+ height: isFullscreen ? "100%" : actualHeight
3287
3317
  },
3288
3318
  children: /* @__PURE__ */ jsx44(
3289
3319
  Editor,
3290
3320
  {
3291
- height: actualHeight,
3321
+ height: "100%",
3292
3322
  defaultLanguage: language,
3293
3323
  defaultValue: value,
3294
3324
  value: tsCode,
@@ -3305,38 +3335,84 @@ var CodeEditor = ({
3305
3335
  }
3306
3336
  ),
3307
3337
  validationErrors.length > 0 && /* @__PURE__ */ jsxs17(
3308
- Alert2,
3338
+ Box12,
3309
3339
  {
3310
- severity: "error",
3311
3340
  sx: {
3312
- position: "absolute",
3313
- bottom: 8,
3314
- left: 8,
3315
- right: 8,
3316
- zIndex: 20,
3317
- boxShadow: 3,
3318
- border: "1px solid",
3319
- borderColor: "error.main",
3320
- borderRadius: 1,
3321
- maxHeight: "150px",
3322
- overflow: "auto"
3341
+ borderTop: 1,
3342
+ borderColor: "divider",
3343
+ bgcolor: "background.default",
3344
+ display: "flex",
3345
+ flexDirection: "column",
3346
+ maxHeight: showProblems ? 180 : 40,
3347
+ minHeight: 40,
3348
+ transition: "max-height 0.2s ease"
3323
3349
  },
3324
3350
  children: [
3325
- /* @__PURE__ */ jsx44(Box12, { sx: { mb: 1, fontWeight: 600 }, children: "Please fix the following errors:" }),
3326
- /* @__PURE__ */ jsxs17(Box12, { component: "ul", sx: { m: 0, pl: 2 }, children: [
3327
- validationErrors.slice(0, 3).map((error, index) => /* @__PURE__ */ jsxs17(Box12, { component: "li", sx: { fontSize: "0.85rem" }, children: [
3328
- "Line ",
3329
- error.startLineNumber,
3330
- ": ",
3331
- error.message
3332
- ] }, index)),
3333
- validationErrors.length > 3 && /* @__PURE__ */ jsxs17(Box12, { component: "li", sx: { fontSize: "0.85rem" }, children: [
3334
- validationErrors.length - 3,
3335
- " more error",
3336
- validationErrors.length - 3 > 1 ? "s" : "",
3337
- "..."
3338
- ] })
3339
- ] })
3351
+ /* @__PURE__ */ jsxs17(
3352
+ Box12,
3353
+ {
3354
+ sx: {
3355
+ display: "flex",
3356
+ alignItems: "center",
3357
+ px: 1,
3358
+ py: 0.5,
3359
+ gap: 1,
3360
+ borderBottom: showProblems ? "1px solid" : "none",
3361
+ borderColor: "divider",
3362
+ fontSize: "0.875rem",
3363
+ color: "text.secondary"
3364
+ },
3365
+ children: [
3366
+ /* @__PURE__ */ jsx44(ErrorOutlineIcon, { color: "error", fontSize: "small" }),
3367
+ /* @__PURE__ */ jsx44(Box12, { sx: { fontWeight: 600, color: "text.primary" }, children: "Problems" }),
3368
+ /* @__PURE__ */ jsxs17(Box12, { sx: { ml: 1 }, children: [
3369
+ validationErrors.length,
3370
+ " error",
3371
+ validationErrors.length > 1 ? "s" : ""
3372
+ ] }),
3373
+ /* @__PURE__ */ jsx44(Box12, { sx: { flex: 1 } }),
3374
+ /* @__PURE__ */ jsx44(
3375
+ IconButton6,
3376
+ {
3377
+ size: "small",
3378
+ "aria-label": "Toggle problems panel",
3379
+ onClick: () => {
3380
+ setHasUserToggledProblems(true);
3381
+ setShowProblems((s) => !s);
3382
+ },
3383
+ children: showProblems ? /* @__PURE__ */ jsx44(ExpandMoreIcon2, { fontSize: "small" }) : /* @__PURE__ */ jsx44(ExpandLessIcon, { fontSize: "small" })
3384
+ }
3385
+ )
3386
+ ]
3387
+ }
3388
+ ),
3389
+ showProblems && /* @__PURE__ */ jsx44(Box12, { sx: { overflow: "auto" }, children: validationErrors.map((error, index) => /* @__PURE__ */ jsxs17(
3390
+ Box12,
3391
+ {
3392
+ onClick: () => gotoMarker(error),
3393
+ sx: {
3394
+ display: "flex",
3395
+ alignItems: "center",
3396
+ px: 1.5,
3397
+ py: 0.75,
3398
+ gap: 1,
3399
+ cursor: "pointer",
3400
+ "&:hover": { bgcolor: "action.hover" },
3401
+ borderBottom: "1px dashed",
3402
+ borderColor: "divider",
3403
+ fontSize: "0.85rem"
3404
+ },
3405
+ children: [
3406
+ /* @__PURE__ */ jsx44(ErrorOutlineIcon, { color: "error", sx: { fontSize: 18 } }),
3407
+ /* @__PURE__ */ jsxs17(Box12, { sx: { color: "text.secondary", width: 64 }, children: [
3408
+ "Line ",
3409
+ error.startLineNumber
3410
+ ] }),
3411
+ /* @__PURE__ */ jsx44(Box12, { sx: { color: "text.primary", flex: 1, minWidth: 0 }, children: error.message })
3412
+ ]
3413
+ },
3414
+ `${error.startLineNumber}-${error.startColumn}-${index}`
3415
+ )) })
3340
3416
  ]
3341
3417
  }
3342
3418
  )
@@ -3384,7 +3460,7 @@ export {
3384
3460
  FormControlLabel,
3385
3461
  FormHelperText,
3386
3462
  FormLabel,
3387
- Grid,
3463
+ Grid2 as Grid,
3388
3464
  IconButton,
3389
3465
  InputAdornment2 as InputAdornment,
3390
3466
  InputLabel,