@astral/ui 4.110.0 → 4.111.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.
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import type { LinkProps as MuiLinkProps } from '@mui/material/Link';
2
+ import { type ComponentPropsWithRef, type ElementType } from 'react';
3
3
  import { type WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
4
- export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href' | 'className' | 'classes' | 'style' | 'children' | 'key' | 'target'> & {
4
+ export type LinkProps<TComponent extends ElementType = ElementType> = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href' | 'className' | 'classes' | 'style' | 'children' | 'key' | 'target'> & {
5
5
  /**
6
6
  * Добавление иконки
7
7
  */
@@ -20,8 +20,18 @@ export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href
20
20
  * Позволяет переключить цвета ссылки на более контрастные
21
21
  */
22
22
  isContrast?: boolean;
23
- };
24
- export declare const Link: import("react").ForwardRefExoticComponent<Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
23
+ /**
24
+ * Тип элемента
25
+ *
26
+ * @example
27
+ * <Link component={RouterLink} to="/documents">
28
+ * Документы
29
+ * </Link>
30
+ * @default 'a'
31
+ */
32
+ component?: TComponent;
33
+ } & (ElementType extends TComponent ? {} : ComponentPropsWithRef<TComponent>);
34
+ export declare const Link: <TComponent extends ElementType>(props: Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
25
35
  /**
26
36
  * Добавление иконки
27
37
  */
@@ -40,4 +50,14 @@ export declare const Link: import("react").ForwardRefExoticComponent<Pick<Withou
40
50
  * Позволяет переключить цвета ссылки на более контрастные
41
51
  */
42
52
  isContrast?: boolean | undefined;
43
- } & import("react").RefAttributes<HTMLAnchorElement>>;
53
+ /**
54
+ * Тип элемента
55
+ *
56
+ * @example
57
+ * <Link component={RouterLink} to="/documents">
58
+ * Документы
59
+ * </Link>
60
+ * @default 'a'
61
+ */
62
+ component?: TComponent | undefined;
63
+ } & (ElementType extends TComponent ? {} : ComponentPropsWithRef<TComponent>) & import("react").RefAttributes<HTMLAnchorElement>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
3
2
  import { DownloadVOutlineSm } from '../../icons/DownloadVOutlineSm';
4
3
  import { OpenLinkOutlineSm } from '../../icons/OpenLinkOutlineSm';
4
+ import { forwardRefWithGeneric } from '../forwardRefWithGeneric';
5
5
  import { cn } from '../utils/cn';
6
6
  import { cva } from '../utils/cva';
7
7
  import { linkClassnames } from './constants';
@@ -13,7 +13,8 @@ const linkCva = cva(linkClassnames.root, {
13
13
  },
14
14
  },
15
15
  });
16
- export const Link = forwardRef(({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
16
+ const UnwrappedLink = ({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
17
17
  const icon = isDownload ? _jsx(DownloadVOutlineSm, {}) : _jsx(OpenLinkOutlineSm, {});
18
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, {})] }));
19
- });
19
+ };
20
+ export const Link = forwardRefWithGeneric(UnwrappedLink);
@@ -15,6 +15,9 @@ export const MuiOutlinedInput = {
15
15
  '&:hover': {
16
16
  background: theme.palette.background.elementHover,
17
17
  },
18
+ '&:hover .MuiOutlinedInput-input:autofill': {
19
+ boxShadow: `0 0 0 1000px ${theme.palette.background.elementHover} inset`,
20
+ },
18
21
  '&:hover .MuiOutlinedInput-notchedOutline': {
19
22
  borderColor: theme.palette.grey[800],
20
23
  transition: theme.transitions.create(['border-color'], {
@@ -50,7 +53,7 @@ export const MuiOutlinedInput = {
50
53
  ? theme.spacing(1)
51
54
  : theme.spacing(3),
52
55
  '&:autofill': {
53
- boxShadow: '0 0 0 1000px white inset',
56
+ boxShadow: `0 0 0 1000px ${theme.palette.common.white} inset`,
54
57
  },
55
58
  '&::placeholder': {
56
59
  opacity: 1,
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import type { LinkProps as MuiLinkProps } from '@mui/material/Link';
2
+ import { type ComponentPropsWithRef, type ElementType } from 'react';
3
3
  import { type WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
4
- export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href' | 'className' | 'classes' | 'style' | 'children' | 'key' | 'target'> & {
4
+ export type LinkProps<TComponent extends ElementType = ElementType> = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href' | 'className' | 'classes' | 'style' | 'children' | 'key' | 'target'> & {
5
5
  /**
6
6
  * Добавление иконки
7
7
  */
@@ -20,8 +20,18 @@ export type LinkProps = Pick<WithoutEmotionSpecific<MuiLinkProps>, 'rel' | 'href
20
20
  * Позволяет переключить цвета ссылки на более контрастные
21
21
  */
22
22
  isContrast?: boolean;
23
- };
24
- export declare const Link: import("react").ForwardRefExoticComponent<Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
23
+ /**
24
+ * Тип элемента
25
+ *
26
+ * @example
27
+ * <Link component={RouterLink} to="/documents">
28
+ * Документы
29
+ * </Link>
30
+ * @default 'a'
31
+ */
32
+ component?: TComponent;
33
+ } & (ElementType extends TComponent ? {} : ComponentPropsWithRef<TComponent>);
34
+ export declare const Link: <TComponent extends ElementType>(props: Pick<WithoutEmotionSpecific<MuiLinkProps>, "classes" | "className" | "style" | "rel" | "children" | "target" | "href" | "key"> & {
25
35
  /**
26
36
  * Добавление иконки
27
37
  */
@@ -40,4 +50,14 @@ export declare const Link: import("react").ForwardRefExoticComponent<Pick<Withou
40
50
  * Позволяет переключить цвета ссылки на более контрастные
41
51
  */
42
52
  isContrast?: boolean | undefined;
43
- } & import("react").RefAttributes<HTMLAnchorElement>>;
53
+ /**
54
+ * Тип элемента
55
+ *
56
+ * @example
57
+ * <Link component={RouterLink} to="/documents">
58
+ * Документы
59
+ * </Link>
60
+ * @default 'a'
61
+ */
62
+ component?: TComponent | undefined;
63
+ } & (ElementType extends TComponent ? {} : ComponentPropsWithRef<TComponent>) & import("react").RefAttributes<HTMLAnchorElement>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Link = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
5
  const DownloadVOutlineSm_1 = require("../../icons/DownloadVOutlineSm");
7
6
  const OpenLinkOutlineSm_1 = require("../../icons/OpenLinkOutlineSm");
7
+ const forwardRefWithGeneric_1 = require("../forwardRefWithGeneric");
8
8
  const cn_1 = require("../utils/cn");
9
9
  const cva_1 = require("../utils/cva");
10
10
  const constants_1 = require("./constants");
@@ -16,7 +16,8 @@ const linkCva = (0, cva_1.cva)(constants_1.linkClassnames.root, {
16
16
  },
17
17
  },
18
18
  });
19
- exports.Link = (0, react_1.forwardRef)(({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
19
+ const UnwrappedLink = ({ withAdornment, isDownload, downloadFilename, isContrast, children, className, ...props }, ref) => {
20
20
  const icon = isDownload ? (0, jsx_runtime_1.jsx)(DownloadVOutlineSm_1.DownloadVOutlineSm, {}) : (0, jsx_runtime_1.jsx)(OpenLinkOutlineSm_1.OpenLinkOutlineSm, {});
21
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, {})] }));
22
- });
22
+ };
23
+ exports.Link = (0, forwardRefWithGeneric_1.forwardRefWithGeneric)(UnwrappedLink);
@@ -18,6 +18,9 @@ exports.MuiOutlinedInput = {
18
18
  '&:hover': {
19
19
  background: theme.palette.background.elementHover,
20
20
  },
21
+ '&:hover .MuiOutlinedInput-input:autofill': {
22
+ boxShadow: `0 0 0 1000px ${theme.palette.background.elementHover} inset`,
23
+ },
21
24
  '&:hover .MuiOutlinedInput-notchedOutline': {
22
25
  borderColor: theme.palette.grey[800],
23
26
  transition: theme.transitions.create(['border-color'], {
@@ -53,7 +56,7 @@ exports.MuiOutlinedInput = {
53
56
  ? theme.spacing(1)
54
57
  : theme.spacing(3),
55
58
  '&:autofill': {
56
- boxShadow: '0 0 0 1000px white inset',
59
+ boxShadow: `0 0 0 1000px ${theme.palette.common.white} inset`,
57
60
  },
58
61
  '&::placeholder': {
59
62
  opacity: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.110.0",
3
+ "version": "4.111.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {