@carto/meridian-ds 2.0.2 → 2.1.0-alpha-copiable-input-text.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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{Alert-CnaTtNJd.js → Link-D5fKicEY.js} +171 -61
  3. package/dist/{Alert-BzEgeyQJ.cjs → Link-_lzRY1Ay.cjs} +170 -60
  4. package/dist/{MenuItem-C4bG5WHw.cjs → MenuItem-BY6fuF5U.cjs} +1 -1
  5. package/dist/{MenuItem-C1DvWMry.js → MenuItem-CKrhDizf.js} +1 -1
  6. package/dist/{TablePaginationActions-Cz5Hbi6N.js → TablePaginationActions-CCDi-BO-.js} +12 -9
  7. package/dist/{TablePaginationActions-mbbjzV6Y.cjs → TablePaginationActions-D2K26kdR.cjs} +12 -9
  8. package/dist/components/index.cjs +744 -631
  9. package/dist/components/index.js +750 -636
  10. package/dist/theme/index.cjs +2 -2
  11. package/dist/theme/index.js +3 -3
  12. package/dist/types/components/atoms/Button.d.ts +11 -0
  13. package/dist/types/components/atoms/Button.d.ts.map +1 -1
  14. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts +4 -0
  15. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts.map +1 -0
  16. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts +18 -0
  17. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts.map +1 -0
  18. package/dist/types/components/atoms/Copy/copyString.d.ts.map +1 -0
  19. package/dist/types/components/{molecules → atoms}/Copy/index.d.ts +2 -1
  20. package/dist/types/components/atoms/Copy/index.d.ts.map +1 -0
  21. package/dist/types/components/{molecules/Copy/CopiableComponent.d.ts → atoms/Copy/types.d.ts} +11 -5
  22. package/dist/types/components/atoms/Copy/types.d.ts.map +1 -0
  23. package/dist/types/components/atoms/Copy/useCopyValue.d.ts.map +1 -0
  24. package/dist/types/components/atoms/Link.d.ts +39 -0
  25. package/dist/types/components/atoms/Link.d.ts.map +1 -0
  26. package/dist/types/components/atoms/ScreenReaderOnly.d.ts +3 -0
  27. package/dist/types/components/atoms/ScreenReaderOnly.d.ts.map +1 -0
  28. package/dist/types/components/atoms/index.d.ts +5 -0
  29. package/dist/types/components/atoms/index.d.ts.map +1 -1
  30. package/dist/types/components/molecules/index.d.ts +0 -2
  31. package/dist/types/components/molecules/index.d.ts.map +1 -1
  32. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -1
  33. package/dist/types/localization/en.d.ts +3 -2
  34. package/dist/types/localization/en.d.ts.map +1 -1
  35. package/dist/types/localization/es.d.ts +3 -2
  36. package/dist/types/localization/es.d.ts.map +1 -1
  37. package/dist/types/localization/id.d.ts +3 -2
  38. package/dist/types/localization/id.d.ts.map +1 -1
  39. package/dist/types/localization/index.d.ts +9 -6
  40. package/dist/types/localization/index.d.ts.map +1 -1
  41. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/ComparativeCategoryWidgetUI.d.ts.map +1 -1
  42. package/dist/widgets/index.cjs +8 -8
  43. package/dist/widgets/index.js +5 -5
  44. package/package.json +1 -1
  45. package/dist/types/components/molecules/Copy/CopiableComponent.d.ts.map +0 -1
  46. package/dist/types/components/molecules/Copy/copyString.d.ts.map +0 -1
  47. package/dist/types/components/molecules/Copy/index.d.ts.map +0 -1
  48. package/dist/types/components/molecules/Copy/useCopyValue.d.ts.map +0 -1
  49. /package/dist/types/components/{molecules → atoms}/Copy/copyString.d.ts +0 -0
  50. /package/dist/types/components/{molecules → atoms}/Copy/useCopyValue.d.ts +0 -0
@@ -1,15 +1,16 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
3
- import { styled, Box, Button as Button$1, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, IconButton, Tooltip, Select, FormControl, InputLabel, FormHelperText, ToggleButtonGroup as ToggleButtonGroup$1, Menu as Menu$2, Link, Checkbox, ListItemText, Autocomplete as Autocomplete$1, Divider, ListItemIcon, createFilterOptions, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Snackbar as Snackbar$1, Portal, Fade, Slide, alpha, useTheme, Toolbar, AppBar as AppBar$1, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip, DialogContent as DialogContent$1, DialogActions as DialogActions$1 } from "@mui/material";
4
- import { T as Typography, c as ICON_SIZE_SMALL, u as useImperativeIntl, f as MENU_ITEM_SIZE_EXTENDED, 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-Cz5Hbi6N.js";
5
- import { a } from "../TablePaginationActions-Cz5Hbi6N.js";
2
+ import React, { forwardRef, useState, useEffect, useMemo, useRef, createElement, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
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";
6
10
  import { A as ArrowDown } from "../ArrowDown-d6bxUL0F.js";
7
11
  import { A as ArrowUp, O as OpenDiagonallyRight, C as CloseDiagonallyRight } from "../OpenDiagonallyRight-CGdCEXlF.js";
8
- import { useIntl } from "react-intl";
9
- import { VisibilityOffOutlined, VisibilityOutlined, Cancel, AddCircleOutlineOutlined, ContentCopyOutlined, CloseOutlined, MenuOutlined, HelpOutline, TodayOutlined, MoreVertOutlined, ErrorOutline, Check } from "@mui/icons-material";
10
- import { I as IconButton$1, A as Alert$1 } from "../Alert-CnaTtNJd.js";
11
12
  import "cartocolor";
12
- import { M as MenuItem$1 } from "../MenuItem-C1DvWMry.js";
13
+ import { M as MenuItem } from "../MenuItem-CKrhDizf.js";
13
14
  import { FixedSizeList } from "react-window";
14
15
  import { DatePicker as DatePicker$1 } from "@mui/x-date-pickers/DatePicker";
15
16
  import { PickersDay as PickersDay$1 } from "@mui/x-date-pickers";
@@ -40,235 +41,146 @@ import "codemirror/addon/fold/indent-fold.js";
40
41
  import "codemirror/addon/fold/markdown-fold.js";
41
42
  import "codemirror/addon/fold/comment-fold.js";
42
43
  import ClickAwayListener$1 from "@mui/material/ClickAwayListener";
43
- const IndicatorIcon = styled(Box)({
44
- position: "absolute",
45
- top: 0,
46
- left: 0,
47
- right: 0,
48
- bottom: 0,
49
- display: "flex",
50
- alignItems: "center",
51
- justifyContent: "center"
52
- });
53
- const HiddenText = styled(Box)({
54
- visibility: "hidden",
55
- pointerEvents: "none"
56
- });
57
- function _Button({
58
- children,
59
- loading,
60
- disabled,
61
- startIcon,
62
- endIcon,
63
- loadingPosition,
64
- ...otherProps
65
- }, ref) {
66
- const defaultIconLoader = /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" });
67
- const isDefaultLoading = loading && loadingPosition === void 0;
68
- const renderContent = () => {
69
- if (isDefaultLoading) {
70
- return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
71
- /* @__PURE__ */ jsx(IndicatorIcon, { children: defaultIconLoader }),
72
- /* @__PURE__ */ jsx(HiddenText, { children })
73
- ] });
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
74
50
  }
75
- return children;
76
- };
77
- const getIconForPosition = (position) => {
78
- if (isDefaultLoading) {
79
- return void 0;
51
+ },
52
+ ...width && {
53
+ ".MuiList-root": {
54
+ width,
55
+ minWidth: width
80
56
  }
81
- if (loading && loadingPosition !== void 0) {
82
- if (loadingPosition === position) {
83
- return defaultIconLoader;
84
- }
85
- return void 0;
57
+ },
58
+ ...height && {
59
+ ".MuiMenu-paper": {
60
+ overflow: "hidden"
61
+ },
62
+ ".MuiList-root": {
63
+ maxHeight: height
86
64
  }
87
- return position === "start" ? startIcon : endIcon;
88
- };
65
+ }
66
+ }));
67
+ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
89
68
  return /* @__PURE__ */ jsx(
90
- Button$1,
69
+ StyledMenu,
91
70
  {
92
- disabled: loading || disabled,
93
- startIcon: getIconForPosition("start"),
94
- endIcon: getIconForPosition("end"),
95
71
  ...otherProps,
96
- role: otherProps.href ? "link" : "button",
97
72
  ref,
98
- children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
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
82
+ }
99
83
  }
100
84
  );
101
85
  }
102
- const Button = forwardRef(_Button);
103
- const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
104
- "& .MuiButton-root:last-child": {
105
- padding: 0,
106
- minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
107
- }
108
- }));
109
- function SplitButton({
110
- options,
111
- disabled,
112
- loading,
113
- loadingPosition,
114
- onClick,
115
- variant,
116
- size,
117
- color,
118
- ...otherProps
119
- }) {
120
- var _a;
121
- const [open, setOpen] = useState(false);
122
- const anchorRef = useRef(null);
123
- const [selectedIndex, setSelectedIndex] = useState(0);
124
- const handleClick = () => {
125
- onClick(options[selectedIndex]);
126
- };
127
- const handleMenuItemClick = (_, index) => {
128
- setSelectedIndex(index);
129
- setOpen(false);
130
- };
131
- const handleToggle = () => {
132
- setOpen((prevOpen) => !prevOpen);
133
- };
134
- const handleClose = (event) => {
135
- var _a2;
136
- if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
137
- return;
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
138
93
  }
139
- setOpen(false);
140
- };
141
- return /* @__PURE__ */ jsxs(Fragment, { children: [
142
- /* @__PURE__ */ jsxs(
143
- ButtonGroup,
144
- {
145
- "data-name": "split-button",
146
- ref: anchorRef,
147
- variant,
148
- size,
149
- color,
150
- ...otherProps,
151
- children: [
152
- /* @__PURE__ */ jsx(
153
- Button,
154
- {
155
- disabled,
156
- loading,
157
- loadingPosition,
158
- onClick: handleClick,
159
- children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
160
- }
161
- ),
162
- /* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
163
- ]
164
- }
165
- ),
166
- /* @__PURE__ */ jsx(
167
- Popper,
168
- {
169
- sx: { zIndex: 1 },
170
- open,
171
- anchorEl: anchorRef.current,
172
- role: void 0,
173
- transition: true,
174
- disablePortal: true,
175
- placement: "bottom-end",
176
- children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
177
- Grow,
178
- {
179
- ...TransitionProps,
180
- style: {
181
- transformOrigin: placement === "bottom" ? "center top" : "center bottom"
182
- },
183
- 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(
184
- MenuItem,
185
- {
186
- disabled: option.disabled,
187
- selected: index === selectedIndex,
188
- onClick: (event) => handleMenuItemClick(event, index),
189
- children: option.label
190
- },
191
- option.label
192
- )) }) }) })
193
- }
194
- )
195
- }
196
- )
197
- ] });
198
- }
199
- const Root$5 = styled(Box)(({ theme }) => ({
200
- display: "flex",
201
- alignItems: "center",
202
- gap: theme.spacing(0.5)
203
- }));
204
- const Indicator = styled(Typography)(({ theme }) => ({
205
- ".Mui-disabled &": {
206
- color: theme.palette.text.disabled
207
- }
208
- }));
209
- const Icon = styled(Box)(({ theme }) => ({
210
- display: "flex",
211
- svg: {
212
- width: ICON_SIZE_SMALL,
213
- height: ICON_SIZE_SMALL,
214
- fontSize: ICON_SIZE_SMALL,
215
- path: {
216
- fill: theme.palette.text.secondary,
217
- ".Mui-disabled &": {
218
- fill: theme.palette.text.disabled
219
- }
94
+ },
95
+ "&.MuiList-root": {
96
+ ...width && {
97
+ width,
98
+ minWidth: width
99
+ },
100
+ ...height && {
101
+ maxHeight: height
220
102
  }
221
103
  }
222
104
  }));
223
- function LabelWithIndicator({
224
- label,
225
- type,
226
- icon,
227
- inheritSize
228
- }) {
229
- return /* @__PURE__ */ jsxs(Root$5, { children: [
230
- label,
231
- type && /* @__PURE__ */ jsx(
232
- Indicator,
233
- {
234
- component: "span",
235
- variant: inheritSize ? "inherit" : "caption",
236
- color: "textSecondary",
237
- weight: "regular",
238
- children: type === "required" ? "(required)" : "(optional)"
239
- }
240
- ),
241
- icon && /* @__PURE__ */ jsx(Icon, { children: icon })
242
- ] });
243
- }
244
- function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
245
- const intl = useIntl();
246
- const intlConfig = useImperativeIntl(intl);
247
- const [showPassword, setShowPassword] = useState(false);
248
- const handleClickShowPassword = () => setShowPassword(!showPassword);
105
+ function _MenuList({ extended, width, height, ...otherProps }, ref) {
249
106
  return /* @__PURE__ */ jsx(
250
- TextField,
107
+ StyledMenuList,
251
108
  {
252
109
  ...otherProps,
253
110
  ref,
254
- type: showPassword ? "text" : "password",
255
- size,
256
- InputProps: {
257
- ...InputProps,
258
- endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsx(
259
- Tooltip,
260
- {
261
- title: intlConfig.formatMessage({
262
- id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
263
- }),
264
- children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOutlined, {})
265
- }
266
- ) }) })
267
- }
111
+ width,
112
+ height,
113
+ extended,
114
+ "data-name": "menu-list",
115
+ "data-width": width,
116
+ "data-height": height,
117
+ "data-extended": extended
268
118
  }
269
119
  );
270
120
  }
271
- const PasswordField = forwardRef(_PasswordField);
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);
272
184
  const idCounter = {};
273
185
  function uniqueId(prefix = "$lodash$") {
274
186
  if (!idCounter[prefix]) {
@@ -297,7 +209,7 @@ const StyledSelect = styled(Select)(({ theme }) => ({
297
209
  paddingRight: theme.spacing(7)
298
210
  }
299
211
  }));
300
- const PlaceholderItem = styled(MenuItem)(() => ({
212
+ const PlaceholderItem = styled(MenuItem$1)(() => ({
301
213
  display: "none"
302
214
  }));
303
215
  function _SelectField({
@@ -387,309 +299,79 @@ function _SelectField({
387
299
  );
388
300
  }
389
301
  const SelectField = forwardRef(_SelectField);
390
- const StyledToggleButtonGroup = styled(ToggleButtonGroup$1, {
391
- shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
392
- })(({ variant, backgroundColor, theme }) => ({
393
- // Variants
394
- ...variant === "contained" && {
395
- boxShadow: "none"
396
- },
397
- ...variant === "unbounded" && {
398
- boxShadow: "none",
399
- borderRadius: theme.spacing(0.5),
400
- "& .MuiDivider-root": {
401
- height: theme.spacing(4),
402
- "&.MuiToggleButtonGroup-groupedHorizontal": {
403
- height: theme.spacing(4)
404
- },
405
- "&.MuiToggleButtonGroup-groupedVertical": {
406
- height: "auto",
407
- width: theme.spacing(4),
408
- margin: `${theme.spacing(0.5, 0, 1)} !important`,
409
- borderRadius: "0 !important"
410
- }
411
- },
412
- "& .MuiToggleButton-sizeSmall": {
413
- margin: 0,
414
- "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
415
- margin: 0
416
- },
417
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
418
- height: theme.spacing(3)
419
- },
420
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
421
- height: "auto",
422
- width: theme.spacing(3)
423
- }
424
- },
425
- ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
426
- margin: 0,
427
- "&:first-of-type": {
428
- marginLeft: 0
429
- },
430
- "&:not(:last-of-type)": {
431
- marginRight: theme.spacing(0.5)
432
- }
433
- },
434
- "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
435
- ".MuiToggleButtonGroup-grouped": {
436
- margin: theme.spacing(0, 0.5)
437
- }
438
- },
439
- "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
440
- ".MuiToggleButtonGroup-grouped": {
441
- margin: theme.spacing(0, 0, 0.5),
442
- "&:not(:last-of-type)": {
443
- marginRight: 0
444
- },
445
- "&:last-of-type": {
446
- marginBottom: 0
447
- }
448
- }
449
- }
450
- },
451
- // Colors
452
- ...backgroundColor === "primary" && {
453
- backgroundColor: theme.palette.background.paper
454
- },
455
- ...backgroundColor === "secondary" && {
456
- backgroundColor: theme.palette.background.default
457
- },
458
- ...backgroundColor === "transparent" && {
459
- backgroundColor: "transparent"
460
- }
461
- }));
462
- function ToggleButtonGroup({
463
- children,
464
- variant = "floating",
465
- backgroundColor,
466
- ...rest
302
+ function useMultipleSelectField({
303
+ selectedOptions,
304
+ options,
305
+ onChange
467
306
  }) {
468
- const isUnbounded = variant === "unbounded";
469
- const defaultColor = isUnbounded ? "transparent" : "primary";
470
- return /* @__PURE__ */ jsx(
471
- StyledToggleButtonGroup,
472
- {
473
- ...rest,
474
- variant,
475
- backgroundColor: backgroundColor ?? defaultColor,
476
- children
307
+ const [currentOptions, setCurrentOptions] = useState(selectedOptions ?? []);
308
+ const areAllSelected = options.length === currentOptions.length;
309
+ const areAnySelected = currentOptions.length > 0;
310
+ useEffect(() => {
311
+ if (currentOptions !== selectedOptions) {
312
+ setCurrentOptions(currentOptions);
477
313
  }
478
- );
314
+ }, [selectedOptions]);
315
+ const handleChange = (event) => {
316
+ const {
317
+ target: { value }
318
+ } = event;
319
+ const options2 = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
320
+ setCurrentOptions(options2);
321
+ onChange(options2);
322
+ };
323
+ const selectAll = () => {
324
+ const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
325
+ if (optionsValues) {
326
+ const allSelected = optionsValues.every(
327
+ (value) => currentOptions.includes(value)
328
+ );
329
+ if (allSelected) {
330
+ setCurrentOptions([]);
331
+ onChange([]);
332
+ } else {
333
+ setCurrentOptions(optionsValues);
334
+ onChange(optionsValues);
335
+ }
336
+ }
337
+ };
338
+ const unselectAll = () => {
339
+ setCurrentOptions([]);
340
+ onChange([]);
341
+ };
342
+ return {
343
+ areAllSelected,
344
+ areAnySelected,
345
+ currentOptions,
346
+ handleChange,
347
+ selectAll,
348
+ unselectAll
349
+ };
479
350
  }
480
- const StyledMenu = styled(Menu$2, {
481
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
482
- })(({ extended, width, height }) => ({
483
- ...extended && {
484
- ".MuiMenuItem-root": {
485
- minHeight: MENU_ITEM_SIZE_EXTENDED
351
+ const StyledMenuItem = styled(MenuItem$1)(({ theme }) => ({
352
+ "&.Mui-disabled": {
353
+ pointerEvents: "auto",
354
+ "&:hover": {
355
+ backgroundColor: `${theme.palette.background.default} !important`
486
356
  }
357
+ }
358
+ }));
359
+ const UnselectButton = styled(InputAdornment, {
360
+ shouldForwardProp: (prop) => prop !== "size"
361
+ })(({ theme, size }) => ({
362
+ display: "none",
363
+ position: "absolute",
364
+ top: theme.spacing(2),
365
+ right: theme.spacing(3.5),
366
+ ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
367
+ display: "flex"
487
368
  },
488
- ...width && {
489
- ".MuiList-root": {
490
- width,
491
- minWidth: width
492
- }
369
+ ".MuiSvgIcon-root": {
370
+ color: theme.palette.text.hint
493
371
  },
494
- ...height && {
495
- ".MuiMenu-paper": {
496
- overflow: "hidden"
497
- },
498
- ".MuiList-root": {
499
- maxHeight: height
500
- }
501
- }
502
- }));
503
- function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
504
- return /* @__PURE__ */ jsx(
505
- StyledMenu,
506
- {
507
- ...otherProps,
508
- ref,
509
- "data-name": "menu",
510
- width,
511
- height,
512
- extended,
513
- MenuListProps: {
514
- ...MenuListProps,
515
- "data-width": width,
516
- "data-height": height,
517
- "data-extended": extended
518
- }
519
- }
520
- );
521
- }
522
- const Menu$1 = forwardRef(_Menu);
523
- const StyledMenuList = styled(MenuList$1, {
524
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
525
- })(({ extended, width, height }) => ({
526
- ...extended && {
527
- ".MuiMenuItem-root": {
528
- minHeight: MENU_ITEM_SIZE_EXTENDED
529
- }
530
- },
531
- "&.MuiList-root": {
532
- ...width && {
533
- width,
534
- minWidth: width
535
- },
536
- ...height && {
537
- maxHeight: height
538
- }
539
- }
540
- }));
541
- function _MenuList({ extended, width, height, ...otherProps }, ref) {
542
- return /* @__PURE__ */ jsx(
543
- StyledMenuList,
544
- {
545
- ...otherProps,
546
- ref,
547
- width,
548
- height,
549
- extended,
550
- "data-name": "menu-list",
551
- "data-width": width,
552
- "data-height": height,
553
- "data-extended": extended
554
- }
555
- );
556
- }
557
- const MenuList = forwardRef(_MenuList);
558
- const StyledMenuItem$1 = styled(MenuItem$1)(() => ({
559
- marginTop: "0 !important",
560
- marginBottom: "0 !important"
561
- }));
562
- const LinkFilter = styled(Link)(
563
- ({ disabled, theme }) => ({
564
- display: "flex",
565
- alignItems: "center",
566
- gap: theme.spacing(1),
567
- width: "100%",
568
- textAlign: "initial",
569
- ...disabled && {
570
- pointerEvents: "none",
571
- color: theme.palette.text.disabled
572
- }
573
- })
574
- );
575
- function _MenuItemFilter({
576
- areAllSelected,
577
- areAnySelected,
578
- selectAll,
579
- selectAllDisabled,
580
- "aria-label": ariaLabel,
581
- "data-testid": dataTestId
582
- }, ref) {
583
- const intl = useIntl();
584
- const intlConfig = useImperativeIntl(intl);
585
- return /* @__PURE__ */ jsx(
586
- StyledMenuItem$1,
587
- {
588
- ref,
589
- fixed: true,
590
- "data-name": "menu-filter",
591
- "aria-label": ariaLabel,
592
- "data-testid": dataTestId,
593
- children: /* @__PURE__ */ jsxs(
594
- LinkFilter,
595
- {
596
- variant: "body2",
597
- color: "textPrimary",
598
- component: "button",
599
- underline: "none",
600
- disabled: !!selectAllDisabled,
601
- onClick: selectAll,
602
- tabIndex: 0,
603
- children: [
604
- /* @__PURE__ */ jsx(
605
- Checkbox,
606
- {
607
- checked: areAllSelected,
608
- indeterminate: areAnySelected && !areAllSelected,
609
- disabled: selectAllDisabled
610
- }
611
- ),
612
- intlConfig.formatMessage({ id: "c4r.form.selectAll" })
613
- ]
614
- }
615
- )
616
- }
617
- );
618
- }
619
- const MenuItemFilter = forwardRef(_MenuItemFilter);
620
- function useMultipleSelectField({
621
- selectedOptions,
622
- options,
623
- onChange
624
- }) {
625
- const [currentOptions, setCurrentOptions] = useState(selectedOptions ?? []);
626
- const areAllSelected = options.length === currentOptions.length;
627
- const areAnySelected = currentOptions.length > 0;
628
- useEffect(() => {
629
- if (currentOptions !== selectedOptions) {
630
- setCurrentOptions(currentOptions);
631
- }
632
- }, [selectedOptions]);
633
- const handleChange = (event) => {
634
- const {
635
- target: { value }
636
- } = event;
637
- const options2 = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
638
- setCurrentOptions(options2);
639
- onChange(options2);
640
- };
641
- const selectAll = () => {
642
- const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
643
- if (optionsValues) {
644
- const allSelected = optionsValues.every(
645
- (value) => currentOptions.includes(value)
646
- );
647
- if (allSelected) {
648
- setCurrentOptions([]);
649
- onChange([]);
650
- } else {
651
- setCurrentOptions(optionsValues);
652
- onChange(optionsValues);
653
- }
654
- }
655
- };
656
- const unselectAll = () => {
657
- setCurrentOptions([]);
658
- onChange([]);
659
- };
660
- return {
661
- areAllSelected,
662
- areAnySelected,
663
- currentOptions,
664
- handleChange,
665
- selectAll,
666
- unselectAll
667
- };
668
- }
669
- const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
670
- "&.Mui-disabled": {
671
- pointerEvents: "auto",
672
- "&:hover": {
673
- backgroundColor: `${theme.palette.background.default} !important`
674
- }
675
- }
676
- }));
677
- const UnselectButton = styled(InputAdornment, {
678
- shouldForwardProp: (prop) => prop !== "size"
679
- })(({ theme, size }) => ({
680
- display: "none",
681
- position: "absolute",
682
- top: theme.spacing(2),
683
- right: theme.spacing(3.5),
684
- ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
685
- display: "flex"
686
- },
687
- ".MuiSvgIcon-root": {
688
- color: theme.palette.text.hint
689
- },
690
- ...size === "medium" && {
691
- top: theme.spacing(3),
692
- right: theme.spacing(5)
372
+ ...size === "medium" && {
373
+ top: theme.spacing(3),
374
+ right: theme.spacing(5)
693
375
  }
694
376
  }));
695
377
  const EMPTY_ARRAY = [];
@@ -1254,7 +936,7 @@ function useAutocompleteRenderOption() {
1254
936
  const { key, ...otherProps } = props;
1255
937
  if (isAutocompleteListGroupHeader(option)) {
1256
938
  return /* @__PURE__ */ createElement(
1257
- MenuItem$1,
939
+ MenuItem,
1258
940
  {
1259
941
  ...otherProps,
1260
942
  subtitle: true,
@@ -1296,7 +978,7 @@ function useAutocompleteRenderOption() {
1296
978
  return /* @__PURE__ */ jsx(Fragment$1, { children: divider ? /* @__PURE__ */ jsx(Divider, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
1297
979
  inputValue && /* @__PURE__ */ jsx(Divider, {}),
1298
980
  /* @__PURE__ */ jsxs(
1299
- MenuItem$1,
981
+ MenuItem,
1300
982
  {
1301
983
  ...otherProps,
1302
984
  ...!isPrimitiveOptionType && {
@@ -1835,124 +1517,34 @@ function useAutocomplete({
1835
1517
  getOptionLabel: internalGetOptionLabel
1836
1518
  };
1837
1519
  }
1838
- const _CopiableComponent = ({
1839
- children,
1840
- disabled,
1841
- value,
1842
- onCopied,
1843
- copyText = "c4r.button.copy",
1844
- copiedText = "c4r.notifications.copiedToClipboard",
1845
- button,
1846
- buttonLabel,
1847
- buttonProps,
1848
- ariaLabel,
1849
- dataTestId,
1850
- tooltipPlacement = "top",
1851
- ...props
1852
- }, ref) => {
1853
- const intl = useIntl();
1854
- const intlConfig = useImperativeIntl(intl);
1855
- const [open, setOpen] = useState(false);
1856
- const { copy } = useCopyValue(copyText, copiedText);
1857
- const handleClick = (e) => {
1858
- e.preventDefault();
1859
- copy(value).then(() => {
1860
- onCopied == null ? void 0 : onCopied();
1861
- setOpen(true);
1862
- }).catch(console.error);
1863
- };
1864
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1865
- /* @__PURE__ */ jsx(
1866
- Tooltip,
1867
- {
1868
- title: intlConfig.formatMessage({ id: copyText }),
1869
- leaveDelay: 0,
1870
- placement: tooltipPlacement,
1871
- children: /* @__PURE__ */ jsxs(
1872
- Box,
1520
+ const AccordionContainer = styled("div", {
1521
+ shouldForwardProp: (prop) => prop !== "variant"
1522
+ })(({ variant, theme }) => ({
1523
+ width: "100%",
1524
+ borderRadius: theme.spacing(0.5),
1525
+ ...variant === "outlined" && {
1526
+ backgroundColor: theme.palette.background.paper,
1527
+ boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`
1528
+ }
1529
+ }));
1530
+ function AccordionGroup({
1531
+ variant = "standard",
1532
+ items,
1533
+ ...otherProps
1534
+ }) {
1535
+ return /* @__PURE__ */ jsx(AccordionContainer, { ...otherProps, variant, children: items.map((item, index) => /* @__PURE__ */ jsxs(
1536
+ Accordion,
1537
+ {
1538
+ disabled: item.disabled,
1539
+ defaultExpanded: item.defaultExpanded,
1540
+ onChange: item.onChange,
1541
+ children: [
1542
+ /* @__PURE__ */ jsx(
1543
+ AccordionSummary,
1873
1544
  {
1874
- ...props,
1875
- sx: { cursor: disabled ? void 0 : "pointer" },
1876
- onClick: handleClick,
1877
- "data-name": "copiable",
1878
- ref,
1879
- children: [
1880
- children,
1881
- button && /* @__PURE__ */ jsx(
1882
- IconButton$1,
1883
- {
1884
- ...buttonProps,
1885
- disabled,
1886
- icon: /* @__PURE__ */ jsx(ContentCopyOutlined, {}),
1887
- "data-testid": dataTestId,
1888
- "aria-label": ariaLabel || buttonLabel,
1889
- sx: {
1890
- display: "flex"
1891
- }
1892
- }
1893
- )
1894
- ]
1895
- }
1896
- )
1897
- }
1898
- ),
1899
- /* @__PURE__ */ jsx(
1900
- Snackbar,
1901
- {
1902
- open,
1903
- autoWidth: true,
1904
- closeable: false,
1905
- autoHideDuration: 4e3,
1906
- onClose: () => setOpen(false),
1907
- children: intlConfig.formatMessage({ id: copiedText })
1908
- }
1909
- )
1910
- ] });
1911
- };
1912
- const CopiableComponent = forwardRef(_CopiableComponent);
1913
- async function copyString(value) {
1914
- return await navigator.clipboard.writeText(value);
1915
- }
1916
- const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
1917
- const [message, setMessage] = useState(msg);
1918
- const copy = async (text) => {
1919
- await copyString(text);
1920
- setMessage(copiedMsg);
1921
- setTimeout(() => setMessage(msg), 1e3);
1922
- };
1923
- return {
1924
- message,
1925
- copy
1926
- };
1927
- };
1928
- const AccordionContainer = styled("div", {
1929
- shouldForwardProp: (prop) => prop !== "variant"
1930
- })(({ variant, theme }) => ({
1931
- width: "100%",
1932
- borderRadius: theme.spacing(0.5),
1933
- ...variant === "outlined" && {
1934
- backgroundColor: theme.palette.background.paper,
1935
- boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`
1936
- }
1937
- }));
1938
- function AccordionGroup({
1939
- variant = "standard",
1940
- items,
1941
- ...otherProps
1942
- }) {
1943
- return /* @__PURE__ */ jsx(AccordionContainer, { ...otherProps, variant, children: items.map((item, index) => /* @__PURE__ */ jsxs(
1944
- Accordion,
1945
- {
1946
- disabled: item.disabled,
1947
- defaultExpanded: item.defaultExpanded,
1948
- onChange: item.onChange,
1949
- children: [
1950
- /* @__PURE__ */ jsx(
1951
- AccordionSummary,
1952
- {
1953
- "aria-controls": `${index}-content`,
1954
- id: `${index}-header`,
1955
- children: item.summary
1545
+ "aria-controls": `${index}-content`,
1546
+ id: `${index}-header`,
1547
+ children: item.summary
1956
1548
  }
1957
1549
  ),
1958
1550
  /* @__PURE__ */ jsx(AccordionDetails, { children: item.content })
@@ -2343,6 +1935,525 @@ function _Tag({
2343
1935
  );
2344
1936
  }
2345
1937
  const Tag = forwardRef(_Tag);
1938
+ const _CopiableComponent = ({
1939
+ children,
1940
+ disabled,
1941
+ value,
1942
+ onCopied,
1943
+ copyText,
1944
+ copiedText,
1945
+ button,
1946
+ buttonLabel,
1947
+ buttonProps,
1948
+ ariaLabel,
1949
+ dataTestId,
1950
+ tooltipPlacement = "top",
1951
+ ...props
1952
+ }, ref) => {
1953
+ const [open, setOpen] = useState(false);
1954
+ const intl = useIntl();
1955
+ const intlConfig = useImperativeIntl(intl);
1956
+ const defaultCopyText = copyText || intlConfig.formatMessage({ id: "c4r.button.copy" });
1957
+ const defaultCopiedText = copiedText || intlConfig.formatMessage({
1958
+ id: "c4r.notifications.copiedToClipboard"
1959
+ });
1960
+ const { copy } = useCopyValue(defaultCopyText, defaultCopiedText);
1961
+ const handleClick = (e) => {
1962
+ e.preventDefault();
1963
+ copy(value).then(() => {
1964
+ onCopied == null ? void 0 : onCopied();
1965
+ setOpen(true);
1966
+ }).catch(console.error);
1967
+ };
1968
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1969
+ /* @__PURE__ */ jsx(
1970
+ Tooltip,
1971
+ {
1972
+ title: defaultCopyText,
1973
+ leaveDelay: 0,
1974
+ placement: tooltipPlacement,
1975
+ children: /* @__PURE__ */ jsxs(
1976
+ Box,
1977
+ {
1978
+ ...props,
1979
+ sx: { cursor: disabled ? void 0 : "pointer" },
1980
+ onClick: handleClick,
1981
+ "data-name": "copiable",
1982
+ ref,
1983
+ children: [
1984
+ children,
1985
+ button && /* @__PURE__ */ jsx(
1986
+ IconButton$1,
1987
+ {
1988
+ ...buttonProps,
1989
+ disabled,
1990
+ icon: /* @__PURE__ */ jsx(ContentCopyOutlined, {}),
1991
+ "data-testid": dataTestId,
1992
+ "aria-label": ariaLabel || buttonLabel || defaultCopyText,
1993
+ sx: {
1994
+ display: "flex"
1995
+ }
1996
+ }
1997
+ )
1998
+ ]
1999
+ }
2000
+ )
2001
+ }
2002
+ ),
2003
+ /* @__PURE__ */ jsx(
2004
+ Snackbar,
2005
+ {
2006
+ open,
2007
+ autoWidth: true,
2008
+ closeable: false,
2009
+ autoHideDuration: 4e3,
2010
+ onClose: () => setOpen(false),
2011
+ children: defaultCopiedText
2012
+ }
2013
+ )
2014
+ ] });
2015
+ };
2016
+ const CopiableComponent = forwardRef(_CopiableComponent);
2017
+ const AdornmentWrapper = styled(Box, {
2018
+ shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
2019
+ })(({ variant, size, theme }) => ({
2020
+ width: theme.spacing(3),
2021
+ ...variant === "standard" ? {
2022
+ marginLeft: theme.spacing(-0.25)
2023
+ } : {
2024
+ marginRight: theme.spacing(-1)
2025
+ },
2026
+ ...size === "medium" && {
2027
+ width: theme.spacing(4),
2028
+ ...variant === "standard" ? {
2029
+ marginLeft: theme.spacing(-0.5)
2030
+ } : {
2031
+ marginLeft: theme.spacing(1)
2032
+ }
2033
+ }
2034
+ }));
2035
+ function _CopiableInputText({
2036
+ value,
2037
+ variant,
2038
+ InputProps,
2039
+ extraEndAdornment,
2040
+ onCopied,
2041
+ password,
2042
+ size = "small",
2043
+ ...rest
2044
+ }, ref) {
2045
+ const intl = useIntl();
2046
+ const intlConfig = useImperativeIntl(intl);
2047
+ const [showText, setShowText] = useState(false);
2048
+ const inputType = !password ? "text" : showText ? "text" : "password";
2049
+ const showTextLabel = intlConfig.formatMessage({
2050
+ id: showText ? "c4r.button.hide" : "c4r.button.show"
2051
+ });
2052
+ const passwordAdornment = useMemo(() => {
2053
+ return /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
2054
+ IconButton$1,
2055
+ {
2056
+ edge: variant !== "standard" ? "end" : void 0,
2057
+ onClick: () => setShowText(!showText),
2058
+ size,
2059
+ icon: showText ? /* @__PURE__ */ jsx(VisibilityOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOffOutlined, {}),
2060
+ tooltip: showTextLabel,
2061
+ "aria-label": showTextLabel
2062
+ }
2063
+ ) });
2064
+ }, [showTextLabel, showText, size, variant]);
2065
+ return /* @__PURE__ */ jsx(
2066
+ TextField,
2067
+ {
2068
+ ...rest,
2069
+ size,
2070
+ value,
2071
+ variant,
2072
+ InputProps: {
2073
+ readOnly: true,
2074
+ endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
2075
+ password ? passwordAdornment : extraEndAdornment,
2076
+ /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(AdornmentWrapper, { size, variant, children: /* @__PURE__ */ jsx(
2077
+ CopiableComponent,
2078
+ {
2079
+ value,
2080
+ onCopied,
2081
+ button: true,
2082
+ buttonProps: {
2083
+ size
2084
+ }
2085
+ }
2086
+ ) }) })
2087
+ ] }),
2088
+ ...variant === "filled" && {
2089
+ disableUnderline: true
2090
+ },
2091
+ ...InputProps
2092
+ },
2093
+ type: inputType,
2094
+ "data-name": "copiable-input-text",
2095
+ ref
2096
+ }
2097
+ );
2098
+ }
2099
+ const CopiableInputText = forwardRef(_CopiableInputText);
2100
+ async function copyString(value) {
2101
+ return await navigator.clipboard.writeText(value);
2102
+ }
2103
+ const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
2104
+ const [message, setMessage] = useState(msg);
2105
+ const copy = async (text) => {
2106
+ await copyString(text);
2107
+ setMessage(copiedMsg);
2108
+ setTimeout(() => setMessage(msg), 1e3);
2109
+ };
2110
+ return {
2111
+ message,
2112
+ copy
2113
+ };
2114
+ };
2115
+ const IndicatorIcon = styled(Box)({
2116
+ position: "absolute",
2117
+ top: 0,
2118
+ left: 0,
2119
+ right: 0,
2120
+ bottom: 0,
2121
+ display: "flex",
2122
+ alignItems: "center",
2123
+ justifyContent: "center"
2124
+ });
2125
+ const HiddenText = styled(Box)({
2126
+ visibility: "hidden",
2127
+ pointerEvents: "none"
2128
+ });
2129
+ function _Button({
2130
+ children,
2131
+ loading,
2132
+ disabled,
2133
+ startIcon,
2134
+ endIcon,
2135
+ loadingPosition,
2136
+ external,
2137
+ showExternalIcon = true,
2138
+ "aria-describedby": ariaDescribedby,
2139
+ ...otherProps
2140
+ }, ref) {
2141
+ const intl = useIntl();
2142
+ const intlConfig = useImperativeIntl(intl);
2143
+ const defaultIconLoader = /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" });
2144
+ const isDefaultLoading = loading && loadingPosition === void 0;
2145
+ const isExternalLink = otherProps.href && external;
2146
+ const renderContent = () => {
2147
+ if (isDefaultLoading) {
2148
+ return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
2149
+ /* @__PURE__ */ jsx(IndicatorIcon, { children: defaultIconLoader }),
2150
+ /* @__PURE__ */ jsx(HiddenText, { children })
2151
+ ] });
2152
+ }
2153
+ if (isExternalLink) {
2154
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2155
+ children,
2156
+ /* @__PURE__ */ jsx(ScreenReaderOnly, { id: "external-hint", children: `(${intlConfig.formatMessage({
2157
+ id: "c4r.button.opensInNewTab"
2158
+ })})` })
2159
+ ] });
2160
+ }
2161
+ return children;
2162
+ };
2163
+ const getIconForPosition = (position) => {
2164
+ if (isDefaultLoading) {
2165
+ return void 0;
2166
+ }
2167
+ if (loading && loadingPosition !== void 0) {
2168
+ if (loadingPosition === position) {
2169
+ return defaultIconLoader;
2170
+ }
2171
+ return void 0;
2172
+ }
2173
+ if (position === "start") {
2174
+ return startIcon;
2175
+ } else {
2176
+ return endIcon || (isExternalLink && showExternalIcon ? /* @__PURE__ */ jsx(OpenInNewOutlined, {}) : void 0);
2177
+ }
2178
+ };
2179
+ return /* @__PURE__ */ jsx(
2180
+ Button$1,
2181
+ {
2182
+ disabled: loading || disabled,
2183
+ startIcon: getIconForPosition("start"),
2184
+ endIcon: getIconForPosition("end"),
2185
+ ...otherProps,
2186
+ role: otherProps.href ? "link" : "button",
2187
+ ...isExternalLink && {
2188
+ target: "_blank",
2189
+ rel: "noopener noreferrer"
2190
+ },
2191
+ ref,
2192
+ "aria-describedby": isExternalLink ? "external-hint" : ariaDescribedby,
2193
+ children: /* @__PURE__ */ jsx(Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
2194
+ }
2195
+ );
2196
+ }
2197
+ const Button = forwardRef(_Button);
2198
+ const ButtonGroup = styled(ButtonGroup$1)(({ theme, size }) => ({
2199
+ "& .MuiButton-root:last-child": {
2200
+ padding: 0,
2201
+ minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
2202
+ }
2203
+ }));
2204
+ function SplitButton({
2205
+ options,
2206
+ disabled,
2207
+ loading,
2208
+ loadingPosition,
2209
+ onClick,
2210
+ variant,
2211
+ size,
2212
+ color,
2213
+ ...otherProps
2214
+ }) {
2215
+ var _a;
2216
+ const [open, setOpen] = useState(false);
2217
+ const anchorRef = useRef(null);
2218
+ const [selectedIndex, setSelectedIndex] = useState(0);
2219
+ const handleClick = () => {
2220
+ onClick(options[selectedIndex]);
2221
+ };
2222
+ const handleMenuItemClick = (_, index) => {
2223
+ setSelectedIndex(index);
2224
+ setOpen(false);
2225
+ };
2226
+ const handleToggle = () => {
2227
+ setOpen((prevOpen) => !prevOpen);
2228
+ };
2229
+ const handleClose = (event) => {
2230
+ var _a2;
2231
+ if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
2232
+ return;
2233
+ }
2234
+ setOpen(false);
2235
+ };
2236
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2237
+ /* @__PURE__ */ jsxs(
2238
+ ButtonGroup,
2239
+ {
2240
+ "data-name": "split-button",
2241
+ ref: anchorRef,
2242
+ variant,
2243
+ size,
2244
+ color,
2245
+ ...otherProps,
2246
+ children: [
2247
+ /* @__PURE__ */ jsx(
2248
+ Button,
2249
+ {
2250
+ disabled,
2251
+ loading,
2252
+ loadingPosition,
2253
+ onClick: handleClick,
2254
+ children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
2255
+ }
2256
+ ),
2257
+ /* @__PURE__ */ jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}) })
2258
+ ]
2259
+ }
2260
+ ),
2261
+ /* @__PURE__ */ jsx(
2262
+ Popper,
2263
+ {
2264
+ sx: { zIndex: 1 },
2265
+ open,
2266
+ anchorEl: anchorRef.current,
2267
+ role: void 0,
2268
+ transition: true,
2269
+ disablePortal: true,
2270
+ placement: "bottom-end",
2271
+ children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx(
2272
+ Grow,
2273
+ {
2274
+ ...TransitionProps,
2275
+ style: {
2276
+ transformOrigin: placement === "bottom" ? "center top" : "center bottom"
2277
+ },
2278
+ 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(
2279
+ MenuItem$1,
2280
+ {
2281
+ disabled: option.disabled,
2282
+ selected: index === selectedIndex,
2283
+ onClick: (event) => handleMenuItemClick(event, index),
2284
+ children: option.label
2285
+ },
2286
+ option.label
2287
+ )) }) }) })
2288
+ }
2289
+ )
2290
+ }
2291
+ )
2292
+ ] });
2293
+ }
2294
+ const Root$5 = styled(Box)(({ theme }) => ({
2295
+ display: "flex",
2296
+ alignItems: "center",
2297
+ gap: theme.spacing(0.5)
2298
+ }));
2299
+ const Indicator = styled(Typography)(({ theme }) => ({
2300
+ ".Mui-disabled &": {
2301
+ color: theme.palette.text.disabled
2302
+ }
2303
+ }));
2304
+ const Icon = styled(Box)(({ theme }) => ({
2305
+ display: "flex",
2306
+ svg: {
2307
+ width: ICON_SIZE_SMALL,
2308
+ height: ICON_SIZE_SMALL,
2309
+ fontSize: ICON_SIZE_SMALL,
2310
+ path: {
2311
+ fill: theme.palette.text.secondary,
2312
+ ".Mui-disabled &": {
2313
+ fill: theme.palette.text.disabled
2314
+ }
2315
+ }
2316
+ }
2317
+ }));
2318
+ function LabelWithIndicator({
2319
+ label,
2320
+ type,
2321
+ icon,
2322
+ inheritSize
2323
+ }) {
2324
+ return /* @__PURE__ */ jsxs(Root$5, { children: [
2325
+ label,
2326
+ type && /* @__PURE__ */ jsx(
2327
+ Indicator,
2328
+ {
2329
+ component: "span",
2330
+ variant: inheritSize ? "inherit" : "caption",
2331
+ color: "textSecondary",
2332
+ weight: "regular",
2333
+ children: type === "required" ? "(required)" : "(optional)"
2334
+ }
2335
+ ),
2336
+ icon && /* @__PURE__ */ jsx(Icon, { children: icon })
2337
+ ] });
2338
+ }
2339
+ function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
2340
+ const intl = useIntl();
2341
+ const intlConfig = useImperativeIntl(intl);
2342
+ const [showPassword, setShowPassword] = useState(false);
2343
+ const handleClickShowPassword = () => setShowPassword(!showPassword);
2344
+ return /* @__PURE__ */ jsx(
2345
+ TextField,
2346
+ {
2347
+ ...otherProps,
2348
+ ref,
2349
+ type: showPassword ? "text" : "password",
2350
+ size,
2351
+ InputProps: {
2352
+ ...InputProps,
2353
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsx(
2354
+ Tooltip,
2355
+ {
2356
+ title: intlConfig.formatMessage({
2357
+ id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
2358
+ }),
2359
+ children: showPassword ? /* @__PURE__ */ jsx(VisibilityOffOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOutlined, {})
2360
+ }
2361
+ ) }) })
2362
+ }
2363
+ }
2364
+ );
2365
+ }
2366
+ const PasswordField = forwardRef(_PasswordField);
2367
+ const StyledToggleButtonGroup = styled(ToggleButtonGroup$1, {
2368
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
2369
+ })(({ variant, backgroundColor, theme }) => ({
2370
+ // Variants
2371
+ ...variant === "contained" && {
2372
+ boxShadow: "none"
2373
+ },
2374
+ ...variant === "unbounded" && {
2375
+ boxShadow: "none",
2376
+ borderRadius: theme.spacing(0.5),
2377
+ "& .MuiDivider-root": {
2378
+ height: theme.spacing(4),
2379
+ "&.MuiToggleButtonGroup-groupedHorizontal": {
2380
+ height: theme.spacing(4)
2381
+ },
2382
+ "&.MuiToggleButtonGroup-groupedVertical": {
2383
+ height: "auto",
2384
+ width: theme.spacing(4),
2385
+ margin: `${theme.spacing(0.5, 0, 1)} !important`,
2386
+ borderRadius: "0 !important"
2387
+ }
2388
+ },
2389
+ "& .MuiToggleButton-sizeSmall": {
2390
+ margin: 0,
2391
+ "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
2392
+ margin: 0
2393
+ },
2394
+ "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
2395
+ height: theme.spacing(3)
2396
+ },
2397
+ "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
2398
+ height: "auto",
2399
+ width: theme.spacing(3)
2400
+ }
2401
+ },
2402
+ ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
2403
+ margin: 0,
2404
+ "&:first-of-type": {
2405
+ marginLeft: 0
2406
+ },
2407
+ "&:not(:last-of-type)": {
2408
+ marginRight: theme.spacing(0.5)
2409
+ }
2410
+ },
2411
+ "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
2412
+ ".MuiToggleButtonGroup-grouped": {
2413
+ margin: theme.spacing(0, 0.5)
2414
+ }
2415
+ },
2416
+ "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
2417
+ ".MuiToggleButtonGroup-grouped": {
2418
+ margin: theme.spacing(0, 0, 0.5),
2419
+ "&:not(:last-of-type)": {
2420
+ marginRight: 0
2421
+ },
2422
+ "&:last-of-type": {
2423
+ marginBottom: 0
2424
+ }
2425
+ }
2426
+ }
2427
+ },
2428
+ // Colors
2429
+ ...backgroundColor === "primary" && {
2430
+ backgroundColor: theme.palette.background.paper
2431
+ },
2432
+ ...backgroundColor === "secondary" && {
2433
+ backgroundColor: theme.palette.background.default
2434
+ },
2435
+ ...backgroundColor === "transparent" && {
2436
+ backgroundColor: "transparent"
2437
+ }
2438
+ }));
2439
+ function ToggleButtonGroup({
2440
+ children,
2441
+ variant = "floating",
2442
+ backgroundColor,
2443
+ ...rest
2444
+ }) {
2445
+ const isUnbounded = variant === "unbounded";
2446
+ const defaultColor = isUnbounded ? "transparent" : "primary";
2447
+ return /* @__PURE__ */ jsx(
2448
+ StyledToggleButtonGroup,
2449
+ {
2450
+ ...rest,
2451
+ variant,
2452
+ backgroundColor: backgroundColor ?? defaultColor,
2453
+ children
2454
+ }
2455
+ );
2456
+ }
2346
2457
  const Menu = styled("div")(({ theme }) => ({
2347
2458
  display: "flex",
2348
2459
  alignItems: "center",
@@ -3414,11 +3525,11 @@ function CodeAreaHeader({
3414
3525
  transformOrigin: { vertical: "top", horizontal: "right" },
3415
3526
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
3416
3527
  children: [
3417
- /* @__PURE__ */ jsxs(MenuItem$1, { onClick: handleCopy, disabled, id: "copy", children: [
3528
+ /* @__PURE__ */ jsxs(MenuItem, { onClick: handleCopy, disabled, id: "copy", children: [
3418
3529
  /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(ContentCopyOutlined, {}) }),
3419
3530
  /* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.copy` }) })
3420
3531
  ] }),
3421
- /* @__PURE__ */ jsxs(MenuItem$1, { onClick: onClickExpand, disabled, id: "expand", children: [
3532
+ /* @__PURE__ */ jsxs(MenuItem, { onClick: onClickExpand, disabled, id: "expand", children: [
3422
3533
  /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(OpenDiagonallyRight, {}) }),
3423
3534
  /* @__PURE__ */ jsx(ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.expand` }) })
3424
3535
  ] })
@@ -5073,6 +5184,7 @@ export {
5073
5184
  CodeAreaInput,
5074
5185
  CodeAreaMarkTextPattern,
5075
5186
  CopiableComponent,
5187
+ CopiableInputText,
5076
5188
  CreatableAutocomplete,
5077
5189
  DatePicker,
5078
5190
  DateRangePicker,
@@ -5089,13 +5201,15 @@ export {
5089
5201
  DialogStepper,
5090
5202
  IconButton$1 as IconButton,
5091
5203
  LabelWithIndicator,
5204
+ L as Link,
5092
5205
  Menu$1 as Menu,
5093
- MenuItem$1 as MenuItem,
5206
+ MenuItem,
5094
5207
  MenuItemFilter,
5095
5208
  MenuList,
5096
5209
  MultipleAutocomplete,
5097
5210
  MultipleSelectField,
5098
5211
  PasswordField,
5212
+ ScreenReaderOnly,
5099
5213
  SelectField,
5100
5214
  Snackbar,
5101
5215
  SplitButton,