@carto/meridian-ds 1.4.5-alpha-external-link.2 → 1.4.5-alpha-external-link.4
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.
- package/CHANGELOG.md +1 -0
- package/dist/Alert-C0UdTQsO.js +257 -0
- package/dist/{Alert-CVfTyHiz.cjs → Alert-D01HgLe0.cjs} +119 -12
- package/dist/{TablePaginationActions-CFGXm44W.cjs → TablePaginationActions-CAmwcyTy.cjs} +6 -3
- package/dist/{TablePaginationActions-KpTvhN4Y.js → TablePaginationActions-b5wP_uRE.js} +6 -3
- package/dist/components/index.cjs +25 -72
- package/dist/components/index.js +37 -84
- package/dist/theme/index.cjs +1 -1
- package/dist/theme/index.js +2 -2
- package/dist/types/components/atoms/Button.d.ts +5 -0
- package/dist/types/components/atoms/Button.d.ts.map +1 -1
- package/dist/types/components/atoms/ExternalLink.d.ts +2 -4
- package/dist/types/components/atoms/ExternalLink.d.ts.map +1 -1
- package/dist/types/components/atoms/Link.d.ts +11 -1
- package/dist/types/components/atoms/Link.d.ts.map +1 -1
- package/dist/types/localization/en.d.ts +1 -0
- package/dist/types/localization/en.d.ts.map +1 -1
- package/dist/types/localization/es.d.ts +1 -0
- package/dist/types/localization/es.d.ts.map +1 -1
- package/dist/types/localization/id.d.ts +1 -0
- package/dist/types/localization/id.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +3 -0
- package/dist/types/localization/index.d.ts.map +1 -1
- package/dist/types/widgets/ChartLegend.d.ts.map +1 -1
- package/dist/widgets/index.cjs +20 -28
- package/dist/widgets/index.js +31 -39
- package/package.json +1 -1
- package/dist/Alert-BcaaL6lM.js +0 -150
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState } from "react";
|
|
3
|
+
import { styled, IconButton as IconButton$1, Tooltip, CircularProgress, Link as Link$1, Box, Alert as Alert$1, Fade, AlertTitle } from "@mui/material";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { OpenInNewOutlined } from "@mui/icons-material";
|
|
6
|
+
import { c as ICON_SIZE_SMALL, b as ICON_SIZE_MEDIUM, I as ICON_SIZE_LARGE, u as useImperativeIntl, T as Typography } from "./TablePaginationActions-b5wP_uRE.js";
|
|
7
|
+
import "cartocolor";
|
|
8
|
+
const Option = styled("div")(({ theme }) => ({
|
|
9
|
+
position: "relative",
|
|
10
|
+
display: "inline-flex",
|
|
11
|
+
// TODO: Remove this once we have a better way to handle the spacing between icon buttons:
|
|
12
|
+
// https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
|
|
13
|
+
"& + &, & + .optionIconButton": {
|
|
14
|
+
marginLeft: theme.spacing(0.5)
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
const StyledIconButton = styled(IconButton$1, {
|
|
18
|
+
shouldForwardProp: (prop) => !["active"].includes(prop)
|
|
19
|
+
})(({ active, theme }) => ({
|
|
20
|
+
...active && {
|
|
21
|
+
color: theme.palette.primary.main,
|
|
22
|
+
backgroundColor: theme.palette.primary.background,
|
|
23
|
+
"& svg:not(.doNotFillIcon) path": {
|
|
24
|
+
fill: theme.palette.primary.main
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
function _IconButton({
|
|
29
|
+
tooltip,
|
|
30
|
+
tooltipPlacement = "top",
|
|
31
|
+
icon,
|
|
32
|
+
size = "medium",
|
|
33
|
+
variant = "icon",
|
|
34
|
+
color = "default",
|
|
35
|
+
sx,
|
|
36
|
+
className,
|
|
37
|
+
loading,
|
|
38
|
+
disabled,
|
|
39
|
+
active,
|
|
40
|
+
...props
|
|
41
|
+
}, ref) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsx(
|
|
43
|
+
Option,
|
|
44
|
+
{
|
|
45
|
+
className: `optionIconButton ${className ?? ""}`,
|
|
46
|
+
sx,
|
|
47
|
+
"data-testid": "icon-button",
|
|
48
|
+
children: /* @__PURE__ */ jsx(
|
|
49
|
+
StyledIconButton,
|
|
50
|
+
{
|
|
51
|
+
...props,
|
|
52
|
+
ref,
|
|
53
|
+
size,
|
|
54
|
+
variant,
|
|
55
|
+
color,
|
|
56
|
+
active,
|
|
57
|
+
disabled: disabled || loading,
|
|
58
|
+
role: "button",
|
|
59
|
+
children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 18, color: "inherit" }) : icon
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
64
|
+
}
|
|
65
|
+
const IconButton = forwardRef(_IconButton);
|
|
66
|
+
const StyledLink = styled(Link$1)(({ theme }) => ({
|
|
67
|
+
display: "inline-flex",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
gap: theme.spacing(0.25)
|
|
70
|
+
}));
|
|
71
|
+
const Icon = styled(Box, {
|
|
72
|
+
shouldForwardProp: (prop) => prop !== "variant"
|
|
73
|
+
})(({ variant }) => ({
|
|
74
|
+
display: "flex",
|
|
75
|
+
svg: {
|
|
76
|
+
...variant === "caption" && {
|
|
77
|
+
fontSize: ICON_SIZE_SMALL
|
|
78
|
+
},
|
|
79
|
+
...variant === "body2" && {
|
|
80
|
+
fontSize: ICON_SIZE_MEDIUM
|
|
81
|
+
},
|
|
82
|
+
...variant === "body1" && {
|
|
83
|
+
fontSize: ICON_SIZE_LARGE
|
|
84
|
+
},
|
|
85
|
+
...variant === "button" && {
|
|
86
|
+
fontSize: ICON_SIZE_MEDIUM
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
function _Link({
|
|
91
|
+
children,
|
|
92
|
+
variant,
|
|
93
|
+
startIcon,
|
|
94
|
+
endIcon,
|
|
95
|
+
color,
|
|
96
|
+
external,
|
|
97
|
+
showExternalIcon = true,
|
|
98
|
+
...otherProps
|
|
99
|
+
}, ref) {
|
|
100
|
+
const intl = useIntl();
|
|
101
|
+
const intlConfig = useImperativeIntl(intl);
|
|
102
|
+
return /* @__PURE__ */ jsxs(
|
|
103
|
+
StyledLink,
|
|
104
|
+
{
|
|
105
|
+
...otherProps,
|
|
106
|
+
variant,
|
|
107
|
+
"data-color": color,
|
|
108
|
+
"data-name": "link",
|
|
109
|
+
role: "link",
|
|
110
|
+
color,
|
|
111
|
+
ref,
|
|
112
|
+
target: external ? "_blank" : void 0,
|
|
113
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
114
|
+
"aria-label": external ? `${children == null ? void 0 : children.toString()} (${intlConfig.formatMessage({
|
|
115
|
+
id: "c4r.button.opensInNewTab"
|
|
116
|
+
})})` : void 0,
|
|
117
|
+
children: [
|
|
118
|
+
startIcon && /* @__PURE__ */ jsx(Icon, { variant, children: startIcon }),
|
|
119
|
+
children,
|
|
120
|
+
(endIcon || external && showExternalIcon) && /* @__PURE__ */ jsx(Icon, { variant, children: endIcon || /* @__PURE__ */ jsx(OpenInNewOutlined, {}) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const Link = forwardRef(_Link);
|
|
126
|
+
const StyledAlert = styled(Alert$1, {
|
|
127
|
+
shouldForwardProp: (prop) => ![
|
|
128
|
+
"isNeutral",
|
|
129
|
+
"content",
|
|
130
|
+
"hasCloseButton",
|
|
131
|
+
"hasAction",
|
|
132
|
+
"hasTitle",
|
|
133
|
+
"isSticky"
|
|
134
|
+
].includes(prop)
|
|
135
|
+
})(
|
|
136
|
+
({
|
|
137
|
+
isNeutral,
|
|
138
|
+
content,
|
|
139
|
+
hasCloseButton,
|
|
140
|
+
hasAction,
|
|
141
|
+
hasTitle,
|
|
142
|
+
isSticky,
|
|
143
|
+
theme
|
|
144
|
+
}) => ({
|
|
145
|
+
columnGap: theme.spacing(1),
|
|
146
|
+
minHeight: theme.spacing(6),
|
|
147
|
+
...hasAction && {
|
|
148
|
+
display: "grid",
|
|
149
|
+
gridTemplateAreas: content === "inline" || hasCloseButton ? `"icon message actions"` : `
|
|
150
|
+
"icon message"
|
|
151
|
+
"icon actions"
|
|
152
|
+
`,
|
|
153
|
+
gridTemplateColumns: hasCloseButton ? `${ICON_SIZE_MEDIUM} 1fr ${theme.spacing(3)}` : `${ICON_SIZE_MEDIUM}`
|
|
154
|
+
},
|
|
155
|
+
...isNeutral && {
|
|
156
|
+
backgroundColor: theme.palette.default.background,
|
|
157
|
+
color: theme.palette.text.primary
|
|
158
|
+
},
|
|
159
|
+
...isSticky && {
|
|
160
|
+
borderRadius: 0
|
|
161
|
+
},
|
|
162
|
+
".MuiAlert-message": {
|
|
163
|
+
flex: 1,
|
|
164
|
+
paddingTop: hasTitle ? theme.spacing(0.25) : theme.spacing(0.5),
|
|
165
|
+
"& a": {
|
|
166
|
+
color: theme.palette.primary.main,
|
|
167
|
+
textDecoration: "none",
|
|
168
|
+
"&:hover": {
|
|
169
|
+
textDecoration: "underline"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
...hasAction && {
|
|
173
|
+
gridArea: "message"
|
|
174
|
+
},
|
|
175
|
+
...isNeutral && {
|
|
176
|
+
"& :not(.MuiAlertTitle-root)": {
|
|
177
|
+
color: theme.palette.text.secondary
|
|
178
|
+
},
|
|
179
|
+
a: {
|
|
180
|
+
color: `${theme.palette.primary.main} !important`
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
".MuiAlert-icon": {
|
|
185
|
+
height: hasTitle ? theme.spacing(2.5) : theme.spacing(3),
|
|
186
|
+
marginRight: 0,
|
|
187
|
+
...hasAction && {
|
|
188
|
+
gridArea: "icon"
|
|
189
|
+
},
|
|
190
|
+
...isNeutral && {
|
|
191
|
+
color: theme.palette.text.primary
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
".MuiAlert-action": {
|
|
195
|
+
alignItems: content === "inline" && !hasCloseButton ? "center" : "flex-start",
|
|
196
|
+
margin: content === "block" && !hasCloseButton ? theme.spacing(1.5, 0, 0.5) : 0,
|
|
197
|
+
marginLeft: content === "inline" || hasCloseButton ? "auto" : 0,
|
|
198
|
+
padding: 0,
|
|
199
|
+
...hasAction && {
|
|
200
|
+
gridArea: "actions"
|
|
201
|
+
},
|
|
202
|
+
".MuiIconButton-root svg path": {
|
|
203
|
+
fill: hasCloseButton ? theme.palette.text.secondary : void 0
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
function _Alert({
|
|
209
|
+
title,
|
|
210
|
+
action,
|
|
211
|
+
severity = "neutral",
|
|
212
|
+
content = "inline",
|
|
213
|
+
variant = "standard",
|
|
214
|
+
children,
|
|
215
|
+
onClose,
|
|
216
|
+
open: controlledOpen,
|
|
217
|
+
isSticky,
|
|
218
|
+
...otherProps
|
|
219
|
+
}, ref) {
|
|
220
|
+
const [open, setOpen] = useState(controlledOpen ?? true);
|
|
221
|
+
const handleClose = onClose ? (ev) => {
|
|
222
|
+
onClose(ev);
|
|
223
|
+
setOpen(false);
|
|
224
|
+
} : void 0;
|
|
225
|
+
const isNeutral = severity === "neutral";
|
|
226
|
+
const isOpen = controlledOpen ?? open;
|
|
227
|
+
return /* @__PURE__ */ jsx(Fade, { in: isOpen, appear: false, children: /* @__PURE__ */ jsxs(
|
|
228
|
+
StyledAlert,
|
|
229
|
+
{
|
|
230
|
+
ref,
|
|
231
|
+
severity: isNeutral ? "info" : severity,
|
|
232
|
+
isNeutral,
|
|
233
|
+
content,
|
|
234
|
+
action,
|
|
235
|
+
onClose: handleClose,
|
|
236
|
+
hasCloseButton: Boolean(onClose),
|
|
237
|
+
hasAction: Boolean(action),
|
|
238
|
+
hasTitle: Boolean(title),
|
|
239
|
+
isSticky,
|
|
240
|
+
variant,
|
|
241
|
+
"data-name": "alert",
|
|
242
|
+
"data-sticky": isSticky,
|
|
243
|
+
"data-content": content,
|
|
244
|
+
...otherProps,
|
|
245
|
+
children: [
|
|
246
|
+
title && /* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
|
247
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "inherit", component: "div", children })
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
) });
|
|
251
|
+
}
|
|
252
|
+
const Alert = forwardRef(_Alert);
|
|
253
|
+
export {
|
|
254
|
+
Alert as A,
|
|
255
|
+
IconButton as I,
|
|
256
|
+
Link as L
|
|
257
|
+
};
|
|
@@ -2,20 +2,126 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const material = require("@mui/material");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const reactIntl = require("react-intl");
|
|
6
|
+
const iconsMaterial = require("@mui/icons-material");
|
|
7
|
+
const TablePaginationActions = require("./TablePaginationActions-CAmwcyTy.cjs");
|
|
8
|
+
require("cartocolor");
|
|
9
|
+
const Option = material.styled("div")(({ theme }) => ({
|
|
7
10
|
position: "relative",
|
|
8
|
-
display: "inline-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
display: "inline-flex",
|
|
12
|
+
// TODO: Remove this once we have a better way to handle the spacing between icon buttons:
|
|
13
|
+
// https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
|
|
14
|
+
"& + &, & + .optionIconButton": {
|
|
15
|
+
marginLeft: theme.spacing(0.5)
|
|
16
|
+
}
|
|
12
17
|
}));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const StyledIconButton = material.styled(material.IconButton, {
|
|
19
|
+
shouldForwardProp: (prop) => !["active"].includes(prop)
|
|
20
|
+
})(({ active, theme }) => ({
|
|
21
|
+
...active && {
|
|
22
|
+
color: theme.palette.primary.main,
|
|
23
|
+
backgroundColor: theme.palette.primary.background,
|
|
24
|
+
"& svg:not(.doNotFillIcon) path": {
|
|
25
|
+
fill: theme.palette.primary.main
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
function _IconButton({
|
|
30
|
+
tooltip,
|
|
31
|
+
tooltipPlacement = "top",
|
|
32
|
+
icon,
|
|
33
|
+
size = "medium",
|
|
34
|
+
variant = "icon",
|
|
35
|
+
color = "default",
|
|
36
|
+
sx,
|
|
37
|
+
className,
|
|
38
|
+
loading,
|
|
39
|
+
disabled,
|
|
40
|
+
active,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) {
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
+
Option,
|
|
45
|
+
{
|
|
46
|
+
className: `optionIconButton ${className ?? ""}`,
|
|
47
|
+
sx,
|
|
48
|
+
"data-testid": "icon-button",
|
|
49
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
StyledIconButton,
|
|
51
|
+
{
|
|
52
|
+
...props,
|
|
53
|
+
ref,
|
|
54
|
+
size,
|
|
55
|
+
variant,
|
|
56
|
+
color,
|
|
57
|
+
active,
|
|
58
|
+
disabled: disabled || loading,
|
|
59
|
+
role: "button",
|
|
60
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : icon
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
) });
|
|
65
|
+
}
|
|
66
|
+
const IconButton = React.forwardRef(_IconButton);
|
|
67
|
+
const StyledLink = material.styled(material.Link)(({ theme }) => ({
|
|
68
|
+
display: "inline-flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
gap: theme.spacing(0.25)
|
|
71
|
+
}));
|
|
72
|
+
const Icon = material.styled(material.Box, {
|
|
73
|
+
shouldForwardProp: (prop) => prop !== "variant"
|
|
74
|
+
})(({ variant }) => ({
|
|
75
|
+
display: "flex",
|
|
76
|
+
svg: {
|
|
77
|
+
...variant === "caption" && {
|
|
78
|
+
fontSize: TablePaginationActions.ICON_SIZE_SMALL
|
|
79
|
+
},
|
|
80
|
+
...variant === "body2" && {
|
|
81
|
+
fontSize: TablePaginationActions.ICON_SIZE_MEDIUM
|
|
82
|
+
},
|
|
83
|
+
...variant === "body1" && {
|
|
84
|
+
fontSize: TablePaginationActions.ICON_SIZE_LARGE
|
|
85
|
+
},
|
|
86
|
+
...variant === "button" && {
|
|
87
|
+
fontSize: TablePaginationActions.ICON_SIZE_MEDIUM
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
function _Link({
|
|
92
|
+
children,
|
|
93
|
+
variant,
|
|
94
|
+
startIcon,
|
|
95
|
+
endIcon,
|
|
96
|
+
color,
|
|
97
|
+
external,
|
|
98
|
+
showExternalIcon = true,
|
|
99
|
+
...otherProps
|
|
100
|
+
}, ref) {
|
|
101
|
+
const intl = reactIntl.useIntl();
|
|
102
|
+
const intlConfig = TablePaginationActions.useImperativeIntl(intl);
|
|
103
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
104
|
+
StyledLink,
|
|
105
|
+
{
|
|
106
|
+
...otherProps,
|
|
107
|
+
variant,
|
|
108
|
+
"data-color": color,
|
|
109
|
+
"data-name": "link",
|
|
110
|
+
role: "link",
|
|
111
|
+
color,
|
|
112
|
+
ref,
|
|
113
|
+
target: external ? "_blank" : void 0,
|
|
114
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
115
|
+
"aria-label": external ? `${children == null ? void 0 : children.toString()} (${intlConfig.formatMessage({
|
|
116
|
+
id: "c4r.button.opensInNewTab"
|
|
117
|
+
})})` : void 0,
|
|
118
|
+
children: [
|
|
119
|
+
startIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { variant, children: startIcon }),
|
|
120
|
+
children,
|
|
121
|
+
(endIcon || external && showExternalIcon) && /* @__PURE__ */ jsxRuntime.jsx(Icon, { variant, children: endIcon || /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.OpenInNewOutlined, {}) })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
);
|
|
19
125
|
}
|
|
20
126
|
const Link = React.forwardRef(_Link);
|
|
21
127
|
const StyledAlert = material.styled(material.Alert, {
|
|
@@ -146,4 +252,5 @@ function _Alert({
|
|
|
146
252
|
}
|
|
147
253
|
const Alert = React.forwardRef(_Alert);
|
|
148
254
|
exports.Alert = Alert;
|
|
255
|
+
exports.IconButton = IconButton;
|
|
149
256
|
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",
|
|
@@ -2,12 +2,12 @@
|
|
|
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 material = require("@mui/material");
|
|
6
|
-
const TablePaginationActions = require("../TablePaginationActions-CFGXm44W.cjs");
|
|
7
5
|
const reactIntl = require("react-intl");
|
|
6
|
+
const material = require("@mui/material");
|
|
8
7
|
const iconsMaterial = require("@mui/icons-material");
|
|
8
|
+
const TablePaginationActions = require("../TablePaginationActions-CAmwcyTy.cjs");
|
|
9
|
+
const Alert$1 = require("../Alert-D01HgLe0.cjs");
|
|
9
10
|
const styles = require("@mui/material/styles");
|
|
10
|
-
const Alert$1 = require("../Alert-CVfTyHiz.cjs");
|
|
11
11
|
require("cartocolor");
|
|
12
12
|
const MenuItem = require("../MenuItem-Br2jY2lt.cjs");
|
|
13
13
|
const ArrowDown = require("../ArrowDown-8fLj23Ge.cjs");
|
|
@@ -62,8 +62,11 @@ function _Button({
|
|
|
62
62
|
startIcon,
|
|
63
63
|
endIcon,
|
|
64
64
|
loadingPosition,
|
|
65
|
+
external,
|
|
65
66
|
...otherProps
|
|
66
67
|
}, ref) {
|
|
68
|
+
const intl = reactIntl.useIntl();
|
|
69
|
+
const intlConfig = TablePaginationActions.useImperativeIntl(intl);
|
|
67
70
|
const defaultIconLoader = /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" });
|
|
68
71
|
const isDefaultLoading = loading && loadingPosition === void 0;
|
|
69
72
|
const renderContent = () => {
|
|
@@ -85,7 +88,11 @@ function _Button({
|
|
|
85
88
|
}
|
|
86
89
|
return void 0;
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
if (position === "start") {
|
|
92
|
+
return startIcon;
|
|
93
|
+
} else {
|
|
94
|
+
return endIcon || (external && otherProps.href ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.OpenInNewOutlined, {}) : void 0);
|
|
95
|
+
}
|
|
89
96
|
};
|
|
90
97
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
98
|
material.Button,
|
|
@@ -95,6 +102,13 @@ function _Button({
|
|
|
95
102
|
endIcon: getIconForPosition("end"),
|
|
96
103
|
...otherProps,
|
|
97
104
|
role: otherProps.href ? "link" : "button",
|
|
105
|
+
...otherProps.href && external && {
|
|
106
|
+
target: "_blank",
|
|
107
|
+
rel: "noopener noreferrer"
|
|
108
|
+
},
|
|
109
|
+
"aria-label": external && otherProps.href ? `${children == null ? void 0 : children.toString()} (${intlConfig.formatMessage({
|
|
110
|
+
id: "c4r.button.opensInNewTab"
|
|
111
|
+
})})` : void 0,
|
|
98
112
|
ref,
|
|
99
113
|
children: /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
|
|
100
114
|
}
|
|
@@ -382,71 +396,12 @@ function ToggleButtonGroup({
|
|
|
382
396
|
}
|
|
383
397
|
);
|
|
384
398
|
}
|
|
385
|
-
const Option = material.styled("div")(({ theme }) => ({
|
|
386
|
-
position: "relative",
|
|
387
|
-
display: "inline-flex",
|
|
388
|
-
// TODO: Remove this once we have a better way to handle the spacing between icon buttons:
|
|
389
|
-
// https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
|
|
390
|
-
"& + &, & + .optionIconButton": {
|
|
391
|
-
marginLeft: theme.spacing(0.5)
|
|
392
|
-
}
|
|
393
|
-
}));
|
|
394
|
-
const StyledIconButton = material.styled(material.IconButton, {
|
|
395
|
-
shouldForwardProp: (prop) => !["active"].includes(prop)
|
|
396
|
-
})(({ active, theme }) => ({
|
|
397
|
-
...active && {
|
|
398
|
-
color: theme.palette.primary.main,
|
|
399
|
-
backgroundColor: theme.palette.primary.background,
|
|
400
|
-
"& svg:not(.doNotFillIcon) path": {
|
|
401
|
-
fill: theme.palette.primary.main
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}));
|
|
405
|
-
function _IconButton({
|
|
406
|
-
tooltip,
|
|
407
|
-
tooltipPlacement = "top",
|
|
408
|
-
icon,
|
|
409
|
-
size = "medium",
|
|
410
|
-
variant = "icon",
|
|
411
|
-
color = "default",
|
|
412
|
-
sx,
|
|
413
|
-
className,
|
|
414
|
-
loading,
|
|
415
|
-
disabled,
|
|
416
|
-
active,
|
|
417
|
-
...props
|
|
418
|
-
}, ref) {
|
|
419
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
-
Option,
|
|
421
|
-
{
|
|
422
|
-
className: `optionIconButton ${className ?? ""}`,
|
|
423
|
-
sx,
|
|
424
|
-
"data-testid": "icon-button",
|
|
425
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
426
|
-
StyledIconButton,
|
|
427
|
-
{
|
|
428
|
-
...props,
|
|
429
|
-
ref,
|
|
430
|
-
size,
|
|
431
|
-
variant,
|
|
432
|
-
color,
|
|
433
|
-
active,
|
|
434
|
-
disabled: disabled || loading,
|
|
435
|
-
role: "button",
|
|
436
|
-
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : icon
|
|
437
|
-
}
|
|
438
|
-
)
|
|
439
|
-
}
|
|
440
|
-
) });
|
|
441
|
-
}
|
|
442
|
-
const IconButton = React.forwardRef(_IconButton);
|
|
443
399
|
const externalLinkProps = {
|
|
444
400
|
target: "_blank",
|
|
445
401
|
rel: "noopener noreferrer"
|
|
446
402
|
};
|
|
447
403
|
const IconOpenInNewOutlined = styles.styled(iconsMaterial.OpenInNewOutlined)(() => ({
|
|
448
404
|
fontSize: "1em",
|
|
449
|
-
// in some place, like alerts all svg/icon colors are overriden, so force color to link color
|
|
450
405
|
color: "inherit !important",
|
|
451
406
|
"> path": {
|
|
452
407
|
color: "inherit !important"
|
|
@@ -457,7 +412,6 @@ function _ExternalLink({
|
|
|
457
412
|
showIcon = true,
|
|
458
413
|
useButton = false,
|
|
459
414
|
icon = /* @__PURE__ */ jsxRuntime.jsx(IconOpenInNewOutlined, {}),
|
|
460
|
-
fontWeight = "medium",
|
|
461
415
|
...props
|
|
462
416
|
}, ref) {
|
|
463
417
|
if (useButton) {
|
|
@@ -475,10 +429,9 @@ function _ExternalLink({
|
|
|
475
429
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
476
430
|
Alert$1.Link,
|
|
477
431
|
{
|
|
478
|
-
...externalLinkProps,
|
|
479
|
-
endIcon: showIcon && icon,
|
|
480
|
-
fontWeight,
|
|
481
432
|
...props,
|
|
433
|
+
external: true,
|
|
434
|
+
showExternalIcon: showIcon,
|
|
482
435
|
ref,
|
|
483
436
|
children
|
|
484
437
|
}
|
|
@@ -1527,7 +1480,7 @@ const _CopiableComponent = ({
|
|
|
1527
1480
|
children: [
|
|
1528
1481
|
children,
|
|
1529
1482
|
button && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1530
|
-
IconButton,
|
|
1483
|
+
Alert$1.IconButton,
|
|
1531
1484
|
{
|
|
1532
1485
|
...buttonProps,
|
|
1533
1486
|
disabled,
|
|
@@ -1786,7 +1739,7 @@ function Snackbar({
|
|
|
1786
1739
|
}
|
|
1787
1740
|
),
|
|
1788
1741
|
closeable && /* @__PURE__ */ jsxRuntime.jsx(CloseButtonWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1789
|
-
IconButton,
|
|
1742
|
+
Alert$1.IconButton,
|
|
1790
1743
|
{
|
|
1791
1744
|
color: "default",
|
|
1792
1745
|
onClick: (e) => onClose(e, "timeout"),
|
|
@@ -3036,7 +2989,7 @@ function CodeAreaHeader({
|
|
|
3036
2989
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3037
2990
|
/* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
|
|
3038
2991
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3039
|
-
IconButton,
|
|
2992
|
+
Alert$1.IconButton,
|
|
3040
2993
|
{
|
|
3041
2994
|
color: "default",
|
|
3042
2995
|
size,
|
|
@@ -3100,7 +3053,7 @@ function CodeAreaHeader({
|
|
|
3100
3053
|
}
|
|
3101
3054
|
),
|
|
3102
3055
|
showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3103
|
-
IconButton,
|
|
3056
|
+
Alert$1.IconButton,
|
|
3104
3057
|
{
|
|
3105
3058
|
color: "default",
|
|
3106
3059
|
size,
|
|
@@ -4590,6 +4543,7 @@ function CodeAreaDialog({
|
|
|
4590
4543
|
exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
|
|
4591
4544
|
exports.Typography = TablePaginationActions.Typography;
|
|
4592
4545
|
exports.Alert = Alert$1.Alert;
|
|
4546
|
+
exports.IconButton = Alert$1.IconButton;
|
|
4593
4547
|
exports.Link = Alert$1.Link;
|
|
4594
4548
|
exports.MenuItem = MenuItem.MenuItem;
|
|
4595
4549
|
exports.AccordionGroup = AccordionGroup;
|
|
@@ -4621,7 +4575,6 @@ exports.DialogHeader = DialogHeader;
|
|
|
4621
4575
|
exports.DialogPaper = DialogPaper;
|
|
4622
4576
|
exports.DialogStepper = DialogStepper;
|
|
4623
4577
|
exports.ExternalLink = ExternalLink;
|
|
4624
|
-
exports.IconButton = IconButton;
|
|
4625
4578
|
exports.LabelWithIndicator = LabelWithIndicator;
|
|
4626
4579
|
exports.Menu = Menu$1;
|
|
4627
4580
|
exports.MenuItemFilter = MenuItemFilter;
|