@carto/meridian-ds 1.4.3-alpha-tag.5 → 1.4.3-alpha-icons-shapes.1

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/dist/{Alert--QYebQp3.js → Alert-D8jI1sG4.js} +1 -1
  3. package/dist/{Alert-DFaAeTZf.cjs → Alert-zqtoWsBL.cjs} +1 -1
  4. package/dist/OpenDiagonallyRight-5HZXh46V.js +59 -0
  5. package/dist/OpenDiagonallyRight-BrRyCV4Q.cjs +58 -0
  6. package/dist/{TablePaginationActions-BG2gWq0M.cjs → TablePaginationActions-CFGXm44W.cjs} +21 -3
  7. package/dist/{TablePaginationActions-Dit3VW-A.js → TablePaginationActions-KpTvhN4Y.js} +21 -3
  8. package/dist/components/index.cjs +1062 -206
  9. package/dist/components/index.js +1064 -208
  10. package/dist/custom-icons/index.cjs +339 -390
  11. package/dist/custom-icons/index.js +339 -390
  12. package/dist/theme/index.cjs +8 -3
  13. package/dist/theme/index.js +9 -4
  14. package/dist/types/components/molecules/index.d.ts +0 -2
  15. package/dist/types/components/molecules/index.d.ts.map +1 -1
  16. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts +16 -0
  17. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts.map +1 -0
  18. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts +16 -0
  19. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts.map +1 -0
  20. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts +10 -0
  21. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts.map +1 -0
  22. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts +8 -0
  23. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts.map +1 -0
  24. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts +4 -0
  25. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts.map +1 -0
  26. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts +12 -0
  27. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts.map +1 -0
  28. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts +9 -0
  29. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -0
  30. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts +28 -0
  31. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts.map +1 -0
  32. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts +7 -0
  33. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts.map +1 -0
  34. package/dist/types/components/organisms/CodeArea/index.d.ts +9 -0
  35. package/dist/types/components/organisms/CodeArea/index.d.ts.map +1 -0
  36. package/dist/types/components/organisms/CodeArea/types.d.ts +38 -0
  37. package/dist/types/components/organisms/CodeArea/types.d.ts.map +1 -0
  38. package/dist/types/components/organisms/CodeArea/utils.d.ts +5 -0
  39. package/dist/types/components/organisms/CodeArea/utils.d.ts.map +1 -0
  40. package/dist/types/components/organisms/index.d.ts +2 -0
  41. package/dist/types/components/organisms/index.d.ts.map +1 -1
  42. package/dist/types/localization/en.d.ts +6 -0
  43. package/dist/types/localization/en.d.ts.map +1 -1
  44. package/dist/types/localization/es.d.ts +6 -0
  45. package/dist/types/localization/es.d.ts.map +1 -1
  46. package/dist/types/localization/id.d.ts +6 -0
  47. package/dist/types/localization/id.d.ts.map +1 -1
  48. package/dist/types/localization/index.d.ts +18 -0
  49. package/dist/types/localization/index.d.ts.map +1 -1
  50. package/dist/types/theme/sections/components/data-display.d.ts.map +1 -1
  51. package/dist/widgets/index.cjs +2 -2
  52. package/dist/widgets/index.js +2 -2
  53. package/package.json +6 -1
  54. package/dist/types/components/molecules/Tag.d.ts +0 -31
  55. package/dist/types/components/molecules/Tag.d.ts.map +0 -1
@@ -3,10 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const material = require("@mui/material");
6
- const TablePaginationActions = require("../TablePaginationActions-BG2gWq0M.cjs");
6
+ const TablePaginationActions = require("../TablePaginationActions-CFGXm44W.cjs");
7
7
  const reactIntl = require("react-intl");
8
8
  const iconsMaterial = require("@mui/icons-material");
9
- const Alert$1 = require("../Alert-DFaAeTZf.cjs");
9
+ const Alert$1 = require("../Alert-zqtoWsBL.cjs");
10
10
  require("cartocolor");
11
11
  const MenuItem = require("../MenuItem-Br2jY2lt.cjs");
12
12
  const ArrowDown = require("../ArrowDown-8fLj23Ge.cjs");
@@ -14,6 +14,31 @@ const DatePicker$1 = require("@mui/x-date-pickers/DatePicker");
14
14
  const xDatePickers = require("@mui/x-date-pickers");
15
15
  const TimePicker$1 = require("@mui/x-date-pickers/TimePicker");
16
16
  const DateTimePicker$1 = require("@mui/x-date-pickers/DateTimePicker");
17
+ const OpenDiagonallyRight = require("../OpenDiagonallyRight-BrRyCV4Q.cjs");
18
+ const reactCodemirror2 = require("react-codemirror2");
19
+ const colors = require("@mui/material/colors");
20
+ require("codemirror/lib/codemirror.css");
21
+ require("codemirror/lib/codemirror.js");
22
+ require("codemirror/mode/sql/sql.js");
23
+ require("codemirror/mode/javascript/javascript.js");
24
+ require("codemirror/mode/htmlmixed/htmlmixed.js");
25
+ require("codemirror/mode/markdown/markdown.js");
26
+ require("codemirror/mode/shell/shell.js");
27
+ require("codemirror/mode/python/python.js");
28
+ require("codemirror/addon/display/placeholder");
29
+ require("codemirror/addon/hint/sql-hint.js");
30
+ require("codemirror/addon/hint/show-hint.css");
31
+ require("codemirror/addon/hint/show-hint.js");
32
+ require("codemirror/addon/selection/active-line.js");
33
+ require("codemirror/addon/edit/matchbrackets.js");
34
+ require("codemirror/addon/fold/foldcode.js");
35
+ require("codemirror/addon/fold/foldgutter.js");
36
+ require("codemirror/addon/fold/foldgutter.css");
37
+ require("codemirror/addon/fold/brace-fold.js");
38
+ require("codemirror/addon/fold/xml-fold.js");
39
+ require("codemirror/addon/fold/indent-fold.js");
40
+ require("codemirror/addon/fold/markdown-fold.js");
41
+ require("codemirror/addon/fold/comment-fold.js");
17
42
  const ClickAwayListener = require("@mui/material/ClickAwayListener");
18
43
  const IndicatorIcon = material.styled(material.Box)({
19
44
  position: "absolute",
@@ -75,7 +100,7 @@ function _Button({
75
100
  );
76
101
  }
77
102
  const Button = React.forwardRef(_Button);
78
- const Root$4 = material.styled(material.Box)(({ theme }) => ({
103
+ const Root$5 = material.styled(material.Box)(({ theme }) => ({
79
104
  display: "flex",
80
105
  alignItems: "center",
81
106
  gap: theme.spacing(0.5)
@@ -105,7 +130,7 @@ function LabelWithIndicator({
105
130
  icon,
106
131
  inheritSize
107
132
  }) {
108
- return /* @__PURE__ */ jsxRuntime.jsxs(Root$4, { children: [
133
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$5, { children: [
109
134
  label,
110
135
  type && /* @__PURE__ */ jsxRuntime.jsx(
111
136
  Indicator,
@@ -1584,7 +1609,7 @@ const SnackbarRoot = material.styled(material.Snackbar)(({ theme }) => ({
1584
1609
  maxWidth: `${MAX_WIDTH}px`
1585
1610
  }
1586
1611
  }));
1587
- const Content$3 = material.styled(material.Box, {
1612
+ const Content$4 = material.styled(material.Box, {
1588
1613
  shouldForwardProp: (prop) => prop !== "autoWidth"
1589
1614
  })(({ autoWidth, theme }) => ({
1590
1615
  minWidth: "100%",
@@ -1693,7 +1718,7 @@ function Snackbar({
1693
1718
  TransitionComponent: autoWidth ? material.Fade : material.Slide,
1694
1719
  "data-auto-width": autoWidth,
1695
1720
  children: /* @__PURE__ */ jsxRuntime.jsxs(
1696
- Content$3,
1721
+ Content$4,
1697
1722
  {
1698
1723
  sx: {
1699
1724
  position: "relative"
@@ -1730,195 +1755,6 @@ function Snackbar({
1730
1755
  }
1731
1756
  ) });
1732
1757
  }
1733
- function colorProps(color, variant, theme, disabled) {
1734
- if (disabled) {
1735
- if (variant === "outlined") {
1736
- return {
1737
- color: theme.palette.text.disabled,
1738
- backgroundColor: theme.palette.black[4],
1739
- borderColor: theme.palette.action.focus
1740
- };
1741
- }
1742
- return {
1743
- color: theme.palette.text.disabled,
1744
- backgroundColor: theme.palette.action.disabledBackground,
1745
- borderColor: "transparent"
1746
- };
1747
- }
1748
- switch (color) {
1749
- case "default":
1750
- if (variant === "outlined") {
1751
- return {
1752
- color: theme.palette.text.secondary,
1753
- backgroundColor: theme.palette.black["4"],
1754
- borderColor: theme.palette.divider
1755
- };
1756
- }
1757
- return {
1758
- color: theme.palette.text.primary,
1759
- backgroundColor: theme.palette.default.main,
1760
- borderColor: "transparent"
1761
- };
1762
- case "primary":
1763
- if (variant === "outlined") {
1764
- return {
1765
- color: theme.palette.primary.main,
1766
- backgroundColor: theme.palette.primary.relatedLight,
1767
- borderColor: theme.palette.primary.main
1768
- };
1769
- }
1770
- return {
1771
- color: theme.palette.primary.contrastText,
1772
- backgroundColor: theme.palette.primary.main,
1773
- borderColor: "transparent"
1774
- };
1775
- case "secondary":
1776
- if (variant === "outlined") {
1777
- return {
1778
- color: theme.palette.secondary.main,
1779
- backgroundColor: theme.palette.secondary.relatedLight,
1780
- borderColor: theme.palette.secondary.main
1781
- };
1782
- }
1783
- return {
1784
- color: theme.palette.text.primary,
1785
- backgroundColor: theme.palette.secondary.main,
1786
- borderColor: "transparent"
1787
- };
1788
- case "success":
1789
- if (variant === "outlined") {
1790
- return {
1791
- color: theme.palette.success.main,
1792
- backgroundColor: theme.palette.success.relatedLight,
1793
- borderColor: theme.palette.success.main
1794
- };
1795
- }
1796
- return {
1797
- color: theme.palette.success.main,
1798
- backgroundColor: theme.palette.success.relatedLight,
1799
- borderColor: "transparent"
1800
- };
1801
- case "warning":
1802
- if (variant === "outlined") {
1803
- return {
1804
- color: theme.palette.warning.main,
1805
- backgroundColor: theme.palette.warning.relatedLight,
1806
- borderColor: theme.palette.warning.main
1807
- };
1808
- }
1809
- return {
1810
- color: theme.palette.text.primary,
1811
- backgroundColor: theme.palette.warning.main,
1812
- borderColor: "transparent"
1813
- };
1814
- case "error":
1815
- if (variant === "outlined") {
1816
- return {
1817
- color: theme.palette.error.main,
1818
- backgroundColor: theme.palette.error.relatedLight,
1819
- borderColor: theme.palette.error.main
1820
- };
1821
- }
1822
- return {
1823
- color: theme.palette.primary.contrastText,
1824
- backgroundColor: theme.palette.error.main,
1825
- borderColor: "transparent"
1826
- };
1827
- }
1828
- }
1829
- const TagRoot = material.styled("div", {
1830
- shouldForwardProp: (prop) => !["color", "variant", "disabled"].includes(prop)
1831
- })(({
1832
- color,
1833
- variant,
1834
- disabled,
1835
- theme
1836
- }) => {
1837
- return {
1838
- display: "inline-flex",
1839
- flexDirection: "row",
1840
- flexWrap: "nowrap",
1841
- alignItems: "center",
1842
- padding: theme.spacing(0, 0.5),
1843
- borderRadius: theme.spacing(0.25),
1844
- gap: theme.spacing(0.5),
1845
- height: theme.spacing(2),
1846
- borderWidth: "1px",
1847
- borderStyle: "solid",
1848
- ...colorProps(color ?? "primary", variant ?? "filled", theme, disabled),
1849
- '.Mui-selected &, [aria-selected="true"] &': {
1850
- borderColor: theme.palette.primary.main,
1851
- backgroundColor: theme.palette.primary.background,
1852
- ".MuiTypography-root": {
1853
- color: theme.palette.primary.main
1854
- }
1855
- }
1856
- };
1857
- });
1858
- const TagIcon = material.styled("div")(({ theme }) => ({
1859
- display: "flex",
1860
- justifyContent: "center",
1861
- alignItems: "center",
1862
- "& svg": {
1863
- width: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
1864
- height: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
1865
- "& g": {
1866
- fill: "currentColor"
1867
- }
1868
- }
1869
- }));
1870
- const TagLabel = material.styled("div", {
1871
- shouldForwardProp: (prop) => !["type"].includes(prop)
1872
- })(({ type, theme }) => ({
1873
- display: "flex",
1874
- alignItems: "center",
1875
- paddingTop: type === "code" ? theme.spacing(0.25) : void 0
1876
- }));
1877
- function _Tag({
1878
- label,
1879
- color = "primary",
1880
- variant = "filled",
1881
- icon,
1882
- type = "default",
1883
- typographyProps,
1884
- noWrap = true,
1885
- disabled,
1886
- ...otherProps
1887
- }, ref) {
1888
- const typeCode = type === "code";
1889
- return /* @__PURE__ */ jsxRuntime.jsxs(
1890
- TagRoot,
1891
- {
1892
- ref,
1893
- className: "CartoTag-root",
1894
- color,
1895
- variant,
1896
- disabled,
1897
- "aria-disabled": disabled,
1898
- "data-color": color,
1899
- "data-variant": variant,
1900
- "data-type": type,
1901
- "data-name": "tag",
1902
- ...otherProps,
1903
- children: [
1904
- icon && /* @__PURE__ */ jsxRuntime.jsx(TagIcon, { children: icon }),
1905
- /* @__PURE__ */ jsxRuntime.jsx(TagLabel, { type, children: /* @__PURE__ */ jsxRuntime.jsx(
1906
- TablePaginationActions.Typography,
1907
- {
1908
- component: "span",
1909
- color: "inherit",
1910
- variant: typeCode ? "code3" : "caption",
1911
- weight: typeCode ? "strong" : "medium",
1912
- noWrap,
1913
- ...typographyProps,
1914
- children: label
1915
- }
1916
- ) })
1917
- ]
1918
- }
1919
- );
1920
- }
1921
- const Tag = React.forwardRef(_Tag);
1922
1758
  const Menu = material.styled("div")(({ theme }) => ({
1923
1759
  display: "flex",
1924
1760
  alignItems: "center",
@@ -2008,7 +1844,7 @@ function SecondaryText({ text }) {
2008
1844
  }
2009
1845
  );
2010
1846
  }
2011
- const Root$3 = material.styled(material.AppBar)(({ theme }) => ({
1847
+ const Root$4 = material.styled(material.AppBar)(({ theme }) => ({
2012
1848
  backgroundColor: theme.palette.brand.appBarMain,
2013
1849
  "& .MuiTypography-root": {
2014
1850
  color: theme.palette.brand.appBarContrastText
@@ -2026,7 +1862,7 @@ const BrandElements = material.styled("div")(({ theme }) => ({
2026
1862
  minWidth: "192px"
2027
1863
  }
2028
1864
  }));
2029
- const Content$2 = material.styled("div")(({ theme }) => ({
1865
+ const Content$3 = material.styled("div")(({ theme }) => ({
2030
1866
  display: "flex",
2031
1867
  alignItems: "center",
2032
1868
  justifyContent: "space-between",
@@ -2042,14 +1878,14 @@ function AppBar({
2042
1878
  onClickMenu,
2043
1879
  ...otherProps
2044
1880
  }) {
2045
- return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Toolbar, { children: [
1881
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$4, { ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Toolbar, { children: [
2046
1882
  /* @__PURE__ */ jsxRuntime.jsxs(BrandElements, { children: [
2047
1883
  showBurgerMenu && /* @__PURE__ */ jsxRuntime.jsx(BurgerMenu, { onClickMenu }),
2048
1884
  brandLogo && /* @__PURE__ */ jsxRuntime.jsx(BrandLogo, { logo: brandLogo }),
2049
1885
  brandText && /* @__PURE__ */ jsxRuntime.jsx(BrandText, { text: brandText }),
2050
1886
  secondaryText && /* @__PURE__ */ jsxRuntime.jsx(SecondaryText, { text: secondaryText })
2051
1887
  ] }),
2052
- /* @__PURE__ */ jsxRuntime.jsx(Content$2, { children })
1888
+ /* @__PURE__ */ jsxRuntime.jsx(Content$3, { children })
2053
1889
  ] }) });
2054
1890
  }
2055
1891
  const Container = material.styled(material.Box, {
@@ -2087,7 +1923,7 @@ function ClearButton({
2087
1923
  }
2088
1924
  ) });
2089
1925
  }
2090
- const Root$2 = material.styled(material.Box, {
1926
+ const Root$3 = material.styled(material.Box, {
2091
1927
  shouldForwardProp: (prop) => !["size", "variant", "readOnly"].includes(prop)
2092
1928
  })(({ size, variant, readOnly, theme }) => ({
2093
1929
  // There is no specific slot to change TextField styles at DatePicker level, so we need to wrap our component to isolate this override. https://mui.com/x/react-date-pickers/date-picker/#customization
@@ -2127,7 +1963,7 @@ function DateFieldContainer({
2127
1963
  readOnly,
2128
1964
  ...props
2129
1965
  }) {
2130
- return /* @__PURE__ */ jsxRuntime.jsx(Root$2, { ...props, size, variant, readOnly, children });
1966
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...props, size, variant, readOnly, children });
2131
1967
  }
2132
1968
  function DatePicker({
2133
1969
  handleClear,
@@ -2800,7 +2636,7 @@ function DateTimePicker({
2800
2636
  );
2801
2637
  }
2802
2638
  const DEFAULT_ITEMS = [{ outlinedBullet: false, value: "" }];
2803
- const Content$1 = material.styled("ul")(({ theme }) => ({
2639
+ const Content$2 = material.styled("ul")(({ theme }) => ({
2804
2640
  listStyle: "none",
2805
2641
  paddingLeft: 0,
2806
2642
  margin: theme.spacing(0.5, 0, 0, 0)
@@ -2831,7 +2667,7 @@ function TooltipData({
2831
2667
  }) {
2832
2668
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2833
2669
  title && /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { color: "inherit", variant: "caption", weight: "medium", children: title }),
2834
- /* @__PURE__ */ jsxRuntime.jsx(Content$1, { children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(Entry, { children: [
2670
+ /* @__PURE__ */ jsxRuntime.jsx(Content$2, { children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(Entry, { children: [
2835
2671
  /* @__PURE__ */ jsxRuntime.jsx(
2836
2672
  Bullet,
2837
2673
  {
@@ -2846,6 +2682,866 @@ function TooltipData({
2846
2682
  ] }, index)) })
2847
2683
  ] });
2848
2684
  }
2685
+ const Footer = material.styled(material.Box, {
2686
+ shouldForwardProp: (prop) => !["withGutter", "disabled"].includes(prop)
2687
+ })(
2688
+ ({ withGutter, disabled, theme }) => ({
2689
+ display: "flex",
2690
+ alignItems: "center",
2691
+ justifyContent: "flex-end",
2692
+ gap: theme.spacing(1),
2693
+ ...withGutter && {
2694
+ height: theme.spacing(4),
2695
+ padding: theme.spacing(0, 0.5),
2696
+ borderTop: `1px solid ${theme.palette.divider}`,
2697
+ borderBottom: "1px solid transparent"
2698
+ },
2699
+ ...disabled && {
2700
+ backgroundColor: theme.palette.default.background
2701
+ }
2702
+ })
2703
+ );
2704
+ function CodeAreaFooter({
2705
+ onClickFooter,
2706
+ buttonFooterLabelId,
2707
+ disabledButtonFooter,
2708
+ withGutter = true,
2709
+ showSnackbar,
2710
+ onCloseSnackbar,
2711
+ loading,
2712
+ disabled,
2713
+ ...props
2714
+ }) {
2715
+ const intl = reactIntl.useIntl();
2716
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2717
+ if (!onClickFooter) return null;
2718
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2719
+ Footer,
2720
+ {
2721
+ withGutter,
2722
+ disabled,
2723
+ "data-name": "code-area-footer",
2724
+ "data-gutter": withGutter,
2725
+ children: [
2726
+ /* @__PURE__ */ jsxRuntime.jsx(
2727
+ Button,
2728
+ {
2729
+ variant: "text",
2730
+ ...props,
2731
+ loading,
2732
+ onClick: onClickFooter,
2733
+ disabled: disabled || disabledButtonFooter,
2734
+ children: intlConfig.formatMessage({
2735
+ id: buttonFooterLabelId || "c4r.button.save"
2736
+ })
2737
+ }
2738
+ ),
2739
+ /* @__PURE__ */ jsxRuntime.jsx(
2740
+ Snackbar,
2741
+ {
2742
+ open: showSnackbar,
2743
+ autoWidth: true,
2744
+ closeable: false,
2745
+ autoHideDuration: 4e3,
2746
+ onClose: onCloseSnackbar,
2747
+ children: intlConfig.formatMessage({
2748
+ id: "c4r.notifications.changesSaved"
2749
+ })
2750
+ }
2751
+ )
2752
+ ]
2753
+ }
2754
+ );
2755
+ }
2756
+ const Header = material.styled(material.Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2757
+ position: "absolute",
2758
+ top: 0,
2759
+ right: theme.spacing(0.5),
2760
+ zIndex: 1,
2761
+ display: "flex",
2762
+ justifyContent: "flex-end",
2763
+ gap: theme.spacing(1),
2764
+ padding: size === "small" ? theme.spacing(0.5) : theme.spacing(1, 2, 2),
2765
+ paddingRight: size === "small" ? 0 : theme.spacing(1.5)
2766
+ }));
2767
+ function CodeAreaHeader({
2768
+ disabled,
2769
+ copyValue,
2770
+ onClickExpand,
2771
+ size
2772
+ }) {
2773
+ const intl = reactIntl.useIntl();
2774
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2775
+ const showExpandButton = !!onClickExpand;
2776
+ const showCopyButton = copyValue !== void 0;
2777
+ const showMenu = showExpandButton && showCopyButton;
2778
+ const { copy } = useCopyValue();
2779
+ const [openSnackbar, setOpenSnackbar] = React.useState(false);
2780
+ const [anchorEl, setAnchorEl] = React.useState(null);
2781
+ const open = Boolean(anchorEl);
2782
+ const openDropdown = (event) => {
2783
+ setAnchorEl(event.currentTarget);
2784
+ };
2785
+ const closeDropdown = () => {
2786
+ setAnchorEl(null);
2787
+ };
2788
+ const handleCopy = (e) => {
2789
+ e.preventDefault();
2790
+ if (copyValue) {
2791
+ copy(copyValue).then(() => {
2792
+ setOpenSnackbar(true);
2793
+ }).catch(console.error);
2794
+ }
2795
+ };
2796
+ if (!showExpandButton && !showCopyButton) {
2797
+ return null;
2798
+ }
2799
+ if (showMenu) {
2800
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2801
+ /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2802
+ /* @__PURE__ */ jsxRuntime.jsx(
2803
+ IconButton,
2804
+ {
2805
+ color: "default",
2806
+ size,
2807
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.MoreVertOutlined, {}),
2808
+ disabled,
2809
+ tooltip: intlConfig.formatMessage({ id: `c4r.button.showOptions` }),
2810
+ tooltipPlacement: "top",
2811
+ "aria-controls": open ? "basic-menu" : void 0,
2812
+ "aria-haspopup": "true",
2813
+ "aria-expanded": open ? "true" : void 0,
2814
+ onClick: openDropdown
2815
+ }
2816
+ ),
2817
+ /* @__PURE__ */ jsxRuntime.jsxs(
2818
+ Menu$1,
2819
+ {
2820
+ anchorEl,
2821
+ open,
2822
+ onClose: closeDropdown,
2823
+ id: "menu",
2824
+ MenuListProps: { "aria-labelledby": "menu-button" },
2825
+ "aria-label": "Code area actions",
2826
+ transformOrigin: { vertical: "top", horizontal: "right" },
2827
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
2828
+ children: [
2829
+ /* @__PURE__ */ jsxRuntime.jsxs(MenuItem.MenuItem, { onClick: handleCopy, disabled, id: "copy", children: [
2830
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}) }),
2831
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.copy` }) })
2832
+ ] }),
2833
+ /* @__PURE__ */ jsxRuntime.jsxs(MenuItem.MenuItem, { onClick: onClickExpand, disabled, id: "expand", children: [
2834
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.OpenDiagonallyRight, {}) }),
2835
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.expand` }) })
2836
+ ] })
2837
+ ]
2838
+ }
2839
+ )
2840
+ ] }),
2841
+ /* @__PURE__ */ jsxRuntime.jsx(
2842
+ Snackbar,
2843
+ {
2844
+ open: openSnackbar,
2845
+ autoWidth: true,
2846
+ closeable: false,
2847
+ autoHideDuration: 4e3,
2848
+ onClose: () => setOpenSnackbar(false),
2849
+ children: intlConfig.formatMessage({
2850
+ id: "c4r.notifications.copiedToClipboard"
2851
+ })
2852
+ }
2853
+ )
2854
+ ] });
2855
+ }
2856
+ return /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2857
+ showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(
2858
+ CopiableComponent,
2859
+ {
2860
+ disabled,
2861
+ value: copyValue,
2862
+ button: true,
2863
+ buttonProps: { size }
2864
+ }
2865
+ ),
2866
+ showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
2867
+ IconButton,
2868
+ {
2869
+ color: "default",
2870
+ size,
2871
+ onClick: onClickExpand,
2872
+ icon: /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.OpenDiagonallyRight, {}),
2873
+ disabled,
2874
+ tooltip: intlConfig.formatMessage({ id: `c4r.button.expand` }),
2875
+ tooltipPlacement: "top"
2876
+ }
2877
+ )
2878
+ ] });
2879
+ }
2880
+ const CodeAreaTheme = material.styled(material.Box, {
2881
+ shouldForwardProp: (prop) => !["size", "height"].includes(prop)
2882
+ })(({ size, height, theme }) => ({
2883
+ position: "relative",
2884
+ flex: 1,
2885
+ display: "flex",
2886
+ cursor: "text",
2887
+ ":focus-within &, .error &": {
2888
+ marginBottom: 0
2889
+ },
2890
+ "& .react-codemirror2": {
2891
+ width: "100%",
2892
+ height: "100% !important",
2893
+ position: "relative"
2894
+ },
2895
+ "& .CodeMirror": {
2896
+ position: "absolute",
2897
+ top: 0,
2898
+ bottom: 0,
2899
+ left: 0,
2900
+ right: 0,
2901
+ zIndex: 1,
2902
+ height: "100% !important",
2903
+ backgroundColor: theme.palette.background.default
2904
+ },
2905
+ "& .CodeMirror-code": {
2906
+ "&> div:first-of-type .CodeMirror-line": {
2907
+ marginTop: theme.spacing(-0.25)
2908
+ }
2909
+ },
2910
+ "& .CodeMirror-scroll": {
2911
+ paddingLeft: theme.spacing(1),
2912
+ paddingRight: theme.spacing(1),
2913
+ backgroundColor: "transparent"
2914
+ },
2915
+ "& .CodeMirror-lines": {
2916
+ padding: theme.spacing(1, 0)
2917
+ },
2918
+ "& .CodeMirror pre.CodeMirror-line, & .CodeMirror pre.CodeMirror-line-like": {
2919
+ boxSizing: "border-box",
2920
+ paddingLeft: 0,
2921
+ paddingTop: theme.spacing(0.25),
2922
+ lineHeight: 1.2
2923
+ },
2924
+ "& .CodeMirror-linenumbers": {
2925
+ width: `${theme.spacing(4.5)} !important`
2926
+ },
2927
+ "& .CodeMirror-linenumber": {
2928
+ width: `${theme.spacing(4.5)} !important`,
2929
+ height: theme.spacing(2),
2930
+ marginBottom: `${theme.spacing(-0.25)} !important`,
2931
+ paddingTop: theme.spacing(0.25),
2932
+ paddingRight: theme.spacing(1.25),
2933
+ boxSizing: "border-box !important",
2934
+ color: theme.palette.text.secondary
2935
+ },
2936
+ // Active line addon
2937
+ "& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter": {
2938
+ backgroundColor: "transparent"
2939
+ },
2940
+ "& .CodeMirror-gutter-background": {
2941
+ width: `${theme.spacing(6.25)} !important`
2942
+ // Hack needed to simulate active line background
2943
+ },
2944
+ "& .CodeMirror-sizer": {
2945
+ paddingTop: theme.spacing(0.25),
2946
+ marginLeft: `${theme.spacing(5.25)} !important`,
2947
+ borderRightWidth: `${theme.spacing(4)} !important`
2948
+ // Hack needed to simulate active line background
2949
+ },
2950
+ "& .CodeMirror-matchingbracket": {
2951
+ color: `${colors.lime[900]} !important`,
2952
+ backgroundColor: theme.palette.black[4],
2953
+ boxShadow: `0 0 0 1px ${theme.palette.text.hint}`
2954
+ },
2955
+ // Selected line
2956
+ "& .CodeMirror-selected, & .CodeMirror-focused .CodeMirror-selected, & .CodeMirror-line::selection, & .CodeMirror-line > span::selection, & .CodeMirror-line > span > span::selection": {
2957
+ background: `${material.alpha(colors.blue[800], 0.2)} !important`
2958
+ },
2959
+ "& .CodeMirror-gutters": {
2960
+ borderRight: 0,
2961
+ color: theme.palette.text.secondary,
2962
+ backgroundColor: theme.palette.default.background
2963
+ },
2964
+ "& .CodeMirror-gutter-elt": {
2965
+ "& .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded": {
2966
+ marginLeft: theme.spacing(-1),
2967
+ "&:after": {
2968
+ fontSize: theme.typography.caption.fontSize
2969
+ }
2970
+ }
2971
+ },
2972
+ "& .CodeMirror-placeholder": {
2973
+ paddingTop: "0 !important",
2974
+ marginLeft: `${theme.spacing(-0.5)} !important`,
2975
+ marginBottom: `${theme.spacing(-0.25)} !important`,
2976
+ color: `${theme.palette.text.hint} !important`
2977
+ },
2978
+ "& .MuiLinearProgress-root": {
2979
+ height: "2px",
2980
+ position: "absolute",
2981
+ top: 0,
2982
+ left: 0,
2983
+ right: 0,
2984
+ zIndex: 1
2985
+ },
2986
+ "& .pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket": {
2987
+ color: theme.palette.text.primary
2988
+ },
2989
+ "& .CodeMirror pre.CodeMirror-placeholder": {
2990
+ color: theme.palette.text.hint
2991
+ },
2992
+ "& .CodeMirror-composing": {
2993
+ border: 0
2994
+ },
2995
+ // Theme: light
2996
+ "& .cm-keyword, & .cm-string, & .cm-string-2, & .cm-other": {
2997
+ color: colors.purple[500]
2998
+ },
2999
+ "& .cm-operator, & .cm-tag, & .cm-attribute": {
3000
+ color: colors.teal[700]
3001
+ },
3002
+ "& .cm-number, & .cm-property, & .cm-builtin": {
3003
+ color: colors.red[700]
3004
+ },
3005
+ "& .cm-comment": {
3006
+ color: theme.palette.text.secondary
3007
+ },
3008
+ "& .cm-variable": {
3009
+ color: colors.lime[900]
3010
+ },
3011
+ "& .cm-variable-2": {
3012
+ color: theme.palette.text.primary
3013
+ },
3014
+ "& .cm-punctuation, & .cm-def, ": {
3015
+ color: colors.blue[800]
3016
+ },
3017
+ "& .cm-variable-3, & .cm-type": {
3018
+ color: colors.indigo[800]
3019
+ },
3020
+ "& .CodeMirror-foldmarker": {
3021
+ textShadow: "none",
3022
+ color: theme.palette.primary.main
3023
+ },
3024
+ "& .cm-error": {
3025
+ color: theme.palette.error.main
3026
+ },
3027
+ "& .CodeMirror-selected": {
3028
+ background: colors.blue[800]
3029
+ },
3030
+ "& .cm-header-1": {
3031
+ fontSize: theme.typography.h2.fontSize
3032
+ },
3033
+ "& .cm-header-2": {
3034
+ fontSize: theme.typography.h3.fontSize
3035
+ },
3036
+ "& .cm-header-3": {
3037
+ fontSize: theme.typography.h4.fontSize
3038
+ },
3039
+ "& .cm-header-4": {
3040
+ fontSize: theme.typography.h5.fontSize
3041
+ },
3042
+ "& .cm-header-5": {
3043
+ fontSize: theme.typography.h6.fontSize
3044
+ },
3045
+ ...size === "small" && {
3046
+ "& .CodeMirror": {
3047
+ height: height ? height : "auto",
3048
+ minHeight: theme.spacing(9),
3049
+ ...theme.typography.code3
3050
+ }
3051
+ }
3052
+ }));
3053
+ function findCodeAreaControlCodeOccurrences(content) {
3054
+ const lines = content.split("\n");
3055
+ const matches = [];
3056
+ const beginStack = [];
3057
+ lines.forEach((line, index) => {
3058
+ const lineNumber = index + 1;
3059
+ if (line.trim() === "-- BEGIN CONTROL CODE") {
3060
+ beginStack.push(lineNumber);
3061
+ } else if (line.trim() === "-- END CONTROL CODE" && beginStack.length > 0) {
3062
+ const startLine = beginStack.pop();
3063
+ matches.push({
3064
+ from: startLine,
3065
+ to: lineNumber
3066
+ });
3067
+ }
3068
+ });
3069
+ while (beginStack.length > 0) {
3070
+ const startLine = beginStack.pop();
3071
+ matches.push({
3072
+ from: startLine,
3073
+ to: lines.length
3074
+ // Set end to last line for unmatched BEGIN
3075
+ });
3076
+ }
3077
+ return matches;
3078
+ }
3079
+ function foldCode(editor, { from, to }) {
3080
+ editor.foldCode(
3081
+ 0,
3082
+ {
3083
+ rangeFinder: () => {
3084
+ if (!to) return;
3085
+ return {
3086
+ from: { line: from - 1, ch: 0 },
3087
+ to: { line: to - 1, ch: 0 }
3088
+ };
3089
+ }
3090
+ },
3091
+ "fold"
3092
+ );
3093
+ }
3094
+ function CodeAreaInput({
3095
+ options,
3096
+ value,
3097
+ defaultValue,
3098
+ id,
3099
+ onEditorDidMount,
3100
+ onChange,
3101
+ onBlur,
3102
+ onFocus,
3103
+ placeholder,
3104
+ disabled,
3105
+ size = "small",
3106
+ height,
3107
+ autoFoldControlBlocks,
3108
+ "data-testid": dataTestId,
3109
+ "aria-label": ariaLabel,
3110
+ ...props
3111
+ }) {
3112
+ var _a;
3113
+ const editorRef = React.useRef();
3114
+ const [editor, setEditor] = React.useState(null);
3115
+ const initialFoldingDoneRef = React.useRef(false);
3116
+ const codeMirrorOptions = {
3117
+ mode: "sql",
3118
+ theme: "light",
3119
+ lineNumbers: true,
3120
+ lineWrapping: true,
3121
+ extraKeys: { "Ctrl-Space": "autocomplete" },
3122
+ placeholder,
3123
+ disabled,
3124
+ gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
3125
+ styleActiveLine: { nonEmpty: true },
3126
+ styleActiveSelected: true,
3127
+ matchBrackets: true,
3128
+ foldOptions: {
3129
+ minFoldSize: 1,
3130
+ scanUp: false
3131
+ },
3132
+ ...options
3133
+ };
3134
+ React.useEffect(() => {
3135
+ return () => {
3136
+ setEditor(null);
3137
+ };
3138
+ }, []);
3139
+ React.useEffect(() => {
3140
+ if (!value || !editor || !autoFoldControlBlocks || initialFoldingDoneRef.current)
3141
+ return;
3142
+ const numberOfBlocks = findCodeAreaControlCodeOccurrences(value);
3143
+ if (!numberOfBlocks.length) return;
3144
+ for (const line of numberOfBlocks) {
3145
+ foldCode(editor, line);
3146
+ }
3147
+ initialFoldingDoneRef.current = true;
3148
+ }, [value, editor, autoFoldControlBlocks]);
3149
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3150
+ CodeAreaTheme,
3151
+ {
3152
+ size,
3153
+ height,
3154
+ id,
3155
+ "data-size": size,
3156
+ "data-height": height,
3157
+ "data-mode": typeof (options == null ? void 0 : options.mode) === "object" && ((_a = options.mode) == null ? void 0 : _a.name) ? options.mode.name : options == null ? void 0 : options.mode,
3158
+ "data-fold-gutter": options == null ? void 0 : options.foldGutter,
3159
+ "data-testid": dataTestId,
3160
+ "aria-label": ariaLabel ?? "Code editor text area",
3161
+ "data-name": "code-area-input",
3162
+ children: [
3163
+ value !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3164
+ reactCodemirror2.Controlled,
3165
+ {
3166
+ ...props,
3167
+ value,
3168
+ editorDidMount: (editor2) => {
3169
+ editorRef.current = editor2;
3170
+ setEditor(editor2);
3171
+ onEditorDidMount == null ? void 0 : onEditorDidMount(editor2);
3172
+ },
3173
+ options: codeMirrorOptions,
3174
+ onBeforeChange: (editor2, data, value2) => {
3175
+ onChange == null ? void 0 : onChange(value2);
3176
+ },
3177
+ onBlur: (editor2) => {
3178
+ onBlur == null ? void 0 : onBlur(editor2.getValue());
3179
+ },
3180
+ onFocus
3181
+ }
3182
+ ),
3183
+ defaultValue !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3184
+ reactCodemirror2.UnControlled,
3185
+ {
3186
+ ...props,
3187
+ value: defaultValue,
3188
+ options: codeMirrorOptions,
3189
+ onBlur: (editor2) => {
3190
+ onBlur == null ? void 0 : onBlur(editor2.getValue());
3191
+ },
3192
+ onFocus
3193
+ }
3194
+ )
3195
+ ]
3196
+ }
3197
+ );
3198
+ }
3199
+ const Root$2 = material.styled(material.FormControl)(() => ({
3200
+ display: "flex",
3201
+ flexDirection: "column",
3202
+ flex: 1
3203
+ }));
3204
+ const CodeMirrorWrapper = material.styled(material.Box, {
3205
+ shouldForwardProp: (prop) => ![
3206
+ "variant",
3207
+ "error",
3208
+ "disabled",
3209
+ "readOnly",
3210
+ "lineNumbers",
3211
+ "fullScreen"
3212
+ ].includes(prop)
3213
+ })(
3214
+ ({ variant, error, disabled, readOnly, lineNumbers, fullScreen, theme }) => ({
3215
+ position: "relative",
3216
+ overflow: "auto",
3217
+ display: "flex",
3218
+ flexDirection: "column",
3219
+ flex: 1,
3220
+ width: "100%",
3221
+ minHeight: 0,
3222
+ background: theme.palette.background.paper,
3223
+ // Active line addon
3224
+ ".CodeMirror-focused .CodeMirror-activeline": {
3225
+ "& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter": {
3226
+ background: theme.palette.primary.background
3227
+ }
3228
+ },
3229
+ ...fullScreen && {
3230
+ maxWidth: "100%",
3231
+ maxHeight: "100vh",
3232
+ height: "100vh"
3233
+ },
3234
+ ...(variant === "filled" || variant === "outlined") && {
3235
+ borderRadius: theme.spacing(0.5),
3236
+ transition: theme.transitions.create("background-color", {
3237
+ easing: theme.transitions.easing.easeInOut,
3238
+ duration: theme.transitions.duration.shortest
3239
+ }),
3240
+ "&:after": {
3241
+ content: '""',
3242
+ position: "absolute",
3243
+ top: 0,
3244
+ left: 0,
3245
+ right: 0,
3246
+ bottom: 0,
3247
+ pointerEvents: "none",
3248
+ border: `1px solid ${theme.palette.default.outlinedBorder}`,
3249
+ borderRadius: theme.spacing(0.5),
3250
+ transition: theme.transitions.create("border-color", {
3251
+ easing: theme.transitions.easing.easeInOut,
3252
+ duration: theme.transitions.duration.shortest
3253
+ })
3254
+ },
3255
+ "&:hover:after": {
3256
+ borderColor: theme.palette.common.black
3257
+ },
3258
+ "&:focus-within": {
3259
+ overflow: "hidden",
3260
+ "&:after": {
3261
+ borderWidth: "2px",
3262
+ borderColor: theme.palette.primary.main
3263
+ }
3264
+ },
3265
+ ...error && {
3266
+ "&.MuiBox-root:after": {
3267
+ borderWidth: "2px",
3268
+ borderColor: theme.palette.error.main
3269
+ }
3270
+ }
3271
+ },
3272
+ ...variant === "filled" && {
3273
+ backgroundColor: theme.palette.background.paper,
3274
+ "&.codeArea-filled:after": {
3275
+ borderColor: "transparent"
3276
+ },
3277
+ "&.codeArea-filled:hover:after": {
3278
+ borderColor: theme.palette.common.black
3279
+ },
3280
+ "&.codeArea-filled:focus-within:after": {
3281
+ borderWidth: "2px",
3282
+ borderColor: theme.palette.primary.main
3283
+ },
3284
+ "& .CodeMirror": {
3285
+ backgroundColor: theme.palette.default.background,
3286
+ "&:focus-within": {
3287
+ backgroundColor: theme.palette.background.paper
3288
+ }
3289
+ },
3290
+ ...error && {
3291
+ borderColor: theme.palette.error.main,
3292
+ "& .CodeMirror": {
3293
+ backgroundColor: theme.palette.default.background
3294
+ },
3295
+ "&:hover, &:focus-within, &.codeArea-filled:after, &.codeArea-filled:hover:after, &.codeArea-filled:focus-within:after": {
3296
+ borderColor: theme.palette.error.main
3297
+ },
3298
+ "&:focus-within": {
3299
+ "& .CodeMirror": {
3300
+ backgroundColor: theme.palette.background.paper
3301
+ }
3302
+ }
3303
+ }
3304
+ },
3305
+ ...readOnly && {
3306
+ "& .CodeMirror": {
3307
+ backgroundColor: theme.palette.default.background,
3308
+ ".CodeMirror-cursors": {
3309
+ visibility: "hidden !important"
3310
+ }
3311
+ },
3312
+ ...variant === "filled" && {
3313
+ backgroundColor: theme.palette.background.paper
3314
+ }
3315
+ },
3316
+ ...disabled && {
3317
+ pointerEvents: "none",
3318
+ "& .CodeMirror": {
3319
+ color: theme.palette.text.disabled,
3320
+ backgroundColor: theme.palette.default.background,
3321
+ "& span, .CodeMirror-linenumber, .CodeMirror-guttermarker-subtle": {
3322
+ color: theme.palette.text.disabled
3323
+ }
3324
+ },
3325
+ ...variant === "filled" && {
3326
+ backgroundColor: theme.palette.background.paper
3327
+ }
3328
+ },
3329
+ ...!lineNumbers && {
3330
+ "& .CodeMirror-scroll .CodeMirror-sizer": {
3331
+ marginLeft: `${theme.spacing(1)} !important`
3332
+ },
3333
+ "& .CodeMirror-gutter-background": {
3334
+ width: `${theme.spacing(2)} !important`
3335
+ }
3336
+ }
3337
+ })
3338
+ );
3339
+ const InputWrapper = material.styled(material.Box, {
3340
+ shouldForwardProp: (prop) => prop !== "hasActions"
3341
+ })(({ theme, hasActions }) => ({
3342
+ flex: "1 1 auto",
3343
+ overflowY: "auto",
3344
+ display: "flex",
3345
+ flexDirection: "column",
3346
+ ...hasActions && {
3347
+ ".CodeMirror-line": {
3348
+ paddingRight: `${theme.spacing(4)} !important`
3349
+ }
3350
+ }
3351
+ }));
3352
+ const HelpIcon = material.styled(iconsMaterial.HelpOutline)(({ theme }) => ({
3353
+ width: TablePaginationActions.ICON_SIZE_SMALL,
3354
+ height: TablePaginationActions.ICON_SIZE_SMALL,
3355
+ fill: theme.palette.text.secondary
3356
+ }));
3357
+ function CodeAreaField({
3358
+ value,
3359
+ defaultValue,
3360
+ validate,
3361
+ onChange,
3362
+ onBlur,
3363
+ onFocus,
3364
+ label,
3365
+ labelHelpTooltip,
3366
+ placeholder,
3367
+ type,
3368
+ disabled,
3369
+ copyValue,
3370
+ helperText,
3371
+ error,
3372
+ size = "small",
3373
+ variant = "outlined",
3374
+ onClickExpand,
3375
+ onClickFooter,
3376
+ disabledButtonFooter,
3377
+ buttonFooterLabelId,
3378
+ options,
3379
+ id = "code-area-field",
3380
+ saveLoading,
3381
+ showSaveSnackbar,
3382
+ onCloseSaveSnackbar,
3383
+ fullScreen,
3384
+ isExpanded,
3385
+ ...props
3386
+ }) {
3387
+ const [focused, setFocused] = React.useState(false);
3388
+ const readOnly = (options == null ? void 0 : options.readOnly) ?? false;
3389
+ const lineNumbers = (options == null ? void 0 : options.lineNumbers) ?? true;
3390
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3391
+ Root$2,
3392
+ {
3393
+ size,
3394
+ error,
3395
+ disabled,
3396
+ "aria-disabled": disabled,
3397
+ "data-size": size,
3398
+ "data-full-screen": fullScreen,
3399
+ "data-variant": variant,
3400
+ "data-name": "code-area-field",
3401
+ children: [
3402
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3403
+ material.InputLabel,
3404
+ {
3405
+ htmlFor: id,
3406
+ disabled,
3407
+ error,
3408
+ focused,
3409
+ shrink: true,
3410
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3411
+ LabelWithIndicator,
3412
+ {
3413
+ label,
3414
+ type,
3415
+ icon: labelHelpTooltip ? /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(
3416
+ HelpIcon,
3417
+ {
3418
+ "aria-label": typeof labelHelpTooltip === "string" ? labelHelpTooltip : void 0
3419
+ }
3420
+ ) }) : void 0
3421
+ }
3422
+ )
3423
+ }
3424
+ ),
3425
+ /* @__PURE__ */ jsxRuntime.jsxs(
3426
+ CodeMirrorWrapper,
3427
+ {
3428
+ variant,
3429
+ error: !!error,
3430
+ disabled,
3431
+ readOnly,
3432
+ lineNumbers,
3433
+ className: variant === "filled" ? "codeArea-filled" : "",
3434
+ fullScreen,
3435
+ children: [
3436
+ /* @__PURE__ */ jsxRuntime.jsx(
3437
+ CodeAreaHeader,
3438
+ {
3439
+ onClickExpand,
3440
+ copyValue,
3441
+ disabled,
3442
+ size: isExpanded ? "medium" : "small"
3443
+ }
3444
+ ),
3445
+ /* @__PURE__ */ jsxRuntime.jsx(InputWrapper, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsxRuntime.jsx(
3446
+ CodeAreaInput,
3447
+ {
3448
+ ...props,
3449
+ id,
3450
+ disabled,
3451
+ value,
3452
+ defaultValue,
3453
+ placeholder,
3454
+ onFocus: () => {
3455
+ setFocused(true);
3456
+ onFocus == null ? void 0 : onFocus();
3457
+ },
3458
+ onBlur: (value2) => {
3459
+ if (onBlur) onBlur(value2);
3460
+ if (onChange) onChange(value2);
3461
+ if (validate) validate(value2);
3462
+ setFocused(false);
3463
+ },
3464
+ onChange,
3465
+ size,
3466
+ options: {
3467
+ ...readOnly && {
3468
+ styleActiveLine: false,
3469
+ matchBrackets: false
3470
+ },
3471
+ ...options
3472
+ }
3473
+ }
3474
+ ) }),
3475
+ /* @__PURE__ */ jsxRuntime.jsx(
3476
+ CodeAreaFooter,
3477
+ {
3478
+ buttonFooterLabelId,
3479
+ onClickFooter,
3480
+ disabled,
3481
+ disabledButtonFooter,
3482
+ size: "small",
3483
+ loading: !!saveLoading,
3484
+ showSnackbar: showSaveSnackbar,
3485
+ onCloseSnackbar: onCloseSaveSnackbar
3486
+ }
3487
+ )
3488
+ ]
3489
+ }
3490
+ ),
3491
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: helperText })
3492
+ ]
3493
+ }
3494
+ );
3495
+ }
3496
+ const ErrorWrapper = material.styled(material.Box)(({ theme }) => ({
3497
+ position: "relative",
3498
+ marginBottom: "1px",
3499
+ padding: theme.spacing(1.5, 2, 1.5, 5.5),
3500
+ "&:before": {
3501
+ content: '""',
3502
+ position: "absolute",
3503
+ top: 0,
3504
+ left: 0,
3505
+ bottom: 0,
3506
+ zIndex: 1,
3507
+ width: theme.spacing(5),
3508
+ background: theme.palette.background.default
3509
+ },
3510
+ "&:after": {
3511
+ content: '""',
3512
+ position: "absolute",
3513
+ top: 0,
3514
+ right: 0,
3515
+ left: 0,
3516
+ bottom: 0,
3517
+ zIndex: 2,
3518
+ background: `linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 40%)`
3519
+ },
3520
+ ".MuiFormHelperText-root": {
3521
+ marginTop: 0
3522
+ }
3523
+ }));
3524
+ const ErrorContent = material.styled(material.Box)(({ theme }) => ({
3525
+ position: "relative",
3526
+ zIndex: 3,
3527
+ display: "flex",
3528
+ alignItems: "center",
3529
+ gap: theme.spacing(1)
3530
+ }));
3531
+ function CodeAreaDialogError({
3532
+ children,
3533
+ hasDivider
3534
+ }) {
3535
+ const theme = material.useTheme();
3536
+ if (!children) return null;
3537
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3538
+ /* @__PURE__ */ jsxRuntime.jsx(ErrorWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(ErrorContent, { children: [
3539
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ErrorOutline, { htmlColor: theme.palette.error.main }),
3540
+ /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { error: true, children })
3541
+ ] }) }),
3542
+ hasDivider && /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {})
3543
+ ] });
3544
+ }
2849
3545
  const sizesHeight = {
2850
3546
  [
2851
3547
  "small"
@@ -3126,7 +3822,7 @@ function DialogHeader({
3126
3822
  children && /* @__PURE__ */ jsxRuntime.jsx(DividerBottom, {})
3127
3823
  ] });
3128
3824
  }
3129
- const Content = material.styled(material.DialogContent, {
3825
+ const Content$1 = material.styled(material.DialogContent, {
3130
3826
  shouldForwardProp: (prop) => !["scrollableContent", "withGutter", "withBottomGutter"].includes(prop)
3131
3827
  })(({ theme, scrollableContent, withGutter, withBottomGutter }) => ({
3132
3828
  display: "flex",
@@ -3203,7 +3899,7 @@ function _DialogContent({
3203
3899
  return () => resizeObserver.disconnect();
3204
3900
  }, [contentRef, updateBorders]);
3205
3901
  return /* @__PURE__ */ jsxRuntime.jsx(
3206
- Content,
3902
+ Content$1,
3207
3903
  {
3208
3904
  ref: setContentRef,
3209
3905
  onScroll: handleScroll,
@@ -3502,6 +4198,159 @@ function DialogStepper({
3502
4198
  );
3503
4199
  }) }) });
3504
4200
  }
4201
+ const Content = material.styled(DialogContent, {
4202
+ shouldForwardProp: (prop) => !["error", "withBorder"].includes(prop)
4203
+ })(
4204
+ ({ error, withBorder, theme }) => ({
4205
+ gap: 0,
4206
+ border: withBorder ? `1px solid ${theme.palette.divider} !important` : void 0,
4207
+ borderBottom: error ? "none !important" : void 0,
4208
+ ".react-codemirror2": {
4209
+ display: "flex",
4210
+ flexDirection: "column",
4211
+ minHeight: "100%"
4212
+ },
4213
+ ".CodeMirror-wrap": {
4214
+ display: "flex",
4215
+ flexDirection: "column",
4216
+ flex: 1
4217
+ },
4218
+ "& + .MuiDivider-root": {
4219
+ display: "none"
4220
+ }
4221
+ })
4222
+ );
4223
+ function CodeAreaDialogContent({
4224
+ children,
4225
+ error,
4226
+ withBorder = true,
4227
+ withGutter = false
4228
+ }) {
4229
+ if (!children) return null;
4230
+ return /* @__PURE__ */ jsxRuntime.jsx(Content, { withGutter, error, withBorder, children });
4231
+ }
4232
+ function CodeAreaDialogConfirmation({
4233
+ onClose,
4234
+ onCancel,
4235
+ cancelLabelId,
4236
+ cancelButton,
4237
+ closeButton,
4238
+ contentLabelId,
4239
+ titleLabelId,
4240
+ severity = "warning",
4241
+ content
4242
+ }) {
4243
+ const intl = reactIntl.useIntl();
4244
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
4245
+ if (!onClose || !onCancel) {
4246
+ return null;
4247
+ }
4248
+ return /* @__PURE__ */ jsxRuntime.jsx(
4249
+ DialogConfirmation,
4250
+ {
4251
+ opened: true,
4252
+ severity,
4253
+ title: intlConfig.formatMessage({
4254
+ id: titleLabelId || "c4r.dialog.confirmation.title"
4255
+ }),
4256
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4257
+ onCancel && (cancelButton ? cancelButton : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onCancel, children: intlConfig.formatMessage({
4258
+ id: cancelLabelId || "c4r.button.cancel"
4259
+ }) })),
4260
+ onClose && (closeButton ? closeButton : /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "contained", onClick: onClose, children: intlConfig.formatMessage({
4261
+ id: "c4r.button.leave"
4262
+ }) }))
4263
+ ] }),
4264
+ children: content ? content : intlConfig.formatMessage({
4265
+ id: contentLabelId || "c4r.dialog.confirmation.content"
4266
+ })
4267
+ }
4268
+ );
4269
+ }
4270
+ function CodeAreaDialog({
4271
+ open,
4272
+ onClose,
4273
+ title,
4274
+ error,
4275
+ helperText,
4276
+ onClickFooter,
4277
+ disabledButtonFooter,
4278
+ buttonFooterLabelId,
4279
+ disabled,
4280
+ showConfirmation,
4281
+ onCancelConfirm,
4282
+ onCloseConfirm,
4283
+ footerProps,
4284
+ saveLoading,
4285
+ showSaveSnackbar,
4286
+ onCloseSaveSnackbar,
4287
+ "data-testid": dataTestId,
4288
+ "aria-label": ariaLabel,
4289
+ ...props
4290
+ }) {
4291
+ const showFooter = error || !!onClickFooter || !!footerProps;
4292
+ if (!open) return null;
4293
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4294
+ Dialog,
4295
+ {
4296
+ open,
4297
+ fullScreen: true,
4298
+ onClose,
4299
+ "data-testid": dataTestId,
4300
+ "aria-label": ariaLabel,
4301
+ "data-name": "code-area-dialog",
4302
+ children: [
4303
+ /* @__PURE__ */ jsxRuntime.jsx(
4304
+ DialogHeader,
4305
+ {
4306
+ title,
4307
+ onClose,
4308
+ closeIcon: !onClickFooter && /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.CloseDiagonallyRight, {})
4309
+ }
4310
+ ),
4311
+ /* @__PURE__ */ jsxRuntime.jsx(CodeAreaDialogContent, { error, children: /* @__PURE__ */ jsxRuntime.jsx(
4312
+ CodeAreaField,
4313
+ {
4314
+ ...props,
4315
+ disabled,
4316
+ variant: null,
4317
+ isExpanded: true
4318
+ }
4319
+ ) }),
4320
+ showFooter && /* @__PURE__ */ jsxRuntime.jsx(
4321
+ DialogFooter,
4322
+ {
4323
+ ...footerProps,
4324
+ topContent: error && /* @__PURE__ */ jsxRuntime.jsx(CodeAreaDialogError, { hasDivider: !!onClickFooter, children: helperText }),
4325
+ children: !!onClickFooter && /* @__PURE__ */ jsxRuntime.jsx(
4326
+ CodeAreaFooter,
4327
+ {
4328
+ onClickFooter,
4329
+ buttonFooterLabelId,
4330
+ disabled,
4331
+ disabledButtonFooter,
4332
+ withGutter: false,
4333
+ variant: "contained",
4334
+ size: "medium",
4335
+ loading: !!saveLoading,
4336
+ showSnackbar: showSaveSnackbar,
4337
+ onCloseSnackbar: onCloseSaveSnackbar
4338
+ }
4339
+ )
4340
+ }
4341
+ ),
4342
+ showConfirmation && /* @__PURE__ */ jsxRuntime.jsx(
4343
+ CodeAreaDialogConfirmation,
4344
+ {
4345
+ onClose: onCloseConfirm ?? onClose,
4346
+ onCancel: onCancelConfirm,
4347
+ cancelLabelId: "c4r.button.keepEditing"
4348
+ }
4349
+ )
4350
+ ]
4351
+ }
4352
+ );
4353
+ }
3505
4354
  exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
3506
4355
  exports.Typography = TablePaginationActions.Typography;
3507
4356
  exports.Alert = Alert$1.Alert;
@@ -3511,6 +4360,14 @@ exports.AppBar = AppBar;
3511
4360
  exports.Autocomplete = Autocomplete;
3512
4361
  exports.Avatar = Avatar;
3513
4362
  exports.Button = Button;
4363
+ exports.CodeAreaDialog = CodeAreaDialog;
4364
+ exports.CodeAreaDialogConfirmation = CodeAreaDialogConfirmation;
4365
+ exports.CodeAreaDialogContent = CodeAreaDialogContent;
4366
+ exports.CodeAreaDialogError = CodeAreaDialogError;
4367
+ exports.CodeAreaField = CodeAreaField;
4368
+ exports.CodeAreaFooter = CodeAreaFooter;
4369
+ exports.CodeAreaHeader = CodeAreaHeader;
4370
+ exports.CodeAreaInput = CodeAreaInput;
3514
4371
  exports.CopiableComponent = CopiableComponent;
3515
4372
  exports.CreatableAutocomplete = CreatableAutocomplete;
3516
4373
  exports.DatePicker = DatePicker;
@@ -3536,7 +4393,6 @@ exports.MultipleSelectField = MultipleSelectField;
3536
4393
  exports.PasswordField = PasswordField;
3537
4394
  exports.SelectField = SelectField;
3538
4395
  exports.Snackbar = Snackbar;
3539
- exports.Tag = Tag;
3540
4396
  exports.TimePicker = TimePicker;
3541
4397
  exports.ToggleButtonGroup = ToggleButtonGroup;
3542
4398
  exports.TooltipData = TooltipData;