@carto/meridian-ds 2.1.0-alpha-copiable-input-text.1 → 2.1.0-alpha-copiable-input-text.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.
|
@@ -1953,11 +1953,11 @@ const _CopiableComponent = ({
|
|
|
1953
1953
|
const [open, setOpen] = React.useState(false);
|
|
1954
1954
|
const intl = reactIntl.useIntl();
|
|
1955
1955
|
const intlConfig = TablePaginationActions.useImperativeIntl(intl);
|
|
1956
|
-
const
|
|
1957
|
-
const
|
|
1956
|
+
const copyTooltipText = copyText || intlConfig.formatMessage({ id: "c4r.button.copy" });
|
|
1957
|
+
const copySuccessMessage = copiedText || intlConfig.formatMessage({
|
|
1958
1958
|
id: "c4r.notifications.copiedToClipboard"
|
|
1959
1959
|
});
|
|
1960
|
-
const { copy } = useCopyValue(
|
|
1960
|
+
const { copy } = useCopyValue(copyTooltipText, copySuccessMessage);
|
|
1961
1961
|
const handleClick = (e) => {
|
|
1962
1962
|
e.preventDefault();
|
|
1963
1963
|
copy(value).then(() => {
|
|
@@ -1969,7 +1969,7 @@ const _CopiableComponent = ({
|
|
|
1969
1969
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1970
1970
|
material.Tooltip,
|
|
1971
1971
|
{
|
|
1972
|
-
title:
|
|
1972
|
+
title: copyTooltipText,
|
|
1973
1973
|
leaveDelay: 0,
|
|
1974
1974
|
placement: tooltipPlacement,
|
|
1975
1975
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1989,7 +1989,7 @@ const _CopiableComponent = ({
|
|
|
1989
1989
|
disabled,
|
|
1990
1990
|
icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}),
|
|
1991
1991
|
"data-testid": dataTestId,
|
|
1992
|
-
"aria-label": ariaLabel || buttonLabel ||
|
|
1992
|
+
"aria-label": ariaLabel || buttonLabel || copyTooltipText,
|
|
1993
1993
|
sx: {
|
|
1994
1994
|
display: "flex"
|
|
1995
1995
|
}
|
|
@@ -2008,12 +2008,18 @@ const _CopiableComponent = ({
|
|
|
2008
2008
|
closeable: false,
|
|
2009
2009
|
autoHideDuration: 4e3,
|
|
2010
2010
|
onClose: () => setOpen(false),
|
|
2011
|
-
children:
|
|
2011
|
+
children: copySuccessMessage
|
|
2012
2012
|
}
|
|
2013
2013
|
)
|
|
2014
2014
|
] });
|
|
2015
2015
|
};
|
|
2016
2016
|
const CopiableComponent = React.forwardRef(_CopiableComponent);
|
|
2017
|
+
const StyledTextField = material.styled(material.TextField)(() => ({
|
|
2018
|
+
"& input": {
|
|
2019
|
+
textOverflow: "unset"
|
|
2020
|
+
// This is needed to avoid scrolling issues in the input
|
|
2021
|
+
}
|
|
2022
|
+
}));
|
|
2017
2023
|
const AdornmentWrapper = material.styled(material.Box, {
|
|
2018
2024
|
shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
|
|
2019
2025
|
})(({ variant, size, theme }) => ({
|
|
@@ -2049,21 +2055,19 @@ function _CopiableInputText({
|
|
|
2049
2055
|
const showTextLabel = intlConfig.formatMessage({
|
|
2050
2056
|
id: showText ? "c4r.button.hide" : "c4r.button.show"
|
|
2051
2057
|
});
|
|
2052
|
-
const passwordAdornment =
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
) });
|
|
2064
|
-
}, [showTextLabel, showText, size, variant]);
|
|
2058
|
+
const passwordAdornment = /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2059
|
+
Link.IconButton,
|
|
2060
|
+
{
|
|
2061
|
+
edge: variant !== "standard" ? "end" : void 0,
|
|
2062
|
+
onClick: () => setShowText(!showText),
|
|
2063
|
+
size,
|
|
2064
|
+
icon: showText ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}),
|
|
2065
|
+
tooltip: showTextLabel,
|
|
2066
|
+
"aria-label": showTextLabel
|
|
2067
|
+
}
|
|
2068
|
+
) });
|
|
2065
2069
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
|
-
|
|
2070
|
+
StyledTextField,
|
|
2067
2071
|
{
|
|
2068
2072
|
...rest,
|
|
2069
2073
|
size,
|
package/dist/components/index.js
CHANGED
|
@@ -1953,11 +1953,11 @@ const _CopiableComponent = ({
|
|
|
1953
1953
|
const [open, setOpen] = useState(false);
|
|
1954
1954
|
const intl = useIntl();
|
|
1955
1955
|
const intlConfig = useImperativeIntl(intl);
|
|
1956
|
-
const
|
|
1957
|
-
const
|
|
1956
|
+
const copyTooltipText = copyText || intlConfig.formatMessage({ id: "c4r.button.copy" });
|
|
1957
|
+
const copySuccessMessage = copiedText || intlConfig.formatMessage({
|
|
1958
1958
|
id: "c4r.notifications.copiedToClipboard"
|
|
1959
1959
|
});
|
|
1960
|
-
const { copy } = useCopyValue(
|
|
1960
|
+
const { copy } = useCopyValue(copyTooltipText, copySuccessMessage);
|
|
1961
1961
|
const handleClick = (e) => {
|
|
1962
1962
|
e.preventDefault();
|
|
1963
1963
|
copy(value).then(() => {
|
|
@@ -1969,7 +1969,7 @@ const _CopiableComponent = ({
|
|
|
1969
1969
|
/* @__PURE__ */ jsx(
|
|
1970
1970
|
Tooltip,
|
|
1971
1971
|
{
|
|
1972
|
-
title:
|
|
1972
|
+
title: copyTooltipText,
|
|
1973
1973
|
leaveDelay: 0,
|
|
1974
1974
|
placement: tooltipPlacement,
|
|
1975
1975
|
children: /* @__PURE__ */ jsxs(
|
|
@@ -1989,7 +1989,7 @@ const _CopiableComponent = ({
|
|
|
1989
1989
|
disabled,
|
|
1990
1990
|
icon: /* @__PURE__ */ jsx(ContentCopyOutlined, {}),
|
|
1991
1991
|
"data-testid": dataTestId,
|
|
1992
|
-
"aria-label": ariaLabel || buttonLabel ||
|
|
1992
|
+
"aria-label": ariaLabel || buttonLabel || copyTooltipText,
|
|
1993
1993
|
sx: {
|
|
1994
1994
|
display: "flex"
|
|
1995
1995
|
}
|
|
@@ -2008,12 +2008,18 @@ const _CopiableComponent = ({
|
|
|
2008
2008
|
closeable: false,
|
|
2009
2009
|
autoHideDuration: 4e3,
|
|
2010
2010
|
onClose: () => setOpen(false),
|
|
2011
|
-
children:
|
|
2011
|
+
children: copySuccessMessage
|
|
2012
2012
|
}
|
|
2013
2013
|
)
|
|
2014
2014
|
] });
|
|
2015
2015
|
};
|
|
2016
2016
|
const CopiableComponent = forwardRef(_CopiableComponent);
|
|
2017
|
+
const StyledTextField = styled(TextField)(() => ({
|
|
2018
|
+
"& input": {
|
|
2019
|
+
textOverflow: "unset"
|
|
2020
|
+
// This is needed to avoid scrolling issues in the input
|
|
2021
|
+
}
|
|
2022
|
+
}));
|
|
2017
2023
|
const AdornmentWrapper = styled(Box, {
|
|
2018
2024
|
shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
|
|
2019
2025
|
})(({ variant, size, theme }) => ({
|
|
@@ -2049,21 +2055,19 @@ function _CopiableInputText({
|
|
|
2049
2055
|
const showTextLabel = intlConfig.formatMessage({
|
|
2050
2056
|
id: showText ? "c4r.button.hide" : "c4r.button.show"
|
|
2051
2057
|
});
|
|
2052
|
-
const passwordAdornment =
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
) });
|
|
2064
|
-
}, [showTextLabel, showText, size, variant]);
|
|
2058
|
+
const passwordAdornment = /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
|
|
2059
|
+
IconButton$1,
|
|
2060
|
+
{
|
|
2061
|
+
edge: variant !== "standard" ? "end" : void 0,
|
|
2062
|
+
onClick: () => setShowText(!showText),
|
|
2063
|
+
size,
|
|
2064
|
+
icon: showText ? /* @__PURE__ */ jsx(VisibilityOutlined, {}) : /* @__PURE__ */ jsx(VisibilityOffOutlined, {}),
|
|
2065
|
+
tooltip: showTextLabel,
|
|
2066
|
+
"aria-label": showTextLabel
|
|
2067
|
+
}
|
|
2068
|
+
) });
|
|
2065
2069
|
return /* @__PURE__ */ jsx(
|
|
2066
|
-
|
|
2070
|
+
StyledTextField,
|
|
2067
2071
|
{
|
|
2068
2072
|
...rest,
|
|
2069
2073
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopiableInputText.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Copy/CopiableInputText.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CopiableInputText.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Copy/CopiableInputText.tsx"],"names":[],"mappings":"AA+HA,QAAA,MAAM,iBAAiB;;8BAtGS,SAAS;;;;;8BAAT,SAAS;;;;;8BAAT,SAAS;;;2DAsGe,CAAA;AACxD,eAAe,iBAAiB,CAAA"}
|