@carto/meridian-ds 1.4.8 → 1.5.0-alpha-virtual-autocomplete.1
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 +7 -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 +378 -52
- package/dist/components/index.js +384 -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 +17 -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 +18 -0
- 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/types.d.ts +61 -3
- package/dist/types/components/molecules/Autocomplete/types.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/useMultipleAutocomplete.d.ts +3 -1
- package/dist/types/components/molecules/Autocomplete/useMultipleAutocomplete.d.ts.map +1 -1
- package/dist/types/components/molecules/Autocomplete/utils.d.ts +9 -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
package/dist/components/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useState, useEffect, useMemo,
|
|
3
|
-
import { styled, Box, Button as Button$1, CircularProgress, TextField, InputAdornment, IconButton, Tooltip, Select,
|
|
4
|
-
import { T as Typography, c as ICON_SIZE_SMALL, u as useImperativeIntl, N as NOTIFICATION_DURATION_IN_MS, A as APPBAR_SIZE } from "../TablePaginationActions-
|
|
5
|
-
import { a } from "../TablePaginationActions-
|
|
2
|
+
import { forwardRef, useState, useRef, useEffect, useMemo, Fragment as Fragment$1, useImperativeHandle, useCallback } from "react";
|
|
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
|
+
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
|
+
import { a } from "../TablePaginationActions-Cz5Hbi6N.js";
|
|
6
|
+
import { A as ArrowDown } from "../ArrowDown-CY_wMVJT.js";
|
|
7
|
+
import { A as ArrowUp, O as OpenDiagonallyRight, C as CloseDiagonallyRight } from "../OpenDiagonallyRight-CSm5GYYJ.js";
|
|
6
8
|
import { useIntl } from "react-intl";
|
|
7
9
|
import { VisibilityOffOutlined, VisibilityOutlined, Cancel, AddCircleOutlineOutlined, ContentCopyOutlined, CloseOutlined, MenuOutlined, HelpOutline, TodayOutlined, MoreVertOutlined, ErrorOutline, Check } from "@mui/icons-material";
|
|
8
|
-
import { I as IconButton$1, A as Alert$1 } from "../Alert-
|
|
10
|
+
import { I as IconButton$1, A as Alert$1 } from "../Alert-CnaTtNJd.js";
|
|
9
11
|
import "cartocolor";
|
|
10
|
-
import { M as MenuItem$1 } from "../MenuItem-
|
|
11
|
-
import {
|
|
12
|
+
import { M as MenuItem$1 } from "../MenuItem-D6wJym7Z.js";
|
|
13
|
+
import { FixedSizeList } from "react-window";
|
|
12
14
|
import { DatePicker as DatePicker$1 } from "@mui/x-date-pickers/DatePicker";
|
|
13
15
|
import { PickersDay as PickersDay$1 } from "@mui/x-date-pickers";
|
|
14
16
|
import { TimePicker as TimePicker$1 } from "@mui/x-date-pickers/TimePicker";
|
|
15
17
|
import { DateTimePicker as DateTimePicker$1 } from "@mui/x-date-pickers/DateTimePicker";
|
|
16
|
-
import { O as OpenDiagonallyRight, C as CloseDiagonallyRight } from "../OpenDiagonallyRight-5HZXh46V.js";
|
|
17
18
|
import { Controlled, UnControlled } from "react-codemirror2";
|
|
18
|
-
import { lime, blue, purple, teal, red, indigo } from "@mui/material/colors";
|
|
19
|
+
import { lime, blue, purple, teal, red, green, indigo } from "@mui/material/colors";
|
|
19
20
|
import "codemirror/lib/codemirror.css";
|
|
20
21
|
import "codemirror/lib/codemirror.js";
|
|
21
22
|
import "codemirror/mode/sql/sql.js";
|
|
@@ -38,7 +39,7 @@ import "codemirror/addon/fold/xml-fold.js";
|
|
|
38
39
|
import "codemirror/addon/fold/indent-fold.js";
|
|
39
40
|
import "codemirror/addon/fold/markdown-fold.js";
|
|
40
41
|
import "codemirror/addon/fold/comment-fold.js";
|
|
41
|
-
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
42
|
+
import ClickAwayListener$1 from "@mui/material/ClickAwayListener";
|
|
42
43
|
const IndicatorIcon = styled(Box)({
|
|
43
44
|
position: "absolute",
|
|
44
45
|
top: 0,
|
|
@@ -99,6 +100,90 @@ function _Button({
|
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
102
|
const Button = forwardRef(_Button);
|
|
103
|
+
const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
|
|
104
|
+
"& .MuiButton-root:last-child": {
|
|
105
|
+
padding: 0,
|
|
106
|
+
minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
|
|
107
|
+
}
|
|
108
|
+
}));
|
|
109
|
+
function SplitButton({
|
|
110
|
+
options,
|
|
111
|
+
onClick,
|
|
112
|
+
variant,
|
|
113
|
+
size,
|
|
114
|
+
color,
|
|
115
|
+
...otherProps
|
|
116
|
+
}) {
|
|
117
|
+
var _a;
|
|
118
|
+
const [open, setOpen] = useState(false);
|
|
119
|
+
const anchorRef = useRef(null);
|
|
120
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
121
|
+
const handleClick = () => {
|
|
122
|
+
onClick(options[selectedIndex]);
|
|
123
|
+
};
|
|
124
|
+
const handleMenuItemClick = (_, index) => {
|
|
125
|
+
setSelectedIndex(index);
|
|
126
|
+
setOpen(false);
|
|
127
|
+
};
|
|
128
|
+
const handleToggle = () => {
|
|
129
|
+
setOpen((prevOpen) => !prevOpen);
|
|
130
|
+
};
|
|
131
|
+
const handleClose = (event) => {
|
|
132
|
+
var _a2;
|
|
133
|
+
if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
setOpen(false);
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
/* @__PURE__ */ jsxs(
|
|
140
|
+
ButtonGroup,
|
|
141
|
+
{
|
|
142
|
+
"data-name": "split-button",
|
|
143
|
+
ref: anchorRef,
|
|
144
|
+
variant,
|
|
145
|
+
size,
|
|
146
|
+
color,
|
|
147
|
+
...otherProps,
|
|
148
|
+
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, {}) })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
Popper,
|
|
156
|
+
{
|
|
157
|
+
sx: { zIndex: 1 },
|
|
158
|
+
open,
|
|
159
|
+
anchorEl: anchorRef.current,
|
|
160
|
+
role: void 0,
|
|
161
|
+
transition: true,
|
|
162
|
+
disablePortal: true,
|
|
163
|
+
placement: "bottom-end",
|
|
164
|
+
children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
|
|
165
|
+
Grow,
|
|
166
|
+
{
|
|
167
|
+
...TransitionProps,
|
|
168
|
+
style: {
|
|
169
|
+
transformOrigin: placement === "bottom" ? "center top" : "center bottom"
|
|
170
|
+
},
|
|
171
|
+
children: /* @__PURE__ */ jsx(Paper, { elevation: 8, children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsx(MenuList$1, { autoFocusItem: true, sx: { paddingY: 1 }, children: options.map((option, index) => /* @__PURE__ */ jsx(
|
|
172
|
+
MenuItem,
|
|
173
|
+
{
|
|
174
|
+
disabled: option.disabled,
|
|
175
|
+
selected: index === selectedIndex,
|
|
176
|
+
onClick: (event) => handleMenuItemClick(event, index),
|
|
177
|
+
children: option.label
|
|
178
|
+
},
|
|
179
|
+
option.label
|
|
180
|
+
)) }) }) })
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] });
|
|
186
|
+
}
|
|
102
187
|
const Root$5 = styled(Box)(({ theme }) => ({
|
|
103
188
|
display: "flex",
|
|
104
189
|
alignItems: "center",
|
|
@@ -382,10 +467,10 @@ function ToggleButtonGroup({
|
|
|
382
467
|
}
|
|
383
468
|
const StyledMenu = styled(Menu$2, {
|
|
384
469
|
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
385
|
-
})(({
|
|
470
|
+
})(({ extended, width, height }) => ({
|
|
386
471
|
...extended && {
|
|
387
472
|
".MuiMenuItem-root": {
|
|
388
|
-
minHeight:
|
|
473
|
+
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
389
474
|
}
|
|
390
475
|
},
|
|
391
476
|
...width && {
|
|
@@ -425,10 +510,10 @@ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
|
|
|
425
510
|
const Menu$1 = forwardRef(_Menu);
|
|
426
511
|
const StyledMenuList = styled(MenuList$1, {
|
|
427
512
|
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
428
|
-
})(({
|
|
513
|
+
})(({ extended, width, height }) => ({
|
|
429
514
|
...extended && {
|
|
430
515
|
".MuiMenuItem-root": {
|
|
431
|
-
minHeight:
|
|
516
|
+
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
432
517
|
}
|
|
433
518
|
},
|
|
434
519
|
"&.MuiList-root": {
|
|
@@ -459,7 +544,8 @@ function _MenuList({ extended, width, height, ...otherProps }, ref) {
|
|
|
459
544
|
}
|
|
460
545
|
const MenuList = forwardRef(_MenuList);
|
|
461
546
|
const StyledMenuItem$1 = styled(MenuItem$1)(() => ({
|
|
462
|
-
marginTop: "0 !important"
|
|
547
|
+
marginTop: "0 !important",
|
|
548
|
+
marginBottom: "0 !important"
|
|
463
549
|
}));
|
|
464
550
|
const LinkFilter = styled(Link)(
|
|
465
551
|
({ disabled, theme }) => ({
|
|
@@ -699,12 +785,20 @@ function _MultipleSelectField({
|
|
|
699
785
|
},
|
|
700
786
|
children: [
|
|
701
787
|
showFilters && /* @__PURE__ */ jsx(
|
|
702
|
-
|
|
788
|
+
Box,
|
|
703
789
|
{
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
790
|
+
sx: {
|
|
791
|
+
mb: 1
|
|
792
|
+
},
|
|
793
|
+
children: /* @__PURE__ */ jsx(
|
|
794
|
+
MenuItemFilter,
|
|
795
|
+
{
|
|
796
|
+
areAllSelected,
|
|
797
|
+
areAnySelected,
|
|
798
|
+
selectAll,
|
|
799
|
+
selectAllDisabled
|
|
800
|
+
}
|
|
801
|
+
)
|
|
708
802
|
}
|
|
709
803
|
),
|
|
710
804
|
options == null ? void 0 : options.map((option) => {
|
|
@@ -1038,7 +1132,40 @@ const getDefaultOptionLabel = (option) => {
|
|
|
1038
1132
|
const createOptionWithMultiple = (option, multiple) => {
|
|
1039
1133
|
return typeof option !== "object" || option === null ? { value: option, multiple } : { ...option, multiple };
|
|
1040
1134
|
};
|
|
1041
|
-
const getDefaultLimitTagsText = (more) => /* @__PURE__ */
|
|
1135
|
+
const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxs("span", { "data-testid": "more-options-tag", children: [
|
|
1136
|
+
"+",
|
|
1137
|
+
more
|
|
1138
|
+
] });
|
|
1139
|
+
function createCounterRenderTags(counterText = "selected", options = [], size = "small", getOptionLabel = getDefaultOptionLabel) {
|
|
1140
|
+
const CounterRenderTags = (value) => {
|
|
1141
|
+
if (value.length === 0) {
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
const totalCount = options.length;
|
|
1145
|
+
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
|
+
}
|
|
1154
|
+
return /* @__PURE__ */ jsx(
|
|
1155
|
+
Typography,
|
|
1156
|
+
{
|
|
1157
|
+
variant: size === "small" ? "body2" : "body1",
|
|
1158
|
+
component: "span",
|
|
1159
|
+
"data-testid": "counter-tag",
|
|
1160
|
+
sx: {
|
|
1161
|
+
ml: 1
|
|
1162
|
+
},
|
|
1163
|
+
children: text
|
|
1164
|
+
}
|
|
1165
|
+
);
|
|
1166
|
+
};
|
|
1167
|
+
return CounterRenderTags;
|
|
1168
|
+
}
|
|
1042
1169
|
function useAutocompleteRenderOption() {
|
|
1043
1170
|
const renderOption = (props, option, state, getOptionLabel, customIcon) => {
|
|
1044
1171
|
const {
|
|
@@ -1180,7 +1307,8 @@ function useMultipleAutocomplete({
|
|
|
1180
1307
|
options,
|
|
1181
1308
|
value,
|
|
1182
1309
|
onChange,
|
|
1183
|
-
getOptionLabel
|
|
1310
|
+
getOptionLabel,
|
|
1311
|
+
size
|
|
1184
1312
|
}) {
|
|
1185
1313
|
const [multipleValue, setMultipleValue] = useState(
|
|
1186
1314
|
Array.isArray(value) ? value : value ? [value] : []
|
|
@@ -1215,13 +1343,20 @@ function useMultipleAutocomplete({
|
|
|
1215
1343
|
getOptionLabel
|
|
1216
1344
|
);
|
|
1217
1345
|
};
|
|
1346
|
+
const getCounterRenderTags = () => createCounterRenderTags(
|
|
1347
|
+
"selected",
|
|
1348
|
+
options,
|
|
1349
|
+
size,
|
|
1350
|
+
getOptionLabel ? (option) => getOptionLabel(option) : void 0
|
|
1351
|
+
);
|
|
1218
1352
|
return {
|
|
1219
1353
|
multipleValue,
|
|
1220
1354
|
allSelected,
|
|
1221
1355
|
someSelected,
|
|
1222
1356
|
handleSelectAll,
|
|
1223
1357
|
handleChange,
|
|
1224
|
-
multipleRenderOption
|
|
1358
|
+
multipleRenderOption,
|
|
1359
|
+
getCounterRenderTags
|
|
1225
1360
|
};
|
|
1226
1361
|
}
|
|
1227
1362
|
function _ListboxWithFilter({
|
|
@@ -1231,15 +1366,53 @@ function _ListboxWithFilter({
|
|
|
1231
1366
|
someSelected,
|
|
1232
1367
|
handleSelectAll = () => void 0,
|
|
1233
1368
|
multiple,
|
|
1369
|
+
extended,
|
|
1370
|
+
itemHeight,
|
|
1371
|
+
maxListHeight = MENU_LIST_MAX_SIZE,
|
|
1234
1372
|
...otherProps
|
|
1235
1373
|
}, ref) {
|
|
1374
|
+
const childrenArray = useMemo(() => {
|
|
1375
|
+
if (Array.isArray(children)) {
|
|
1376
|
+
return children;
|
|
1377
|
+
}
|
|
1378
|
+
return children ? [children] : [];
|
|
1379
|
+
}, [children]);
|
|
1380
|
+
const defaultItemHeight = itemHeight ?? (extended ? MENU_ITEM_SIZE_EXTENDED : MENU_ITEM_SIZE_DEFAULT);
|
|
1381
|
+
const listboxHeight = useMemo(() => {
|
|
1382
|
+
const filterHeight = showFilters && multiple ? MENU_ITEM_SIZE_EXTENDED : 0;
|
|
1383
|
+
const availableHeight = maxListHeight - filterHeight;
|
|
1384
|
+
const calculatedHeight = Math.min(
|
|
1385
|
+
childrenArray.length * defaultItemHeight,
|
|
1386
|
+
availableHeight
|
|
1387
|
+
);
|
|
1388
|
+
return Math.max(calculatedHeight, defaultItemHeight + 8);
|
|
1389
|
+
}, [
|
|
1390
|
+
showFilters,
|
|
1391
|
+
multiple,
|
|
1392
|
+
maxListHeight,
|
|
1393
|
+
childrenArray.length,
|
|
1394
|
+
defaultItemHeight
|
|
1395
|
+
]);
|
|
1396
|
+
const renderItem = ({
|
|
1397
|
+
index,
|
|
1398
|
+
style
|
|
1399
|
+
}) => {
|
|
1400
|
+
const child = childrenArray[index];
|
|
1401
|
+
if (!child) return null;
|
|
1402
|
+
return /* @__PURE__ */ jsx("div", { style, children: child });
|
|
1403
|
+
};
|
|
1236
1404
|
return /* @__PURE__ */ jsxs(
|
|
1237
1405
|
"ul",
|
|
1238
1406
|
{
|
|
1239
1407
|
ref,
|
|
1240
1408
|
...otherProps,
|
|
1241
1409
|
role: "listbox",
|
|
1410
|
+
"data-list-height": listboxHeight,
|
|
1411
|
+
"data-item-height": defaultItemHeight,
|
|
1242
1412
|
"aria-multiselectable": multiple,
|
|
1413
|
+
style: {
|
|
1414
|
+
maxHeight: maxListHeight + defaultItemHeight
|
|
1415
|
+
},
|
|
1243
1416
|
children: [
|
|
1244
1417
|
showFilters && multiple && /* @__PURE__ */ jsx(
|
|
1245
1418
|
MenuItemFilter,
|
|
@@ -1249,7 +1422,16 @@ function _ListboxWithFilter({
|
|
|
1249
1422
|
selectAll: handleSelectAll
|
|
1250
1423
|
}
|
|
1251
1424
|
),
|
|
1252
|
-
|
|
1425
|
+
/* @__PURE__ */ jsx(
|
|
1426
|
+
FixedSizeList,
|
|
1427
|
+
{
|
|
1428
|
+
height: listboxHeight,
|
|
1429
|
+
width: "100%",
|
|
1430
|
+
itemCount: childrenArray.length,
|
|
1431
|
+
itemSize: defaultItemHeight,
|
|
1432
|
+
children: renderItem
|
|
1433
|
+
}
|
|
1434
|
+
)
|
|
1253
1435
|
]
|
|
1254
1436
|
}
|
|
1255
1437
|
);
|
|
@@ -1264,10 +1446,15 @@ function _CreatableAutocomplete({
|
|
|
1264
1446
|
disabled,
|
|
1265
1447
|
loading,
|
|
1266
1448
|
showFilters,
|
|
1449
|
+
showCounter = false,
|
|
1267
1450
|
options = [],
|
|
1268
1451
|
value,
|
|
1269
1452
|
onChange,
|
|
1270
1453
|
getLimitTagsText,
|
|
1454
|
+
renderTags,
|
|
1455
|
+
itemHeight,
|
|
1456
|
+
maxListHeight,
|
|
1457
|
+
extended,
|
|
1271
1458
|
...props
|
|
1272
1459
|
}, ref) {
|
|
1273
1460
|
const { freeSolo = true, ...otherProps } = props;
|
|
@@ -1276,11 +1463,14 @@ function _CreatableAutocomplete({
|
|
|
1276
1463
|
allSelected,
|
|
1277
1464
|
someSelected,
|
|
1278
1465
|
handleSelectAll,
|
|
1279
|
-
handleChange
|
|
1466
|
+
handleChange,
|
|
1467
|
+
getCounterRenderTags
|
|
1280
1468
|
} = useMultipleAutocomplete({
|
|
1281
1469
|
options,
|
|
1282
1470
|
value,
|
|
1283
|
-
onChange
|
|
1471
|
+
onChange,
|
|
1472
|
+
getOptionLabel,
|
|
1473
|
+
size: props.size
|
|
1284
1474
|
});
|
|
1285
1475
|
const {
|
|
1286
1476
|
creatableFilterOptions,
|
|
@@ -1292,6 +1482,17 @@ function _CreatableAutocomplete({
|
|
|
1292
1482
|
newItemIcon,
|
|
1293
1483
|
multiple
|
|
1294
1484
|
});
|
|
1485
|
+
const listboxProps = {
|
|
1486
|
+
showFilters,
|
|
1487
|
+
allSelected,
|
|
1488
|
+
someSelected,
|
|
1489
|
+
handleSelectAll,
|
|
1490
|
+
multiple,
|
|
1491
|
+
itemHeight,
|
|
1492
|
+
maxListHeight,
|
|
1493
|
+
extended
|
|
1494
|
+
};
|
|
1495
|
+
const finalRenderTags = showCounter && multiple && !renderTags ? getCounterRenderTags() : renderTags;
|
|
1295
1496
|
return /* @__PURE__ */ jsx(
|
|
1296
1497
|
Autocomplete$1,
|
|
1297
1498
|
{
|
|
@@ -1303,18 +1504,13 @@ function _CreatableAutocomplete({
|
|
|
1303
1504
|
filterOptions: creatableFilterOptions,
|
|
1304
1505
|
getOptionLabel: creatableOptionLabel,
|
|
1305
1506
|
renderOption: creatableRenderOption,
|
|
1507
|
+
renderTags: finalRenderTags,
|
|
1306
1508
|
freeSolo,
|
|
1307
1509
|
forcePopupIcon: true,
|
|
1308
1510
|
multiple,
|
|
1309
1511
|
disableCloseOnSelect: disableCloseOnSelect ?? multiple,
|
|
1310
1512
|
ListboxComponent: ListboxWithFilter,
|
|
1311
|
-
ListboxProps:
|
|
1312
|
-
showFilters,
|
|
1313
|
-
allSelected,
|
|
1314
|
-
someSelected,
|
|
1315
|
-
handleSelectAll,
|
|
1316
|
-
multiple
|
|
1317
|
-
},
|
|
1513
|
+
ListboxProps: listboxProps,
|
|
1318
1514
|
getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
|
|
1319
1515
|
disabled: disabled || loading,
|
|
1320
1516
|
popupIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsx(ArrowDown, {}),
|
|
@@ -1329,11 +1525,16 @@ function _MultipleAutocomplete({
|
|
|
1329
1525
|
disabled,
|
|
1330
1526
|
loading,
|
|
1331
1527
|
showFilters,
|
|
1528
|
+
showCounter = false,
|
|
1332
1529
|
options,
|
|
1333
1530
|
value,
|
|
1334
1531
|
onChange,
|
|
1335
1532
|
getOptionLabel,
|
|
1336
1533
|
getLimitTagsText,
|
|
1534
|
+
renderTags,
|
|
1535
|
+
itemHeight,
|
|
1536
|
+
maxListHeight,
|
|
1537
|
+
extended,
|
|
1337
1538
|
...props
|
|
1338
1539
|
}, ref) {
|
|
1339
1540
|
const {
|
|
@@ -1342,13 +1543,26 @@ function _MultipleAutocomplete({
|
|
|
1342
1543
|
someSelected,
|
|
1343
1544
|
handleSelectAll,
|
|
1344
1545
|
handleChange,
|
|
1345
|
-
multipleRenderOption
|
|
1546
|
+
multipleRenderOption,
|
|
1547
|
+
getCounterRenderTags
|
|
1346
1548
|
} = useMultipleAutocomplete({
|
|
1347
1549
|
options,
|
|
1348
1550
|
value,
|
|
1349
1551
|
onChange,
|
|
1350
|
-
getOptionLabel
|
|
1552
|
+
getOptionLabel,
|
|
1553
|
+
size: props.size
|
|
1351
1554
|
});
|
|
1555
|
+
const listboxProps = {
|
|
1556
|
+
showFilters,
|
|
1557
|
+
allSelected,
|
|
1558
|
+
someSelected,
|
|
1559
|
+
handleSelectAll,
|
|
1560
|
+
multiple: true,
|
|
1561
|
+
itemHeight,
|
|
1562
|
+
maxListHeight,
|
|
1563
|
+
extended
|
|
1564
|
+
};
|
|
1565
|
+
const finalRenderTags = showCounter && !renderTags ? getCounterRenderTags() : renderTags;
|
|
1352
1566
|
return /* @__PURE__ */ jsx(
|
|
1353
1567
|
Autocomplete$1,
|
|
1354
1568
|
{
|
|
@@ -1359,14 +1573,9 @@ function _MultipleAutocomplete({
|
|
|
1359
1573
|
onChange: handleChange,
|
|
1360
1574
|
getOptionLabel,
|
|
1361
1575
|
renderOption: renderOption ?? multipleRenderOption,
|
|
1576
|
+
renderTags: finalRenderTags,
|
|
1362
1577
|
ListboxComponent: ListboxWithFilter,
|
|
1363
|
-
ListboxProps:
|
|
1364
|
-
showFilters,
|
|
1365
|
-
allSelected,
|
|
1366
|
-
someSelected,
|
|
1367
|
-
handleSelectAll,
|
|
1368
|
-
multiple: true
|
|
1369
|
-
},
|
|
1578
|
+
ListboxProps: listboxProps,
|
|
1370
1579
|
multiple: true,
|
|
1371
1580
|
getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
|
|
1372
1581
|
disableCloseOnSelect,
|
|
@@ -3113,8 +3322,9 @@ const CodeAreaTheme = styled(Box, {
|
|
|
3113
3322
|
right: 0,
|
|
3114
3323
|
zIndex: 1
|
|
3115
3324
|
},
|
|
3116
|
-
"
|
|
3117
|
-
color: theme.palette.text.primary
|
|
3325
|
+
".CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket": {
|
|
3326
|
+
color: theme.palette.text.primary,
|
|
3327
|
+
fontVariantLigatures: "no-common-ligatures"
|
|
3118
3328
|
},
|
|
3119
3329
|
"& .CodeMirror pre.CodeMirror-placeholder": {
|
|
3120
3330
|
color: theme.palette.text.hint
|
|
@@ -3132,7 +3342,7 @@ const CodeAreaTheme = styled(Box, {
|
|
|
3132
3342
|
"& .cm-number, & .cm-property, & .cm-builtin": {
|
|
3133
3343
|
color: red[700]
|
|
3134
3344
|
},
|
|
3135
|
-
"& .cm-comment": {
|
|
3345
|
+
"& .cm-comment, & .cm-quote": {
|
|
3136
3346
|
color: theme.palette.text.secondary
|
|
3137
3347
|
},
|
|
3138
3348
|
"& .cm-variable": {
|
|
@@ -3141,9 +3351,18 @@ const CodeAreaTheme = styled(Box, {
|
|
|
3141
3351
|
"& .cm-variable-2": {
|
|
3142
3352
|
color: theme.palette.text.primary
|
|
3143
3353
|
},
|
|
3144
|
-
"& .cm-punctuation, & .cm-def
|
|
3354
|
+
"& .cm-punctuation, & .cm-def": {
|
|
3145
3355
|
color: blue[800]
|
|
3146
3356
|
},
|
|
3357
|
+
"& .cm-image-alt-text, & .cm-link": {
|
|
3358
|
+
color: green[800],
|
|
3359
|
+
textDecoration: "none"
|
|
3360
|
+
},
|
|
3361
|
+
// Custom inline link styling .cm-inline-url
|
|
3362
|
+
"& .cm-url, & .cm-inline-url": {
|
|
3363
|
+
color: blue[800],
|
|
3364
|
+
textDecoration: "none"
|
|
3365
|
+
},
|
|
3147
3366
|
"& .cm-variable-3, & .cm-type": {
|
|
3148
3367
|
color: indigo[800]
|
|
3149
3368
|
},
|
|
@@ -3157,20 +3376,23 @@ const CodeAreaTheme = styled(Box, {
|
|
|
3157
3376
|
"& .CodeMirror-selected": {
|
|
3158
3377
|
background: blue[800]
|
|
3159
3378
|
},
|
|
3160
|
-
"& .cm-header
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
fontSize: theme.typography.h3.fontSize
|
|
3379
|
+
"& .cm-header": {
|
|
3380
|
+
color: red[700],
|
|
3381
|
+
...theme.typography.code3,
|
|
3382
|
+
fontWeight: theme.typography.fontWeightBold
|
|
3165
3383
|
},
|
|
3166
|
-
"& .cm-header-
|
|
3167
|
-
|
|
3384
|
+
"& .cm-header-4, & .cm-header-5, & .cm-header-6": {
|
|
3385
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
3168
3386
|
},
|
|
3169
|
-
|
|
3170
|
-
|
|
3387
|
+
// Custom inline code styling
|
|
3388
|
+
"& .cm-inline-code": {
|
|
3389
|
+
backgroundColor: theme.palette.black[4],
|
|
3390
|
+
color: purple[500]
|
|
3171
3391
|
},
|
|
3172
|
-
|
|
3173
|
-
|
|
3392
|
+
// Custom code block styling
|
|
3393
|
+
"& .cm-code-block": {
|
|
3394
|
+
backgroundColor: theme.palette.black[4],
|
|
3395
|
+
marginRight: theme.spacing(2)
|
|
3174
3396
|
},
|
|
3175
3397
|
...size === "small" && {
|
|
3176
3398
|
"& .CodeMirror": {
|
|
@@ -3206,6 +3428,100 @@ function findCodeAreaControlCodeOccurrences(content) {
|
|
|
3206
3428
|
}
|
|
3207
3429
|
return matches;
|
|
3208
3430
|
}
|
|
3431
|
+
const editorMarkers = /* @__PURE__ */ new WeakMap();
|
|
3432
|
+
function clearMarkersForClass(editor, className) {
|
|
3433
|
+
var _a, _b;
|
|
3434
|
+
const markers = (_a = editorMarkers.get(editor)) == null ? void 0 : _a.get(className);
|
|
3435
|
+
if (!markers) return;
|
|
3436
|
+
markers.forEach((marker) => {
|
|
3437
|
+
if (marker.find()) {
|
|
3438
|
+
marker.clear();
|
|
3439
|
+
}
|
|
3440
|
+
});
|
|
3441
|
+
(_b = editorMarkers.get(editor)) == null ? void 0 : _b.delete(className);
|
|
3442
|
+
}
|
|
3443
|
+
function storeMarkersForClass(editor, className, markers) {
|
|
3444
|
+
if (!editorMarkers.has(editor)) {
|
|
3445
|
+
editorMarkers.set(editor, /* @__PURE__ */ new Map());
|
|
3446
|
+
}
|
|
3447
|
+
const editorMap = editorMarkers.get(editor);
|
|
3448
|
+
if (editorMap) {
|
|
3449
|
+
editorMap.set(className, markers);
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
function CodeAreaMarkTextPattern(editor, pattern, options, excludePatterns) {
|
|
3453
|
+
const { className } = options;
|
|
3454
|
+
clearMarkersForClass(editor, className);
|
|
3455
|
+
const doc = editor.getDoc();
|
|
3456
|
+
const content = doc.getValue();
|
|
3457
|
+
const excludeRanges = (excludePatterns == null ? void 0 : excludePatterns.flatMap(
|
|
3458
|
+
(excludePattern) => Array.from(content.matchAll(excludePattern), (match) => ({
|
|
3459
|
+
start: match.index,
|
|
3460
|
+
end: match.index + match[0].length
|
|
3461
|
+
}))
|
|
3462
|
+
)) ?? [];
|
|
3463
|
+
const markers = Array.from(content.matchAll(pattern)).filter((match) => {
|
|
3464
|
+
if (excludeRanges.some(
|
|
3465
|
+
(range) => match.index >= range.start && match.index < range.end
|
|
3466
|
+
)) {
|
|
3467
|
+
return false;
|
|
3468
|
+
}
|
|
3469
|
+
return !match[1] || match[1].trim().length > 0;
|
|
3470
|
+
}).map((match) => {
|
|
3471
|
+
const startPos = doc.posFromIndex(match.index);
|
|
3472
|
+
const endPos = doc.posFromIndex(match.index + match[0].length);
|
|
3473
|
+
return editor.markText(startPos, endPos, {
|
|
3474
|
+
atomic: false,
|
|
3475
|
+
clearOnEnter: false,
|
|
3476
|
+
...options
|
|
3477
|
+
});
|
|
3478
|
+
});
|
|
3479
|
+
if (markers.length > 0) {
|
|
3480
|
+
storeMarkersForClass(editor, className, markers);
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
function markInlineCode(editor, className = "cm-inline-code") {
|
|
3484
|
+
const inlineCodePattern = /`([^`\n\r]+)`/g;
|
|
3485
|
+
const codeBlockPattern = /```[\s\S]*?```/g;
|
|
3486
|
+
CodeAreaMarkTextPattern(
|
|
3487
|
+
editor,
|
|
3488
|
+
inlineCodePattern,
|
|
3489
|
+
{
|
|
3490
|
+
className
|
|
3491
|
+
},
|
|
3492
|
+
[codeBlockPattern]
|
|
3493
|
+
);
|
|
3494
|
+
}
|
|
3495
|
+
function markInlineLinks(editor, className = "cm-inline-url") {
|
|
3496
|
+
const inlineLinkPattern = /<((?:https?:\/\/[^\s<>]+)|(?:[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+))>/g;
|
|
3497
|
+
const codeBlockPattern = /```[\s\S]*?```/g;
|
|
3498
|
+
CodeAreaMarkTextPattern(
|
|
3499
|
+
editor,
|
|
3500
|
+
inlineLinkPattern,
|
|
3501
|
+
{
|
|
3502
|
+
className
|
|
3503
|
+
},
|
|
3504
|
+
[codeBlockPattern]
|
|
3505
|
+
);
|
|
3506
|
+
}
|
|
3507
|
+
function markCodeBlocks(editor, className = "cm-code-block") {
|
|
3508
|
+
const doc = editor.getDoc();
|
|
3509
|
+
const content = doc.getValue();
|
|
3510
|
+
const lineCount = content.split("\n").length;
|
|
3511
|
+
for (let i = 0; i < lineCount; i++) {
|
|
3512
|
+
["background", "wrap", "text"].forEach(
|
|
3513
|
+
(where) => editor.removeLineClass(i, where, className)
|
|
3514
|
+
);
|
|
3515
|
+
}
|
|
3516
|
+
const codeBlockPattern = /```[\s\S]*?(?:```|$)/g;
|
|
3517
|
+
Array.from(content.matchAll(codeBlockPattern)).forEach((match) => {
|
|
3518
|
+
const startPos = doc.posFromIndex(match.index);
|
|
3519
|
+
const endPos = doc.posFromIndex(match.index + match[0].length);
|
|
3520
|
+
for (let lineNum = startPos.line; lineNum <= endPos.line; lineNum++) {
|
|
3521
|
+
editor.addLineClass(lineNum, "wrap", className);
|
|
3522
|
+
}
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3209
3525
|
function foldCode(editor, { from, to }) {
|
|
3210
3526
|
editor.foldCode(
|
|
3211
3527
|
0,
|
|
@@ -3246,6 +3562,7 @@ function CodeAreaInput({
|
|
|
3246
3562
|
const codeMirrorOptions = {
|
|
3247
3563
|
mode: "sql",
|
|
3248
3564
|
theme: "light",
|
|
3565
|
+
addModeClass: true,
|
|
3249
3566
|
lineNumbers: true,
|
|
3250
3567
|
lineWrapping: true,
|
|
3251
3568
|
extraKeys: { "Ctrl-Space": "autocomplete" },
|
|
@@ -3276,6 +3593,13 @@ function CodeAreaInput({
|
|
|
3276
3593
|
}
|
|
3277
3594
|
initialFoldingDoneRef.current = true;
|
|
3278
3595
|
}, [value, editor, autoFoldControlBlocks]);
|
|
3596
|
+
useEffect(() => {
|
|
3597
|
+
const mode = typeof (options == null ? void 0 : options.mode) === "object" && options.mode !== null ? options.mode.name : options == null ? void 0 : options.mode;
|
|
3598
|
+
if (mode !== "markdown" || !editor || !value) return;
|
|
3599
|
+
markInlineCode(editor);
|
|
3600
|
+
markInlineLinks(editor);
|
|
3601
|
+
markCodeBlocks(editor);
|
|
3602
|
+
}, [editor, value, options == null ? void 0 : options.mode]);
|
|
3279
3603
|
return /* @__PURE__ */ jsxs(
|
|
3280
3604
|
CodeAreaTheme,
|
|
3281
3605
|
{
|
|
@@ -4210,7 +4534,7 @@ function DialogConfirmation({
|
|
|
4210
4534
|
"aria-label": ariaLabel,
|
|
4211
4535
|
role: "presentation",
|
|
4212
4536
|
"data-name": "dialog-confirmation",
|
|
4213
|
-
children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleClickAway, children: /* @__PURE__ */ jsx(
|
|
4537
|
+
children: /* @__PURE__ */ jsx(ClickAwayListener$1, { onClickAway: handleClickAway, children: /* @__PURE__ */ jsx(
|
|
4214
4538
|
Slide,
|
|
4215
4539
|
{
|
|
4216
4540
|
direction: "up",
|
|
@@ -4496,6 +4820,7 @@ export {
|
|
|
4496
4820
|
CodeAreaFooter,
|
|
4497
4821
|
CodeAreaHeader,
|
|
4498
4822
|
CodeAreaInput,
|
|
4823
|
+
CodeAreaMarkTextPattern,
|
|
4499
4824
|
CopiableComponent,
|
|
4500
4825
|
CreatableAutocomplete,
|
|
4501
4826
|
DatePicker,
|
|
@@ -4522,6 +4847,7 @@ export {
|
|
|
4522
4847
|
PasswordField,
|
|
4523
4848
|
SelectField,
|
|
4524
4849
|
Snackbar,
|
|
4850
|
+
SplitButton,
|
|
4525
4851
|
a as TablePaginationActions,
|
|
4526
4852
|
Tag,
|
|
4527
4853
|
TimePicker,
|