@carto/meridian-ds 1.4.5-alpha-external-link.1 → 1.4.5-alpha-external-link.3

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 (32) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/{Alert-D8jI1sG4.js → Alert-CETC14v2.js} +89 -3
  3. package/dist/{Alert-zqtoWsBL.cjs → Alert-hun6016k.cjs} +88 -2
  4. package/dist/{TablePaginationActions-CFGXm44W.cjs → TablePaginationActions-CAmwcyTy.cjs} +6 -3
  5. package/dist/{TablePaginationActions-KpTvhN4Y.js → TablePaginationActions-b5wP_uRE.js} +6 -3
  6. package/dist/components/index.cjs +19 -100
  7. package/dist/components/index.js +31 -112
  8. package/dist/theme/index.cjs +1 -1
  9. package/dist/theme/index.js +2 -2
  10. package/dist/types/components/atoms/ExternalLink.d.ts +1 -1
  11. package/dist/types/components/atoms/ExternalLink.d.ts.map +1 -1
  12. package/dist/types/components/atoms/Link.d.ts +4 -0
  13. package/dist/types/components/atoms/Link.d.ts.map +1 -0
  14. package/dist/types/components/atoms/index.d.ts +2 -0
  15. package/dist/types/components/atoms/index.d.ts.map +1 -1
  16. package/dist/types/localization/en.d.ts +1 -0
  17. package/dist/types/localization/en.d.ts.map +1 -1
  18. package/dist/types/localization/es.d.ts +1 -0
  19. package/dist/types/localization/es.d.ts.map +1 -1
  20. package/dist/types/localization/id.d.ts +1 -0
  21. package/dist/types/localization/id.d.ts.map +1 -1
  22. package/dist/types/localization/index.d.ts +3 -0
  23. package/dist/types/localization/index.d.ts.map +1 -1
  24. package/dist/types/theme/types.d.ts +6 -0
  25. package/dist/types/theme/types.d.ts.map +1 -1
  26. package/dist/types/widgets/CategoryWidgetUI/CategoryWidgetUI.styled.d.ts +1 -1
  27. package/dist/types/widgets/CategoryWidgetUI/CategoryWidgetUI.styled.d.ts.map +1 -1
  28. package/dist/types/widgets/ChartLegend.d.ts.map +1 -1
  29. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/ComparativeCategoryWidgetUI.d.ts.map +1 -1
  30. package/dist/widgets/index.cjs +23 -31
  31. package/dist/widgets/index.js +34 -42
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,7 @@
3
3
  ## Unreleased
4
4
 
5
5
  - New Link and ExternalLink components [#202](https://github.com/CartoDB/meridian-ds/pull/202)
6
+ - Fix tooltips in ChartLegend pagination buttons [201](https://github.com/CartoDB/meridian-ds/pull/201)
6
7
 
7
8
  ## 1.0
8
9
 
@@ -1,7 +1,91 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { b as ICON_SIZE_MEDIUM, T as Typography } from "./TablePaginationActions-KpTvhN4Y.js";
3
- import { styled, Alert as Alert$1, Fade, AlertTitle } from "@mui/material";
4
2
  import { forwardRef, useState } from "react";
3
+ import { styled, IconButton as IconButton$1, Tooltip, CircularProgress, Box, Link as Link$1, Alert as Alert$1, Fade, AlertTitle } from "@mui/material";
4
+ import { b as ICON_SIZE_MEDIUM, T as Typography } from "./TablePaginationActions-b5wP_uRE.js";
5
+ const Option = styled("div")(({ theme }) => ({
6
+ position: "relative",
7
+ display: "inline-flex",
8
+ // TODO: Remove this once we have a better way to handle the spacing between icon buttons:
9
+ // https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
10
+ "& + &, & + .optionIconButton": {
11
+ marginLeft: theme.spacing(0.5)
12
+ }
13
+ }));
14
+ const StyledIconButton = styled(IconButton$1, {
15
+ shouldForwardProp: (prop) => !["active"].includes(prop)
16
+ })(({ active, theme }) => ({
17
+ ...active && {
18
+ color: theme.palette.primary.main,
19
+ backgroundColor: theme.palette.primary.background,
20
+ "& svg:not(.doNotFillIcon) path": {
21
+ fill: theme.palette.primary.main
22
+ }
23
+ }
24
+ }));
25
+ function _IconButton({
26
+ tooltip,
27
+ tooltipPlacement = "top",
28
+ icon,
29
+ size = "medium",
30
+ variant = "icon",
31
+ color = "default",
32
+ sx,
33
+ className,
34
+ loading,
35
+ disabled,
36
+ active,
37
+ ...props
38
+ }, ref) {
39
+ return /* @__PURE__ */ jsx(Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsx(
40
+ Option,
41
+ {
42
+ className: `optionIconButton ${className ?? ""}`,
43
+ sx,
44
+ "data-testid": "icon-button",
45
+ children: /* @__PURE__ */ jsx(
46
+ StyledIconButton,
47
+ {
48
+ ...props,
49
+ ref,
50
+ size,
51
+ variant,
52
+ color,
53
+ active,
54
+ disabled: disabled || loading,
55
+ role: "button",
56
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" }) : icon
57
+ }
58
+ )
59
+ }
60
+ ) });
61
+ }
62
+ const IconButton = forwardRef(_IconButton);
63
+ const Icon = styled(Box)(({ theme }) => ({
64
+ position: "relative",
65
+ display: "inline-block",
66
+ margin: theme.spacing(0, 0.25),
67
+ top: "calc(1em * 5.0/32)"
68
+ // heuristic to align icon with true perceived baseline
69
+ }));
70
+ function _Link({ children, startIcon, endIcon, color, ...otherProps }, ref) {
71
+ return /* @__PURE__ */ jsxs(
72
+ Link$1,
73
+ {
74
+ ...otherProps,
75
+ "data-color": color,
76
+ "data-name": "link",
77
+ role: "link",
78
+ color,
79
+ ref,
80
+ children: [
81
+ startIcon && /* @__PURE__ */ jsx(Icon, { children: startIcon }),
82
+ children,
83
+ endIcon && /* @__PURE__ */ jsx(Icon, { children: endIcon })
84
+ ]
85
+ }
86
+ );
87
+ }
88
+ const Link = forwardRef(_Link);
5
89
  const StyledAlert = styled(Alert$1, {
6
90
  shouldForwardProp: (prop) => ![
7
91
  "isNeutral",
@@ -130,5 +214,7 @@ function _Alert({
130
214
  }
131
215
  const Alert = forwardRef(_Alert);
132
216
  export {
133
- Alert as A
217
+ Alert as A,
218
+ IconButton as I,
219
+ Link as L
134
220
  };
@@ -1,8 +1,92 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const TablePaginationActions = require("./TablePaginationActions-CFGXm44W.cjs");
4
- const material = require("@mui/material");
5
3
  const React = require("react");
4
+ const material = require("@mui/material");
5
+ const TablePaginationActions = require("./TablePaginationActions-CAmwcyTy.cjs");
6
+ const Option = material.styled("div")(({ theme }) => ({
7
+ position: "relative",
8
+ display: "inline-flex",
9
+ // TODO: Remove this once we have a better way to handle the spacing between icon buttons:
10
+ // https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
11
+ "& + &, & + .optionIconButton": {
12
+ marginLeft: theme.spacing(0.5)
13
+ }
14
+ }));
15
+ const StyledIconButton = material.styled(material.IconButton, {
16
+ shouldForwardProp: (prop) => !["active"].includes(prop)
17
+ })(({ active, theme }) => ({
18
+ ...active && {
19
+ color: theme.palette.primary.main,
20
+ backgroundColor: theme.palette.primary.background,
21
+ "& svg:not(.doNotFillIcon) path": {
22
+ fill: theme.palette.primary.main
23
+ }
24
+ }
25
+ }));
26
+ function _IconButton({
27
+ tooltip,
28
+ tooltipPlacement = "top",
29
+ icon,
30
+ size = "medium",
31
+ variant = "icon",
32
+ color = "default",
33
+ sx,
34
+ className,
35
+ loading,
36
+ disabled,
37
+ active,
38
+ ...props
39
+ }, ref) {
40
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsxRuntime.jsx(
41
+ Option,
42
+ {
43
+ className: `optionIconButton ${className ?? ""}`,
44
+ sx,
45
+ "data-testid": "icon-button",
46
+ children: /* @__PURE__ */ jsxRuntime.jsx(
47
+ StyledIconButton,
48
+ {
49
+ ...props,
50
+ ref,
51
+ size,
52
+ variant,
53
+ color,
54
+ active,
55
+ disabled: disabled || loading,
56
+ role: "button",
57
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : icon
58
+ }
59
+ )
60
+ }
61
+ ) });
62
+ }
63
+ const IconButton = React.forwardRef(_IconButton);
64
+ const Icon = material.styled(material.Box)(({ theme }) => ({
65
+ position: "relative",
66
+ display: "inline-block",
67
+ margin: theme.spacing(0, 0.25),
68
+ top: "calc(1em * 5.0/32)"
69
+ // heuristic to align icon with true perceived baseline
70
+ }));
71
+ function _Link({ children, startIcon, endIcon, color, ...otherProps }, ref) {
72
+ return /* @__PURE__ */ jsxRuntime.jsxs(
73
+ material.Link,
74
+ {
75
+ ...otherProps,
76
+ "data-color": color,
77
+ "data-name": "link",
78
+ role: "link",
79
+ color,
80
+ ref,
81
+ children: [
82
+ startIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: startIcon }),
83
+ children,
84
+ endIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: endIcon })
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ const Link = React.forwardRef(_Link);
6
90
  const StyledAlert = material.styled(material.Alert, {
7
91
  shouldForwardProp: (prop) => ![
8
92
  "isNeutral",
@@ -131,3 +215,5 @@ function _Alert({
131
215
  }
132
216
  const Alert = React.forwardRef(_Alert);
133
217
  exports.Alert = Alert;
218
+ exports.IconButton = IconButton;
219
+ exports.Link = Link;
@@ -814,7 +814,8 @@ const en = {
814
814
  copy: "Copy",
815
815
  save: "Save",
816
816
  add: "Add",
817
- showOptions: "Show options"
817
+ showOptions: "Show options",
818
+ opensInNewTab: "Opens in new tab"
818
819
  },
819
820
  form: {
820
821
  selectAll: "Select all",
@@ -962,7 +963,8 @@ const es = {
962
963
  copy: "Copiar",
963
964
  save: "Guardar",
964
965
  add: "Añadir",
965
- showOptions: "Mostrar opciones"
966
+ showOptions: "Mostrar opciones",
967
+ opensInNewTab: "Abre en una nueva pestaña"
966
968
  },
967
969
  form: {
968
970
  selectAll: "Seleccionar todos",
@@ -1108,7 +1110,8 @@ const id = {
1108
1110
  copy: "Salin",
1109
1111
  save: "Simpan",
1110
1112
  add: "Tambah",
1111
- showOptions: "Tampilkan opsi"
1113
+ showOptions: "Tampilkan opsi",
1114
+ opensInNewTab: "Buka di tab baru"
1112
1115
  },
1113
1116
  form: {
1114
1117
  selectAll: "Select all",
@@ -813,7 +813,8 @@ const en = {
813
813
  copy: "Copy",
814
814
  save: "Save",
815
815
  add: "Add",
816
- showOptions: "Show options"
816
+ showOptions: "Show options",
817
+ opensInNewTab: "Opens in new tab"
817
818
  },
818
819
  form: {
819
820
  selectAll: "Select all",
@@ -961,7 +962,8 @@ const es = {
961
962
  copy: "Copiar",
962
963
  save: "Guardar",
963
964
  add: "Añadir",
964
- showOptions: "Mostrar opciones"
965
+ showOptions: "Mostrar opciones",
966
+ opensInNewTab: "Abre en una nueva pestaña"
965
967
  },
966
968
  form: {
967
969
  selectAll: "Seleccionar todos",
@@ -1107,7 +1109,8 @@ const id = {
1107
1109
  copy: "Salin",
1108
1110
  save: "Simpan",
1109
1111
  add: "Tambah",
1110
- showOptions: "Tampilkan opsi"
1112
+ showOptions: "Tampilkan opsi",
1113
+ opensInNewTab: "Buka di tab baru"
1111
1114
  },
1112
1115
  form: {
1113
1116
  selectAll: "Select all",
@@ -3,12 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const material = require("@mui/material");
6
- const TablePaginationActions = require("../TablePaginationActions-CFGXm44W.cjs");
6
+ const TablePaginationActions = require("../TablePaginationActions-CAmwcyTy.cjs");
7
7
  const reactIntl = require("react-intl");
8
8
  const iconsMaterial = require("@mui/icons-material");
9
- const Link = require("@mui/material/Link");
9
+ const Alert$1 = require("../Alert-hun6016k.cjs");
10
10
  const styles = require("@mui/material/styles");
11
- const Alert$1 = require("../Alert-zqtoWsBL.cjs");
12
11
  require("cartocolor");
13
12
  const MenuItem = require("../MenuItem-Br2jY2lt.cjs");
14
13
  const ArrowDown = require("../ArrowDown-8fLj23Ge.cjs");
@@ -383,101 +382,17 @@ function ToggleButtonGroup({
383
382
  }
384
383
  );
385
384
  }
386
- const Option = material.styled("div")(({ theme }) => ({
387
- position: "relative",
388
- display: "inline-flex",
389
- // TODO: Remove this once we have a better way to handle the spacing between icon buttons:
390
- // https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
391
- "& + &, & + .optionIconButton": {
392
- marginLeft: theme.spacing(0.5)
393
- }
394
- }));
395
- const StyledIconButton = material.styled(material.IconButton, {
396
- shouldForwardProp: (prop) => !["active"].includes(prop)
397
- })(({ active, theme }) => ({
398
- ...active && {
399
- color: theme.palette.primary.main,
400
- backgroundColor: theme.palette.primary.background,
401
- "& svg:not(.doNotFillIcon) path": {
402
- fill: theme.palette.primary.main
403
- }
404
- }
405
- }));
406
- function _IconButton({
407
- tooltip,
408
- tooltipPlacement = "top",
409
- icon,
410
- size = "medium",
411
- variant = "icon",
412
- color = "default",
413
- sx,
414
- className,
415
- loading,
416
- disabled,
417
- active,
418
- ...props
419
- }, ref) {
420
- return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsxRuntime.jsx(
421
- Option,
422
- {
423
- className: `optionIconButton ${className ?? ""}`,
424
- sx,
425
- "data-testid": "icon-button",
426
- children: /* @__PURE__ */ jsxRuntime.jsx(
427
- StyledIconButton,
428
- {
429
- ...props,
430
- ref,
431
- size,
432
- variant,
433
- color,
434
- active,
435
- disabled: disabled || loading,
436
- role: "button",
437
- children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : icon
438
- }
439
- )
440
- }
441
- ) });
442
- }
443
- const IconButton = React.forwardRef(_IconButton);
444
385
  const externalLinkProps = {
445
386
  target: "_blank",
446
387
  rel: "noopener noreferrer"
447
388
  };
448
- const InlineLink = styles.styled(Link)(
449
- ({ fontWeight = 500 }) => ({
450
- display: "inline",
451
- fontWeight
452
- })
453
- );
454
389
  const IconOpenInNewOutlined = styles.styled(iconsMaterial.OpenInNewOutlined)(() => ({
455
- display: "inline",
456
390
  fontSize: "1em",
457
- // in some place, like alerts all svg/icon colors are overriden, so force color to link color
458
- color: `inherit !important`,
391
+ color: "inherit !important",
459
392
  "> path": {
460
393
  color: "inherit !important"
461
394
  }
462
395
  }));
463
- const IconWrapperInline = styles.styled("span")(() => ({
464
- marginLeft: "0.25em",
465
- position: "relative",
466
- top: "calc(1em * 5.0/32)"
467
- // heuristic to align icon with true perceived baseline
468
- }));
469
- const StyledButton = styles.styled(Button)(({ size, theme }) => ({
470
- "& > span": {
471
- display: "inline-flex",
472
- alignItems: "center"
473
- },
474
- ...size === "small" && {
475
- svg: {
476
- width: `${theme.spacing(2)} !important`,
477
- height: `${theme.spacing(2)} !important`
478
- }
479
- }
480
- }));
481
396
  function _ExternalLink({
482
397
  children,
483
398
  showIcon = true,
@@ -485,9 +400,11 @@ function _ExternalLink({
485
400
  icon = /* @__PURE__ */ jsxRuntime.jsx(IconOpenInNewOutlined, {}),
486
401
  ...props
487
402
  }, ref) {
403
+ const intl = reactIntl.useIntl();
404
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
488
405
  if (useButton) {
489
406
  return /* @__PURE__ */ jsxRuntime.jsx(
490
- StyledButton,
407
+ Button,
491
408
  {
492
409
  ...externalLinkProps,
493
410
  endIcon: showIcon && icon,
@@ -497,16 +414,17 @@ function _ExternalLink({
497
414
  }
498
415
  );
499
416
  } else {
500
- return /* @__PURE__ */ jsxRuntime.jsxs(
501
- InlineLink,
417
+ return /* @__PURE__ */ jsxRuntime.jsx(
418
+ Alert$1.Link,
502
419
  {
503
420
  ...externalLinkProps,
421
+ endIcon: showIcon && icon,
504
422
  ...props,
505
423
  ref,
506
- children: [
507
- children,
508
- showIcon && /* @__PURE__ */ jsxRuntime.jsx(IconWrapperInline, { children: icon })
509
- ]
424
+ "aria-label": `${children == null ? void 0 : children.toString()} (${intlConfig.formatMessage({
425
+ id: "c4r.button.opensInNewTab"
426
+ })})`,
427
+ children
510
428
  }
511
429
  );
512
430
  }
@@ -1553,7 +1471,7 @@ const _CopiableComponent = ({
1553
1471
  children: [
1554
1472
  children,
1555
1473
  button && /* @__PURE__ */ jsxRuntime.jsx(
1556
- IconButton,
1474
+ Alert$1.IconButton,
1557
1475
  {
1558
1476
  ...buttonProps,
1559
1477
  disabled,
@@ -1812,7 +1730,7 @@ function Snackbar({
1812
1730
  }
1813
1731
  ),
1814
1732
  closeable && /* @__PURE__ */ jsxRuntime.jsx(CloseButtonWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
1815
- IconButton,
1733
+ Alert$1.IconButton,
1816
1734
  {
1817
1735
  color: "default",
1818
1736
  onClick: (e) => onClose(e, "timeout"),
@@ -3062,7 +2980,7 @@ function CodeAreaHeader({
3062
2980
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3063
2981
  /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
3064
2982
  /* @__PURE__ */ jsxRuntime.jsx(
3065
- IconButton,
2983
+ Alert$1.IconButton,
3066
2984
  {
3067
2985
  color: "default",
3068
2986
  size,
@@ -3126,7 +3044,7 @@ function CodeAreaHeader({
3126
3044
  }
3127
3045
  ),
3128
3046
  showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
3129
- IconButton,
3047
+ Alert$1.IconButton,
3130
3048
  {
3131
3049
  color: "default",
3132
3050
  size,
@@ -4616,6 +4534,8 @@ function CodeAreaDialog({
4616
4534
  exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
4617
4535
  exports.Typography = TablePaginationActions.Typography;
4618
4536
  exports.Alert = Alert$1.Alert;
4537
+ exports.IconButton = Alert$1.IconButton;
4538
+ exports.Link = Alert$1.Link;
4619
4539
  exports.MenuItem = MenuItem.MenuItem;
4620
4540
  exports.AccordionGroup = AccordionGroup;
4621
4541
  exports.AppBar = AppBar;
@@ -4646,7 +4566,6 @@ exports.DialogHeader = DialogHeader;
4646
4566
  exports.DialogPaper = DialogPaper;
4647
4567
  exports.DialogStepper = DialogStepper;
4648
4568
  exports.ExternalLink = ExternalLink;
4649
- exports.IconButton = IconButton;
4650
4569
  exports.LabelWithIndicator = LabelWithIndicator;
4651
4570
  exports.Menu = Menu$1;
4652
4571
  exports.MenuItemFilter = MenuItemFilter;