@carto/meridian-ds 1.4.3-alpha-codemirror.6 → 1.4.3-alpha-tag.2

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 (58) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/{Alert-CpgfD3bq.js → Alert--QYebQp3.js} +1 -1
  3. package/dist/{Alert-ChcvNOU6.cjs → Alert-DFaAeTZf.cjs} +3 -3
  4. package/dist/{palette-CD5ph5A-.cjs → TablePaginationActions-BG2gWq0M.cjs} +3 -232
  5. package/dist/{palette-DI1CmQ2J.js → TablePaginationActions-Dit3VW-A.js} +5 -234
  6. package/dist/components/index.cjs +236 -1098
  7. package/dist/components/index.js +202 -1064
  8. package/dist/custom-icons/index.cjs +390 -339
  9. package/dist/custom-icons/index.js +390 -339
  10. package/dist/paletteUtils-B9ybmwiI.cjs +304 -0
  11. package/dist/paletteUtils-BHqJlHm9.js +288 -0
  12. package/dist/theme/index.cjs +103 -103
  13. package/dist/theme/index.js +4 -3
  14. package/dist/types/components/molecules/Tag.d.ts +20 -0
  15. package/dist/types/components/molecules/Tag.d.ts.map +1 -0
  16. package/dist/types/components/molecules/index.d.ts +2 -0
  17. package/dist/types/components/molecules/index.d.ts.map +1 -1
  18. package/dist/types/components/organisms/index.d.ts +0 -2
  19. package/dist/types/components/organisms/index.d.ts.map +1 -1
  20. package/dist/types/localization/en.d.ts +0 -6
  21. package/dist/types/localization/en.d.ts.map +1 -1
  22. package/dist/types/localization/es.d.ts +0 -6
  23. package/dist/types/localization/es.d.ts.map +1 -1
  24. package/dist/types/localization/id.d.ts +0 -6
  25. package/dist/types/localization/id.d.ts.map +1 -1
  26. package/dist/types/localization/index.d.ts +0 -18
  27. package/dist/types/localization/index.d.ts.map +1 -1
  28. package/dist/widgets/index.cjs +136 -136
  29. package/dist/widgets/index.js +3 -3
  30. package/package.json +1 -6
  31. package/dist/OpenDiagonallyRight-5HZXh46V.js +0 -59
  32. package/dist/OpenDiagonallyRight-BrRyCV4Q.cjs +0 -58
  33. package/dist/paletteUtils-DEHchy2r.cjs +0 -93
  34. package/dist/paletteUtils-DTaXyq2Z.js +0 -77
  35. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts +0 -16
  36. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts.map +0 -1
  37. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts +0 -16
  38. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts.map +0 -1
  39. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts +0 -10
  40. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts.map +0 -1
  41. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts +0 -8
  42. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts.map +0 -1
  43. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts +0 -4
  44. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts.map +0 -1
  45. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts +0 -12
  46. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts.map +0 -1
  47. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts +0 -9
  48. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +0 -1
  49. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts +0 -26
  50. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts.map +0 -1
  51. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts +0 -7
  52. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts.map +0 -1
  53. package/dist/types/components/organisms/CodeArea/index.d.ts +0 -9
  54. package/dist/types/components/organisms/CodeArea/index.d.ts.map +0 -1
  55. package/dist/types/components/organisms/CodeArea/types.d.ts +0 -38
  56. package/dist/types/components/organisms/CodeArea/types.d.ts.map +0 -1
  57. package/dist/types/components/organisms/CodeArea/utils.d.ts +0 -5
  58. package/dist/types/components/organisms/CodeArea/utils.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useState, useEffect, useMemo, useRef, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
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 "../palette-DI1CmQ2J.js";
5
- import { a } from "../palette-DI1CmQ2J.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-Dit3VW-A.js";
5
+ import { a } from "../TablePaginationActions-Dit3VW-A.js";
6
6
  import { useIntl } from "react-intl";
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-CpgfD3bq.js";
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";
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,31 +13,6 @@ 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";
41
16
  import ClickAwayListener from "@mui/material/ClickAwayListener";
42
17
  const IndicatorIcon = styled(Box)({
43
18
  position: "absolute",
@@ -99,7 +74,7 @@ function _Button({
99
74
  );
100
75
  }
101
76
  const Button = forwardRef(_Button);
102
- const Root$5 = styled(Box)(({ theme }) => ({
77
+ const Root$4 = styled(Box)(({ theme }) => ({
103
78
  display: "flex",
104
79
  alignItems: "center",
105
80
  gap: theme.spacing(0.5)
@@ -129,7 +104,7 @@ function LabelWithIndicator({
129
104
  icon,
130
105
  inheritSize
131
106
  }) {
132
- return /* @__PURE__ */ jsxs(Root$5, { children: [
107
+ return /* @__PURE__ */ jsxs(Root$4, { children: [
133
108
  label,
134
109
  type && /* @__PURE__ */ jsx(
135
110
  Indicator,
@@ -1608,7 +1583,7 @@ const SnackbarRoot = styled(Snackbar$1)(({ theme }) => ({
1608
1583
  maxWidth: `${MAX_WIDTH}px`
1609
1584
  }
1610
1585
  }));
1611
- const Content$4 = styled(Box, {
1586
+ const Content$3 = styled(Box, {
1612
1587
  shouldForwardProp: (prop) => prop !== "autoWidth"
1613
1588
  })(({ autoWidth, theme }) => ({
1614
1589
  minWidth: "100%",
@@ -1717,7 +1692,7 @@ function Snackbar({
1717
1692
  TransitionComponent: autoWidth ? Fade : Slide,
1718
1693
  "data-auto-width": autoWidth,
1719
1694
  children: /* @__PURE__ */ jsxs(
1720
- Content$4,
1695
+ Content$3,
1721
1696
  {
1722
1697
  sx: {
1723
1698
  position: "relative"
@@ -1754,6 +1729,188 @@ function Snackbar({
1754
1729
  }
1755
1730
  ) });
1756
1731
  }
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
+ };
1849
+ });
1850
+ const TagIcon = styled("div")(({ theme }) => ({
1851
+ display: "flex",
1852
+ justifyContent: "center",
1853
+ alignItems: "center",
1854
+ "& svg": {
1855
+ width: theme.spacing(ICON_SIZE_SMALL),
1856
+ height: theme.spacing(ICON_SIZE_SMALL),
1857
+ "& g": {
1858
+ fill: "currentColor"
1859
+ }
1860
+ }
1861
+ }));
1862
+ const TagLabel = styled("span", {
1863
+ shouldForwardProp: (prop) => !["type", "icon"].includes(prop)
1864
+ })(({ type, icon, theme }) => ({
1865
+ display: "flex",
1866
+ alignItems: "center",
1867
+ paddingTop: type === "code" || icon ? theme.spacing(0.25) : void 0
1868
+ }));
1869
+ function _Tag({
1870
+ label,
1871
+ color = "primary",
1872
+ variant = "filled",
1873
+ icon,
1874
+ type = "default",
1875
+ typographyProps,
1876
+ noWrap = true,
1877
+ disabled,
1878
+ ...otherProps
1879
+ }, ref) {
1880
+ const typeCode = type === "code";
1881
+ return /* @__PURE__ */ jsxs(
1882
+ TagRoot,
1883
+ {
1884
+ ref,
1885
+ className: "CartoTag-root",
1886
+ color,
1887
+ variant,
1888
+ disabled,
1889
+ "aria-disabled": disabled,
1890
+ "data-color": color,
1891
+ "data-variant": variant,
1892
+ "data-type": type,
1893
+ "data-name": "tag",
1894
+ ...otherProps,
1895
+ children: [
1896
+ icon && /* @__PURE__ */ jsx(TagIcon, { children: icon }),
1897
+ /* @__PURE__ */ jsx(TagLabel, { icon: !!icon, type, children: /* @__PURE__ */ jsx(
1898
+ Typography,
1899
+ {
1900
+ component: "span",
1901
+ color: "inherit",
1902
+ variant: typeCode ? "code3" : "caption",
1903
+ weight: typeCode ? "strong" : "medium",
1904
+ noWrap,
1905
+ ...typographyProps,
1906
+ children: label
1907
+ }
1908
+ ) })
1909
+ ]
1910
+ }
1911
+ );
1912
+ }
1913
+ const Tag = forwardRef(_Tag);
1757
1914
  const Menu = styled("div")(({ theme }) => ({
1758
1915
  display: "flex",
1759
1916
  alignItems: "center",
@@ -1843,7 +2000,7 @@ function SecondaryText({ text }) {
1843
2000
  }
1844
2001
  );
1845
2002
  }
1846
- const Root$4 = styled(AppBar$1)(({ theme }) => ({
2003
+ const Root$3 = styled(AppBar$1)(({ theme }) => ({
1847
2004
  backgroundColor: theme.palette.brand.appBarMain,
1848
2005
  "& .MuiTypography-root": {
1849
2006
  color: theme.palette.brand.appBarContrastText
@@ -1861,7 +2018,7 @@ const BrandElements = styled("div")(({ theme }) => ({
1861
2018
  minWidth: "192px"
1862
2019
  }
1863
2020
  }));
1864
- const Content$3 = styled("div")(({ theme }) => ({
2021
+ const Content$2 = styled("div")(({ theme }) => ({
1865
2022
  display: "flex",
1866
2023
  alignItems: "center",
1867
2024
  justifyContent: "space-between",
@@ -1877,14 +2034,14 @@ function AppBar({
1877
2034
  onClickMenu,
1878
2035
  ...otherProps
1879
2036
  }) {
1880
- return /* @__PURE__ */ jsx(Root$4, { ...otherProps, children: /* @__PURE__ */ jsxs(Toolbar, { children: [
2037
+ return /* @__PURE__ */ jsx(Root$3, { ...otherProps, children: /* @__PURE__ */ jsxs(Toolbar, { children: [
1881
2038
  /* @__PURE__ */ jsxs(BrandElements, { children: [
1882
2039
  showBurgerMenu && /* @__PURE__ */ jsx(BurgerMenu, { onClickMenu }),
1883
2040
  brandLogo && /* @__PURE__ */ jsx(BrandLogo, { logo: brandLogo }),
1884
2041
  brandText && /* @__PURE__ */ jsx(BrandText, { text: brandText }),
1885
2042
  secondaryText && /* @__PURE__ */ jsx(SecondaryText, { text: secondaryText })
1886
2043
  ] }),
1887
- /* @__PURE__ */ jsx(Content$3, { children })
2044
+ /* @__PURE__ */ jsx(Content$2, { children })
1888
2045
  ] }) });
1889
2046
  }
1890
2047
  const Container = styled(Box, {
@@ -1922,7 +2079,7 @@ function ClearButton({
1922
2079
  }
1923
2080
  ) });
1924
2081
  }
1925
- const Root$3 = styled(Box, {
2082
+ const Root$2 = styled(Box, {
1926
2083
  shouldForwardProp: (prop) => !["size", "variant", "readOnly"].includes(prop)
1927
2084
  })(({ size, variant, readOnly, theme }) => ({
1928
2085
  // 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
@@ -1962,7 +2119,7 @@ function DateFieldContainer({
1962
2119
  readOnly,
1963
2120
  ...props
1964
2121
  }) {
1965
- return /* @__PURE__ */ jsx(Root$3, { ...props, size, variant, readOnly, children });
2122
+ return /* @__PURE__ */ jsx(Root$2, { ...props, size, variant, readOnly, children });
1966
2123
  }
1967
2124
  function DatePicker({
1968
2125
  handleClear,
@@ -2635,7 +2792,7 @@ function DateTimePicker({
2635
2792
  );
2636
2793
  }
2637
2794
  const DEFAULT_ITEMS = [{ outlinedBullet: false, value: "" }];
2638
- const Content$2 = styled("ul")(({ theme }) => ({
2795
+ const Content$1 = styled("ul")(({ theme }) => ({
2639
2796
  listStyle: "none",
2640
2797
  paddingLeft: 0,
2641
2798
  margin: theme.spacing(0.5, 0, 0, 0)
@@ -2666,7 +2823,7 @@ function TooltipData({
2666
2823
  }) {
2667
2824
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2668
2825
  title && /* @__PURE__ */ jsx(Typography, { color: "inherit", variant: "caption", weight: "medium", children: title }),
2669
- /* @__PURE__ */ jsx(Content$2, { children: items.map((item, index) => /* @__PURE__ */ jsxs(Entry, { children: [
2826
+ /* @__PURE__ */ jsx(Content$1, { children: items.map((item, index) => /* @__PURE__ */ jsxs(Entry, { children: [
2670
2827
  /* @__PURE__ */ jsx(
2671
2828
  Bullet,
2672
2829
  {
@@ -2681,865 +2838,6 @@ function TooltipData({
2681
2838
  ] }, index)) })
2682
2839
  ] });
2683
2840
  }
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
- labelIdButtonFooter,
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: labelIdButtonFooter || "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 CodeAreaInput({
3079
- options,
3080
- value,
3081
- defaultValue,
3082
- id,
3083
- onEditorDidMount,
3084
- onChange,
3085
- onBlur,
3086
- onFocus,
3087
- placeholder,
3088
- disabled,
3089
- size = "small",
3090
- height,
3091
- "data-testid": dataTestId,
3092
- "aria-label": ariaLabel,
3093
- ...props
3094
- }) {
3095
- var _a;
3096
- const editorRef = useRef();
3097
- const codeMirrorOptions = {
3098
- mode: "sql",
3099
- theme: "light",
3100
- lineNumbers: true,
3101
- lineWrapping: true,
3102
- extraKeys: { "Ctrl-Space": "autocomplete" },
3103
- placeholder,
3104
- disabled,
3105
- gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
3106
- styleActiveLine: { nonEmpty: true },
3107
- styleActiveSelected: true,
3108
- matchBrackets: true,
3109
- foldOptions: {
3110
- minFoldSize: 1,
3111
- scanUp: false
3112
- },
3113
- ...options
3114
- };
3115
- const [editor, setEditor] = useState(null);
3116
- useEffect(() => {
3117
- return () => {
3118
- setEditor(null);
3119
- };
3120
- }, []);
3121
- const foldCode = useCallback(
3122
- ({ from, to }) => {
3123
- editor.foldCode(
3124
- 0,
3125
- {
3126
- rangeFinder: () => {
3127
- if (!to) return;
3128
- return {
3129
- from: { line: from - 1, ch: 0 },
3130
- to: { line: to - 1, ch: 0 }
3131
- };
3132
- }
3133
- },
3134
- "fold"
3135
- );
3136
- },
3137
- [editor]
3138
- );
3139
- useEffect(() => {
3140
- if (!value || !editor) return;
3141
- const numberOfBlocks = findCodeAreaControlCodeOccurrences(value);
3142
- if (!numberOfBlocks.length) return;
3143
- for (const line of numberOfBlocks) {
3144
- foldCode(line);
3145
- }
3146
- }, [value, foldCode, editor]);
3147
- return /* @__PURE__ */ jsxs(
3148
- CodeAreaTheme,
3149
- {
3150
- size,
3151
- height,
3152
- id,
3153
- "data-size": size,
3154
- "data-height": height,
3155
- "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,
3156
- "data-fold-gutter": options == null ? void 0 : options.foldGutter,
3157
- "data-testid": dataTestId,
3158
- "aria-label": ariaLabel ?? "Code editor text area",
3159
- "data-name": "code-area-input",
3160
- children: [
3161
- value !== void 0 && /* @__PURE__ */ jsx(
3162
- Controlled,
3163
- {
3164
- ...props,
3165
- value,
3166
- editorDidMount: (editor2) => {
3167
- editorRef.current = editor2;
3168
- setEditor(editor2);
3169
- onEditorDidMount == null ? void 0 : onEditorDidMount(editor2);
3170
- },
3171
- options: codeMirrorOptions,
3172
- onBeforeChange: (editor2, data, value2) => {
3173
- onChange == null ? void 0 : onChange(value2);
3174
- },
3175
- onBlur: (editor2) => {
3176
- onBlur == null ? void 0 : onBlur(editor2.getValue());
3177
- },
3178
- onFocus
3179
- }
3180
- ),
3181
- defaultValue !== void 0 && /* @__PURE__ */ jsx(
3182
- UnControlled,
3183
- {
3184
- ...props,
3185
- value: defaultValue,
3186
- options: codeMirrorOptions,
3187
- onBlur: (editor2) => {
3188
- onBlur == null ? void 0 : onBlur(editor2.getValue());
3189
- },
3190
- onFocus
3191
- }
3192
- )
3193
- ]
3194
- }
3195
- );
3196
- }
3197
- const Root$2 = styled(FormControl)(() => ({
3198
- display: "flex",
3199
- flexDirection: "column",
3200
- flex: 1
3201
- }));
3202
- const CodeMirrorWrapper = styled(Box, {
3203
- shouldForwardProp: (prop) => ![
3204
- "variant",
3205
- "error",
3206
- "disabled",
3207
- "readOnly",
3208
- "lineNumbers",
3209
- "fullScreen"
3210
- ].includes(prop)
3211
- })(
3212
- ({ variant, error, disabled, readOnly, lineNumbers, fullScreen, theme }) => ({
3213
- position: "relative",
3214
- overflow: "auto",
3215
- display: "flex",
3216
- flexDirection: "column",
3217
- flex: 1,
3218
- width: "100%",
3219
- minHeight: 0,
3220
- background: theme.palette.background.paper,
3221
- // Active line addon
3222
- ".CodeMirror-focused .CodeMirror-activeline": {
3223
- "& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter": {
3224
- background: theme.palette.primary.background
3225
- }
3226
- },
3227
- ...fullScreen && {
3228
- maxWidth: "100%",
3229
- maxHeight: "100vh",
3230
- height: "100vh"
3231
- },
3232
- ...(variant === "filled" || variant === "outlined") && {
3233
- borderRadius: theme.spacing(0.5),
3234
- transition: theme.transitions.create("background-color", {
3235
- easing: theme.transitions.easing.easeInOut,
3236
- duration: theme.transitions.duration.shortest
3237
- }),
3238
- "&:after": {
3239
- content: '""',
3240
- position: "absolute",
3241
- top: 0,
3242
- left: 0,
3243
- right: 0,
3244
- bottom: 0,
3245
- pointerEvents: "none",
3246
- border: `1px solid ${theme.palette.default.outlinedBorder}`,
3247
- borderRadius: theme.spacing(0.5),
3248
- transition: theme.transitions.create("border-color", {
3249
- easing: theme.transitions.easing.easeInOut,
3250
- duration: theme.transitions.duration.shortest
3251
- })
3252
- },
3253
- "&:hover:after": {
3254
- borderColor: theme.palette.common.black
3255
- },
3256
- "&:focus-within": {
3257
- overflow: "hidden",
3258
- "&:after": {
3259
- borderWidth: "2px",
3260
- borderColor: theme.palette.primary.main
3261
- }
3262
- },
3263
- ...error && {
3264
- "&.MuiBox-root:after": {
3265
- borderWidth: "2px",
3266
- borderColor: theme.palette.error.main
3267
- }
3268
- }
3269
- },
3270
- ...variant === "filled" && {
3271
- backgroundColor: theme.palette.background.paper,
3272
- "&.codeArea-filled:after": {
3273
- borderColor: "transparent"
3274
- },
3275
- "&.codeArea-filled:hover:after": {
3276
- borderColor: theme.palette.common.black
3277
- },
3278
- "&.codeArea-filled:focus-within:after": {
3279
- borderWidth: "2px",
3280
- borderColor: theme.palette.primary.main
3281
- },
3282
- "& .CodeMirror": {
3283
- backgroundColor: theme.palette.default.background,
3284
- "&:focus-within": {
3285
- backgroundColor: theme.palette.background.paper
3286
- }
3287
- },
3288
- ...error && {
3289
- borderColor: theme.palette.error.main,
3290
- "& .CodeMirror": {
3291
- backgroundColor: theme.palette.default.background
3292
- },
3293
- "&:hover, &:focus-within, &.codeArea-filled:after, &.codeArea-filled:hover:after, &.codeArea-filled:focus-within:after": {
3294
- borderColor: theme.palette.error.main
3295
- },
3296
- "&:focus-within": {
3297
- "& .CodeMirror": {
3298
- backgroundColor: theme.palette.background.paper
3299
- }
3300
- }
3301
- }
3302
- },
3303
- ...readOnly && {
3304
- "& .CodeMirror": {
3305
- backgroundColor: theme.palette.default.background,
3306
- ".CodeMirror-cursors": {
3307
- visibility: "hidden !important"
3308
- }
3309
- },
3310
- ...variant === "filled" && {
3311
- backgroundColor: theme.palette.background.paper
3312
- }
3313
- },
3314
- ...disabled && {
3315
- pointerEvents: "none",
3316
- "& .CodeMirror": {
3317
- color: theme.palette.text.disabled,
3318
- backgroundColor: theme.palette.default.background,
3319
- "& span, .CodeMirror-linenumber, .CodeMirror-guttermarker-subtle": {
3320
- color: theme.palette.text.disabled
3321
- }
3322
- },
3323
- ...variant === "filled" && {
3324
- backgroundColor: theme.palette.background.paper
3325
- }
3326
- },
3327
- ...!lineNumbers && {
3328
- "& .CodeMirror-scroll .CodeMirror-sizer": {
3329
- marginLeft: `${theme.spacing(1)} !important`
3330
- },
3331
- "& .CodeMirror-gutter-background": {
3332
- width: `${theme.spacing(2)} !important`
3333
- }
3334
- }
3335
- })
3336
- );
3337
- const InputWrapper = styled(Box, {
3338
- shouldForwardProp: (prop) => prop !== "hasActions"
3339
- })(({ theme, hasActions }) => ({
3340
- flex: "1 1 auto",
3341
- overflowY: "auto",
3342
- display: "flex",
3343
- flexDirection: "column",
3344
- ...hasActions && {
3345
- ".CodeMirror-line": {
3346
- paddingRight: `${theme.spacing(4)} !important`
3347
- }
3348
- }
3349
- }));
3350
- const HelpIcon = styled(HelpOutline)(({ theme }) => ({
3351
- width: ICON_SIZE_SMALL,
3352
- height: ICON_SIZE_SMALL,
3353
- fill: theme.palette.text.secondary
3354
- }));
3355
- function CodeAreaField({
3356
- value,
3357
- defaultValue,
3358
- validate,
3359
- onChange,
3360
- onBlur,
3361
- onFocus,
3362
- label,
3363
- labelHelpTooltip,
3364
- placeholder,
3365
- type,
3366
- disabled,
3367
- copyValue,
3368
- helperText,
3369
- error,
3370
- size = "small",
3371
- variant = "outlined",
3372
- onClickExpand,
3373
- onClickFooter,
3374
- disabledButtonFooter,
3375
- labelIdButtonFooter,
3376
- options,
3377
- id = "code-area-field",
3378
- saveLoading,
3379
- showSaveSnackbar,
3380
- onCloseSaveSnackbar,
3381
- fullScreen,
3382
- isExpanded,
3383
- ...props
3384
- }) {
3385
- const [focused, setFocused] = useState(false);
3386
- const readOnly = (options == null ? void 0 : options.readOnly) ?? false;
3387
- const lineNumbers = (options == null ? void 0 : options.lineNumbers) ?? true;
3388
- return /* @__PURE__ */ jsxs(
3389
- Root$2,
3390
- {
3391
- size,
3392
- error,
3393
- disabled,
3394
- "aria-disabled": disabled,
3395
- "data-size": size,
3396
- "data-full-screen": fullScreen,
3397
- "data-variant": variant,
3398
- "data-name": "code-area-field",
3399
- children: [
3400
- label && /* @__PURE__ */ jsx(
3401
- InputLabel,
3402
- {
3403
- htmlFor: id,
3404
- disabled,
3405
- error,
3406
- focused,
3407
- shrink: true,
3408
- children: /* @__PURE__ */ jsx(
3409
- LabelWithIndicator,
3410
- {
3411
- label,
3412
- type,
3413
- icon: labelHelpTooltip ? /* @__PURE__ */ jsx(Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsx(
3414
- HelpIcon,
3415
- {
3416
- "aria-label": typeof labelHelpTooltip === "string" ? labelHelpTooltip : void 0
3417
- }
3418
- ) }) : void 0
3419
- }
3420
- )
3421
- }
3422
- ),
3423
- /* @__PURE__ */ jsxs(
3424
- CodeMirrorWrapper,
3425
- {
3426
- variant,
3427
- error: !!error,
3428
- disabled,
3429
- readOnly,
3430
- lineNumbers,
3431
- className: variant === "filled" ? "codeArea-filled" : "",
3432
- fullScreen,
3433
- children: [
3434
- /* @__PURE__ */ jsx(
3435
- CodeAreaHeader,
3436
- {
3437
- onClickExpand,
3438
- copyValue,
3439
- disabled,
3440
- size: isExpanded ? "medium" : "small"
3441
- }
3442
- ),
3443
- /* @__PURE__ */ jsx(InputWrapper, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsx(
3444
- CodeAreaInput,
3445
- {
3446
- ...props,
3447
- id,
3448
- disabled,
3449
- value,
3450
- defaultValue,
3451
- placeholder,
3452
- onFocus: () => {
3453
- setFocused(true);
3454
- onFocus == null ? void 0 : onFocus();
3455
- },
3456
- onBlur: (value2) => {
3457
- if (onBlur) onBlur(value2);
3458
- if (onChange) onChange(value2);
3459
- if (validate) validate(value2);
3460
- setFocused(false);
3461
- },
3462
- onChange,
3463
- size,
3464
- options: {
3465
- ...readOnly && {
3466
- styleActiveLine: false,
3467
- matchBrackets: false
3468
- },
3469
- ...options
3470
- }
3471
- }
3472
- ) }),
3473
- /* @__PURE__ */ jsx(
3474
- CodeAreaFooter,
3475
- {
3476
- labelIdButtonFooter,
3477
- onClickFooter,
3478
- disabled,
3479
- disabledButtonFooter,
3480
- size: "small",
3481
- loading: !!saveLoading,
3482
- showSnackbar: showSaveSnackbar,
3483
- onCloseSnackbar: onCloseSaveSnackbar
3484
- }
3485
- )
3486
- ]
3487
- }
3488
- ),
3489
- helperText && /* @__PURE__ */ jsx(FormHelperText, { children: helperText })
3490
- ]
3491
- }
3492
- );
3493
- }
3494
- const ErrorWrapper = styled(Box)(({ theme }) => ({
3495
- position: "relative",
3496
- marginBottom: "1px",
3497
- padding: theme.spacing(1.5, 2, 1.5, 5.5),
3498
- "&:before": {
3499
- content: '""',
3500
- position: "absolute",
3501
- top: 0,
3502
- left: 0,
3503
- bottom: 0,
3504
- zIndex: 1,
3505
- width: theme.spacing(5),
3506
- background: theme.palette.background.default
3507
- },
3508
- "&:after": {
3509
- content: '""',
3510
- position: "absolute",
3511
- top: 0,
3512
- right: 0,
3513
- left: 0,
3514
- bottom: 0,
3515
- zIndex: 2,
3516
- background: `linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 40%)`
3517
- },
3518
- ".MuiFormHelperText-root": {
3519
- marginTop: 0
3520
- }
3521
- }));
3522
- const ErrorContent = styled(Box)(({ theme }) => ({
3523
- position: "relative",
3524
- zIndex: 3,
3525
- display: "flex",
3526
- alignItems: "center",
3527
- gap: theme.spacing(1)
3528
- }));
3529
- function CodeAreaDialogError({
3530
- children,
3531
- hasDivider
3532
- }) {
3533
- const theme = useTheme();
3534
- if (!children) return null;
3535
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3536
- /* @__PURE__ */ jsx(ErrorWrapper, { children: /* @__PURE__ */ jsxs(ErrorContent, { children: [
3537
- /* @__PURE__ */ jsx(ErrorOutline, { htmlColor: theme.palette.error.main }),
3538
- /* @__PURE__ */ jsx(FormHelperText, { error: true, children })
3539
- ] }) }),
3540
- hasDivider && /* @__PURE__ */ jsx(Divider, {})
3541
- ] });
3542
- }
3543
2841
  const sizesHeight = {
3544
2842
  [
3545
2843
  "small"
@@ -3820,7 +3118,7 @@ function DialogHeader({
3820
3118
  children && /* @__PURE__ */ jsx(DividerBottom, {})
3821
3119
  ] });
3822
3120
  }
3823
- const Content$1 = styled(DialogContent$1, {
3121
+ const Content = styled(DialogContent$1, {
3824
3122
  shouldForwardProp: (prop) => !["scrollableContent", "withGutter", "withBottomGutter"].includes(prop)
3825
3123
  })(({ theme, scrollableContent, withGutter, withBottomGutter }) => ({
3826
3124
  display: "flex",
@@ -3897,7 +3195,7 @@ function _DialogContent({
3897
3195
  return () => resizeObserver.disconnect();
3898
3196
  }, [contentRef, updateBorders]);
3899
3197
  return /* @__PURE__ */ jsx(
3900
- Content$1,
3198
+ Content,
3901
3199
  {
3902
3200
  ref: setContentRef,
3903
3201
  onScroll: handleScroll,
@@ -4196,159 +3494,6 @@ function DialogStepper({
4196
3494
  );
4197
3495
  }) }) });
4198
3496
  }
4199
- const Content = styled(DialogContent, {
4200
- shouldForwardProp: (prop) => !["error", "withBorder"].includes(prop)
4201
- })(
4202
- ({ error, withBorder, theme }) => ({
4203
- gap: 0,
4204
- border: withBorder ? `1px solid ${theme.palette.divider} !important` : void 0,
4205
- borderBottom: error ? "none !important" : void 0,
4206
- ".react-codemirror2": {
4207
- display: "flex",
4208
- flexDirection: "column",
4209
- minHeight: "100%"
4210
- },
4211
- ".CodeMirror-wrap": {
4212
- display: "flex",
4213
- flexDirection: "column",
4214
- flex: 1
4215
- },
4216
- "& + .MuiDivider-root": {
4217
- display: "none"
4218
- }
4219
- })
4220
- );
4221
- function CodeAreaDialogContent({
4222
- children,
4223
- error,
4224
- withBorder = true,
4225
- withGutter = false
4226
- }) {
4227
- if (!children) return null;
4228
- return /* @__PURE__ */ jsx(Content, { withGutter, error, withBorder, children });
4229
- }
4230
- function CodeAreaDialogConfirmation({
4231
- onClose,
4232
- onCancel,
4233
- cancelLabelId,
4234
- cancelButton,
4235
- closeButton,
4236
- contentLabelId,
4237
- titleLabelId,
4238
- severity = "warning",
4239
- content
4240
- }) {
4241
- const intl = useIntl();
4242
- const intlConfig = useImperativeIntl(intl);
4243
- if (!onClose || !onCancel) {
4244
- return null;
4245
- }
4246
- return /* @__PURE__ */ jsx(
4247
- DialogConfirmation,
4248
- {
4249
- opened: true,
4250
- severity,
4251
- title: intlConfig.formatMessage({
4252
- id: titleLabelId || "c4r.dialog.confirmation.title"
4253
- }),
4254
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
4255
- onCancel && (cancelButton ? cancelButton : /* @__PURE__ */ jsx(Button, { onClick: onCancel, children: intlConfig.formatMessage({
4256
- id: cancelLabelId || "c4r.button.cancel"
4257
- }) })),
4258
- onClose && (closeButton ? closeButton : /* @__PURE__ */ jsx(Button, { variant: "contained", onClick: onClose, children: intlConfig.formatMessage({
4259
- id: "c4r.button.leave"
4260
- }) }))
4261
- ] }),
4262
- children: content ? content : intlConfig.formatMessage({
4263
- id: contentLabelId || "c4r.dialog.confirmation.content"
4264
- })
4265
- }
4266
- );
4267
- }
4268
- function CodeAreaDialog({
4269
- open,
4270
- onClose,
4271
- title,
4272
- error,
4273
- helperText,
4274
- onClickFooter,
4275
- disabledButtonFooter,
4276
- labelIdButtonFooter,
4277
- disabled,
4278
- showConfirmation,
4279
- onCancelConfirm,
4280
- onCloseConfirm,
4281
- footerProps,
4282
- saveLoading,
4283
- showSaveSnackbar,
4284
- onCloseSaveSnackbar,
4285
- "data-testid": dataTestId,
4286
- "aria-label": ariaLabel,
4287
- ...props
4288
- }) {
4289
- const showFooter = error || !!onClickFooter || !!footerProps;
4290
- if (!open) return null;
4291
- return /* @__PURE__ */ jsxs(
4292
- Dialog,
4293
- {
4294
- open,
4295
- fullScreen: true,
4296
- onClose,
4297
- "data-testid": dataTestId,
4298
- "aria-label": ariaLabel,
4299
- "data-name": "code-area-dialog",
4300
- children: [
4301
- /* @__PURE__ */ jsx(
4302
- DialogHeader,
4303
- {
4304
- title,
4305
- onClose,
4306
- closeIcon: !onClickFooter && /* @__PURE__ */ jsx(CloseDiagonallyRight, {})
4307
- }
4308
- ),
4309
- /* @__PURE__ */ jsx(CodeAreaDialogContent, { error, children: /* @__PURE__ */ jsx(
4310
- CodeAreaField,
4311
- {
4312
- ...props,
4313
- disabled,
4314
- variant: null,
4315
- isExpanded: true
4316
- }
4317
- ) }),
4318
- showFooter && /* @__PURE__ */ jsx(
4319
- DialogFooter,
4320
- {
4321
- ...footerProps,
4322
- topContent: error && /* @__PURE__ */ jsx(CodeAreaDialogError, { hasDivider: !!onClickFooter, children: helperText }),
4323
- children: !!onClickFooter && /* @__PURE__ */ jsx(
4324
- CodeAreaFooter,
4325
- {
4326
- onClickFooter,
4327
- labelIdButtonFooter,
4328
- disabled,
4329
- disabledButtonFooter,
4330
- withGutter: false,
4331
- variant: "contained",
4332
- size: "medium",
4333
- loading: !!saveLoading,
4334
- showSnackbar: showSaveSnackbar,
4335
- onCloseSnackbar: onCloseSaveSnackbar
4336
- }
4337
- )
4338
- }
4339
- ),
4340
- showConfirmation && /* @__PURE__ */ jsx(
4341
- CodeAreaDialogConfirmation,
4342
- {
4343
- onClose: onCloseConfirm ?? onClose,
4344
- onCancel: onCancelConfirm,
4345
- cancelLabelId: "c4r.button.keepEditing"
4346
- }
4347
- )
4348
- ]
4349
- }
4350
- );
4351
- }
4352
3497
  export {
4353
3498
  AccordionGroup,
4354
3499
  Alert$1 as Alert,
@@ -4356,14 +3501,6 @@ export {
4356
3501
  Autocomplete,
4357
3502
  Avatar,
4358
3503
  Button,
4359
- CodeAreaDialog,
4360
- CodeAreaDialogConfirmation,
4361
- CodeAreaDialogContent,
4362
- CodeAreaDialogError,
4363
- CodeAreaField,
4364
- CodeAreaFooter,
4365
- CodeAreaHeader,
4366
- CodeAreaInput,
4367
3504
  CopiableComponent,
4368
3505
  CreatableAutocomplete,
4369
3506
  DatePicker,
@@ -4391,6 +3528,7 @@ export {
4391
3528
  SelectField,
4392
3529
  Snackbar,
4393
3530
  a as TablePaginationActions,
3531
+ Tag,
4394
3532
  TimePicker,
4395
3533
  ToggleButtonGroup,
4396
3534
  TooltipData,