@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
package/CHANGELOG.md CHANGED
@@ -2,8 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Allow customization of menu item label in MultipleSelectField [#359](https://github.com/CartoDB/meridian-ds/pull/359)
6
+
5
7
  ## 2.0
6
8
 
9
+ ### 2.11.0
10
+
11
+ - Extend `AccordionGroup`, adding the `sx` property to each of the `items` [#369](https://github.com/CartoDB/meridian-ds/pull/369)
12
+ - New MessageField and ChipGroup components [#362](https://github.com/CartoDB/meridian-ds/pull/362)
13
+ - Fix flaky DateRangePicker test: auto-opens end date picker after selecting start date [#368](https://github.com/CartoDB/meridian-ds/pull/368)
14
+
7
15
  ### 2.10.2
8
16
 
9
17
  - FeatureSelectionWidgetUI: Fix ChipList horizontal layout after List component update [#365](https://github.com/CartoDB/meridian-ds/pull/365)
@@ -3,7 +3,7 @@ import React, { forwardRef, useState, createContext, useMemo, useContext } from
3
3
  import { styled, Link as Link$1, Alert as Alert$1, Fade, AlertTitle, List as List$1, ListItemButton as ListItemButton$1, ListItem as ListItem$1 } from "@mui/material";
4
4
  import { OpenInNewOutlined } from "@mui/icons-material";
5
5
  import "cartocolor";
6
- import { c as ICON_SIZE_SMALL, b as ICON_SIZE_MEDIUM, u as useTranslationWithFallback, T as Typography, m as LIST_MAX_SIZE, n as LIST_OVERSCAN_ITEMS_COUNT, h as LIST_ITEM_SIZE_DENSE, i as LIST_ITEM_SIZE_DEFAULT } from "./palette-utils-MuFJ3gQ2.js";
6
+ import { c as ICON_SIZE_SMALL, b as ICON_SIZE_MEDIUM, u as useTranslationWithFallback, T as Typography, m as LIST_MAX_SIZE, n as LIST_OVERSCAN_ITEMS_COUNT, h as LIST_ITEM_SIZE_DENSE, i as LIST_ITEM_SIZE_DEFAULT } from "./palette-utils-BMEVUZ5G.js";
7
7
  import * as ReactWindow from "react-window";
8
8
  const ScreenReaderOnly = styled("span")(() => ({
9
9
  position: "absolute",
@@ -4,7 +4,7 @@ const React = require("react");
4
4
  const material = require("@mui/material");
5
5
  const iconsMaterial = require("@mui/icons-material");
6
6
  require("cartocolor");
7
- const paletteUtils = require("./palette-utils-AE0NwrEo.cjs");
7
+ const paletteUtils = require("./palette-utils-BsfMFfME.cjs");
8
8
  const ReactWindow = require("react-window");
9
9
  function _interopNamespaceDefault(e) {
10
10
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -4,11 +4,11 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const material = require("@mui/material");
6
6
  const iconsMaterial = require("@mui/icons-material");
7
- const paletteUtils = require("../palette-utils-AE0NwrEo.cjs");
8
- const ListItem = require("../ListItem-CzAfw3KD.cjs");
7
+ const paletteUtils = require("../palette-utils-BsfMFfME.cjs");
8
+ const ListItem = require("../ListItem-DQ9_zkrB.cjs");
9
9
  const ArrowDown = require("../ArrowDown-84Oc8r9k.cjs");
10
10
  const OpenDiagonallyRight = require("../OpenDiagonallyRight-BUZBgnkY.cjs");
11
- const utils = require("../utils-dwDSNbwq.cjs");
11
+ const utils = require("../utils-BndCEhGs.cjs");
12
12
  require("cartocolor");
13
13
  const ReactWindow = require("react-window");
14
14
  const reactCodemirror2 = require("react-codemirror2");
@@ -638,6 +638,7 @@ function _MultipleSelectField({
638
638
  noneSelectedText,
639
639
  selectedText,
640
640
  selectAllText,
641
+ renderItemLabel,
641
642
  ...props
642
643
  }, ref) {
643
644
  const {
@@ -771,7 +772,7 @@ function _MultipleSelectField({
771
772
  checked: currentOptions.includes(option.value)
772
773
  }
773
774
  ),
774
- /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { primary: option.label })
775
+ renderItemLabel ? renderItemLabel(option) : /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { primary: option.label })
775
776
  ]
776
777
  },
777
778
  option.value
@@ -1967,7 +1968,7 @@ const BrandElements = material.styled("div")(({ theme }) => ({
1967
1968
  minWidth: "192px"
1968
1969
  }
1969
1970
  }));
1970
- const Content$5 = material.styled("div")(({ theme }) => ({
1971
+ const Content$6 = material.styled("div")(({ theme }) => ({
1971
1972
  display: "flex",
1972
1973
  alignItems: "center",
1973
1974
  justifyContent: "space-between",
@@ -1990,7 +1991,7 @@ function _AppBar({
1990
1991
  brandText && /* @__PURE__ */ jsxRuntime.jsx(BrandText, { text: brandText }),
1991
1992
  secondaryText && /* @__PURE__ */ jsxRuntime.jsx(SecondaryText, { text: secondaryText })
1992
1993
  ] }),
1993
- /* @__PURE__ */ jsxRuntime.jsx(Content$5, { children })
1994
+ /* @__PURE__ */ jsxRuntime.jsx(Content$6, { children })
1994
1995
  ] }) });
1995
1996
  }
1996
1997
  const AppBar = React.forwardRef(_AppBar);
@@ -2069,7 +2070,7 @@ function CodeAreaFooter({
2069
2070
  }
2070
2071
  );
2071
2072
  }
2072
- const Header = material.styled(material.Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2073
+ const Header$1 = material.styled(material.Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2073
2074
  position: "absolute",
2074
2075
  top: 0,
2075
2076
  right: theme.spacing(0.5),
@@ -2129,7 +2130,7 @@ function CodeAreaHeader({
2129
2130
  }
2130
2131
  if (showMenu) {
2131
2132
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2132
- /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2133
+ /* @__PURE__ */ jsxRuntime.jsxs(Header$1, { size, "data-size": size, "data-name": "code-area-header", children: [
2133
2134
  /* @__PURE__ */ jsxRuntime.jsx(
2134
2135
  paletteUtils.IconButton,
2135
2136
  {
@@ -2182,7 +2183,7 @@ function CodeAreaHeader({
2182
2183
  )
2183
2184
  ] });
2184
2185
  }
2185
- return /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2186
+ return /* @__PURE__ */ jsxRuntime.jsxs(Header$1, { size, "data-size": size, "data-name": "code-area-header", children: [
2186
2187
  showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(
2187
2188
  CopiableComponent,
2188
2189
  {
@@ -2803,7 +2804,7 @@ const CodeMirrorWrapper = material.styled(material.Box, {
2803
2804
  }
2804
2805
  })
2805
2806
  );
2806
- const InputWrapper = material.styled(material.Box, {
2807
+ const InputWrapper$1 = material.styled(material.Box, {
2807
2808
  shouldForwardProp: (prop) => prop !== "hasActions"
2808
2809
  })(({ theme, hasActions }) => ({
2809
2810
  flex: "1 1 auto",
@@ -2909,7 +2910,7 @@ function CodeAreaField({
2909
2910
  size: isExpanded ? "medium" : "small"
2910
2911
  }
2911
2912
  ),
2912
- /* @__PURE__ */ jsxRuntime.jsx(InputWrapper, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsxRuntime.jsx(
2913
+ /* @__PURE__ */ jsxRuntime.jsx(InputWrapper$1, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsxRuntime.jsx(
2913
2914
  CodeAreaInput,
2914
2915
  {
2915
2916
  ...props,
@@ -3295,7 +3296,7 @@ function DialogHeader({
3295
3296
  children && /* @__PURE__ */ jsxRuntime.jsx(DividerBottom, {})
3296
3297
  ] });
3297
3298
  }
3298
- const Content$4 = material.styled(material.DialogContent, {
3299
+ const Content$5 = material.styled(material.DialogContent, {
3299
3300
  shouldForwardProp: (prop) => ![
3300
3301
  "scrollableContent",
3301
3302
  "withGutter",
@@ -3386,7 +3387,7 @@ function _DialogContent({
3386
3387
  return () => resizeObserver.disconnect();
3387
3388
  }, [contentRef, updateBorders]);
3388
3389
  return /* @__PURE__ */ jsxRuntime.jsx(
3389
- Content$4,
3390
+ Content$5,
3390
3391
  {
3391
3392
  ref: setContentRef,
3392
3393
  onScroll: handleScroll,
@@ -3693,7 +3694,7 @@ function DialogStepper({
3693
3694
  );
3694
3695
  }) }) });
3695
3696
  }
3696
- const Content$3 = material.styled(DialogContent, {
3697
+ const Content$4 = material.styled(DialogContent, {
3697
3698
  shouldForwardProp: (prop) => !["error", "withBorder"].includes(prop)
3698
3699
  })(
3699
3700
  ({ error, withBorder, theme }) => ({
@@ -3722,7 +3723,7 @@ function CodeAreaDialogContent({
3722
3723
  withGutter = false
3723
3724
  }) {
3724
3725
  if (!children) return null;
3725
- return /* @__PURE__ */ jsxRuntime.jsx(Content$3, { withGutter, error, withBorder, children });
3726
+ return /* @__PURE__ */ jsxRuntime.jsx(Content$4, { withGutter, error, withBorder, children });
3726
3727
  }
3727
3728
  function CodeAreaDialogConfirmation({
3728
3729
  onClose,
@@ -4802,7 +4803,7 @@ function _EmptyState({
4802
4803
  }
4803
4804
  const EmptyState = React.forwardRef(_EmptyState);
4804
4805
  const DEFAULT_ITEMS = [{ outlinedBullet: false, value: "" }];
4805
- const Content$2 = material.styled("ul")(({ theme }) => ({
4806
+ const Content$3 = material.styled("ul")(({ theme }) => ({
4806
4807
  listStyle: "none",
4807
4808
  paddingLeft: 0,
4808
4809
  margin: theme.spacing(0.5, 0, 0, 0)
@@ -4833,7 +4834,7 @@ function TooltipData({
4833
4834
  }) {
4834
4835
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4835
4836
  title && /* @__PURE__ */ jsxRuntime.jsx(paletteUtils.Typography, { color: "inherit", variant: "caption", weight: "medium", children: title }),
4836
- /* @__PURE__ */ jsxRuntime.jsx(Content$2, { children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(Entry, { children: [
4837
+ /* @__PURE__ */ jsxRuntime.jsx(Content$3, { children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(Entry, { children: [
4837
4838
  /* @__PURE__ */ jsxRuntime.jsx(
4838
4839
  Bullet,
4839
4840
  {
@@ -4883,6 +4884,7 @@ function _AccordionGroup({
4883
4884
  disabled: item.disabled,
4884
4885
  defaultExpanded: item.defaultExpanded,
4885
4886
  onChange: item.onChange,
4887
+ sx: item.sx,
4886
4888
  children: [
4887
4889
  /* @__PURE__ */ jsxRuntime.jsx(
4888
4890
  material.AccordionSummary,
@@ -5219,6 +5221,296 @@ function _FilterDropdown({
5219
5221
  const FilterDropdown = React.forwardRef(
5220
5222
  _FilterDropdown
5221
5223
  );
5224
+ const Header = material.styled(material.Box)(({ theme }) => ({
5225
+ display: "flex",
5226
+ alignItems: "center",
5227
+ flexWrap: "wrap",
5228
+ gap: theme.spacing(0.5),
5229
+ padding: theme.spacing(0.5)
5230
+ }));
5231
+ const Content$2 = material.styled(material.Box, {
5232
+ shouldForwardProp: (prop) => !["hasToolbar"].includes(prop)
5233
+ })(({ hasToolbar }) => ({
5234
+ display: "flex",
5235
+ alignItems: "flex-end",
5236
+ ...hasToolbar && {
5237
+ display: "block"
5238
+ }
5239
+ }));
5240
+ const TextFieldBase = material.styled(material.TextField)(({ theme }) => ({
5241
+ "& .MuiInputBase-root": {
5242
+ minHeight: "auto !important",
5243
+ "&:before": {
5244
+ border: `none !important`,
5245
+ "&:hover": {
5246
+ border: `none !important`
5247
+ }
5248
+ },
5249
+ "& textarea": {
5250
+ maxHeight: theme.spacing(32),
5251
+ // 256px, defined in the design specs
5252
+ overflowY: "auto !important",
5253
+ boxSizing: "border-box"
5254
+ },
5255
+ // Sizes
5256
+ "&.MuiInputBase-multiline.MuiInputBase-sizeSmall textarea": {
5257
+ padding: theme.spacing(0.75, 1.25)
5258
+ }
5259
+ },
5260
+ // Variant's overrides
5261
+ "& .MuiFilledInput-root": {
5262
+ backgroundColor: "transparent !important"
5263
+ },
5264
+ "& .MuiOutlinedInput-root": {
5265
+ backgroundColor: "transparent !important",
5266
+ "& .MuiOutlinedInput-notchedOutline": {
5267
+ border: "none !important"
5268
+ }
5269
+ }
5270
+ }));
5271
+ const InputWrapper = material.styled(material.Box, {
5272
+ shouldForwardProp: (prop) => !["variant", "disabled", "error"].includes(prop)
5273
+ })(({ theme, variant, disabled, error }) => ({
5274
+ borderRadius: theme.spacing(0.5),
5275
+ transition: theme.transitions.create(["background-color", "box-shadow"], {
5276
+ easing: theme.transitions.easing.easeInOut,
5277
+ duration: theme.transitions.duration.shortest
5278
+ }),
5279
+ // States
5280
+ ...error && {
5281
+ boxShadow: `0 0 0 2px inset ${theme.palette.error.light}`
5282
+ },
5283
+ // Variants
5284
+ ...variant === "filled" && {
5285
+ backgroundColor: theme.palette.default.background,
5286
+ "&:hover": {
5287
+ backgroundColor: !disabled && theme.palette.action.hover
5288
+ },
5289
+ "&:focus-within": {
5290
+ backgroundColor: theme.palette.default.background
5291
+ }
5292
+ },
5293
+ ...variant === "outlined" && {
5294
+ boxShadow: `0 0 0 1px inset ${theme.palette.default.outlinedBorder}`
5295
+ // TBD when we need to support outlined variant
5296
+ }
5297
+ }));
5298
+ const FooterWrapper = material.styled(material.Box, {
5299
+ shouldForwardProp: (prop) => !["size"].includes(prop)
5300
+ })(({ theme, size }) => ({
5301
+ display: "flex",
5302
+ alignItems: "center",
5303
+ justifyContent: "space-between",
5304
+ gap: theme.spacing(0.5),
5305
+ padding: theme.spacing(size === "small" ? 0.5 : 1)
5306
+ }));
5307
+ const Toolbar = material.styled(material.Box)(({ theme }) => ({
5308
+ display: "flex",
5309
+ alignItems: "center",
5310
+ gap: theme.spacing(0.5),
5311
+ // Reset margin
5312
+ "& .MuiButtonBase-root, & .optionIconButton": {
5313
+ marginLeft: 0
5314
+ }
5315
+ }));
5316
+ const MessageFieldFooter = ({
5317
+ size,
5318
+ toolbar,
5319
+ analyzing,
5320
+ onStop,
5321
+ stopLabel,
5322
+ iconButton,
5323
+ labelButton,
5324
+ onClick,
5325
+ buttonIsDisabled,
5326
+ disabled,
5327
+ typeToSendLabel,
5328
+ sendLabel
5329
+ }) => {
5330
+ const stopAriaLabel = typeof stopLabel === "string" ? stopLabel : void 0;
5331
+ const sendButtonLabel = buttonIsDisabled ? typeToSendLabel : sendLabel;
5332
+ const sendAriaLabel = typeof sendButtonLabel === "string" ? sendButtonLabel : void 0;
5333
+ return /* @__PURE__ */ jsxRuntime.jsxs(FooterWrapper, { size, children: [
5334
+ toolbar && /* @__PURE__ */ jsxRuntime.jsx(Toolbar, { children: toolbar }),
5335
+ /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: analyzing ? /* @__PURE__ */ jsxRuntime.jsx(
5336
+ paletteUtils.IconButton,
5337
+ {
5338
+ onClick: onStop,
5339
+ color: "default",
5340
+ size,
5341
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.StopCircleOutlined, {}),
5342
+ tooltip: stopLabel,
5343
+ "aria-label": stopAriaLabel,
5344
+ tooltipPlacement: "top"
5345
+ }
5346
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5347
+ iconButton && !labelButton && /* @__PURE__ */ jsxRuntime.jsx(
5348
+ paletteUtils.IconButton,
5349
+ {
5350
+ onClick,
5351
+ disabled: buttonIsDisabled,
5352
+ color: "primary",
5353
+ variant: "contained",
5354
+ size,
5355
+ icon: iconButton,
5356
+ tooltip: !disabled ? sendButtonLabel : void 0,
5357
+ "aria-label": sendAriaLabel,
5358
+ tooltipPlacement: "top"
5359
+ }
5360
+ ),
5361
+ labelButton && /* @__PURE__ */ jsxRuntime.jsx(
5362
+ material.Tooltip,
5363
+ {
5364
+ title: buttonIsDisabled && !disabled ? typeToSendLabel : void 0,
5365
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { display: "flex", children: /* @__PURE__ */ jsxRuntime.jsx(
5366
+ Button,
5367
+ {
5368
+ onClick,
5369
+ variant: "contained",
5370
+ color: "primary",
5371
+ disabled: buttonIsDisabled,
5372
+ size,
5373
+ children: labelButton
5374
+ }
5375
+ ) })
5376
+ }
5377
+ )
5378
+ ] }) })
5379
+ ] });
5380
+ };
5381
+ function _MessageField({
5382
+ value,
5383
+ defaultValue,
5384
+ label,
5385
+ onChange,
5386
+ onClick,
5387
+ onStop,
5388
+ disabled,
5389
+ variant = "filled",
5390
+ size = "small",
5391
+ analyzing,
5392
+ iconButton = /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpwardOutlined, {}),
5393
+ labelButton,
5394
+ disabledButton,
5395
+ helperText,
5396
+ error,
5397
+ fullWidth = true,
5398
+ validationType,
5399
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5400
+ focused: _focused,
5401
+ onKeyDown,
5402
+ textFieldProps,
5403
+ toolbar,
5404
+ header,
5405
+ stopText,
5406
+ typeToSendText,
5407
+ sendText,
5408
+ "data-testid": dataTestId,
5409
+ "aria-label": ariaLabel,
5410
+ ...otherProps
5411
+ }, ref) {
5412
+ const stopLabel = paletteUtils.useTranslationWithFallback("c4r.button.stop", stopText);
5413
+ const typeToSendLabel = paletteUtils.useTranslationWithFallback(
5414
+ "c4r.button.typeToSend",
5415
+ typeToSendText
5416
+ );
5417
+ const sendLabel = paletteUtils.useTranslationWithFallback("c4r.button.send", sendText);
5418
+ const inputIsDisabled = disabled || analyzing;
5419
+ const currentValue = value ?? defaultValue ?? "";
5420
+ const buttonIsDisabled = currentValue === "" || disabledButton || disabled;
5421
+ const handleKeyDown = (e) => {
5422
+ if (e.key === "Enter") {
5423
+ if (e.ctrlKey || e.shiftKey) {
5424
+ e.preventDefault();
5425
+ const textarea = e.target;
5426
+ const cursorPosition = e.target.selectionStart;
5427
+ const textValue = textarea.value;
5428
+ const newValue = textValue.slice(0, cursorPosition) + "\n" + textValue.slice(cursorPosition);
5429
+ const onChangeHandler = (textFieldProps == null ? void 0 : textFieldProps.onChange) || onChange;
5430
+ if (onChangeHandler) {
5431
+ const newEvent = {
5432
+ ...e,
5433
+ target: {
5434
+ ...e.target,
5435
+ value: newValue
5436
+ }
5437
+ };
5438
+ onChangeHandler(newEvent);
5439
+ } else {
5440
+ textarea.value = newValue;
5441
+ }
5442
+ requestAnimationFrame(() => {
5443
+ textarea.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
5444
+ });
5445
+ } else {
5446
+ e.preventDefault();
5447
+ onClick(e);
5448
+ }
5449
+ }
5450
+ const onKeyDownHandler = (textFieldProps == null ? void 0 : textFieldProps.onKeyDown) || onKeyDown;
5451
+ onKeyDownHandler == null ? void 0 : onKeyDownHandler(e);
5452
+ };
5453
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5454
+ material.FormControl,
5455
+ {
5456
+ ref,
5457
+ fullWidth,
5458
+ size,
5459
+ error,
5460
+ disabled: inputIsDisabled,
5461
+ role: "group",
5462
+ "data-name": "message-field",
5463
+ "data-testid": dataTestId,
5464
+ "aria-label": ariaLabel,
5465
+ children: [
5466
+ label && /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { shrink: true, children: /* @__PURE__ */ jsxRuntime.jsx(LabelWithIndicator, { label, type: validationType }) }),
5467
+ /* @__PURE__ */ jsxRuntime.jsxs(InputWrapper, { variant, disabled: inputIsDisabled, error, children: [
5468
+ header && /* @__PURE__ */ jsxRuntime.jsx(Header, { children: header }),
5469
+ /* @__PURE__ */ jsxRuntime.jsxs(Content$2, { hasToolbar: !!toolbar, children: [
5470
+ /* @__PURE__ */ jsxRuntime.jsx(
5471
+ TextFieldBase,
5472
+ {
5473
+ multiline: true,
5474
+ ...value !== void 0 ? { value } : { defaultValue },
5475
+ onChange,
5476
+ focused: false,
5477
+ disabled: inputIsDisabled,
5478
+ variant,
5479
+ size,
5480
+ fullWidth,
5481
+ required: validationType === "required",
5482
+ inputProps: { "aria-invalid": !!error },
5483
+ ...otherProps,
5484
+ ...textFieldProps,
5485
+ onKeyDown: handleKeyDown
5486
+ }
5487
+ ),
5488
+ /* @__PURE__ */ jsxRuntime.jsx(
5489
+ MessageFieldFooter,
5490
+ {
5491
+ size,
5492
+ toolbar,
5493
+ analyzing,
5494
+ onStop,
5495
+ stopLabel,
5496
+ iconButton,
5497
+ labelButton,
5498
+ onClick,
5499
+ buttonIsDisabled,
5500
+ disabled,
5501
+ typeToSendLabel,
5502
+ sendLabel
5503
+ }
5504
+ )
5505
+ ] })
5506
+ ] }),
5507
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: helperText })
5508
+ ]
5509
+ }
5510
+ );
5511
+ }
5512
+ const MessageField = React.forwardRef(_MessageField);
5513
+ MessageField.displayName = "MessageField";
5222
5514
  const SearchIcon = material.styled(Search.ForwardedComponent, {
5223
5515
  shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
5224
5516
  })(
@@ -6447,6 +6739,197 @@ function _ListItemIcon({ iconProps, sx, ...otherProps }, ref) {
6447
6739
  }
6448
6740
  const ListItemIcon = React.forwardRef(_ListItemIcon);
6449
6741
  ListItemIcon.displayName = "ListItemIcon";
6742
+ const Chip = material.styled(material.Chip)(() => ({
6743
+ maxWidth: "100%"
6744
+ }));
6745
+ function _ChipGroupItem({
6746
+ chipData,
6747
+ index,
6748
+ displayLabel,
6749
+ showTooltip = false,
6750
+ disabled,
6751
+ onClick,
6752
+ onDelete,
6753
+ ...restProps
6754
+ }, ref) {
6755
+ const uniqueId2 = `chip-${index}`;
6756
+ const isDisabled = chipData.disabled ?? disabled;
6757
+ const chipElement = /* @__PURE__ */ jsxRuntime.jsx(
6758
+ Chip,
6759
+ {
6760
+ ...restProps,
6761
+ ref,
6762
+ label: /* @__PURE__ */ jsxRuntime.jsx(
6763
+ paletteUtils.Typography,
6764
+ {
6765
+ component: "p",
6766
+ variant: "inherit",
6767
+ color: "inherit",
6768
+ noWrap: true,
6769
+ id: uniqueId2,
6770
+ children: displayLabel
6771
+ }
6772
+ ),
6773
+ variant: chipData.variant ?? "outlined",
6774
+ color: chipData.color ?? "default",
6775
+ size: chipData.size ?? "small",
6776
+ disabled: isDisabled,
6777
+ avatar: chipData.avatar,
6778
+ icon: chipData.icon,
6779
+ deleteIcon: chipData.deleteIcon,
6780
+ onClick,
6781
+ onDelete,
6782
+ "aria-disabled": isDisabled,
6783
+ "aria-labelledby": uniqueId2,
6784
+ "data-truncated": showTooltip
6785
+ }
6786
+ );
6787
+ if (!showTooltip && !chipData.tooltip) {
6788
+ return chipElement;
6789
+ }
6790
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: chipData.tooltip || chipData.label, children: chipElement });
6791
+ }
6792
+ const ChipGroupItem = React.forwardRef(_ChipGroupItem);
6793
+ ChipGroupItem.displayName = "ChipGroupItem";
6794
+ const PopoverMenu = material.styled(material.Popover)(({ theme }) => ({
6795
+ ".MuiPaper-root": {
6796
+ pointerEvents: "all",
6797
+ padding: theme.spacing(1),
6798
+ marginTop: 0,
6799
+ marginLeft: theme.spacing(0.5)
6800
+ }
6801
+ }));
6802
+ function _ChipGroup({
6803
+ chips,
6804
+ disabled,
6805
+ maxVisibleChips = 3,
6806
+ maxLengthChip = 30,
6807
+ onClickAllChips,
6808
+ onDeleteAllChips,
6809
+ ...rootProps
6810
+ }, ref) {
6811
+ const [openedRef, setOpen] = React.useState(null);
6812
+ const localRef = React.useRef(null);
6813
+ const hasChips = Boolean(chips == null ? void 0 : chips.length);
6814
+ const normalizedChips = (chips == null ? void 0 : chips.map((chip) => {
6815
+ if (typeof chip === "string") {
6816
+ return { label: chip };
6817
+ }
6818
+ return chip;
6819
+ })) || [];
6820
+ const chipsToShow = normalizedChips.slice(0, maxVisibleChips);
6821
+ const additionalChips = Math.max(0, normalizedChips.length - maxVisibleChips);
6822
+ const hiddenChips = normalizedChips.slice(maxVisibleChips);
6823
+ const firstChip = normalizedChips[0];
6824
+ const indicatorVariant = (firstChip == null ? void 0 : firstChip.variant) ?? "outlined";
6825
+ const indicatorColor = (firstChip == null ? void 0 : firstChip.color) ?? "default";
6826
+ const indicatorSize = (firstChip == null ? void 0 : firstChip.size) ?? "small";
6827
+ const handleMouseOver = () => setOpen(localRef.current);
6828
+ const handleMouseLeave = () => setOpen(null);
6829
+ const truncateChipLabel = (label) => {
6830
+ if (maxLengthChip !== void 0 && label.length > maxLengthChip) {
6831
+ return label.slice(0, maxLengthChip) + "...";
6832
+ }
6833
+ return label;
6834
+ };
6835
+ const getClickHandler = (chipData) => {
6836
+ return onClickAllChips ? (event) => onClickAllChips(chipData, event) : chipData.onClick;
6837
+ };
6838
+ const getDeleteHandler = (chipData) => {
6839
+ return onDeleteAllChips ? (event) => onDeleteAllChips(chipData, event) : chipData.onDelete;
6840
+ };
6841
+ const getChipDisplayProps = (chipData) => {
6842
+ const displayLabel = truncateChipLabel(chipData.label);
6843
+ const showTooltip = displayLabel !== chipData.label || Boolean(chipData.tooltip);
6844
+ return { displayLabel, showTooltip };
6845
+ };
6846
+ if (!hasChips) return null;
6847
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6848
+ /* @__PURE__ */ jsxRuntime.jsxs(
6849
+ material.Stack,
6850
+ {
6851
+ direction: "row",
6852
+ spacing: 0.5,
6853
+ ...rootProps,
6854
+ ref,
6855
+ "data-name": "chip-group",
6856
+ children: [
6857
+ chipsToShow.map((chipData, index) => {
6858
+ const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
6859
+ return /* @__PURE__ */ jsxRuntime.jsx(
6860
+ ChipGroupItem,
6861
+ {
6862
+ chipData,
6863
+ index,
6864
+ displayLabel,
6865
+ showTooltip,
6866
+ disabled,
6867
+ onClick: getClickHandler(chipData),
6868
+ onDelete: getDeleteHandler(chipData)
6869
+ },
6870
+ chipData.id ?? `${chipData.label}-${index}`
6871
+ );
6872
+ }),
6873
+ Boolean(additionalChips) && /* @__PURE__ */ jsxRuntime.jsx(
6874
+ ChipGroupItem,
6875
+ {
6876
+ ref: localRef,
6877
+ chipData: {
6878
+ label: `+${additionalChips}`,
6879
+ variant: indicatorVariant,
6880
+ color: indicatorColor,
6881
+ size: indicatorSize
6882
+ },
6883
+ index: -1,
6884
+ displayLabel: `+${additionalChips}`,
6885
+ onMouseOver: handleMouseOver,
6886
+ onMouseLeave: handleMouseLeave,
6887
+ "aria-label": "Additional items",
6888
+ disabled
6889
+ }
6890
+ )
6891
+ ]
6892
+ }
6893
+ ),
6894
+ /* @__PURE__ */ jsxRuntime.jsx(
6895
+ PopoverMenu,
6896
+ {
6897
+ sx: { pointerEvents: "none", outline: "none" },
6898
+ anchorOrigin: { vertical: "top", horizontal: "right" },
6899
+ transformOrigin: { vertical: "top", horizontal: "left" },
6900
+ anchorEl: openedRef,
6901
+ open: Boolean(openedRef),
6902
+ disableAutoFocus: true,
6903
+ disableEnforceFocus: true,
6904
+ slotProps: {
6905
+ paper: {
6906
+ onMouseEnter: handleMouseOver,
6907
+ onMouseLeave: handleMouseLeave
6908
+ }
6909
+ },
6910
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { direction: "column", spacing: 1, children: hiddenChips.map((chipData, index) => {
6911
+ const chipIndex = index + maxVisibleChips;
6912
+ const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
6913
+ return /* @__PURE__ */ jsxRuntime.jsx(
6914
+ ChipGroupItem,
6915
+ {
6916
+ chipData,
6917
+ index: chipIndex,
6918
+ displayLabel,
6919
+ showTooltip,
6920
+ disabled,
6921
+ onClick: getClickHandler(chipData),
6922
+ onDelete: getDeleteHandler(chipData)
6923
+ },
6924
+ chipData.id ?? `${chipData.label}-hidden-${index}`
6925
+ );
6926
+ }) })
6927
+ }
6928
+ )
6929
+ ] });
6930
+ }
6931
+ const ChipGroup = React.forwardRef(_ChipGroup);
6932
+ ChipGroup.displayName = "ChipGroup";
6450
6933
  Object.defineProperty(exports, "ListItemAvatar", {
6451
6934
  enumerable: true,
6452
6935
  get: () => material.ListItemAvatar
@@ -6474,6 +6957,7 @@ exports.Autocomplete = Autocomplete;
6474
6957
  exports.AutocompleteList = AutocompleteList;
6475
6958
  exports.Avatar = Avatar;
6476
6959
  exports.Button = Button;
6960
+ exports.ChipGroup = ChipGroup;
6477
6961
  exports.CircularProgress = CircularProgress;
6478
6962
  exports.CodeAreaDialog = CodeAreaDialog;
6479
6963
  exports.CodeAreaDialogConfirmation = CodeAreaDialogConfirmation;
@@ -6513,6 +6997,7 @@ exports.Loader = Loader;
6513
6997
  exports.Menu = Menu;
6514
6998
  exports.MenuItemFilter = MenuItemFilter;
6515
6999
  exports.MenuList = MenuList;
7000
+ exports.MessageField = MessageField;
6516
7001
  exports.MultipleAutocomplete = MultipleAutocomplete;
6517
7002
  exports.MultipleSelectField = MultipleSelectField;
6518
7003
  exports.PasswordField = PasswordField;