@hh.ru/magritte-ui-floating-button 1.1.0 → 1.2.1
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/FloatingButton.js +15 -16
- package/FloatingButton.js.map +1 -1
- package/index.css +121 -73
- package/index.mock.d.ts +2 -0
- package/index.mock.js +9 -0
- package/index.mock.js.map +1 -0
- package/package.json +6 -5
- package/types.d.ts +17 -15
package/FloatingButton.js
CHANGED
|
@@ -10,15 +10,18 @@ import { Layer } from '@hh.ru/magritte-ui-layer';
|
|
|
10
10
|
import { Loader } from '@hh.ru/magritte-ui-loader';
|
|
11
11
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
12
12
|
|
|
13
|
-
var styles = {"wrapper":"magritte-wrapper___7m9lC_1-1
|
|
13
|
+
var styles = {"wrapper":"magritte-wrapper___7m9lC_1-2-1","animation-timeout":"magritte-animation-timeout___NL8n0_1-2-1","animationTimeout":"magritte-animation-timeout___NL8n0_1-2-1","button":"magritte-button___nL-Hn_1-2-1","loading":"magritte-loading___C0oPZ_1-2-1","withIconAndLabel":"magritte-withIconAndLabel___Qa-lU_1-2-1","right":"magritte-right___3n0Rz_1-2-1","content":"magritte-content___JNpTZ_1-2-1","left":"magritte-left___GnzU7_1-2-1","center":"magritte-center___MdA40_1-2-1","postfix":"magritte-postfix___r0EZ6_1-2-1","icon":"magritte-icon___VpqJt_1-2-1","textless":"magritte-textless___IbYgp_1-2-1","label":"magritte-label___EPgvj_1-2-1","withPostfix":"magritte-withPostfix___PmQAz_1-2-1","hideLabel":"magritte-hideLabel___K79XM_1-2-1","withLabelOnHover":"magritte-withLabelOnHover___1oktd_1-2-1","border-radius":"magritte-border-radius___ObLLb_1-2-1","borderRadius":"magritte-border-radius___ObLLb_1-2-1","loader":"magritte-loader___EPezG_1-2-1","enter-animation":"magritte-enter-animation___2sPz3_1-2-1","enterAnimation":"magritte-enter-animation___2sPz3_1-2-1","enter-animation-active":"magritte-enter-animation-active___Lq9eq_1-2-1","enterAnimationActive":"magritte-enter-animation-active___Lq9eq_1-2-1","exit-animation":"magritte-exit-animation___h2-7a_1-2-1","exitAnimation":"magritte-exit-animation___h2-7a_1-2-1","exit-animation-active":"magritte-exit-animation-active___w0F1a_1-2-1","exitAnimationActive":"magritte-exit-animation-active___w0F1a_1-2-1","button_style-neutral":"magritte-button_style-neutral___bPUwu_1-2-1","buttonStyleNeutral":"magritte-button_style-neutral___bPUwu_1-2-1","button_style-inverse":"magritte-button_style-inverse___Xgf26_1-2-1","buttonStyleInverse":"magritte-button_style-inverse___Xgf26_1-2-1"};
|
|
14
14
|
|
|
15
15
|
const ALLOWED_BADGE_SIZES = ['small'];
|
|
16
|
-
const FloatingButtonComponent = (
|
|
17
|
-
const
|
|
18
|
-
|
|
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;
|
|
19
19
|
const isServerEnv = useServerEnv();
|
|
20
20
|
const wrapperRef = useRef(null);
|
|
21
21
|
const [animationTimeout, setAnimationTimeout] = useState(0);
|
|
22
|
+
const additionalAttributes = {
|
|
23
|
+
'data-qa': dataQa,
|
|
24
|
+
};
|
|
22
25
|
useLayoutEffect(() => {
|
|
23
26
|
const animationTimeoutElement = document.createElement('div');
|
|
24
27
|
animationTimeoutElement.classList.add(styles.animationTimeout);
|
|
@@ -31,29 +34,25 @@ const FloatingButtonComponent = (props, ref) => {
|
|
|
31
34
|
document.body.removeChild(animationTimeoutElement);
|
|
32
35
|
}, []);
|
|
33
36
|
if (Element === 'button') {
|
|
34
|
-
additionalAttributes =
|
|
35
|
-
type: 'button',
|
|
36
|
-
};
|
|
37
|
+
additionalAttributes.type = 'button';
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
additionalAttributes =
|
|
40
|
-
|
|
41
|
-
tabIndex: disabled ? -1 : 0,
|
|
42
|
-
'aria-disabled': disabled,
|
|
43
|
-
};
|
|
40
|
+
additionalAttributes.role = Element !== 'a' ? 'button' : undefined;
|
|
41
|
+
additionalAttributes['aria-disabled'] = disabled;
|
|
44
42
|
}
|
|
45
43
|
additionalAttributes.ref = ref;
|
|
46
44
|
if (isServerEnv) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
|
-
let button = (jsx(Element, { ...additionalAttributes, disabled: !!disabled, className: classnames(styles.button, styles[`button_style-${style}`], {
|
|
47
|
+
let button = (jsx(Element, { ...additionalAttributes, ...restProps, disabled: !!disabled, tabIndex: disabled || loading ? -1 : 0, className: classnames(styles.button, styles[`button_style-${style}`], {
|
|
50
48
|
[styles.borderRadius]: !!borderRadius,
|
|
51
49
|
[styles.loading]: !!loading,
|
|
52
50
|
[styles.withLabelOnHover]: !!labelOnHover,
|
|
53
|
-
[styles.hideLabel]: !!hideLabel,
|
|
51
|
+
[styles.hideLabel]: !!hideLabel || !children,
|
|
54
52
|
[styles.withPostfix]: !!postfix,
|
|
55
53
|
[styles.textless]: !postfix && (!children || !!hideLabel),
|
|
56
|
-
|
|
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 }) }))] }) }));
|
|
57
56
|
if (badge && !disabled) {
|
|
58
57
|
button = (jsx(ComponentWithBadge, { allowedSizes: ALLOWED_BADGE_SIZES, badge: badge, offset: 4, noClip: true, children: button }));
|
|
59
58
|
}
|
|
@@ -67,7 +66,7 @@ const FloatingButtonComponent = (props, ref) => {
|
|
|
67
66
|
enterActive: styles.enterAnimationActive,
|
|
68
67
|
exit: styles.exitAnimation,
|
|
69
68
|
exitActive: styles.exitAnimationActive,
|
|
70
|
-
}, timeout: animationTimeout, unmountOnExit: true, children: jsx(Layer, { layer: "floating-button", children: jsx("div", { className: classnames(styles.wrapper, styles[`${position}`]), ref: wrapperRef, style: inlineStyle, children: button }) }) }), host?.current || document.body);
|
|
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);
|
|
71
70
|
};
|
|
72
71
|
const FloatingButton = forwardRef(FloatingButtonComponent);
|
|
73
72
|
|
package/FloatingButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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'> = (props, ref) => {\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 visible,\n labelOnHover,\n hideLabel,\n badge,\n position = 'right',\n } = props;\n\n let additionalAttributes: Record<string, unknown>;\n const isServerEnv = useServerEnv();\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [animationTimeout, setAnimationTimeout] = useState(0);\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 = {\n type: 'button',\n };\n } else {\n additionalAttributes = {\n role: 'button',\n tabIndex: disabled ? -1 : 0,\n '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 disabled={!!disabled}\n className={classnames(\n styles.button,\n styles[`button_style-${style}`],\n {\n [styles.borderRadius]: !!borderRadius,\n [styles.loading]: !!loading,\n [styles.withLabelOnHover]: !!labelOnHover,\n [styles.hideLabel]: !!hideLabel,\n [styles.withPostfix]: !!postfix,\n [styles.textless]: !postfix && (!children || !!hideLabel),\n },\n className\n )}\n >\n <span className={styles.content}>\n {IconComponent && (\n <span className={styles.icon}>\n <IconComponent />\n </span>\n )}\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\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 className={classnames(styles.wrapper, styles[`${position}`])} ref={wrapperRef} style={inlineStyle}>\n {button}\n </div>\n </Layer>\n </CSSTransition>,\n host?.current || document.body\n );\n};\n\nexport const FloatingButton = forwardRef(FloatingButtonComponent) as PolymorphicComponentWithRef<\n FloatingButtonProps,\n 'button'\n>;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,mBAAmB,GAAgB,CAAC,OAAO,CAAC,CAAC;AAEnD,MAAM,uBAAuB,GAAmE,CAAC,KAAK,EAAE,GAAG,KAAI;AAC3G,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,EACX,OAAO,EACP,YAAY,EACZ,SAAS,EACT,KAAK,EACL,QAAQ,GAAG,OAAO,GACrB,GAAG,KAAK,CAAC;AAEV,IAAA,IAAI,oBAA6C,CAAC;AAClD,IAAA,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AACnC,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBA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+
{"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 FloatingButtonProps,\n 'button'\n>;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,mBAAmB,GAAgB,CAAC,OAAO,CAAC,CAAC;AAEnD,MAAM,uBAAuB,GAAmE,CAC5F,EACI,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,EACX,OAAO,EACP,YAAY,EAAE,aAAa,EAC3B,SAAS,EAAE,UAAU,EACrB,KAAK,EACL,QAAQ,GAAG,OAAO,EAClB,SAAS,EAAE,MAAM,GAAG,iBAAiB,EACrC,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,YAAY,GAAG,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC;AACtD,IAAA,MAAM,SAAS,GAAG,UAAU,IAAI,CAAC,CAAC,aAAa,CAAC;AAChD,IAAA,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AACnC,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE5D,IAAA,MAAM,oBAAoB,GAA4B;AAClD,QAAA,SAAS,EAAE,MAAM;KACpB,CAAC;IAEF,eAAe,CAAC,MAAK;QACjB,MAAM,uBAAuB,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9D,uBAAuB,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC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3B,QAAA,EAAA,MAAM,EACL,CAAA,EAAA,CACF,EACI,CAAA,EAChB,IAAI,EAAE,OAAO,IAAI,QAAQ,CAAC,IAAI,CACjC,CAAC;AACN,CAAC,CAAC;MAEW,cAAc,GAAG,UAAU,CAAC,uBAAuB;;;;"}
|
package/index.css
CHANGED
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
:root{
|
|
41
41
|
--magritte-semantic-animation-time-s-duration-v23-2-2:200ms;
|
|
42
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;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
.magritte-night-theme{
|
|
@@ -70,101 +74,117 @@
|
|
|
70
74
|
--magritte-shadow-level-2-color-v23-2-2:#0000003d;
|
|
71
75
|
--magritte-shadow-level-1-color-v23-2-2:#00000029;
|
|
72
76
|
}
|
|
73
|
-
.magritte-wrapper___7m9lC_1-1
|
|
77
|
+
.magritte-wrapper___7m9lC_1-2-1{
|
|
74
78
|
display:inline-block;
|
|
75
79
|
position:fixed;
|
|
76
80
|
}
|
|
77
|
-
.magritte-wrapper___7m9lC_1-1
|
|
78
|
-
.magritte-animation-timeout___NL8n0_1-1
|
|
81
|
+
.magritte-wrapper___7m9lC_1-2-1,
|
|
82
|
+
.magritte-animation-timeout___NL8n0_1-2-1{
|
|
79
83
|
--animation-duration:0;
|
|
80
84
|
}
|
|
81
85
|
@media (prefers-reduced-motion: no-preference){
|
|
82
|
-
.magritte-wrapper___7m9lC_1-1
|
|
83
|
-
.magritte-animation-timeout___NL8n0_1-1
|
|
86
|
+
.magritte-wrapper___7m9lC_1-2-1,
|
|
87
|
+
.magritte-animation-timeout___NL8n0_1-2-1{
|
|
84
88
|
--animation-duration:var(--magritte-semantic-animation-time-s-duration-v23-2-2);
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
|
-
.magritte-button___nL-Hn_1-1
|
|
91
|
+
.magritte-button___nL-Hn_1-2-1{
|
|
88
92
|
display:inline-block;
|
|
89
|
-
padding:12px
|
|
93
|
+
padding:12px;
|
|
90
94
|
border-radius:24px;
|
|
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);
|
|
91
98
|
}
|
|
92
|
-
.magritte-button___nL-Hn_1-1
|
|
93
|
-
.magritte-button___nL-Hn_1-
|
|
99
|
+
.magritte-button___nL-Hn_1-2-1:disabled,
|
|
100
|
+
.magritte-button___nL-Hn_1-2-1[aria-disabled='true'],
|
|
101
|
+
.magritte-button___nL-Hn_1-2-1.magritte-loading___C0oPZ_1-2-1{
|
|
94
102
|
pointer-events:none;
|
|
95
103
|
cursor:not-allowed;
|
|
96
104
|
}
|
|
97
|
-
.magritte-
|
|
105
|
+
.magritte-button___nL-Hn_1-2-1:not(:disabled):active,
|
|
106
|
+
.magritte-button___nL-Hn_1-2-1: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-1{
|
|
112
|
+
padding:12px 16px;
|
|
113
|
+
}
|
|
114
|
+
.magritte-right___3n0Rz_1-2-1{
|
|
98
115
|
right:16px;
|
|
99
116
|
bottom:20px;
|
|
100
117
|
}
|
|
101
118
|
@media (min-width: 1020px){
|
|
102
|
-
body.magritte-old-layout .magritte-right___3n0Rz_1-1
|
|
119
|
+
body.magritte-old-layout .magritte-right___3n0Rz_1-2-1{
|
|
103
120
|
right:36px;
|
|
104
121
|
bottom:32px;
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
124
|
@media (min-width: 1024px){
|
|
108
|
-
body:not(.magritte-old-layout) .magritte-right___3n0Rz_1-1
|
|
125
|
+
body:not(.magritte-old-layout) .magritte-right___3n0Rz_1-2-1{
|
|
109
126
|
right:36px;
|
|
110
127
|
bottom:32px;
|
|
111
128
|
}
|
|
112
129
|
}
|
|
113
|
-
.magritte-right___3n0Rz_1-1
|
|
130
|
+
.magritte-right___3n0Rz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
114
131
|
justify-content:end;
|
|
115
132
|
}
|
|
116
|
-
.magritte-left___GnzU7_1-1
|
|
133
|
+
.magritte-left___GnzU7_1-2-1{
|
|
117
134
|
left:16px;
|
|
118
135
|
bottom:20px;
|
|
119
136
|
}
|
|
120
137
|
@media (min-width: 1020px){
|
|
121
|
-
body.magritte-old-layout .magritte-left___GnzU7_1-1
|
|
138
|
+
body.magritte-old-layout .magritte-left___GnzU7_1-2-1{
|
|
122
139
|
left:36px;
|
|
123
140
|
bottom:32px;
|
|
124
141
|
}
|
|
125
142
|
}
|
|
126
143
|
@media (min-width: 1024px){
|
|
127
|
-
body:not(.magritte-old-layout) .magritte-left___GnzU7_1-1
|
|
144
|
+
body:not(.magritte-old-layout) .magritte-left___GnzU7_1-2-1{
|
|
128
145
|
left:36px;
|
|
129
146
|
bottom:32px;
|
|
130
147
|
}
|
|
131
148
|
}
|
|
132
|
-
.magritte-left___GnzU7_1-1
|
|
149
|
+
.magritte-left___GnzU7_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
133
150
|
justify-content:start;
|
|
134
151
|
}
|
|
135
|
-
.magritte-center___MdA40_1-1
|
|
152
|
+
.magritte-center___MdA40_1-2-1{
|
|
136
153
|
left:50%;
|
|
137
154
|
bottom:20px;
|
|
138
155
|
transform:translateX(-50%);
|
|
139
156
|
}
|
|
140
157
|
@media (min-width: 1020px){
|
|
141
|
-
body.magritte-old-layout .magritte-center___MdA40_1-1
|
|
158
|
+
body.magritte-old-layout .magritte-center___MdA40_1-2-1{
|
|
142
159
|
bottom:32px;
|
|
143
160
|
}
|
|
144
161
|
}
|
|
145
162
|
@media (min-width: 1024px){
|
|
146
|
-
body:not(.magritte-old-layout) .magritte-center___MdA40_1-1
|
|
163
|
+
body:not(.magritte-old-layout) .magritte-center___MdA40_1-2-1{
|
|
147
164
|
bottom:32px;
|
|
148
165
|
}
|
|
149
166
|
}
|
|
150
|
-
.magritte-center___MdA40_1-1
|
|
167
|
+
.magritte-center___MdA40_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
151
168
|
justify-content:space-between;
|
|
152
169
|
}
|
|
153
|
-
.magritte-
|
|
154
|
-
padding:
|
|
170
|
+
.magritte-postfix___r0EZ6_1-2-1{
|
|
171
|
+
padding:0 4px;
|
|
172
|
+
}
|
|
173
|
+
.magritte-icon___VpqJt_1-2-1{
|
|
174
|
+
margin-right:4px;
|
|
155
175
|
}
|
|
156
|
-
.magritte-
|
|
157
|
-
margin
|
|
176
|
+
.magritte-textless___IbYgp_1-2-1 .magritte-icon___VpqJt_1-2-1{
|
|
177
|
+
margin:0;
|
|
158
178
|
}
|
|
159
|
-
.magritte-label___EPgvj_1-1
|
|
179
|
+
.magritte-label___EPgvj_1-2-1{
|
|
160
180
|
text-align:left;
|
|
161
|
-
padding-left:8px;
|
|
162
181
|
overflow:hidden;
|
|
163
182
|
transition-property:padding;
|
|
164
183
|
transition-duration:var(--animation-duration);
|
|
165
184
|
transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
|
|
185
|
+
padding:0 4px;
|
|
166
186
|
}
|
|
167
|
-
.magritte-content___JNpTZ_1-1
|
|
187
|
+
.magritte-content___JNpTZ_1-2-1{
|
|
168
188
|
display:inline-grid;
|
|
169
189
|
justify-content:flex-end;
|
|
170
190
|
grid-template-columns:max-content 1fr;
|
|
@@ -173,54 +193,76 @@
|
|
|
173
193
|
transition-duration:var(--animation-duration);
|
|
174
194
|
transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
|
|
175
195
|
}
|
|
176
|
-
.magritte-withPostfix___PmQAz_1-1
|
|
196
|
+
.magritte-withPostfix___PmQAz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
177
197
|
grid-template-columns:max-content 1fr max-content;
|
|
178
198
|
}
|
|
179
|
-
.magritte-hideLabel___K79XM_1-1
|
|
199
|
+
.magritte-hideLabel___K79XM_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
180
200
|
grid-template-columns:max-content 0fr;
|
|
181
201
|
}
|
|
182
|
-
.magritte-hideLabel___K79XM_1-1
|
|
202
|
+
.magritte-hideLabel___K79XM_1-2-1 .magritte-label___EPgvj_1-2-1{
|
|
183
203
|
padding:0;
|
|
184
204
|
}
|
|
185
|
-
.magritte-hideLabel___K79XM_1-1
|
|
205
|
+
.magritte-hideLabel___K79XM_1-2-1.magritte-withPostfix___PmQAz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
186
206
|
grid-template-columns:max-content 0fr max-content;
|
|
187
207
|
}
|
|
188
|
-
.magritte-withLabelOnHover___1oktd_1-1
|
|
208
|
+
.magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1).magritte-withIconAndLabel___Qa-lU_1-2-1{
|
|
189
209
|
padding:12px;
|
|
190
210
|
}
|
|
191
|
-
.magritte-withLabelOnHover___1oktd_1-1
|
|
192
|
-
|
|
211
|
+
.magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):not(.magritte-withPostfix___PmQAz_1-2-1) .magritte-icon___VpqJt_1-2-1{
|
|
212
|
+
margin:0;
|
|
193
213
|
}
|
|
194
|
-
.magritte-withLabelOnHover___1oktd_1-1
|
|
214
|
+
.magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1) .magritte-content___JNpTZ_1-2-1{
|
|
195
215
|
grid-template-columns:max-content 0fr;
|
|
196
216
|
}
|
|
197
|
-
.magritte-withLabelOnHover___1oktd_1-1
|
|
217
|
+
.magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1).magritte-withPostfix___PmQAz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
198
218
|
grid-template-columns:max-content 0fr max-content;
|
|
199
219
|
}
|
|
200
|
-
.magritte-withLabelOnHover___1oktd_1-1
|
|
220
|
+
.magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1) .magritte-label___EPgvj_1-2-1{
|
|
201
221
|
padding:0;
|
|
202
222
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
223
|
+
@media (min-width: 1020px){
|
|
224
|
+
body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']).magritte-withIconAndLabel___Qa-lU_1-2-1{
|
|
225
|
+
padding:12px 16px;
|
|
226
|
+
}
|
|
227
|
+
body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-icon___VpqJt_1-2-1{
|
|
228
|
+
margin-right:4px;
|
|
229
|
+
}
|
|
230
|
+
body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-content___JNpTZ_1-2-1{
|
|
231
|
+
grid-template-columns:max-content 1fr;
|
|
232
|
+
}
|
|
233
|
+
body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']).magritte-withPostfix___PmQAz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
234
|
+
grid-template-columns:max-content 1fr max-content;
|
|
235
|
+
}
|
|
236
|
+
body.magritte-old-layout .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-label___EPgvj_1-2-1{
|
|
237
|
+
padding:0 4px;
|
|
238
|
+
}
|
|
211
239
|
}
|
|
212
|
-
|
|
213
|
-
|
|
240
|
+
@media (min-width: 1024px){
|
|
241
|
+
body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']).magritte-withIconAndLabel___Qa-lU_1-2-1{
|
|
242
|
+
padding:12px 16px;
|
|
243
|
+
}
|
|
244
|
+
body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-icon___VpqJt_1-2-1{
|
|
245
|
+
margin-right:4px;
|
|
246
|
+
}
|
|
247
|
+
body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-content___JNpTZ_1-2-1{
|
|
248
|
+
grid-template-columns:max-content 1fr;
|
|
249
|
+
}
|
|
250
|
+
body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']).magritte-withPostfix___PmQAz_1-2-1 .magritte-content___JNpTZ_1-2-1{
|
|
251
|
+
grid-template-columns:max-content 1fr max-content;
|
|
252
|
+
}
|
|
253
|
+
body:not(.magritte-old-layout) .magritte-withLabelOnHover___1oktd_1-2-1:not(.magritte-hideLabel___K79XM_1-2-1):hover:not(:disabled):not([aria-disabled='true']) .magritte-label___EPgvj_1-2-1{
|
|
254
|
+
padding:0 4px;
|
|
255
|
+
}
|
|
214
256
|
}
|
|
215
|
-
.magritte-loading___C0oPZ_1-1
|
|
216
|
-
.magritte-loading___C0oPZ_1-1
|
|
217
|
-
.magritte-loading___C0oPZ_1-1
|
|
257
|
+
.magritte-loading___C0oPZ_1-2-1 .magritte-postfix___r0EZ6_1-2-1,
|
|
258
|
+
.magritte-loading___C0oPZ_1-2-1 .magritte-icon___VpqJt_1-2-1,
|
|
259
|
+
.magritte-loading___C0oPZ_1-2-1 .magritte-label___EPgvj_1-2-1{
|
|
218
260
|
visibility:hidden;
|
|
219
261
|
}
|
|
220
|
-
.magritte-border-radius___ObLLb_1-1
|
|
262
|
+
.magritte-border-radius___ObLLb_1-2-1{
|
|
221
263
|
border-radius:12px;
|
|
222
264
|
}
|
|
223
|
-
.magritte-loader___EPezG_1-1
|
|
265
|
+
.magritte-loader___EPezG_1-2-1{
|
|
224
266
|
position:absolute;
|
|
225
267
|
left:50%;
|
|
226
268
|
top:50%;
|
|
@@ -228,91 +270,97 @@
|
|
|
228
270
|
line-height:0;
|
|
229
271
|
overflow:hidden;
|
|
230
272
|
}
|
|
231
|
-
.magritte-enter-animation___2sPz3_1-1
|
|
273
|
+
.magritte-enter-animation___2sPz3_1-2-1{
|
|
232
274
|
opacity:0;
|
|
233
275
|
}
|
|
234
|
-
.magritte-enter-animation-active___Lq9eq_1-1
|
|
276
|
+
.magritte-enter-animation-active___Lq9eq_1-2-1{
|
|
235
277
|
opacity:1;
|
|
236
278
|
transition-property:opacity;
|
|
237
279
|
transition-duration:var(--animation-duration);
|
|
238
280
|
transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
|
|
239
281
|
}
|
|
240
|
-
.magritte-exit-animation___h2-7a_1-1
|
|
282
|
+
.magritte-exit-animation___h2-7a_1-2-1{
|
|
241
283
|
opacity:1;
|
|
242
284
|
}
|
|
243
|
-
.magritte-exit-animation-active___w0F1a_1-1
|
|
285
|
+
.magritte-exit-animation-active___w0F1a_1-2-1{
|
|
244
286
|
opacity:0;
|
|
245
287
|
transition-property:opacity;
|
|
246
288
|
transition-duration:var(--animation-duration);
|
|
247
289
|
transition-timing-function:var(--magritte-semantic-animation-ease-base-timing-function-v23-2-2);
|
|
248
290
|
}
|
|
249
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
291
|
+
.magritte-button_style-neutral___bPUwu_1-2-1{
|
|
250
292
|
background:var(--magritte-color-component-button-background-neutral-v23-2-2);
|
|
251
293
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-text-neutral-v23-2-2);
|
|
252
294
|
--magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-neutral-v23-2-2);
|
|
253
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);
|
|
254
296
|
--magritte-ui-loader-color-override:var(--magritte-color-component-button-loader-icon-neutral-v23-2-2);
|
|
255
297
|
}
|
|
256
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
298
|
+
.magritte-button_style-neutral___bPUwu_1-2-1 .magritte-postfix___r0EZ6_1-2-1{
|
|
257
299
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-neutral-v23-2-2);
|
|
258
300
|
}
|
|
259
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
301
|
+
.magritte-button_style-neutral___bPUwu_1-2-1.focus-visible{
|
|
260
302
|
outline:4px solid var(--magritte-color-component-button-stroke-state-neutral-focused-accessible-v23-2-2);
|
|
261
303
|
background:var(--magritte-color-component-button-background-state-neutral-focused-v23-2-2);
|
|
262
304
|
}
|
|
263
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
305
|
+
.magritte-button_style-neutral___bPUwu_1-2-1:not(:disabled):active,
|
|
306
|
+
.magritte-button_style-neutral___bPUwu_1-2-1:not([aria-disabled='true']):active{
|
|
264
307
|
background:var(--magritte-color-component-button-background-state-neutral-pressed-v23-2-2);
|
|
265
308
|
}
|
|
266
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
309
|
+
.magritte-button_style-neutral___bPUwu_1-2-1:disabled,
|
|
310
|
+
.magritte-button_style-neutral___bPUwu_1-2-1[aria-disabled='true']{
|
|
267
311
|
background:var(--magritte-color-component-button-background-state-neutral-disabled-v23-2-2);
|
|
268
312
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-text-state-neutral-disabled-v23-2-2);
|
|
269
313
|
--magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-state-neutral-disabled-v23-2-2);
|
|
270
314
|
}
|
|
271
|
-
.magritte-button_style-neutral___bPUwu_1-1
|
|
315
|
+
.magritte-button_style-neutral___bPUwu_1-2-1:disabled .magritte-postfix___r0EZ6_1-2-1,
|
|
316
|
+
.magritte-button_style-neutral___bPUwu_1-2-1[aria-disabled='true'] .magritte-postfix___r0EZ6_1-2-1{
|
|
272
317
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-state-neutral-disabled-v23-2-2);
|
|
273
318
|
}
|
|
274
319
|
@media (min-width: 1020px){
|
|
275
|
-
body.magritte-old-layout .magritte-button_style-neutral___bPUwu_1-1
|
|
320
|
+
body.magritte-old-layout .magritte-button_style-neutral___bPUwu_1-2-1:hover:not(:active):not(:disabled):not([aria-disabled='true']){
|
|
276
321
|
background:var(--magritte-color-component-button-background-state-neutral-hovered-v23-2-2);
|
|
277
322
|
}
|
|
278
323
|
}
|
|
279
324
|
@media (min-width: 1024px){
|
|
280
|
-
body:not(.magritte-old-layout) .magritte-button_style-neutral___bPUwu_1-1
|
|
325
|
+
body:not(.magritte-old-layout) .magritte-button_style-neutral___bPUwu_1-2-1:hover:not(:active):not(:disabled):not([aria-disabled='true']){
|
|
281
326
|
background:var(--magritte-color-component-button-background-state-neutral-hovered-v23-2-2);
|
|
282
327
|
}
|
|
283
328
|
}
|
|
284
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
329
|
+
.magritte-button_style-inverse___Xgf26_1-2-1{
|
|
285
330
|
background:var(--magritte-color-component-button-background-inverse-v23-2-2);
|
|
286
331
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-text-inverse-v23-2-2);
|
|
287
332
|
--magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-inverse-v23-2-2);
|
|
288
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);
|
|
289
334
|
--magritte-ui-loader-color-override:var(--magritte-color-component-button-loader-icon-inverse-v23-2-2);
|
|
290
335
|
}
|
|
291
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
336
|
+
.magritte-button_style-inverse___Xgf26_1-2-1 .magritte-postfix___r0EZ6_1-2-1{
|
|
292
337
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-inverse-v23-2-2);
|
|
293
338
|
}
|
|
294
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
339
|
+
.magritte-button_style-inverse___Xgf26_1-2-1.focus-visible{
|
|
295
340
|
outline:4px solid var(--magritte-color-component-button-stroke-state-inverse-focused-accessible-v23-2-2);
|
|
296
341
|
background:var(--magritte-color-component-button-background-state-inverse-focused-v23-2-2);
|
|
297
342
|
}
|
|
298
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
343
|
+
.magritte-button_style-inverse___Xgf26_1-2-1:not(:disabled):active,
|
|
344
|
+
.magritte-button_style-inverse___Xgf26_1-2-1:not([aria-disabled='true']):active{
|
|
299
345
|
background:var(--magritte-color-component-button-background-state-inverse-pressed-v23-2-2);
|
|
300
346
|
}
|
|
301
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
347
|
+
.magritte-button_style-inverse___Xgf26_1-2-1:disabled,
|
|
348
|
+
.magritte-button_style-inverse___Xgf26_1-2-1[aria-disabled='true']{
|
|
302
349
|
background:var(--magritte-color-component-button-background-state-inverse-disabled-v23-2-2);
|
|
303
350
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-text-state-inverse-disabled-v23-2-2);
|
|
304
351
|
--magritte-ui-icon-color-override:var(--magritte-color-component-button-icon-state-inverse-disabled-v23-2-2);
|
|
305
352
|
}
|
|
306
|
-
.magritte-button_style-inverse___Xgf26_1-1
|
|
353
|
+
.magritte-button_style-inverse___Xgf26_1-2-1:disabled .magritte-postfix___r0EZ6_1-2-1,
|
|
354
|
+
.magritte-button_style-inverse___Xgf26_1-2-1[aria-disabled='true'] .magritte-postfix___r0EZ6_1-2-1{
|
|
307
355
|
--magritte-ui-text-color-override:var(--magritte-color-component-button-postfix-text-state-inverse-disabled-v23-2-2);
|
|
308
356
|
}
|
|
309
357
|
@media (min-width: 1020px){
|
|
310
|
-
body.magritte-old-layout .magritte-button_style-inverse___Xgf26_1-1
|
|
358
|
+
body.magritte-old-layout .magritte-button_style-inverse___Xgf26_1-2-1:hover:not(:active):not(:disabled):not([aria-disabled='true']){
|
|
311
359
|
background:var(--magritte-color-component-button-background-state-inverse-hovered-v23-2-2);
|
|
312
360
|
}
|
|
313
361
|
}
|
|
314
362
|
@media (min-width: 1024px){
|
|
315
|
-
body:not(.magritte-old-layout) .magritte-button_style-inverse___Xgf26_1-1
|
|
363
|
+
body:not(.magritte-old-layout) .magritte-button_style-inverse___Xgf26_1-2-1:hover:not(:active):not(:disabled):not([aria-disabled='true']){
|
|
316
364
|
background:var(--magritte-color-component-button-background-state-inverse-hovered-v23-2-2);
|
|
317
365
|
}
|
|
318
366
|
}
|
package/index.mock.d.ts
ADDED
package/index.mock.js
ADDED
|
@@ -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.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@hh.ru/magritte-common-is-server-env": "1.0.7",
|
|
23
23
|
"@hh.ru/magritte-design-tokens": "23.2.2",
|
|
24
|
-
"@hh.ru/magritte-types": "5.0.
|
|
24
|
+
"@hh.ru/magritte-types": "5.0.5",
|
|
25
25
|
"@hh.ru/magritte-ui-badge": "3.2.0",
|
|
26
26
|
"@hh.ru/magritte-ui-breakpoint": "6.0.1",
|
|
27
27
|
"@hh.ru/magritte-ui-layer": "3.0.4",
|
|
28
|
-
"@hh.ru/magritte-ui-loader": "2.0.
|
|
29
|
-
"@hh.ru/magritte-ui-
|
|
28
|
+
"@hh.ru/magritte-ui-loader": "2.0.10",
|
|
29
|
+
"@hh.ru/magritte-ui-mock-component": "1.1.5",
|
|
30
|
+
"@hh.ru/magritte-ui-typography": "4.2.4"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
33
|
"classnames": ">=2.3.2",
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "15abe7ba2bc392ac808d2056c5571253286d099e"
|
|
41
42
|
}
|
package/types.d.ts
CHANGED
|
@@ -6,28 +6,30 @@ export interface FloatingButtonProps extends PropsWithChildren {
|
|
|
6
6
|
/** Кастомный компонент 'a', 'button', 'span' или функция */
|
|
7
7
|
Element?: 'a' | 'button' | 'span';
|
|
8
8
|
style?: FloatingButtonStyle;
|
|
9
|
+
/** Флаг видимости **/
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
/** Заблокирована ли кнопка */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Отображение индикации загрузки */
|
|
14
|
+
loading?: boolean;
|
|
9
15
|
icon?: IconWrapperComponentSize24;
|
|
16
|
+
/** Постфикс */
|
|
17
|
+
postfix?: ReactNode;
|
|
18
|
+
/** Показывать ли лейбл только при ховере */
|
|
19
|
+
labelOnHover?: boolean;
|
|
20
|
+
/** Скрыть ли лейбл */
|
|
21
|
+
hideLabel?: boolean;
|
|
22
|
+
/** Расположение (задает дефолтное положение и используется для анимации) */
|
|
23
|
+
position?: FloatingButtonPosition;
|
|
10
24
|
/** Скругления */
|
|
11
25
|
borderRadius?: boolean;
|
|
12
26
|
/** Компонент Badge */
|
|
13
27
|
badge?: ReactElement;
|
|
14
|
-
/** Постфикс */
|
|
15
|
-
postfix?: ReactNode;
|
|
16
|
-
/** Отображение индикации загрузки */
|
|
17
|
-
loading?: boolean;
|
|
18
|
-
/** Заблокирована ли кнопка */
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
/** Хост для отрисовки */
|
|
21
|
-
host?: RefObject<HTMLElement>;
|
|
22
28
|
/** css-класс для позиционирования кнопки */
|
|
23
29
|
className?: string;
|
|
24
30
|
/** инлайн стили для позиционирования кнопки */
|
|
25
31
|
inlineStyle?: CSSProperties;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/** Скрыть ли лейбл */
|
|
30
|
-
hideLabel?: boolean;
|
|
31
|
-
/** Позиция */
|
|
32
|
-
position?: FloatingButtonPosition;
|
|
32
|
+
/** Хост для отрисовки */
|
|
33
|
+
host?: RefObject<HTMLElement>;
|
|
34
|
+
'data-qa'?: string;
|
|
33
35
|
}
|