@astral/ui 4.96.0 → 4.97.0

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.
@@ -16,6 +16,10 @@ export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href
16
16
  * добавляет значение атрибуту 'download' тега 'a'
17
17
  */
18
18
  downloadFilename?: string;
19
+ /**
20
+ * Позволяет переключить цвета ссылки на более контрастные
21
+ */
22
+ isContrast?: boolean;
19
23
  };
20
24
  export declare const Link: import("react").ForwardRefExoticComponent<Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
21
25
  /**
@@ -32,4 +36,8 @@ export declare const Link: import("react").ForwardRefExoticComponent<Pick<Withou
32
36
  * добавляет значение атрибуту 'download' тега 'a'
33
37
  */
34
38
  downloadFilename?: string | undefined;
39
+ /**
40
+ * Позволяет переключить цвета ссылки на более контрастные
41
+ */
42
+ isContrast?: boolean | undefined;
35
43
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -2,8 +2,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { DownloadVOutlineSm } from '../../icons/DownloadVOutlineSm';
4
4
  import { OpenLinkOutlineSm } from '../../icons/OpenLinkOutlineSm';
5
+ import { cn } from '../utils/cn';
6
+ import { cva } from '../utils/cva';
7
+ import { linkClassnames } from './constants';
5
8
  import { StyledLink } from './styles';
6
- export const Link = forwardRef(({ withAdornment, isDownload, downloadFilename, children, ...props }, ref) => {
9
+ const linkCva = cva(linkClassnames.root, {
10
+ variants: {
11
+ isContrast: {
12
+ true: linkClassnames.isContrast,
13
+ },
14
+ },
15
+ });
16
+ export const Link = forwardRef(({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
7
17
  const icon = isDownload ? _jsx(DownloadVOutlineSm, {}) : _jsx(OpenLinkOutlineSm, {});
8
- return (_jsxs(StyledLink, { download: downloadFilename ?? isDownload, ref: ref, ...props, children: [withAdornment === 'start' && icon, children, withAdornment === 'end' && icon, !withAdornment && isDownload && _jsx(DownloadVOutlineSm, {})] }));
18
+ return (_jsxs(StyledLink, { download: downloadFilename ?? isDownload, className: cn(linkCva({ isContrast }), className), ref: ref, ...props, children: [withAdornment === 'start' && icon, children, withAdornment === 'end' && icon, !withAdornment && isDownload && _jsx(DownloadVOutlineSm, {})] }));
9
19
  });
@@ -0,0 +1,4 @@
1
+ export declare const linkClassnames: {
2
+ root: string;
3
+ isContrast: string;
4
+ };
@@ -0,0 +1,5 @@
1
+ import { createUIKitClassname } from '../utils/createUIKitClassname';
2
+ export const linkClassnames = {
3
+ root: createUIKitClassname('link'),
4
+ isContrast: createUIKitClassname('link__contrast-color'),
5
+ };
@@ -1 +1,2 @@
1
1
  export { Link, type LinkProps } from './Link';
2
+ export { linkClassnames } from './constants';
@@ -1 +1,2 @@
1
1
  export { Link } from './Link';
2
+ export { linkClassnames } from './constants';
@@ -1 +1,2 @@
1
+ export { linkClassnames } from './constants';
1
2
  export { Link, type LinkProps } from './Link';
@@ -1 +1,2 @@
1
+ export { linkClassnames } from './constants';
1
2
  export { Link } from './Link';
@@ -1,6 +1,7 @@
1
1
  import Link from '@mui/material/Link';
2
2
  import { svgIconClassnames } from '../SvgIcon';
3
3
  import { styled } from '../styled';
4
+ import { linkClassnames } from './constants';
4
5
  export const StyledLink = styled(Link) `
5
6
  display: inline-flex;
6
7
  gap: ${({ theme }) => theme.spacing(1)};
@@ -24,6 +25,22 @@ export const StyledLink = styled(Link) `
24
25
  text-decoration: underline;
25
26
  }
26
27
 
28
+ &.${linkClassnames.isContrast} {
29
+ color: ${({ theme }) => theme.palette.components.link.contrast.main};
30
+
31
+ &:visited {
32
+ color: ${({ theme }) => theme.palette.components.link.contrast.visited};
33
+ }
34
+
35
+ &:hover {
36
+ color: ${({ theme }) => theme.palette.components.link.contrast.hover};
37
+ }
38
+
39
+ &:active {
40
+ color: ${({ theme }) => theme.palette.components.link.active};
41
+ }
42
+ }
43
+
27
44
  &:focus-visible {
28
45
  border-radius: ${({ theme }) => theme.shape.medium};
29
46
  outline: 2px solid ${({ theme }) => theme.palette.components.focused};
@@ -3,5 +3,10 @@ export type LinkColors = {
3
3
  hover: string;
4
4
  visited: string;
5
5
  active: string;
6
+ contrast: {
7
+ main: string;
8
+ hover: string;
9
+ visited: string;
10
+ };
6
11
  };
7
12
  export declare const linkColors: LinkColors;
@@ -3,4 +3,9 @@ export const linkColors = {
3
3
  hover: '#268FF9',
4
4
  visited: '#762376',
5
5
  active: '#072D57',
6
+ contrast: {
7
+ main: '#6EB3F8',
8
+ hover: '#499CEF',
9
+ visited: '#C084FC',
10
+ },
6
11
  };
@@ -16,6 +16,10 @@ export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href
16
16
  * добавляет значение атрибуту 'download' тега 'a'
17
17
  */
18
18
  downloadFilename?: string;
19
+ /**
20
+ * Позволяет переключить цвета ссылки на более контрастные
21
+ */
22
+ isContrast?: boolean;
19
23
  };
20
24
  export declare const Link: import("react").ForwardRefExoticComponent<Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
21
25
  /**
@@ -32,4 +36,8 @@ export declare const Link: import("react").ForwardRefExoticComponent<Pick<Withou
32
36
  * добавляет значение атрибуту 'download' тега 'a'
33
37
  */
34
38
  downloadFilename?: string | undefined;
39
+ /**
40
+ * Позволяет переключить цвета ссылки на более контрастные
41
+ */
42
+ isContrast?: boolean | undefined;
35
43
  } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -5,8 +5,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const DownloadVOutlineSm_1 = require("../../icons/DownloadVOutlineSm");
7
7
  const OpenLinkOutlineSm_1 = require("../../icons/OpenLinkOutlineSm");
8
+ const cn_1 = require("../utils/cn");
9
+ const cva_1 = require("../utils/cva");
10
+ const constants_1 = require("./constants");
8
11
  const styles_1 = require("./styles");
9
- exports.Link = (0, react_1.forwardRef)(({ withAdornment, isDownload, downloadFilename, children, ...props }, ref) => {
12
+ const linkCva = (0, cva_1.cva)(constants_1.linkClassnames.root, {
13
+ variants: {
14
+ isContrast: {
15
+ true: constants_1.linkClassnames.isContrast,
16
+ },
17
+ },
18
+ });
19
+ exports.Link = (0, react_1.forwardRef)(({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
10
20
  const icon = isDownload ? (0, jsx_runtime_1.jsx)(DownloadVOutlineSm_1.DownloadVOutlineSm, {}) : (0, jsx_runtime_1.jsx)(OpenLinkOutlineSm_1.OpenLinkOutlineSm, {});
11
- return ((0, jsx_runtime_1.jsxs)(styles_1.StyledLink, { download: downloadFilename ?? isDownload, ref: ref, ...props, children: [withAdornment === 'start' && icon, children, withAdornment === 'end' && icon, !withAdornment && isDownload && (0, jsx_runtime_1.jsx)(DownloadVOutlineSm_1.DownloadVOutlineSm, {})] }));
21
+ return ((0, jsx_runtime_1.jsxs)(styles_1.StyledLink, { download: downloadFilename ?? isDownload, className: (0, cn_1.cn)(linkCva({ isContrast }), className), ref: ref, ...props, children: [withAdornment === 'start' && icon, children, withAdornment === 'end' && icon, !withAdornment && isDownload && (0, jsx_runtime_1.jsx)(DownloadVOutlineSm_1.DownloadVOutlineSm, {})] }));
12
22
  });
@@ -0,0 +1,4 @@
1
+ export declare const linkClassnames: {
2
+ root: string;
3
+ isContrast: string;
4
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linkClassnames = void 0;
4
+ const createUIKitClassname_1 = require("../utils/createUIKitClassname");
5
+ exports.linkClassnames = {
6
+ root: (0, createUIKitClassname_1.createUIKitClassname)('link'),
7
+ isContrast: (0, createUIKitClassname_1.createUIKitClassname)('link__contrast-color'),
8
+ };
@@ -1 +1,2 @@
1
1
  export { Link, type LinkProps } from './Link';
2
+ export { linkClassnames } from './constants';
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Link = void 0;
3
+ exports.linkClassnames = exports.Link = void 0;
4
4
  var Link_1 = require("./Link");
5
5
  Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
6
+ var constants_1 = require("./constants");
7
+ Object.defineProperty(exports, "linkClassnames", { enumerable: true, get: function () { return constants_1.linkClassnames; } });
@@ -1 +1,2 @@
1
+ export { linkClassnames } from './constants';
1
2
  export { Link, type LinkProps } from './Link';
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Link = void 0;
3
+ exports.Link = exports.linkClassnames = void 0;
4
+ var constants_1 = require("./constants");
5
+ Object.defineProperty(exports, "linkClassnames", { enumerable: true, get: function () { return constants_1.linkClassnames; } });
4
6
  var Link_1 = require("./Link");
5
7
  Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return Link_1.Link; } });
@@ -7,6 +7,7 @@ exports.StyledLink = void 0;
7
7
  const Link_1 = __importDefault(require("@mui/material/Link"));
8
8
  const SvgIcon_1 = require("../SvgIcon");
9
9
  const styled_1 = require("../styled");
10
+ const constants_1 = require("./constants");
10
11
  exports.StyledLink = (0, styled_1.styled)(Link_1.default) `
11
12
  display: inline-flex;
12
13
  gap: ${({ theme }) => theme.spacing(1)};
@@ -30,6 +31,22 @@ exports.StyledLink = (0, styled_1.styled)(Link_1.default) `
30
31
  text-decoration: underline;
31
32
  }
32
33
 
34
+ &.${constants_1.linkClassnames.isContrast} {
35
+ color: ${({ theme }) => theme.palette.components.link.contrast.main};
36
+
37
+ &:visited {
38
+ color: ${({ theme }) => theme.palette.components.link.contrast.visited};
39
+ }
40
+
41
+ &:hover {
42
+ color: ${({ theme }) => theme.palette.components.link.contrast.hover};
43
+ }
44
+
45
+ &:active {
46
+ color: ${({ theme }) => theme.palette.components.link.active};
47
+ }
48
+ }
49
+
33
50
  &:focus-visible {
34
51
  border-radius: ${({ theme }) => theme.shape.medium};
35
52
  outline: 2px solid ${({ theme }) => theme.palette.components.focused};
@@ -3,5 +3,10 @@ export type LinkColors = {
3
3
  hover: string;
4
4
  visited: string;
5
5
  active: string;
6
+ contrast: {
7
+ main: string;
8
+ hover: string;
9
+ visited: string;
10
+ };
6
11
  };
7
12
  export declare const linkColors: LinkColors;
@@ -6,4 +6,9 @@ exports.linkColors = {
6
6
  hover: '#268FF9',
7
7
  visited: '#762376',
8
8
  active: '#072D57',
9
+ contrast: {
10
+ main: '#6EB3F8',
11
+ hover: '#499CEF',
12
+ visited: '#C084FC',
13
+ },
9
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.96.0",
3
+ "version": "4.97.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {