@hh.ru/magritte-ui-link 4.2.9 → 4.3.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.
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from '@hh.ru/magritte-ui-theme-provider';
2
2
  export * from '@hh.ru/magritte-ui-link/Link';
3
- export { type LinkStyle, type LinkProps } from '@hh.ru/magritte-ui-link/types';
3
+ export { type LinkStyle, type LinkProps, isLinkComponent } from '@hh.ru/magritte-ui-link/types';
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import './index.css';
2
2
  export * from '@hh.ru/magritte-ui-theme-provider';
3
3
  export { Link, LinkForwardRefRenderFunc } from './Link.js';
4
+ export { isLinkComponent } from './types.js';
4
5
  import 'react/jsx-runtime';
5
6
  import 'react';
6
7
  import 'classnames';
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-link",
3
- "version": "4.2.9",
3
+ "version": "4.3.0",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -22,11 +22,11 @@
22
22
  "dependencies": {
23
23
  "@hh.ru/magritte-common-keyboard": "4.0.1",
24
24
  "@hh.ru/magritte-common-use-disabled": "1.0.9",
25
- "@hh.ru/magritte-design-tokens": "18.3.0",
25
+ "@hh.ru/magritte-design-tokens": "18.3.1",
26
26
  "@hh.ru/magritte-types": "4.0.2",
27
- "@hh.ru/magritte-ui-icon": "7.5.0",
28
- "@hh.ru/magritte-ui-theme-provider": "1.1.26",
29
- "@hh.ru/magritte-ui-typography": "3.0.13"
27
+ "@hh.ru/magritte-ui-icon": "7.5.1",
28
+ "@hh.ru/magritte-ui-theme-provider": "1.1.27",
29
+ "@hh.ru/magritte-ui-typography": "3.0.14"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "classnames": ">=2.3.2",
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "2719680c0fbdbc1c92fe4ac0306279e3df74514e"
38
+ "gitHead": "6fb24f3a7bd82fd24cf7374de808e83459686b9c"
39
39
  }
package/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  import { ComponentWithCustomElement, ForwardRefRenderFuncWithCustomElement } from '@hh.ru/magritte-types';
2
3
  import { type IconWrapperComponentSize16, type IconWrapperComponentSize24 } from '@hh.ru/magritte-ui-icon/src/iconTypes';
3
4
  import { TextTypography, HeadersTypography } from '@hh.ru/magritte-ui-typography';
@@ -30,3 +31,4 @@ export interface LinkProps {
30
31
  }
31
32
  export type LinkForwardRefRenderFuncWithCustomElement = ForwardRefRenderFuncWithCustomElement<LinkProps, 'a'>;
32
33
  export type LinkWithCustomElement = ComponentWithCustomElement<LinkProps, 'a'>;
34
+ export declare const isLinkComponent: (component: ReactElement) => component is ReactElement<LinkProps, string | import("react").JSXElementConstructor<any>>;
package/types.js CHANGED
@@ -1,3 +1,9 @@
1
1
  import './index.css';
2
+ import { isValidElement } from 'react';
2
3
 
4
+ const isLinkComponent = (component) => {
5
+ return isValidElement(component) && typeof component.type !== 'string' && 'isLink' in component?.type;
6
+ };
7
+
8
+ export { isLinkComponent };
3
9
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { isValidElement, ReactElement } from 'react';\n\nimport { ComponentWithCustomElement, ForwardRefRenderFuncWithCustomElement } from '@hh.ru/magritte-types';\nimport {\n type IconWrapperComponentSize16,\n type IconWrapperComponentSize24,\n} from '@hh.ru/magritte-ui-icon/src/iconTypes';\nimport { TextTypography, HeadersTypography } from '@hh.ru/magritte-ui-typography';\n\nexport type LinkStyle = 'neutral' | 'accent' | 'positive' | 'negative' | 'warning' | 'contrast';\n\nexport interface LinkProps {\n /** Кастомный элемент для линка */\n Element: 'a' | 'button';\n /** Расположение ссылки в тексте */\n inline?: boolean;\n /** Стиль компонента в зависимости от назначения */\n style?: LinkStyle;\n /** Отображение иконки с левой стороны ссылки */\n iconLeft?: IconWrapperComponentSize16 | IconWrapperComponentSize24;\n /** Отображение иконки с правой стороны ссылки */\n iconRight?: IconWrapperComponentSize16 | IconWrapperComponentSize24;\n /** Ссылка перестает реагировать на любое взаимодействие */\n disabled?: boolean;\n /** Типография */\n typography?: TextTypography | HeadersTypography;\n /** Ссылка */\n href?: string;\n /** Кастомный data-qa для тестирования */\n 'data-qa'?: string;\n /** Вспомогательный лейбл для скринридеров */\n 'aria-label'?: string;\n /** Флаг включения visited состояния */\n enableVisited?: boolean;\n /** Включает подчеркивание */\n underlined?: boolean;\n}\n\nexport type LinkForwardRefRenderFuncWithCustomElement = ForwardRefRenderFuncWithCustomElement<LinkProps, 'a'>;\n\nexport type LinkWithCustomElement = ComponentWithCustomElement<LinkProps, 'a'>;\n\nexport const isLinkComponent = (component: ReactElement): component is ReactElement<LinkProps> => {\n return isValidElement(component) && typeof component.type !== 'string' && 'isLink' in component?.type;\n};\n"],"names":[],"mappings":";;AA0Ca,MAAA,eAAe,GAAG,CAAC,SAAuB,KAA0C;AAC7F,IAAA,OAAO,cAAc,CAAC,SAAS,CAAC,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,IAAI,SAAS,EAAE,IAAI,CAAC;AAC1G;;;;"}