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