@carto/meridian-ds 2.1.1-alpha-copiable-input-text.4 → 2.1.1-alpha-filter-dropdown.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +1 -3
  2. package/dist/{Link-_lzRY1Ay.cjs → Alert-oGAW_syG.cjs} +129 -129
  3. package/dist/{Link-D5fKicEY.js → Alert-yL5uEg4Z.js} +129 -129
  4. package/dist/{MenuItem-BY6fuF5U.cjs → MenuItem-8L6Ub4X5.cjs} +4 -3
  5. package/dist/{MenuItem-CKrhDizf.js → MenuItem-Cx8rUKOU.js} +4 -3
  6. package/dist/{TablePaginationActions-CCDi-BO-.js → TablePaginationActions-BWer8cmX.js} +6 -6
  7. package/dist/{TablePaginationActions-D2K26kdR.cjs → TablePaginationActions-MwqZJoRm.cjs} +6 -6
  8. package/dist/components/index.cjs +897 -989
  9. package/dist/components/index.js +842 -934
  10. package/dist/theme/index.cjs +2 -2
  11. package/dist/theme/index.js +3 -3
  12. package/dist/types/components/atoms/index.d.ts +0 -2
  13. package/dist/types/components/atoms/index.d.ts.map +1 -1
  14. package/dist/types/components/{atoms/Copy/types.d.ts → molecules/Copy/CopiableComponent.d.ts} +5 -11
  15. package/dist/types/components/molecules/Copy/CopiableComponent.d.ts.map +1 -0
  16. package/dist/types/components/molecules/Copy/copyString.d.ts.map +1 -0
  17. package/dist/types/components/{atoms → molecules}/Copy/index.d.ts +1 -2
  18. package/dist/types/components/molecules/Copy/index.d.ts.map +1 -0
  19. package/dist/types/components/molecules/Copy/useCopyValue.d.ts.map +1 -0
  20. package/dist/types/components/molecules/Menu/MenuItem.d.ts.map +1 -1
  21. package/dist/types/components/molecules/index.d.ts +2 -0
  22. package/dist/types/components/molecules/index.d.ts.map +1 -1
  23. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -1
  24. package/dist/types/localization/en.d.ts +2 -2
  25. package/dist/types/localization/es.d.ts +2 -2
  26. package/dist/types/localization/id.d.ts +2 -2
  27. package/dist/types/localization/index.d.ts +6 -6
  28. package/dist/widgets/index.cjs +8 -8
  29. package/dist/widgets/index.js +2 -2
  30. package/package.json +1 -1
  31. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts +0 -4
  32. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts.map +0 -1
  33. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts +0 -18
  34. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts.map +0 -1
  35. package/dist/types/components/atoms/Copy/copyString.d.ts.map +0 -1
  36. package/dist/types/components/atoms/Copy/index.d.ts.map +0 -1
  37. package/dist/types/components/atoms/Copy/types.d.ts.map +0 -1
  38. package/dist/types/components/atoms/Copy/useCopyValue.d.ts.map +0 -1
  39. /package/dist/types/components/{atoms → molecules}/Copy/copyString.d.ts +0 -0
  40. /package/dist/types/components/{atoms → molecules}/Copy/useCopyValue.d.ts +0 -0
@@ -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, 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";
4
+ 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";
5
+ import { OpenInNewOutlined, VisibilityOffOutlined, VisibilityOutlined, Cancel, AddCircleOutlineOutlined, ContentCopyOutlined, CloseOutlined, MenuOutlined, HelpOutline, TodayOutlined, MoreVertOutlined, ErrorOutline, Check } from "@mui/icons-material";
6
+ import { u as useImperativeIntl, T as Typography, c as ICON_SIZE_SMALL, f as MENU_ITEM_SIZE_EXTENDED, e as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, M as MENU_ITEM_SIZE_DEFAULT, N as NOTIFICATION_DURATION_IN_MS, A as APPBAR_SIZE } from "../TablePaginationActions-BWer8cmX.js";
7
+ import { a } from "../TablePaginationActions-BWer8cmX.js";
8
+ import { S as ScreenReaderOnly, I as IconButton$1, A as Alert$1 } from "../Alert-yL5uEg4Z.js";
9
+ import { L } from "../Alert-yL5uEg4Z.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 } from "../MenuItem-CKrhDizf.js";
13
+ import { M as MenuItem$1 } from "../MenuItem-Cx8rUKOU.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,199 +41,311 @@ 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 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
44
+ const IndicatorIcon = styled(Box)({
45
+ position: "absolute",
46
+ top: 0,
47
+ left: 0,
48
+ right: 0,
49
+ bottom: 0,
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
+ ] });
50
81
  }
51
- },
52
- ...width && {
53
- ".MuiList-root": {
54
- width,
55
- minWidth: width
82
+ if (isExternalLink) {
83
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
84
+ children,
85
+ /* @__PURE__ */ jsx(ScreenReaderOnly, { id: "external-hint", children: `(${intlConfig.formatMessage({
86
+ id: "c4r.button.opensInNewTab"
87
+ })})` })
88
+ ] });
56
89
  }
57
- },
58
- ...height && {
59
- ".MuiMenu-paper": {
60
- overflow: "hidden"
61
- },
62
- ".MuiList-root": {
63
- maxHeight: height
90
+ return children;
91
+ };
92
+ const getIconForPosition = (position) => {
93
+ if (isDefaultLoading) {
94
+ return void 0;
64
95
  }
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
96
+ if (loading && loadingPosition !== void 0) {
97
+ if (loadingPosition === position) {
98
+ return defaultIconLoader;
82
99
  }
100
+ return void 0;
83
101
  }
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
93
- }
94
- },
95
- "&.MuiList-root": {
96
- ...width && {
97
- width,
98
- minWidth: width
99
- },
100
- ...height && {
101
- maxHeight: height
102
+ if (position === "start") {
103
+ return startIcon;
104
+ } else {
105
+ return endIcon || (isExternalLink && showExternalIcon ? /* @__PURE__ */ jsx(OpenInNewOutlined, {}) : void 0);
102
106
  }
103
- }
104
- }));
105
- function _MenuList({ extended, width, height, ...otherProps }, ref) {
107
+ };
106
108
  return /* @__PURE__ */ jsx(
107
- StyledMenuList,
109
+ Button$1,
108
110
  {
111
+ disabled: loading || disabled,
112
+ startIcon: getIconForPosition("start"),
113
+ endIcon: getIconForPosition("end"),
109
114
  ...otherProps,
115
+ role: otherProps.href ? "link" : "button",
116
+ ...isExternalLink && {
117
+ target: "_blank",
118
+ rel: "noopener noreferrer"
119
+ },
110
120
  ref,
111
- width,
112
- height,
113
- extended,
114
- "data-name": "menu-list",
115
- "data-width": width,
116
- "data-height": height,
117
- "data-extended": extended
118
- }
119
- );
120
- }
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
- )
121
+ "aria-describedby": isExternalLink ? "external-hint" : ariaDescribedby,
122
+ children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
180
123
  }
181
124
  );
182
125
  }
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)
126
+ const Button = forwardRef(_Button);
127
+ const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
128
+ "& .MuiButton-root:last-child": {
129
+ padding: 0,
130
+ minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
210
131
  }
211
132
  }));
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,
133
+ function SplitButton({
134
+ options,
229
135
  disabled,
230
- fullWidth,
231
- required,
232
- "aria-label": ariaLabel,
136
+ loading,
137
+ loadingPosition,
138
+ onClick,
139
+ variant,
140
+ size,
141
+ color,
233
142
  ...otherProps
234
- }, ref) {
235
- const isSmall = size === "small";
236
- const [defaultId] = useState(() => uniqueId("select-label-"));
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,
345
+ ...otherProps
346
+ }, ref) {
347
+ const isSmall = size === "small";
348
+ const [defaultId] = useState(() => uniqueId("select-label-"));
237
349
  const ariaLabelledBy = label ? labelId ?? defaultId : void 0;
238
350
  return /* @__PURE__ */ jsxs(
239
351
  FormControl,
@@ -299,134 +411,364 @@ function _SelectField({
299
411
  );
300
412
  }
301
413
  const SelectField = forwardRef(_SelectField);
302
- function useMultipleSelectField({
303
- selectedOptions,
304
- options,
305
- onChange
306
- }) {
307
- const [currentOptions, setCurrentOptions] = useState(selectedOptions ?? []);
308
- const isInternalUpdate = useRef(false);
309
- useEffect(() => {
310
- if (!isInternalUpdate.current) {
311
- setCurrentOptions(selectedOptions ?? []);
312
- }
313
- isInternalUpdate.current = false;
314
- }, [selectedOptions]);
315
- const enabledOptions = useMemo(
316
- () => options.filter(({ disabled }) => !disabled),
317
- [options]
318
- );
319
- const enabledOptionValues = useMemo(
320
- () => enabledOptions.map(({ value }) => value),
321
- [enabledOptions]
322
- );
323
- const areAllSelected = enabledOptionValues.length > 0 && enabledOptionValues.every((value) => currentOptions.includes(value));
324
- const areAnySelected = currentOptions.length > 0;
325
- const handleChange = (event) => {
326
- if (isInternalUpdate.current) {
327
- return;
328
- }
329
- const {
330
- target: { value }
331
- } = event;
332
- const newOptions = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
333
- setCurrentOptions(newOptions);
334
- onChange(newOptions);
335
- };
336
- const selectAll = () => {
337
- const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
338
- if (optionsValues) {
339
- const allSelected = optionsValues.every(
340
- (value) => currentOptions.includes(value)
341
- );
342
- const newValue = allSelected ? [] : optionsValues;
343
- isInternalUpdate.current = true;
344
- setCurrentOptions(newValue);
345
- onChange(newValue);
346
- }
347
- };
348
- const unselectAll = () => {
349
- const newValue = [];
350
- isInternalUpdate.current = true;
351
- setCurrentOptions(newValue);
352
- onChange(newValue);
353
- };
354
- return {
355
- areAllSelected,
356
- areAnySelected,
357
- currentOptions,
358
- handleChange,
359
- selectAll,
360
- unselectAll
361
- };
362
- }
363
- const StyledMenuItem = styled(MenuItem$1)(({ theme }) => ({
364
- "&.Mui-disabled": {
365
- pointerEvents: "auto",
366
- "&:hover": {
367
- backgroundColor: `${theme.palette.background.default} !important`
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
+ }
368
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"
369
484
  }
370
485
  }));
371
- const UnselectButton = styled(InputAdornment, {
372
- shouldForwardProp: (prop) => prop !== "size"
373
- })(({ theme, size }) => ({
374
- display: "none",
375
- position: "absolute",
376
- top: theme.spacing(2),
377
- right: theme.spacing(3.5),
378
- ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
379
- display: "flex"
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
+ }
380
511
  },
381
- ".MuiSvgIcon-root": {
382
- color: theme.palette.text.hint
512
+ ...width && {
513
+ ".MuiList-root": {
514
+ width,
515
+ minWidth: width
516
+ }
383
517
  },
384
- ...size === "medium" && {
385
- top: theme.spacing(3),
386
- right: theme.spacing(5)
518
+ ...height && {
519
+ ".MuiMenu-paper": {
520
+ overflow: "hidden"
521
+ },
522
+ ".MuiList-root": {
523
+ maxHeight: height
524
+ }
387
525
  }
388
526
  }));
389
- const EMPTY_ARRAY = [];
390
- const EMPTY_FN = () => void 0;
391
- function _MultipleSelectField({
392
- options = EMPTY_ARRAY,
393
- selectedOptions,
394
- size = "small",
395
- placeholder,
396
- showCounter,
397
- showFilters = true,
398
- onChange = EMPTY_FN,
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,
399
603
  selectAllDisabled,
400
- tooltipPlacement,
401
- variant,
402
- ...props
604
+ "aria-label": ariaLabel,
605
+ "data-testid": dataTestId
403
606
  }, ref) {
404
- const {
405
- areAllSelected,
406
- areAnySelected,
407
- currentOptions,
408
- handleChange,
409
- selectAll,
410
- unselectAll
411
- } = useMultipleSelectField({
412
- options,
413
- selectedOptions,
414
- onChange
415
- });
416
- const isSmall = size === "small";
417
- const paddingSize = isSmall || variant === "standard" ? 0 : 2;
418
607
  const intl = useIntl();
419
608
  const intlConfig = useImperativeIntl(intl);
420
- const counterText = `${currentOptions.length} ${intlConfig.formatMessage({
421
- id: "c4r.form.selected"
422
- })}`;
423
- const renderValue = useMemo(() => {
424
- if (areAllSelected) {
425
- return /* @__PURE__ */ jsx(
426
- Typography,
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,
427
619
  {
428
- component: "span",
429
- variant: isSmall ? "body2" : "body1",
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
+ function useMultipleSelectField({
645
+ selectedOptions,
646
+ options,
647
+ onChange
648
+ }) {
649
+ const [currentOptions, setCurrentOptions] = useState(selectedOptions ?? []);
650
+ const isInternalUpdate = useRef(false);
651
+ useEffect(() => {
652
+ if (!isInternalUpdate.current) {
653
+ setCurrentOptions(selectedOptions ?? []);
654
+ }
655
+ isInternalUpdate.current = false;
656
+ }, [selectedOptions]);
657
+ const enabledOptions = useMemo(
658
+ () => options.filter(({ disabled }) => !disabled),
659
+ [options]
660
+ );
661
+ const enabledOptionValues = useMemo(
662
+ () => enabledOptions.map(({ value }) => value),
663
+ [enabledOptions]
664
+ );
665
+ const areAllSelected = enabledOptionValues.length > 0 && enabledOptionValues.every((value) => currentOptions.includes(value));
666
+ const areAnySelected = currentOptions.length > 0;
667
+ const handleChange = (event) => {
668
+ if (isInternalUpdate.current) {
669
+ return;
670
+ }
671
+ const {
672
+ target: { value }
673
+ } = event;
674
+ const newOptions = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
675
+ setCurrentOptions(newOptions);
676
+ onChange(newOptions);
677
+ };
678
+ const selectAll = () => {
679
+ const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
680
+ if (optionsValues) {
681
+ const allSelected = optionsValues.every(
682
+ (value) => currentOptions.includes(value)
683
+ );
684
+ const newValue = allSelected ? [] : optionsValues;
685
+ isInternalUpdate.current = true;
686
+ setCurrentOptions(newValue);
687
+ onChange(newValue);
688
+ }
689
+ };
690
+ const unselectAll = () => {
691
+ const newValue = [];
692
+ isInternalUpdate.current = true;
693
+ setCurrentOptions(newValue);
694
+ onChange(newValue);
695
+ };
696
+ return {
697
+ areAllSelected,
698
+ areAnySelected,
699
+ currentOptions,
700
+ handleChange,
701
+ selectAll,
702
+ unselectAll
703
+ };
704
+ }
705
+ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
706
+ "&.Mui-disabled": {
707
+ pointerEvents: "auto",
708
+ "&:hover": {
709
+ backgroundColor: `${theme.palette.background.default} !important`
710
+ }
711
+ }
712
+ }));
713
+ const UnselectButton = styled(InputAdornment, {
714
+ shouldForwardProp: (prop) => prop !== "size"
715
+ })(({ theme, size }) => ({
716
+ display: "none",
717
+ position: "absolute",
718
+ top: theme.spacing(2),
719
+ right: theme.spacing(3.5),
720
+ ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
721
+ display: "flex"
722
+ },
723
+ ".MuiSvgIcon-root": {
724
+ color: theme.palette.text.hint
725
+ },
726
+ ...size === "medium" && {
727
+ top: theme.spacing(3),
728
+ right: theme.spacing(5)
729
+ }
730
+ }));
731
+ const EMPTY_ARRAY = [];
732
+ const EMPTY_FN = () => void 0;
733
+ function _MultipleSelectField({
734
+ options = EMPTY_ARRAY,
735
+ selectedOptions,
736
+ size = "small",
737
+ placeholder,
738
+ showCounter,
739
+ showFilters = true,
740
+ onChange = EMPTY_FN,
741
+ selectAllDisabled,
742
+ tooltipPlacement,
743
+ variant,
744
+ ...props
745
+ }, ref) {
746
+ const {
747
+ areAllSelected,
748
+ areAnySelected,
749
+ currentOptions,
750
+ handleChange,
751
+ selectAll,
752
+ unselectAll
753
+ } = useMultipleSelectField({
754
+ options,
755
+ selectedOptions,
756
+ onChange
757
+ });
758
+ const isSmall = size === "small";
759
+ const paddingSize = isSmall || variant === "standard" ? 0 : 2;
760
+ const intl = useIntl();
761
+ const intlConfig = useImperativeIntl(intl);
762
+ const counterText = `${currentOptions.length} ${intlConfig.formatMessage({
763
+ id: "c4r.form.selected"
764
+ })}`;
765
+ const renderValue = useMemo(() => {
766
+ if (areAllSelected) {
767
+ return /* @__PURE__ */ jsx(
768
+ Typography,
769
+ {
770
+ component: "span",
771
+ variant: isSmall ? "body2" : "body1",
430
772
  color: "textPrimary",
431
773
  ml: paddingSize,
432
774
  children: intlConfig.formatMessage({ id: "c4r.form.allSelected" })
@@ -948,7 +1290,7 @@ function useAutocompleteRenderOption() {
948
1290
  const { key, ...otherProps } = props;
949
1291
  if (isAutocompleteListGroupHeader(option)) {
950
1292
  return /* @__PURE__ */ createElement(
951
- MenuItem,
1293
+ MenuItem$1,
952
1294
  {
953
1295
  ...otherProps,
954
1296
  subtitle: true,
@@ -990,7 +1332,7 @@ function useAutocompleteRenderOption() {
990
1332
  return /* @__PURE__ */ jsx(Fragment$1, { children: divider ? /* @__PURE__ */ jsx(Divider, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
991
1333
  inputValue && /* @__PURE__ */ jsx(Divider, {}),
992
1334
  /* @__PURE__ */ jsxs(
993
- MenuItem,
1335
+ MenuItem$1,
994
1336
  {
995
1337
  ...otherProps,
996
1338
  ...!isPrimitiveOptionType && {
@@ -1529,6 +1871,96 @@ function useAutocomplete({
1529
1871
  getOptionLabel: internalGetOptionLabel
1530
1872
  };
1531
1873
  }
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
+ };
1532
1964
  const AccordionContainer = styled("div", {
1533
1965
  shouldForwardProp: (prop) => prop !== "variant"
1534
1966
  })(({ variant, theme }) => ({
@@ -1824,652 +2256,129 @@ function colorProps(color, variant, theme, disabled) {
1824
2256
  return {
1825
2257
  color: theme.palette.success.main,
1826
2258
  backgroundColor: theme.palette.success.relatedLight,
1827
- borderColor: "transparent"
1828
- };
1829
- case "warning":
1830
- if (variant === "outlined") {
1831
- return {
1832
- color: theme.palette.warning.main,
1833
- backgroundColor: theme.palette.warning.relatedLight,
1834
- borderColor: theme.palette.warning.main
1835
- };
1836
- }
1837
- return {
1838
- color: theme.palette.text.primary,
1839
- backgroundColor: theme.palette.warning.main,
1840
- borderColor: "transparent"
1841
- };
1842
- case "error":
1843
- if (variant === "outlined") {
1844
- return {
1845
- color: theme.palette.error.main,
1846
- backgroundColor: theme.palette.error.relatedLight,
1847
- borderColor: theme.palette.error.main
1848
- };
1849
- }
1850
- return {
1851
- color: theme.palette.primary.contrastText,
1852
- backgroundColor: theme.palette.error.main,
1853
- borderColor: "transparent"
1854
- };
1855
- }
1856
- }
1857
- const TagRoot = styled("div", {
1858
- shouldForwardProp: (prop) => !["color", "variant", "disabled"].includes(prop)
1859
- })(({
1860
- color,
1861
- variant,
1862
- disabled,
1863
- theme
1864
- }) => {
1865
- return {
1866
- display: "inline-flex",
1867
- flexDirection: "row",
1868
- flexWrap: "nowrap",
1869
- alignItems: "center",
1870
- padding: theme.spacing(0, 0.5),
1871
- borderRadius: theme.spacing(0.25),
1872
- gap: theme.spacing(0.5),
1873
- height: theme.spacing(2),
1874
- borderWidth: "1px",
1875
- borderStyle: "solid",
1876
- ...colorProps(color ?? "primary", variant ?? "filled", theme, disabled),
1877
- '.Mui-selected &, [aria-selected="true"] &': {
1878
- borderColor: theme.palette.primary.main,
1879
- backgroundColor: theme.palette.primary.background,
1880
- ".MuiTypography-root": {
1881
- color: theme.palette.primary.main
1882
- }
1883
- }
1884
- };
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
- "& input": {
2031
- textOverflow: "unset"
2032
- // This is needed to avoid scrolling issues in the input
2033
- }
2034
- }));
2035
- const AdornmentWrapper = styled(Box, {
2036
- shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
2037
- })(({ variant, size, theme }) => ({
2038
- width: theme.spacing(3),
2039
- ...variant === "standard" ? {
2040
- marginLeft: theme.spacing(-0.25)
2041
- } : {
2042
- marginRight: theme.spacing(-1)
2043
- },
2044
- ...size === "medium" && {
2045
- width: theme.spacing(4),
2046
- ...variant === "standard" ? {
2047
- marginLeft: theme.spacing(-0.5)
2048
- } : {
2049
- marginLeft: theme.spacing(1)
2050
- }
2051
- }
2052
- }));
2053
- function _CopiableInputText({
2054
- value,
2055
- variant,
2056
- InputProps,
2057
- extraEndAdornment,
2058
- onCopied,
2059
- password,
2060
- size = "small",
2061
- ...rest
2062
- }, ref) {
2063
- const intl = useIntl();
2064
- const intlConfig = useImperativeIntl(intl);
2065
- const [showText, setShowText] = useState(false);
2066
- const inputType = !password ? "text" : showText ? "text" : "password";
2067
- const showTextLabel = intlConfig.formatMessage({
2068
- id: showText ? "c4r.button.hide" : "c4r.button.show"
2069
- });
2070
- const passwordAdornment = /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
2071
- IconButton$1,
2072
- {
2073
- edge: variant !== "standard" ? "end" : void 0,
2074
- onClick: () => setShowText(!showText),
2075
- size,
2076
- icon: showText ? /* @__PURE__ */ jsx(VisibilityOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOffOutlined, {}),
2077
- tooltip: showTextLabel,
2078
- "aria-label": showTextLabel
2079
- }
2080
- ) });
2081
- return /* @__PURE__ */ jsx(
2082
- StyledTextField,
2083
- {
2084
- ...rest,
2085
- size,
2086
- value,
2087
- variant,
2088
- InputProps: {
2089
- readOnly: true,
2090
- endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
2091
- password ? passwordAdornment : extraEndAdornment,
2092
- /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(AdornmentWrapper, { size, variant, children: /* @__PURE__ */ jsx(
2093
- CopiableComponent,
2094
- {
2095
- value,
2096
- onCopied,
2097
- button: true,
2098
- buttonProps: {
2099
- size
2100
- }
2101
- }
2102
- ) }) })
2103
- ] }),
2104
- ...variant === "filled" && {
2105
- disableUnderline: true
2106
- },
2107
- ...InputProps
2108
- },
2109
- type: inputType,
2110
- "data-name": "copiable-input-text",
2111
- ref
2112
- }
2113
- );
2114
- }
2115
- const CopiableInputText = forwardRef(_CopiableInputText);
2116
- async function copyString(value) {
2117
- return await navigator.clipboard.writeText(value);
2118
- }
2119
- const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
2120
- const [message, setMessage] = useState(msg);
2121
- const copy = async (text) => {
2122
- await copyString(text);
2123
- setMessage(copiedMsg);
2124
- setTimeout(() => setMessage(msg), 1e3);
2125
- };
2126
- return {
2127
- message,
2128
- copy
2129
- };
2130
- };
2131
- const IndicatorIcon = styled(Box)({
2132
- position: "absolute",
2133
- top: 0,
2134
- left: 0,
2135
- right: 0,
2136
- bottom: 0,
2137
- display: "flex",
2138
- alignItems: "center",
2139
- justifyContent: "center"
2140
- });
2141
- const HiddenText = styled(Box)({
2142
- visibility: "hidden",
2143
- pointerEvents: "none"
2144
- });
2145
- function _Button({
2146
- children,
2147
- loading,
2148
- disabled,
2149
- startIcon,
2150
- endIcon,
2151
- loadingPosition,
2152
- external,
2153
- showExternalIcon = true,
2154
- "aria-describedby": ariaDescribedby,
2155
- ...otherProps
2156
- }, ref) {
2157
- const intl = useIntl();
2158
- const intlConfig = useImperativeIntl(intl);
2159
- const defaultIconLoader = /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" });
2160
- const isDefaultLoading = loading && loadingPosition === void 0;
2161
- const isExternalLink = otherProps.href && external;
2162
- const renderContent = () => {
2163
- if (isDefaultLoading) {
2164
- return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
2165
- /* @__PURE__ */ jsx(IndicatorIcon, { children: defaultIconLoader }),
2166
- /* @__PURE__ */ jsx(HiddenText, { children })
2167
- ] });
2168
- }
2169
- if (isExternalLink) {
2170
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2171
- children,
2172
- /* @__PURE__ */ jsx(ScreenReaderOnly, { id: "external-hint", children: `(${intlConfig.formatMessage({
2173
- id: "c4r.button.opensInNewTab"
2174
- })})` })
2175
- ] });
2176
- }
2177
- return children;
2178
- };
2179
- const getIconForPosition = (position) => {
2180
- if (isDefaultLoading) {
2181
- return void 0;
2182
- }
2183
- if (loading && loadingPosition !== void 0) {
2184
- if (loadingPosition === position) {
2185
- return defaultIconLoader;
2186
- }
2187
- return void 0;
2188
- }
2189
- if (position === "start") {
2190
- return startIcon;
2191
- } else {
2192
- return endIcon || (isExternalLink && showExternalIcon ? /* @__PURE__ */ jsx(OpenInNewOutlined, {}) : void 0);
2193
- }
2194
- };
2195
- return /* @__PURE__ */ jsx(
2196
- Button$1,
2197
- {
2198
- disabled: loading || disabled,
2199
- startIcon: getIconForPosition("start"),
2200
- endIcon: getIconForPosition("end"),
2201
- ...otherProps,
2202
- role: otherProps.href ? "link" : "button",
2203
- ...isExternalLink && {
2204
- target: "_blank",
2205
- rel: "noopener noreferrer"
2206
- },
2207
- ref,
2208
- "aria-describedby": isExternalLink ? "external-hint" : ariaDescribedby,
2209
- children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
2210
- }
2211
- );
2212
- }
2213
- const Button = forwardRef(_Button);
2214
- const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
2215
- "& .MuiButton-root:last-child": {
2216
- padding: 0,
2217
- minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
2218
- }
2219
- }));
2220
- function SplitButton({
2221
- options,
2222
- disabled,
2223
- loading,
2224
- loadingPosition,
2225
- onClick,
2226
- variant,
2227
- size,
2228
- color,
2229
- ...otherProps
2230
- }) {
2231
- var _a;
2232
- const [open, setOpen] = useState(false);
2233
- const anchorRef = useRef(null);
2234
- const [selectedIndex, setSelectedIndex] = useState(0);
2235
- const handleClick = () => {
2236
- onClick(options[selectedIndex]);
2237
- };
2238
- const handleMenuItemClick = (_, index) => {
2239
- setSelectedIndex(index);
2240
- setOpen(false);
2241
- };
2242
- const handleToggle = () => {
2243
- setOpen((prevOpen) => !prevOpen);
2244
- };
2245
- const handleClose = (event) => {
2246
- var _a2;
2247
- if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
2248
- return;
2249
- }
2250
- setOpen(false);
2251
- };
2252
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2253
- /* @__PURE__ */ jsxs(
2254
- ButtonGroup,
2255
- {
2256
- "data-name": "split-button",
2257
- ref: anchorRef,
2258
- variant,
2259
- size,
2260
- color,
2261
- ...otherProps,
2262
- children: [
2263
- /* @__PURE__ */ jsx(
2264
- Button,
2265
- {
2266
- disabled,
2267
- loading,
2268
- loadingPosition,
2269
- onClick: handleClick,
2270
- children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
2271
- }
2272
- ),
2273
- /* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
2274
- ]
2275
- }
2276
- ),
2277
- /* @__PURE__ */ jsx(
2278
- Popper,
2279
- {
2280
- sx: { zIndex: 1 },
2281
- open,
2282
- anchorEl: anchorRef.current,
2283
- role: void 0,
2284
- transition: true,
2285
- disablePortal: true,
2286
- placement: "bottom-end",
2287
- children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
2288
- Grow,
2289
- {
2290
- ...TransitionProps,
2291
- style: {
2292
- transformOrigin: placement === "bottom" ? "center top" : "center bottom"
2293
- },
2294
- 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(
2295
- MenuItem$1,
2296
- {
2297
- disabled: option.disabled,
2298
- selected: index === selectedIndex,
2299
- onClick: (event) => handleMenuItemClick(event, index),
2300
- children: option.label
2301
- },
2302
- option.label
2303
- )) }) }) })
2304
- }
2305
- )
2259
+ borderColor: "transparent"
2260
+ };
2261
+ case "warning":
2262
+ if (variant === "outlined") {
2263
+ return {
2264
+ color: theme.palette.warning.main,
2265
+ backgroundColor: theme.palette.warning.relatedLight,
2266
+ borderColor: theme.palette.warning.main
2267
+ };
2306
2268
  }
2307
- )
2308
- ] });
2269
+ return {
2270
+ color: theme.palette.text.primary,
2271
+ backgroundColor: theme.palette.warning.main,
2272
+ borderColor: "transparent"
2273
+ };
2274
+ case "error":
2275
+ if (variant === "outlined") {
2276
+ return {
2277
+ color: theme.palette.error.main,
2278
+ backgroundColor: theme.palette.error.relatedLight,
2279
+ borderColor: theme.palette.error.main
2280
+ };
2281
+ }
2282
+ return {
2283
+ color: theme.palette.primary.contrastText,
2284
+ backgroundColor: theme.palette.error.main,
2285
+ borderColor: "transparent"
2286
+ };
2287
+ }
2309
2288
  }
2310
- const Root$5 = styled(Box)(({ theme }) => ({
2289
+ const TagRoot = styled("div", {
2290
+ shouldForwardProp: (prop) => !["color", "variant", "disabled"].includes(prop)
2291
+ })(({
2292
+ color,
2293
+ variant,
2294
+ disabled,
2295
+ theme
2296
+ }) => {
2297
+ return {
2298
+ display: "inline-flex",
2299
+ flexDirection: "row",
2300
+ flexWrap: "nowrap",
2301
+ alignItems: "center",
2302
+ padding: theme.spacing(0, 0.5),
2303
+ borderRadius: theme.spacing(0.25),
2304
+ gap: theme.spacing(0.5),
2305
+ height: theme.spacing(2),
2306
+ borderWidth: "1px",
2307
+ borderStyle: "solid",
2308
+ ...colorProps(color ?? "primary", variant ?? "filled", theme, disabled),
2309
+ '.Mui-selected &, [aria-selected="true"] &': {
2310
+ borderColor: theme.palette.primary.main,
2311
+ backgroundColor: theme.palette.primary.background,
2312
+ ".MuiTypography-root": {
2313
+ color: theme.palette.primary.main
2314
+ }
2315
+ }
2316
+ };
2317
+ });
2318
+ const TagIcon = styled("div")(({ theme }) => ({
2311
2319
  display: "flex",
2320
+ justifyContent: "center",
2312
2321
  alignItems: "center",
2313
- gap: theme.spacing(0.5)
2314
- }));
2315
- const Indicator = styled(Typography)(({ theme }) => ({
2316
- ".Mui-disabled &": {
2317
- color: theme.palette.text.disabled
2322
+ "& svg": {
2323
+ width: theme.spacing(ICON_SIZE_SMALL),
2324
+ height: theme.spacing(ICON_SIZE_SMALL),
2325
+ "& g": {
2326
+ fill: "currentColor"
2327
+ }
2318
2328
  }
2319
2329
  }));
2320
- const Icon = styled(Box)(({ theme }) => ({
2330
+ const TagLabel = styled("div", {
2331
+ shouldForwardProp: (prop) => !["type"].includes(prop)
2332
+ })(({ type, theme }) => ({
2321
2333
  display: "flex",
2322
- svg: {
2323
- width: ICON_SIZE_SMALL,
2324
- height: ICON_SIZE_SMALL,
2325
- fontSize: ICON_SIZE_SMALL,
2326
- path: {
2327
- fill: theme.palette.text.secondary,
2328
- ".Mui-disabled &": {
2329
- fill: theme.palette.text.disabled
2330
- }
2331
- }
2332
- }
2334
+ alignItems: "center",
2335
+ paddingTop: type === "code" ? theme.spacing(0.25) : void 0
2333
2336
  }));
2334
- function LabelWithIndicator({
2337
+ function _Tag({
2335
2338
  label,
2336
- type,
2339
+ color = "primary",
2340
+ variant = "filled",
2337
2341
  icon,
2338
- inheritSize
2339
- }) {
2340
- return /* @__PURE__ */ jsxs(Root$5, { children: [
2341
- label,
2342
- type && /* @__PURE__ */ jsx(
2343
- Indicator,
2344
- {
2345
- component: "span",
2346
- variant: inheritSize ? "inherit" : "caption",
2347
- color: "textSecondary",
2348
- weight: "regular",
2349
- children: type === "required" ? "(required)" : "(optional)"
2350
- }
2351
- ),
2352
- icon && /* @__PURE__ */ jsx(Icon, { children: icon })
2353
- ] });
2354
- }
2355
- function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
2356
- const intl = useIntl();
2357
- const intlConfig = useImperativeIntl(intl);
2358
- const [showPassword, setShowPassword] = useState(false);
2359
- const handleClickShowPassword = () => setShowPassword(!showPassword);
2360
- return /* @__PURE__ */ jsx(
2361
- TextField,
2342
+ type = "default",
2343
+ typographyProps,
2344
+ noWrap = true,
2345
+ disabled,
2346
+ ...otherProps
2347
+ }, ref) {
2348
+ const typeCode = type === "code";
2349
+ return /* @__PURE__ */ jsxs(
2350
+ TagRoot,
2362
2351
  {
2363
- ...otherProps,
2364
2352
  ref,
2365
- type: showPassword ? "text" : "password",
2366
- size,
2367
- InputProps: {
2368
- ...InputProps,
2369
- endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsx(
2370
- Tooltip,
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
+ ...otherProps,
2363
+ children: [
2364
+ icon && /* @__PURE__ */ jsx(TagIcon, { children: icon }),
2365
+ /* @__PURE__ */ jsx(TagLabel, { type, children: /* @__PURE__ */ jsx(
2366
+ Typography,
2371
2367
  {
2372
- title: intlConfig.formatMessage({
2373
- id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
2374
- }),
2375
- children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOutlined, {})
2368
+ component: "span",
2369
+ color: "inherit",
2370
+ variant: typeCode ? "code3" : "caption",
2371
+ weight: typeCode ? "strong" : "medium",
2372
+ noWrap,
2373
+ ...typographyProps,
2374
+ children: label
2376
2375
  }
2377
- ) }) })
2378
- }
2379
- }
2380
- );
2381
- }
2382
- const PasswordField = forwardRef(_PasswordField);
2383
- const StyledToggleButtonGroup = styled(ToggleButtonGroup$1, {
2384
- shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
2385
- })(({ variant, backgroundColor, theme }) => ({
2386
- // Variants
2387
- ...variant === "contained" && {
2388
- boxShadow: "none"
2389
- },
2390
- ...variant === "unbounded" && {
2391
- boxShadow: "none",
2392
- borderRadius: theme.spacing(0.5),
2393
- "& .MuiDivider-root": {
2394
- height: theme.spacing(4),
2395
- "&.MuiToggleButtonGroup-groupedHorizontal": {
2396
- height: theme.spacing(4)
2397
- },
2398
- "&.MuiToggleButtonGroup-groupedVertical": {
2399
- height: "auto",
2400
- width: theme.spacing(4),
2401
- margin: `${theme.spacing(0.5, 0, 1)} !important`,
2402
- borderRadius: "0 !important"
2403
- }
2404
- },
2405
- "& .MuiToggleButton-sizeSmall": {
2406
- margin: 0,
2407
- "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
2408
- margin: 0
2409
- },
2410
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
2411
- height: theme.spacing(3)
2412
- },
2413
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
2414
- height: "auto",
2415
- width: theme.spacing(3)
2416
- }
2417
- },
2418
- ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
2419
- margin: 0,
2420
- "&:first-of-type": {
2421
- marginLeft: 0
2422
- },
2423
- "&:not(:last-of-type)": {
2424
- marginRight: theme.spacing(0.5)
2425
- }
2426
- },
2427
- "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
2428
- ".MuiToggleButtonGroup-grouped": {
2429
- margin: theme.spacing(0, 0.5)
2430
- }
2431
- },
2432
- "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
2433
- ".MuiToggleButtonGroup-grouped": {
2434
- margin: theme.spacing(0, 0, 0.5),
2435
- "&:not(:last-of-type)": {
2436
- marginRight: 0
2437
- },
2438
- "&:last-of-type": {
2439
- marginBottom: 0
2440
- }
2441
- }
2442
- }
2443
- },
2444
- // Colors
2445
- ...backgroundColor === "primary" && {
2446
- backgroundColor: theme.palette.background.paper
2447
- },
2448
- ...backgroundColor === "secondary" && {
2449
- backgroundColor: theme.palette.background.default
2450
- },
2451
- ...backgroundColor === "transparent" && {
2452
- backgroundColor: "transparent"
2453
- }
2454
- }));
2455
- function ToggleButtonGroup({
2456
- children,
2457
- variant = "floating",
2458
- backgroundColor,
2459
- ...rest
2460
- }) {
2461
- const isUnbounded = variant === "unbounded";
2462
- const defaultColor = isUnbounded ? "transparent" : "primary";
2463
- return /* @__PURE__ */ jsx(
2464
- StyledToggleButtonGroup,
2465
- {
2466
- ...rest,
2467
- variant,
2468
- backgroundColor: backgroundColor ?? defaultColor,
2469
- children
2376
+ ) })
2377
+ ]
2470
2378
  }
2471
2379
  );
2472
2380
  }
2381
+ const Tag = forwardRef(_Tag);
2473
2382
  const Menu = styled("div")(({ theme }) => ({
2474
2383
  display: "flex",
2475
2384
  alignItems: "center",
@@ -3541,11 +3450,11 @@ function CodeAreaHeader({
3541
3450
  transformOrigin: { vertical: "top", horizontal: "right" },
3542
3451
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
3543
3452
  children: [
3544
- /* @__PURE__ */ jsxs(MenuItem, { onClick: handleCopy, disabled, id: "copy", children: [
3453
+ /* @__PURE__ */ jsxs(MenuItem$1, { onClick: handleCopy, disabled, id: "copy", children: [
3545
3454
  /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ContentCopyOutlined, {}) }),
3546
3455
  /* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.copy` }) })
3547
3456
  ] }),
3548
- /* @__PURE__ */ jsxs(MenuItem, { onClick: onClickExpand, disabled, id: "expand", children: [
3457
+ /* @__PURE__ */ jsxs(MenuItem$1, { onClick: onClickExpand, disabled, id: "expand", children: [
3549
3458
  /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(OpenDiagonallyRight, {}) }),
3550
3459
  /* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.expand` }) })
3551
3460
  ] })
@@ -5200,7 +5109,6 @@ export {
5200
5109
  CodeAreaInput,
5201
5110
  CodeAreaMarkTextPattern,
5202
5111
  CopiableComponent,
5203
- CopiableInputText,
5204
5112
  CreatableAutocomplete,
5205
5113
  DatePicker,
5206
5114
  DateRangePicker,
@@ -5219,7 +5127,7 @@ export {
5219
5127
  LabelWithIndicator,
5220
5128
  L as Link,
5221
5129
  Menu$1 as Menu,
5222
- MenuItem,
5130
+ MenuItem$1 as MenuItem,
5223
5131
  MenuItemFilter,
5224
5132
  MenuList,
5225
5133
  MultipleAutocomplete,