@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
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
+ const reactIntl = require("react-intl");
5
6
  const material = require("@mui/material");
6
- const TablePaginationActions = require("../TablePaginationActions-mbbjzV6Y.cjs");
7
+ const iconsMaterial = require("@mui/icons-material");
8
+ const TablePaginationActions = require("../TablePaginationActions-D2K26kdR.cjs");
9
+ const Link = require("../Link-_lzRY1Ay.cjs");
7
10
  const ArrowDown = require("../ArrowDown-DJ0vhbsw.cjs");
8
11
  const OpenDiagonallyRight = require("../OpenDiagonallyRight-CpL4ROwg.cjs");
9
- const reactIntl = require("react-intl");
10
- const iconsMaterial = require("@mui/icons-material");
11
- const Alert$1 = require("../Alert-BzEgeyQJ.cjs");
12
12
  require("cartocolor");
13
- const MenuItem = require("../MenuItem-C4bG5WHw.cjs");
13
+ const MenuItem = require("../MenuItem-BY6fuF5U.cjs");
14
14
  const reactWindow = require("react-window");
15
15
  const DatePicker$1 = require("@mui/x-date-pickers/DatePicker");
16
16
  const xDatePickers = require("@mui/x-date-pickers");
@@ -41,235 +41,146 @@ require("codemirror/addon/fold/indent-fold.js");
41
41
  require("codemirror/addon/fold/markdown-fold.js");
42
42
  require("codemirror/addon/fold/comment-fold.js");
43
43
  const ClickAwayListener = require("@mui/material/ClickAwayListener");
44
- const IndicatorIcon = material.styled(material.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 = material.styled(material.Box)({
55
- visibility: "hidden",
56
- pointerEvents: "none"
57
- });
58
- function _Button({
59
- children,
60
- loading,
61
- disabled,
62
- startIcon,
63
- endIcon,
64
- loadingPosition,
65
- ...otherProps
66
- }, ref) {
67
- const defaultIconLoader = /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" });
68
- const isDefaultLoading = loading && loadingPosition === void 0;
69
- const renderContent = () => {
70
- if (isDefaultLoading) {
71
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
72
- /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, { children: defaultIconLoader }),
73
- /* @__PURE__ */ jsxRuntime.jsx(HiddenText, { children })
74
- ] });
44
+ const StyledMenu = material.styled(material.Menu, {
45
+ shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
46
+ })(({ extended, width, height }) => ({
47
+ ...extended && {
48
+ ".MuiMenuItem-root": {
49
+ minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
75
50
  }
76
- return children;
77
- };
78
- const getIconForPosition = (position) => {
79
- if (isDefaultLoading) {
80
- return void 0;
51
+ },
52
+ ...width && {
53
+ ".MuiList-root": {
54
+ width,
55
+ minWidth: width
81
56
  }
82
- if (loading && loadingPosition !== void 0) {
83
- if (loadingPosition === position) {
84
- return defaultIconLoader;
85
- }
86
- return void 0;
57
+ },
58
+ ...height && {
59
+ ".MuiMenu-paper": {
60
+ overflow: "hidden"
61
+ },
62
+ ".MuiList-root": {
63
+ maxHeight: height
87
64
  }
88
- return position === "start" ? startIcon : endIcon;
89
- };
65
+ }
66
+ }));
67
+ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
90
68
  return /* @__PURE__ */ jsxRuntime.jsx(
91
- material.Button,
69
+ StyledMenu,
92
70
  {
93
- disabled: loading || disabled,
94
- startIcon: getIconForPosition("start"),
95
- endIcon: getIconForPosition("end"),
96
71
  ...otherProps,
97
- role: otherProps.href ? "link" : "button",
98
72
  ref,
99
- children: /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.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
+ }
100
83
  }
101
84
  );
102
85
  }
103
- const Button = React.forwardRef(_Button);
104
- const ButtonGroup = material.styled(material.ButtonGroup)(({ theme, size }) => ({
105
- "& .MuiButton-root:last-child": {
106
- padding: 0,
107
- minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
108
- }
109
- }));
110
- function SplitButton({
111
- options,
112
- disabled,
113
- loading,
114
- loadingPosition,
115
- onClick,
116
- variant,
117
- size,
118
- color,
119
- ...otherProps
120
- }) {
121
- var _a;
122
- const [open, setOpen] = React.useState(false);
123
- const anchorRef = React.useRef(null);
124
- const [selectedIndex, setSelectedIndex] = React.useState(0);
125
- const handleClick = () => {
126
- onClick(options[selectedIndex]);
127
- };
128
- const handleMenuItemClick = (_, index) => {
129
- setSelectedIndex(index);
130
- setOpen(false);
131
- };
132
- const handleToggle = () => {
133
- setOpen((prevOpen) => !prevOpen);
134
- };
135
- const handleClose = (event) => {
136
- var _a2;
137
- if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
138
- return;
86
+ const Menu$1 = React.forwardRef(_Menu);
87
+ const StyledMenuList = material.styled(material.MenuList, {
88
+ shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
89
+ })(({ extended, width, height }) => ({
90
+ ...extended && {
91
+ ".MuiMenuItem-root": {
92
+ minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
139
93
  }
140
- setOpen(false);
141
- };
142
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
143
- /* @__PURE__ */ jsxRuntime.jsxs(
144
- ButtonGroup,
145
- {
146
- "data-name": "split-button",
147
- ref: anchorRef,
148
- variant,
149
- size,
150
- color,
151
- ...otherProps,
152
- children: [
153
- /* @__PURE__ */ jsxRuntime.jsx(
154
- Button,
155
- {
156
- disabled,
157
- loading,
158
- loadingPosition,
159
- onClick: handleClick,
160
- children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
161
- }
162
- ),
163
- /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}) })
164
- ]
165
- }
166
- ),
167
- /* @__PURE__ */ jsxRuntime.jsx(
168
- material.Popper,
169
- {
170
- sx: { zIndex: 1 },
171
- open,
172
- anchorEl: anchorRef.current,
173
- role: void 0,
174
- transition: true,
175
- disablePortal: true,
176
- placement: "bottom-end",
177
- children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsxRuntime.jsx(
178
- material.Grow,
179
- {
180
- ...TransitionProps,
181
- style: {
182
- transformOrigin: placement === "bottom" ? "center top" : "center bottom"
183
- },
184
- children: /* @__PURE__ */ jsxRuntime.jsx(material.Paper, { elevation: 8, children: /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntime.jsx(material.MenuList, { autoFocusItem: true, sx: { paddingY: 1 }, children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
185
- material.MenuItem,
186
- {
187
- disabled: option.disabled,
188
- selected: index === selectedIndex,
189
- onClick: (event) => handleMenuItemClick(event, index),
190
- children: option.label
191
- },
192
- option.label
193
- )) }) }) })
194
- }
195
- )
196
- }
197
- )
198
- ] });
199
- }
200
- const Root$5 = material.styled(material.Box)(({ theme }) => ({
201
- display: "flex",
202
- alignItems: "center",
203
- gap: theme.spacing(0.5)
204
- }));
205
- const Indicator = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
206
- ".Mui-disabled &": {
207
- color: theme.palette.text.disabled
208
- }
209
- }));
210
- const Icon = material.styled(material.Box)(({ theme }) => ({
211
- display: "flex",
212
- svg: {
213
- width: TablePaginationActions.ICON_SIZE_SMALL,
214
- height: TablePaginationActions.ICON_SIZE_SMALL,
215
- fontSize: TablePaginationActions.ICON_SIZE_SMALL,
216
- path: {
217
- fill: theme.palette.text.secondary,
218
- ".Mui-disabled &": {
219
- fill: theme.palette.text.disabled
220
- }
94
+ },
95
+ "&.MuiList-root": {
96
+ ...width && {
97
+ width,
98
+ minWidth: width
99
+ },
100
+ ...height && {
101
+ maxHeight: height
221
102
  }
222
103
  }
223
104
  }));
224
- function LabelWithIndicator({
225
- label,
226
- type,
227
- icon,
228
- inheritSize
229
- }) {
230
- return /* @__PURE__ */ jsxRuntime.jsxs(Root$5, { children: [
231
- label,
232
- type && /* @__PURE__ */ jsxRuntime.jsx(
233
- Indicator,
234
- {
235
- component: "span",
236
- variant: inheritSize ? "inherit" : "caption",
237
- color: "textSecondary",
238
- weight: "regular",
239
- children: type === "required" ? "(required)" : "(optional)"
240
- }
241
- ),
242
- icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon })
243
- ] });
244
- }
245
- function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
246
- const intl = reactIntl.useIntl();
247
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
248
- const [showPassword, setShowPassword] = React.useState(false);
249
- const handleClickShowPassword = () => setShowPassword(!showPassword);
105
+ function _MenuList({ extended, width, height, ...otherProps }, ref) {
250
106
  return /* @__PURE__ */ jsxRuntime.jsx(
251
- material.TextField,
107
+ StyledMenuList,
252
108
  {
253
109
  ...otherProps,
254
110
  ref,
255
- type: showPassword ? "text" : "password",
256
- size,
257
- InputProps: {
258
- ...InputProps,
259
- endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsxRuntime.jsx(
260
- material.Tooltip,
261
- {
262
- title: intlConfig.formatMessage({
263
- id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
264
- }),
265
- children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {})
266
- }
267
- ) }) })
268
- }
111
+ width,
112
+ height,
113
+ extended,
114
+ "data-name": "menu-list",
115
+ "data-width": width,
116
+ "data-height": height,
117
+ "data-extended": extended
269
118
  }
270
119
  );
271
120
  }
272
- const PasswordField = React.forwardRef(_PasswordField);
121
+ const MenuList = React.forwardRef(_MenuList);
122
+ const StyledMenuItem$1 = material.styled(MenuItem.MenuItem)(() => ({
123
+ marginTop: "0 !important",
124
+ marginBottom: "0 !important"
125
+ }));
126
+ const LinkFilter = material.styled(material.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 = reactIntl.useIntl();
148
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
149
+ return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
169
+ material.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 = React.forwardRef(_MenuItemFilter);
273
184
  const idCounter = {};
274
185
  function uniqueId(prefix = "$lodash$") {
275
186
  if (!idCounter[prefix]) {
@@ -388,309 +299,79 @@ function _SelectField({
388
299
  );
389
300
  }
390
301
  const SelectField = React.forwardRef(_SelectField);
391
- const StyledToggleButtonGroup = material.styled(material.ToggleButtonGroup, {
392
- shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
393
- })(({ variant, backgroundColor, theme }) => ({
394
- // Variants
395
- ...variant === "contained" && {
396
- boxShadow: "none"
397
- },
398
- ...variant === "unbounded" && {
399
- boxShadow: "none",
400
- borderRadius: theme.spacing(0.5),
401
- "& .MuiDivider-root": {
402
- height: theme.spacing(4),
403
- "&.MuiToggleButtonGroup-groupedHorizontal": {
404
- height: theme.spacing(4)
405
- },
406
- "&.MuiToggleButtonGroup-groupedVertical": {
407
- height: "auto",
408
- width: theme.spacing(4),
409
- margin: `${theme.spacing(0.5, 0, 1)} !important`,
410
- borderRadius: "0 !important"
411
- }
412
- },
413
- "& .MuiToggleButton-sizeSmall": {
414
- margin: 0,
415
- "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
416
- margin: 0
417
- },
418
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
419
- height: theme.spacing(3)
420
- },
421
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
422
- height: "auto",
423
- width: theme.spacing(3)
424
- }
425
- },
426
- ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
427
- margin: 0,
428
- "&:first-of-type": {
429
- marginLeft: 0
430
- },
431
- "&:not(:last-of-type)": {
432
- marginRight: theme.spacing(0.5)
433
- }
434
- },
435
- "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
436
- ".MuiToggleButtonGroup-grouped": {
437
- margin: theme.spacing(0, 0.5)
438
- }
439
- },
440
- "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
441
- ".MuiToggleButtonGroup-grouped": {
442
- margin: theme.spacing(0, 0, 0.5),
443
- "&:not(:last-of-type)": {
444
- marginRight: 0
445
- },
446
- "&:last-of-type": {
447
- marginBottom: 0
448
- }
449
- }
450
- }
451
- },
452
- // Colors
453
- ...backgroundColor === "primary" && {
454
- backgroundColor: theme.palette.background.paper
455
- },
456
- ...backgroundColor === "secondary" && {
457
- backgroundColor: theme.palette.background.default
458
- },
459
- ...backgroundColor === "transparent" && {
460
- backgroundColor: "transparent"
461
- }
462
- }));
463
- function ToggleButtonGroup({
464
- children,
465
- variant = "floating",
466
- backgroundColor,
467
- ...rest
302
+ function useMultipleSelectField({
303
+ selectedOptions,
304
+ options,
305
+ onChange
468
306
  }) {
469
- const isUnbounded = variant === "unbounded";
470
- const defaultColor = isUnbounded ? "transparent" : "primary";
471
- return /* @__PURE__ */ jsxRuntime.jsx(
472
- StyledToggleButtonGroup,
473
- {
474
- ...rest,
475
- variant,
476
- backgroundColor: backgroundColor ?? defaultColor,
477
- children
307
+ const [currentOptions, setCurrentOptions] = React.useState(selectedOptions ?? []);
308
+ const areAllSelected = options.length === currentOptions.length;
309
+ const areAnySelected = currentOptions.length > 0;
310
+ React.useEffect(() => {
311
+ if (currentOptions !== selectedOptions) {
312
+ setCurrentOptions(currentOptions);
478
313
  }
479
- );
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
+ };
480
350
  }
481
- const StyledMenu = material.styled(material.Menu, {
482
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
483
- })(({ extended, width, height }) => ({
484
- ...extended && {
485
- ".MuiMenuItem-root": {
486
- minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
351
+ const StyledMenuItem = material.styled(material.MenuItem)(({ theme }) => ({
352
+ "&.Mui-disabled": {
353
+ pointerEvents: "auto",
354
+ "&:hover": {
355
+ backgroundColor: `${theme.palette.background.default} !important`
487
356
  }
357
+ }
358
+ }));
359
+ const UnselectButton = material.styled(material.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"
488
368
  },
489
- ...width && {
490
- ".MuiList-root": {
491
- width,
492
- minWidth: width
493
- }
369
+ ".MuiSvgIcon-root": {
370
+ color: theme.palette.text.hint
494
371
  },
495
- ...height && {
496
- ".MuiMenu-paper": {
497
- overflow: "hidden"
498
- },
499
- ".MuiList-root": {
500
- maxHeight: height
501
- }
502
- }
503
- }));
504
- function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
505
- return /* @__PURE__ */ jsxRuntime.jsx(
506
- StyledMenu,
507
- {
508
- ...otherProps,
509
- ref,
510
- "data-name": "menu",
511
- width,
512
- height,
513
- extended,
514
- MenuListProps: {
515
- ...MenuListProps,
516
- "data-width": width,
517
- "data-height": height,
518
- "data-extended": extended
519
- }
520
- }
521
- );
522
- }
523
- const Menu$1 = React.forwardRef(_Menu);
524
- const StyledMenuList = material.styled(material.MenuList, {
525
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
526
- })(({ extended, width, height }) => ({
527
- ...extended && {
528
- ".MuiMenuItem-root": {
529
- minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
530
- }
531
- },
532
- "&.MuiList-root": {
533
- ...width && {
534
- width,
535
- minWidth: width
536
- },
537
- ...height && {
538
- maxHeight: height
539
- }
540
- }
541
- }));
542
- function _MenuList({ extended, width, height, ...otherProps }, ref) {
543
- return /* @__PURE__ */ jsxRuntime.jsx(
544
- StyledMenuList,
545
- {
546
- ...otherProps,
547
- ref,
548
- width,
549
- height,
550
- extended,
551
- "data-name": "menu-list",
552
- "data-width": width,
553
- "data-height": height,
554
- "data-extended": extended
555
- }
556
- );
557
- }
558
- const MenuList = React.forwardRef(_MenuList);
559
- const StyledMenuItem$1 = material.styled(MenuItem.MenuItem)(() => ({
560
- marginTop: "0 !important",
561
- marginBottom: "0 !important"
562
- }));
563
- const LinkFilter = material.styled(material.Link)(
564
- ({ disabled, theme }) => ({
565
- display: "flex",
566
- alignItems: "center",
567
- gap: theme.spacing(1),
568
- width: "100%",
569
- textAlign: "initial",
570
- ...disabled && {
571
- pointerEvents: "none",
572
- color: theme.palette.text.disabled
573
- }
574
- })
575
- );
576
- function _MenuItemFilter({
577
- areAllSelected,
578
- areAnySelected,
579
- selectAll,
580
- selectAllDisabled,
581
- "aria-label": ariaLabel,
582
- "data-testid": dataTestId
583
- }, ref) {
584
- const intl = reactIntl.useIntl();
585
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
586
- return /* @__PURE__ */ jsxRuntime.jsx(
587
- StyledMenuItem$1,
588
- {
589
- ref,
590
- fixed: true,
591
- "data-name": "menu-filter",
592
- "aria-label": ariaLabel,
593
- "data-testid": dataTestId,
594
- children: /* @__PURE__ */ jsxRuntime.jsxs(
595
- LinkFilter,
596
- {
597
- variant: "body2",
598
- color: "textPrimary",
599
- component: "button",
600
- underline: "none",
601
- disabled: !!selectAllDisabled,
602
- onClick: selectAll,
603
- tabIndex: 0,
604
- children: [
605
- /* @__PURE__ */ jsxRuntime.jsx(
606
- material.Checkbox,
607
- {
608
- checked: areAllSelected,
609
- indeterminate: areAnySelected && !areAllSelected,
610
- disabled: selectAllDisabled
611
- }
612
- ),
613
- intlConfig.formatMessage({ id: "c4r.form.selectAll" })
614
- ]
615
- }
616
- )
617
- }
618
- );
619
- }
620
- const MenuItemFilter = React.forwardRef(_MenuItemFilter);
621
- function useMultipleSelectField({
622
- selectedOptions,
623
- options,
624
- onChange
625
- }) {
626
- const [currentOptions, setCurrentOptions] = React.useState(selectedOptions ?? []);
627
- const areAllSelected = options.length === currentOptions.length;
628
- const areAnySelected = currentOptions.length > 0;
629
- React.useEffect(() => {
630
- if (currentOptions !== selectedOptions) {
631
- setCurrentOptions(currentOptions);
632
- }
633
- }, [selectedOptions]);
634
- const handleChange = (event) => {
635
- const {
636
- target: { value }
637
- } = event;
638
- const options2 = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
639
- setCurrentOptions(options2);
640
- onChange(options2);
641
- };
642
- const selectAll = () => {
643
- const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
644
- if (optionsValues) {
645
- const allSelected = optionsValues.every(
646
- (value) => currentOptions.includes(value)
647
- );
648
- if (allSelected) {
649
- setCurrentOptions([]);
650
- onChange([]);
651
- } else {
652
- setCurrentOptions(optionsValues);
653
- onChange(optionsValues);
654
- }
655
- }
656
- };
657
- const unselectAll = () => {
658
- setCurrentOptions([]);
659
- onChange([]);
660
- };
661
- return {
662
- areAllSelected,
663
- areAnySelected,
664
- currentOptions,
665
- handleChange,
666
- selectAll,
667
- unselectAll
668
- };
669
- }
670
- const StyledMenuItem = material.styled(material.MenuItem)(({ theme }) => ({
671
- "&.Mui-disabled": {
672
- pointerEvents: "auto",
673
- "&:hover": {
674
- backgroundColor: `${theme.palette.background.default} !important`
675
- }
676
- }
677
- }));
678
- const UnselectButton = material.styled(material.InputAdornment, {
679
- shouldForwardProp: (prop) => prop !== "size"
680
- })(({ theme, size }) => ({
681
- display: "none",
682
- position: "absolute",
683
- top: theme.spacing(2),
684
- right: theme.spacing(3.5),
685
- ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
686
- display: "flex"
687
- },
688
- ".MuiSvgIcon-root": {
689
- color: theme.palette.text.hint
690
- },
691
- ...size === "medium" && {
692
- top: theme.spacing(3),
693
- right: theme.spacing(5)
372
+ ...size === "medium" && {
373
+ top: theme.spacing(3),
374
+ right: theme.spacing(5)
694
375
  }
695
376
  }));
696
377
  const EMPTY_ARRAY = [];
@@ -1836,120 +1517,30 @@ function useAutocomplete({
1836
1517
  getOptionLabel: internalGetOptionLabel
1837
1518
  };
1838
1519
  }
1839
- const _CopiableComponent = ({
1840
- children,
1841
- disabled,
1842
- value,
1843
- onCopied,
1844
- copyText = "c4r.button.copy",
1845
- copiedText = "c4r.notifications.copiedToClipboard",
1846
- button,
1847
- buttonLabel,
1848
- buttonProps,
1849
- ariaLabel,
1850
- dataTestId,
1851
- tooltipPlacement = "top",
1852
- ...props
1853
- }, ref) => {
1854
- const intl = reactIntl.useIntl();
1855
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1856
- const [open, setOpen] = React.useState(false);
1857
- const { copy } = useCopyValue(copyText, copiedText);
1858
- const handleClick = (e) => {
1859
- e.preventDefault();
1860
- copy(value).then(() => {
1861
- onCopied == null ? void 0 : onCopied();
1862
- setOpen(true);
1863
- }).catch(console.error);
1864
- };
1865
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1866
- /* @__PURE__ */ jsxRuntime.jsx(
1867
- material.Tooltip,
1868
- {
1869
- title: intlConfig.formatMessage({ id: copyText }),
1870
- leaveDelay: 0,
1871
- placement: tooltipPlacement,
1872
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1873
- material.Box,
1874
- {
1875
- ...props,
1876
- sx: { cursor: disabled ? void 0 : "pointer" },
1877
- onClick: handleClick,
1878
- "data-name": "copiable",
1879
- ref,
1880
- children: [
1881
- children,
1882
- button && /* @__PURE__ */ jsxRuntime.jsx(
1883
- Alert$1.IconButton,
1884
- {
1885
- ...buttonProps,
1886
- disabled,
1887
- icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}),
1888
- "data-testid": dataTestId,
1889
- "aria-label": ariaLabel || buttonLabel,
1890
- sx: {
1891
- display: "flex"
1892
- }
1893
- }
1894
- )
1895
- ]
1896
- }
1897
- )
1898
- }
1899
- ),
1900
- /* @__PURE__ */ jsxRuntime.jsx(
1901
- Snackbar,
1902
- {
1903
- open,
1904
- autoWidth: true,
1905
- closeable: false,
1906
- autoHideDuration: 4e3,
1907
- onClose: () => setOpen(false),
1908
- children: intlConfig.formatMessage({ id: copiedText })
1909
- }
1910
- )
1911
- ] });
1912
- };
1913
- const CopiableComponent = React.forwardRef(_CopiableComponent);
1914
- async function copyString(value) {
1915
- return await navigator.clipboard.writeText(value);
1916
- }
1917
- const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
1918
- const [message, setMessage] = React.useState(msg);
1919
- const copy = async (text) => {
1920
- await copyString(text);
1921
- setMessage(copiedMsg);
1922
- setTimeout(() => setMessage(msg), 1e3);
1923
- };
1924
- return {
1925
- message,
1926
- copy
1927
- };
1928
- };
1929
- const AccordionContainer = material.styled("div", {
1930
- shouldForwardProp: (prop) => prop !== "variant"
1931
- })(({ variant, theme }) => ({
1932
- width: "100%",
1933
- borderRadius: theme.spacing(0.5),
1934
- ...variant === "outlined" && {
1935
- backgroundColor: theme.palette.background.paper,
1936
- boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`
1937
- }
1938
- }));
1939
- function AccordionGroup({
1940
- variant = "standard",
1941
- items,
1942
- ...otherProps
1943
- }) {
1944
- return /* @__PURE__ */ jsxRuntime.jsx(AccordionContainer, { ...otherProps, variant, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1945
- material.Accordion,
1946
- {
1947
- disabled: item.disabled,
1948
- defaultExpanded: item.defaultExpanded,
1949
- onChange: item.onChange,
1950
- children: [
1951
- /* @__PURE__ */ jsxRuntime.jsx(
1952
- material.AccordionSummary,
1520
+ const AccordionContainer = material.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__ */ jsxRuntime.jsx(AccordionContainer, { ...otherProps, variant, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1536
+ material.Accordion,
1537
+ {
1538
+ disabled: item.disabled,
1539
+ defaultExpanded: item.defaultExpanded,
1540
+ onChange: item.onChange,
1541
+ children: [
1542
+ /* @__PURE__ */ jsxRuntime.jsx(
1543
+ material.AccordionSummary,
1953
1544
  {
1954
1545
  "aria-controls": `${index}-content`,
1955
1546
  id: `${index}-header`,
@@ -2025,7 +1616,7 @@ const Content$4 = material.styled(material.Box, {
2025
1616
  }
2026
1617
  }
2027
1618
  }));
2028
- const Alert = material.styled(Alert$1.Alert, {
1619
+ const Alert = material.styled(Link.Alert, {
2029
1620
  shouldForwardProp: (prop) => !["hasActions", "closeable"].includes(prop)
2030
1621
  })(({ hasActions, closeable, icon, theme }) => ({
2031
1622
  position: "relative",
@@ -2139,7 +1730,7 @@ function Snackbar({
2139
1730
  }
2140
1731
  ),
2141
1732
  closeable && /* @__PURE__ */ jsxRuntime.jsx(CloseButtonWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
2142
- Alert$1.IconButton,
1733
+ Link.IconButton,
2143
1734
  {
2144
1735
  color: "default",
2145
1736
  onClick: (e) => onClose(e, "timeout"),
@@ -2344,6 +1935,525 @@ function _Tag({
2344
1935
  );
2345
1936
  }
2346
1937
  const Tag = React.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] = React.useState(false);
1954
+ const intl = reactIntl.useIntl();
1955
+ const intlConfig = TablePaginationActions.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__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1969
+ /* @__PURE__ */ jsxRuntime.jsx(
1970
+ material.Tooltip,
1971
+ {
1972
+ title: defaultCopyText,
1973
+ leaveDelay: 0,
1974
+ placement: tooltipPlacement,
1975
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1976
+ material.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__ */ jsxRuntime.jsx(
1986
+ Link.IconButton,
1987
+ {
1988
+ ...buttonProps,
1989
+ disabled,
1990
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.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__ */ jsxRuntime.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 = React.forwardRef(_CopiableComponent);
2017
+ const AdornmentWrapper = material.styled(material.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 = reactIntl.useIntl();
2046
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2047
+ const [showText, setShowText] = React.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 = React.useMemo(() => {
2053
+ return /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
2054
+ Link.IconButton,
2055
+ {
2056
+ edge: variant !== "standard" ? "end" : void 0,
2057
+ onClick: () => setShowText(!showText),
2058
+ size,
2059
+ icon: showText ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}),
2060
+ tooltip: showTextLabel,
2061
+ "aria-label": showTextLabel
2062
+ }
2063
+ ) });
2064
+ }, [showTextLabel, showText, size, variant]);
2065
+ return /* @__PURE__ */ jsxRuntime.jsx(
2066
+ material.TextField,
2067
+ {
2068
+ ...rest,
2069
+ size,
2070
+ value,
2071
+ variant,
2072
+ InputProps: {
2073
+ readOnly: true,
2074
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2075
+ password ? passwordAdornment : extraEndAdornment,
2076
+ /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(AdornmentWrapper, { size, variant, children: /* @__PURE__ */ jsxRuntime.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 = React.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] = React.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 = material.styled(material.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 = material.styled(material.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 = reactIntl.useIntl();
2142
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2143
+ const defaultIconLoader = /* @__PURE__ */ jsxRuntime.jsx(material.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__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
2149
+ /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, { children: defaultIconLoader }),
2150
+ /* @__PURE__ */ jsxRuntime.jsx(HiddenText, { children })
2151
+ ] });
2152
+ }
2153
+ if (isExternalLink) {
2154
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2155
+ children,
2156
+ /* @__PURE__ */ jsxRuntime.jsx(Link.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__ */ jsxRuntime.jsx(iconsMaterial.OpenInNewOutlined, {}) : void 0);
2177
+ }
2178
+ };
2179
+ return /* @__PURE__ */ jsxRuntime.jsx(
2180
+ material.Button,
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__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
2194
+ }
2195
+ );
2196
+ }
2197
+ const Button = React.forwardRef(_Button);
2198
+ const ButtonGroup = material.styled(material.ButtonGroup)(({ 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] = React.useState(false);
2217
+ const anchorRef = React.useRef(null);
2218
+ const [selectedIndex, setSelectedIndex] = React.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__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2237
+ /* @__PURE__ */ jsxRuntime.jsxs(
2238
+ ButtonGroup,
2239
+ {
2240
+ "data-name": "split-button",
2241
+ ref: anchorRef,
2242
+ variant,
2243
+ size,
2244
+ color,
2245
+ ...otherProps,
2246
+ children: [
2247
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}) })
2258
+ ]
2259
+ }
2260
+ ),
2261
+ /* @__PURE__ */ jsxRuntime.jsx(
2262
+ material.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__ */ jsxRuntime.jsx(
2272
+ material.Grow,
2273
+ {
2274
+ ...TransitionProps,
2275
+ style: {
2276
+ transformOrigin: placement === "bottom" ? "center top" : "center bottom"
2277
+ },
2278
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Paper, { elevation: 8, children: /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntime.jsx(material.MenuList, { autoFocusItem: true, sx: { paddingY: 1 }, children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
2279
+ material.MenuItem,
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 = material.styled(material.Box)(({ theme }) => ({
2295
+ display: "flex",
2296
+ alignItems: "center",
2297
+ gap: theme.spacing(0.5)
2298
+ }));
2299
+ const Indicator = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
2300
+ ".Mui-disabled &": {
2301
+ color: theme.palette.text.disabled
2302
+ }
2303
+ }));
2304
+ const Icon = material.styled(material.Box)(({ theme }) => ({
2305
+ display: "flex",
2306
+ svg: {
2307
+ width: TablePaginationActions.ICON_SIZE_SMALL,
2308
+ height: TablePaginationActions.ICON_SIZE_SMALL,
2309
+ fontSize: TablePaginationActions.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__ */ jsxRuntime.jsxs(Root$5, { children: [
2325
+ label,
2326
+ type && /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(Icon, { children: icon })
2337
+ ] });
2338
+ }
2339
+ function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
2340
+ const intl = reactIntl.useIntl();
2341
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2342
+ const [showPassword, setShowPassword] = React.useState(false);
2343
+ const handleClickShowPassword = () => setShowPassword(!showPassword);
2344
+ return /* @__PURE__ */ jsxRuntime.jsx(
2345
+ material.TextField,
2346
+ {
2347
+ ...otherProps,
2348
+ ref,
2349
+ type: showPassword ? "text" : "password",
2350
+ size,
2351
+ InputProps: {
2352
+ ...InputProps,
2353
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsxRuntime.jsx(
2354
+ material.Tooltip,
2355
+ {
2356
+ title: intlConfig.formatMessage({
2357
+ id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
2358
+ }),
2359
+ children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {})
2360
+ }
2361
+ ) }) })
2362
+ }
2363
+ }
2364
+ );
2365
+ }
2366
+ const PasswordField = React.forwardRef(_PasswordField);
2367
+ const StyledToggleButtonGroup = material.styled(material.ToggleButtonGroup, {
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__ */ jsxRuntime.jsx(
2448
+ StyledToggleButtonGroup,
2449
+ {
2450
+ ...rest,
2451
+ variant,
2452
+ backgroundColor: backgroundColor ?? defaultColor,
2453
+ children
2454
+ }
2455
+ );
2456
+ }
2347
2457
  const Menu = material.styled("div")(({ theme }) => ({
2348
2458
  display: "flex",
2349
2459
  alignItems: "center",
@@ -3389,7 +3499,7 @@ function CodeAreaHeader({
3389
3499
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3390
3500
  /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
3391
3501
  /* @__PURE__ */ jsxRuntime.jsx(
3392
- Alert$1.IconButton,
3502
+ Link.IconButton,
3393
3503
  {
3394
3504
  color: "default",
3395
3505
  size,
@@ -3453,7 +3563,7 @@ function CodeAreaHeader({
3453
3563
  }
3454
3564
  ),
3455
3565
  showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
3456
- Alert$1.IconButton,
3566
+ Link.IconButton,
3457
3567
  {
3458
3568
  color: "default",
3459
3569
  size,
@@ -4625,7 +4735,7 @@ const DialogContentPadded = material.styled(DialogContent, {
4625
4735
  paddingBottom: `${theme.spacing(3)} !important`
4626
4736
  }
4627
4737
  }));
4628
- const StyledAlert = material.styled(Alert$1.Alert)(({ theme }) => ({
4738
+ const StyledAlert = material.styled(Link.Alert)(({ theme }) => ({
4629
4739
  minHeight: "auto",
4630
4740
  padding: 0,
4631
4741
  backgroundColor: "transparent",
@@ -5057,8 +5167,10 @@ function CodeAreaDialog({
5057
5167
  }
5058
5168
  exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
5059
5169
  exports.Typography = TablePaginationActions.Typography;
5060
- exports.Alert = Alert$1.Alert;
5061
- exports.IconButton = Alert$1.IconButton;
5170
+ exports.Alert = Link.Alert;
5171
+ exports.IconButton = Link.IconButton;
5172
+ exports.Link = Link.Link;
5173
+ exports.ScreenReaderOnly = Link.ScreenReaderOnly;
5062
5174
  exports.MenuItem = MenuItem.MenuItem;
5063
5175
  exports.AUTOCOMPLETE_GROUP_HEADER_PROPERTY = AUTOCOMPLETE_GROUP_HEADER_PROPERTY;
5064
5176
  exports.AccordionGroup = AccordionGroup;
@@ -5077,6 +5189,7 @@ exports.CodeAreaHeader = CodeAreaHeader;
5077
5189
  exports.CodeAreaInput = CodeAreaInput;
5078
5190
  exports.CodeAreaMarkTextPattern = CodeAreaMarkTextPattern;
5079
5191
  exports.CopiableComponent = CopiableComponent;
5192
+ exports.CopiableInputText = CopiableInputText;
5080
5193
  exports.CreatableAutocomplete = CreatableAutocomplete;
5081
5194
  exports.DatePicker = DatePicker;
5082
5195
  exports.DateRangePicker = DateRangePicker;