@hh.ru/magritte-ui-floating-button 1.0.3 → 1.2.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,3 +1,3 @@
1
- import type { PolymorphicForwardRefRenderFunc } from '@hh.ru/magritte-types';
1
+ import type { PolymorphicComponentWithRef } from '@hh.ru/magritte-types';
2
2
  import type { FloatingButtonProps } from '@hh.ru/magritte-ui-floating-button/types';
3
- export declare const FloatingButton: PolymorphicForwardRefRenderFunc<FloatingButtonProps, 'button'>;
3
+ export declare const FloatingButton: PolymorphicComponentWithRef<FloatingButtonProps, "button">;
package/FloatingButton.js CHANGED
@@ -1,38 +1,74 @@
1
1
  import './index.css';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { forwardRef, useRef, useState, useLayoutEffect } from 'react';
3
4
  import { createPortal } from 'react-dom';
5
+ import { CSSTransition } from 'react-transition-group';
4
6
  import classnames from 'classnames';
5
7
  import { useServerEnv } from '@hh.ru/magritte-common-is-server-env';
8
+ import { ComponentWithBadge } from '@hh.ru/magritte-ui-badge';
9
+ import { Layer } from '@hh.ru/magritte-ui-layer';
6
10
  import { Loader } from '@hh.ru/magritte-ui-loader';
7
11
  import { Text } from '@hh.ru/magritte-ui-typography';
8
12
 
9
- var styles = {"button":"magritte-button___nL-Hn_1-0-3","loading":"magritte-loading___C0oPZ_1-0-3","postfix":"magritte-postfix___r0EZ6_1-0-3","icon":"magritte-icon___VpqJt_1-0-3","label":"magritte-label___EPgvj_1-0-3","border-radius":"magritte-border-radius___ObLLb_1-0-3","borderRadius":"magritte-border-radius___ObLLb_1-0-3","content":"magritte-content___JNpTZ_1-0-3","withLabel":"magritte-withLabel___3gZML_1-0-3","loader":"magritte-loader___EPezG_1-0-3","button_style-neutral":"magritte-button_style-neutral___bPUwu_1-0-3","buttonStyleNeutral":"magritte-button_style-neutral___bPUwu_1-0-3","button_style-inverse":"magritte-button_style-inverse___Xgf26_1-0-3","buttonStyleInverse":"magritte-button_style-inverse___Xgf26_1-0-3"};
13
+ var styles = {"wrapper":"magritte-wrapper___7m9lC_1-2-0","animation-timeout":"magritte-animation-timeout___NL8n0_1-2-0","animationTimeout":"magritte-animation-timeout___NL8n0_1-2-0","button":"magritte-button___nL-Hn_1-2-0","loading":"magritte-loading___C0oPZ_1-2-0","withIconAndLabel":"magritte-withIconAndLabel___Qa-lU_1-2-0","right":"magritte-right___3n0Rz_1-2-0","content":"magritte-content___JNpTZ_1-2-0","left":"magritte-left___GnzU7_1-2-0","center":"magritte-center___MdA40_1-2-0","postfix":"magritte-postfix___r0EZ6_1-2-0","icon":"magritte-icon___VpqJt_1-2-0","textless":"magritte-textless___IbYgp_1-2-0","label":"magritte-label___EPgvj_1-2-0","withPostfix":"magritte-withPostfix___PmQAz_1-2-0","hideLabel":"magritte-hideLabel___K79XM_1-2-0","withLabelOnHover":"magritte-withLabelOnHover___1oktd_1-2-0","border-radius":"magritte-border-radius___ObLLb_1-2-0","borderRadius":"magritte-border-radius___ObLLb_1-2-0","loader":"magritte-loader___EPezG_1-2-0","enter-animation":"magritte-enter-animation___2sPz3_1-2-0","enterAnimation":"magritte-enter-animation___2sPz3_1-2-0","enter-animation-active":"magritte-enter-animation-active___Lq9eq_1-2-0","enterAnimationActive":"magritte-enter-animation-active___Lq9eq_1-2-0","exit-animation":"magritte-exit-animation___h2-7a_1-2-0","exitAnimation":"magritte-exit-animation___h2-7a_1-2-0","exit-animation-active":"magritte-exit-animation-active___w0F1a_1-2-0","exitAnimationActive":"magritte-exit-animation-active___w0F1a_1-2-0","button_style-neutral":"magritte-button_style-neutral___bPUwu_1-2-0","buttonStyleNeutral":"magritte-button_style-neutral___bPUwu_1-2-0","button_style-inverse":"magritte-button_style-inverse___Xgf26_1-2-0","buttonStyleInverse":"magritte-button_style-inverse___Xgf26_1-2-0"};
10
14
 
11
- const FloatingButton = (props) => {
12
- const { Element = 'button', style = 'neutral', disabled, borderRadius, icon: IconComponent, postfix, loading, host, children, className, inlineStyle, } = props;
13
- let additionalAttributes;
15
+ const ALLOWED_BADGE_SIZES = ['small'];
16
+ const FloatingButtonComponent = ({ Element = 'button', style = 'neutral', disabled, borderRadius, icon: IconComponent, postfix, loading, host, children, className, inlineStyle, visible, labelOnHover: _labelOnHover, hideLabel: _hideLabel, badge, position = 'right', 'data-qa': dataQa = 'floating-button', ...restProps }, ref) => {
17
+ const labelOnHover = _labelOnHover && !!IconComponent;
18
+ const hideLabel = _hideLabel && !!IconComponent;
14
19
  const isServerEnv = useServerEnv();
20
+ const wrapperRef = useRef(null);
21
+ const [animationTimeout, setAnimationTimeout] = useState(0);
22
+ const additionalAttributes = {
23
+ 'data-qa': dataQa,
24
+ };
25
+ useLayoutEffect(() => {
26
+ const animationTimeoutElement = document.createElement('div');
27
+ animationTimeoutElement.classList.add(styles.animationTimeout);
28
+ document.body.appendChild(animationTimeoutElement);
29
+ const style = window.getComputedStyle(animationTimeoutElement);
30
+ const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);
31
+ if (Number.isInteger(animationTimeout)) {
32
+ setAnimationTimeout(animationTimeout);
33
+ }
34
+ document.body.removeChild(animationTimeoutElement);
35
+ }, []);
15
36
  if (Element === 'button') {
16
- additionalAttributes = {
17
- type: 'button',
18
- };
37
+ additionalAttributes.type = 'button';
19
38
  }
20
39
  else {
21
- additionalAttributes = {
22
- role: 'button',
23
- tabIndex: disabled ? -1 : 0,
24
- 'aria-disabled': disabled,
25
- };
40
+ additionalAttributes.role = Element !== 'a' ? 'button' : undefined;
41
+ additionalAttributes['aria-disabled'] = disabled;
26
42
  }
43
+ additionalAttributes.ref = ref;
27
44
  if (isServerEnv) {
28
45
  return null;
29
46
  }
30
- return createPortal(jsx(Element, { ...additionalAttributes, disabled: !!disabled, className: classnames(styles.button, styles[`button_style-${style}`], {
31
- [styles.borderRadius]: borderRadius,
32
- [styles.withLabel]: !!children,
33
- [styles.loading]: loading,
34
- }, className), style: inlineStyle, children: jsxs("span", { className: styles.content, children: [IconComponent && (jsx("span", { className: styles.icon, children: jsx(IconComponent, {}) })), children && (jsx("span", { className: styles.label, children: jsx(Text, { typography: 'subtitle-1-semibold', children: children }) })), postfix && (jsx("span", { className: styles.postfix, children: jsx(Text, { typography: 'subtitle-1-semibold', children: postfix }) })), loading && (jsx("span", { className: styles.loader, children: jsx(Loader, { size: 24 }) }))] }) }), host?.current || document.body);
47
+ let button = (jsx(Element, { ...additionalAttributes, ...restProps, disabled: !!disabled, tabIndex: disabled || loading ? -1 : 0, className: classnames(styles.button, styles[`button_style-${style}`], {
48
+ [styles.borderRadius]: !!borderRadius,
49
+ [styles.loading]: !!loading,
50
+ [styles.withLabelOnHover]: !!labelOnHover,
51
+ [styles.hideLabel]: !!hideLabel || !children,
52
+ [styles.withPostfix]: !!postfix,
53
+ [styles.textless]: !postfix && (!children || !!hideLabel),
54
+ [styles.withIconAndLabel]: !!IconComponent && !!children && !hideLabel,
55
+ }), children: jsxs("span", { className: styles.content, children: [IconComponent && (jsx("span", { className: styles.icon, children: jsx(IconComponent, { "data-qa": `${dataQa}-icon` }) })), jsx("span", { className: styles.label, "data-qa": `${dataQa}-label`, children: jsx(Text, { typography: 'subtitle-1-semibold', children: children }) }), postfix && (jsx("span", { className: styles.postfix, "data-qa": `${dataQa}-postfix`, children: jsx(Text, { typography: 'subtitle-1-semibold', children: postfix }) })), loading && (jsx("span", { className: styles.loader, children: jsx(Loader, { size: 24 }) }))] }) }));
56
+ if (badge && !disabled) {
57
+ button = (jsx(ComponentWithBadge, { allowedSizes: ALLOWED_BADGE_SIZES, badge: badge, offset: 4, noClip: true, children: button }));
58
+ }
59
+ if (isServerEnv) {
60
+ return null;
61
+ }
62
+ return createPortal(jsx(CSSTransition, { appear: true, in: !!visible && !isServerEnv, nodeRef: wrapperRef, classNames: {
63
+ appear: styles.enterAnimation,
64
+ appearActive: styles.enterAnimationActive,
65
+ enter: styles.enterAnimation,
66
+ enterActive: styles.enterAnimationActive,
67
+ exit: styles.exitAnimation,
68
+ exitActive: styles.exitAnimationActive,
69
+ }, timeout: animationTimeout, unmountOnExit: true, children: jsx(Layer, { layer: "floating-button", children: jsx("div", { className: classnames(styles.wrapper, styles[`${position}`], className), ref: wrapperRef, style: inlineStyle, "data-qa": `${dataQa}-wrapper`, children: button }) }) }), host?.current || document.body);
35
70
  };
71
+ const FloatingButton = forwardRef(FloatingButtonComponent);
36
72
 
37
73
  export { FloatingButton };
38
74
  //# sourceMappingURL=FloatingButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingButton.js","sources":["../src/FloatingButton.tsx"],"sourcesContent":["import React from 'react';\nimport { createPortal } from 'react-dom';\nimport classnames from 'classnames';\n\nimport { useServerEnv } from '@hh.ru/magritte-common-is-server-env';\nimport type { PolymorphicForwardRefRenderFunc } from '@hh.ru/magritte-types';\nimport type { FloatingButtonProps } from '@hh.ru/magritte-ui-floating-button/types';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './floating-button.less';\n\nexport const FloatingButton: PolymorphicForwardRefRenderFunc<FloatingButtonProps, 'button'> = (props) => {\n const {\n Element = 'button',\n style = 'neutral',\n disabled,\n borderRadius,\n icon: IconComponent,\n postfix,\n loading,\n host,\n children,\n className,\n inlineStyle,\n } = props;\n let additionalAttributes: Record<string, unknown>;\n const isServerEnv = useServerEnv();\n\n if (Element === 'button') {\n additionalAttributes = {\n type: 'button',\n };\n } else {\n additionalAttributes = {\n role: 'button',\n tabIndex: disabled ? -1 : 0,\n 'aria-disabled': disabled,\n };\n }\n\n if (isServerEnv) {\n return null;\n }\n\n return createPortal(\n <Element\n {...additionalAttributes}\n disabled={!!disabled}\n className={classnames(\n styles.button,\n styles[`button_style-${style}`],\n {\n [styles.borderRadius]: borderRadius,\n [styles.withLabel]: !!children,\n [styles.loading]: loading,\n },\n className\n )}\n style={inlineStyle}\n >\n <span className={styles.content}>\n {IconComponent && (\n <span className={styles.icon}>\n <IconComponent />\n </span>\n )}\n {children && (\n <span className={styles.label}>\n <Text typography={'subtitle-1-semibold'}>{children}</Text>\n </span>\n )}\n {postfix && (\n <span className={styles.postfix}>\n <Text typography={'subtitle-1-semibold'}>{postfix}</Text>\n </span>\n )}\n {loading && (\n <span className={styles.loader}>\n <Loader size={24} />\n </span>\n )}\n </span>\n </Element>,\n host?.current || document.body\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAYa,MAAA,cAAc,GAAmE,CAAC,KAAK,KAAI;AACpG,IAAA,MAAM,EACF,OAAO,GAAG,QAAQ,EAClB,KAAK,GAAG,SAAS,EACjB,QAAQ,EACR,YAAY,EACZ,IAAI,EAAE,aAAa,EACnB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,GACd,GAAG,KAAK,CAAC;AACV,IAAA,IAAI,oBAA6C,CAAC;AAClD,IAAA,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AAEnC,IAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;AACtB,QAAA,oBAAoB,GAAG;AACnB,YAAA,IAAI,EAAE,QAAQ;SACjB,CAAC;KACL;SAAM;AACH,QAAA,oBAAoB,GAAG;AACnB,YAAA,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;AAC3B,YAAA,eAAe,EAAE,QAAQ;SAC5B,CAAC;KACL;IAED,IAAI,WAAW,EAAE;AACb,QAAA,OAAO,IAAI,CAAC;KACf;IAED,OAAO,YAAY,CACfA,GAAA,CAAC,OAAO,EAAA,EAAA,GACA,oBAAoB,EACxB,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,SAAS,EAAE,UAAU,CACjB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,CAAgB,aAAA,EAAA,KAAK,CAAE,CAAA,CAAC,EAC/B;AACI,YAAA,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY;AACnC,YAAA,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,QAAQ;AAC9B,YAAA,CAAC,MAAM,CAAC,OAAO,GAAG,OAAO;SAC5B,EACD,SAAS,CACZ,EACD,KAAK,EAAE,WAAW,EAAA,QAAA,EAElBC,IAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,OAAO,EAAA,QAAA,EAAA,CAC1B,aAAa,KACVD,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,MAAM,CAAC,IAAI,EACxB,QAAA,EAAAA,GAAA,CAAC,aAAa,EAAG,EAAA,CAAA,EAAA,CACd,CACV,EACA,QAAQ,KACLA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,MAAM,CAAC,KAAK,EACzB,QAAA,EAAAA,GAAA,CAAC,IAAI,EAAA,EAAC,UAAU,EAAE,qBAAqB,EAAG,QAAA,EAAA,QAAQ,EAAQ,CAAA,EAAA,CACvD,CACV,EACA,OAAO,KACJA,cAAM,SAAS,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAA,EAAAA,GAAA,CAAC,IAAI,EAAA,EAAC,UAAU,EAAE,qBAAqB,EAAG,QAAA,EAAA,OAAO,EAAQ,CAAA,EAAA,CACtD,CACV,EACA,OAAO,KACJA,GAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,MAAM,EAC1B,QAAA,EAAAA,GAAA,CAAC,MAAM,EAAC,EAAA,IAAI,EAAE,EAAE,EAAI,CAAA,EAAA,CACjB,CACV,CACE,EAAA,CAAA,EAAA,CACD,EACV,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC,IAAI,CACjC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"FloatingButton.js","sources":["../src/FloatingButton.tsx"],"sourcesContent":["import React, { forwardRef, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { useServerEnv } from '@hh.ru/magritte-common-is-server-env';\nimport type { PolymorphicComponentWithRef, PolymorphicForwardRefRenderFunc } from '@hh.ru/magritte-types';\nimport { BadgeSize, ComponentWithBadge } from '@hh.ru/magritte-ui-badge';\nimport type { FloatingButtonProps } from '@hh.ru/magritte-ui-floating-button/types';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './floating-button.less';\n\nconst ALLOWED_BADGE_SIZES: BadgeSize[] = ['small'];\n\nconst FloatingButtonComponent: PolymorphicForwardRefRenderFunc<FloatingButtonProps, 'button'> = (\n {\n Element = 'button',\n style = 'neutral',\n disabled,\n borderRadius,\n icon: IconComponent,\n postfix,\n loading,\n host,\n children,\n className,\n inlineStyle,\n visible,\n labelOnHover: _labelOnHover,\n hideLabel: _hideLabel,\n badge,\n position = 'right',\n 'data-qa': dataQa = 'floating-button',\n ...restProps\n },\n ref\n) => {\n const labelOnHover = _labelOnHover && !!IconComponent;\n const hideLabel = _hideLabel && !!IconComponent;\n const isServerEnv = useServerEnv();\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [animationTimeout, setAnimationTimeout] = useState(0);\n\n const additionalAttributes: Record<string, unknown> = {\n 'data-qa': dataQa,\n };\n\n useLayoutEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.animationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);\n if (Number.isInteger(animationTimeout)) {\n setAnimationTimeout(animationTimeout);\n }\n document.body.removeChild(animationTimeoutElement);\n }, []);\n\n if (Element === 'button') {\n additionalAttributes.type = 'button';\n } else {\n additionalAttributes.role = Element !== 'a' ? 'button' : undefined;\n additionalAttributes['aria-disabled'] = disabled;\n }\n\n additionalAttributes.ref = ref;\n\n if (isServerEnv) {\n return null;\n }\n let button = (\n <Element\n {...additionalAttributes}\n {...restProps}\n disabled={!!disabled}\n tabIndex={disabled || loading ? -1 : 0}\n className={classnames(styles.button, styles[`button_style-${style}`], {\n [styles.borderRadius]: !!borderRadius,\n [styles.loading]: !!loading,\n [styles.withLabelOnHover]: !!labelOnHover,\n [styles.hideLabel]: !!hideLabel || !children,\n [styles.withPostfix]: !!postfix,\n [styles.textless]: !postfix && (!children || !!hideLabel),\n [styles.withIconAndLabel]: !!IconComponent && !!children && !hideLabel,\n })}\n >\n <span className={styles.content}>\n {IconComponent && (\n <span className={styles.icon}>\n <IconComponent data-qa={`${dataQa}-icon`} />\n </span>\n )}\n <span className={styles.label} data-qa={`${dataQa}-label`}>\n <Text typography={'subtitle-1-semibold'}>{children}</Text>\n </span>\n {postfix && (\n <span className={styles.postfix} data-qa={`${dataQa}-postfix`}>\n <Text typography={'subtitle-1-semibold'}>{postfix}</Text>\n </span>\n )}\n\n {loading && (\n <span className={styles.loader}>\n <Loader size={24} />\n </span>\n )}\n </span>\n </Element>\n );\n\n if (badge && !disabled) {\n button = (\n <ComponentWithBadge allowedSizes={ALLOWED_BADGE_SIZES} badge={badge} offset={4} noClip>\n {button}\n </ComponentWithBadge>\n );\n }\n\n if (isServerEnv) {\n return null;\n }\n\n return createPortal(\n <CSSTransition\n appear\n in={!!visible && !isServerEnv}\n nodeRef={wrapperRef}\n classNames={{\n appear: styles.enterAnimation,\n appearActive: styles.enterAnimationActive,\n enter: styles.enterAnimation,\n enterActive: styles.enterAnimationActive,\n exit: styles.exitAnimation,\n exitActive: styles.exitAnimationActive,\n }}\n timeout={animationTimeout}\n unmountOnExit\n >\n <Layer layer=\"floating-button\">\n <div\n className={classnames(styles.wrapper, styles[`${position}`], className)}\n ref={wrapperRef}\n style={inlineStyle}\n data-qa={`${dataQa}-wrapper`}\n >\n {button}\n </div>\n </Layer>\n </CSSTransition>,\n host?.current || document.body\n );\n};\n\nexport const FloatingButton = forwardRef(FloatingButtonComponent) as PolymorphicComponentWithRef<\n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HANGED
@@ -37,6 +37,15 @@
37
37
  --magritte-shadow-level-1-spread-v23-2-2:0px;
38
38
  }
39
39
 
40
+ :root{
41
+ --magritte-semantic-animation-time-s-duration-v23-2-2:200ms;
42
+ --magritte-semantic-animation-ease-base-timing-function-v23-2-2:cubic-bezier(0.4, 0.24, 0, 1);
43
+ --magritte-semantic-animation-ease-in-out-100-timing-function-v23-2-2:cubic-bezier(0.25, 0.1, 0.25, 1);
44
+ --magritte-semantic-animation-ease-in-out-100-duration-v23-2-2:100ms;
45
+ --magritte-semantic-animation-ease-in-out-200-timing-function-v23-2-2:cubic-bezier(0.25, 0.1, 0.25, 1);
46
+ --magritte-semantic-animation-ease-in-out-200-duration-v23-2-2:200ms;
47
+ }
48
+
40
49
  .magritte-night-theme{
41
50
  --magritte-color-component-button-background-neutral-v23-2-2:#ffffff;
42
51
  --magritte-color-component-button-background-inverse-v23-2-2:#303030;
@@ -65,57 +74,195 @@
65
74
  --magritte-shadow-level-2-color-v23-2-2:#0000003d;
66
75
  --magritte-shadow-level-1-color-v23-2-2:#00000029;
67
76
  }
68
- .magritte-button___nL-Hn_1-0-3{
77
+ .magritte-wrapper___7m9lC_1-2-0{
78
+ display:inline-block;
79
+ position:fixed;
80
+ }
81
+ .magritte-wrapper___7m9lC_1-2-0,
82
+ .magritte-animation-timeout___NL8n0_1-2-0{
83
+ --animation-duration:0;
84
+ }
85
+ @media (prefers-reduced-motion: no-preference){
86
+ .magritte-wrapper___7m9lC_1-2-0,
87
+ .magritte-animation-timeout___NL8n0_1-2-0{
88
+ --animation-duration:var(--magritte-semantic-animation-time-s-duration-v23-2-2);
89
+ }
90
+ }
91
+ .magritte-button___nL-Hn_1-2-0{
69
92
  display:inline-block;
70
93
  padding:12px;
71
94
  border-radius:24px;
72
- position:fixed;
95
+ transition-property:transform;
96
+ transition-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v23-2-2);
97
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v23-2-2);
98
+ }
99
+ .magritte-button___nL-Hn_1-2-0:disabled,
100
+ .magritte-button___nL-Hn_1-2-0[aria-disabled='true'],
101
+ .magritte-button___nL-Hn_1-2-0.magritte-loading___C0oPZ_1-2-0{
102
+ pointer-events:none;
103
+ cursor:not-allowed;
104
+ }
105
+ .magritte-button___nL-Hn_1-2-0:not(:disabled):active,
106
+ .magritte-button___nL-Hn_1-2-0:not([aria-disabled='true']):active{
107
+ transform:scale(0.96);
108
+ transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v23-2-2);
109
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v23-2-2);
110
+ }
111
+ .magritte-withIconAndLabel___Qa-lU_1-2-0{
112
+ padding:12px 16px;
113
+ }
114
+ .magritte-right___3n0Rz_1-2-0{
73
115
  right:16px;
74
116
  bottom:20px;
75
117
  }
76
118
  @media (min-width: 1020px){
77
- body.magritte-old-layout .magritte-button___nL-Hn_1-0-3{
119
+ body.magritte-old-layout .magritte-right___3n0Rz_1-2-0{
78
120
  right:36px;
79
121
  bottom:32px;
80
122
  }
81
123
  }
82
124
  @media (min-width: 1024px){
83
- body:not(.magritte-old-layout) .magritte-button___nL-Hn_1-0-3{
125
+ body:not(.magritte-old-layout) .magritte-right___3n0Rz_1-2-0{
84
126
  right:36px;
85
127
  bottom:32px;
86
128
  }
87
129
  }
88
- .magritte-button___nL-Hn_1-0-3:disabled,
89
- .magritte-button___nL-Hn_1-0-3.magritte-loading___C0oPZ_1-0-3{
90
- pointer-events:none;
91
- cursor:not-allowed;
130
+ .magritte-right___3n0Rz_1-2-0 .magritte-content___JNpTZ_1-2-0{
131
+ justify-content:end;
92
132
  }
93
- .magritte-loading___C0oPZ_1-0-3 .magritte-postfix___r0EZ6_1-0-3,
94
- .magritte-loading___C0oPZ_1-0-3 .magritte-icon___VpqJt_1-0-3,
95
- .magritte-loading___C0oPZ_1-0-3 .magritte-label___EPgvj_1-0-3{
96
- visibility:hidden;
133
+ .magritte-left___GnzU7_1-2-0{
134
+ left:16px;
135
+ bottom:20px;
97
136
  }
98
- .magritte-border-radius___ObLLb_1-0-3{
99
- border-radius:12px;
137
+ @media (min-width: 1020px){
138
+ body.magritte-old-layout .magritte-left___GnzU7_1-2-0{
139
+ left:36px;
140
+ bottom:32px;
141
+ }
142
+ }
143
+ @media (min-width: 1024px){
144
+ body:not(.magritte-old-layout) .magritte-left___GnzU7_1-2-0{
145
+ left:36px;
146
+ bottom:32px;
147
+ }
148
+ }
149
+ .magritte-left___GnzU7_1-2-0 .magritte-content___JNpTZ_1-2-0{
150
+ justify-content:start;
151
+ }
152
+ .magritte-center___MdA40_1-2-0{
153
+ left:50%;
154
+ bottom:20px;
155
+ transform:translateX(-50%);
156
+ }
157
+ @media (min-width: 1020px){
158
+ body.magritte-old-layout .magritte-center___MdA40_1-2-0{
159
+ bottom:32px;
160
+ }
161
+ }
162
+ @media (min-width: 1024px){
163
+ body:not(.magritte-old-layout) .magritte-center___MdA40_1-2-0{
164
+ bottom:32px;
165
+ }
166
+ }
167
+ .magritte-center___MdA40_1-2-0 .magritte-content___JNpTZ_1-2-0{
168
+ justify-content:space-between;
169
+ }
170
+ .magritte-postfix___r0EZ6_1-2-0{
171
+ padding:0 4px;
100
172
  }
101
- .magritte-content___JNpTZ_1-0-3{
102
- display:flex;
103
- position:relative;
173
+ .magritte-icon___VpqJt_1-2-0{
174
+ margin-right:4px;
104
175
  }
105
- .magritte-withLabel___3gZML_1-0-3 .magritte-icon___VpqJt_1-0-3{
106
- padding-left:4px;
176
+ .magritte-textless___IbYgp_1-2-0 .magritte-icon___VpqJt_1-2-0{
177
+ margin:0;
107
178
  }
108
- .magritte-label___EPgvj_1-0-3{
109
- padding:1px 4px;
179
+ .magritte-label___EPgvj_1-2-0{
180
+ text-align:left;
181
+ overflow:hidden;
182
+ transition-property:padding;
183
+ transition-duration:var(--animation-duration);
184
+ transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
185
+ padding:0 4px;
186
+ }
187
+ .magritte-content___JNpTZ_1-2-0{
188
+ display:inline-grid;
189
+ justify-content:flex-end;
190
+ grid-template-columns:max-content 1fr;
191
+ transition-property:grid-template-columns;
192
+ min-height:24px;
193
+ transition-duration:var(--animation-duration);
194
+ transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
195
+ }
196
+ .magritte-withPostfix___PmQAz_1-2-0 .magritte-content___JNpTZ_1-2-0{
197
+ grid-template-columns:max-content 1fr max-content;
110
198
  }
111
- .magritte-postfix___r0EZ6_1-0-3{
112
- padding:1px 4px;
199
+ .magritte-hideLabel___K79XM_1-2-0 .magritte-content___JNpTZ_1-2-0{
200
+ grid-template-columns:max-content 0fr;
113
201
  }
114
- .magritte-icon___VpqJt_1-0-3 + .magritte-label___EPgvj_1-0-3,
115
- .magritte-icon___VpqJt_1-0-3 + .magritte-postfix___r0EZ6_1-0-3{
116
- padding-left:8px;
202
+ .magritte-hideLabel___K79XM_1-2-0 .magritte-label___EPgvj_1-2-0{
203
+ padding:0;
117
204
  }
118
- .magritte-loader___EPezG_1-0-3{
205
+ .magritte-hideLabel___K79XM_1-2-0.magritte-withPostfix___PmQAz_1-2-0 .magritte-content___JNpTZ_1-2-0{
206
+ grid-template-columns:max-content 0fr max-content;
207
+ }
208
+ .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0).magritte-withIconAndLabel___Qa-lU_1-2-0{
209
+ padding:12px;
210
+ }
211
+ .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):not(.magritte-withPostfix___PmQAz_1-2-0) .magritte-icon___VpqJt_1-2-0{
212
+ margin:0;
213
+ }
214
+ .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0) .magritte-content___JNpTZ_1-2-0{
215
+ grid-template-columns:max-content 0fr;
216
+ }
217
+ .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0).magritte-withPostfix___PmQAz_1-2-0 .magritte-content___JNpTZ_1-2-0{
218
+ grid-template-columns:max-content 0fr max-content;
219
+ }
220
+ .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0) .magritte-label___EPgvj_1-2-0{
221
+ padding:0;
222
+ }
223
+ @media (min-width: 1020px){
224
+ body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']).magritte-withIconAndLabel___Qa-lU_1-2-0{
225
+ padding:12px 16px;
226
+ }
227
+ body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-icon___VpqJt_1-2-0{
228
+ margin-right:4px;
229
+ }
230
+ body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-content___JNpTZ_1-2-0{
231
+ grid-template-columns:max-content 1fr;
232
+ }
233
+ body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']).magritte-withPostfix___PmQAz_1-2-0 .magritte-content___JNpTZ_1-2-0{
234
+ grid-template-columns:max-content 1fr max-content;
235
+ }
236
+ body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-label___EPgvj_1-2-0{
237
+ padding:0 4px;
238
+ }
239
+ }
240
+ @media (min-width: 1024px){
241
+ body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']).magritte-withIconAndLabel___Qa-lU_1-2-0{
242
+ padding:12px 16px;
243
+ }
244
+ body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-icon___VpqJt_1-2-0{
245
+ margin-right:4px;
246
+ }
247
+ body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-content___JNpTZ_1-2-0{
248
+ grid-template-columns:max-content 1fr;
249
+ }
250
+ body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']).magritte-withPostfix___PmQAz_1-2-0 .magritte-content___JNpTZ_1-2-0{
251
+ grid-template-columns:max-content 1fr max-content;
252
+ }
253
+ body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-0:not(.magritte-hideLabel___K79XM_1-2-0):hover:not(:disabled):not([aria-disabled='true']) .magritte-label___EPgvj_1-2-0{
254
+ padding:0 4px;
255
+ }
256
+ }
257
+ .magritte-loading___C0oPZ_1-2-0 .magritte-postfix___r0EZ6_1-2-0,
258
+ .magritte-loading___C0oPZ_1-2-0 .magritte-icon___VpqJt_1-2-0,
259
+ .magritte-loading___C0oPZ_1-2-0 .magritte-label___EPgvj_1-2-0{
260
+ visibility:hidden;
261
+ }
262
+ .magritte-border-radius___ObLLb_1-2-0{
263
+ border-radius:12px;
264
+ }
265
+ .magritte-loader___EPezG_1-2-0{
119
266
  position:absolute;
120
267
  left:50%;
121
268
  top:50%;
@@ -123,73 +270,97 @@
123
270
  line-height:0;
124
271
  overflow:hidden;
125
272
  }
126
- .magritte-button_style-neutral___bPUwu_1-0-3{
273
+ .magritte-enter-animation___2sPz3_1-2-0{
274
+ opacity:0;
275
+ }
276
+ .magritte-enter-animation-active___Lq9eq_1-2-0{
277
+ opacity:1;
278
+ transition-property:opacity;
279
+ transition-duration:var(--animation-duration);
280
+ transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
281
+ }
282
+ .magritte-exit-animation___h2-7a_1-2-0{
283
+ opacity:1;
284
+ }
285
+ .magritte-exit-animation-active___w0F1a_1-2-0{
286
+ opacity:0;
287
+ transition-property:opacity;
288
+ transition-duration:var(--animation-duration);
289
+ transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
290
+ }
291
+ .magritte-button_style-neutral___bPUwu_1-2-0{
127
292
  background:var(--magritte-color-component-button-background-neutral-v23-2-2);
128
293
  --magritte-ui-text-color-override:var(--magritte-color-component-button-text-neutral-v23-2-2);
129
294
  --magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-neutral-v23-2-2);
130
295
  box-shadow:var(--magritte-shadow-level-2-x-v23-2-2) var(--magritte-shadow-level-2-y-v23-2-2) var(--magritte-shadow-level-2-blur-v23-2-2) var(--magritte-shadow-level-2-spread-v23-2-2) var(--magritte-shadow-level-2-color-v23-2-2);
131
296
  --magritte-ui-loader-color-override:var(--magritte-color-component-button-loader-icon-neutral-v23-2-2);
132
297
  }
133
- .magritte-button_style-neutral___bPUwu_1-0-3 .magritte-postfix___r0EZ6_1-0-3{
298
+ .magritte-button_style-neutral___bPUwu_1-2-0 .magritte-postfix___r0EZ6_1-2-0{
134
299
  --magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-neutral-v23-2-2);
135
300
  }
136
- .magritte-button_style-neutral___bPUwu_1-0-3.focus-visible{
301
+ .magritte-button_style-neutral___bPUwu_1-2-0.focus-visible{
137
302
  outline:4px solid var(--magritte-color-component-button-stroke-state-neutral-focused-accessible-v23-2-2);
138
303
  background:var(--magritte-color-component-button-background-state-neutral-focused-v23-2-2);
139
304
  }
140
- .magritte-button_style-neutral___bPUwu_1-0-3:not(:disabled):active{
305
+ .magritte-button_style-neutral___bPUwu_1-2-0:not(:disabled):active,
306
+ .magritte-button_style-neutral___bPUwu_1-2-0:not([aria-disabled='true']):active{
141
307
  background:var(--magritte-color-component-button-background-state-neutral-pressed-v23-2-2);
142
308
  }
143
- .magritte-button_style-neutral___bPUwu_1-0-3:disabled{
309
+ .magritte-button_style-neutral___bPUwu_1-2-0:disabled,
310
+ .magritte-button_style-neutral___bPUwu_1-2-0[aria-disabled='true']{
144
311
  background:var(--magritte-color-component-button-background-state-neutral-disabled-v23-2-2);
145
312
  --magritte-ui-text-color-override:var(--magritte-color-component-button-text-state-neutral-disabled-v23-2-2);
146
313
  --magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-state-neutral-disabled-v23-2-2);
147
314
  }
148
- .magritte-button_style-neutral___bPUwu_1-0-3:disabled .magritte-postfix___r0EZ6_1-0-3{
315
+ .magritte-button_style-neutral___bPUwu_1-2-0:disabled .magritte-postfix___r0EZ6_1-2-0,
316
+ .magritte-button_style-neutral___bPUwu_1-2-0[aria-disabled='true'] .magritte-postfix___r0EZ6_1-2-0{
149
317
  --magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-state-neutral-disabled-v23-2-2);
150
318
  }
151
319
  @media (min-width: 1020px){
152
- body.magritte-old-layout .magritte-button_style-neutral___bPUwu_1-0-3:hover:not(:active):not(:disabled):not([aria-disabled='true']){
320
+ body.magritte-old-layout .magritte-button_style-neutral___bPUwu_1-2-0:hover:not(:active):not(:disabled):not([aria-disabled='true']){
153
321
  background:var(--magritte-color-component-button-background-state-neutral-hovered-v23-2-2);
154
322
  }
155
323
  }
156
324
  @media (min-width: 1024px){
157
- body:not(.magritte-old-layout) .magritte-button_style-neutral___bPUwu_1-0-3:hover:not(:active):not(:disabled):not([aria-disabled='true']){
325
+ body:not(.magritte-old-layout) .magritte-button_style-neutral___bPUwu_1-2-0:hover:not(:active):not(:disabled):not([aria-disabled='true']){
158
326
  background:var(--magritte-color-component-button-background-state-neutral-hovered-v23-2-2);
159
327
  }
160
328
  }
161
- .magritte-button_style-inverse___Xgf26_1-0-3{
329
+ .magritte-button_style-inverse___Xgf26_1-2-0{
162
330
  background:var(--magritte-color-component-button-background-inverse-v23-2-2);
163
331
  --magritte-ui-text-color-override:var(--magritte-color-component-button-text-inverse-v23-2-2);
164
332
  --magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-inverse-v23-2-2);
165
333
  box-shadow:var(--magritte-shadow-level-1-x-v23-2-2) var(--magritte-shadow-level-1-y-v23-2-2) var(--magritte-shadow-level-1-blur-v23-2-2) var(--magritte-shadow-level-1-spread-v23-2-2) var(--magritte-shadow-level-1-color-v23-2-2);
166
334
  --magritte-ui-loader-color-override:var(--magritte-color-component-button-loader-icon-inverse-v23-2-2);
167
335
  }
168
- .magritte-button_style-inverse___Xgf26_1-0-3 .magritte-postfix___r0EZ6_1-0-3{
336
+ .magritte-button_style-inverse___Xgf26_1-2-0 .magritte-postfix___r0EZ6_1-2-0{
169
337
  --magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-inverse-v23-2-2);
170
338
  }
171
- .magritte-button_style-inverse___Xgf26_1-0-3.focus-visible{
339
+ .magritte-button_style-inverse___Xgf26_1-2-0.focus-visible{
172
340
  outline:4px solid var(--magritte-color-component-button-stroke-state-inverse-focused-accessible-v23-2-2);
173
341
  background:var(--magritte-color-component-button-background-state-inverse-focused-v23-2-2);
174
342
  }
175
- .magritte-button_style-inverse___Xgf26_1-0-3:not(:disabled):active{
343
+ .magritte-button_style-inverse___Xgf26_1-2-0:not(:disabled):active,
344
+ .magritte-button_style-inverse___Xgf26_1-2-0:not([aria-disabled='true']):active{
176
345
  background:var(--magritte-color-component-button-background-state-inverse-pressed-v23-2-2);
177
346
  }
178
- .magritte-button_style-inverse___Xgf26_1-0-3:disabled{
347
+ .magritte-button_style-inverse___Xgf26_1-2-0:disabled,
348
+ .magritte-button_style-inverse___Xgf26_1-2-0[aria-disabled='true']{
179
349
  background:var(--magritte-color-component-button-background-state-inverse-disabled-v23-2-2);
180
350
  --magritte-ui-text-color-override:var(--magritte-color-component-button-text-state-inverse-disabled-v23-2-2);
181
351
  --magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-state-inverse-disabled-v23-2-2);
182
352
  }
183
- .magritte-button_style-inverse___Xgf26_1-0-3:disabled .magritte-postfix___r0EZ6_1-0-3{
353
+ .magritte-button_style-inverse___Xgf26_1-2-0:disabled .magritte-postfix___r0EZ6_1-2-0,
354
+ .magritte-button_style-inverse___Xgf26_1-2-0[aria-disabled='true'] .magritte-postfix___r0EZ6_1-2-0{
184
355
  --magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-state-inverse-disabled-v23-2-2);
185
356
  }
186
357
  @media (min-width: 1020px){
187
- body.magritte-old-layout .magritte-button_style-inverse___Xgf26_1-0-3:hover:not(:active):not(:disabled):not([aria-disabled='true']){
358
+ body.magritte-old-layout .magritte-button_style-inverse___Xgf26_1-2-0:hover:not(:active):not(:disabled):not([aria-disabled='true']){
188
359
  background:var(--magritte-color-component-button-background-state-inverse-hovered-v23-2-2);
189
360
  }
190
361
  }
191
362
  @media (min-width: 1024px){
192
- body:not(.magritte-old-layout) .magritte-button_style-inverse___Xgf26_1-0-3:hover:not(:active):not(:disabled):not([aria-disabled='true']){
363
+ body:not(.magritte-old-layout) .magritte-button_style-inverse___Xgf26_1-2-0:hover:not(:active):not(:disabled):not([aria-disabled='true']){
193
364
  background:var(--magritte-color-component-button-background-state-inverse-hovered-v23-2-2);
194
365
  }
195
366
  }
package/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import './index.css';
2
2
  export { FloatingButton } from './FloatingButton.js';
3
3
  import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import 'react-dom';
6
+ import 'react-transition-group';
5
7
  import 'classnames';
6
8
  import '@hh.ru/magritte-common-is-server-env';
9
+ import '@hh.ru/magritte-ui-badge';
10
+ import '@hh.ru/magritte-ui-layer';
7
11
  import '@hh.ru/magritte-ui-loader';
8
12
  import '@hh.ru/magritte-ui-typography';
9
13
  //# sourceMappingURL=index.js.map
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":";;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export * from '@hh.ru/magritte-ui-floating-button/types';
2
+ export declare const FloatingButton: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js ADDED
@@ -0,0 +1,9 @@
1
+ import './index.css';
2
+ import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+
4
+ const FloatingButton = mockComponent('FloatingButton', undefined, {
5
+ withChildren: true,
6
+ });
7
+
8
+ export { FloatingButton };
9
+ //# sourceMappingURL=index.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mock.js","sources":["../src/index.mock.ts"],"sourcesContent":["import { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport * from '@hh.ru/magritte-ui-floating-button/types';\n\nexport const FloatingButton = mockComponent('FloatingButton', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;MAIa,cAAc,GAAG,aAAa,CAAC,gBAAgB,EAAE,SAAS,EAAE;AACrE,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-floating-button",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -22,18 +22,21 @@
22
22
  "@hh.ru/magritte-common-is-server-env": "1.0.7",
23
23
  "@hh.ru/magritte-design-tokens": "23.2.2",
24
24
  "@hh.ru/magritte-types": "5.0.4",
25
- "@hh.ru/magritte-ui-badge": "3.1.4",
25
+ "@hh.ru/magritte-ui-badge": "3.2.0",
26
26
  "@hh.ru/magritte-ui-breakpoint": "6.0.1",
27
- "@hh.ru/magritte-ui-loader": "2.0.8",
27
+ "@hh.ru/magritte-ui-layer": "3.0.4",
28
+ "@hh.ru/magritte-ui-loader": "2.0.9",
29
+ "@hh.ru/magritte-ui-mock-component": "1.1.5",
28
30
  "@hh.ru/magritte-ui-typography": "4.2.3"
29
31
  },
30
32
  "peerDependencies": {
31
33
  "classnames": ">=2.3.2",
32
34
  "react": ">=18.2.0",
33
- "react-dom": ">=18.2.0"
35
+ "react-dom": ">=18.2.0",
36
+ "react-transition-group": ">=4.4.5"
34
37
  },
35
38
  "publishConfig": {
36
39
  "access": "public"
37
40
  },
38
- "gitHead": "b2ab15b73592666625ff3b84e10f3cc1bcee9cbc"
41
+ "gitHead": "f11d50914c03d4a4f9395fc61e4ca80c5ea9c5e1"
39
42
  }
package/types.d.ts CHANGED
@@ -1,25 +1,35 @@
1
1
  import { CSSProperties, PropsWithChildren, ReactElement, ReactNode, type RefObject } from 'react';
2
2
  import { IconWrapperComponentSize24 } from '@hh.ru/magritte-ui-icon';
3
3
  export type FloatingButtonStyle = 'neutral' | 'inverse';
4
+ export type FloatingButtonPosition = 'left' | 'right' | 'center';
4
5
  export interface FloatingButtonProps extends PropsWithChildren {
5
6
  /** Кастомный компонент 'a', 'button', 'span' или функция */
6
7
  Element?: 'a' | 'button' | 'span';
7
8
  style?: FloatingButtonStyle;
9
+ /** Флаг видимости **/
10
+ visible?: boolean;
11
+ /** Заблокирована ли кнопка */
12
+ disabled?: boolean;
13
+ /** Отображение индикации загрузки */
14
+ loading?: boolean;
8
15
  icon?: IconWrapperComponentSize24;
16
+ /** Постфикс */
17
+ postfix?: ReactNode;
18
+ /** Показывать ли лейбл только при ховере */
19
+ labelOnHover?: boolean;
20
+ /** Скрыть ли лейбл */
21
+ hideLabel?: boolean;
22
+ /** Расположение (задает дефолтное положение и используется для анимации) */
23
+ position?: FloatingButtonPosition;
9
24
  /** Скругления */
10
25
  borderRadius?: boolean;
11
26
  /** Компонент Badge */
12
27
  badge?: ReactElement;
13
- /** Постфикс */
14
- postfix?: ReactNode;
15
- /** Отображение индикации загрузки */
16
- loading?: boolean;
17
- /** Заблокирована ли кнопка */
18
- disabled?: boolean;
19
- /** Хост для отрисовки */
20
- host?: RefObject<HTMLElement>;
21
28
  /** css-класс для позиционирования кнопки */
22
29
  className?: string;
23
30
  /** инлайн стили для позиционирования кнопки */
24
31
  inlineStyle?: CSSProperties;
32
+ /** Хост для отрисовки */
33
+ host?: RefObject<HTMLElement>;
34
+ 'data-qa'?: string;
25
35
  }