@carto/meridian-ds 1.5.0-alpha-virtual-autocomplete.1 → 1.5.0-alpha-virtual-autocomplete.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,7 @@
3
3
  ## Unreleased
4
4
 
5
5
  - Support VirtualizedList in Autocomplete components [#215](https://github.com/CartoDB/meridian-ds/pull/215)
6
+ - Support `loading` and `disabled` properties in `SplitButton` [#216](https://github.com/CartoDB/meridian-ds/pull/216)
6
7
 
7
8
  ## 1.0
8
9
 
@@ -109,6 +109,9 @@ const ButtonGroup = material.styled(material.ButtonGroup)(({ theme, size }) => (
109
109
  }));
110
110
  function SplitButton({
111
111
  options,
112
+ disabled,
113
+ loading,
114
+ loadingPosition,
112
115
  onClick,
113
116
  variant,
114
117
  size,
@@ -147,8 +150,17 @@ function SplitButton({
147
150
  color,
148
151
  ...otherProps,
149
152
  children: [
150
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: handleClick, children: (_a = options[selectedIndex]) == null ? void 0 : _a.label }),
151
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: handleToggle, children: open ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}) })
153
+ /* @__PURE__ */ jsxRuntime.jsx(
154
+ Button,
155
+ {
156
+ disabled,
157
+ loading,
158
+ loadingPosition,
159
+ onClick: handleClick,
160
+ children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}) })
152
164
  ]
153
165
  }
154
166
  ),
@@ -1137,21 +1149,20 @@ const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxRuntime.jsxs("span"
1137
1149
  "+",
1138
1150
  more
1139
1151
  ] });
1140
- function createCounterRenderTags(counterText = "selected", options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
1152
+ function createCounterRenderTags(formatCounter, options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
1141
1153
  const CounterRenderTags = (value) => {
1142
1154
  if (value.length === 0) {
1143
1155
  return null;
1144
1156
  }
1145
- const totalCount = options.length;
1146
1157
  const selectedCount = value.length;
1147
- let text;
1148
- if (selectedCount === totalCount && totalCount > 0) {
1149
- text = `All ${counterText}`;
1150
- } else if (selectedCount === 1) {
1151
- text = getOptionLabel(value[0]);
1152
- } else {
1153
- text = `${selectedCount} ${counterText}`;
1154
- }
1158
+ const totalCount = options.length;
1159
+ const text = formatCounter({
1160
+ selectedCount,
1161
+ totalCount,
1162
+ selectedItems: value,
1163
+ allItems: options,
1164
+ getOptionLabel
1165
+ });
1155
1166
  return /* @__PURE__ */ jsxRuntime.jsx(
1156
1167
  TablePaginationActions.Typography,
1157
1168
  {
@@ -1167,6 +1178,22 @@ function createCounterRenderTags(counterText = "selected", options = [], size =
1167
1178
  };
1168
1179
  return CounterRenderTags;
1169
1180
  }
1181
+ function createCounterFormatter(counterText, allText, showSingleItemText = true) {
1182
+ return ({
1183
+ selectedCount,
1184
+ totalCount,
1185
+ selectedItems,
1186
+ getOptionLabel
1187
+ }) => {
1188
+ if (selectedCount === totalCount && totalCount > 0) {
1189
+ return allText;
1190
+ } else if (selectedCount === 1 && showSingleItemText) {
1191
+ return getOptionLabel(selectedItems[0]);
1192
+ } else {
1193
+ return `${selectedCount} ${counterText}`;
1194
+ }
1195
+ };
1196
+ }
1170
1197
  function useAutocompleteRenderOption() {
1171
1198
  const renderOption = (props, option, state, getOptionLabel, customIcon) => {
1172
1199
  const {
@@ -1309,8 +1336,15 @@ function useMultipleAutocomplete({
1309
1336
  value,
1310
1337
  onChange,
1311
1338
  getOptionLabel,
1312
- size
1339
+ size,
1340
+ counterFormatter,
1341
+ counterText,
1342
+ allSelectedText
1313
1343
  }) {
1344
+ const intl = reactIntl.useIntl();
1345
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1346
+ const defaultCounterText = counterText || intlConfig.formatMessage({ id: "c4r.form.selected" });
1347
+ const defaultAllSelectedText = allSelectedText || intlConfig.formatMessage({ id: "c4r.form.allSelected" });
1314
1348
  const [multipleValue, setMultipleValue] = React.useState(
1315
1349
  Array.isArray(value) ? value : value ? [value] : []
1316
1350
  );
@@ -1344,12 +1378,15 @@ function useMultipleAutocomplete({
1344
1378
  getOptionLabel
1345
1379
  );
1346
1380
  };
1347
- const getCounterRenderTags = () => createCounterRenderTags(
1348
- "selected",
1349
- options,
1350
- size,
1351
- getOptionLabel ? (option) => getOptionLabel(option) : void 0
1352
- );
1381
+ const getCounterRenderTags = () => {
1382
+ const formatter = counterFormatter || createCounterFormatter(defaultCounterText, defaultAllSelectedText);
1383
+ return createCounterRenderTags(
1384
+ formatter,
1385
+ options,
1386
+ size,
1387
+ getOptionLabel ? (option) => getOptionLabel(option) : void 0
1388
+ );
1389
+ };
1353
1390
  return {
1354
1391
  multipleValue,
1355
1392
  allSelected,
@@ -1373,10 +1410,7 @@ function _ListboxWithFilter({
1373
1410
  ...otherProps
1374
1411
  }, ref) {
1375
1412
  const childrenArray = React.useMemo(() => {
1376
- if (Array.isArray(children)) {
1377
- return children;
1378
- }
1379
- return children ? [children] : [];
1413
+ return React.Children.toArray(children);
1380
1414
  }, [children]);
1381
1415
  const defaultItemHeight = itemHeight ?? (extended ? TablePaginationActions.MENU_ITEM_SIZE_EXTENDED : TablePaginationActions.MENU_ITEM_SIZE_DEFAULT);
1382
1416
  const listboxHeight = React.useMemo(() => {
@@ -1448,6 +1482,9 @@ function _CreatableAutocomplete({
1448
1482
  loading,
1449
1483
  showFilters,
1450
1484
  showCounter = false,
1485
+ counterFormatter,
1486
+ counterText,
1487
+ allSelectedText,
1451
1488
  options = [],
1452
1489
  value,
1453
1490
  onChange,
@@ -1471,7 +1508,10 @@ function _CreatableAutocomplete({
1471
1508
  value,
1472
1509
  onChange,
1473
1510
  getOptionLabel,
1474
- size: props.size
1511
+ size: props.size,
1512
+ counterFormatter,
1513
+ counterText,
1514
+ allSelectedText
1475
1515
  });
1476
1516
  const {
1477
1517
  creatableFilterOptions,
@@ -1527,6 +1567,9 @@ function _MultipleAutocomplete({
1527
1567
  loading,
1528
1568
  showFilters,
1529
1569
  showCounter = false,
1570
+ counterFormatter,
1571
+ counterText,
1572
+ allSelectedText,
1530
1573
  options,
1531
1574
  value,
1532
1575
  onChange,
@@ -1551,7 +1594,10 @@ function _MultipleAutocomplete({
1551
1594
  value,
1552
1595
  onChange,
1553
1596
  getOptionLabel,
1554
- size: props.size
1597
+ size: props.size,
1598
+ counterFormatter,
1599
+ counterText,
1600
+ allSelectedText
1555
1601
  });
1556
1602
  const listboxProps = {
1557
1603
  showFilters,
@@ -4857,5 +4903,7 @@ exports.TooltipData = TooltipData;
4857
4903
  exports.UploadField = UploadField;
4858
4904
  exports.UploadFieldBase = UploadFieldBase;
4859
4905
  exports.copyString = copyString;
4906
+ exports.createCounterFormatter = createCounterFormatter;
4907
+ exports.createCounterRenderTags = createCounterRenderTags;
4860
4908
  exports.dialogDimensionsBySize = dialogDimensionsBySize;
4861
4909
  exports.useCopyValue = useCopyValue;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useState, useRef, useEffect, useMemo, Fragment as Fragment$1, useImperativeHandle, useCallback } from "react";
2
+ import React, { forwardRef, useState, useRef, useEffect, useMemo, Fragment as Fragment$1, useImperativeHandle, useCallback } from "react";
3
3
  import { styled, Box, Button as Button$1, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, IconButton, Tooltip, Select, FormControl, InputLabel, FormHelperText, ToggleButtonGroup as ToggleButtonGroup$1, Menu as Menu$2, Link, Checkbox, ListItemText, Autocomplete as Autocomplete$1, Divider, ListItemIcon, createFilterOptions, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Snackbar as Snackbar$1, Portal, Fade, Slide, alpha, useTheme, Toolbar, AppBar as AppBar$1, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip, DialogContent as DialogContent$1, DialogActions as DialogActions$1 } from "@mui/material";
4
4
  import { T as Typography, c as ICON_SIZE_SMALL, u as useImperativeIntl, f as MENU_ITEM_SIZE_EXTENDED, d as MENU_LIST_MAX_SIZE, M as MENU_ITEM_SIZE_DEFAULT, N as NOTIFICATION_DURATION_IN_MS, A as APPBAR_SIZE } from "../TablePaginationActions-Cz5Hbi6N.js";
5
5
  import { a } from "../TablePaginationActions-Cz5Hbi6N.js";
@@ -108,6 +108,9 @@ const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
108
108
  }));
109
109
  function SplitButton({
110
110
  options,
111
+ disabled,
112
+ loading,
113
+ loadingPosition,
111
114
  onClick,
112
115
  variant,
113
116
  size,
@@ -146,8 +149,17 @@ function SplitButton({
146
149
  color,
147
150
  ...otherProps,
148
151
  children: [
149
- /* @__PURE__ */ jsx(Button$1, { onClick: handleClick, children: (_a = options[selectedIndex]) == null ? void 0 : _a.label }),
150
- /* @__PURE__ */ jsx(Button$1, { onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
152
+ /* @__PURE__ */ jsx(
153
+ Button,
154
+ {
155
+ disabled,
156
+ loading,
157
+ loadingPosition,
158
+ onClick: handleClick,
159
+ children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
160
+ }
161
+ ),
162
+ /* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
151
163
  ]
152
164
  }
153
165
  ),
@@ -1136,21 +1148,20 @@ const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxs("span", { "data-t
1136
1148
  "+",
1137
1149
  more
1138
1150
  ] });
1139
- function createCounterRenderTags(counterText = "selected", options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
1151
+ function createCounterRenderTags(formatCounter, options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
1140
1152
  const CounterRenderTags = (value) => {
1141
1153
  if (value.length === 0) {
1142
1154
  return null;
1143
1155
  }
1144
- const totalCount = options.length;
1145
1156
  const selectedCount = value.length;
1146
- let text;
1147
- if (selectedCount === totalCount && totalCount > 0) {
1148
- text = `All ${counterText}`;
1149
- } else if (selectedCount === 1) {
1150
- text = getOptionLabel(value[0]);
1151
- } else {
1152
- text = `${selectedCount} ${counterText}`;
1153
- }
1157
+ const totalCount = options.length;
1158
+ const text = formatCounter({
1159
+ selectedCount,
1160
+ totalCount,
1161
+ selectedItems: value,
1162
+ allItems: options,
1163
+ getOptionLabel
1164
+ });
1154
1165
  return /* @__PURE__ */ jsx(
1155
1166
  Typography,
1156
1167
  {
@@ -1166,6 +1177,22 @@ function createCounterRenderTags(counterText = "selected", options = [], size =
1166
1177
  };
1167
1178
  return CounterRenderTags;
1168
1179
  }
1180
+ function createCounterFormatter(counterText, allText, showSingleItemText = true) {
1181
+ return ({
1182
+ selectedCount,
1183
+ totalCount,
1184
+ selectedItems,
1185
+ getOptionLabel
1186
+ }) => {
1187
+ if (selectedCount === totalCount && totalCount > 0) {
1188
+ return allText;
1189
+ } else if (selectedCount === 1 && showSingleItemText) {
1190
+ return getOptionLabel(selectedItems[0]);
1191
+ } else {
1192
+ return `${selectedCount} ${counterText}`;
1193
+ }
1194
+ };
1195
+ }
1169
1196
  function useAutocompleteRenderOption() {
1170
1197
  const renderOption = (props, option, state, getOptionLabel, customIcon) => {
1171
1198
  const {
@@ -1308,8 +1335,15 @@ function useMultipleAutocomplete({
1308
1335
  value,
1309
1336
  onChange,
1310
1337
  getOptionLabel,
1311
- size
1338
+ size,
1339
+ counterFormatter,
1340
+ counterText,
1341
+ allSelectedText
1312
1342
  }) {
1343
+ const intl = useIntl();
1344
+ const intlConfig = useImperativeIntl(intl);
1345
+ const defaultCounterText = counterText || intlConfig.formatMessage({ id: "c4r.form.selected" });
1346
+ const defaultAllSelectedText = allSelectedText || intlConfig.formatMessage({ id: "c4r.form.allSelected" });
1313
1347
  const [multipleValue, setMultipleValue] = useState(
1314
1348
  Array.isArray(value) ? value : value ? [value] : []
1315
1349
  );
@@ -1343,12 +1377,15 @@ function useMultipleAutocomplete({
1343
1377
  getOptionLabel
1344
1378
  );
1345
1379
  };
1346
- const getCounterRenderTags = () => createCounterRenderTags(
1347
- "selected",
1348
- options,
1349
- size,
1350
- getOptionLabel ? (option) => getOptionLabel(option) : void 0
1351
- );
1380
+ const getCounterRenderTags = () => {
1381
+ const formatter = counterFormatter || createCounterFormatter(defaultCounterText, defaultAllSelectedText);
1382
+ return createCounterRenderTags(
1383
+ formatter,
1384
+ options,
1385
+ size,
1386
+ getOptionLabel ? (option) => getOptionLabel(option) : void 0
1387
+ );
1388
+ };
1352
1389
  return {
1353
1390
  multipleValue,
1354
1391
  allSelected,
@@ -1372,10 +1409,7 @@ function _ListboxWithFilter({
1372
1409
  ...otherProps
1373
1410
  }, ref) {
1374
1411
  const childrenArray = useMemo(() => {
1375
- if (Array.isArray(children)) {
1376
- return children;
1377
- }
1378
- return children ? [children] : [];
1412
+ return React.Children.toArray(children);
1379
1413
  }, [children]);
1380
1414
  const defaultItemHeight = itemHeight ?? (extended ? MENU_ITEM_SIZE_EXTENDED : MENU_ITEM_SIZE_DEFAULT);
1381
1415
  const listboxHeight = useMemo(() => {
@@ -1447,6 +1481,9 @@ function _CreatableAutocomplete({
1447
1481
  loading,
1448
1482
  showFilters,
1449
1483
  showCounter = false,
1484
+ counterFormatter,
1485
+ counterText,
1486
+ allSelectedText,
1450
1487
  options = [],
1451
1488
  value,
1452
1489
  onChange,
@@ -1470,7 +1507,10 @@ function _CreatableAutocomplete({
1470
1507
  value,
1471
1508
  onChange,
1472
1509
  getOptionLabel,
1473
- size: props.size
1510
+ size: props.size,
1511
+ counterFormatter,
1512
+ counterText,
1513
+ allSelectedText
1474
1514
  });
1475
1515
  const {
1476
1516
  creatableFilterOptions,
@@ -1526,6 +1566,9 @@ function _MultipleAutocomplete({
1526
1566
  loading,
1527
1567
  showFilters,
1528
1568
  showCounter = false,
1569
+ counterFormatter,
1570
+ counterText,
1571
+ allSelectedText,
1529
1572
  options,
1530
1573
  value,
1531
1574
  onChange,
@@ -1550,7 +1593,10 @@ function _MultipleAutocomplete({
1550
1593
  value,
1551
1594
  onChange,
1552
1595
  getOptionLabel,
1553
- size: props.size
1596
+ size: props.size,
1597
+ counterFormatter,
1598
+ counterText,
1599
+ allSelectedText
1554
1600
  });
1555
1601
  const listboxProps = {
1556
1602
  showFilters,
@@ -4857,6 +4903,8 @@ export {
4857
4903
  UploadField,
4858
4904
  UploadFieldBase,
4859
4905
  copyString,
4906
+ createCounterFormatter,
4907
+ createCounterRenderTags,
4860
4908
  dialogDimensionsBySize,
4861
4909
  useCopyValue
4862
4910
  };
@@ -1,17 +1,21 @@
1
- import { ButtonProps } from '@mui/material';
1
+ import { ButtonProps } from './Button';
2
2
  type SplitButtonOption = {
3
3
  label: string;
4
4
  disabled?: boolean;
5
+ [key: string]: any;
5
6
  };
6
- export type SplitButtonProps = {
7
- options: SplitButtonOption[];
8
- onClick: (option: SplitButtonOption) => void;
7
+ export type SplitButtonProps<T extends SplitButtonOption = SplitButtonOption> = {
8
+ options: T[];
9
+ onClick: (option: T) => void;
10
+ loading?: boolean;
11
+ loadingPosition?: ButtonProps['loadingPosition'];
12
+ disabled?: boolean;
9
13
  variant?: ButtonProps['variant'];
10
14
  size?: ButtonProps['size'];
11
15
  color?: ButtonProps['color'];
12
16
  'data-testid'?: string;
13
17
  'aria-label'?: string;
14
18
  };
15
- export default function SplitButton({ options, onClick, variant, size, color, ...otherProps }: SplitButtonProps): import("react/jsx-runtime").JSX.Element;
19
+ export default function SplitButton<T extends SplitButtonOption = SplitButtonOption>({ options, disabled, loading, loadingPosition, onClick, variant, size, color, ...otherProps }: SplitButtonProps<T>): import("react/jsx-runtime").JSX.Element;
16
20
  export {};
17
21
  //# sourceMappingURL=SplitButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SplitButton.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/SplitButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,WAAW,EAOZ,MAAM,eAAe,CAAA;AAetB,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,OAAO,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAC5C,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,KAAK,EACL,GAAG,UAAU,EACd,EAAE,gBAAgB,2CAkFlB"}
1
+ {"version":3,"file":"SplitButton.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/SplitButton.tsx"],"names":[],"mappings":"AAWA,OAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAe9C,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IAC1E;IACE,OAAO,EAAE,CAAC,EAAE,CAAA;IACZ,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAA;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAEH,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EAC/C,EACA,OAAO,EACP,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACP,OAAO,EACP,IAAI,EACJ,KAAK,EACL,GAAG,UAAU,EACd,EAAE,gBAAgB,CAAC,CAAC,CAAC,2CAyFrB"}
@@ -1,7 +1,7 @@
1
1
  import { ForwardedRef } from 'react';
2
2
  import { ChipTypeMap } from '@mui/material';
3
3
  import { CreatableAutocompleteProps } from './types';
4
- declare function _CreatableAutocomplete<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']>({ newItemLabel, newItemIcon, getOptionLabel, multiple, disableCloseOnSelect, disabled, loading, showFilters, showCounter, options, value, onChange, getLimitTagsText, renderTags, itemHeight, maxListHeight, extended, ...props }: CreatableAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, ref: ForwardedRef<HTMLElement>): import("react/jsx-runtime").JSX.Element;
4
+ declare function _CreatableAutocomplete<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']>({ newItemLabel, newItemIcon, getOptionLabel, multiple, disableCloseOnSelect, disabled, loading, showFilters, showCounter, counterFormatter, counterText, allSelectedText, options, value, onChange, getLimitTagsText, renderTags, itemHeight, maxListHeight, extended, ...props }: CreatableAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, ref: ForwardedRef<HTMLElement>): import("react/jsx-runtime").JSX.Element;
5
5
  declare const CreatableAutocomplete: <Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>(props: CreatableAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
6
6
  ref?: ForwardedRef<HTMLElement>;
7
7
  }) => ReturnType<typeof _CreatableAutocomplete>;
@@ -1 +1 @@
1
- {"version":3,"file":"CreatableAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/CreatableAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAA;AAChD,OAAO,EACL,WAAW,EAGZ,MAAM,eAAe,CAAA;AAOtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAGpD,iBAAS,sBAAsB,CAC7B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,EACE,YAAY,EACZ,WAAW,EACX,cAAsC,EACtC,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAmB,EACnB,OAAY,EACZ,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,0BAA0B,CAC3B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,EACD,GAAG,EAAE,YAAY,CAAC,WAAW,CAAC,2CAqE/B;AAID,QAAA,MAAM,qBAAqB,EAAyC,CAClE,KAAK,EACL,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAwD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAyE,SAAnD,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,KAAK,EAAE,0BAA0B,CAC/B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAA;CAAE,KACpC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE9C,eAAe,qBAAqB,CAAA"}
1
+ {"version":3,"file":"CreatableAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/CreatableAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAA;AAChD,OAAO,EACL,WAAW,EAGZ,MAAM,eAAe,CAAA;AAOtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAGpD,iBAAS,sBAAsB,CAC7B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,EACE,YAAY,EACZ,WAAW,EACX,cAAsC,EACtC,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,OAAY,EACZ,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,0BAA0B,CAC3B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,EACD,GAAG,EAAE,YAAY,CAAC,WAAW,CAAC,2CAwE/B;AAID,QAAA,MAAM,qBAAqB,EAAyC,CAClE,KAAK,EACL,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAwD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAyE,SAAnD,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,KAAK,EAAE,0BAA0B,CAC/B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAA;CAAE,KACpC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE9C,eAAe,qBAAqB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import { default as React, HTMLAttributes } from 'react';
2
2
  export type ListboxWithFilterProps = HTMLAttributes<HTMLElement> & {
3
3
  showFilters?: boolean;
4
4
  allSelected?: boolean;
@@ -15,7 +15,7 @@ export type ListboxWithFilterProps = HTMLAttributes<HTMLElement> & {
15
15
  */
16
16
  maxListHeight?: number;
17
17
  };
18
- declare const ListboxWithFilter: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
18
+ declare const ListboxWithFilter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
19
19
  showFilters?: boolean;
20
20
  allSelected?: boolean;
21
21
  someSelected?: boolean;
@@ -30,6 +30,6 @@ declare const ListboxWithFilter: import('react').ForwardRefExoticComponent<HTMLA
30
30
  * Maximum height of the listbox in pixels
31
31
  */
32
32
  maxListHeight?: number;
33
- } & import('react').RefAttributes<HTMLUListElement>>;
33
+ } & React.RefAttributes<HTMLUListElement>>;
34
34
  export default ListboxWithFilter;
35
35
  //# sourceMappingURL=ListBoxWithFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListBoxWithFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/ListBoxWithFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAW,MAAM,OAAO,CAAA;AAUzE,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACjE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AA2FD,QAAA,MAAM,iBAAiB;kBAzGP,OAAO;kBACP,OAAO;mBACN,OAAO;sBACJ,MAAM,IAAI;eACjB,OAAO;eACP,OAAO;IAClB;;OAEG;iBACU,MAAM;IACnB;;OAEG;oBACa,MAAM;oDA4FgC,CAAA;AACxD,eAAe,iBAAiB,CAAA"}
1
+ {"version":3,"file":"ListBoxWithFilter.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/ListBoxWithFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA4B,cAAc,EAAW,MAAM,OAAO,CAAA;AAUhF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACjE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAyFD,QAAA,MAAM,iBAAiB;kBAvGP,OAAO;kBACP,OAAO;mBACN,OAAO;sBACJ,MAAM,IAAI;eACjB,OAAO;eACP,OAAO;IAClB;;OAEG;iBACU,MAAM;IACnB;;OAEG;oBACa,MAAM;0CA0FgC,CAAA;AACxD,eAAe,iBAAiB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { ForwardedRef } from 'react';
2
2
  import { ChipTypeMap } from '@mui/material';
3
3
  import { MultipleAutocompleteProps } from './types';
4
- declare function _MultipleAutocomplete<Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']>({ renderOption, disableCloseOnSelect, disabled, loading, showFilters, showCounter, options, value, onChange, getOptionLabel, getLimitTagsText, renderTags, itemHeight, maxListHeight, extended, ...props }: MultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, ref: ForwardedRef<HTMLElement>): import("react/jsx-runtime").JSX.Element;
4
+ declare function _MultipleAutocomplete<Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']>({ renderOption, disableCloseOnSelect, disabled, loading, showFilters, showCounter, counterFormatter, counterText, allSelectedText, options, value, onChange, getOptionLabel, getLimitTagsText, renderTags, itemHeight, maxListHeight, extended, ...props }: MultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, ref: ForwardedRef<HTMLElement>): import("react/jsx-runtime").JSX.Element;
5
5
  declare const MultipleAutocomplete: <Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>(props: MultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
6
6
  ref?: ForwardedRef<HTMLElement>;
7
7
  }) => ReturnType<typeof _MultipleAutocomplete>;
@@ -1 +1 @@
1
- {"version":3,"file":"MultipleAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/MultipleAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAA;AAChD,OAAO,EACL,WAAW,EAGZ,MAAM,eAAe,CAAA;AAMtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGnD,iBAAS,qBAAqB,CAC5B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,IAAI,EAC3C,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,EACE,YAAY,EACZ,oBAA2B,EAC3B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAmB,EACnB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,CAC1B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,EACD,GAAG,EAAE,YAAY,CAAC,WAAW,CAAC,2CAsD/B;AAID,QAAA,MAAM,oBAAoB,EAAwC,CAChE,KAAK,EACL,QAA2C,SAA1B,OAAO,GAAG,SAAS,GAAG,IAAI,EAC3C,gBAAwD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAyE,SAAnD,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,KAAK,EAAE,yBAAyB,CAC9B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAA;CAAE,KACpC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE7C,eAAe,oBAAoB,CAAA"}
1
+ {"version":3,"file":"MultipleAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/MultipleAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,OAAO,CAAA;AAChD,OAAO,EACL,WAAW,EAGZ,MAAM,eAAe,CAAA;AAMtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGnD,iBAAS,qBAAqB,CAC5B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,IAAI,EAC3C,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,EACE,YAAY,EACZ,oBAA2B,EAC3B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,EACb,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,yBAAyB,CAC1B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,EACD,GAAG,EAAE,YAAY,CAAC,WAAW,CAAC,2CAyD/B;AAID,QAAA,MAAM,oBAAoB,EAAwC,CAChE,KAAK,EACL,QAA2C,SAA1B,OAAO,GAAG,SAAS,GAAG,IAAI,EAC3C,gBAAwD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAgD,SAA/B,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAyE,SAAnD,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,EAEzE,KAAK,EAAE,yBAAyB,CAC9B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAA;CAAE,KACpC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE7C,eAAe,oBAAoB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export { default as Autocomplete } from './Autocomplete';
2
2
  export { default as CreatableAutocomplete } from './CreatableAutocomplete';
3
3
  export { default as MultipleAutocomplete } from './MultipleAutocomplete';
4
+ export { createCounterRenderTags, createCounterFormatter } from './utils';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA"}
@@ -2,24 +2,6 @@ import { ChipTypeMap, AutocompleteProps as MUIAutocompleteProps } from '@mui/mat
2
2
  import { MenuItemProps } from '../Menu/MenuItem';
3
3
  type BaseAutocompleteProps<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = Omit<MUIAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'ref'> & {
4
4
  loading?: boolean;
5
- };
6
- export type AutocompleteProps<Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = Omit<BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'multiple'>;
7
- export type MultipleAutocompleteProps<Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
8
- /**
9
- * If true, the popup will display a filter option for multiple selection.
10
- * @default false
11
- */
12
- showFilters?: boolean;
13
- /**
14
- * If true, the menu will not close when an option is selected.
15
- * @default true
16
- */
17
- disableCloseOnSelect?: boolean;
18
- /**
19
- * If true, displays a counter (e.g., "3 items selected") instead of individual tags.
20
- * @default false
21
- */
22
- showCounter?: boolean;
23
5
  /**
24
6
  * Height of each item in pixels when virtualized.
25
7
  * @default 32
@@ -36,15 +18,7 @@ export type MultipleAutocompleteProps<Value, Multiple extends boolean | undefine
36
18
  */
37
19
  extended?: boolean;
38
20
  };
39
- export type CreatableAutocompleteProps<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
40
- /**
41
- * Text for "create new item" option. String (used directly), function (for custom formatting), or undefined (uses translated "Add" text).
42
- */
43
- newItemLabel?: string | ((value: string) => React.ReactNode);
44
- /**
45
- * Icon to display next to the "Create new item" option.
46
- */
47
- newItemIcon?: React.ReactNode;
21
+ type BaseMultipleAutocompleteProps<Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
48
22
  /**
49
23
  * If true, the popup will display a filter option for multiple selection.
50
24
  * @default false
@@ -55,32 +29,52 @@ export type CreatableAutocompleteProps<Value, Multiple extends boolean | undefin
55
29
  * @default true
56
30
  */
57
31
  disableCloseOnSelect?: boolean;
58
- /**
59
- * If true, the input accepts multiple values. The default is `false`.
60
- * @default false
61
- */
62
- multiple?: Multiple;
63
32
  /**
64
33
  * If true, displays a counter (e.g., "3 items selected") instead of individual tags.
65
- * Only applies when multiple is true.
66
34
  * @default false
67
35
  */
68
36
  showCounter?: boolean;
69
37
  /**
70
- * Height of each item in pixels when virtualized.
71
- * @default 32
38
+ * Custom formatter function for counter tags. Takes precedence over counterText/allSelectedText.
39
+ * If not provided, will use counterText and allSelectedText to create a simple formatter.
40
+ * Only applies when showCounter is true.
72
41
  */
73
- itemHeight?: number;
42
+ counterFormatter?: (params: {
43
+ selectedCount: number;
44
+ totalCount: number;
45
+ selectedItems: readonly unknown[];
46
+ allItems: readonly unknown[];
47
+ getOptionLabel: (option: unknown) => string;
48
+ }) => string;
74
49
  /**
75
- * Maximum height of the listbox in pixels when virtualized.
76
- * @default 312
50
+ * Text to display with the counter (e.g., "selected", "chosen").
51
+ * Only used if counterFormatter is not provided and showCounter is true.
52
+ * @default "selected"
77
53
  */
78
- maxListHeight?: number;
54
+ counterText?: string;
79
55
  /**
80
- * If true, uses larger item height (48px) for extended menu items.
56
+ * Text to display when all items are selected (e.g., "All selected", "All chosen").
57
+ * Only used if counterFormatter is not provided and showCounter is true.
58
+ * @default "All selected"
59
+ */
60
+ allSelectedText?: string;
61
+ };
62
+ export type AutocompleteProps<Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = Omit<BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'multiple'>;
63
+ export type MultipleAutocompleteProps<Value, Multiple extends boolean | undefined = true, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = BaseAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & BaseMultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>;
64
+ export type CreatableAutocompleteProps<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> = BaseMultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
65
+ /**
66
+ * Text for "create new item" option. String (used directly), function (for custom formatting), or undefined (uses translated "Add" text).
67
+ */
68
+ newItemLabel?: string | ((value: string) => React.ReactNode);
69
+ /**
70
+ * Icon to display next to the "Create new item" option.
71
+ */
72
+ newItemIcon?: React.ReactNode;
73
+ /**
74
+ * If true, the input accepts multiple values. The default is `false`.
81
75
  * @default false
82
76
  */
83
- extended?: boolean;
77
+ multiple?: Multiple;
84
78
  };
85
79
  export type CreatableValueProps = {
86
80
  inputValue: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,IAAI,oBAAoB,EAC1C,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,KAAK,qBAAqB,CACxB,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,IACvE,IAAI,CACN,oBAAoB,CAClB,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,EACD,KAAK,CACN,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,iBAAiB,CAC3B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,KAAK,EAC5C,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,aAAa,SAAS,KAAK,CAAC,WAAW,GAAG,WAAW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AC,CAAA;IAC5D;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,aAAa,EACX,OAAO,GACP,UAAU,GACV,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,UAAU,GACV,SAAS,GACT,OAAO,CACV,GAAG;IACF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,IAAI,oBAAoB,EAC1C,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,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AS,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC,kBAAkB,CAAC,IACvE,6BAA6B,CAC/B,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,CACd,GAAG;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IAC5D;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,aAAa,EACX,OAAO,GACP,UAAU,GACV,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,UAAU,GACV,SAAS,GACT,OAAO,CACV,GAAG;IACF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA"}
@@ -6,8 +6,31 @@ type UseMultipleAutocompleteProps<Value, Multiple extends boolean | undefined =
6
6
  onChange?: (event: SyntheticEvent, value: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<Value>) => void;
7
7
  getOptionLabel?: (option: Value) => string;
8
8
  size?: 'small' | 'medium';
9
+ /**
10
+ * Custom formatter function for counter tags. Takes precedence over counterText/allSelectedText.
11
+ * If not provided, will use counterText and allSelectedText to create a simple formatter.
12
+ */
13
+ counterFormatter?: (params: {
14
+ selectedCount: number;
15
+ totalCount: number;
16
+ selectedItems: readonly unknown[];
17
+ allItems: readonly unknown[];
18
+ getOptionLabel: (option: unknown) => string;
19
+ }) => string;
20
+ /**
21
+ * Text to display with the counter (e.g., "selected", "chosen").
22
+ * Only used if counterFormatter is not provided.
23
+ * @default Localized string from 'c4r.form.selected'
24
+ */
25
+ counterText?: string;
26
+ /**
27
+ * Text to display when all items are selected (e.g., "All selected", "All chosen").
28
+ * Only used if counterFormatter is not provided.
29
+ * @default Localized string from 'c4r.form.allSelected'
30
+ */
31
+ allSelectedText?: string;
9
32
  };
10
- export default function useMultipleAutocomplete<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>({ options, value, onChange, getOptionLabel, size, }: UseMultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo>): {
33
+ export default function useMultipleAutocomplete<Value, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>({ options, value, onChange, getOptionLabel, size, counterFormatter, counterText, allSelectedText, }: UseMultipleAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo>): {
11
34
  multipleValue: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>;
12
35
  allSelected: boolean;
13
36
  someSelected: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useMultipleAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/useMultipleAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAA;AAC3D,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,eAAe,CAAA;AAKtB,KAAK,4BAA4B,CAC/B,KAAK,EACL,QAAQ,SAAS,OAAO,GA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AAE,OAAO,CAAA;KAAE;;EAqC/B"}
1
+ {"version":3,"file":"useMultipleAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/useMultipleAutocomplete.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAA;AAC3D,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,eAAe,CAAA;AAWtB,KAAK,4BAA4B,CAC/B,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,IAC9C;IACF,OAAO,EAAE,SAAS,KAAK,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAA;IACtE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EACrE,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,yBAAyB,CAAC,KAAK,CAAC,KACvC,IAAI,CAAA;IACT,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,MAAM,CAAA;IAC1C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAC1B,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,EAAE,SAAS,OAAO,EAAE,CAAA;QACjC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;QAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;KAC5C,KAAK,MAAM,CAAA;IACZ;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EACL,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,gBAAgB,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EACxD,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,EAChD,EACA,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,EAAE,4BAA4B,CAAC,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC;mBA2FxC,iBAAiB,CAC/C,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,CACT;;;6BAjE6B,cAAc;0BAkBrC,cAAc,YACX,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,UAChE,wBAAwB;kCASzB,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,UAClC,KAAK,SACN;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE;;EA0C/B"}
@@ -3,11 +3,51 @@ export declare const createOptionWithMultiple: <Value>(option: Value, multiple:
3
3
  export declare const getDefaultLimitTagsText: (more: number) => import("react/jsx-runtime").JSX.Element;
4
4
  /**
5
5
  * Creates a renderTags function that displays a counter instead of individual tags
6
- * @param counterText - Text to display with the counter (e.g., "selected")
6
+ * @param formatCounter - Function that receives selection state and returns the display text
7
7
  * @param options - Array of all available options to determine total count
8
8
  * @param size - Size variant for typography ('small' or 'medium')
9
9
  * @param getOptionLabel - Function to get the label for an option
10
- * @returns renderTags function that shows "X items selected", "All selected", or the item text for single selection
10
+ * @returns renderTags function that shows custom formatted text based on selection state
11
+ */
12
+ export declare function createCounterRenderTags(formatCounter: (params: {
13
+ selectedCount: number;
14
+ totalCount: number;
15
+ selectedItems: readonly unknown[];
16
+ allItems: readonly unknown[];
17
+ getOptionLabel: (option: unknown) => string;
18
+ }) => string, options?: readonly unknown[], size?: 'small' | 'medium', getOptionLabel?: (option: unknown) => string): (value: readonly unknown[]) => import("react/jsx-runtime").JSX.Element | null;
19
+ /**
20
+ * Helper function that creates a simple counter formatter
21
+ * @param counterText - Text to display with the counter (e.g., "selected")
22
+ * @param allText - Text to display when all items are selected (e.g., "All selected")
23
+ * @param showSingleItemText - Whether to show the actual item text for single selection
24
+ * @returns A formatter function that can be used with createCounterRenderTags
25
+ *
26
+ * @example
27
+ * // Basic usage with custom text
28
+ * const formatter = createCounterFormatter('items', 'All items')
29
+ * const renderTags = createCounterRenderTags(formatter, options)
30
+ *
31
+ * @example
32
+ * // I18N-friendly usage
33
+ * const formatter = createCounterFormatter(
34
+ * intl.formatMessage({ id: 'autocomplete.selected' }),
35
+ * intl.formatMessage({ id: 'autocomplete.allSelected' })
36
+ * )
37
+ * const renderTags = createCounterRenderTags(formatter, options)
38
+ *
39
+ * @example
40
+ * // Using with useMultipleAutocomplete hook
41
+ * const { getCounterRenderTags } = useMultipleAutocomplete({
42
+ * options,
43
+ * counterText: intl.formatMessage({ id: 'autocomplete.selected' }),
44
+ * allSelectedText: intl.formatMessage({ id: 'autocomplete.allSelected' })
45
+ * })
11
46
  */
12
- export declare function createCounterRenderTags(counterText?: string, options?: readonly unknown[], size?: 'small' | 'medium', getOptionLabel?: (option: unknown) => string): (value: readonly unknown[]) => import("react/jsx-runtime").JSX.Element | null;
47
+ export declare function createCounterFormatter(counterText: string, allText: string, showSingleItemText?: boolean): ({ selectedCount, totalCount, selectedItems, getOptionLabel, }: {
48
+ selectedCount: number;
49
+ totalCount: number;
50
+ selectedItems: readonly unknown[];
51
+ getOptionLabel: (option: unknown) => string;
52
+ }) => string;
13
53
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/utils.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,GAAI,KAAK,UAAW,KAAK,KAAG,MAI7D,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAAI,KAAK,UACpC,KAAK,YACH,OAAO,KAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAIxB,CAAA;AAGD,eAAO,MAAM,uBAAuB,SAAU,MAAM,4CAEnD,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,SAAa,EACxB,OAAO,GAAE,SAAS,OAAO,EAAO,EAChC,IAAI,GAAE,OAAO,GAAG,QAAkB,EAClC,cAAc,GAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAA8B,WAEjC,SAAS,OAAO,EAAE,oDAkCrD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Autocomplete/utils.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,GAAI,KAAK,UAAW,KAAK,KAAG,MAI7D,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAAI,KAAK,UACpC,KAAK,YACH,OAAO,KAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAIxB,CAAA;AAGD,eAAO,MAAM,uBAAuB,SAAU,MAAM,4CAEnD,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,CAAC,MAAM,EAAE;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,SAAS,OAAO,EAAE,CAAA;IACjC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;CAC5C,KAAK,MAAM,EACZ,OAAO,GAAE,SAAS,OAAO,EAAO,EAChC,IAAI,GAAE,OAAO,GAAG,QAAkB,EAClC,cAAc,GAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAA8B,WAEjC,SAAS,OAAO,EAAE,oDA+BrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,kBAAkB,UAAO,mEAOtB;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,SAAS,OAAO,EAAE,CAAA;IACjC,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;CAC5C,YASF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/meridian-ds",
3
- "version": "1.5.0-alpha-virtual-autocomplete.1",
3
+ "version": "1.5.0-alpha-virtual-autocomplete.2",
4
4
  "description": "CARTO Meridian Design System",
5
5
  "type": "module",
6
6
  "scripts": {