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