@carto/meridian-ds 1.4.8 → 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 +8 -0
- package/dist/{Alert-BiOR9aar.cjs → Alert-BzEgeyQJ.cjs} +1 -1
- package/dist/{Alert-CywtIMOj.js → Alert-CnaTtNJd.js} +1 -1
- package/dist/{MenuItem-CXnnE5lK.js → MenuItem-D6wJym7Z.js} +9 -5
- package/dist/{MenuItem-Br2jY2lt.cjs → MenuItem-lAxlHrDp.cjs} +9 -5
- package/dist/{OpenDiagonallyRight-BrRyCV4Q.cjs → OpenDiagonallyRight-CM1tojUq.cjs} +27 -0
- package/dist/{OpenDiagonallyRight-5HZXh46V.js → OpenDiagonallyRight-CSm5GYYJ.js} +27 -0
- package/dist/{TablePaginationActions-KpTvhN4Y.js → TablePaginationActions-Cz5Hbi6N.js} +9 -1
- package/dist/{TablePaginationActions-CFGXm44W.cjs → TablePaginationActions-mbbjzV6Y.cjs} +8 -0
- package/dist/components/index.cjs +426 -52
- package/dist/components/index.js +432 -58
- package/dist/custom-icons/index.cjs +29 -55
- package/dist/custom-icons/index.js +29 -55
- package/dist/theme/index.cjs +13 -9
- package/dist/theme/index.js +14 -10
- package/dist/types/components/atoms/SplitButton.d.ts +21 -0
- package/dist/types/components/atoms/SplitButton.d.ts.map +1 -0
- package/dist/types/components/atoms/index.d.ts +2 -0
- package/dist/types/components/atoms/index.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/CreatableAutocomplete.d.ts +1 -1
- package/dist/types/components/molecules/Autocomplete/CreatableAutocomplete.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/ListBoxWithFilter.d.ts +21 -3
- package/dist/types/components/molecules/Autocomplete/ListBoxWithFilter.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/MultipleAutocomplete.d.ts +1 -1
- package/dist/types/components/molecules/Autocomplete/MultipleAutocomplete.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/index.d.ts +1 -0
- package/dist/types/components/molecules/Autocomplete/index.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/types.d.ts +59 -7
- package/dist/types/components/molecules/Autocomplete/types.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/useMultipleAutocomplete.d.ts +26 -1
- package/dist/types/components/molecules/Autocomplete/useMultipleAutocomplete.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/utils.d.ts +49 -0
- package/dist/types/components/molecules/Autocomplete/utils.d.ts.map +1 -1
- package/dist/types/components/molecules/Menu/Menu.d.ts.map +1 -1
- package/dist/types/components/molecules/Menu/MenuItem.d.ts.map +1 -1
- package/dist/types/components/molecules/Menu/MenuItemFilter.d.ts.map +1 -1
- package/dist/types/components/molecules/Menu/MenuList.d.ts.map +1 -1
- package/dist/types/components/molecules/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/index.d.ts +1 -0
- package/dist/types/components/organisms/CodeArea/index.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/types.d.ts +4 -0
- package/dist/types/components/organisms/CodeArea/types.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/utils.d.ts +34 -0
- package/dist/types/components/organisms/CodeArea/utils.d.ts.map +1 -1
- package/dist/types/theme/sections/components/forms.d.ts.map +1 -1
- package/dist/types/theme/sections/components/navigation.d.ts.map +1 -1
- package/dist/types/theme/theme-constants.d.ts +4 -0
- package/dist/types/theme/theme-constants.d.ts.map +1 -1
- package/dist/widgets/index.cjs +2 -2
- package/dist/widgets/index.js +2 -2
- package/package.json +1 -1
|
@@ -3,18 +3,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const material = require("@mui/material");
|
|
6
|
-
const TablePaginationActions = require("../TablePaginationActions-
|
|
6
|
+
const TablePaginationActions = require("../TablePaginationActions-mbbjzV6Y.cjs");
|
|
7
|
+
const ArrowDown = require("../ArrowDown-8fLj23Ge.cjs");
|
|
8
|
+
const OpenDiagonallyRight = require("../OpenDiagonallyRight-CM1tojUq.cjs");
|
|
7
9
|
const reactIntl = require("react-intl");
|
|
8
10
|
const iconsMaterial = require("@mui/icons-material");
|
|
9
|
-
const Alert$1 = require("../Alert-
|
|
11
|
+
const Alert$1 = require("../Alert-BzEgeyQJ.cjs");
|
|
10
12
|
require("cartocolor");
|
|
11
|
-
const MenuItem = require("../MenuItem-
|
|
12
|
-
const
|
|
13
|
+
const MenuItem = require("../MenuItem-lAxlHrDp.cjs");
|
|
14
|
+
const reactWindow = require("react-window");
|
|
13
15
|
const DatePicker$1 = require("@mui/x-date-pickers/DatePicker");
|
|
14
16
|
const xDatePickers = require("@mui/x-date-pickers");
|
|
15
17
|
const TimePicker$1 = require("@mui/x-date-pickers/TimePicker");
|
|
16
18
|
const DateTimePicker$1 = require("@mui/x-date-pickers/DateTimePicker");
|
|
17
|
-
const OpenDiagonallyRight = require("../OpenDiagonallyRight-BrRyCV4Q.cjs");
|
|
18
19
|
const reactCodemirror2 = require("react-codemirror2");
|
|
19
20
|
const colors = require("@mui/material/colors");
|
|
20
21
|
require("codemirror/lib/codemirror.css");
|
|
@@ -100,6 +101,102 @@ function _Button({
|
|
|
100
101
|
);
|
|
101
102
|
}
|
|
102
103
|
const Button = React.forwardRef(_Button);
|
|
104
|
+
const ButtonGroup = material.styled(material.ButtonGroup)(({ theme, size }) => ({
|
|
105
|
+
"& .MuiButton-root:last-child": {
|
|
106
|
+
padding: 0,
|
|
107
|
+
minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
function SplitButton({
|
|
111
|
+
options,
|
|
112
|
+
disabled,
|
|
113
|
+
loading,
|
|
114
|
+
loadingPosition,
|
|
115
|
+
onClick,
|
|
116
|
+
variant,
|
|
117
|
+
size,
|
|
118
|
+
color,
|
|
119
|
+
...otherProps
|
|
120
|
+
}) {
|
|
121
|
+
var _a;
|
|
122
|
+
const [open, setOpen] = React.useState(false);
|
|
123
|
+
const anchorRef = React.useRef(null);
|
|
124
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
125
|
+
const handleClick = () => {
|
|
126
|
+
onClick(options[selectedIndex]);
|
|
127
|
+
};
|
|
128
|
+
const handleMenuItemClick = (_, index) => {
|
|
129
|
+
setSelectedIndex(index);
|
|
130
|
+
setOpen(false);
|
|
131
|
+
};
|
|
132
|
+
const handleToggle = () => {
|
|
133
|
+
setOpen((prevOpen) => !prevOpen);
|
|
134
|
+
};
|
|
135
|
+
const handleClose = (event) => {
|
|
136
|
+
var _a2;
|
|
137
|
+
if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
setOpen(false);
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
143
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
144
|
+
ButtonGroup,
|
|
145
|
+
{
|
|
146
|
+
"data-name": "split-button",
|
|
147
|
+
ref: anchorRef,
|
|
148
|
+
variant,
|
|
149
|
+
size,
|
|
150
|
+
color,
|
|
151
|
+
...otherProps,
|
|
152
|
+
children: [
|
|
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, {}) })
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
+
material.Popper,
|
|
169
|
+
{
|
|
170
|
+
sx: { zIndex: 1 },
|
|
171
|
+
open,
|
|
172
|
+
anchorEl: anchorRef.current,
|
|
173
|
+
role: void 0,
|
|
174
|
+
transition: true,
|
|
175
|
+
disablePortal: true,
|
|
176
|
+
placement: "bottom-end",
|
|
177
|
+
children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
material.Grow,
|
|
179
|
+
{
|
|
180
|
+
...TransitionProps,
|
|
181
|
+
style: {
|
|
182
|
+
transformOrigin: placement === "bottom" ? "center top" : "center bottom"
|
|
183
|
+
},
|
|
184
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Paper, { elevation: 8, children: /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntime.jsx(material.MenuList, { autoFocusItem: true, sx: { paddingY: 1 }, children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
+
material.MenuItem,
|
|
186
|
+
{
|
|
187
|
+
disabled: option.disabled,
|
|
188
|
+
selected: index === selectedIndex,
|
|
189
|
+
onClick: (event) => handleMenuItemClick(event, index),
|
|
190
|
+
children: option.label
|
|
191
|
+
},
|
|
192
|
+
option.label
|
|
193
|
+
)) }) }) })
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] });
|
|
199
|
+
}
|
|
103
200
|
const Root$5 = material.styled(material.Box)(({ theme }) => ({
|
|
104
201
|
display: "flex",
|
|
105
202
|
alignItems: "center",
|
|
@@ -383,10 +480,10 @@ function ToggleButtonGroup({
|
|
|
383
480
|
}
|
|
384
481
|
const StyledMenu = material.styled(material.Menu, {
|
|
385
482
|
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
386
|
-
})(({
|
|
483
|
+
})(({ extended, width, height }) => ({
|
|
387
484
|
...extended && {
|
|
388
485
|
".MuiMenuItem-root": {
|
|
389
|
-
minHeight:
|
|
486
|
+
minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
|
|
390
487
|
}
|
|
391
488
|
},
|
|
392
489
|
...width && {
|
|
@@ -426,10 +523,10 @@ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
|
|
|
426
523
|
const Menu$1 = React.forwardRef(_Menu);
|
|
427
524
|
const StyledMenuList = material.styled(material.MenuList, {
|
|
428
525
|
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
429
|
-
})(({
|
|
526
|
+
})(({ extended, width, height }) => ({
|
|
430
527
|
...extended && {
|
|
431
528
|
".MuiMenuItem-root": {
|
|
432
|
-
minHeight:
|
|
529
|
+
minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
|
|
433
530
|
}
|
|
434
531
|
},
|
|
435
532
|
"&.MuiList-root": {
|
|
@@ -460,7 +557,8 @@ function _MenuList({ extended, width, height, ...otherProps }, ref) {
|
|
|
460
557
|
}
|
|
461
558
|
const MenuList = React.forwardRef(_MenuList);
|
|
462
559
|
const StyledMenuItem$1 = material.styled(MenuItem.MenuItem)(() => ({
|
|
463
|
-
marginTop: "0 !important"
|
|
560
|
+
marginTop: "0 !important",
|
|
561
|
+
marginBottom: "0 !important"
|
|
464
562
|
}));
|
|
465
563
|
const LinkFilter = material.styled(material.Link)(
|
|
466
564
|
({ disabled, theme }) => ({
|
|
@@ -700,12 +798,20 @@ function _MultipleSelectField({
|
|
|
700
798
|
},
|
|
701
799
|
children: [
|
|
702
800
|
showFilters && /* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
-
|
|
801
|
+
material.Box,
|
|
704
802
|
{
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
803
|
+
sx: {
|
|
804
|
+
mb: 1
|
|
805
|
+
},
|
|
806
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
807
|
+
MenuItemFilter,
|
|
808
|
+
{
|
|
809
|
+
areAllSelected,
|
|
810
|
+
areAnySelected,
|
|
811
|
+
selectAll,
|
|
812
|
+
selectAllDisabled
|
|
813
|
+
}
|
|
814
|
+
)
|
|
709
815
|
}
|
|
710
816
|
),
|
|
711
817
|
options == null ? void 0 : options.map((option) => {
|
|
@@ -1039,7 +1145,55 @@ const getDefaultOptionLabel = (option) => {
|
|
|
1039
1145
|
const createOptionWithMultiple = (option, multiple) => {
|
|
1040
1146
|
return typeof option !== "object" || option === null ? { value: option, multiple } : { ...option, multiple };
|
|
1041
1147
|
};
|
|
1042
|
-
const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxRuntime.
|
|
1148
|
+
const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-testid": "more-options-tag", children: [
|
|
1149
|
+
"+",
|
|
1150
|
+
more
|
|
1151
|
+
] });
|
|
1152
|
+
function createCounterRenderTags(formatCounter, options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
|
|
1153
|
+
const CounterRenderTags = (value) => {
|
|
1154
|
+
if (value.length === 0) {
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
const selectedCount = value.length;
|
|
1158
|
+
const totalCount = options.length;
|
|
1159
|
+
const text = formatCounter({
|
|
1160
|
+
selectedCount,
|
|
1161
|
+
totalCount,
|
|
1162
|
+
selectedItems: value,
|
|
1163
|
+
allItems: options,
|
|
1164
|
+
getOptionLabel
|
|
1165
|
+
});
|
|
1166
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1167
|
+
TablePaginationActions.Typography,
|
|
1168
|
+
{
|
|
1169
|
+
variant: size === "small" ? "body2" : "body1",
|
|
1170
|
+
component: "span",
|
|
1171
|
+
"data-testid": "counter-tag",
|
|
1172
|
+
sx: {
|
|
1173
|
+
ml: 1
|
|
1174
|
+
},
|
|
1175
|
+
children: text
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
};
|
|
1179
|
+
return CounterRenderTags;
|
|
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
|
+
}
|
|
1043
1197
|
function useAutocompleteRenderOption() {
|
|
1044
1198
|
const renderOption = (props, option, state, getOptionLabel, customIcon) => {
|
|
1045
1199
|
const {
|
|
@@ -1181,8 +1335,16 @@ function useMultipleAutocomplete({
|
|
|
1181
1335
|
options,
|
|
1182
1336
|
value,
|
|
1183
1337
|
onChange,
|
|
1184
|
-
getOptionLabel
|
|
1338
|
+
getOptionLabel,
|
|
1339
|
+
size,
|
|
1340
|
+
counterFormatter,
|
|
1341
|
+
counterText,
|
|
1342
|
+
allSelectedText
|
|
1185
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" });
|
|
1186
1348
|
const [multipleValue, setMultipleValue] = React.useState(
|
|
1187
1349
|
Array.isArray(value) ? value : value ? [value] : []
|
|
1188
1350
|
);
|
|
@@ -1216,13 +1378,23 @@ function useMultipleAutocomplete({
|
|
|
1216
1378
|
getOptionLabel
|
|
1217
1379
|
);
|
|
1218
1380
|
};
|
|
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
|
+
};
|
|
1219
1390
|
return {
|
|
1220
1391
|
multipleValue,
|
|
1221
1392
|
allSelected,
|
|
1222
1393
|
someSelected,
|
|
1223
1394
|
handleSelectAll,
|
|
1224
1395
|
handleChange,
|
|
1225
|
-
multipleRenderOption
|
|
1396
|
+
multipleRenderOption,
|
|
1397
|
+
getCounterRenderTags
|
|
1226
1398
|
};
|
|
1227
1399
|
}
|
|
1228
1400
|
function _ListboxWithFilter({
|
|
@@ -1232,15 +1404,50 @@ function _ListboxWithFilter({
|
|
|
1232
1404
|
someSelected,
|
|
1233
1405
|
handleSelectAll = () => void 0,
|
|
1234
1406
|
multiple,
|
|
1407
|
+
extended,
|
|
1408
|
+
itemHeight,
|
|
1409
|
+
maxListHeight = TablePaginationActions.MENU_LIST_MAX_SIZE,
|
|
1235
1410
|
...otherProps
|
|
1236
1411
|
}, ref) {
|
|
1412
|
+
const childrenArray = React.useMemo(() => {
|
|
1413
|
+
return React.Children.toArray(children);
|
|
1414
|
+
}, [children]);
|
|
1415
|
+
const defaultItemHeight = itemHeight ?? (extended ? TablePaginationActions.MENU_ITEM_SIZE_EXTENDED : TablePaginationActions.MENU_ITEM_SIZE_DEFAULT);
|
|
1416
|
+
const listboxHeight = React.useMemo(() => {
|
|
1417
|
+
const filterHeight = showFilters && multiple ? TablePaginationActions.MENU_ITEM_SIZE_EXTENDED : 0;
|
|
1418
|
+
const availableHeight = maxListHeight - filterHeight;
|
|
1419
|
+
const calculatedHeight = Math.min(
|
|
1420
|
+
childrenArray.length * defaultItemHeight,
|
|
1421
|
+
availableHeight
|
|
1422
|
+
);
|
|
1423
|
+
return Math.max(calculatedHeight, defaultItemHeight + 8);
|
|
1424
|
+
}, [
|
|
1425
|
+
showFilters,
|
|
1426
|
+
multiple,
|
|
1427
|
+
maxListHeight,
|
|
1428
|
+
childrenArray.length,
|
|
1429
|
+
defaultItemHeight
|
|
1430
|
+
]);
|
|
1431
|
+
const renderItem = ({
|
|
1432
|
+
index,
|
|
1433
|
+
style
|
|
1434
|
+
}) => {
|
|
1435
|
+
const child = childrenArray[index];
|
|
1436
|
+
if (!child) return null;
|
|
1437
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children: child });
|
|
1438
|
+
};
|
|
1237
1439
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1238
1440
|
"ul",
|
|
1239
1441
|
{
|
|
1240
1442
|
ref,
|
|
1241
1443
|
...otherProps,
|
|
1242
1444
|
role: "listbox",
|
|
1445
|
+
"data-list-height": listboxHeight,
|
|
1446
|
+
"data-item-height": defaultItemHeight,
|
|
1243
1447
|
"aria-multiselectable": multiple,
|
|
1448
|
+
style: {
|
|
1449
|
+
maxHeight: maxListHeight + defaultItemHeight
|
|
1450
|
+
},
|
|
1244
1451
|
children: [
|
|
1245
1452
|
showFilters && multiple && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
1453
|
MenuItemFilter,
|
|
@@ -1250,7 +1457,16 @@ function _ListboxWithFilter({
|
|
|
1250
1457
|
selectAll: handleSelectAll
|
|
1251
1458
|
}
|
|
1252
1459
|
),
|
|
1253
|
-
|
|
1460
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1461
|
+
reactWindow.FixedSizeList,
|
|
1462
|
+
{
|
|
1463
|
+
height: listboxHeight,
|
|
1464
|
+
width: "100%",
|
|
1465
|
+
itemCount: childrenArray.length,
|
|
1466
|
+
itemSize: defaultItemHeight,
|
|
1467
|
+
children: renderItem
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1254
1470
|
]
|
|
1255
1471
|
}
|
|
1256
1472
|
);
|
|
@@ -1265,10 +1481,18 @@ function _CreatableAutocomplete({
|
|
|
1265
1481
|
disabled,
|
|
1266
1482
|
loading,
|
|
1267
1483
|
showFilters,
|
|
1484
|
+
showCounter = false,
|
|
1485
|
+
counterFormatter,
|
|
1486
|
+
counterText,
|
|
1487
|
+
allSelectedText,
|
|
1268
1488
|
options = [],
|
|
1269
1489
|
value,
|
|
1270
1490
|
onChange,
|
|
1271
1491
|
getLimitTagsText,
|
|
1492
|
+
renderTags,
|
|
1493
|
+
itemHeight,
|
|
1494
|
+
maxListHeight,
|
|
1495
|
+
extended,
|
|
1272
1496
|
...props
|
|
1273
1497
|
}, ref) {
|
|
1274
1498
|
const { freeSolo = true, ...otherProps } = props;
|
|
@@ -1277,11 +1501,17 @@ function _CreatableAutocomplete({
|
|
|
1277
1501
|
allSelected,
|
|
1278
1502
|
someSelected,
|
|
1279
1503
|
handleSelectAll,
|
|
1280
|
-
handleChange
|
|
1504
|
+
handleChange,
|
|
1505
|
+
getCounterRenderTags
|
|
1281
1506
|
} = useMultipleAutocomplete({
|
|
1282
1507
|
options,
|
|
1283
1508
|
value,
|
|
1284
|
-
onChange
|
|
1509
|
+
onChange,
|
|
1510
|
+
getOptionLabel,
|
|
1511
|
+
size: props.size,
|
|
1512
|
+
counterFormatter,
|
|
1513
|
+
counterText,
|
|
1514
|
+
allSelectedText
|
|
1285
1515
|
});
|
|
1286
1516
|
const {
|
|
1287
1517
|
creatableFilterOptions,
|
|
@@ -1293,6 +1523,17 @@ function _CreatableAutocomplete({
|
|
|
1293
1523
|
newItemIcon,
|
|
1294
1524
|
multiple
|
|
1295
1525
|
});
|
|
1526
|
+
const listboxProps = {
|
|
1527
|
+
showFilters,
|
|
1528
|
+
allSelected,
|
|
1529
|
+
someSelected,
|
|
1530
|
+
handleSelectAll,
|
|
1531
|
+
multiple,
|
|
1532
|
+
itemHeight,
|
|
1533
|
+
maxListHeight,
|
|
1534
|
+
extended
|
|
1535
|
+
};
|
|
1536
|
+
const finalRenderTags = showCounter && multiple && !renderTags ? getCounterRenderTags() : renderTags;
|
|
1296
1537
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1297
1538
|
material.Autocomplete,
|
|
1298
1539
|
{
|
|
@@ -1304,18 +1545,13 @@ function _CreatableAutocomplete({
|
|
|
1304
1545
|
filterOptions: creatableFilterOptions,
|
|
1305
1546
|
getOptionLabel: creatableOptionLabel,
|
|
1306
1547
|
renderOption: creatableRenderOption,
|
|
1548
|
+
renderTags: finalRenderTags,
|
|
1307
1549
|
freeSolo,
|
|
1308
1550
|
forcePopupIcon: true,
|
|
1309
1551
|
multiple,
|
|
1310
1552
|
disableCloseOnSelect: disableCloseOnSelect ?? multiple,
|
|
1311
1553
|
ListboxComponent: ListboxWithFilter,
|
|
1312
|
-
ListboxProps:
|
|
1313
|
-
showFilters,
|
|
1314
|
-
allSelected,
|
|
1315
|
-
someSelected,
|
|
1316
|
-
handleSelectAll,
|
|
1317
|
-
multiple
|
|
1318
|
-
},
|
|
1554
|
+
ListboxProps: listboxProps,
|
|
1319
1555
|
getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
|
|
1320
1556
|
disabled: disabled || loading,
|
|
1321
1557
|
popupIcon: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}),
|
|
@@ -1330,11 +1566,19 @@ function _MultipleAutocomplete({
|
|
|
1330
1566
|
disabled,
|
|
1331
1567
|
loading,
|
|
1332
1568
|
showFilters,
|
|
1569
|
+
showCounter = false,
|
|
1570
|
+
counterFormatter,
|
|
1571
|
+
counterText,
|
|
1572
|
+
allSelectedText,
|
|
1333
1573
|
options,
|
|
1334
1574
|
value,
|
|
1335
1575
|
onChange,
|
|
1336
1576
|
getOptionLabel,
|
|
1337
1577
|
getLimitTagsText,
|
|
1578
|
+
renderTags,
|
|
1579
|
+
itemHeight,
|
|
1580
|
+
maxListHeight,
|
|
1581
|
+
extended,
|
|
1338
1582
|
...props
|
|
1339
1583
|
}, ref) {
|
|
1340
1584
|
const {
|
|
@@ -1343,13 +1587,29 @@ function _MultipleAutocomplete({
|
|
|
1343
1587
|
someSelected,
|
|
1344
1588
|
handleSelectAll,
|
|
1345
1589
|
handleChange,
|
|
1346
|
-
multipleRenderOption
|
|
1590
|
+
multipleRenderOption,
|
|
1591
|
+
getCounterRenderTags
|
|
1347
1592
|
} = useMultipleAutocomplete({
|
|
1348
1593
|
options,
|
|
1349
1594
|
value,
|
|
1350
1595
|
onChange,
|
|
1351
|
-
getOptionLabel
|
|
1596
|
+
getOptionLabel,
|
|
1597
|
+
size: props.size,
|
|
1598
|
+
counterFormatter,
|
|
1599
|
+
counterText,
|
|
1600
|
+
allSelectedText
|
|
1352
1601
|
});
|
|
1602
|
+
const listboxProps = {
|
|
1603
|
+
showFilters,
|
|
1604
|
+
allSelected,
|
|
1605
|
+
someSelected,
|
|
1606
|
+
handleSelectAll,
|
|
1607
|
+
multiple: true,
|
|
1608
|
+
itemHeight,
|
|
1609
|
+
maxListHeight,
|
|
1610
|
+
extended
|
|
1611
|
+
};
|
|
1612
|
+
const finalRenderTags = showCounter && !renderTags ? getCounterRenderTags() : renderTags;
|
|
1353
1613
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1354
1614
|
material.Autocomplete,
|
|
1355
1615
|
{
|
|
@@ -1360,14 +1620,9 @@ function _MultipleAutocomplete({
|
|
|
1360
1620
|
onChange: handleChange,
|
|
1361
1621
|
getOptionLabel,
|
|
1362
1622
|
renderOption: renderOption ?? multipleRenderOption,
|
|
1623
|
+
renderTags: finalRenderTags,
|
|
1363
1624
|
ListboxComponent: ListboxWithFilter,
|
|
1364
|
-
ListboxProps:
|
|
1365
|
-
showFilters,
|
|
1366
|
-
allSelected,
|
|
1367
|
-
someSelected,
|
|
1368
|
-
handleSelectAll,
|
|
1369
|
-
multiple: true
|
|
1370
|
-
},
|
|
1625
|
+
ListboxProps: listboxProps,
|
|
1371
1626
|
multiple: true,
|
|
1372
1627
|
getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
|
|
1373
1628
|
disableCloseOnSelect,
|
|
@@ -3114,8 +3369,9 @@ const CodeAreaTheme = material.styled(material.Box, {
|
|
|
3114
3369
|
right: 0,
|
|
3115
3370
|
zIndex: 1
|
|
3116
3371
|
},
|
|
3117
|
-
"
|
|
3118
|
-
color: theme.palette.text.primary
|
|
3372
|
+
".CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket": {
|
|
3373
|
+
color: theme.palette.text.primary,
|
|
3374
|
+
fontVariantLigatures: "no-common-ligatures"
|
|
3119
3375
|
},
|
|
3120
3376
|
"& .CodeMirror pre.CodeMirror-placeholder": {
|
|
3121
3377
|
color: theme.palette.text.hint
|
|
@@ -3133,7 +3389,7 @@ const CodeAreaTheme = material.styled(material.Box, {
|
|
|
3133
3389
|
"& .cm-number, & .cm-property, & .cm-builtin": {
|
|
3134
3390
|
color: colors.red[700]
|
|
3135
3391
|
},
|
|
3136
|
-
"& .cm-comment": {
|
|
3392
|
+
"& .cm-comment, & .cm-quote": {
|
|
3137
3393
|
color: theme.palette.text.secondary
|
|
3138
3394
|
},
|
|
3139
3395
|
"& .cm-variable": {
|
|
@@ -3142,9 +3398,18 @@ const CodeAreaTheme = material.styled(material.Box, {
|
|
|
3142
3398
|
"& .cm-variable-2": {
|
|
3143
3399
|
color: theme.palette.text.primary
|
|
3144
3400
|
},
|
|
3145
|
-
"& .cm-punctuation, & .cm-def
|
|
3401
|
+
"& .cm-punctuation, & .cm-def": {
|
|
3146
3402
|
color: colors.blue[800]
|
|
3147
3403
|
},
|
|
3404
|
+
"& .cm-image-alt-text, & .cm-link": {
|
|
3405
|
+
color: colors.green[800],
|
|
3406
|
+
textDecoration: "none"
|
|
3407
|
+
},
|
|
3408
|
+
// Custom inline link styling .cm-inline-url
|
|
3409
|
+
"& .cm-url, & .cm-inline-url": {
|
|
3410
|
+
color: colors.blue[800],
|
|
3411
|
+
textDecoration: "none"
|
|
3412
|
+
},
|
|
3148
3413
|
"& .cm-variable-3, & .cm-type": {
|
|
3149
3414
|
color: colors.indigo[800]
|
|
3150
3415
|
},
|
|
@@ -3158,20 +3423,23 @@ const CodeAreaTheme = material.styled(material.Box, {
|
|
|
3158
3423
|
"& .CodeMirror-selected": {
|
|
3159
3424
|
background: colors.blue[800]
|
|
3160
3425
|
},
|
|
3161
|
-
"& .cm-header
|
|
3162
|
-
|
|
3426
|
+
"& .cm-header": {
|
|
3427
|
+
color: colors.red[700],
|
|
3428
|
+
...theme.typography.code3,
|
|
3429
|
+
fontWeight: theme.typography.fontWeightBold
|
|
3163
3430
|
},
|
|
3164
|
-
"& .cm-header-
|
|
3165
|
-
|
|
3431
|
+
"& .cm-header-4, & .cm-header-5, & .cm-header-6": {
|
|
3432
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
3166
3433
|
},
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
fontSize: theme.typography.h5.fontSize
|
|
3434
|
+
// Custom inline code styling
|
|
3435
|
+
"& .cm-inline-code": {
|
|
3436
|
+
backgroundColor: theme.palette.black[4],
|
|
3437
|
+
color: colors.purple[500]
|
|
3172
3438
|
},
|
|
3173
|
-
|
|
3174
|
-
|
|
3439
|
+
// Custom code block styling
|
|
3440
|
+
"& .cm-code-block": {
|
|
3441
|
+
backgroundColor: theme.palette.black[4],
|
|
3442
|
+
marginRight: theme.spacing(2)
|
|
3175
3443
|
},
|
|
3176
3444
|
...size === "small" && {
|
|
3177
3445
|
"& .CodeMirror": {
|
|
@@ -3207,6 +3475,100 @@ function findCodeAreaControlCodeOccurrences(content) {
|
|
|
3207
3475
|
}
|
|
3208
3476
|
return matches;
|
|
3209
3477
|
}
|
|
3478
|
+
const editorMarkers = /* @__PURE__ */ new WeakMap();
|
|
3479
|
+
function clearMarkersForClass(editor, className) {
|
|
3480
|
+
var _a, _b;
|
|
3481
|
+
const markers = (_a = editorMarkers.get(editor)) == null ? void 0 : _a.get(className);
|
|
3482
|
+
if (!markers) return;
|
|
3483
|
+
markers.forEach((marker) => {
|
|
3484
|
+
if (marker.find()) {
|
|
3485
|
+
marker.clear();
|
|
3486
|
+
}
|
|
3487
|
+
});
|
|
3488
|
+
(_b = editorMarkers.get(editor)) == null ? void 0 : _b.delete(className);
|
|
3489
|
+
}
|
|
3490
|
+
function storeMarkersForClass(editor, className, markers) {
|
|
3491
|
+
if (!editorMarkers.has(editor)) {
|
|
3492
|
+
editorMarkers.set(editor, /* @__PURE__ */ new Map());
|
|
3493
|
+
}
|
|
3494
|
+
const editorMap = editorMarkers.get(editor);
|
|
3495
|
+
if (editorMap) {
|
|
3496
|
+
editorMap.set(className, markers);
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
function CodeAreaMarkTextPattern(editor, pattern, options, excludePatterns) {
|
|
3500
|
+
const { className } = options;
|
|
3501
|
+
clearMarkersForClass(editor, className);
|
|
3502
|
+
const doc = editor.getDoc();
|
|
3503
|
+
const content = doc.getValue();
|
|
3504
|
+
const excludeRanges = (excludePatterns == null ? void 0 : excludePatterns.flatMap(
|
|
3505
|
+
(excludePattern) => Array.from(content.matchAll(excludePattern), (match) => ({
|
|
3506
|
+
start: match.index,
|
|
3507
|
+
end: match.index + match[0].length
|
|
3508
|
+
}))
|
|
3509
|
+
)) ?? [];
|
|
3510
|
+
const markers = Array.from(content.matchAll(pattern)).filter((match) => {
|
|
3511
|
+
if (excludeRanges.some(
|
|
3512
|
+
(range) => match.index >= range.start && match.index < range.end
|
|
3513
|
+
)) {
|
|
3514
|
+
return false;
|
|
3515
|
+
}
|
|
3516
|
+
return !match[1] || match[1].trim().length > 0;
|
|
3517
|
+
}).map((match) => {
|
|
3518
|
+
const startPos = doc.posFromIndex(match.index);
|
|
3519
|
+
const endPos = doc.posFromIndex(match.index + match[0].length);
|
|
3520
|
+
return editor.markText(startPos, endPos, {
|
|
3521
|
+
atomic: false,
|
|
3522
|
+
clearOnEnter: false,
|
|
3523
|
+
...options
|
|
3524
|
+
});
|
|
3525
|
+
});
|
|
3526
|
+
if (markers.length > 0) {
|
|
3527
|
+
storeMarkersForClass(editor, className, markers);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
function markInlineCode(editor, className = "cm-inline-code") {
|
|
3531
|
+
const inlineCodePattern = /`([^`\n\r]+)`/g;
|
|
3532
|
+
const codeBlockPattern = /```[\s\S]*?```/g;
|
|
3533
|
+
CodeAreaMarkTextPattern(
|
|
3534
|
+
editor,
|
|
3535
|
+
inlineCodePattern,
|
|
3536
|
+
{
|
|
3537
|
+
className
|
|
3538
|
+
},
|
|
3539
|
+
[codeBlockPattern]
|
|
3540
|
+
);
|
|
3541
|
+
}
|
|
3542
|
+
function markInlineLinks(editor, className = "cm-inline-url") {
|
|
3543
|
+
const inlineLinkPattern = /<((?:https?:\/\/[^\s<>]+)|(?:[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+))>/g;
|
|
3544
|
+
const codeBlockPattern = /```[\s\S]*?```/g;
|
|
3545
|
+
CodeAreaMarkTextPattern(
|
|
3546
|
+
editor,
|
|
3547
|
+
inlineLinkPattern,
|
|
3548
|
+
{
|
|
3549
|
+
className
|
|
3550
|
+
},
|
|
3551
|
+
[codeBlockPattern]
|
|
3552
|
+
);
|
|
3553
|
+
}
|
|
3554
|
+
function markCodeBlocks(editor, className = "cm-code-block") {
|
|
3555
|
+
const doc = editor.getDoc();
|
|
3556
|
+
const content = doc.getValue();
|
|
3557
|
+
const lineCount = content.split("\n").length;
|
|
3558
|
+
for (let i = 0; i < lineCount; i++) {
|
|
3559
|
+
["background", "wrap", "text"].forEach(
|
|
3560
|
+
(where) => editor.removeLineClass(i, where, className)
|
|
3561
|
+
);
|
|
3562
|
+
}
|
|
3563
|
+
const codeBlockPattern = /```[\s\S]*?(?:```|$)/g;
|
|
3564
|
+
Array.from(content.matchAll(codeBlockPattern)).forEach((match) => {
|
|
3565
|
+
const startPos = doc.posFromIndex(match.index);
|
|
3566
|
+
const endPos = doc.posFromIndex(match.index + match[0].length);
|
|
3567
|
+
for (let lineNum = startPos.line; lineNum <= endPos.line; lineNum++) {
|
|
3568
|
+
editor.addLineClass(lineNum, "wrap", className);
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3210
3572
|
function foldCode(editor, { from, to }) {
|
|
3211
3573
|
editor.foldCode(
|
|
3212
3574
|
0,
|
|
@@ -3247,6 +3609,7 @@ function CodeAreaInput({
|
|
|
3247
3609
|
const codeMirrorOptions = {
|
|
3248
3610
|
mode: "sql",
|
|
3249
3611
|
theme: "light",
|
|
3612
|
+
addModeClass: true,
|
|
3250
3613
|
lineNumbers: true,
|
|
3251
3614
|
lineWrapping: true,
|
|
3252
3615
|
extraKeys: { "Ctrl-Space": "autocomplete" },
|
|
@@ -3277,6 +3640,13 @@ function CodeAreaInput({
|
|
|
3277
3640
|
}
|
|
3278
3641
|
initialFoldingDoneRef.current = true;
|
|
3279
3642
|
}, [value, editor, autoFoldControlBlocks]);
|
|
3643
|
+
React.useEffect(() => {
|
|
3644
|
+
const mode = typeof (options == null ? void 0 : options.mode) === "object" && options.mode !== null ? options.mode.name : options == null ? void 0 : options.mode;
|
|
3645
|
+
if (mode !== "markdown" || !editor || !value) return;
|
|
3646
|
+
markInlineCode(editor);
|
|
3647
|
+
markInlineLinks(editor);
|
|
3648
|
+
markCodeBlocks(editor);
|
|
3649
|
+
}, [editor, value, options == null ? void 0 : options.mode]);
|
|
3280
3650
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3281
3651
|
CodeAreaTheme,
|
|
3282
3652
|
{
|
|
@@ -4500,6 +4870,7 @@ exports.CodeAreaField = CodeAreaField;
|
|
|
4500
4870
|
exports.CodeAreaFooter = CodeAreaFooter;
|
|
4501
4871
|
exports.CodeAreaHeader = CodeAreaHeader;
|
|
4502
4872
|
exports.CodeAreaInput = CodeAreaInput;
|
|
4873
|
+
exports.CodeAreaMarkTextPattern = CodeAreaMarkTextPattern;
|
|
4503
4874
|
exports.CopiableComponent = CopiableComponent;
|
|
4504
4875
|
exports.CreatableAutocomplete = CreatableAutocomplete;
|
|
4505
4876
|
exports.DatePicker = DatePicker;
|
|
@@ -4524,6 +4895,7 @@ exports.MultipleSelectField = MultipleSelectField;
|
|
|
4524
4895
|
exports.PasswordField = PasswordField;
|
|
4525
4896
|
exports.SelectField = SelectField;
|
|
4526
4897
|
exports.Snackbar = Snackbar;
|
|
4898
|
+
exports.SplitButton = SplitButton;
|
|
4527
4899
|
exports.Tag = Tag;
|
|
4528
4900
|
exports.TimePicker = TimePicker;
|
|
4529
4901
|
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
@@ -4531,5 +4903,7 @@ exports.TooltipData = TooltipData;
|
|
|
4531
4903
|
exports.UploadField = UploadField;
|
|
4532
4904
|
exports.UploadFieldBase = UploadFieldBase;
|
|
4533
4905
|
exports.copyString = copyString;
|
|
4906
|
+
exports.createCounterFormatter = createCounterFormatter;
|
|
4907
|
+
exports.createCounterRenderTags = createCounterRenderTags;
|
|
4534
4908
|
exports.dialogDimensionsBySize = dialogDimensionsBySize;
|
|
4535
4909
|
exports.useCopyValue = useCopyValue;
|