@hh.ru/magritte-ui-button 3.1.14

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 ADDED
@@ -0,0 +1,3 @@
1
+ export { type ButtonStyle, type ButtonMode, type ButtonSize, type ButtonProps, type ButtonLabel, type DefaultButtonProps, } from './types';
2
+ export { Button } from './Button';
3
+ export * from '@hh.ru/magritte-ui-theme-provider';
package/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import './index.css';
2
+ export { Button } from './Button.js';
3
+ export * from '@hh.ru/magritte-ui-theme-provider';
4
+ import 'react/jsx-runtime';
5
+ import 'react';
6
+ import 'classnames';
7
+ import '@hh.ru/magritte-common-use-disabled';
8
+ import '@hh.ru/magritte-ui-badge';
9
+ import './aria.js';
10
+ import '@hh.ru/magritte-ui-counter';
11
+ import '@hh.ru/magritte-ui-loader';
12
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import { ForwardRefExoticComponent } from 'react';
2
+ export * from './types';
3
+ declare const ThemeProvider: any;
4
+ export { ThemeProvider };
5
+ export declare const Button: ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js ADDED
@@ -0,0 +1,11 @@
1
+ import './index.css';
2
+ import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5
+ const { ThemeProvider } = jest.requireActual('@hh.ru/magritte-ui-theme-provider/index');
6
+ const Button = mockComponent('Button', undefined, {
7
+ withChildren: true,
8
+ });
9
+
10
+ export { Button, ThemeProvider };
11
+ //# sourceMappingURL=index.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mock.js","sources":["../src/index.mock.ts"],"sourcesContent":["import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport * from '@hh.ru/magritte-ui-button/types';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst { ThemeProvider } = jest.requireActual('@hh.ru/magritte-ui-theme-provider/index');\n\nexport { ThemeProvider };\n\nexport const Button: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent('Button', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;AAMA;AACM,MAAA,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,yCAAyC,EAAE;MAI3E,MAAM,GAAuD,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE;AACzG,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA;;;;"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@hh.ru/magritte-ui-button",
3
+ "version": "3.1.14",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "sideEffects": [
7
+ "index.css"
8
+ ],
9
+ "scripts": {
10
+ "build": "yarn root:build $(pwd)",
11
+ "build-test-branch": "yarn root:build-test-branch $(pwd)",
12
+ "changelog": "yarn root:changelog $(pwd)",
13
+ "prepack": "yarn root:prepack $(pwd)",
14
+ "postpublish": "yarn root:postpublish $(pwd)",
15
+ "stylelint-test": "yarn root:stylelint-test $(pwd)",
16
+ "eslint-test": "yarn root:eslint-test $(pwd)",
17
+ "ts-config": "yarn root:ts-config $(pwd)",
18
+ "ts-check": "yarn root:ts-check $(pwd)",
19
+ "test": "yarn root:test $(pwd)"
20
+ },
21
+ "dependencies": {
22
+ "@hh.ru/magritte-common-use-disabled": "1.0.8",
23
+ "@hh.ru/magritte-design-tokens": "18.1.1",
24
+ "@hh.ru/magritte-types": "4.0.1",
25
+ "@hh.ru/magritte-ui-badge": "2.1.9",
26
+ "@hh.ru/magritte-ui-breakpoint": "4.0.1",
27
+ "@hh.ru/magritte-ui-counter": "4.0.8",
28
+ "@hh.ru/magritte-ui-loader": "1.2.35",
29
+ "@hh.ru/magritte-ui-mock-component": "1.0.10",
30
+ "@hh.ru/magritte-ui-theme-provider": "1.1.21"
31
+ },
32
+ "peerDependencies": {
33
+ "classnames": ">=2.3.2",
34
+ "react": ">=18.2.0"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "gitHead": "b660dd64fca3eaad5ec44ea9a73f92bb0d9694aa"
40
+ }
package/types.d.ts ADDED
@@ -0,0 +1,84 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { Override, PropsWithElement, PropsWithCustomElement } from '@hh.ru/magritte-types';
3
+ export type ButtonSize = 'small' | 'medium' | 'large';
4
+ export type ButtonMode = 'primary' | 'secondary' | 'tertiary';
5
+ export type ButtonStyle = 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
6
+ export type ButtonLabel = ReactNode;
7
+ interface VariableButtonProps {
8
+ /** Лейбл кнопки для скринридеров, когда основной лейбл скрыт */
9
+ ariaLabel?: string;
10
+ /** Содержимое лейбла кнопки */
11
+ children?: ButtonLabel;
12
+ /** Значение в счетчике */
13
+ counter?: string;
14
+ /** Скрывать ли лейбл */
15
+ hideLabel?: boolean;
16
+ /** Иконка */
17
+ icon?: ReactElement;
18
+ /** Кнопка растянута по ширине контейнера */
19
+ stretched?: boolean;
20
+ /** Подпись под лейблом, отображается только при size = Large или Medium */
21
+ subcaption?: ReactNode;
22
+ }
23
+ interface ButtonElementProps {
24
+ /** Тип компонента по назначению возможные варианты [ButtonMode](#button-mode) */
25
+ mode: ButtonMode;
26
+ /** Стиль компонента в зависимости от назначения */
27
+ style?: ButtonStyle;
28
+ /** Заблокирована ли кнопка */
29
+ disabled?: boolean;
30
+ /** Кастомный компонент 'a', 'button', 'span' или функция */
31
+ Element?: 'a' | 'button' | 'span';
32
+ /** Отображать индикацию загрузки */
33
+ loading?: boolean;
34
+ /** onClick callback */
35
+ onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
36
+ /** Функция для получения DOM элемента кнопки */
37
+ ref?: React.Ref<HTMLElement>;
38
+ /** Определяет физический вертикальный размер компонента. */
39
+ size?: ButtonSize;
40
+ /** Тип кнопки по назначению */
41
+ type?: 'submit' | 'button';
42
+ /** QA атрибут для тестирования */
43
+ 'data-qa'?: string;
44
+ /** Компонент Badge */
45
+ badge?: ReactElement;
46
+ }
47
+ export type DefaultButtonProps = Override<VariableButtonProps, {
48
+ ariaLabel?: never;
49
+ children: ButtonLabel;
50
+ hideLabel?: never;
51
+ icon?: never;
52
+ subcaption?: never;
53
+ }>;
54
+ export type SubcaptionButton = Override<VariableButtonProps, {
55
+ ariaLabel?: never;
56
+ children: ReactNode;
57
+ counter?: never;
58
+ hideLabel?: never;
59
+ icon?: never;
60
+ subcaption: ReactNode;
61
+ }>;
62
+ export type IconButton<IconType, HideLabel> = Override<VariableButtonProps, {
63
+ ariaLabel: string;
64
+ children?: ButtonLabel;
65
+ hideLabel: HideLabel;
66
+ icon: IconType;
67
+ stretched?: never;
68
+ subcaption?: never;
69
+ }>;
70
+ export type LabeledIconButton<IconType, HideLabel> = Override<VariableButtonProps, {
71
+ ariaLabel?: string;
72
+ children: ButtonLabel;
73
+ hideLabel?: HideLabel;
74
+ icon: IconType;
75
+ subcaption?: never;
76
+ }>;
77
+ export type AcceptableButtonPropsSets = SubcaptionButton | IconButton<ReactElement, true> | LabeledIconButton<ReactElement, false> | DefaultButtonProps;
78
+ export type ButtonPropsHelper<IconType, HideLabel> = SubcaptionButton | (IconType extends ReactElement ? HideLabel extends true ? IconButton<IconType, HideLabel> : LabeledIconButton<IconType, HideLabel> : DefaultButtonProps);
79
+ export type ButtonProps = ButtonElementProps & AcceptableButtonPropsSets;
80
+ export interface ButtonWithCustomElement<ComponentProps extends PropsWithElement, DefaultElement extends ComponentProps['Element'] | React.ComponentType<any>> {
81
+ <IconType, HideLabel, ElementType extends any = DefaultElement>(props: ButtonPropsHelper<IconType, HideLabel> & PropsWithCustomElement<ComponentProps, ElementType>): ReturnType<React.FC>;
82
+ displayName?: string;
83
+ }
84
+ export {};
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+
3
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}