@cgi-learning-hub/ui 1.12.0-dev.1771407294 → 1.12.0-dev.1771430232

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
@@ -8,6 +8,8 @@ const ReactDOM = require("react-dom");
8
8
  const reactColor = require("react-color");
9
9
  const dayjs = require("dayjs");
10
10
  const reactDropzone = require("react-dropzone");
11
+ const iconsMaterial = require("@mui/icons-material");
12
+ const material = require("@mui/material");
11
13
  function _interopNamespaceDefault(e) {
12
14
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
15
  if (e) {
@@ -63631,12 +63633,6 @@ const TreeView = ({
63631
63633
  }
63632
63634
  ) });
63633
63635
  };
63634
- const AddRoundedIcon = createSvgIcon(/* @__PURE__ */ jsxRuntime.jsx("path", {
63635
- d: "M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"
63636
- }), "AddRounded");
63637
- const RemoveRoundedIcon = createSvgIcon(/* @__PURE__ */ jsxRuntime.jsx("path", {
63638
- d: "M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1"
63639
- }), "RemoveRounded");
63640
63636
  const GREY = "rgba(238, 238, 238, 0.75)";
63641
63637
  const LIGHT_GREY = "#D6D6D6";
63642
63638
  const WHITE = "#FFFFFF";
@@ -63686,22 +63682,42 @@ const labelStyle = {
63686
63682
  opacity: 0.8
63687
63683
  }
63688
63684
  };
63689
- const ZoomComponent = ({
63690
- opacity = 1,
63691
- zoomLevel,
63692
- zoomMaxLevel,
63693
- zoomIn,
63694
- zoomOut,
63695
- resetZoom,
63685
+ const ZoomControl = ({
63686
+ step = 10,
63687
+ value = 50,
63688
+ onChange,
63689
+ max: max2 = 100,
63690
+ min: min2 = 0,
63696
63691
  label = "Zoom",
63692
+ opacity = 1,
63697
63693
  slotProps = {}
63698
63694
  }) => {
63699
- const isMinZoom = zoomLevel === 0;
63700
- const isMaxZoom = zoomLevel === zoomMaxLevel;
63701
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: containerStyle({ opacity }), ...slotProps.boxStyle, children: [
63702
- /* @__PURE__ */ jsxRuntime.jsx(IconButton, { onClick: zoomOut, disabled: isMinZoom, sx: iconButtonStyle, children: /* @__PURE__ */ jsxRuntime.jsx(RemoveRoundedIcon, { sx: iconStyle({ disabled: isMinZoom }) }) }),
63703
- /* @__PURE__ */ jsxRuntime.jsx(Typography, { onClick: resetZoom, sx: labelStyle, component: "button", children: label }),
63704
- /* @__PURE__ */ jsxRuntime.jsx(IconButton, { onClick: zoomIn, disabled: isMaxZoom, sx: iconButtonStyle, children: /* @__PURE__ */ jsxRuntime.jsx(AddRoundedIcon, { sx: iconStyle({ disabled: isMaxZoom }) }) })
63695
+ const isMinZoom = value === min2;
63696
+ const isMaxZoom = value === max2;
63697
+ const initialValue = React.useRef(value);
63698
+ const handleDecrease = () => onChange?.(Math.max(value - step, min2));
63699
+ const handleIncrease = () => onChange?.(Math.min(value + step, max2));
63700
+ const handleReset = () => onChange?.(initialValue.current);
63701
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: containerStyle({ opacity }), ...slotProps.root, children: [
63702
+ /* @__PURE__ */ jsxRuntime.jsx(
63703
+ material.IconButton,
63704
+ {
63705
+ onClick: handleDecrease,
63706
+ disabled: isMinZoom,
63707
+ sx: iconButtonStyle,
63708
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.RemoveRounded, { sx: iconStyle({ disabled: isMinZoom }) })
63709
+ }
63710
+ ),
63711
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { onClick: handleReset, sx: labelStyle, component: "button", children: label }),
63712
+ /* @__PURE__ */ jsxRuntime.jsx(
63713
+ material.IconButton,
63714
+ {
63715
+ onClick: handleIncrease,
63716
+ disabled: isMaxZoom,
63717
+ sx: iconButtonStyle,
63718
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.AddRounded, { sx: iconStyle({ disabled: isMaxZoom }) })
63719
+ }
63720
+ )
63705
63721
  ] });
63706
63722
  };
63707
63723
  Object.defineProperty(exports, "css", {
@@ -63841,7 +63857,7 @@ exports.Tooltip = Tooltip;
63841
63857
  exports.TreeView = TreeView;
63842
63858
  exports.Typography = Typography;
63843
63859
  exports.Zoom = Zoom;
63844
- exports.ZoomComponent = ZoomComponent;
63860
+ exports.ZoomControl = ZoomControl;
63845
63861
  exports.accordionActionsClasses = accordionActionsClasses;
63846
63862
  exports.accordionClasses = accordionClasses;
63847
63863
  exports.accordionDetailsClasses = accordionDetailsClasses;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { BackdropProps } from '@mui/material/Backdrop';
12
12
  import { default as Badge } from '@mui/material/Badge';
13
13
  import { default as Box } from '@mui/material/Box';
14
14
  import { BoxProps } from '@mui/material/Box';
15
+ import { BoxProps as BoxProps_2 } from '@mui/material';
15
16
  import { default as Breadcrumbs } from '@mui/material/Breadcrumbs';
16
17
  import { default as ButtonGroup } from '@mui/material/ButtonGroup';
17
18
  import { ButtonProps } from '@mui/material/Button';
@@ -652,18 +653,18 @@ export { useMediaQuery }
652
653
 
653
654
  export { Zoom }
654
655
 
655
- export declare const ZoomComponent: FC<ZoomComponentProps>;
656
+ export declare const ZoomControl: FC<ZoomControlProps>;
656
657
 
657
- declare interface ZoomComponentProps {
658
- opacity?: number;
659
- zoomLevel: number;
660
- zoomMaxLevel: number;
661
- zoomIn: () => void;
662
- zoomOut: () => void;
663
- resetZoom: () => void;
658
+ declare interface ZoomControlProps {
659
+ step?: number;
660
+ value: number;
661
+ onChange: (value: number) => void;
662
+ max?: number;
663
+ min?: number;
664
664
  label?: string;
665
+ opacity?: number;
665
666
  slotProps?: {
666
- boxStyle?: BoxProps;
667
+ root?: BoxProps_2;
667
668
  };
668
669
  }
669
670
 
package/dist/index.es.js CHANGED
@@ -9,6 +9,8 @@ import ReactDOM__default from "react-dom";
9
9
  import { CirclePicker } from "react-color";
10
10
  import dayjs from "dayjs";
11
11
  import { useDropzone } from "react-dropzone";
12
+ import { RemoveRounded, AddRounded } from "@mui/icons-material";
13
+ import { Box as Box$1, IconButton as IconButton$1, Typography as Typography$1 } from "@mui/material";
12
14
  function getDefaultExportFromCjs(x) {
13
15
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
14
16
  }
@@ -63614,12 +63616,6 @@ const TreeView = ({
63614
63616
  }
63615
63617
  ) });
63616
63618
  };
63617
- const AddRoundedIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
63618
- d: "M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"
63619
- }), "AddRounded");
63620
- const RemoveRoundedIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
63621
- d: "M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1"
63622
- }), "RemoveRounded");
63623
63619
  const GREY = "rgba(238, 238, 238, 0.75)";
63624
63620
  const LIGHT_GREY = "#D6D6D6";
63625
63621
  const WHITE = "#FFFFFF";
@@ -63669,22 +63665,42 @@ const labelStyle = {
63669
63665
  opacity: 0.8
63670
63666
  }
63671
63667
  };
63672
- const ZoomComponent = ({
63673
- opacity = 1,
63674
- zoomLevel,
63675
- zoomMaxLevel,
63676
- zoomIn,
63677
- zoomOut,
63678
- resetZoom,
63668
+ const ZoomControl = ({
63669
+ step = 10,
63670
+ value = 50,
63671
+ onChange,
63672
+ max: max2 = 100,
63673
+ min: min2 = 0,
63679
63674
  label = "Zoom",
63675
+ opacity = 1,
63680
63676
  slotProps = {}
63681
63677
  }) => {
63682
- const isMinZoom = zoomLevel === 0;
63683
- const isMaxZoom = zoomLevel === zoomMaxLevel;
63684
- return /* @__PURE__ */ jsxs(Box, { sx: containerStyle({ opacity }), ...slotProps.boxStyle, children: [
63685
- /* @__PURE__ */ jsx(IconButton, { onClick: zoomOut, disabled: isMinZoom, sx: iconButtonStyle, children: /* @__PURE__ */ jsx(RemoveRoundedIcon, { sx: iconStyle({ disabled: isMinZoom }) }) }),
63686
- /* @__PURE__ */ jsx(Typography, { onClick: resetZoom, sx: labelStyle, component: "button", children: label }),
63687
- /* @__PURE__ */ jsx(IconButton, { onClick: zoomIn, disabled: isMaxZoom, sx: iconButtonStyle, children: /* @__PURE__ */ jsx(AddRoundedIcon, { sx: iconStyle({ disabled: isMaxZoom }) }) })
63678
+ const isMinZoom = value === min2;
63679
+ const isMaxZoom = value === max2;
63680
+ const initialValue = useRef(value);
63681
+ const handleDecrease = () => onChange?.(Math.max(value - step, min2));
63682
+ const handleIncrease = () => onChange?.(Math.min(value + step, max2));
63683
+ const handleReset = () => onChange?.(initialValue.current);
63684
+ return /* @__PURE__ */ jsxs(Box$1, { sx: containerStyle({ opacity }), ...slotProps.root, children: [
63685
+ /* @__PURE__ */ jsx(
63686
+ IconButton$1,
63687
+ {
63688
+ onClick: handleDecrease,
63689
+ disabled: isMinZoom,
63690
+ sx: iconButtonStyle,
63691
+ children: /* @__PURE__ */ jsx(RemoveRounded, { sx: iconStyle({ disabled: isMinZoom }) })
63692
+ }
63693
+ ),
63694
+ /* @__PURE__ */ jsx(Typography$1, { onClick: handleReset, sx: labelStyle, component: "button", children: label }),
63695
+ /* @__PURE__ */ jsx(
63696
+ IconButton$1,
63697
+ {
63698
+ onClick: handleIncrease,
63699
+ disabled: isMaxZoom,
63700
+ sx: iconButtonStyle,
63701
+ children: /* @__PURE__ */ jsx(AddRounded, { sx: iconStyle({ disabled: isMaxZoom }) })
63702
+ }
63703
+ )
63688
63704
  ] });
63689
63705
  };
63690
63706
  export {
@@ -63817,7 +63833,7 @@ export {
63817
63833
  TreeView,
63818
63834
  Typography,
63819
63835
  Zoom,
63820
- ZoomComponent,
63836
+ ZoomControl,
63821
63837
  accordionActionsClasses,
63822
63838
  accordionClasses,
63823
63839
  accordionDetailsClasses,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgi-learning-hub/ui",
3
- "version": "1.12.0-dev.1771407294",
3
+ "version": "1.12.0-dev.1771430232",
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",