@carto/meridian-ds 2.1.1-alpha-filter-dropdown.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/dist/{Alert-yL5uEg4Z.js → Link-D5fKicEY.js} +129 -129
- package/dist/{Alert-oGAW_syG.cjs → Link-_lzRY1Ay.cjs} +129 -129
- package/dist/{MenuItem-8L6Ub4X5.cjs → MenuItem-BY6fuF5U.cjs} +3 -4
- package/dist/{MenuItem-Cx8rUKOU.js → MenuItem-CKrhDizf.js} +3 -4
- package/dist/{TablePaginationActions-BWer8cmX.js → TablePaginationActions-CCDi-BO-.js} +6 -6
- package/dist/{TablePaginationActions-MwqZJoRm.cjs → TablePaginationActions-D2K26kdR.cjs} +6 -6
- package/dist/components/index.cjs +836 -728
- package/dist/components/index.js +776 -668
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.js +3 -3
- package/dist/types/components/atoms/Copy/CopiableComponent.d.ts +4 -0
- package/dist/types/components/atoms/Copy/CopiableComponent.d.ts.map +1 -0
- package/dist/types/components/atoms/Copy/CopiableInputText.d.ts +18 -0
- package/dist/types/components/atoms/Copy/CopiableInputText.d.ts.map +1 -0
- package/dist/types/components/atoms/Copy/copyString.d.ts.map +1 -0
- package/dist/types/components/{molecules → atoms}/Copy/index.d.ts +2 -1
- package/dist/types/components/atoms/Copy/index.d.ts.map +1 -0
- package/dist/types/components/{molecules/Copy/CopiableComponent.d.ts → atoms/Copy/types.d.ts} +11 -5
- package/dist/types/components/atoms/Copy/types.d.ts.map +1 -0
- package/dist/types/components/atoms/Copy/useCopyValue.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/Menu/MenuItem.d.ts.map +1 -1
- package/dist/types/components/molecules/index.d.ts +0 -2
- package/dist/types/components/molecules/index.d.ts.map +1 -1
- package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -1
- package/dist/types/localization/en.d.ts +2 -2
- package/dist/types/localization/es.d.ts +2 -2
- package/dist/types/localization/id.d.ts +2 -2
- package/dist/types/localization/index.d.ts +6 -6
- package/dist/widgets/index.cjs +8 -8
- package/dist/widgets/index.js +2 -2
- package/package.json +1 -1
- package/dist/types/components/molecules/Copy/CopiableComponent.d.ts.map +0 -1
- package/dist/types/components/molecules/Copy/copyString.d.ts.map +0 -1
- package/dist/types/components/molecules/Copy/index.d.ts.map +0 -1
- package/dist/types/components/molecules/Copy/useCopyValue.d.ts.map +0 -1
- /package/dist/types/components/{molecules → atoms}/Copy/copyString.d.ts +0 -0
- /package/dist/types/components/{molecules → atoms}/Copy/useCopyValue.d.ts +0 -0
package/dist/components/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { styled,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a } from "../TablePaginationActions-
|
|
8
|
-
import {
|
|
9
|
-
import { L } from "../
|
|
4
|
+
import { styled, Menu as Menu$2, MenuList as MenuList$1, Link, Checkbox, Select, MenuItem as MenuItem$1, FormControl, Box, InputLabel, FormHelperText, InputAdornment, IconButton, ListItemText, Tooltip, TextField, CircularProgress, Button as Button$1, Autocomplete as Autocomplete$1, Divider, ListItemIcon, createFilterOptions, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Snackbar as Snackbar$1, Portal, Fade, Slide, Popper, Grow, Paper, ClickAwayListener, ButtonGroup as ButtonGroup$1, ToggleButtonGroup as ToggleButtonGroup$1, 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";
|
|
5
|
+
import { Cancel, AddCircleOutlineOutlined, CloseOutlined, ContentCopyOutlined, VisibilityOutlined, VisibilityOffOutlined, OpenInNewOutlined, MenuOutlined, HelpOutline, TodayOutlined, MoreVertOutlined, ErrorOutline, Check } from "@mui/icons-material";
|
|
6
|
+
import { f as MENU_ITEM_SIZE_EXTENDED, u as useImperativeIntl, T as Typography, e as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, M as MENU_ITEM_SIZE_DEFAULT, c as ICON_SIZE_SMALL, N as NOTIFICATION_DURATION_IN_MS, A as APPBAR_SIZE } from "../TablePaginationActions-CCDi-BO-.js";
|
|
7
|
+
import { a } from "../TablePaginationActions-CCDi-BO-.js";
|
|
8
|
+
import { A as Alert$1, I as IconButton$1, S as ScreenReaderOnly } from "../Link-D5fKicEY.js";
|
|
9
|
+
import { L } from "../Link-D5fKicEY.js";
|
|
10
10
|
import { A as ArrowDown } from "../ArrowDown-d6bxUL0F.js";
|
|
11
11
|
import { A as ArrowUp, O as OpenDiagonallyRight, C as CloseDiagonallyRight } from "../OpenDiagonallyRight-CGdCEXlF.js";
|
|
12
12
|
import "cartocolor";
|
|
13
|
-
import { M as MenuItem
|
|
13
|
+
import { M as MenuItem } from "../MenuItem-CKrhDizf.js";
|
|
14
14
|
import { FixedSizeList } from "react-window";
|
|
15
15
|
import { DatePicker as DatePicker$1 } from "@mui/x-date-pickers/DatePicker";
|
|
16
16
|
import { PickersDay as PickersDay$1 } from "@mui/x-date-pickers";
|
|
@@ -41,307 +41,195 @@ import "codemirror/addon/fold/indent-fold.js";
|
|
|
41
41
|
import "codemirror/addon/fold/markdown-fold.js";
|
|
42
42
|
import "codemirror/addon/fold/comment-fold.js";
|
|
43
43
|
import ClickAwayListener$1 from "@mui/material/ClickAwayListener";
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
display: "flex",
|
|
51
|
-
alignItems: "center",
|
|
52
|
-
justifyContent: "center"
|
|
53
|
-
});
|
|
54
|
-
const HiddenText = styled(Box)({
|
|
55
|
-
visibility: "hidden",
|
|
56
|
-
pointerEvents: "none"
|
|
57
|
-
});
|
|
58
|
-
function _Button({
|
|
59
|
-
children,
|
|
60
|
-
loading,
|
|
61
|
-
disabled,
|
|
62
|
-
startIcon,
|
|
63
|
-
endIcon,
|
|
64
|
-
loadingPosition,
|
|
65
|
-
external,
|
|
66
|
-
showExternalIcon = true,
|
|
67
|
-
"aria-describedby": ariaDescribedby,
|
|
68
|
-
...otherProps
|
|
69
|
-
}, ref) {
|
|
70
|
-
const intl = useIntl();
|
|
71
|
-
const intlConfig = useImperativeIntl(intl);
|
|
72
|
-
const defaultIconLoader = /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" });
|
|
73
|
-
const isDefaultLoading = loading && loadingPosition === void 0;
|
|
74
|
-
const isExternalLink = otherProps.href && external;
|
|
75
|
-
const renderContent = () => {
|
|
76
|
-
if (isDefaultLoading) {
|
|
77
|
-
return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
|
|
78
|
-
/* @__PURE__ */ jsx(IndicatorIcon, { children: defaultIconLoader }),
|
|
79
|
-
/* @__PURE__ */ jsx(HiddenText, { children })
|
|
80
|
-
] });
|
|
44
|
+
const StyledMenu = styled(Menu$2, {
|
|
45
|
+
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
46
|
+
})(({ extended, width, height }) => ({
|
|
47
|
+
...extended && {
|
|
48
|
+
".MuiMenuItem-root": {
|
|
49
|
+
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
81
50
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})})` })
|
|
88
|
-
] });
|
|
51
|
+
},
|
|
52
|
+
...width && {
|
|
53
|
+
".MuiList-root": {
|
|
54
|
+
width,
|
|
55
|
+
minWidth: width
|
|
89
56
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
57
|
+
},
|
|
58
|
+
...height && {
|
|
59
|
+
".MuiMenu-paper": {
|
|
60
|
+
overflow: "hidden"
|
|
61
|
+
},
|
|
62
|
+
".MuiList-root": {
|
|
63
|
+
maxHeight: height
|
|
95
64
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
StyledMenu,
|
|
70
|
+
{
|
|
71
|
+
...otherProps,
|
|
72
|
+
ref,
|
|
73
|
+
"data-name": "menu",
|
|
74
|
+
width,
|
|
75
|
+
height,
|
|
76
|
+
extended,
|
|
77
|
+
MenuListProps: {
|
|
78
|
+
...MenuListProps,
|
|
79
|
+
"data-width": width,
|
|
80
|
+
"data-height": height,
|
|
81
|
+
"data-extended": extended
|
|
99
82
|
}
|
|
100
|
-
return void 0;
|
|
101
83
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
const Menu$1 = forwardRef(_Menu);
|
|
87
|
+
const StyledMenuList = styled(MenuList$1, {
|
|
88
|
+
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
89
|
+
})(({ extended, width, height }) => ({
|
|
90
|
+
...extended && {
|
|
91
|
+
".MuiMenuItem-root": {
|
|
92
|
+
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
106
93
|
}
|
|
107
|
-
}
|
|
94
|
+
},
|
|
95
|
+
"&.MuiList-root": {
|
|
96
|
+
...width && {
|
|
97
|
+
width,
|
|
98
|
+
minWidth: width
|
|
99
|
+
},
|
|
100
|
+
...height && {
|
|
101
|
+
maxHeight: height
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
function _MenuList({ extended, width, height, ...otherProps }, ref) {
|
|
108
106
|
return /* @__PURE__ */ jsx(
|
|
109
|
-
|
|
107
|
+
StyledMenuList,
|
|
110
108
|
{
|
|
111
|
-
disabled: loading || disabled,
|
|
112
|
-
startIcon: getIconForPosition("start"),
|
|
113
|
-
endIcon: getIconForPosition("end"),
|
|
114
109
|
...otherProps,
|
|
115
|
-
role: otherProps.href ? "link" : "button",
|
|
116
|
-
...isExternalLink && {
|
|
117
|
-
target: "_blank",
|
|
118
|
-
rel: "noopener noreferrer"
|
|
119
|
-
},
|
|
120
110
|
ref,
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
width,
|
|
112
|
+
height,
|
|
113
|
+
extended,
|
|
114
|
+
"data-name": "menu-list",
|
|
115
|
+
"data-width": width,
|
|
116
|
+
"data-height": height,
|
|
117
|
+
"data-extended": extended
|
|
123
118
|
}
|
|
124
119
|
);
|
|
125
120
|
}
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
const MenuList = forwardRef(_MenuList);
|
|
122
|
+
const StyledMenuItem$1 = styled(MenuItem)(() => ({
|
|
123
|
+
marginTop: "0 !important",
|
|
124
|
+
marginBottom: "0 !important"
|
|
125
|
+
}));
|
|
126
|
+
const LinkFilter = styled(Link)(
|
|
127
|
+
({ disabled, theme }) => ({
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
gap: theme.spacing(1),
|
|
131
|
+
width: "100%",
|
|
132
|
+
textAlign: "initial",
|
|
133
|
+
...disabled && {
|
|
134
|
+
pointerEvents: "none",
|
|
135
|
+
color: theme.palette.text.disabled
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
function _MenuItemFilter({
|
|
140
|
+
areAllSelected,
|
|
141
|
+
areAnySelected,
|
|
142
|
+
selectAll,
|
|
143
|
+
selectAllDisabled,
|
|
144
|
+
"aria-label": ariaLabel,
|
|
145
|
+
"data-testid": dataTestId
|
|
146
|
+
}, ref) {
|
|
147
|
+
const intl = useIntl();
|
|
148
|
+
const intlConfig = useImperativeIntl(intl);
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
|
+
StyledMenuItem$1,
|
|
151
|
+
{
|
|
152
|
+
ref,
|
|
153
|
+
fixed: true,
|
|
154
|
+
"data-name": "menu-filter",
|
|
155
|
+
"aria-label": ariaLabel,
|
|
156
|
+
"data-testid": dataTestId,
|
|
157
|
+
children: /* @__PURE__ */ jsxs(
|
|
158
|
+
LinkFilter,
|
|
159
|
+
{
|
|
160
|
+
variant: "body2",
|
|
161
|
+
color: "textPrimary",
|
|
162
|
+
component: "button",
|
|
163
|
+
underline: "none",
|
|
164
|
+
disabled: !!selectAllDisabled,
|
|
165
|
+
onClick: selectAll,
|
|
166
|
+
tabIndex: 0,
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
Checkbox,
|
|
170
|
+
{
|
|
171
|
+
checked: areAllSelected,
|
|
172
|
+
indeterminate: areAnySelected && !areAllSelected,
|
|
173
|
+
disabled: selectAllDisabled
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
intlConfig.formatMessage({ id: "c4r.form.selectAll" })
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
const MenuItemFilter = forwardRef(_MenuItemFilter);
|
|
184
|
+
const idCounter = {};
|
|
185
|
+
function uniqueId(prefix = "$lodash$") {
|
|
186
|
+
if (!idCounter[prefix]) {
|
|
187
|
+
idCounter[prefix] = 0;
|
|
188
|
+
}
|
|
189
|
+
const id = ++idCounter[prefix];
|
|
190
|
+
if (prefix === "$lodash$") {
|
|
191
|
+
return `${id}`;
|
|
192
|
+
}
|
|
193
|
+
return `${prefix}${id}`;
|
|
194
|
+
}
|
|
195
|
+
const StyledSelect = styled(Select)(({ theme }) => ({
|
|
196
|
+
"& .MuiInputAdornment-positionStart": {
|
|
197
|
+
paddingLeft: theme.spacing(2),
|
|
198
|
+
"&.MuiInputAdornment-sizeSmall": {
|
|
199
|
+
paddingLeft: theme.spacing(1.5)
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"& .MuiInputBase-inputAdornedStart": {
|
|
203
|
+
paddingLeft: "0px !important"
|
|
204
|
+
},
|
|
205
|
+
"& .MuiSelect-select .MuiMenuItem-root:hover": {
|
|
206
|
+
backgroundColor: "transparent"
|
|
207
|
+
},
|
|
208
|
+
"&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple": {
|
|
209
|
+
paddingRight: theme.spacing(7)
|
|
131
210
|
}
|
|
132
211
|
}));
|
|
133
|
-
|
|
134
|
-
|
|
212
|
+
const PlaceholderItem = styled(MenuItem$1)(() => ({
|
|
213
|
+
display: "none"
|
|
214
|
+
}));
|
|
215
|
+
function _SelectField({
|
|
216
|
+
children,
|
|
217
|
+
placeholder,
|
|
218
|
+
size = "small",
|
|
219
|
+
displayEmpty,
|
|
220
|
+
menuProps,
|
|
221
|
+
inputProps,
|
|
222
|
+
labelId,
|
|
223
|
+
label,
|
|
224
|
+
labelSecondary,
|
|
225
|
+
helperText,
|
|
226
|
+
name,
|
|
227
|
+
error,
|
|
228
|
+
focused,
|
|
135
229
|
disabled,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
variant,
|
|
140
|
-
size,
|
|
141
|
-
color,
|
|
142
|
-
...otherProps
|
|
143
|
-
}) {
|
|
144
|
-
var _a;
|
|
145
|
-
const [open, setOpen] = useState(false);
|
|
146
|
-
const anchorRef = useRef(null);
|
|
147
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
148
|
-
const handleClick = () => {
|
|
149
|
-
onClick(options[selectedIndex]);
|
|
150
|
-
};
|
|
151
|
-
const handleMenuItemClick = (_, index) => {
|
|
152
|
-
setSelectedIndex(index);
|
|
153
|
-
setOpen(false);
|
|
154
|
-
};
|
|
155
|
-
const handleToggle = () => {
|
|
156
|
-
setOpen((prevOpen) => !prevOpen);
|
|
157
|
-
};
|
|
158
|
-
const handleClose = (event) => {
|
|
159
|
-
var _a2;
|
|
160
|
-
if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
setOpen(false);
|
|
164
|
-
};
|
|
165
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
|
-
/* @__PURE__ */ jsxs(
|
|
167
|
-
ButtonGroup,
|
|
168
|
-
{
|
|
169
|
-
"data-name": "split-button",
|
|
170
|
-
ref: anchorRef,
|
|
171
|
-
variant,
|
|
172
|
-
size,
|
|
173
|
-
color,
|
|
174
|
-
...otherProps,
|
|
175
|
-
children: [
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
Button,
|
|
178
|
-
{
|
|
179
|
-
disabled,
|
|
180
|
-
loading,
|
|
181
|
-
loadingPosition,
|
|
182
|
-
onClick: handleClick,
|
|
183
|
-
children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
/* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
/* @__PURE__ */ jsx(
|
|
191
|
-
Popper,
|
|
192
|
-
{
|
|
193
|
-
sx: { zIndex: 1 },
|
|
194
|
-
open,
|
|
195
|
-
anchorEl: anchorRef.current,
|
|
196
|
-
role: void 0,
|
|
197
|
-
transition: true,
|
|
198
|
-
disablePortal: true,
|
|
199
|
-
placement: "bottom-end",
|
|
200
|
-
children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
|
|
201
|
-
Grow,
|
|
202
|
-
{
|
|
203
|
-
...TransitionProps,
|
|
204
|
-
style: {
|
|
205
|
-
transformOrigin: placement === "bottom" ? "center top" : "center bottom"
|
|
206
|
-
},
|
|
207
|
-
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(
|
|
208
|
-
MenuItem,
|
|
209
|
-
{
|
|
210
|
-
disabled: option.disabled,
|
|
211
|
-
selected: index === selectedIndex,
|
|
212
|
-
onClick: (event) => handleMenuItemClick(event, index),
|
|
213
|
-
children: option.label
|
|
214
|
-
},
|
|
215
|
-
option.label
|
|
216
|
-
)) }) }) })
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
] });
|
|
222
|
-
}
|
|
223
|
-
const Root$5 = styled(Box)(({ theme }) => ({
|
|
224
|
-
display: "flex",
|
|
225
|
-
alignItems: "center",
|
|
226
|
-
gap: theme.spacing(0.5)
|
|
227
|
-
}));
|
|
228
|
-
const Indicator = styled(Typography)(({ theme }) => ({
|
|
229
|
-
".Mui-disabled &": {
|
|
230
|
-
color: theme.palette.text.disabled
|
|
231
|
-
}
|
|
232
|
-
}));
|
|
233
|
-
const Icon = styled(Box)(({ theme }) => ({
|
|
234
|
-
display: "flex",
|
|
235
|
-
svg: {
|
|
236
|
-
width: ICON_SIZE_SMALL,
|
|
237
|
-
height: ICON_SIZE_SMALL,
|
|
238
|
-
fontSize: ICON_SIZE_SMALL,
|
|
239
|
-
path: {
|
|
240
|
-
fill: theme.palette.text.secondary,
|
|
241
|
-
".Mui-disabled &": {
|
|
242
|
-
fill: theme.palette.text.disabled
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}));
|
|
247
|
-
function LabelWithIndicator({
|
|
248
|
-
label,
|
|
249
|
-
type,
|
|
250
|
-
icon,
|
|
251
|
-
inheritSize
|
|
252
|
-
}) {
|
|
253
|
-
return /* @__PURE__ */ jsxs(Root$5, { children: [
|
|
254
|
-
label,
|
|
255
|
-
type && /* @__PURE__ */ jsx(
|
|
256
|
-
Indicator,
|
|
257
|
-
{
|
|
258
|
-
component: "span",
|
|
259
|
-
variant: inheritSize ? "inherit" : "caption",
|
|
260
|
-
color: "textSecondary",
|
|
261
|
-
weight: "regular",
|
|
262
|
-
children: type === "required" ? "(required)" : "(optional)"
|
|
263
|
-
}
|
|
264
|
-
),
|
|
265
|
-
icon && /* @__PURE__ */ jsx(Icon, { children: icon })
|
|
266
|
-
] });
|
|
267
|
-
}
|
|
268
|
-
function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
|
|
269
|
-
const intl = useIntl();
|
|
270
|
-
const intlConfig = useImperativeIntl(intl);
|
|
271
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
272
|
-
const handleClickShowPassword = () => setShowPassword(!showPassword);
|
|
273
|
-
return /* @__PURE__ */ jsx(
|
|
274
|
-
TextField,
|
|
275
|
-
{
|
|
276
|
-
...otherProps,
|
|
277
|
-
ref,
|
|
278
|
-
type: showPassword ? "text" : "password",
|
|
279
|
-
size,
|
|
280
|
-
InputProps: {
|
|
281
|
-
...InputProps,
|
|
282
|
-
endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsx(
|
|
283
|
-
Tooltip,
|
|
284
|
-
{
|
|
285
|
-
title: intlConfig.formatMessage({
|
|
286
|
-
id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
|
|
287
|
-
}),
|
|
288
|
-
children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOutlined, {})
|
|
289
|
-
}
|
|
290
|
-
) }) })
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
const PasswordField = forwardRef(_PasswordField);
|
|
296
|
-
const idCounter = {};
|
|
297
|
-
function uniqueId(prefix = "$lodash$") {
|
|
298
|
-
if (!idCounter[prefix]) {
|
|
299
|
-
idCounter[prefix] = 0;
|
|
300
|
-
}
|
|
301
|
-
const id = ++idCounter[prefix];
|
|
302
|
-
if (prefix === "$lodash$") {
|
|
303
|
-
return `${id}`;
|
|
304
|
-
}
|
|
305
|
-
return `${prefix}${id}`;
|
|
306
|
-
}
|
|
307
|
-
const StyledSelect = styled(Select)(({ theme }) => ({
|
|
308
|
-
"& .MuiInputAdornment-positionStart": {
|
|
309
|
-
paddingLeft: theme.spacing(2),
|
|
310
|
-
"&.MuiInputAdornment-sizeSmall": {
|
|
311
|
-
paddingLeft: theme.spacing(1.5)
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
"& .MuiInputBase-inputAdornedStart": {
|
|
315
|
-
paddingLeft: "0px !important"
|
|
316
|
-
},
|
|
317
|
-
"& .MuiSelect-select .MuiMenuItem-root:hover": {
|
|
318
|
-
backgroundColor: "transparent"
|
|
319
|
-
},
|
|
320
|
-
"&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple": {
|
|
321
|
-
paddingRight: theme.spacing(7)
|
|
322
|
-
}
|
|
323
|
-
}));
|
|
324
|
-
const PlaceholderItem = styled(MenuItem)(() => ({
|
|
325
|
-
display: "none"
|
|
326
|
-
}));
|
|
327
|
-
function _SelectField({
|
|
328
|
-
children,
|
|
329
|
-
placeholder,
|
|
330
|
-
size = "small",
|
|
331
|
-
displayEmpty,
|
|
332
|
-
menuProps,
|
|
333
|
-
inputProps,
|
|
334
|
-
labelId,
|
|
335
|
-
label,
|
|
336
|
-
labelSecondary,
|
|
337
|
-
helperText,
|
|
338
|
-
name,
|
|
339
|
-
error,
|
|
340
|
-
focused,
|
|
341
|
-
disabled,
|
|
342
|
-
fullWidth,
|
|
343
|
-
required,
|
|
344
|
-
"aria-label": ariaLabel,
|
|
230
|
+
fullWidth,
|
|
231
|
+
required,
|
|
232
|
+
"aria-label": ariaLabel,
|
|
345
233
|
...otherProps
|
|
346
234
|
}, ref) {
|
|
347
235
|
const isSmall = size === "small";
|
|
@@ -411,236 +299,6 @@ function _SelectField({
|
|
|
411
299
|
);
|
|
412
300
|
}
|
|
413
301
|
const SelectField = forwardRef(_SelectField);
|
|
414
|
-
const StyledToggleButtonGroup = styled(ToggleButtonGroup$1, {
|
|
415
|
-
shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
|
|
416
|
-
})(({ variant, backgroundColor, theme }) => ({
|
|
417
|
-
// Variants
|
|
418
|
-
...variant === "contained" && {
|
|
419
|
-
boxShadow: "none"
|
|
420
|
-
},
|
|
421
|
-
...variant === "unbounded" && {
|
|
422
|
-
boxShadow: "none",
|
|
423
|
-
borderRadius: theme.spacing(0.5),
|
|
424
|
-
"& .MuiDivider-root": {
|
|
425
|
-
height: theme.spacing(4),
|
|
426
|
-
"&.MuiToggleButtonGroup-groupedHorizontal": {
|
|
427
|
-
height: theme.spacing(4)
|
|
428
|
-
},
|
|
429
|
-
"&.MuiToggleButtonGroup-groupedVertical": {
|
|
430
|
-
height: "auto",
|
|
431
|
-
width: theme.spacing(4),
|
|
432
|
-
margin: `${theme.spacing(0.5, 0, 1)} !important`,
|
|
433
|
-
borderRadius: "0 !important"
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
"& .MuiToggleButton-sizeSmall": {
|
|
437
|
-
margin: 0,
|
|
438
|
-
"&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
|
|
439
|
-
margin: 0
|
|
440
|
-
},
|
|
441
|
-
"& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
|
|
442
|
-
height: theme.spacing(3)
|
|
443
|
-
},
|
|
444
|
-
"& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
|
|
445
|
-
height: "auto",
|
|
446
|
-
width: theme.spacing(3)
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
|
|
450
|
-
margin: 0,
|
|
451
|
-
"&:first-of-type": {
|
|
452
|
-
marginLeft: 0
|
|
453
|
-
},
|
|
454
|
-
"&:not(:last-of-type)": {
|
|
455
|
-
marginRight: theme.spacing(0.5)
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
"&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
|
|
459
|
-
".MuiToggleButtonGroup-grouped": {
|
|
460
|
-
margin: theme.spacing(0, 0.5)
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
"&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
|
|
464
|
-
".MuiToggleButtonGroup-grouped": {
|
|
465
|
-
margin: theme.spacing(0, 0, 0.5),
|
|
466
|
-
"&:not(:last-of-type)": {
|
|
467
|
-
marginRight: 0
|
|
468
|
-
},
|
|
469
|
-
"&:last-of-type": {
|
|
470
|
-
marginBottom: 0
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
// Colors
|
|
476
|
-
...backgroundColor === "primary" && {
|
|
477
|
-
backgroundColor: theme.palette.background.paper
|
|
478
|
-
},
|
|
479
|
-
...backgroundColor === "secondary" && {
|
|
480
|
-
backgroundColor: theme.palette.background.default
|
|
481
|
-
},
|
|
482
|
-
...backgroundColor === "transparent" && {
|
|
483
|
-
backgroundColor: "transparent"
|
|
484
|
-
}
|
|
485
|
-
}));
|
|
486
|
-
function ToggleButtonGroup({
|
|
487
|
-
children,
|
|
488
|
-
variant = "floating",
|
|
489
|
-
backgroundColor,
|
|
490
|
-
...rest
|
|
491
|
-
}) {
|
|
492
|
-
const isUnbounded = variant === "unbounded";
|
|
493
|
-
const defaultColor = isUnbounded ? "transparent" : "primary";
|
|
494
|
-
return /* @__PURE__ */ jsx(
|
|
495
|
-
StyledToggleButtonGroup,
|
|
496
|
-
{
|
|
497
|
-
...rest,
|
|
498
|
-
variant,
|
|
499
|
-
backgroundColor: backgroundColor ?? defaultColor,
|
|
500
|
-
children
|
|
501
|
-
}
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
const StyledMenu = styled(Menu$2, {
|
|
505
|
-
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
506
|
-
})(({ extended, width, height }) => ({
|
|
507
|
-
...extended && {
|
|
508
|
-
".MuiMenuItem-root": {
|
|
509
|
-
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
510
|
-
}
|
|
511
|
-
},
|
|
512
|
-
...width && {
|
|
513
|
-
".MuiList-root": {
|
|
514
|
-
width,
|
|
515
|
-
minWidth: width
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
...height && {
|
|
519
|
-
".MuiMenu-paper": {
|
|
520
|
-
overflow: "hidden"
|
|
521
|
-
},
|
|
522
|
-
".MuiList-root": {
|
|
523
|
-
maxHeight: height
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}));
|
|
527
|
-
function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
|
|
528
|
-
return /* @__PURE__ */ jsx(
|
|
529
|
-
StyledMenu,
|
|
530
|
-
{
|
|
531
|
-
...otherProps,
|
|
532
|
-
ref,
|
|
533
|
-
"data-name": "menu",
|
|
534
|
-
width,
|
|
535
|
-
height,
|
|
536
|
-
extended,
|
|
537
|
-
MenuListProps: {
|
|
538
|
-
...MenuListProps,
|
|
539
|
-
"data-width": width,
|
|
540
|
-
"data-height": height,
|
|
541
|
-
"data-extended": extended
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
);
|
|
545
|
-
}
|
|
546
|
-
const Menu$1 = forwardRef(_Menu);
|
|
547
|
-
const StyledMenuList = styled(MenuList$1, {
|
|
548
|
-
shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
|
|
549
|
-
})(({ extended, width, height }) => ({
|
|
550
|
-
...extended && {
|
|
551
|
-
".MuiMenuItem-root": {
|
|
552
|
-
minHeight: MENU_ITEM_SIZE_EXTENDED
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
"&.MuiList-root": {
|
|
556
|
-
...width && {
|
|
557
|
-
width,
|
|
558
|
-
minWidth: width
|
|
559
|
-
},
|
|
560
|
-
...height && {
|
|
561
|
-
maxHeight: height
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}));
|
|
565
|
-
function _MenuList({ extended, width, height, ...otherProps }, ref) {
|
|
566
|
-
return /* @__PURE__ */ jsx(
|
|
567
|
-
StyledMenuList,
|
|
568
|
-
{
|
|
569
|
-
...otherProps,
|
|
570
|
-
ref,
|
|
571
|
-
width,
|
|
572
|
-
height,
|
|
573
|
-
extended,
|
|
574
|
-
"data-name": "menu-list",
|
|
575
|
-
"data-width": width,
|
|
576
|
-
"data-height": height,
|
|
577
|
-
"data-extended": extended
|
|
578
|
-
}
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
const MenuList = forwardRef(_MenuList);
|
|
582
|
-
const StyledMenuItem$1 = styled(MenuItem$1)(() => ({
|
|
583
|
-
marginTop: "0 !important",
|
|
584
|
-
marginBottom: "0 !important"
|
|
585
|
-
}));
|
|
586
|
-
const LinkFilter = styled(Link)(
|
|
587
|
-
({ disabled, theme }) => ({
|
|
588
|
-
display: "flex",
|
|
589
|
-
alignItems: "center",
|
|
590
|
-
gap: theme.spacing(1),
|
|
591
|
-
width: "100%",
|
|
592
|
-
textAlign: "initial",
|
|
593
|
-
...disabled && {
|
|
594
|
-
pointerEvents: "none",
|
|
595
|
-
color: theme.palette.text.disabled
|
|
596
|
-
}
|
|
597
|
-
})
|
|
598
|
-
);
|
|
599
|
-
function _MenuItemFilter({
|
|
600
|
-
areAllSelected,
|
|
601
|
-
areAnySelected,
|
|
602
|
-
selectAll,
|
|
603
|
-
selectAllDisabled,
|
|
604
|
-
"aria-label": ariaLabel,
|
|
605
|
-
"data-testid": dataTestId
|
|
606
|
-
}, ref) {
|
|
607
|
-
const intl = useIntl();
|
|
608
|
-
const intlConfig = useImperativeIntl(intl);
|
|
609
|
-
return /* @__PURE__ */ jsx(
|
|
610
|
-
StyledMenuItem$1,
|
|
611
|
-
{
|
|
612
|
-
ref,
|
|
613
|
-
fixed: true,
|
|
614
|
-
"data-name": "menu-filter",
|
|
615
|
-
"aria-label": ariaLabel,
|
|
616
|
-
"data-testid": dataTestId,
|
|
617
|
-
children: /* @__PURE__ */ jsxs(
|
|
618
|
-
LinkFilter,
|
|
619
|
-
{
|
|
620
|
-
variant: "body2",
|
|
621
|
-
color: "textPrimary",
|
|
622
|
-
component: "button",
|
|
623
|
-
underline: "none",
|
|
624
|
-
disabled: !!selectAllDisabled,
|
|
625
|
-
onClick: selectAll,
|
|
626
|
-
tabIndex: 0,
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ jsx(
|
|
629
|
-
Checkbox,
|
|
630
|
-
{
|
|
631
|
-
checked: areAllSelected,
|
|
632
|
-
indeterminate: areAnySelected && !areAllSelected,
|
|
633
|
-
disabled: selectAllDisabled
|
|
634
|
-
}
|
|
635
|
-
),
|
|
636
|
-
intlConfig.formatMessage({ id: "c4r.form.selectAll" })
|
|
637
|
-
]
|
|
638
|
-
}
|
|
639
|
-
)
|
|
640
|
-
}
|
|
641
|
-
);
|
|
642
|
-
}
|
|
643
|
-
const MenuItemFilter = forwardRef(_MenuItemFilter);
|
|
644
302
|
function useMultipleSelectField({
|
|
645
303
|
selectedOptions,
|
|
646
304
|
options,
|
|
@@ -702,7 +360,7 @@ function useMultipleSelectField({
|
|
|
702
360
|
unselectAll
|
|
703
361
|
};
|
|
704
362
|
}
|
|
705
|
-
const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
|
|
363
|
+
const StyledMenuItem = styled(MenuItem$1)(({ theme }) => ({
|
|
706
364
|
"&.Mui-disabled": {
|
|
707
365
|
pointerEvents: "auto",
|
|
708
366
|
"&:hover": {
|
|
@@ -1290,7 +948,7 @@ function useAutocompleteRenderOption() {
|
|
|
1290
948
|
const { key, ...otherProps } = props;
|
|
1291
949
|
if (isAutocompleteListGroupHeader(option)) {
|
|
1292
950
|
return /* @__PURE__ */ createElement(
|
|
1293
|
-
MenuItem
|
|
951
|
+
MenuItem,
|
|
1294
952
|
{
|
|
1295
953
|
...otherProps,
|
|
1296
954
|
subtitle: true,
|
|
@@ -1332,7 +990,7 @@ function useAutocompleteRenderOption() {
|
|
|
1332
990
|
return /* @__PURE__ */ jsx(Fragment$1, { children: divider ? /* @__PURE__ */ jsx(Divider, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1333
991
|
inputValue && /* @__PURE__ */ jsx(Divider, {}),
|
|
1334
992
|
/* @__PURE__ */ jsxs(
|
|
1335
|
-
MenuItem
|
|
993
|
+
MenuItem,
|
|
1336
994
|
{
|
|
1337
995
|
...otherProps,
|
|
1338
996
|
...!isPrimitiveOptionType && {
|
|
@@ -1871,96 +1529,6 @@ function useAutocomplete({
|
|
|
1871
1529
|
getOptionLabel: internalGetOptionLabel
|
|
1872
1530
|
};
|
|
1873
1531
|
}
|
|
1874
|
-
const _CopiableComponent = ({
|
|
1875
|
-
children,
|
|
1876
|
-
disabled,
|
|
1877
|
-
value,
|
|
1878
|
-
onCopied,
|
|
1879
|
-
copyText = "c4r.button.copy",
|
|
1880
|
-
copiedText = "c4r.notifications.copiedToClipboard",
|
|
1881
|
-
button,
|
|
1882
|
-
buttonLabel,
|
|
1883
|
-
buttonProps,
|
|
1884
|
-
ariaLabel,
|
|
1885
|
-
dataTestId,
|
|
1886
|
-
tooltipPlacement = "top",
|
|
1887
|
-
...props
|
|
1888
|
-
}, ref) => {
|
|
1889
|
-
const intl = useIntl();
|
|
1890
|
-
const intlConfig = useImperativeIntl(intl);
|
|
1891
|
-
const [open, setOpen] = useState(false);
|
|
1892
|
-
const { copy } = useCopyValue(copyText, copiedText);
|
|
1893
|
-
const handleClick = (e) => {
|
|
1894
|
-
e.preventDefault();
|
|
1895
|
-
copy(value).then(() => {
|
|
1896
|
-
onCopied == null ? void 0 : onCopied();
|
|
1897
|
-
setOpen(true);
|
|
1898
|
-
}).catch(console.error);
|
|
1899
|
-
};
|
|
1900
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1901
|
-
/* @__PURE__ */ jsx(
|
|
1902
|
-
Tooltip,
|
|
1903
|
-
{
|
|
1904
|
-
title: intlConfig.formatMessage({ id: copyText }),
|
|
1905
|
-
leaveDelay: 0,
|
|
1906
|
-
placement: tooltipPlacement,
|
|
1907
|
-
children: /* @__PURE__ */ jsxs(
|
|
1908
|
-
Box,
|
|
1909
|
-
{
|
|
1910
|
-
...props,
|
|
1911
|
-
sx: { cursor: disabled ? void 0 : "pointer" },
|
|
1912
|
-
onClick: handleClick,
|
|
1913
|
-
"data-name": "copiable",
|
|
1914
|
-
ref,
|
|
1915
|
-
children: [
|
|
1916
|
-
children,
|
|
1917
|
-
button && /* @__PURE__ */ jsx(
|
|
1918
|
-
IconButton$1,
|
|
1919
|
-
{
|
|
1920
|
-
...buttonProps,
|
|
1921
|
-
disabled,
|
|
1922
|
-
icon: /* @__PURE__ */ jsx(ContentCopyOutlined, {}),
|
|
1923
|
-
"data-testid": dataTestId,
|
|
1924
|
-
"aria-label": ariaLabel || buttonLabel,
|
|
1925
|
-
sx: {
|
|
1926
|
-
display: "flex"
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
)
|
|
1930
|
-
]
|
|
1931
|
-
}
|
|
1932
|
-
)
|
|
1933
|
-
}
|
|
1934
|
-
),
|
|
1935
|
-
/* @__PURE__ */ jsx(
|
|
1936
|
-
Snackbar,
|
|
1937
|
-
{
|
|
1938
|
-
open,
|
|
1939
|
-
autoWidth: true,
|
|
1940
|
-
closeable: false,
|
|
1941
|
-
autoHideDuration: 4e3,
|
|
1942
|
-
onClose: () => setOpen(false),
|
|
1943
|
-
children: intlConfig.formatMessage({ id: copiedText })
|
|
1944
|
-
}
|
|
1945
|
-
)
|
|
1946
|
-
] });
|
|
1947
|
-
};
|
|
1948
|
-
const CopiableComponent = forwardRef(_CopiableComponent);
|
|
1949
|
-
async function copyString(value) {
|
|
1950
|
-
return await navigator.clipboard.writeText(value);
|
|
1951
|
-
}
|
|
1952
|
-
const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
|
|
1953
|
-
const [message, setMessage] = useState(msg);
|
|
1954
|
-
const copy = async (text) => {
|
|
1955
|
-
await copyString(text);
|
|
1956
|
-
setMessage(copiedMsg);
|
|
1957
|
-
setTimeout(() => setMessage(msg), 1e3);
|
|
1958
|
-
};
|
|
1959
|
-
return {
|
|
1960
|
-
message,
|
|
1961
|
-
copy
|
|
1962
|
-
};
|
|
1963
|
-
};
|
|
1964
1532
|
const AccordionContainer = styled("div", {
|
|
1965
1533
|
shouldForwardProp: (prop) => prop !== "variant"
|
|
1966
1534
|
})(({ variant, theme }) => ({
|
|
@@ -2314,71 +1882,610 @@ const TagRoot = styled("div", {
|
|
|
2314
1882
|
}
|
|
2315
1883
|
}
|
|
2316
1884
|
};
|
|
2317
|
-
});
|
|
2318
|
-
const TagIcon = styled("div")(({ theme }) => ({
|
|
1885
|
+
});
|
|
1886
|
+
const TagIcon = styled("div")(({ theme }) => ({
|
|
1887
|
+
display: "flex",
|
|
1888
|
+
justifyContent: "center",
|
|
1889
|
+
alignItems: "center",
|
|
1890
|
+
"& svg": {
|
|
1891
|
+
width: theme.spacing(ICON_SIZE_SMALL),
|
|
1892
|
+
height: theme.spacing(ICON_SIZE_SMALL),
|
|
1893
|
+
"& g": {
|
|
1894
|
+
fill: "currentColor"
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}));
|
|
1898
|
+
const TagLabel = styled("div", {
|
|
1899
|
+
shouldForwardProp: (prop) => !["type"].includes(prop)
|
|
1900
|
+
})(({ type, theme }) => ({
|
|
1901
|
+
display: "flex",
|
|
1902
|
+
alignItems: "center",
|
|
1903
|
+
paddingTop: type === "code" ? theme.spacing(0.25) : void 0
|
|
1904
|
+
}));
|
|
1905
|
+
function _Tag({
|
|
1906
|
+
label,
|
|
1907
|
+
color = "primary",
|
|
1908
|
+
variant = "filled",
|
|
1909
|
+
icon,
|
|
1910
|
+
type = "default",
|
|
1911
|
+
typographyProps,
|
|
1912
|
+
noWrap = true,
|
|
1913
|
+
disabled,
|
|
1914
|
+
...otherProps
|
|
1915
|
+
}, ref) {
|
|
1916
|
+
const typeCode = type === "code";
|
|
1917
|
+
return /* @__PURE__ */ jsxs(
|
|
1918
|
+
TagRoot,
|
|
1919
|
+
{
|
|
1920
|
+
ref,
|
|
1921
|
+
className: "CartoTag-root",
|
|
1922
|
+
color,
|
|
1923
|
+
variant,
|
|
1924
|
+
disabled,
|
|
1925
|
+
"aria-disabled": disabled,
|
|
1926
|
+
"data-color": color,
|
|
1927
|
+
"data-variant": variant,
|
|
1928
|
+
"data-type": type,
|
|
1929
|
+
"data-name": "tag",
|
|
1930
|
+
...otherProps,
|
|
1931
|
+
children: [
|
|
1932
|
+
icon && /* @__PURE__ */ jsx(TagIcon, { children: icon }),
|
|
1933
|
+
/* @__PURE__ */ jsx(TagLabel, { type, children: /* @__PURE__ */ jsx(
|
|
1934
|
+
Typography,
|
|
1935
|
+
{
|
|
1936
|
+
component: "span",
|
|
1937
|
+
color: "inherit",
|
|
1938
|
+
variant: typeCode ? "code3" : "caption",
|
|
1939
|
+
weight: typeCode ? "strong" : "medium",
|
|
1940
|
+
noWrap,
|
|
1941
|
+
...typographyProps,
|
|
1942
|
+
children: label
|
|
1943
|
+
}
|
|
1944
|
+
) })
|
|
1945
|
+
]
|
|
1946
|
+
}
|
|
1947
|
+
);
|
|
1948
|
+
}
|
|
1949
|
+
const Tag = forwardRef(_Tag);
|
|
1950
|
+
const _CopiableComponent = ({
|
|
1951
|
+
children,
|
|
1952
|
+
disabled,
|
|
1953
|
+
value,
|
|
1954
|
+
onCopied,
|
|
1955
|
+
copyText,
|
|
1956
|
+
copiedText,
|
|
1957
|
+
button,
|
|
1958
|
+
buttonLabel,
|
|
1959
|
+
buttonProps,
|
|
1960
|
+
ariaLabel,
|
|
1961
|
+
dataTestId,
|
|
1962
|
+
tooltipPlacement = "top",
|
|
1963
|
+
...props
|
|
1964
|
+
}, ref) => {
|
|
1965
|
+
const [open, setOpen] = useState(false);
|
|
1966
|
+
const intl = useIntl();
|
|
1967
|
+
const intlConfig = useImperativeIntl(intl);
|
|
1968
|
+
const copyTooltipText = copyText || intlConfig.formatMessage({ id: "c4r.button.copy" });
|
|
1969
|
+
const copySuccessMessage = copiedText || intlConfig.formatMessage({
|
|
1970
|
+
id: "c4r.notifications.copiedToClipboard"
|
|
1971
|
+
});
|
|
1972
|
+
const { copy } = useCopyValue(copyTooltipText, copySuccessMessage);
|
|
1973
|
+
const handleClick = (e) => {
|
|
1974
|
+
e.preventDefault();
|
|
1975
|
+
copy(value).then(() => {
|
|
1976
|
+
onCopied == null ? void 0 : onCopied();
|
|
1977
|
+
setOpen(true);
|
|
1978
|
+
}).catch(console.error);
|
|
1979
|
+
};
|
|
1980
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1981
|
+
/* @__PURE__ */ jsx(
|
|
1982
|
+
Tooltip,
|
|
1983
|
+
{
|
|
1984
|
+
title: copyTooltipText,
|
|
1985
|
+
leaveDelay: 0,
|
|
1986
|
+
placement: tooltipPlacement,
|
|
1987
|
+
children: /* @__PURE__ */ jsxs(
|
|
1988
|
+
Box,
|
|
1989
|
+
{
|
|
1990
|
+
...props,
|
|
1991
|
+
sx: { cursor: disabled ? void 0 : "pointer" },
|
|
1992
|
+
onClick: handleClick,
|
|
1993
|
+
"data-name": "copiable",
|
|
1994
|
+
ref,
|
|
1995
|
+
children: [
|
|
1996
|
+
children,
|
|
1997
|
+
button && /* @__PURE__ */ jsx(
|
|
1998
|
+
IconButton$1,
|
|
1999
|
+
{
|
|
2000
|
+
...buttonProps,
|
|
2001
|
+
disabled,
|
|
2002
|
+
icon: /* @__PURE__ */ jsx(ContentCopyOutlined, {}),
|
|
2003
|
+
"data-testid": dataTestId,
|
|
2004
|
+
"aria-label": ariaLabel || buttonLabel || copyTooltipText,
|
|
2005
|
+
sx: {
|
|
2006
|
+
display: "flex"
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
)
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
)
|
|
2013
|
+
}
|
|
2014
|
+
),
|
|
2015
|
+
/* @__PURE__ */ jsx(
|
|
2016
|
+
Snackbar,
|
|
2017
|
+
{
|
|
2018
|
+
open,
|
|
2019
|
+
autoWidth: true,
|
|
2020
|
+
closeable: false,
|
|
2021
|
+
autoHideDuration: 4e3,
|
|
2022
|
+
onClose: () => setOpen(false),
|
|
2023
|
+
children: copySuccessMessage
|
|
2024
|
+
}
|
|
2025
|
+
)
|
|
2026
|
+
] });
|
|
2027
|
+
};
|
|
2028
|
+
const CopiableComponent = forwardRef(_CopiableComponent);
|
|
2029
|
+
const StyledTextField = styled(TextField, {
|
|
2030
|
+
shouldForwardProp: (prop) => !["isInputFocused"].includes(prop)
|
|
2031
|
+
})(({ isInputFocused }) => ({
|
|
2032
|
+
"& input": {
|
|
2033
|
+
pointerEvents: isInputFocused ? "auto" : "none"
|
|
2034
|
+
// Disable pointer events when not focused https://issues.chromium.org/issues/41245282
|
|
2035
|
+
}
|
|
2036
|
+
}));
|
|
2037
|
+
const AdornmentWrapper = styled(Box, {
|
|
2038
|
+
shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
|
|
2039
|
+
})(({ variant, size, theme }) => ({
|
|
2040
|
+
width: theme.spacing(3),
|
|
2041
|
+
...variant === "standard" ? {
|
|
2042
|
+
marginLeft: theme.spacing(-0.25)
|
|
2043
|
+
} : {
|
|
2044
|
+
marginRight: theme.spacing(-1)
|
|
2045
|
+
},
|
|
2046
|
+
...size === "medium" && {
|
|
2047
|
+
width: theme.spacing(4),
|
|
2048
|
+
...variant === "standard" ? {
|
|
2049
|
+
marginLeft: theme.spacing(-0.5)
|
|
2050
|
+
} : {
|
|
2051
|
+
marginLeft: theme.spacing(1)
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}));
|
|
2055
|
+
function _CopiableInputText({
|
|
2056
|
+
value,
|
|
2057
|
+
variant,
|
|
2058
|
+
InputProps,
|
|
2059
|
+
extraEndAdornment,
|
|
2060
|
+
onCopied,
|
|
2061
|
+
password,
|
|
2062
|
+
size = "small",
|
|
2063
|
+
onFocus,
|
|
2064
|
+
onBlur,
|
|
2065
|
+
...rest
|
|
2066
|
+
}, ref) {
|
|
2067
|
+
const intl = useIntl();
|
|
2068
|
+
const intlConfig = useImperativeIntl(intl);
|
|
2069
|
+
const [showText, setShowText] = useState(false);
|
|
2070
|
+
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
2071
|
+
const inputType = !password ? "text" : showText ? "text" : "password";
|
|
2072
|
+
const showTextLabel = intlConfig.formatMessage({
|
|
2073
|
+
id: showText ? "c4r.button.hide" : "c4r.button.show"
|
|
2074
|
+
});
|
|
2075
|
+
const handleFocus = (event) => {
|
|
2076
|
+
setIsInputFocused(true);
|
|
2077
|
+
onFocus == null ? void 0 : onFocus(event);
|
|
2078
|
+
};
|
|
2079
|
+
const handleBlur = (event) => {
|
|
2080
|
+
setIsInputFocused(false);
|
|
2081
|
+
onBlur == null ? void 0 : onBlur(event);
|
|
2082
|
+
};
|
|
2083
|
+
const passwordAdornment = /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
|
|
2084
|
+
IconButton$1,
|
|
2085
|
+
{
|
|
2086
|
+
edge: variant !== "standard" ? "end" : void 0,
|
|
2087
|
+
onClick: () => setShowText(!showText),
|
|
2088
|
+
size,
|
|
2089
|
+
icon: showText ? /* @__PURE__ */ jsx(VisibilityOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOffOutlined, {}),
|
|
2090
|
+
tooltip: showTextLabel,
|
|
2091
|
+
"aria-label": showTextLabel
|
|
2092
|
+
}
|
|
2093
|
+
) });
|
|
2094
|
+
return /* @__PURE__ */ jsx(
|
|
2095
|
+
StyledTextField,
|
|
2096
|
+
{
|
|
2097
|
+
...rest,
|
|
2098
|
+
isInputFocused,
|
|
2099
|
+
size,
|
|
2100
|
+
value,
|
|
2101
|
+
variant,
|
|
2102
|
+
InputProps: {
|
|
2103
|
+
readOnly: true,
|
|
2104
|
+
onFocus: handleFocus,
|
|
2105
|
+
onBlur: handleBlur,
|
|
2106
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2107
|
+
password ? passwordAdornment : extraEndAdornment,
|
|
2108
|
+
/* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(AdornmentWrapper, { size, variant, children: /* @__PURE__ */ jsx(
|
|
2109
|
+
CopiableComponent,
|
|
2110
|
+
{
|
|
2111
|
+
value,
|
|
2112
|
+
onCopied,
|
|
2113
|
+
button: true,
|
|
2114
|
+
buttonProps: {
|
|
2115
|
+
size
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
) }) })
|
|
2119
|
+
] }),
|
|
2120
|
+
...variant === "filled" && {
|
|
2121
|
+
disableUnderline: true
|
|
2122
|
+
},
|
|
2123
|
+
...InputProps
|
|
2124
|
+
},
|
|
2125
|
+
type: inputType,
|
|
2126
|
+
"data-name": "copiable-input-text",
|
|
2127
|
+
ref
|
|
2128
|
+
}
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
const CopiableInputText = forwardRef(_CopiableInputText);
|
|
2132
|
+
async function copyString(value) {
|
|
2133
|
+
return await navigator.clipboard.writeText(value);
|
|
2134
|
+
}
|
|
2135
|
+
const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
|
|
2136
|
+
const [message, setMessage] = useState(msg);
|
|
2137
|
+
const copy = async (text) => {
|
|
2138
|
+
await copyString(text);
|
|
2139
|
+
setMessage(copiedMsg);
|
|
2140
|
+
setTimeout(() => setMessage(msg), 1e3);
|
|
2141
|
+
};
|
|
2142
|
+
return {
|
|
2143
|
+
message,
|
|
2144
|
+
copy
|
|
2145
|
+
};
|
|
2146
|
+
};
|
|
2147
|
+
const IndicatorIcon = styled(Box)({
|
|
2148
|
+
position: "absolute",
|
|
2149
|
+
top: 0,
|
|
2150
|
+
left: 0,
|
|
2151
|
+
right: 0,
|
|
2152
|
+
bottom: 0,
|
|
2153
|
+
display: "flex",
|
|
2154
|
+
alignItems: "center",
|
|
2155
|
+
justifyContent: "center"
|
|
2156
|
+
});
|
|
2157
|
+
const HiddenText = styled(Box)({
|
|
2158
|
+
visibility: "hidden",
|
|
2159
|
+
pointerEvents: "none"
|
|
2160
|
+
});
|
|
2161
|
+
function _Button({
|
|
2162
|
+
children,
|
|
2163
|
+
loading,
|
|
2164
|
+
disabled,
|
|
2165
|
+
startIcon,
|
|
2166
|
+
endIcon,
|
|
2167
|
+
loadingPosition,
|
|
2168
|
+
external,
|
|
2169
|
+
showExternalIcon = true,
|
|
2170
|
+
"aria-describedby": ariaDescribedby,
|
|
2171
|
+
...otherProps
|
|
2172
|
+
}, ref) {
|
|
2173
|
+
const intl = useIntl();
|
|
2174
|
+
const intlConfig = useImperativeIntl(intl);
|
|
2175
|
+
const defaultIconLoader = /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" });
|
|
2176
|
+
const isDefaultLoading = loading && loadingPosition === void 0;
|
|
2177
|
+
const isExternalLink = otherProps.href && external;
|
|
2178
|
+
const renderContent = () => {
|
|
2179
|
+
if (isDefaultLoading) {
|
|
2180
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
|
|
2181
|
+
/* @__PURE__ */ jsx(IndicatorIcon, { children: defaultIconLoader }),
|
|
2182
|
+
/* @__PURE__ */ jsx(HiddenText, { children })
|
|
2183
|
+
] });
|
|
2184
|
+
}
|
|
2185
|
+
if (isExternalLink) {
|
|
2186
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2187
|
+
children,
|
|
2188
|
+
/* @__PURE__ */ jsx(ScreenReaderOnly, { id: "external-hint", children: `(${intlConfig.formatMessage({
|
|
2189
|
+
id: "c4r.button.opensInNewTab"
|
|
2190
|
+
})})` })
|
|
2191
|
+
] });
|
|
2192
|
+
}
|
|
2193
|
+
return children;
|
|
2194
|
+
};
|
|
2195
|
+
const getIconForPosition = (position) => {
|
|
2196
|
+
if (isDefaultLoading) {
|
|
2197
|
+
return void 0;
|
|
2198
|
+
}
|
|
2199
|
+
if (loading && loadingPosition !== void 0) {
|
|
2200
|
+
if (loadingPosition === position) {
|
|
2201
|
+
return defaultIconLoader;
|
|
2202
|
+
}
|
|
2203
|
+
return void 0;
|
|
2204
|
+
}
|
|
2205
|
+
if (position === "start") {
|
|
2206
|
+
return startIcon;
|
|
2207
|
+
} else {
|
|
2208
|
+
return endIcon || (isExternalLink && showExternalIcon ? /* @__PURE__ */ jsx(OpenInNewOutlined, {}) : void 0);
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
return /* @__PURE__ */ jsx(
|
|
2212
|
+
Button$1,
|
|
2213
|
+
{
|
|
2214
|
+
disabled: loading || disabled,
|
|
2215
|
+
startIcon: getIconForPosition("start"),
|
|
2216
|
+
endIcon: getIconForPosition("end"),
|
|
2217
|
+
...otherProps,
|
|
2218
|
+
role: otherProps.href ? "link" : "button",
|
|
2219
|
+
...isExternalLink && {
|
|
2220
|
+
target: "_blank",
|
|
2221
|
+
rel: "noopener noreferrer"
|
|
2222
|
+
},
|
|
2223
|
+
ref,
|
|
2224
|
+
"aria-describedby": isExternalLink ? "external-hint" : ariaDescribedby,
|
|
2225
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
|
|
2226
|
+
}
|
|
2227
|
+
);
|
|
2228
|
+
}
|
|
2229
|
+
const Button = forwardRef(_Button);
|
|
2230
|
+
const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
|
|
2231
|
+
"& .MuiButton-root:last-child": {
|
|
2232
|
+
padding: 0,
|
|
2233
|
+
minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
|
|
2234
|
+
}
|
|
2235
|
+
}));
|
|
2236
|
+
function SplitButton({
|
|
2237
|
+
options,
|
|
2238
|
+
disabled,
|
|
2239
|
+
loading,
|
|
2240
|
+
loadingPosition,
|
|
2241
|
+
onClick,
|
|
2242
|
+
variant,
|
|
2243
|
+
size,
|
|
2244
|
+
color,
|
|
2245
|
+
...otherProps
|
|
2246
|
+
}) {
|
|
2247
|
+
var _a;
|
|
2248
|
+
const [open, setOpen] = useState(false);
|
|
2249
|
+
const anchorRef = useRef(null);
|
|
2250
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
2251
|
+
const handleClick = () => {
|
|
2252
|
+
onClick(options[selectedIndex]);
|
|
2253
|
+
};
|
|
2254
|
+
const handleMenuItemClick = (_, index) => {
|
|
2255
|
+
setSelectedIndex(index);
|
|
2256
|
+
setOpen(false);
|
|
2257
|
+
};
|
|
2258
|
+
const handleToggle = () => {
|
|
2259
|
+
setOpen((prevOpen) => !prevOpen);
|
|
2260
|
+
};
|
|
2261
|
+
const handleClose = (event) => {
|
|
2262
|
+
var _a2;
|
|
2263
|
+
if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2266
|
+
setOpen(false);
|
|
2267
|
+
};
|
|
2268
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2269
|
+
/* @__PURE__ */ jsxs(
|
|
2270
|
+
ButtonGroup,
|
|
2271
|
+
{
|
|
2272
|
+
"data-name": "split-button",
|
|
2273
|
+
ref: anchorRef,
|
|
2274
|
+
variant,
|
|
2275
|
+
size,
|
|
2276
|
+
color,
|
|
2277
|
+
...otherProps,
|
|
2278
|
+
children: [
|
|
2279
|
+
/* @__PURE__ */ jsx(
|
|
2280
|
+
Button,
|
|
2281
|
+
{
|
|
2282
|
+
disabled,
|
|
2283
|
+
loading,
|
|
2284
|
+
loadingPosition,
|
|
2285
|
+
onClick: handleClick,
|
|
2286
|
+
children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
|
|
2287
|
+
}
|
|
2288
|
+
),
|
|
2289
|
+
/* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
|
|
2290
|
+
]
|
|
2291
|
+
}
|
|
2292
|
+
),
|
|
2293
|
+
/* @__PURE__ */ jsx(
|
|
2294
|
+
Popper,
|
|
2295
|
+
{
|
|
2296
|
+
sx: { zIndex: 1 },
|
|
2297
|
+
open,
|
|
2298
|
+
anchorEl: anchorRef.current,
|
|
2299
|
+
role: void 0,
|
|
2300
|
+
transition: true,
|
|
2301
|
+
disablePortal: true,
|
|
2302
|
+
placement: "bottom-end",
|
|
2303
|
+
children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
|
|
2304
|
+
Grow,
|
|
2305
|
+
{
|
|
2306
|
+
...TransitionProps,
|
|
2307
|
+
style: {
|
|
2308
|
+
transformOrigin: placement === "bottom" ? "center top" : "center bottom"
|
|
2309
|
+
},
|
|
2310
|
+
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(
|
|
2311
|
+
MenuItem$1,
|
|
2312
|
+
{
|
|
2313
|
+
disabled: option.disabled,
|
|
2314
|
+
selected: index === selectedIndex,
|
|
2315
|
+
onClick: (event) => handleMenuItemClick(event, index),
|
|
2316
|
+
children: option.label
|
|
2317
|
+
},
|
|
2318
|
+
option.label
|
|
2319
|
+
)) }) }) })
|
|
2320
|
+
}
|
|
2321
|
+
)
|
|
2322
|
+
}
|
|
2323
|
+
)
|
|
2324
|
+
] });
|
|
2325
|
+
}
|
|
2326
|
+
const Root$5 = styled(Box)(({ theme }) => ({
|
|
2319
2327
|
display: "flex",
|
|
2320
|
-
justifyContent: "center",
|
|
2321
2328
|
alignItems: "center",
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
}
|
|
2329
|
+
gap: theme.spacing(0.5)
|
|
2330
|
+
}));
|
|
2331
|
+
const Indicator = styled(Typography)(({ theme }) => ({
|
|
2332
|
+
".Mui-disabled &": {
|
|
2333
|
+
color: theme.palette.text.disabled
|
|
2328
2334
|
}
|
|
2329
2335
|
}));
|
|
2330
|
-
const
|
|
2331
|
-
shouldForwardProp: (prop) => !["type"].includes(prop)
|
|
2332
|
-
})(({ type, theme }) => ({
|
|
2336
|
+
const Icon = styled(Box)(({ theme }) => ({
|
|
2333
2337
|
display: "flex",
|
|
2334
|
-
|
|
2335
|
-
|
|
2338
|
+
svg: {
|
|
2339
|
+
width: ICON_SIZE_SMALL,
|
|
2340
|
+
height: ICON_SIZE_SMALL,
|
|
2341
|
+
fontSize: ICON_SIZE_SMALL,
|
|
2342
|
+
path: {
|
|
2343
|
+
fill: theme.palette.text.secondary,
|
|
2344
|
+
".Mui-disabled &": {
|
|
2345
|
+
fill: theme.palette.text.disabled
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2336
2349
|
}));
|
|
2337
|
-
function
|
|
2350
|
+
function LabelWithIndicator({
|
|
2338
2351
|
label,
|
|
2339
|
-
|
|
2340
|
-
variant = "filled",
|
|
2352
|
+
type,
|
|
2341
2353
|
icon,
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2354
|
+
inheritSize
|
|
2355
|
+
}) {
|
|
2356
|
+
return /* @__PURE__ */ jsxs(Root$5, { children: [
|
|
2357
|
+
label,
|
|
2358
|
+
type && /* @__PURE__ */ jsx(
|
|
2359
|
+
Indicator,
|
|
2360
|
+
{
|
|
2361
|
+
component: "span",
|
|
2362
|
+
variant: inheritSize ? "inherit" : "caption",
|
|
2363
|
+
color: "textSecondary",
|
|
2364
|
+
weight: "regular",
|
|
2365
|
+
children: type === "required" ? "(required)" : "(optional)"
|
|
2366
|
+
}
|
|
2367
|
+
),
|
|
2368
|
+
icon && /* @__PURE__ */ jsx(Icon, { children: icon })
|
|
2369
|
+
] });
|
|
2370
|
+
}
|
|
2371
|
+
function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
|
|
2372
|
+
const intl = useIntl();
|
|
2373
|
+
const intlConfig = useImperativeIntl(intl);
|
|
2374
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
2375
|
+
const handleClickShowPassword = () => setShowPassword(!showPassword);
|
|
2376
|
+
return /* @__PURE__ */ jsx(
|
|
2377
|
+
TextField,
|
|
2351
2378
|
{
|
|
2352
|
-
ref,
|
|
2353
|
-
className: "CartoTag-root",
|
|
2354
|
-
color,
|
|
2355
|
-
variant,
|
|
2356
|
-
disabled,
|
|
2357
|
-
"aria-disabled": disabled,
|
|
2358
|
-
"data-color": color,
|
|
2359
|
-
"data-variant": variant,
|
|
2360
|
-
"data-type": type,
|
|
2361
|
-
"data-name": "tag",
|
|
2362
2379
|
...otherProps,
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2380
|
+
ref,
|
|
2381
|
+
type: showPassword ? "text" : "password",
|
|
2382
|
+
size,
|
|
2383
|
+
InputProps: {
|
|
2384
|
+
...InputProps,
|
|
2385
|
+
endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsx(
|
|
2386
|
+
Tooltip,
|
|
2367
2387
|
{
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
noWrap,
|
|
2373
|
-
...typographyProps,
|
|
2374
|
-
children: label
|
|
2388
|
+
title: intlConfig.formatMessage({
|
|
2389
|
+
id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
|
|
2390
|
+
}),
|
|
2391
|
+
children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOutlined, {})
|
|
2375
2392
|
}
|
|
2376
|
-
) })
|
|
2377
|
-
|
|
2393
|
+
) }) })
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
const PasswordField = forwardRef(_PasswordField);
|
|
2399
|
+
const StyledToggleButtonGroup = styled(ToggleButtonGroup$1, {
|
|
2400
|
+
shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
|
|
2401
|
+
})(({ variant, backgroundColor, theme }) => ({
|
|
2402
|
+
// Variants
|
|
2403
|
+
...variant === "contained" && {
|
|
2404
|
+
boxShadow: "none"
|
|
2405
|
+
},
|
|
2406
|
+
...variant === "unbounded" && {
|
|
2407
|
+
boxShadow: "none",
|
|
2408
|
+
borderRadius: theme.spacing(0.5),
|
|
2409
|
+
"& .MuiDivider-root": {
|
|
2410
|
+
height: theme.spacing(4),
|
|
2411
|
+
"&.MuiToggleButtonGroup-groupedHorizontal": {
|
|
2412
|
+
height: theme.spacing(4)
|
|
2413
|
+
},
|
|
2414
|
+
"&.MuiToggleButtonGroup-groupedVertical": {
|
|
2415
|
+
height: "auto",
|
|
2416
|
+
width: theme.spacing(4),
|
|
2417
|
+
margin: `${theme.spacing(0.5, 0, 1)} !important`,
|
|
2418
|
+
borderRadius: "0 !important"
|
|
2419
|
+
}
|
|
2420
|
+
},
|
|
2421
|
+
"& .MuiToggleButton-sizeSmall": {
|
|
2422
|
+
margin: 0,
|
|
2423
|
+
"&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
|
|
2424
|
+
margin: 0
|
|
2425
|
+
},
|
|
2426
|
+
"& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
|
|
2427
|
+
height: theme.spacing(3)
|
|
2428
|
+
},
|
|
2429
|
+
"& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
|
|
2430
|
+
height: "auto",
|
|
2431
|
+
width: theme.spacing(3)
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
|
|
2435
|
+
margin: 0,
|
|
2436
|
+
"&:first-of-type": {
|
|
2437
|
+
marginLeft: 0
|
|
2438
|
+
},
|
|
2439
|
+
"&:not(:last-of-type)": {
|
|
2440
|
+
marginRight: theme.spacing(0.5)
|
|
2441
|
+
}
|
|
2442
|
+
},
|
|
2443
|
+
"&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
|
|
2444
|
+
".MuiToggleButtonGroup-grouped": {
|
|
2445
|
+
margin: theme.spacing(0, 0.5)
|
|
2446
|
+
}
|
|
2447
|
+
},
|
|
2448
|
+
"&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
|
|
2449
|
+
".MuiToggleButtonGroup-grouped": {
|
|
2450
|
+
margin: theme.spacing(0, 0, 0.5),
|
|
2451
|
+
"&:not(:last-of-type)": {
|
|
2452
|
+
marginRight: 0
|
|
2453
|
+
},
|
|
2454
|
+
"&:last-of-type": {
|
|
2455
|
+
marginBottom: 0
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
},
|
|
2460
|
+
// Colors
|
|
2461
|
+
...backgroundColor === "primary" && {
|
|
2462
|
+
backgroundColor: theme.palette.background.paper
|
|
2463
|
+
},
|
|
2464
|
+
...backgroundColor === "secondary" && {
|
|
2465
|
+
backgroundColor: theme.palette.background.default
|
|
2466
|
+
},
|
|
2467
|
+
...backgroundColor === "transparent" && {
|
|
2468
|
+
backgroundColor: "transparent"
|
|
2469
|
+
}
|
|
2470
|
+
}));
|
|
2471
|
+
function ToggleButtonGroup({
|
|
2472
|
+
children,
|
|
2473
|
+
variant = "floating",
|
|
2474
|
+
backgroundColor,
|
|
2475
|
+
...rest
|
|
2476
|
+
}) {
|
|
2477
|
+
const isUnbounded = variant === "unbounded";
|
|
2478
|
+
const defaultColor = isUnbounded ? "transparent" : "primary";
|
|
2479
|
+
return /* @__PURE__ */ jsx(
|
|
2480
|
+
StyledToggleButtonGroup,
|
|
2481
|
+
{
|
|
2482
|
+
...rest,
|
|
2483
|
+
variant,
|
|
2484
|
+
backgroundColor: backgroundColor ?? defaultColor,
|
|
2485
|
+
children
|
|
2378
2486
|
}
|
|
2379
2487
|
);
|
|
2380
2488
|
}
|
|
2381
|
-
const Tag = forwardRef(_Tag);
|
|
2382
2489
|
const Menu = styled("div")(({ theme }) => ({
|
|
2383
2490
|
display: "flex",
|
|
2384
2491
|
alignItems: "center",
|
|
@@ -3450,11 +3557,11 @@ function CodeAreaHeader({
|
|
|
3450
3557
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
3451
3558
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
3452
3559
|
children: [
|
|
3453
|
-
/* @__PURE__ */ jsxs(MenuItem
|
|
3560
|
+
/* @__PURE__ */ jsxs(MenuItem, { onClick: handleCopy, disabled, id: "copy", children: [
|
|
3454
3561
|
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ContentCopyOutlined, {}) }),
|
|
3455
3562
|
/* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.copy` }) })
|
|
3456
3563
|
] }),
|
|
3457
|
-
/* @__PURE__ */ jsxs(MenuItem
|
|
3564
|
+
/* @__PURE__ */ jsxs(MenuItem, { onClick: onClickExpand, disabled, id: "expand", children: [
|
|
3458
3565
|
/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(OpenDiagonallyRight, {}) }),
|
|
3459
3566
|
/* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.expand` }) })
|
|
3460
3567
|
] })
|
|
@@ -5109,6 +5216,7 @@ export {
|
|
|
5109
5216
|
CodeAreaInput,
|
|
5110
5217
|
CodeAreaMarkTextPattern,
|
|
5111
5218
|
CopiableComponent,
|
|
5219
|
+
CopiableInputText,
|
|
5112
5220
|
CreatableAutocomplete,
|
|
5113
5221
|
DatePicker,
|
|
5114
5222
|
DateRangePicker,
|
|
@@ -5127,7 +5235,7 @@ export {
|
|
|
5127
5235
|
LabelWithIndicator,
|
|
5128
5236
|
L as Link,
|
|
5129
5237
|
Menu$1 as Menu,
|
|
5130
|
-
MenuItem
|
|
5238
|
+
MenuItem,
|
|
5131
5239
|
MenuItemFilter,
|
|
5132
5240
|
MenuList,
|
|
5133
5241
|
MultipleAutocomplete,
|