@carto/meridian-ds 2.0.2-alpha-external-link.11 → 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 (39) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/{Alert-yL5uEg4Z.js → Link-D5fKicEY.js} +129 -129
  3. package/dist/{Alert-oGAW_syG.cjs → Link-_lzRY1Ay.cjs} +129 -129
  4. package/dist/{MenuItem-CyIdh2wX.cjs → MenuItem-BY6fuF5U.cjs} +1 -1
  5. package/dist/{MenuItem-C8x-GasJ.js → MenuItem-CKrhDizf.js} +1 -1
  6. package/dist/{TablePaginationActions-BWer8cmX.js → TablePaginationActions-CCDi-BO-.js} +6 -6
  7. package/dist/{TablePaginationActions-MwqZJoRm.cjs → TablePaginationActions-D2K26kdR.cjs} +6 -6
  8. package/dist/components/index.cjs +822 -734
  9. package/dist/components/index.js +790 -702
  10. package/dist/theme/index.cjs +2 -2
  11. package/dist/theme/index.js +3 -3
  12. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts +4 -0
  13. package/dist/types/components/atoms/Copy/CopiableComponent.d.ts.map +1 -0
  14. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts +18 -0
  15. package/dist/types/components/atoms/Copy/CopiableInputText.d.ts.map +1 -0
  16. package/dist/types/components/atoms/Copy/copyString.d.ts.map +1 -0
  17. package/dist/types/components/{molecules → atoms}/Copy/index.d.ts +2 -1
  18. package/dist/types/components/atoms/Copy/index.d.ts.map +1 -0
  19. package/dist/types/components/{molecules/Copy/CopiableComponent.d.ts → atoms/Copy/types.d.ts} +11 -5
  20. package/dist/types/components/atoms/Copy/types.d.ts.map +1 -0
  21. package/dist/types/components/atoms/Copy/useCopyValue.d.ts.map +1 -0
  22. package/dist/types/components/atoms/index.d.ts +2 -0
  23. package/dist/types/components/atoms/index.d.ts.map +1 -1
  24. package/dist/types/components/molecules/index.d.ts +0 -2
  25. package/dist/types/components/molecules/index.d.ts.map +1 -1
  26. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -1
  27. package/dist/types/localization/en.d.ts +2 -2
  28. package/dist/types/localization/es.d.ts +2 -2
  29. package/dist/types/localization/id.d.ts +2 -2
  30. package/dist/types/localization/index.d.ts +6 -6
  31. package/dist/widgets/index.cjs +8 -8
  32. package/dist/widgets/index.js +2 -2
  33. package/package.json +1 -1
  34. package/dist/types/components/molecules/Copy/CopiableComponent.d.ts.map +0 -1
  35. package/dist/types/components/molecules/Copy/copyString.d.ts.map +0 -1
  36. package/dist/types/components/molecules/Copy/index.d.ts.map +0 -1
  37. package/dist/types/components/molecules/Copy/useCopyValue.d.ts.map +0 -1
  38. /package/dist/types/components/{molecules → atoms}/Copy/copyString.d.ts +0 -0
  39. /package/dist/types/components/{molecules → atoms}/Copy/useCopyValue.d.ts +0 -0
@@ -5,12 +5,12 @@ const React = require("react");
5
5
  const reactIntl = require("react-intl");
6
6
  const material = require("@mui/material");
7
7
  const iconsMaterial = require("@mui/icons-material");
8
- const TablePaginationActions = require("../TablePaginationActions-MwqZJoRm.cjs");
9
- const Alert$1 = require("../Alert-oGAW_syG.cjs");
8
+ const TablePaginationActions = require("../TablePaginationActions-D2K26kdR.cjs");
9
+ const Link = require("../Link-_lzRY1Ay.cjs");
10
10
  const ArrowDown = require("../ArrowDown-DJ0vhbsw.cjs");
11
11
  const OpenDiagonallyRight = require("../OpenDiagonallyRight-CpL4ROwg.cjs");
12
12
  require("cartocolor");
13
- const MenuItem = require("../MenuItem-CyIdh2wX.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,307 +41,195 @@ 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
- external,
66
- showExternalIcon = true,
67
- "aria-describedby": ariaDescribedby,
68
- ...otherProps
69
- }, ref) {
70
- const intl = reactIntl.useIntl();
71
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
72
- const defaultIconLoader = /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" });
73
- const isDefaultLoading = loading && loadingPosition === void 0;
74
- const isExternalLink = otherProps.href && external;
75
- const renderContent = () => {
76
- if (isDefaultLoading) {
77
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
78
- /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, { children: defaultIconLoader }),
79
- /* @__PURE__ */ jsxRuntime.jsx(HiddenText, { children })
80
- ] });
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
81
50
  }
82
- if (isExternalLink) {
83
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
84
- children,
85
- /* @__PURE__ */ jsxRuntime.jsx(Alert$1.ScreenReaderOnly, { id: "external-hint", children: `(${intlConfig.formatMessage({
86
- id: "c4r.button.opensInNewTab"
87
- })})` })
88
- ] });
51
+ },
52
+ ...width && {
53
+ ".MuiList-root": {
54
+ width,
55
+ minWidth: width
89
56
  }
90
- return children;
91
- };
92
- const getIconForPosition = (position) => {
93
- if (isDefaultLoading) {
94
- return void 0;
57
+ },
58
+ ...height && {
59
+ ".MuiMenu-paper": {
60
+ overflow: "hidden"
61
+ },
62
+ ".MuiList-root": {
63
+ maxHeight: height
95
64
  }
96
- if (loading && loadingPosition !== void 0) {
97
- if (loadingPosition === position) {
98
- return defaultIconLoader;
65
+ }
66
+ }));
67
+ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
68
+ return /* @__PURE__ */ jsxRuntime.jsx(
69
+ StyledMenu,
70
+ {
71
+ ...otherProps,
72
+ ref,
73
+ "data-name": "menu",
74
+ width,
75
+ height,
76
+ extended,
77
+ MenuListProps: {
78
+ ...MenuListProps,
79
+ "data-width": width,
80
+ "data-height": height,
81
+ "data-extended": extended
99
82
  }
100
- return void 0;
101
83
  }
102
- if (position === "start") {
103
- return startIcon;
104
- } else {
105
- return endIcon || (isExternalLink && showExternalIcon ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.OpenInNewOutlined, {}) : void 0);
84
+ );
85
+ }
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
106
93
  }
107
- };
94
+ },
95
+ "&.MuiList-root": {
96
+ ...width && {
97
+ width,
98
+ minWidth: width
99
+ },
100
+ ...height && {
101
+ maxHeight: height
102
+ }
103
+ }
104
+ }));
105
+ function _MenuList({ extended, width, height, ...otherProps }, ref) {
108
106
  return /* @__PURE__ */ jsxRuntime.jsx(
109
- material.Button,
107
+ StyledMenuList,
110
108
  {
111
- disabled: loading || disabled,
112
- startIcon: getIconForPosition("start"),
113
- endIcon: getIconForPosition("end"),
114
109
  ...otherProps,
115
- role: otherProps.href ? "link" : "button",
116
- ...isExternalLink && {
117
- target: "_blank",
118
- rel: "noopener noreferrer"
119
- },
120
110
  ref,
121
- "aria-describedby": isExternalLink ? "external-hint" : ariaDescribedby,
122
- children: /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
111
+ width,
112
+ height,
113
+ extended,
114
+ "data-name": "menu-list",
115
+ "data-width": width,
116
+ "data-height": height,
117
+ "data-extended": extended
123
118
  }
124
119
  );
125
120
  }
126
- const Button = React.forwardRef(_Button);
127
- const ButtonGroup = material.styled(material.ButtonGroup)(({ theme, size }) => ({
128
- "& .MuiButton-root:last-child": {
129
- padding: 0,
130
- minWidth: size === "small" ? theme.spacing(3) : size === "large" ? theme.spacing(6) : theme.spacing(4)
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);
184
+ const idCounter = {};
185
+ function uniqueId(prefix = "$lodash$") {
186
+ if (!idCounter[prefix]) {
187
+ idCounter[prefix] = 0;
188
+ }
189
+ const id = ++idCounter[prefix];
190
+ if (prefix === "$lodash$") {
191
+ return `${id}`;
192
+ }
193
+ return `${prefix}${id}`;
194
+ }
195
+ const StyledSelect = material.styled(material.Select)(({ theme }) => ({
196
+ "& .MuiInputAdornment-positionStart": {
197
+ paddingLeft: theme.spacing(2),
198
+ "&.MuiInputAdornment-sizeSmall": {
199
+ paddingLeft: theme.spacing(1.5)
200
+ }
201
+ },
202
+ "& .MuiInputBase-inputAdornedStart": {
203
+ paddingLeft: "0px !important"
204
+ },
205
+ "& .MuiSelect-select .MuiMenuItem-root:hover": {
206
+ backgroundColor: "transparent"
207
+ },
208
+ "&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple": {
209
+ paddingRight: theme.spacing(7)
131
210
  }
132
211
  }));
133
- function SplitButton({
134
- options,
212
+ const PlaceholderItem = material.styled(material.MenuItem)(() => ({
213
+ display: "none"
214
+ }));
215
+ function _SelectField({
216
+ children,
217
+ placeholder,
218
+ size = "small",
219
+ displayEmpty,
220
+ menuProps,
221
+ inputProps,
222
+ labelId,
223
+ label,
224
+ labelSecondary,
225
+ helperText,
226
+ name,
227
+ error,
228
+ focused,
135
229
  disabled,
136
- loading,
137
- loadingPosition,
138
- onClick,
139
- variant,
140
- size,
141
- color,
142
- ...otherProps
143
- }) {
144
- var _a;
145
- const [open, setOpen] = React.useState(false);
146
- const anchorRef = React.useRef(null);
147
- const [selectedIndex, setSelectedIndex] = React.useState(0);
148
- const handleClick = () => {
149
- onClick(options[selectedIndex]);
150
- };
151
- const handleMenuItemClick = (_, index) => {
152
- setSelectedIndex(index);
153
- setOpen(false);
154
- };
155
- const handleToggle = () => {
156
- setOpen((prevOpen) => !prevOpen);
157
- };
158
- const handleClose = (event) => {
159
- var _a2;
160
- if ((_a2 = anchorRef.current) == null ? void 0 : _a2.contains(event.target)) {
161
- return;
162
- }
163
- setOpen(false);
164
- };
165
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
166
- /* @__PURE__ */ jsxRuntime.jsxs(
167
- ButtonGroup,
168
- {
169
- "data-name": "split-button",
170
- ref: anchorRef,
171
- variant,
172
- size,
173
- color,
174
- ...otherProps,
175
- children: [
176
- /* @__PURE__ */ jsxRuntime.jsx(
177
- Button,
178
- {
179
- disabled,
180
- loading,
181
- loadingPosition,
182
- onClick: handleClick,
183
- children: (_a = options[selectedIndex]) == null ? void 0 : _a.label
184
- }
185
- ),
186
- /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: loading || disabled, onClick: handleToggle, children: open ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}) })
187
- ]
188
- }
189
- ),
190
- /* @__PURE__ */ jsxRuntime.jsx(
191
- material.Popper,
192
- {
193
- sx: { zIndex: 1 },
194
- open,
195
- anchorEl: anchorRef.current,
196
- role: void 0,
197
- transition: true,
198
- disablePortal: true,
199
- placement: "bottom-end",
200
- children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsxRuntime.jsx(
201
- material.Grow,
202
- {
203
- ...TransitionProps,
204
- style: {
205
- transformOrigin: placement === "bottom" ? "center top" : "center bottom"
206
- },
207
- 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(
208
- material.MenuItem,
209
- {
210
- disabled: option.disabled,
211
- selected: index === selectedIndex,
212
- onClick: (event) => handleMenuItemClick(event, index),
213
- children: option.label
214
- },
215
- option.label
216
- )) }) }) })
217
- }
218
- )
219
- }
220
- )
221
- ] });
222
- }
223
- const Root$5 = material.styled(material.Box)(({ theme }) => ({
224
- display: "flex",
225
- alignItems: "center",
226
- gap: theme.spacing(0.5)
227
- }));
228
- const Indicator = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
229
- ".Mui-disabled &": {
230
- color: theme.palette.text.disabled
231
- }
232
- }));
233
- const Icon = material.styled(material.Box)(({ theme }) => ({
234
- display: "flex",
235
- svg: {
236
- width: TablePaginationActions.ICON_SIZE_SMALL,
237
- height: TablePaginationActions.ICON_SIZE_SMALL,
238
- fontSize: TablePaginationActions.ICON_SIZE_SMALL,
239
- path: {
240
- fill: theme.palette.text.secondary,
241
- ".Mui-disabled &": {
242
- fill: theme.palette.text.disabled
243
- }
244
- }
245
- }
246
- }));
247
- function LabelWithIndicator({
248
- label,
249
- type,
250
- icon,
251
- inheritSize
252
- }) {
253
- return /* @__PURE__ */ jsxRuntime.jsxs(Root$5, { children: [
254
- label,
255
- type && /* @__PURE__ */ jsxRuntime.jsx(
256
- Indicator,
257
- {
258
- component: "span",
259
- variant: inheritSize ? "inherit" : "caption",
260
- color: "textSecondary",
261
- weight: "regular",
262
- children: type === "required" ? "(required)" : "(optional)"
263
- }
264
- ),
265
- icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon })
266
- ] });
267
- }
268
- function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
269
- const intl = reactIntl.useIntl();
270
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
271
- const [showPassword, setShowPassword] = React.useState(false);
272
- const handleClickShowPassword = () => setShowPassword(!showPassword);
273
- return /* @__PURE__ */ jsxRuntime.jsx(
274
- material.TextField,
275
- {
276
- ...otherProps,
277
- ref,
278
- type: showPassword ? "text" : "password",
279
- size,
280
- InputProps: {
281
- ...InputProps,
282
- endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsxRuntime.jsx(
283
- material.Tooltip,
284
- {
285
- title: intlConfig.formatMessage({
286
- id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
287
- }),
288
- children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {})
289
- }
290
- ) }) })
291
- }
292
- }
293
- );
294
- }
295
- const PasswordField = React.forwardRef(_PasswordField);
296
- const idCounter = {};
297
- function uniqueId(prefix = "$lodash$") {
298
- if (!idCounter[prefix]) {
299
- idCounter[prefix] = 0;
300
- }
301
- const id = ++idCounter[prefix];
302
- if (prefix === "$lodash$") {
303
- return `${id}`;
304
- }
305
- return `${prefix}${id}`;
306
- }
307
- const StyledSelect = material.styled(material.Select)(({ theme }) => ({
308
- "& .MuiInputAdornment-positionStart": {
309
- paddingLeft: theme.spacing(2),
310
- "&.MuiInputAdornment-sizeSmall": {
311
- paddingLeft: theme.spacing(1.5)
312
- }
313
- },
314
- "& .MuiInputBase-inputAdornedStart": {
315
- paddingLeft: "0px !important"
316
- },
317
- "& .MuiSelect-select .MuiMenuItem-root:hover": {
318
- backgroundColor: "transparent"
319
- },
320
- "&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple": {
321
- paddingRight: theme.spacing(7)
322
- }
323
- }));
324
- const PlaceholderItem = material.styled(material.MenuItem)(() => ({
325
- display: "none"
326
- }));
327
- function _SelectField({
328
- children,
329
- placeholder,
330
- size = "small",
331
- displayEmpty,
332
- menuProps,
333
- inputProps,
334
- labelId,
335
- label,
336
- labelSecondary,
337
- helperText,
338
- name,
339
- error,
340
- focused,
341
- disabled,
342
- fullWidth,
343
- required,
344
- "aria-label": ariaLabel,
230
+ fullWidth,
231
+ required,
232
+ "aria-label": ariaLabel,
345
233
  ...otherProps
346
234
  }, ref) {
347
235
  const isSmall = size === "small";
@@ -411,269 +299,39 @@ function _SelectField({
411
299
  );
412
300
  }
413
301
  const SelectField = React.forwardRef(_SelectField);
414
- const StyledToggleButtonGroup = material.styled(material.ToggleButtonGroup, {
415
- shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
416
- })(({ variant, backgroundColor, theme }) => ({
417
- // Variants
418
- ...variant === "contained" && {
419
- boxShadow: "none"
420
- },
421
- ...variant === "unbounded" && {
422
- boxShadow: "none",
423
- borderRadius: theme.spacing(0.5),
424
- "& .MuiDivider-root": {
425
- height: theme.spacing(4),
426
- "&.MuiToggleButtonGroup-groupedHorizontal": {
427
- height: theme.spacing(4)
428
- },
429
- "&.MuiToggleButtonGroup-groupedVertical": {
430
- height: "auto",
431
- width: theme.spacing(4),
432
- margin: `${theme.spacing(0.5, 0, 1)} !important`,
433
- borderRadius: "0 !important"
434
- }
435
- },
436
- "& .MuiToggleButton-sizeSmall": {
437
- margin: 0,
438
- "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
439
- margin: 0
440
- },
441
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
442
- height: theme.spacing(3)
443
- },
444
- "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
445
- height: "auto",
446
- width: theme.spacing(3)
447
- }
448
- },
449
- ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
450
- margin: 0,
451
- "&:first-of-type": {
452
- marginLeft: 0
453
- },
454
- "&:not(:last-of-type)": {
455
- marginRight: theme.spacing(0.5)
456
- }
457
- },
458
- "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
459
- ".MuiToggleButtonGroup-grouped": {
460
- margin: theme.spacing(0, 0.5)
461
- }
462
- },
463
- "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
464
- ".MuiToggleButtonGroup-grouped": {
465
- margin: theme.spacing(0, 0, 0.5),
466
- "&:not(:last-of-type)": {
467
- marginRight: 0
468
- },
469
- "&:last-of-type": {
470
- marginBottom: 0
471
- }
472
- }
473
- }
474
- },
475
- // Colors
476
- ...backgroundColor === "primary" && {
477
- backgroundColor: theme.palette.background.paper
478
- },
479
- ...backgroundColor === "secondary" && {
480
- backgroundColor: theme.palette.background.default
481
- },
482
- ...backgroundColor === "transparent" && {
483
- backgroundColor: "transparent"
484
- }
485
- }));
486
- function ToggleButtonGroup({
487
- children,
488
- variant = "floating",
489
- backgroundColor,
490
- ...rest
491
- }) {
492
- const isUnbounded = variant === "unbounded";
493
- const defaultColor = isUnbounded ? "transparent" : "primary";
494
- return /* @__PURE__ */ jsxRuntime.jsx(
495
- StyledToggleButtonGroup,
496
- {
497
- ...rest,
498
- variant,
499
- backgroundColor: backgroundColor ?? defaultColor,
500
- children
501
- }
502
- );
503
- }
504
- const StyledMenu = material.styled(material.Menu, {
505
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
506
- })(({ extended, width, height }) => ({
507
- ...extended && {
508
- ".MuiMenuItem-root": {
509
- minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
510
- }
511
- },
512
- ...width && {
513
- ".MuiList-root": {
514
- width,
515
- minWidth: width
516
- }
517
- },
518
- ...height && {
519
- ".MuiMenu-paper": {
520
- overflow: "hidden"
521
- },
522
- ".MuiList-root": {
523
- maxHeight: height
524
- }
525
- }
526
- }));
527
- function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
528
- return /* @__PURE__ */ jsxRuntime.jsx(
529
- StyledMenu,
530
- {
531
- ...otherProps,
532
- ref,
533
- "data-name": "menu",
534
- width,
535
- height,
536
- extended,
537
- MenuListProps: {
538
- ...MenuListProps,
539
- "data-width": width,
540
- "data-height": height,
541
- "data-extended": extended
542
- }
543
- }
544
- );
545
- }
546
- const Menu$1 = React.forwardRef(_Menu);
547
- const StyledMenuList = material.styled(material.MenuList, {
548
- shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
549
- })(({ extended, width, height }) => ({
550
- ...extended && {
551
- ".MuiMenuItem-root": {
552
- minHeight: TablePaginationActions.MENU_ITEM_SIZE_EXTENDED
553
- }
554
- },
555
- "&.MuiList-root": {
556
- ...width && {
557
- width,
558
- minWidth: width
559
- },
560
- ...height && {
561
- maxHeight: height
562
- }
563
- }
564
- }));
565
- function _MenuList({ extended, width, height, ...otherProps }, ref) {
566
- return /* @__PURE__ */ jsxRuntime.jsx(
567
- StyledMenuList,
568
- {
569
- ...otherProps,
570
- ref,
571
- width,
572
- height,
573
- extended,
574
- "data-name": "menu-list",
575
- "data-width": width,
576
- "data-height": height,
577
- "data-extended": extended
578
- }
579
- );
580
- }
581
- const MenuList = React.forwardRef(_MenuList);
582
- const StyledMenuItem$1 = material.styled(MenuItem.MenuItem)(() => ({
583
- marginTop: "0 !important",
584
- marginBottom: "0 !important"
585
- }));
586
- const LinkFilter = material.styled(material.Link)(
587
- ({ disabled, theme }) => ({
588
- display: "flex",
589
- alignItems: "center",
590
- gap: theme.spacing(1),
591
- width: "100%",
592
- textAlign: "initial",
593
- ...disabled && {
594
- pointerEvents: "none",
595
- color: theme.palette.text.disabled
596
- }
597
- })
598
- );
599
- function _MenuItemFilter({
600
- areAllSelected,
601
- areAnySelected,
602
- selectAll,
603
- selectAllDisabled,
604
- "aria-label": ariaLabel,
605
- "data-testid": dataTestId
606
- }, ref) {
607
- const intl = reactIntl.useIntl();
608
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
609
- return /* @__PURE__ */ jsxRuntime.jsx(
610
- StyledMenuItem$1,
611
- {
612
- ref,
613
- fixed: true,
614
- "data-name": "menu-filter",
615
- "aria-label": ariaLabel,
616
- "data-testid": dataTestId,
617
- children: /* @__PURE__ */ jsxRuntime.jsxs(
618
- LinkFilter,
619
- {
620
- variant: "body2",
621
- color: "textPrimary",
622
- component: "button",
623
- underline: "none",
624
- disabled: !!selectAllDisabled,
625
- onClick: selectAll,
626
- tabIndex: 0,
627
- children: [
628
- /* @__PURE__ */ jsxRuntime.jsx(
629
- material.Checkbox,
630
- {
631
- checked: areAllSelected,
632
- indeterminate: areAnySelected && !areAllSelected,
633
- disabled: selectAllDisabled
634
- }
635
- ),
636
- intlConfig.formatMessage({ id: "c4r.form.selectAll" })
637
- ]
638
- }
639
- )
640
- }
641
- );
642
- }
643
- const MenuItemFilter = React.forwardRef(_MenuItemFilter);
644
- function useMultipleSelectField({
645
- selectedOptions,
646
- options,
647
- onChange
648
- }) {
649
- const [currentOptions, setCurrentOptions] = React.useState(selectedOptions ?? []);
650
- const areAllSelected = options.length === currentOptions.length;
651
- const areAnySelected = currentOptions.length > 0;
652
- React.useEffect(() => {
653
- if (currentOptions !== selectedOptions) {
654
- setCurrentOptions(currentOptions);
655
- }
656
- }, [selectedOptions]);
657
- const handleChange = (event) => {
658
- const {
659
- target: { value }
660
- } = event;
661
- const options2 = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
662
- setCurrentOptions(options2);
663
- onChange(options2);
664
- };
665
- const selectAll = () => {
666
- const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
667
- if (optionsValues) {
668
- const allSelected = optionsValues.every(
669
- (value) => currentOptions.includes(value)
670
- );
671
- if (allSelected) {
672
- setCurrentOptions([]);
673
- onChange([]);
674
- } else {
675
- setCurrentOptions(optionsValues);
676
- onChange(optionsValues);
302
+ function useMultipleSelectField({
303
+ selectedOptions,
304
+ options,
305
+ onChange
306
+ }) {
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);
313
+ }
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);
677
335
  }
678
336
  }
679
337
  };
@@ -1859,96 +1517,6 @@ function useAutocomplete({
1859
1517
  getOptionLabel: internalGetOptionLabel
1860
1518
  };
1861
1519
  }
1862
- const _CopiableComponent = ({
1863
- children,
1864
- disabled,
1865
- value,
1866
- onCopied,
1867
- copyText = "c4r.button.copy",
1868
- copiedText = "c4r.notifications.copiedToClipboard",
1869
- button,
1870
- buttonLabel,
1871
- buttonProps,
1872
- ariaLabel,
1873
- dataTestId,
1874
- tooltipPlacement = "top",
1875
- ...props
1876
- }, ref) => {
1877
- const intl = reactIntl.useIntl();
1878
- const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1879
- const [open, setOpen] = React.useState(false);
1880
- const { copy } = useCopyValue(copyText, copiedText);
1881
- const handleClick = (e) => {
1882
- e.preventDefault();
1883
- copy(value).then(() => {
1884
- onCopied == null ? void 0 : onCopied();
1885
- setOpen(true);
1886
- }).catch(console.error);
1887
- };
1888
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1889
- /* @__PURE__ */ jsxRuntime.jsx(
1890
- material.Tooltip,
1891
- {
1892
- title: intlConfig.formatMessage({ id: copyText }),
1893
- leaveDelay: 0,
1894
- placement: tooltipPlacement,
1895
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1896
- material.Box,
1897
- {
1898
- ...props,
1899
- sx: { cursor: disabled ? void 0 : "pointer" },
1900
- onClick: handleClick,
1901
- "data-name": "copiable",
1902
- ref,
1903
- children: [
1904
- children,
1905
- button && /* @__PURE__ */ jsxRuntime.jsx(
1906
- Alert$1.IconButton,
1907
- {
1908
- ...buttonProps,
1909
- disabled,
1910
- icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}),
1911
- "data-testid": dataTestId,
1912
- "aria-label": ariaLabel || buttonLabel,
1913
- sx: {
1914
- display: "flex"
1915
- }
1916
- }
1917
- )
1918
- ]
1919
- }
1920
- )
1921
- }
1922
- ),
1923
- /* @__PURE__ */ jsxRuntime.jsx(
1924
- Snackbar,
1925
- {
1926
- open,
1927
- autoWidth: true,
1928
- closeable: false,
1929
- autoHideDuration: 4e3,
1930
- onClose: () => setOpen(false),
1931
- children: intlConfig.formatMessage({ id: copiedText })
1932
- }
1933
- )
1934
- ] });
1935
- };
1936
- const CopiableComponent = React.forwardRef(_CopiableComponent);
1937
- async function copyString(value) {
1938
- return await navigator.clipboard.writeText(value);
1939
- }
1940
- const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
1941
- const [message, setMessage] = React.useState(msg);
1942
- const copy = async (text) => {
1943
- await copyString(text);
1944
- setMessage(copiedMsg);
1945
- setTimeout(() => setMessage(msg), 1e3);
1946
- };
1947
- return {
1948
- message,
1949
- copy
1950
- };
1951
- };
1952
1520
  const AccordionContainer = material.styled("div", {
1953
1521
  shouldForwardProp: (prop) => prop !== "variant"
1954
1522
  })(({ variant, theme }) => ({
@@ -2048,7 +1616,7 @@ const Content$4 = material.styled(material.Box, {
2048
1616
  }
2049
1617
  }
2050
1618
  }));
2051
- const Alert = material.styled(Alert$1.Alert, {
1619
+ const Alert = material.styled(Link.Alert, {
2052
1620
  shouldForwardProp: (prop) => !["hasActions", "closeable"].includes(prop)
2053
1621
  })(({ hasActions, closeable, icon, theme }) => ({
2054
1622
  position: "relative",
@@ -2162,7 +1730,7 @@ function Snackbar({
2162
1730
  }
2163
1731
  ),
2164
1732
  closeable && /* @__PURE__ */ jsxRuntime.jsx(CloseButtonWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
2165
- Alert$1.IconButton,
1733
+ Link.IconButton,
2166
1734
  {
2167
1735
  color: "default",
2168
1736
  onClick: (e) => onClose(e, "timeout"),
@@ -2267,106 +1835,625 @@ function colorProps(color, variant, theme, disabled) {
2267
1835
  borderColor: theme.palette.error.main
2268
1836
  };
2269
1837
  }
2270
- return {
2271
- color: theme.palette.primary.contrastText,
2272
- backgroundColor: theme.palette.error.main,
2273
- borderColor: "transparent"
2274
- };
2275
- }
1838
+ return {
1839
+ color: theme.palette.primary.contrastText,
1840
+ backgroundColor: theme.palette.error.main,
1841
+ borderColor: "transparent"
1842
+ };
1843
+ }
1844
+ }
1845
+ const TagRoot = material.styled("div", {
1846
+ shouldForwardProp: (prop) => !["color", "variant", "disabled"].includes(prop)
1847
+ })(({
1848
+ color,
1849
+ variant,
1850
+ disabled,
1851
+ theme
1852
+ }) => {
1853
+ return {
1854
+ display: "inline-flex",
1855
+ flexDirection: "row",
1856
+ flexWrap: "nowrap",
1857
+ alignItems: "center",
1858
+ padding: theme.spacing(0, 0.5),
1859
+ borderRadius: theme.spacing(0.25),
1860
+ gap: theme.spacing(0.5),
1861
+ height: theme.spacing(2),
1862
+ borderWidth: "1px",
1863
+ borderStyle: "solid",
1864
+ ...colorProps(color ?? "primary", variant ?? "filled", theme, disabled),
1865
+ '.Mui-selected &, [aria-selected="true"] &': {
1866
+ borderColor: theme.palette.primary.main,
1867
+ backgroundColor: theme.palette.primary.background,
1868
+ ".MuiTypography-root": {
1869
+ color: theme.palette.primary.main
1870
+ }
1871
+ }
1872
+ };
1873
+ });
1874
+ const TagIcon = material.styled("div")(({ theme }) => ({
1875
+ display: "flex",
1876
+ justifyContent: "center",
1877
+ alignItems: "center",
1878
+ "& svg": {
1879
+ width: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
1880
+ height: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
1881
+ "& g": {
1882
+ fill: "currentColor"
1883
+ }
1884
+ }
1885
+ }));
1886
+ const TagLabel = material.styled("div", {
1887
+ shouldForwardProp: (prop) => !["type"].includes(prop)
1888
+ })(({ type, theme }) => ({
1889
+ display: "flex",
1890
+ alignItems: "center",
1891
+ paddingTop: type === "code" ? theme.spacing(0.25) : void 0
1892
+ }));
1893
+ function _Tag({
1894
+ label,
1895
+ color = "primary",
1896
+ variant = "filled",
1897
+ icon,
1898
+ type = "default",
1899
+ typographyProps,
1900
+ noWrap = true,
1901
+ disabled,
1902
+ ...otherProps
1903
+ }, ref) {
1904
+ const typeCode = type === "code";
1905
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1906
+ TagRoot,
1907
+ {
1908
+ ref,
1909
+ className: "CartoTag-root",
1910
+ color,
1911
+ variant,
1912
+ disabled,
1913
+ "aria-disabled": disabled,
1914
+ "data-color": color,
1915
+ "data-variant": variant,
1916
+ "data-type": type,
1917
+ "data-name": "tag",
1918
+ ...otherProps,
1919
+ children: [
1920
+ icon && /* @__PURE__ */ jsxRuntime.jsx(TagIcon, { children: icon }),
1921
+ /* @__PURE__ */ jsxRuntime.jsx(TagLabel, { type, children: /* @__PURE__ */ jsxRuntime.jsx(
1922
+ TablePaginationActions.Typography,
1923
+ {
1924
+ component: "span",
1925
+ color: "inherit",
1926
+ variant: typeCode ? "code3" : "caption",
1927
+ weight: typeCode ? "strong" : "medium",
1928
+ noWrap,
1929
+ ...typographyProps,
1930
+ children: label
1931
+ }
1932
+ ) })
1933
+ ]
1934
+ }
1935
+ );
1936
+ }
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
+ ] });
2276
2293
  }
2277
- const TagRoot = material.styled("div", {
2278
- shouldForwardProp: (prop) => !["color", "variant", "disabled"].includes(prop)
2279
- })(({
2280
- color,
2281
- variant,
2282
- disabled,
2283
- theme
2284
- }) => {
2285
- return {
2286
- display: "inline-flex",
2287
- flexDirection: "row",
2288
- flexWrap: "nowrap",
2289
- alignItems: "center",
2290
- padding: theme.spacing(0, 0.5),
2291
- borderRadius: theme.spacing(0.25),
2292
- gap: theme.spacing(0.5),
2293
- height: theme.spacing(2),
2294
- borderWidth: "1px",
2295
- borderStyle: "solid",
2296
- ...colorProps(color ?? "primary", variant ?? "filled", theme, disabled),
2297
- '.Mui-selected &, [aria-selected="true"] &': {
2298
- borderColor: theme.palette.primary.main,
2299
- backgroundColor: theme.palette.primary.background,
2300
- ".MuiTypography-root": {
2301
- color: theme.palette.primary.main
2302
- }
2303
- }
2304
- };
2305
- });
2306
- const TagIcon = material.styled("div")(({ theme }) => ({
2294
+ const Root$5 = material.styled(material.Box)(({ theme }) => ({
2307
2295
  display: "flex",
2308
- justifyContent: "center",
2309
2296
  alignItems: "center",
2310
- "& svg": {
2311
- width: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
2312
- height: theme.spacing(TablePaginationActions.ICON_SIZE_SMALL),
2313
- "& g": {
2314
- fill: "currentColor"
2315
- }
2297
+ gap: theme.spacing(0.5)
2298
+ }));
2299
+ const Indicator = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
2300
+ ".Mui-disabled &": {
2301
+ color: theme.palette.text.disabled
2316
2302
  }
2317
2303
  }));
2318
- const TagLabel = material.styled("div", {
2319
- shouldForwardProp: (prop) => !["type"].includes(prop)
2320
- })(({ type, theme }) => ({
2304
+ const Icon = material.styled(material.Box)(({ theme }) => ({
2321
2305
  display: "flex",
2322
- alignItems: "center",
2323
- paddingTop: type === "code" ? theme.spacing(0.25) : void 0
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
+ }
2324
2317
  }));
2325
- function _Tag({
2318
+ function LabelWithIndicator({
2326
2319
  label,
2327
- color = "primary",
2328
- variant = "filled",
2320
+ type,
2329
2321
  icon,
2330
- type = "default",
2331
- typographyProps,
2332
- noWrap = true,
2333
- disabled,
2334
- ...otherProps
2335
- }, ref) {
2336
- const typeCode = type === "code";
2337
- return /* @__PURE__ */ jsxRuntime.jsxs(
2338
- TagRoot,
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,
2339
2346
  {
2340
- ref,
2341
- className: "CartoTag-root",
2342
- color,
2343
- variant,
2344
- disabled,
2345
- "aria-disabled": disabled,
2346
- "data-color": color,
2347
- "data-variant": variant,
2348
- "data-type": type,
2349
- "data-name": "tag",
2350
2347
  ...otherProps,
2351
- children: [
2352
- icon && /* @__PURE__ */ jsxRuntime.jsx(TagIcon, { children: icon }),
2353
- /* @__PURE__ */ jsxRuntime.jsx(TagLabel, { type, children: /* @__PURE__ */ jsxRuntime.jsx(
2354
- TablePaginationActions.Typography,
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
2355
  {
2356
- component: "span",
2357
- color: "inherit",
2358
- variant: typeCode ? "code3" : "caption",
2359
- weight: typeCode ? "strong" : "medium",
2360
- noWrap,
2361
- ...typographyProps,
2362
- children: label
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, {})
2363
2360
  }
2364
- ) })
2365
- ]
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
2366
2454
  }
2367
2455
  );
2368
2456
  }
2369
- const Tag = React.forwardRef(_Tag);
2370
2457
  const Menu = material.styled("div")(({ theme }) => ({
2371
2458
  display: "flex",
2372
2459
  alignItems: "center",
@@ -3412,7 +3499,7 @@ function CodeAreaHeader({
3412
3499
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3413
3500
  /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
3414
3501
  /* @__PURE__ */ jsxRuntime.jsx(
3415
- Alert$1.IconButton,
3502
+ Link.IconButton,
3416
3503
  {
3417
3504
  color: "default",
3418
3505
  size,
@@ -3476,7 +3563,7 @@ function CodeAreaHeader({
3476
3563
  }
3477
3564
  ),
3478
3565
  showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
3479
- Alert$1.IconButton,
3566
+ Link.IconButton,
3480
3567
  {
3481
3568
  color: "default",
3482
3569
  size,
@@ -4648,7 +4735,7 @@ const DialogContentPadded = material.styled(DialogContent, {
4648
4735
  paddingBottom: `${theme.spacing(3)} !important`
4649
4736
  }
4650
4737
  }));
4651
- const StyledAlert = material.styled(Alert$1.Alert)(({ theme }) => ({
4738
+ const StyledAlert = material.styled(Link.Alert)(({ theme }) => ({
4652
4739
  minHeight: "auto",
4653
4740
  padding: 0,
4654
4741
  backgroundColor: "transparent",
@@ -5080,10 +5167,10 @@ function CodeAreaDialog({
5080
5167
  }
5081
5168
  exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
5082
5169
  exports.Typography = TablePaginationActions.Typography;
5083
- exports.Alert = Alert$1.Alert;
5084
- exports.IconButton = Alert$1.IconButton;
5085
- exports.Link = Alert$1.Link;
5086
- exports.ScreenReaderOnly = Alert$1.ScreenReaderOnly;
5170
+ exports.Alert = Link.Alert;
5171
+ exports.IconButton = Link.IconButton;
5172
+ exports.Link = Link.Link;
5173
+ exports.ScreenReaderOnly = Link.ScreenReaderOnly;
5087
5174
  exports.MenuItem = MenuItem.MenuItem;
5088
5175
  exports.AUTOCOMPLETE_GROUP_HEADER_PROPERTY = AUTOCOMPLETE_GROUP_HEADER_PROPERTY;
5089
5176
  exports.AccordionGroup = AccordionGroup;
@@ -5102,6 +5189,7 @@ exports.CodeAreaHeader = CodeAreaHeader;
5102
5189
  exports.CodeAreaInput = CodeAreaInput;
5103
5190
  exports.CodeAreaMarkTextPattern = CodeAreaMarkTextPattern;
5104
5191
  exports.CopiableComponent = CopiableComponent;
5192
+ exports.CopiableInputText = CopiableInputText;
5105
5193
  exports.CreatableAutocomplete = CreatableAutocomplete;
5106
5194
  exports.DatePicker = DatePicker;
5107
5195
  exports.DateRangePicker = DateRangePicker;