@cgi-learning-hub/ui 1.15.0-dev.1788530642 → 1.15.0-dev.1788870644

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.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-DldG1AFs.cjs");
2
+ const require_src = require("./src-DLUPogQT.cjs");
3
3
  let _mui_material_Accordion = require("@mui/material/Accordion");
4
4
  let _mui_material_AccordionActions = require("@mui/material/AccordionActions");
5
5
  let _mui_material_AccordionDetails = require("@mui/material/AccordionDetails");
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ListSubheader, $t as FolderCard, A as DialogTitle, At as TableSortLabel, B as Grid, Bt as ZoomControl, C as CircularProgress, Ct as TableBody, D as DialogActions, Dt as TableHead, E as Container, Et as TableFooter, F as FormControlLabel, Ft as Toolbar, G as InputLabel, Gt as ResourceCard, H as IconButton, Ht as ICON_TYPE, I as FormGroup, It as Tooltip, J as List, Jt as LoaderBackdrop, K as LinearProgress, Kt as QueryError, L as FormHelperText, Lt as Typography, M as Drawer, Mt as TextField, N as Fade, Nt as ToggleButton, O as DialogContent, Ot as TablePagination, P as FormControl, Pt as ToggleButtonGroup, Q as ListItemText, Qt as Heading, R as FormLabel, Rt as Zoom, S as Chip, St as Table, T as Collapse, Tt as TableContainer, U as Input, Ut as TimePicker, V as Grow, Vt as TreeView, W as InputBase, Wt as SearchInput, X as ListItemButton, Xt as ImagePicker, Y as ListItem, Yt as Loader, Z as ListItemIcon, _ as CardActions, _n as TabList, _t as StepLabel, a as AlertTitle, an as Dialog, at as Paper, b as CardMedia, bn as getTabId, bt as Switch, c as Avatar, cn as DEFAULT_COLOR_OPTIONS, ct as RadioGroup, d as Box, dn as Alert, dt as Slide, en as FileList, et as Menu, f as Breadcrumbs, fn as ActionBar, ft as Slider, g as CardActionArea, gt as StepButton, h as Card, hn as tabPanelClasses, ht as Step, i as AccordionSummary, in as Dropzone, it as Pagination, j as Divider, jt as Tabs, k as DialogContentText, kt as TableRow, l as Backdrop, lt as Select, m as ButtonGroup, mn as getTabPanelUtilityClass, mt as Stack, n as AccordionActions, nn as EmptyState, nt as MobileStepper, o as AppBar, on as DatePicker, ot as Popover, p as Button, pn as TabPanel, pt as Snackbar, q as Link, qt as PasswordInput, r as AccordionDetails, rn as EllipsisWithTooltip, rt as Modal, s as Autocomplete, sn as ColorPicker, st as Radio, t as Accordion, tn as FileListItem, tt as MenuItem, u as Badge, ut as Skeleton, v as CardContent, vn as TabContext, vt as Stepper, w as ClickAwayListener, wt as TableCell, x as Checkbox, xn as useTabContext, xt as Tab, y as CardHeader, yn as getPanelId, yt as SvgIcon, z as GlobalStyles, zt as useMediaQuery } from "./src-2xPjYvOK.js";
1
+ import { $ as ListSubheader, $t as FolderCard, A as DialogTitle, At as TableSortLabel, B as Grid, Bt as ZoomControl, C as CircularProgress, Ct as TableBody, D as DialogActions, Dt as TableHead, E as Container, Et as TableFooter, F as FormControlLabel, Ft as Toolbar, G as InputLabel, Gt as ResourceCard, H as IconButton, Ht as ICON_TYPE, I as FormGroup, It as Tooltip, J as List, Jt as LoaderBackdrop, K as LinearProgress, Kt as QueryError, L as FormHelperText, Lt as Typography, M as Drawer, Mt as TextField, N as Fade, Nt as ToggleButton, O as DialogContent, Ot as TablePagination, P as FormControl, Pt as ToggleButtonGroup, Q as ListItemText, Qt as Heading, R as FormLabel, Rt as Zoom, S as Chip, St as Table, T as Collapse, Tt as TableContainer, U as Input, Ut as TimePicker, V as Grow, Vt as TreeView, W as InputBase, Wt as SearchInput, X as ListItemButton, Xt as ImagePicker, Y as ListItem, Yt as Loader, Z as ListItemIcon, _ as CardActions, _n as TabList, _t as StepLabel, a as AlertTitle, an as Dialog, at as Paper, b as CardMedia, bn as getTabId, bt as Switch, c as Avatar, cn as DEFAULT_COLOR_OPTIONS, ct as RadioGroup, d as Box, dn as Alert, dt as Slide, en as FileList, et as Menu, f as Breadcrumbs, fn as ActionBar, ft as Slider, g as CardActionArea, gt as StepButton, h as Card, hn as tabPanelClasses, ht as Step, i as AccordionSummary, in as Dropzone, it as Pagination, j as Divider, jt as Tabs, k as DialogContentText, kt as TableRow, l as Backdrop, lt as Select, m as ButtonGroup, mn as getTabPanelUtilityClass, mt as Stack, n as AccordionActions, nn as EmptyState, nt as MobileStepper, o as AppBar, on as DatePicker, ot as Popover, p as Button, pn as TabPanel, pt as Snackbar, q as Link, qt as PasswordInput, r as AccordionDetails, rn as EllipsisWithTooltip, rt as Modal, s as Autocomplete, sn as ColorPicker, st as Radio, t as Accordion, tn as FileListItem, tt as MenuItem, u as Badge, ut as Skeleton, v as CardContent, vn as TabContext, vt as Stepper, w as ClickAwayListener, wt as TableCell, x as Checkbox, xn as useTabContext, xt as Tab, y as CardHeader, yn as getPanelId, yt as SvgIcon, z as GlobalStyles, zt as useMediaQuery } from "./src-CUvREoVb.js";
2
2
  export * from "@mui/material/Tabs";
3
3
  export * from "@mui/material/styles";
4
4
  export * from "@mui/material/Accordion";
@@ -2023,7 +2023,7 @@ var ColorPicker = ({ disabled = false, options, value, onChange, slotProps, useC
2023
2023
  });
2024
2024
  };
2025
2025
  //#endregion
2026
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/formatErrorMessage/formatErrorMessage.mjs
2026
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/formatErrorMessage/formatErrorMessage.mjs
2027
2027
  /**
2028
2028
  * WARNING: Don't import this directly. It's imported by the code generated by
2029
2029
  * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
@@ -2610,7 +2610,7 @@ var require_advancedFormat = /* @__PURE__ */ __commonJSMin(((exports, module) =>
2610
2610
  }));
2611
2611
  }));
2612
2612
  //#endregion
2613
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/warning/warning.mjs
2613
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/warning/warning.mjs
2614
2614
  var warnedOnceCache = /* @__PURE__ */ new Set();
2615
2615
  /**
2616
2616
  * Logs a message to the console on development mode. The warning will only be logged once.
@@ -25546,7 +25546,7 @@ function lruMemoize(func, equalityCheckOrOptions) {
25546
25546
  return memoized;
25547
25547
  }
25548
25548
  //#endregion
25549
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/createSelector.mjs
25549
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/createSelector.mjs
25550
25550
  var reselectCreateSelector = createSelectorCreator({
25551
25551
  memoize: lruMemoize,
25552
25552
  memoizeOptions: {
@@ -25704,7 +25704,7 @@ var createSelectorMemoizedWithOptions = (options) => (...inputs) => {
25704
25704
  */
25705
25705
  var createSelectorMemoized = createSelectorMemoizedWithOptions();
25706
25706
  //#endregion
25707
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/useStore.mjs
25707
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/useStore.mjs
25708
25708
  var useStoreImplementation = parseInt(React$1.version, 10) >= 19 ? useStoreR19 : useStoreLegacy;
25709
25709
  function useStore(store, selector, a1, a2, a3) {
25710
25710
  return useStoreImplementation(store, selector, a1, a2, a3);
@@ -25723,7 +25723,7 @@ function useStoreLegacy(store, selector, a1, a2, a3) {
25723
25723
  return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3));
25724
25724
  }
25725
25725
  //#endregion
25726
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/Store.mjs
25726
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/store/Store.mjs
25727
25727
  var Store = class Store {
25728
25728
  static create(state) {
25729
25729
  return new Store(state);
@@ -25937,7 +25937,7 @@ function TreeViewProvider(props) {
25937
25937
  });
25938
25938
  }
25939
25939
  //#endregion
25940
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/fastObjectShallowCompare/fastObjectShallowCompare.mjs
25940
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/fastObjectShallowCompare/fastObjectShallowCompare.mjs
25941
25941
  var is = Object.is;
25942
25942
  /**
25943
25943
  * Fast shallow compare for objects.
@@ -28180,7 +28180,7 @@ function useOnMount(fn) {
28180
28180
  */
28181
28181
  var SafeReact = { ...React$1 };
28182
28182
  //#endregion
28183
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/disposable/index.mjs
28183
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/disposable/index.mjs
28184
28184
  /**
28185
28185
  * Well-known `Symbol.dispose`. Resolves to the native well-known symbol when
28186
28186
  * the runtime ships the explicit resource management proposal; otherwise falls
@@ -28297,7 +28297,7 @@ function unwrapSuppressedErrors(error) {
28297
28297
  return failures;
28298
28298
  }
28299
28299
  //#endregion
28300
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/useDisposable/useDisposable.mjs
28300
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/useDisposable/useDisposable.mjs
28301
28301
  var STRICT_MODE_BITS = 16;
28302
28302
  var SafeReactInternals = SafeReact;
28303
28303
  var ReactInternals = SafeReactInternals.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE ?? SafeReactInternals.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -28400,7 +28400,7 @@ function useTreeViewStore(StoreClass, parameters) {
28400
28400
  return store;
28401
28401
  }
28402
28402
  //#endregion
28403
- //#region ../../node_modules/.pnpm/@mui+x-internals@9.12.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/EventManager/EventManager.mjs
28403
+ //#region ../../node_modules/.pnpm/@mui+x-internals@9.13.0_@types+react@19.2.18_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@mui/x-internals/EventManager/EventManager.mjs
28404
28404
  var EventManager = class {
28405
28405
  maxListeners = 20;
28406
28406
  warnOnce = false;
@@ -29562,4 +29562,4 @@ var ZoomControl = ({ step = 10, value = 50, onChange, max = 100, min = 0, label
29562
29562
  //#endregion
29563
29563
  export { ListSubheader as $, FolderCard as $t, DialogTitle as A, TableSortLabel as At, Grid as B, ZoomControl as Bt, CircularProgress$1 as C, TableBody as Ct, DialogActions$1 as D, TableHead as Dt, Container as E, TableFooter as Et, FormControlLabel as F, Toolbar as Ft, InputLabel$1 as G, ResourceCard as Gt, IconButton as H, ICON_TYPE as Ht, FormGroup as I, Tooltip$1 as It, List$1 as J, LoaderBackdrop as Jt, LinearProgress as K, QueryError as Kt, FormHelperText$1 as L, Typography$1 as Lt, Drawer as M, TextField$1 as Mt, Fade$1 as N, ToggleButton as Nt, DialogContent$1 as O, TablePagination as Ot, FormControl$1 as P, ToggleButtonGroup as Pt, ListItemText$1 as Q, Heading as Qt, FormLabel as R, Zoom as Rt, Chip$1 as S, Table as St, Collapse$1 as T, TableContainer as Tt, Input as U, TimePicker as Ut, Grow$1 as V, TreeView as Vt, InputBase$1 as W, SearchInput as Wt, ListItemButton$1 as X, ImagePicker as Xt, ListItem$1 as Y, Loader as Yt, ListItemIcon$1 as Z, DeleteRounded_default as Zt, CardActions as _, TabList as _n, StepLabel as _t, AlertTitle$1 as a, Dialog as an, Paper as at, CardMedia$1 as b, getTabId as bn, Switch as bt, Avatar as c, DEFAULT_COLOR_OPTIONS as cn, RadioGroup as ct, Box$1 as d, Alert as dn, Slide as dt, FileList as en, Menu as et, Breadcrumbs as f, ActionBar as fn, Slider as ft, CardActionArea as g, clsx as gn, StepButton as gt, Card$1 as h, tabPanelClasses as hn, Step as ht, AccordionSummary as i, Dropzone as in, Pagination as it, Divider$1 as j, Tabs$1 as jt, DialogContentText as k, TableRow as kt, Backdrop$1 as l, SvgIcon_default as ln, Select as lt, ButtonGroup as m, getTabPanelUtilityClass as mn, Stack$1 as mt, AccordionActions as n, EmptyState as nn, MobileStepper as nt, AppBar as o, DatePicker as on, Popover as ot, Button$1 as p, TabPanel as pn, Snackbar as pt, Link as q, PasswordInput as qt, AccordionDetails as r, EllipsisWithTooltip as rn, Modal as rt, Autocomplete as s, ColorPicker as sn, Radio as st, Accordion as t, FileListItem as tn, MenuItem$1 as tt, Badge as u, Circle as un, Skeleton as ut, CardContent$1 as v, TabContext as vn, Stepper as vt, ClickAwayListener$1 as w, TableCell as wt, Checkbox as x, useTabContext as xn, Tab as xt, CardHeader as y, getPanelId as yn, SvgIcon as yt, GlobalStyles as z, useMediaQuery$1 as zt };
29564
29564
 
29565
- //# sourceMappingURL=src-2xPjYvOK.js.map
29565
+ //# sourceMappingURL=src-CUvREoVb.js.map
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("../src-DldG1AFs.cjs");
2
+ const require_src = require("../src-DLUPogQT.cjs");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  let _mui_material_styles = require("@mui/material/styles");
@@ -2951,6 +2951,139 @@ var UndoRedoButton = (0, react.forwardRef)(({ editor: providedEditor, action, te
2951
2951
  });
2952
2952
  UndoRedoButton.displayName = "UndoRedoButton";
2953
2953
  //#endregion
2954
+ //#region src/tiptap/components/ui-primitive/formatting-controls/const.tsx
2955
+ var BUTTON_DEFS = [
2956
+ {
2957
+ id: "undo",
2958
+ extensionName: "undoRedo",
2959
+ group: "history",
2960
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UndoRedoButton, { action: "undo" })
2961
+ },
2962
+ {
2963
+ id: "redo",
2964
+ extensionName: "undoRedo",
2965
+ group: "history",
2966
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UndoRedoButton, { action: "redo" })
2967
+ },
2968
+ {
2969
+ id: "heading",
2970
+ extensionName: "heading",
2971
+ group: "blocks",
2972
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeadingMenu, {
2973
+ modal: false,
2974
+ levels: [
2975
+ 1,
2976
+ 2,
2977
+ 3,
2978
+ 4
2979
+ ]
2980
+ })
2981
+ },
2982
+ {
2983
+ id: "bulletList",
2984
+ extensionName: "bulletList",
2985
+ group: "blocks",
2986
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListButton, { type: "bulletList" })
2987
+ },
2988
+ {
2989
+ id: "orderedList",
2990
+ extensionName: "orderedList",
2991
+ group: "blocks",
2992
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListButton, { type: "orderedList" })
2993
+ },
2994
+ {
2995
+ id: "blockquote",
2996
+ extensionName: "blockquote",
2997
+ group: "blocks",
2998
+ Component: BlockquoteButton
2999
+ },
3000
+ {
3001
+ id: "codeBlock",
3002
+ extensionName: "codeBlock",
3003
+ group: "blocks",
3004
+ Component: CodeBlockButton
3005
+ },
3006
+ {
3007
+ id: "textColor",
3008
+ extensionName: "textStyle",
3009
+ group: "marks",
3010
+ Component: TextColorPopover
3011
+ },
3012
+ {
3013
+ id: "bold",
3014
+ extensionName: "bold",
3015
+ group: "marks",
3016
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "bold" })
3017
+ },
3018
+ {
3019
+ id: "italic",
3020
+ extensionName: "italic",
3021
+ group: "marks",
3022
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "italic" })
3023
+ },
3024
+ {
3025
+ id: "strike",
3026
+ extensionName: "strike",
3027
+ group: "marks",
3028
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "strike" })
3029
+ },
3030
+ {
3031
+ id: "code",
3032
+ extensionName: "code",
3033
+ group: "marks",
3034
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "code" })
3035
+ },
3036
+ {
3037
+ id: "underline",
3038
+ extensionName: "underline",
3039
+ group: "marks",
3040
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "underline" })
3041
+ },
3042
+ {
3043
+ id: "link",
3044
+ extensionName: "link",
3045
+ group: "marks",
3046
+ Component: LinkPopover
3047
+ },
3048
+ {
3049
+ id: "superscript",
3050
+ extensionName: "superscript",
3051
+ group: "scripts",
3052
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "superscript" })
3053
+ },
3054
+ {
3055
+ id: "subscript",
3056
+ extensionName: "subscript",
3057
+ group: "scripts",
3058
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "subscript" })
3059
+ },
3060
+ {
3061
+ id: "alignLeft",
3062
+ extensionName: "textAlign",
3063
+ group: "textAlign",
3064
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "left" })
3065
+ },
3066
+ {
3067
+ id: "alignCenter",
3068
+ extensionName: "textAlign",
3069
+ group: "textAlign",
3070
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "center" })
3071
+ },
3072
+ {
3073
+ id: "alignRight",
3074
+ extensionName: "textAlign",
3075
+ group: "textAlign",
3076
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "right" })
3077
+ },
3078
+ {
3079
+ id: "alignJustify",
3080
+ extensionName: "textAlign",
3081
+ group: "textAlign",
3082
+ Component: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "justify" })
3083
+ }
3084
+ ];
3085
+ var BUTTON_IDS = BUTTON_DEFS.map((def) => def.id);
3086
+ //#endregion
2954
3087
  //#region src/tiptap/hooks/use-composed-ref.ts
2955
3088
  var updateRef = (ref, value) => {
2956
3089
  if (typeof ref === "function") ref(value);
@@ -3196,48 +3329,28 @@ var ToolbarSeparator = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_mat
3196
3329
  });
3197
3330
  ToolbarSeparator.displayName = "ToolbarSeparator";
3198
3331
  //#endregion
3332
+ //#region src/tiptap/components/ui-primitive/formatting-controls/hooks.ts
3333
+ var useFormattingItems = (editor) => {
3334
+ return (0, react.useMemo)(() => {
3335
+ if (!editor) return [];
3336
+ return BUTTON_DEFS.filter((def) => def.extensionName ? editor.extensionManager.extensions.some((e) => e.name === def.extensionName) : true);
3337
+ }, [editor]);
3338
+ };
3339
+ //#endregion
3340
+ //#region src/tiptap/components/ui-primitive/formatting-controls/utils.ts
3341
+ function groupBy(items, getKey) {
3342
+ return items.reduce((acc, item) => {
3343
+ const key = getKey(item);
3344
+ (acc[key] ??= []).push(item);
3345
+ return acc;
3346
+ }, {});
3347
+ }
3348
+ //#endregion
3199
3349
  //#region src/tiptap/components/ui-primitive/formatting-controls/formatting-controls.tsx
3200
- var FormattingControls = ({ editor }) => {
3201
- const extensionNames = editor.extensionManager.extensions.map((e) => e.name);
3202
- const hasSuperscriptSubscript = extensionNames.some((name) => name === "subscript" || name === "superscript");
3203
- const hasTextStyle = extensionNames.some((name) => name === "textStyle");
3204
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3205
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarGroup, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UndoRedoButton, { action: "undo" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UndoRedoButton, { action: "redo" })] }),
3206
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarSeparator, {}),
3207
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarGroup, { children: [
3208
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeadingMenu, {
3209
- modal: false,
3210
- levels: [
3211
- 1,
3212
- 2,
3213
- 3,
3214
- 4
3215
- ]
3216
- }),
3217
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListButton, { type: "bulletList" }),
3218
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ListButton, { type: "orderedList" }),
3219
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockquoteButton, {}),
3220
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeBlockButton, {})
3221
- ] }),
3222
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarSeparator, {}),
3223
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarGroup, { children: [
3224
- hasTextStyle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextColorPopover, {}) : null,
3225
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "bold" }),
3226
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "italic" }),
3227
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "strike" }),
3228
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "code" }),
3229
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "underline" }),
3230
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkPopover, {})
3231
- ] }),
3232
- hasSuperscriptSubscript ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarSeparator, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarGroup, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "superscript" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkButton, { type: "subscript" })] })] }) : null,
3233
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarSeparator, {}),
3234
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarGroup, { children: [
3235
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "left" }),
3236
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "center" }),
3237
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "right" }),
3238
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextAlignButton, { align: "justify" })
3239
- ] })
3240
- ] });
3350
+ var FormattingControls = ({ editor, include }) => {
3351
+ const items = useFormattingItems(editor);
3352
+ const groups = groupBy(include ? items.filter((button) => include.includes(button.id)) : items, (button) => button.group);
3353
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Object.entries(groups).map(([groupId, groupItems], index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [index > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarSeparator, {}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarGroup, { children: groupItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(item.Component, {}, item.id)) })] }, groupId)) });
3241
3354
  };
3242
3355
  FormattingControls.displayName = "FormattingControls";
3243
3356
  //#endregion
@@ -3257,6 +3370,7 @@ function Spacer({ orientation = "horizontal", size, style = {}, ...props }) {
3257
3370
  });
3258
3371
  }
3259
3372
  //#endregion
3373
+ exports.BUTTON_IDS = BUTTON_IDS;
3260
3374
  exports.FormattingControls = FormattingControls;
3261
3375
  exports.Spacer = Spacer;
3262
3376
  exports.Toolbar = Toolbar;
@@ -7,13 +7,25 @@ declare type BaseProps = React.HTMLAttributes<HTMLDivElement>;
7
7
 
8
8
  declare type BaseProps_2 = React.HTMLAttributes<HTMLDivElement>;
9
9
 
10
+ export declare const BUTTON_IDS: string[];
11
+
12
+ declare type ButtonDef = {
13
+ Component: React.FC;
14
+ extensionName: string;
15
+ group: ButtonGroup;
16
+ id: string;
17
+ };
18
+
19
+ declare type ButtonGroup = "history" | "blocks" | "marks" | "scripts" | "textAlign";
20
+
10
21
  export declare const FormattingControls: {
11
- ({ editor }: FormattingControlsProps): JSX.Element;
22
+ ({ editor, include, }: FormattingControlsProps): JSX.Element;
12
23
  displayName: string;
13
24
  };
14
25
 
15
26
  declare interface FormattingControlsProps extends BaseProps {
16
27
  editor: Editor;
28
+ include?: ButtonDef["id"][];
17
29
  }
18
30
 
19
31
  export declare function Spacer({ orientation, size, style, ...props }: React.ComponentProps<"div"> & {
@@ -1,4 +1,4 @@
1
- import { H as IconButton, It as Tooltip, Lt as Typography, Nt as ToggleButton, W as InputBase, Zt as DeleteRounded_default, et as Menu, gn as clsx, j as Divider, ln as SvgIcon_default, mt as Stack, ot as Popover, tt as MenuItem, u as Badge, un as Circle } from "../src-2xPjYvOK.js";
1
+ import { H as IconButton, It as Tooltip, Lt as Typography, Nt as ToggleButton, W as InputBase, Zt as DeleteRounded_default, et as Menu, gn as clsx, j as Divider, ln as SvgIcon_default, mt as Stack, ot as Popover, tt as MenuItem, u as Badge, un as Circle } from "../src-CUvREoVb.js";
2
2
  import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { styled } from "@mui/material/styles";
@@ -2927,6 +2927,139 @@ var UndoRedoButton = forwardRef(({ editor: providedEditor, action, text, hideWhe
2927
2927
  });
2928
2928
  UndoRedoButton.displayName = "UndoRedoButton";
2929
2929
  //#endregion
2930
+ //#region src/tiptap/components/ui-primitive/formatting-controls/const.tsx
2931
+ var BUTTON_DEFS = [
2932
+ {
2933
+ id: "undo",
2934
+ extensionName: "undoRedo",
2935
+ group: "history",
2936
+ Component: () => /* @__PURE__ */ jsx(UndoRedoButton, { action: "undo" })
2937
+ },
2938
+ {
2939
+ id: "redo",
2940
+ extensionName: "undoRedo",
2941
+ group: "history",
2942
+ Component: () => /* @__PURE__ */ jsx(UndoRedoButton, { action: "redo" })
2943
+ },
2944
+ {
2945
+ id: "heading",
2946
+ extensionName: "heading",
2947
+ group: "blocks",
2948
+ Component: () => /* @__PURE__ */ jsx(HeadingMenu, {
2949
+ modal: false,
2950
+ levels: [
2951
+ 1,
2952
+ 2,
2953
+ 3,
2954
+ 4
2955
+ ]
2956
+ })
2957
+ },
2958
+ {
2959
+ id: "bulletList",
2960
+ extensionName: "bulletList",
2961
+ group: "blocks",
2962
+ Component: () => /* @__PURE__ */ jsx(ListButton, { type: "bulletList" })
2963
+ },
2964
+ {
2965
+ id: "orderedList",
2966
+ extensionName: "orderedList",
2967
+ group: "blocks",
2968
+ Component: () => /* @__PURE__ */ jsx(ListButton, { type: "orderedList" })
2969
+ },
2970
+ {
2971
+ id: "blockquote",
2972
+ extensionName: "blockquote",
2973
+ group: "blocks",
2974
+ Component: BlockquoteButton
2975
+ },
2976
+ {
2977
+ id: "codeBlock",
2978
+ extensionName: "codeBlock",
2979
+ group: "blocks",
2980
+ Component: CodeBlockButton
2981
+ },
2982
+ {
2983
+ id: "textColor",
2984
+ extensionName: "textStyle",
2985
+ group: "marks",
2986
+ Component: TextColorPopover
2987
+ },
2988
+ {
2989
+ id: "bold",
2990
+ extensionName: "bold",
2991
+ group: "marks",
2992
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "bold" })
2993
+ },
2994
+ {
2995
+ id: "italic",
2996
+ extensionName: "italic",
2997
+ group: "marks",
2998
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "italic" })
2999
+ },
3000
+ {
3001
+ id: "strike",
3002
+ extensionName: "strike",
3003
+ group: "marks",
3004
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "strike" })
3005
+ },
3006
+ {
3007
+ id: "code",
3008
+ extensionName: "code",
3009
+ group: "marks",
3010
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "code" })
3011
+ },
3012
+ {
3013
+ id: "underline",
3014
+ extensionName: "underline",
3015
+ group: "marks",
3016
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "underline" })
3017
+ },
3018
+ {
3019
+ id: "link",
3020
+ extensionName: "link",
3021
+ group: "marks",
3022
+ Component: LinkPopover
3023
+ },
3024
+ {
3025
+ id: "superscript",
3026
+ extensionName: "superscript",
3027
+ group: "scripts",
3028
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "superscript" })
3029
+ },
3030
+ {
3031
+ id: "subscript",
3032
+ extensionName: "subscript",
3033
+ group: "scripts",
3034
+ Component: () => /* @__PURE__ */ jsx(MarkButton, { type: "subscript" })
3035
+ },
3036
+ {
3037
+ id: "alignLeft",
3038
+ extensionName: "textAlign",
3039
+ group: "textAlign",
3040
+ Component: () => /* @__PURE__ */ jsx(TextAlignButton, { align: "left" })
3041
+ },
3042
+ {
3043
+ id: "alignCenter",
3044
+ extensionName: "textAlign",
3045
+ group: "textAlign",
3046
+ Component: () => /* @__PURE__ */ jsx(TextAlignButton, { align: "center" })
3047
+ },
3048
+ {
3049
+ id: "alignRight",
3050
+ extensionName: "textAlign",
3051
+ group: "textAlign",
3052
+ Component: () => /* @__PURE__ */ jsx(TextAlignButton, { align: "right" })
3053
+ },
3054
+ {
3055
+ id: "alignJustify",
3056
+ extensionName: "textAlign",
3057
+ group: "textAlign",
3058
+ Component: () => /* @__PURE__ */ jsx(TextAlignButton, { align: "justify" })
3059
+ }
3060
+ ];
3061
+ var BUTTON_IDS = BUTTON_DEFS.map((def) => def.id);
3062
+ //#endregion
2930
3063
  //#region src/tiptap/hooks/use-composed-ref.ts
2931
3064
  var updateRef = (ref, value) => {
2932
3065
  if (typeof ref === "function") ref(value);
@@ -3172,48 +3305,28 @@ var ToolbarSeparator = () => /* @__PURE__ */ jsx(Divider, {
3172
3305
  });
3173
3306
  ToolbarSeparator.displayName = "ToolbarSeparator";
3174
3307
  //#endregion
3308
+ //#region src/tiptap/components/ui-primitive/formatting-controls/hooks.ts
3309
+ var useFormattingItems = (editor) => {
3310
+ return useMemo(() => {
3311
+ if (!editor) return [];
3312
+ return BUTTON_DEFS.filter((def) => def.extensionName ? editor.extensionManager.extensions.some((e) => e.name === def.extensionName) : true);
3313
+ }, [editor]);
3314
+ };
3315
+ //#endregion
3316
+ //#region src/tiptap/components/ui-primitive/formatting-controls/utils.ts
3317
+ function groupBy(items, getKey) {
3318
+ return items.reduce((acc, item) => {
3319
+ const key = getKey(item);
3320
+ (acc[key] ??= []).push(item);
3321
+ return acc;
3322
+ }, {});
3323
+ }
3324
+ //#endregion
3175
3325
  //#region src/tiptap/components/ui-primitive/formatting-controls/formatting-controls.tsx
3176
- var FormattingControls = ({ editor }) => {
3177
- const extensionNames = editor.extensionManager.extensions.map((e) => e.name);
3178
- const hasSuperscriptSubscript = extensionNames.some((name) => name === "subscript" || name === "superscript");
3179
- const hasTextStyle = extensionNames.some((name) => name === "textStyle");
3180
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3181
- /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(UndoRedoButton, { action: "undo" }), /* @__PURE__ */ jsx(UndoRedoButton, { action: "redo" })] }),
3182
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3183
- /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
3184
- /* @__PURE__ */ jsx(HeadingMenu, {
3185
- modal: false,
3186
- levels: [
3187
- 1,
3188
- 2,
3189
- 3,
3190
- 4
3191
- ]
3192
- }),
3193
- /* @__PURE__ */ jsx(ListButton, { type: "bulletList" }),
3194
- /* @__PURE__ */ jsx(ListButton, { type: "orderedList" }),
3195
- /* @__PURE__ */ jsx(BlockquoteButton, {}),
3196
- /* @__PURE__ */ jsx(CodeBlockButton, {})
3197
- ] }),
3198
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3199
- /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
3200
- hasTextStyle ? /* @__PURE__ */ jsx(TextColorPopover, {}) : null,
3201
- /* @__PURE__ */ jsx(MarkButton, { type: "bold" }),
3202
- /* @__PURE__ */ jsx(MarkButton, { type: "italic" }),
3203
- /* @__PURE__ */ jsx(MarkButton, { type: "strike" }),
3204
- /* @__PURE__ */ jsx(MarkButton, { type: "code" }),
3205
- /* @__PURE__ */ jsx(MarkButton, { type: "underline" }),
3206
- /* @__PURE__ */ jsx(LinkPopover, {})
3207
- ] }),
3208
- hasSuperscriptSubscript ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToolbarSeparator, {}), /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(MarkButton, { type: "superscript" }), /* @__PURE__ */ jsx(MarkButton, { type: "subscript" })] })] }) : null,
3209
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3210
- /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
3211
- /* @__PURE__ */ jsx(TextAlignButton, { align: "left" }),
3212
- /* @__PURE__ */ jsx(TextAlignButton, { align: "center" }),
3213
- /* @__PURE__ */ jsx(TextAlignButton, { align: "right" }),
3214
- /* @__PURE__ */ jsx(TextAlignButton, { align: "justify" })
3215
- ] })
3216
- ] });
3326
+ var FormattingControls = ({ editor, include }) => {
3327
+ const items = useFormattingItems(editor);
3328
+ const groups = groupBy(include ? items.filter((button) => include.includes(button.id)) : items, (button) => button.group);
3329
+ return /* @__PURE__ */ jsx(Fragment$1, { children: Object.entries(groups).map(([groupId, groupItems], index) => /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 ? /* @__PURE__ */ jsx(ToolbarSeparator, {}) : null, /* @__PURE__ */ jsx(ToolbarGroup, { children: groupItems.map((item) => /* @__PURE__ */ jsx(item.Component, {}, item.id)) })] }, groupId)) });
3217
3330
  };
3218
3331
  FormattingControls.displayName = "FormattingControls";
3219
3332
  //#endregion
@@ -3233,6 +3346,6 @@ function Spacer({ orientation = "horizontal", size, style = {}, ...props }) {
3233
3346
  });
3234
3347
  }
3235
3348
  //#endregion
3236
- export { FormattingControls, Spacer, Toolbar, ToolbarGroup, ToolbarSeparator };
3349
+ export { BUTTON_IDS, FormattingControls, Spacer, Toolbar, ToolbarGroup, ToolbarSeparator };
3237
3350
 
3238
3351
  //# sourceMappingURL=index.es.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgi-learning-hub/ui",
3
- "version": "1.15.0-dev.1788530642",
3
+ "version": "1.15.0-dev.1788870644",
4
4
  "description": "React component library for Hub's design system, built on Material UI with custom and extended components.",
5
5
  "keywords": [
6
6
  "cgi-learning-hub",