@carto/meridian-ds 2.10.2 → 2.11.1-multipleselectfield-custom.0

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 (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{ListItem-BUH1WVMn.js → ListItem-Ce-ui7dI.js} +1 -1
  3. package/dist/{ListItem-CzAfw3KD.cjs → ListItem-DQ9_zkrB.cjs} +1 -1
  4. package/dist/components/index.cjs +502 -17
  5. package/dist/components/index.js +508 -23
  6. package/dist/{palette-utils-MuFJ3gQ2.js → palette-utils-BMEVUZ5G.js} +9 -0
  7. package/dist/{palette-utils-AE0NwrEo.cjs → palette-utils-BsfMFfME.cjs} +9 -0
  8. package/dist/theme/index.cjs +2 -2
  9. package/dist/theme/index.js +3 -3
  10. package/dist/types/components/AccordionGroup/AccordionGroup.d.ts +2 -0
  11. package/dist/types/components/AccordionGroup/AccordionGroup.d.ts.map +1 -1
  12. package/dist/types/components/AccordionGroup/AccordionGroup.stories.d.ts +20 -0
  13. package/dist/types/components/AccordionGroup/AccordionGroup.stories.d.ts.map +1 -1
  14. package/dist/types/components/ChipGroup/ChipGroup.d.ts +4 -0
  15. package/dist/types/components/ChipGroup/ChipGroup.d.ts.map +1 -0
  16. package/dist/types/components/ChipGroup/ChipGroup.stories.d.ts +140 -0
  17. package/dist/types/components/ChipGroup/ChipGroup.stories.d.ts.map +1 -0
  18. package/dist/types/components/ChipGroup/ChipGroup.test.d.ts +2 -0
  19. package/dist/types/components/ChipGroup/ChipGroup.test.d.ts.map +1 -0
  20. package/dist/types/components/ChipGroup/ChipGroupItem.d.ts +19 -0
  21. package/dist/types/components/ChipGroup/ChipGroupItem.d.ts.map +1 -0
  22. package/dist/types/components/ChipGroup/index.d.ts +3 -0
  23. package/dist/types/components/ChipGroup/index.d.ts.map +1 -0
  24. package/dist/types/components/ChipGroup/types.d.ts +57 -0
  25. package/dist/types/components/ChipGroup/types.d.ts.map +1 -0
  26. package/dist/types/components/LabelWithIndicator/LabelWithIndicator.stories.d.ts.map +1 -1
  27. package/dist/types/components/MessageField/MessageField.d.ts +4 -0
  28. package/dist/types/components/MessageField/MessageField.d.ts.map +1 -0
  29. package/dist/types/components/MessageField/MessageField.stories.d.ts +146 -0
  30. package/dist/types/components/MessageField/MessageField.stories.d.ts.map +1 -0
  31. package/dist/types/components/MessageField/MessageField.styled.d.ts +28 -0
  32. package/dist/types/components/MessageField/MessageField.styled.d.ts.map +1 -0
  33. package/dist/types/components/MessageField/MessageField.test.d.ts +2 -0
  34. package/dist/types/components/MessageField/MessageField.test.d.ts.map +1 -0
  35. package/dist/types/components/MessageField/components/MessageFieldFooter.d.ts +8 -0
  36. package/dist/types/components/MessageField/components/MessageFieldFooter.d.ts.map +1 -0
  37. package/dist/types/components/MessageField/index.d.ts +3 -0
  38. package/dist/types/components/MessageField/index.d.ts.map +1 -0
  39. package/dist/types/components/MessageField/types.d.ts +91 -0
  40. package/dist/types/components/MessageField/types.d.ts.map +1 -0
  41. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts +5 -2
  42. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
  43. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts +13 -1
  44. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts.map +1 -1
  45. package/dist/types/components/SelectField/types.d.ts +8 -2
  46. package/dist/types/components/SelectField/types.d.ts.map +1 -1
  47. package/dist/types/components/index.d.ts +4 -0
  48. package/dist/types/components/index.d.ts.map +1 -1
  49. package/dist/types/localization/en.d.ts +3 -0
  50. package/dist/types/localization/en.d.ts.map +1 -1
  51. package/dist/types/localization/es.d.ts +3 -0
  52. package/dist/types/localization/es.d.ts.map +1 -1
  53. package/dist/types/localization/id.d.ts +3 -0
  54. package/dist/types/localization/id.d.ts.map +1 -1
  55. package/dist/types/localization/index.d.ts +9 -0
  56. package/dist/types/localization/index.d.ts.map +1 -1
  57. package/dist/{utils-dwDSNbwq.cjs → utils-BndCEhGs.cjs} +1 -1
  58. package/dist/{utils-B-IEyPJ0.js → utils-DYO_K3Z4.js} +1 -1
  59. package/dist/widgets/index.cjs +2 -2
  60. package/dist/widgets/index.js +2 -2
  61. package/package.json +4 -3
@@ -1,15 +1,15 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
3
- import { styled, Box, Button as Button$1, CircularProgress as CircularProgress$1, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, Select, FormControl, InputLabel, FormHelperText, Link, Checkbox, IconButton as IconButton$1, ListItemText as ListItemText$1, Tooltip, ToggleButtonGroup as ToggleButtonGroup$1, Stack, Autocomplete as Autocomplete$1, Divider, ListItemIcon as ListItemIcon$1, createFilterOptions, alpha, useTheme, AppBar as AppBar$1, Toolbar, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip, DialogContent as DialogContent$1, DialogActions as DialogActions$1, Slide, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Menu as Menu$2, useMediaQuery, Snackbar as Snackbar$1, Portal, Fade, ListSubheader as ListSubheader$1, Typography as Typography$1 } from "@mui/material";
3
+ import { styled, Box, Button as Button$1, CircularProgress as CircularProgress$1, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, Select, FormControl, InputLabel, FormHelperText, Link, Checkbox, IconButton as IconButton$1, ListItemText as ListItemText$1, Tooltip, ToggleButtonGroup as ToggleButtonGroup$1, Stack, Autocomplete as Autocomplete$1, Divider, ListItemIcon as ListItemIcon$1, createFilterOptions, alpha, useTheme, AppBar as AppBar$1, Toolbar as Toolbar$1, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip as Chip$1, DialogContent as DialogContent$1, DialogActions as DialogActions$1, Slide, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Menu as Menu$2, useMediaQuery, Snackbar as Snackbar$1, Portal, Fade, ListSubheader as ListSubheader$1, Typography as Typography$1, Popover } from "@mui/material";
4
4
  import { ListItemAvatar, ListItemSecondaryAction } from "@mui/material";
5
- import { OpenInNewOutlined, VisibilityOffOutlined, VisibilityOutlined, Cancel, ContentCopyOutlined, AddCircleOutlineOutlined, MenuOutlined, MoreVertOutlined, HelpOutline, ErrorOutline, CloseOutlined, Check, TodayOutlined } from "@mui/icons-material";
6
- import { u as useTranslationWithFallback, T as Typography, c as ICON_SIZE_SMALL, o as IconButton, f as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, l as MENU_ITEM_SIZE_EXTENDED, M as MENU_ITEM_SIZE_DEFAULT, A as APPBAR_SIZE, p as useImperativeIntl, b as ICON_SIZE_MEDIUM, N as NOTIFICATION_DURATION_IN_MS, e as ellipsisStyles, r as resolvePalettePath } from "../palette-utils-MuFJ3gQ2.js";
7
- import { a } from "../palette-utils-MuFJ3gQ2.js";
8
- import { S as ScreenReaderOnly, A as Alert$1, u as useListContextProps } from "../ListItem-BUH1WVMn.js";
9
- import { L, a as a2, b, c, d } from "../ListItem-BUH1WVMn.js";
5
+ import { OpenInNewOutlined, VisibilityOffOutlined, VisibilityOutlined, Cancel, ContentCopyOutlined, AddCircleOutlineOutlined, MenuOutlined, MoreVertOutlined, HelpOutline, ErrorOutline, CloseOutlined, Check, TodayOutlined, StopCircleOutlined, ArrowUpwardOutlined } from "@mui/icons-material";
6
+ import { u as useTranslationWithFallback, T as Typography, c as ICON_SIZE_SMALL, o as IconButton, f as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, l as MENU_ITEM_SIZE_EXTENDED, M as MENU_ITEM_SIZE_DEFAULT, A as APPBAR_SIZE, p as useImperativeIntl, b as ICON_SIZE_MEDIUM, N as NOTIFICATION_DURATION_IN_MS, e as ellipsisStyles, r as resolvePalettePath } from "../palette-utils-BMEVUZ5G.js";
7
+ import { a } from "../palette-utils-BMEVUZ5G.js";
8
+ import { S as ScreenReaderOnly, A as Alert$1, u as useListContextProps } from "../ListItem-Ce-ui7dI.js";
9
+ import { L, a as a2, b, c, d } from "../ListItem-Ce-ui7dI.js";
10
10
  import { F as ForwardedComponent$1 } from "../ArrowDown-Bho9Ssnw.js";
11
11
  import { F as ForwardedComponent, b as ForwardedComponent$2, a as ForwardedComponent$3 } from "../OpenDiagonallyRight-DQEM4RAg.js";
12
- import { M as MenuItem$1, b as getThemeColor, S as SVG_SELECTOR } from "../utils-B-IEyPJ0.js";
12
+ import { M as MenuItem$1, b as getThemeColor, S as SVG_SELECTOR } from "../utils-DYO_K3Z4.js";
13
13
  import "cartocolor";
14
14
  import * as ReactWindow from "react-window";
15
15
  import { Controlled, UnControlled } from "react-codemirror2";
@@ -622,6 +622,7 @@ function _MultipleSelectField({
622
622
  noneSelectedText,
623
623
  selectedText,
624
624
  selectAllText,
625
+ renderItemLabel,
625
626
  ...props
626
627
  }, ref) {
627
628
  const {
@@ -755,7 +756,7 @@ function _MultipleSelectField({
755
756
  checked: currentOptions.includes(option.value)
756
757
  }
757
758
  ),
758
- /* @__PURE__ */ jsx(ListItemText$1, { primary: option.label })
759
+ renderItemLabel ? renderItemLabel(option) : /* @__PURE__ */ jsx(ListItemText$1, { primary: option.label })
759
760
  ]
760
761
  },
761
762
  option.value
@@ -1951,7 +1952,7 @@ const BrandElements = styled("div")(({ theme }) => ({
1951
1952
  minWidth: "192px"
1952
1953
  }
1953
1954
  }));
1954
- const Content$5 = styled("div")(({ theme }) => ({
1955
+ const Content$6 = styled("div")(({ theme }) => ({
1955
1956
  display: "flex",
1956
1957
  alignItems: "center",
1957
1958
  justifyContent: "space-between",
@@ -1967,14 +1968,14 @@ function _AppBar({
1967
1968
  onClickMenu,
1968
1969
  ...otherProps
1969
1970
  }, ref) {
1970
- return /* @__PURE__ */ jsx(Root$6, { ...otherProps, ref, "data-name": "app-bar", children: /* @__PURE__ */ jsxs(Toolbar, { children: [
1971
+ return /* @__PURE__ */ jsx(Root$6, { ...otherProps, ref, "data-name": "app-bar", children: /* @__PURE__ */ jsxs(Toolbar$1, { children: [
1971
1972
  /* @__PURE__ */ jsxs(BrandElements, { children: [
1972
1973
  showBurgerMenu && /* @__PURE__ */ jsx(BurgerMenu, { onClickMenu }),
1973
1974
  brandLogo && /* @__PURE__ */ jsx(BrandLogo, { logo: brandLogo }),
1974
1975
  brandText && /* @__PURE__ */ jsx(BrandText, { text: brandText }),
1975
1976
  secondaryText && /* @__PURE__ */ jsx(SecondaryText, { text: secondaryText })
1976
1977
  ] }),
1977
- /* @__PURE__ */ jsx(Content$5, { children })
1978
+ /* @__PURE__ */ jsx(Content$6, { children })
1978
1979
  ] }) });
1979
1980
  }
1980
1981
  const AppBar = forwardRef(_AppBar);
@@ -2053,7 +2054,7 @@ function CodeAreaFooter({
2053
2054
  }
2054
2055
  );
2055
2056
  }
2056
- const Header = styled(Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2057
+ const Header$1 = styled(Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2057
2058
  position: "absolute",
2058
2059
  top: 0,
2059
2060
  right: theme.spacing(0.5),
@@ -2113,7 +2114,7 @@ function CodeAreaHeader({
2113
2114
  }
2114
2115
  if (showMenu) {
2115
2116
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2116
- /* @__PURE__ */ jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2117
+ /* @__PURE__ */ jsxs(Header$1, { size, "data-size": size, "data-name": "code-area-header", children: [
2117
2118
  /* @__PURE__ */ jsx(
2118
2119
  IconButton,
2119
2120
  {
@@ -2166,7 +2167,7 @@ function CodeAreaHeader({
2166
2167
  )
2167
2168
  ] });
2168
2169
  }
2169
- return /* @__PURE__ */ jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2170
+ return /* @__PURE__ */ jsxs(Header$1, { size, "data-size": size, "data-name": "code-area-header", children: [
2170
2171
  showCopyButton && /* @__PURE__ */ jsx(
2171
2172
  CopiableComponent,
2172
2173
  {
@@ -2787,7 +2788,7 @@ const CodeMirrorWrapper = styled(Box, {
2787
2788
  }
2788
2789
  })
2789
2790
  );
2790
- const InputWrapper = styled(Box, {
2791
+ const InputWrapper$1 = styled(Box, {
2791
2792
  shouldForwardProp: (prop) => prop !== "hasActions"
2792
2793
  })(({ theme, hasActions }) => ({
2793
2794
  flex: "1 1 auto",
@@ -2893,7 +2894,7 @@ function CodeAreaField({
2893
2894
  size: isExpanded ? "medium" : "small"
2894
2895
  }
2895
2896
  ),
2896
- /* @__PURE__ */ jsx(InputWrapper, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsx(
2897
+ /* @__PURE__ */ jsx(InputWrapper$1, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsx(
2897
2898
  CodeAreaInput,
2898
2899
  {
2899
2900
  ...props,
@@ -3259,7 +3260,7 @@ function DialogHeader({
3259
3260
  children: title
3260
3261
  }
3261
3262
  ),
3262
- chipLabel && /* @__PURE__ */ jsx(Chip, { color: "default", label: chipLabel, ...chipProps })
3263
+ chipLabel && /* @__PURE__ */ jsx(Chip$1, { color: "default", label: chipLabel, ...chipProps })
3263
3264
  ] }),
3264
3265
  /* @__PURE__ */ jsxs(ItemsWrapper$1, { children: [
3265
3266
  secondaryActions,
@@ -3279,7 +3280,7 @@ function DialogHeader({
3279
3280
  children && /* @__PURE__ */ jsx(DividerBottom, {})
3280
3281
  ] });
3281
3282
  }
3282
- const Content$4 = styled(DialogContent$1, {
3283
+ const Content$5 = styled(DialogContent$1, {
3283
3284
  shouldForwardProp: (prop) => ![
3284
3285
  "scrollableContent",
3285
3286
  "withGutter",
@@ -3370,7 +3371,7 @@ function _DialogContent({
3370
3371
  return () => resizeObserver.disconnect();
3371
3372
  }, [contentRef, updateBorders]);
3372
3373
  return /* @__PURE__ */ jsx(
3373
- Content$4,
3374
+ Content$5,
3374
3375
  {
3375
3376
  ref: setContentRef,
3376
3377
  onScroll: handleScroll,
@@ -3677,7 +3678,7 @@ function DialogStepper({
3677
3678
  );
3678
3679
  }) }) });
3679
3680
  }
3680
- const Content$3 = styled(DialogContent, {
3681
+ const Content$4 = styled(DialogContent, {
3681
3682
  shouldForwardProp: (prop) => !["error", "withBorder"].includes(prop)
3682
3683
  })(
3683
3684
  ({ error, withBorder, theme }) => ({
@@ -3706,7 +3707,7 @@ function CodeAreaDialogContent({
3706
3707
  withGutter = false
3707
3708
  }) {
3708
3709
  if (!children) return null;
3709
- return /* @__PURE__ */ jsx(Content$3, { withGutter, error, withBorder, children });
3710
+ return /* @__PURE__ */ jsx(Content$4, { withGutter, error, withBorder, children });
3710
3711
  }
3711
3712
  function CodeAreaDialogConfirmation({
3712
3713
  onClose,
@@ -4786,7 +4787,7 @@ function _EmptyState({
4786
4787
  }
4787
4788
  const EmptyState = forwardRef(_EmptyState);
4788
4789
  const DEFAULT_ITEMS = [{ outlinedBullet: false, value: "" }];
4789
- const Content$2 = styled("ul")(({ theme }) => ({
4790
+ const Content$3 = styled("ul")(({ theme }) => ({
4790
4791
  listStyle: "none",
4791
4792
  paddingLeft: 0,
4792
4793
  margin: theme.spacing(0.5, 0, 0, 0)
@@ -4817,7 +4818,7 @@ function TooltipData({
4817
4818
  }) {
4818
4819
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4819
4820
  title && /* @__PURE__ */ jsx(Typography, { color: "inherit", variant: "caption", weight: "medium", children: title }),
4820
- /* @__PURE__ */ jsx(Content$2, { children: items.map((item, index) => /* @__PURE__ */ jsxs(Entry, { children: [
4821
+ /* @__PURE__ */ jsx(Content$3, { children: items.map((item, index) => /* @__PURE__ */ jsxs(Entry, { children: [
4821
4822
  /* @__PURE__ */ jsx(
4822
4823
  Bullet,
4823
4824
  {
@@ -4867,6 +4868,7 @@ function _AccordionGroup({
4867
4868
  disabled: item.disabled,
4868
4869
  defaultExpanded: item.defaultExpanded,
4869
4870
  onChange: item.onChange,
4871
+ sx: item.sx,
4870
4872
  children: [
4871
4873
  /* @__PURE__ */ jsx(
4872
4874
  AccordionSummary,
@@ -5203,6 +5205,296 @@ function _FilterDropdown({
5203
5205
  const FilterDropdown = forwardRef(
5204
5206
  _FilterDropdown
5205
5207
  );
5208
+ const Header = styled(Box)(({ theme }) => ({
5209
+ display: "flex",
5210
+ alignItems: "center",
5211
+ flexWrap: "wrap",
5212
+ gap: theme.spacing(0.5),
5213
+ padding: theme.spacing(0.5)
5214
+ }));
5215
+ const Content$2 = styled(Box, {
5216
+ shouldForwardProp: (prop) => !["hasToolbar"].includes(prop)
5217
+ })(({ hasToolbar }) => ({
5218
+ display: "flex",
5219
+ alignItems: "flex-end",
5220
+ ...hasToolbar && {
5221
+ display: "block"
5222
+ }
5223
+ }));
5224
+ const TextFieldBase = styled(TextField)(({ theme }) => ({
5225
+ "& .MuiInputBase-root": {
5226
+ minHeight: "auto !important",
5227
+ "&:before": {
5228
+ border: `none !important`,
5229
+ "&:hover": {
5230
+ border: `none !important`
5231
+ }
5232
+ },
5233
+ "& textarea": {
5234
+ maxHeight: theme.spacing(32),
5235
+ // 256px, defined in the design specs
5236
+ overflowY: "auto !important",
5237
+ boxSizing: "border-box"
5238
+ },
5239
+ // Sizes
5240
+ "&.MuiInputBase-multiline.MuiInputBase-sizeSmall textarea": {
5241
+ padding: theme.spacing(0.75, 1.25)
5242
+ }
5243
+ },
5244
+ // Variant's overrides
5245
+ "& .MuiFilledInput-root": {
5246
+ backgroundColor: "transparent !important"
5247
+ },
5248
+ "& .MuiOutlinedInput-root": {
5249
+ backgroundColor: "transparent !important",
5250
+ "& .MuiOutlinedInput-notchedOutline": {
5251
+ border: "none !important"
5252
+ }
5253
+ }
5254
+ }));
5255
+ const InputWrapper = styled(Box, {
5256
+ shouldForwardProp: (prop) => !["variant", "disabled", "error"].includes(prop)
5257
+ })(({ theme, variant, disabled, error }) => ({
5258
+ borderRadius: theme.spacing(0.5),
5259
+ transition: theme.transitions.create(["background-color", "box-shadow"], {
5260
+ easing: theme.transitions.easing.easeInOut,
5261
+ duration: theme.transitions.duration.shortest
5262
+ }),
5263
+ // States
5264
+ ...error && {
5265
+ boxShadow: `0 0 0 2px inset ${theme.palette.error.light}`
5266
+ },
5267
+ // Variants
5268
+ ...variant === "filled" && {
5269
+ backgroundColor: theme.palette.default.background,
5270
+ "&:hover": {
5271
+ backgroundColor: !disabled && theme.palette.action.hover
5272
+ },
5273
+ "&:focus-within": {
5274
+ backgroundColor: theme.palette.default.background
5275
+ }
5276
+ },
5277
+ ...variant === "outlined" && {
5278
+ boxShadow: `0 0 0 1px inset ${theme.palette.default.outlinedBorder}`
5279
+ // TBD when we need to support outlined variant
5280
+ }
5281
+ }));
5282
+ const FooterWrapper = styled(Box, {
5283
+ shouldForwardProp: (prop) => !["size"].includes(prop)
5284
+ })(({ theme, size }) => ({
5285
+ display: "flex",
5286
+ alignItems: "center",
5287
+ justifyContent: "space-between",
5288
+ gap: theme.spacing(0.5),
5289
+ padding: theme.spacing(size === "small" ? 0.5 : 1)
5290
+ }));
5291
+ const Toolbar = styled(Box)(({ theme }) => ({
5292
+ display: "flex",
5293
+ alignItems: "center",
5294
+ gap: theme.spacing(0.5),
5295
+ // Reset margin
5296
+ "& .MuiButtonBase-root, & .optionIconButton": {
5297
+ marginLeft: 0
5298
+ }
5299
+ }));
5300
+ const MessageFieldFooter = ({
5301
+ size,
5302
+ toolbar,
5303
+ analyzing,
5304
+ onStop,
5305
+ stopLabel,
5306
+ iconButton,
5307
+ labelButton,
5308
+ onClick,
5309
+ buttonIsDisabled,
5310
+ disabled,
5311
+ typeToSendLabel,
5312
+ sendLabel
5313
+ }) => {
5314
+ const stopAriaLabel = typeof stopLabel === "string" ? stopLabel : void 0;
5315
+ const sendButtonLabel = buttonIsDisabled ? typeToSendLabel : sendLabel;
5316
+ const sendAriaLabel = typeof sendButtonLabel === "string" ? sendButtonLabel : void 0;
5317
+ return /* @__PURE__ */ jsxs(FooterWrapper, { size, children: [
5318
+ toolbar && /* @__PURE__ */ jsx(Toolbar, { children: toolbar }),
5319
+ /* @__PURE__ */ jsx(Fragment, { children: analyzing ? /* @__PURE__ */ jsx(
5320
+ IconButton,
5321
+ {
5322
+ onClick: onStop,
5323
+ color: "default",
5324
+ size,
5325
+ icon: /* @__PURE__ */ jsx(StopCircleOutlined, {}),
5326
+ tooltip: stopLabel,
5327
+ "aria-label": stopAriaLabel,
5328
+ tooltipPlacement: "top"
5329
+ }
5330
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
5331
+ iconButton && !labelButton && /* @__PURE__ */ jsx(
5332
+ IconButton,
5333
+ {
5334
+ onClick,
5335
+ disabled: buttonIsDisabled,
5336
+ color: "primary",
5337
+ variant: "contained",
5338
+ size,
5339
+ icon: iconButton,
5340
+ tooltip: !disabled ? sendButtonLabel : void 0,
5341
+ "aria-label": sendAriaLabel,
5342
+ tooltipPlacement: "top"
5343
+ }
5344
+ ),
5345
+ labelButton && /* @__PURE__ */ jsx(
5346
+ Tooltip,
5347
+ {
5348
+ title: buttonIsDisabled && !disabled ? typeToSendLabel : void 0,
5349
+ children: /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(
5350
+ Button,
5351
+ {
5352
+ onClick,
5353
+ variant: "contained",
5354
+ color: "primary",
5355
+ disabled: buttonIsDisabled,
5356
+ size,
5357
+ children: labelButton
5358
+ }
5359
+ ) })
5360
+ }
5361
+ )
5362
+ ] }) })
5363
+ ] });
5364
+ };
5365
+ function _MessageField({
5366
+ value,
5367
+ defaultValue,
5368
+ label,
5369
+ onChange,
5370
+ onClick,
5371
+ onStop,
5372
+ disabled,
5373
+ variant = "filled",
5374
+ size = "small",
5375
+ analyzing,
5376
+ iconButton = /* @__PURE__ */ jsx(ArrowUpwardOutlined, {}),
5377
+ labelButton,
5378
+ disabledButton,
5379
+ helperText,
5380
+ error,
5381
+ fullWidth = true,
5382
+ validationType,
5383
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5384
+ focused: _focused,
5385
+ onKeyDown,
5386
+ textFieldProps,
5387
+ toolbar,
5388
+ header,
5389
+ stopText,
5390
+ typeToSendText,
5391
+ sendText,
5392
+ "data-testid": dataTestId,
5393
+ "aria-label": ariaLabel,
5394
+ ...otherProps
5395
+ }, ref) {
5396
+ const stopLabel = useTranslationWithFallback("c4r.button.stop", stopText);
5397
+ const typeToSendLabel = useTranslationWithFallback(
5398
+ "c4r.button.typeToSend",
5399
+ typeToSendText
5400
+ );
5401
+ const sendLabel = useTranslationWithFallback("c4r.button.send", sendText);
5402
+ const inputIsDisabled = disabled || analyzing;
5403
+ const currentValue = value ?? defaultValue ?? "";
5404
+ const buttonIsDisabled = currentValue === "" || disabledButton || disabled;
5405
+ const handleKeyDown = (e) => {
5406
+ if (e.key === "Enter") {
5407
+ if (e.ctrlKey || e.shiftKey) {
5408
+ e.preventDefault();
5409
+ const textarea = e.target;
5410
+ const cursorPosition = e.target.selectionStart;
5411
+ const textValue = textarea.value;
5412
+ const newValue = textValue.slice(0, cursorPosition) + "\n" + textValue.slice(cursorPosition);
5413
+ const onChangeHandler = (textFieldProps == null ? void 0 : textFieldProps.onChange) || onChange;
5414
+ if (onChangeHandler) {
5415
+ const newEvent = {
5416
+ ...e,
5417
+ target: {
5418
+ ...e.target,
5419
+ value: newValue
5420
+ }
5421
+ };
5422
+ onChangeHandler(newEvent);
5423
+ } else {
5424
+ textarea.value = newValue;
5425
+ }
5426
+ requestAnimationFrame(() => {
5427
+ textarea.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
5428
+ });
5429
+ } else {
5430
+ e.preventDefault();
5431
+ onClick(e);
5432
+ }
5433
+ }
5434
+ const onKeyDownHandler = (textFieldProps == null ? void 0 : textFieldProps.onKeyDown) || onKeyDown;
5435
+ onKeyDownHandler == null ? void 0 : onKeyDownHandler(e);
5436
+ };
5437
+ return /* @__PURE__ */ jsxs(
5438
+ FormControl,
5439
+ {
5440
+ ref,
5441
+ fullWidth,
5442
+ size,
5443
+ error,
5444
+ disabled: inputIsDisabled,
5445
+ role: "group",
5446
+ "data-name": "message-field",
5447
+ "data-testid": dataTestId,
5448
+ "aria-label": ariaLabel,
5449
+ children: [
5450
+ label && /* @__PURE__ */ jsx(InputLabel, { shrink: true, children: /* @__PURE__ */ jsx(LabelWithIndicator, { label, type: validationType }) }),
5451
+ /* @__PURE__ */ jsxs(InputWrapper, { variant, disabled: inputIsDisabled, error, children: [
5452
+ header && /* @__PURE__ */ jsx(Header, { children: header }),
5453
+ /* @__PURE__ */ jsxs(Content$2, { hasToolbar: !!toolbar, children: [
5454
+ /* @__PURE__ */ jsx(
5455
+ TextFieldBase,
5456
+ {
5457
+ multiline: true,
5458
+ ...value !== void 0 ? { value } : { defaultValue },
5459
+ onChange,
5460
+ focused: false,
5461
+ disabled: inputIsDisabled,
5462
+ variant,
5463
+ size,
5464
+ fullWidth,
5465
+ required: validationType === "required",
5466
+ inputProps: { "aria-invalid": !!error },
5467
+ ...otherProps,
5468
+ ...textFieldProps,
5469
+ onKeyDown: handleKeyDown
5470
+ }
5471
+ ),
5472
+ /* @__PURE__ */ jsx(
5473
+ MessageFieldFooter,
5474
+ {
5475
+ size,
5476
+ toolbar,
5477
+ analyzing,
5478
+ onStop,
5479
+ stopLabel,
5480
+ iconButton,
5481
+ labelButton,
5482
+ onClick,
5483
+ buttonIsDisabled,
5484
+ disabled,
5485
+ typeToSendLabel,
5486
+ sendLabel
5487
+ }
5488
+ )
5489
+ ] })
5490
+ ] }),
5491
+ helperText && /* @__PURE__ */ jsx(FormHelperText, { children: helperText })
5492
+ ]
5493
+ }
5494
+ );
5495
+ }
5496
+ const MessageField = forwardRef(_MessageField);
5497
+ MessageField.displayName = "MessageField";
5206
5498
  const SearchIcon = styled(ForwardedComponent$4, {
5207
5499
  shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
5208
5500
  })(
@@ -6431,6 +6723,197 @@ function _ListItemIcon({ iconProps, sx, ...otherProps }, ref) {
6431
6723
  }
6432
6724
  const ListItemIcon = forwardRef(_ListItemIcon);
6433
6725
  ListItemIcon.displayName = "ListItemIcon";
6726
+ const Chip = styled(Chip$1)(() => ({
6727
+ maxWidth: "100%"
6728
+ }));
6729
+ function _ChipGroupItem({
6730
+ chipData,
6731
+ index,
6732
+ displayLabel,
6733
+ showTooltip = false,
6734
+ disabled,
6735
+ onClick,
6736
+ onDelete,
6737
+ ...restProps
6738
+ }, ref) {
6739
+ const uniqueId2 = `chip-${index}`;
6740
+ const isDisabled = chipData.disabled ?? disabled;
6741
+ const chipElement = /* @__PURE__ */ jsx(
6742
+ Chip,
6743
+ {
6744
+ ...restProps,
6745
+ ref,
6746
+ label: /* @__PURE__ */ jsx(
6747
+ Typography,
6748
+ {
6749
+ component: "p",
6750
+ variant: "inherit",
6751
+ color: "inherit",
6752
+ noWrap: true,
6753
+ id: uniqueId2,
6754
+ children: displayLabel
6755
+ }
6756
+ ),
6757
+ variant: chipData.variant ?? "outlined",
6758
+ color: chipData.color ?? "default",
6759
+ size: chipData.size ?? "small",
6760
+ disabled: isDisabled,
6761
+ avatar: chipData.avatar,
6762
+ icon: chipData.icon,
6763
+ deleteIcon: chipData.deleteIcon,
6764
+ onClick,
6765
+ onDelete,
6766
+ "aria-disabled": isDisabled,
6767
+ "aria-labelledby": uniqueId2,
6768
+ "data-truncated": showTooltip
6769
+ }
6770
+ );
6771
+ if (!showTooltip && !chipData.tooltip) {
6772
+ return chipElement;
6773
+ }
6774
+ return /* @__PURE__ */ jsx(Tooltip, { title: chipData.tooltip || chipData.label, children: chipElement });
6775
+ }
6776
+ const ChipGroupItem = forwardRef(_ChipGroupItem);
6777
+ ChipGroupItem.displayName = "ChipGroupItem";
6778
+ const PopoverMenu = styled(Popover)(({ theme }) => ({
6779
+ ".MuiPaper-root": {
6780
+ pointerEvents: "all",
6781
+ padding: theme.spacing(1),
6782
+ marginTop: 0,
6783
+ marginLeft: theme.spacing(0.5)
6784
+ }
6785
+ }));
6786
+ function _ChipGroup({
6787
+ chips,
6788
+ disabled,
6789
+ maxVisibleChips = 3,
6790
+ maxLengthChip = 30,
6791
+ onClickAllChips,
6792
+ onDeleteAllChips,
6793
+ ...rootProps
6794
+ }, ref) {
6795
+ const [openedRef, setOpen] = useState(null);
6796
+ const localRef = useRef(null);
6797
+ const hasChips = Boolean(chips == null ? void 0 : chips.length);
6798
+ const normalizedChips = (chips == null ? void 0 : chips.map((chip) => {
6799
+ if (typeof chip === "string") {
6800
+ return { label: chip };
6801
+ }
6802
+ return chip;
6803
+ })) || [];
6804
+ const chipsToShow = normalizedChips.slice(0, maxVisibleChips);
6805
+ const additionalChips = Math.max(0, normalizedChips.length - maxVisibleChips);
6806
+ const hiddenChips = normalizedChips.slice(maxVisibleChips);
6807
+ const firstChip = normalizedChips[0];
6808
+ const indicatorVariant = (firstChip == null ? void 0 : firstChip.variant) ?? "outlined";
6809
+ const indicatorColor = (firstChip == null ? void 0 : firstChip.color) ?? "default";
6810
+ const indicatorSize = (firstChip == null ? void 0 : firstChip.size) ?? "small";
6811
+ const handleMouseOver = () => setOpen(localRef.current);
6812
+ const handleMouseLeave = () => setOpen(null);
6813
+ const truncateChipLabel = (label) => {
6814
+ if (maxLengthChip !== void 0 && label.length > maxLengthChip) {
6815
+ return label.slice(0, maxLengthChip) + "...";
6816
+ }
6817
+ return label;
6818
+ };
6819
+ const getClickHandler = (chipData) => {
6820
+ return onClickAllChips ? (event) => onClickAllChips(chipData, event) : chipData.onClick;
6821
+ };
6822
+ const getDeleteHandler = (chipData) => {
6823
+ return onDeleteAllChips ? (event) => onDeleteAllChips(chipData, event) : chipData.onDelete;
6824
+ };
6825
+ const getChipDisplayProps = (chipData) => {
6826
+ const displayLabel = truncateChipLabel(chipData.label);
6827
+ const showTooltip = displayLabel !== chipData.label || Boolean(chipData.tooltip);
6828
+ return { displayLabel, showTooltip };
6829
+ };
6830
+ if (!hasChips) return null;
6831
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6832
+ /* @__PURE__ */ jsxs(
6833
+ Stack,
6834
+ {
6835
+ direction: "row",
6836
+ spacing: 0.5,
6837
+ ...rootProps,
6838
+ ref,
6839
+ "data-name": "chip-group",
6840
+ children: [
6841
+ chipsToShow.map((chipData, index) => {
6842
+ const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
6843
+ return /* @__PURE__ */ jsx(
6844
+ ChipGroupItem,
6845
+ {
6846
+ chipData,
6847
+ index,
6848
+ displayLabel,
6849
+ showTooltip,
6850
+ disabled,
6851
+ onClick: getClickHandler(chipData),
6852
+ onDelete: getDeleteHandler(chipData)
6853
+ },
6854
+ chipData.id ?? `${chipData.label}-${index}`
6855
+ );
6856
+ }),
6857
+ Boolean(additionalChips) && /* @__PURE__ */ jsx(
6858
+ ChipGroupItem,
6859
+ {
6860
+ ref: localRef,
6861
+ chipData: {
6862
+ label: `+${additionalChips}`,
6863
+ variant: indicatorVariant,
6864
+ color: indicatorColor,
6865
+ size: indicatorSize
6866
+ },
6867
+ index: -1,
6868
+ displayLabel: `+${additionalChips}`,
6869
+ onMouseOver: handleMouseOver,
6870
+ onMouseLeave: handleMouseLeave,
6871
+ "aria-label": "Additional items",
6872
+ disabled
6873
+ }
6874
+ )
6875
+ ]
6876
+ }
6877
+ ),
6878
+ /* @__PURE__ */ jsx(
6879
+ PopoverMenu,
6880
+ {
6881
+ sx: { pointerEvents: "none", outline: "none" },
6882
+ anchorOrigin: { vertical: "top", horizontal: "right" },
6883
+ transformOrigin: { vertical: "top", horizontal: "left" },
6884
+ anchorEl: openedRef,
6885
+ open: Boolean(openedRef),
6886
+ disableAutoFocus: true,
6887
+ disableEnforceFocus: true,
6888
+ slotProps: {
6889
+ paper: {
6890
+ onMouseEnter: handleMouseOver,
6891
+ onMouseLeave: handleMouseLeave
6892
+ }
6893
+ },
6894
+ children: /* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, children: hiddenChips.map((chipData, index) => {
6895
+ const chipIndex = index + maxVisibleChips;
6896
+ const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
6897
+ return /* @__PURE__ */ jsx(
6898
+ ChipGroupItem,
6899
+ {
6900
+ chipData,
6901
+ index: chipIndex,
6902
+ displayLabel,
6903
+ showTooltip,
6904
+ disabled,
6905
+ onClick: getClickHandler(chipData),
6906
+ onDelete: getDeleteHandler(chipData)
6907
+ },
6908
+ chipData.id ?? `${chipData.label}-hidden-${index}`
6909
+ );
6910
+ }) })
6911
+ }
6912
+ )
6913
+ ] });
6914
+ }
6915
+ const ChipGroup = forwardRef(_ChipGroup);
6916
+ ChipGroup.displayName = "ChipGroup";
6434
6917
  export {
6435
6918
  AUTOCOMPLETE_GROUP_HEADER_PROPERTY,
6436
6919
  AccordionGroup,
@@ -6440,6 +6923,7 @@ export {
6440
6923
  AutocompleteList,
6441
6924
  Avatar,
6442
6925
  Button,
6926
+ ChipGroup,
6443
6927
  CircularProgress,
6444
6928
  CodeAreaDialog,
6445
6929
  CodeAreaDialogConfirmation,
@@ -6488,6 +6972,7 @@ export {
6488
6972
  MenuItem$1 as MenuItem,
6489
6973
  MenuItemFilter,
6490
6974
  MenuList,
6975
+ MessageField,
6491
6976
  MultipleAutocomplete,
6492
6977
  MultipleSelectField,
6493
6978
  PasswordField,