@evergis/react 3.1.75 → 3.1.76

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/dist/react.esm.js CHANGED
@@ -7844,15 +7844,14 @@ const ExternalLink = styled(IconButton).attrs(() => ({
7844
7844
  color: ${({ theme: { palette } }) => palette.primaryDeep};
7845
7845
  }
7846
7846
  `;
7847
- const LocalLinkBlank = styled(Blank) `
7848
- min-width: 13.5rem;
7849
- padding: 0.5rem 0.75rem 0;
7850
-
7851
- a {
7847
+ const Link = styled.a `
7852
7848
  text-decoration: none;
7853
7849
  font-size: 0.75rem;
7854
7850
  color: ${({ theme: { palette } }) => palette.primary};
7855
- }
7851
+ `;
7852
+ const LocalLinkBlank = styled(Blank) `
7853
+ min-width: 13.5rem;
7854
+ padding: 0.5rem 0.75rem 0;
7856
7855
 
7857
7856
  ${IconButtonButton} {
7858
7857
  font-size: 0.75rem;
@@ -7887,23 +7886,30 @@ const LocalLinkCopy = styled(Flex) `
7887
7886
  justify-content: center;
7888
7887
  `;
7889
7888
 
7890
- const LocalLink = memo(({ link }) => {
7889
+ const LocalLink = memo(({ link, style }) => {
7891
7890
  const { t } = useGlobalContext();
7892
7891
  const [isOpen, toggleOpen] = useToggle();
7893
7892
  const onCopy = useCallback(() => {
7894
7893
  navigator.clipboard.writeText(link);
7895
7894
  toggleOpen();
7896
7895
  }, [link, toggleOpen]);
7897
- return (jsx(Popover, { open: isOpen, zIndex: 10, onRequestClose: toggleOpen, anchorOrigin: "bottom-right", targetOrigin: "top-right", anchor: jsx(LocalLinkButton, { onClick: toggleOpen }), children: jsxs(LocalLinkBlank, { children: [jsx("a", { href: link, target: "_blank", rel: "noreferrer", children: link }), jsx(LocalLinkCopy, { children: jsx(IconButton, { kind: "copy", onClick: onCopy, children: t("copy", { ns: "dashboard", defaultValue: "Копировать" }) }) })] }) }));
7896
+ return (jsx(Popover, { open: isOpen, zIndex: 10, onRequestClose: toggleOpen, anchorOrigin: "bottom-right", targetOrigin: "top-right", anchor: jsx(LocalLinkButton, { onClick: toggleOpen }), children: jsxs(LocalLinkBlank, { children: [jsx(Link, { href: link, target: "_blank", rel: "noreferrer", style: style, children: link }), jsx(LocalLinkCopy, { children: jsx(IconButton, { kind: "copy", onClick: onCopy, children: t("copy", { ns: "dashboard", defaultValue: "Копировать" }) }) })] }) }));
7898
7897
  });
7899
7898
 
7900
7899
  const ElementLink = memo(({ type, elementConfig }) => {
7901
7900
  const { attributes } = useWidgetContext(type);
7902
- const attribute = getAttributeByName(elementConfig?.attributeName, attributes);
7903
- const link = getResourceUrl(attribute?.value?.toString());
7901
+ const { options, style } = elementConfig || {};
7902
+ const { simple, title } = options || {};
7903
+ const attribute = useMemo(() => getAttributeByName(elementConfig?.attributeName, attributes), [attributes, elementConfig?.attributeName]);
7904
+ const link = useMemo(() => getResourceUrl(attribute?.value?.toString()), [attribute?.value]);
7904
7905
  if (!link)
7905
7906
  return null;
7906
- return link.startsWith("http") ? jsx(ExternalLink, { onClick: () => window.open(link) }) : jsx(LocalLink, { link: link });
7907
+ if (simple) {
7908
+ return (jsx(Link, { href: link, target: "_blank", rel: "noreferrer", style: style, children: title ?? link }));
7909
+ }
7910
+ return link.startsWith("http")
7911
+ ? jsx(ExternalLink, { style: style, onClick: () => window.open(link) })
7912
+ : jsx(LocalLink, { style: style, link: link });
7907
7913
  });
7908
7914
 
7909
7915
  const MarkdownWrapper = styled.div `