@hh.ru/magritte-ui-placeholder 6.0.4 → 7.0.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/Placeholder.js +2 -2
- package/Placeholder.js.map +1 -1
- package/index.css +12 -12
- package/package.json +3 -3
- package/types.d.ts +2 -2
package/Placeholder.js
CHANGED
|
@@ -5,10 +5,10 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { getContainerStyles } from './utils.js';
|
|
6
6
|
import { Title } from '@hh.ru/magritte-ui-title';
|
|
7
7
|
|
|
8
|
-
var styles = {"placeholder-container":"magritte-placeholder-
|
|
8
|
+
var styles = {"placeholder-container":"magritte-placeholder-container___4kN6h_7-0-0","placeholderContainer":"magritte-placeholder-container___4kN6h_7-0-0","placeholder-container_vertical-align-top":"magritte-placeholder-container_vertical-align-top___mKdWm_7-0-0","placeholderContainerVerticalAlignTop":"magritte-placeholder-container_vertical-align-top___mKdWm_7-0-0","placeholder-container_vertical-align-center":"magritte-placeholder-container_vertical-align-center___S3DkI_7-0-0","placeholderContainerVerticalAlignCenter":"magritte-placeholder-container_vertical-align-center___S3DkI_7-0-0","placeholder-container_vertical-align-bottom":"magritte-placeholder-container_vertical-align-bottom___Zo2-M_7-0-0","placeholderContainerVerticalAlignBottom":"magritte-placeholder-container_vertical-align-bottom___Zo2-M_7-0-0","placeholder-buttons":"magritte-placeholder-buttons___FO-A6_7-0-0","placeholderButtons":"magritte-placeholder-buttons___FO-A6_7-0-0","placeholder-buttons_no-stretch":"magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0","placeholderButtonsNoStretch":"magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0","placeholder-buttons_align-left":"magritte-placeholder-buttons_align-left___mzBmy_7-0-0","placeholderButtonsAlignLeft":"magritte-placeholder-buttons_align-left___mzBmy_7-0-0","placeholder-buttons_align-center":"magritte-placeholder-buttons_align-center___7QhoH_7-0-0","placeholderButtonsAlignCenter":"magritte-placeholder-buttons_align-center___7QhoH_7-0-0","placeholder-image-container":"magritte-placeholder-image-container___3eIPQ_7-0-0","placeholderImageContainer":"magritte-placeholder-image-container___3eIPQ_7-0-0","placeholder-image":"magritte-placeholder-image___bMcah_7-0-0","placeholderImage":"magritte-placeholder-image___bMcah_7-0-0","placeholder-image_hidden":"magritte-placeholder-image_hidden___5fOaL_7-0-0","placeholderImageHidden":"magritte-placeholder-image_hidden___5fOaL_7-0-0"};
|
|
9
9
|
|
|
10
10
|
const PLACEHOLDER_IMAGE_HEIGHT = 200;
|
|
11
|
-
const Placeholder = ({ title, titleProps, description, maxWidth, minHeight, buttonPrimary, buttonSecondary, buttonTertiary, showButtons = true, paddingTop, paddingBottom, image, imageWidth, imageHeight, verticalAlign = 'center', buttonsStretched = true, buttonsAlign = 'center', ariaLabel, dataQa, }) => {
|
|
11
|
+
const Placeholder = ({ title, titleProps, description, maxWidth, minHeight, buttonPrimary, buttonSecondary, buttonTertiary, showButtons = true, paddingTop, paddingBottom, image, imageWidth, imageHeight, verticalAlign = 'center', buttonsStretched = true, buttonsAlign = 'center', 'aria-label': ariaLabel, 'data-qa': dataQa, }) => {
|
|
12
12
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
13
13
|
const [isLoadingError, setIsLoadingError] = useState(false);
|
|
14
14
|
const containerStyles = getContainerStyles({ paddingTop, paddingBottom, maxWidth, minHeight });
|
package/Placeholder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.js","sources":["../src/Placeholder.tsx"],"sourcesContent":["import { FC, useState } from 'react';\nimport classnames from 'classnames';\n\nimport { PlaceholderProps } from '@hh.ru/magritte-ui-placeholder/types';\nimport { getContainerStyles } from '@hh.ru/magritte-ui-placeholder/utils';\nimport { Title } from '@hh.ru/magritte-ui-title';\n\nimport styles from './placeholder.less';\n\nconst PLACEHOLDER_IMAGE_HEIGHT = 200;\n\nexport const Placeholder: FC<PlaceholderProps> = ({\n title,\n titleProps,\n description,\n maxWidth,\n minHeight,\n buttonPrimary,\n buttonSecondary,\n buttonTertiary,\n showButtons = true,\n paddingTop,\n paddingBottom,\n image,\n imageWidth,\n imageHeight,\n verticalAlign = 'center',\n buttonsStretched = true,\n buttonsAlign = 'center',\n ariaLabel,\n dataQa,\n}) => {\n const [isLoaded, setIsLoaded] = useState(false);\n const [isLoadingError, setIsLoadingError] = useState(false);\n const containerStyles = getContainerStyles({ paddingTop, paddingBottom, maxWidth, minHeight });\n const hasAnyButton = !!(buttonPrimary || buttonSecondary || buttonTertiary);\n return (\n <div\n className={classnames(styles.placeholderContainer, {\n [styles.placeholderContainerVerticalAlignTop]: verticalAlign === 'top',\n [styles.placeholderContainerVerticalAlignCenter]: verticalAlign === 'center',\n [styles.placeholderContainerVerticalAlignBottom]: verticalAlign === 'bottom',\n })}\n style={containerStyles}\n data-qa={dataQa}\n >\n {!!image && (\n <div className={styles.placeholderImageContainer}>\n <img\n onLoad={() => {\n setIsLoaded(true);\n }}\n onError={() => {\n setIsLoaded(false);\n setIsLoadingError(true);\n }}\n src={image}\n alt={ariaLabel}\n className={classnames(styles.placeholderImage, {\n [styles.placeholderImageHidden]: isLoadingError,\n })}\n width={imageWidth}\n height={!isLoaded && !imageHeight ? PLACEHOLDER_IMAGE_HEIGHT : imageHeight}\n />\n </div>\n )}\n <Title size=\"medium\" alignment=\"center\" Element=\"h2\" description={description} {...titleProps}>\n {title}\n </Title>\n {showButtons && hasAnyButton && (\n <div\n className={classnames(styles.placeholderButtons, {\n [styles.placeholderButtonsNoStretch]: !buttonsStretched,\n [styles.placeholderButtonsAlignLeft]: buttonsAlign === 'left',\n [styles.placeholderButtonsAlignCenter]: buttonsAlign === 'center',\n })}\n >\n {buttonPrimary}\n {buttonSecondary}\n {buttonTertiary}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AASA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAExB,MAAA,WAAW,GAAyB,CAAC,EAC9C,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,GAAG,IAAI,EAClB,UAAU,EACV,aAAa,EACb,KAAK,EACL,UAAU,EACV,WAAW,EACX,aAAa,GAAG,QAAQ,EACxB,gBAAgB,GAAG,IAAI,EACvB,YAAY,GAAG,QAAQ,EACvB,SAAS,
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sources":["../src/Placeholder.tsx"],"sourcesContent":["import { FC, useState } from 'react';\nimport classnames from 'classnames';\n\nimport { PlaceholderProps } from '@hh.ru/magritte-ui-placeholder/types';\nimport { getContainerStyles } from '@hh.ru/magritte-ui-placeholder/utils';\nimport { Title } from '@hh.ru/magritte-ui-title';\n\nimport styles from './placeholder.less';\n\nconst PLACEHOLDER_IMAGE_HEIGHT = 200;\n\nexport const Placeholder: FC<PlaceholderProps> = ({\n title,\n titleProps,\n description,\n maxWidth,\n minHeight,\n buttonPrimary,\n buttonSecondary,\n buttonTertiary,\n showButtons = true,\n paddingTop,\n paddingBottom,\n image,\n imageWidth,\n imageHeight,\n verticalAlign = 'center',\n buttonsStretched = true,\n buttonsAlign = 'center',\n 'aria-label': ariaLabel,\n 'data-qa': dataQa,\n}) => {\n const [isLoaded, setIsLoaded] = useState(false);\n const [isLoadingError, setIsLoadingError] = useState(false);\n const containerStyles = getContainerStyles({ paddingTop, paddingBottom, maxWidth, minHeight });\n const hasAnyButton = !!(buttonPrimary || buttonSecondary || buttonTertiary);\n return (\n <div\n className={classnames(styles.placeholderContainer, {\n [styles.placeholderContainerVerticalAlignTop]: verticalAlign === 'top',\n [styles.placeholderContainerVerticalAlignCenter]: verticalAlign === 'center',\n [styles.placeholderContainerVerticalAlignBottom]: verticalAlign === 'bottom',\n })}\n style={containerStyles}\n data-qa={dataQa}\n >\n {!!image && (\n <div className={styles.placeholderImageContainer}>\n <img\n onLoad={() => {\n setIsLoaded(true);\n }}\n onError={() => {\n setIsLoaded(false);\n setIsLoadingError(true);\n }}\n src={image}\n alt={ariaLabel}\n className={classnames(styles.placeholderImage, {\n [styles.placeholderImageHidden]: isLoadingError,\n })}\n width={imageWidth}\n height={!isLoaded && !imageHeight ? PLACEHOLDER_IMAGE_HEIGHT : imageHeight}\n />\n </div>\n )}\n <Title size=\"medium\" alignment=\"center\" Element=\"h2\" description={description} {...titleProps}>\n {title}\n </Title>\n {showButtons && hasAnyButton && (\n <div\n className={classnames(styles.placeholderButtons, {\n [styles.placeholderButtonsNoStretch]: !buttonsStretched,\n [styles.placeholderButtonsAlignLeft]: buttonsAlign === 'left',\n [styles.placeholderButtonsAlignCenter]: buttonsAlign === 'center',\n })}\n >\n {buttonPrimary}\n {buttonSecondary}\n {buttonTertiary}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AASA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAExB,MAAA,WAAW,GAAyB,CAAC,EAC9C,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,GAAG,IAAI,EAClB,UAAU,EACV,aAAa,EACb,KAAK,EACL,UAAU,EACV,WAAW,EACX,aAAa,GAAG,QAAQ,EACxB,gBAAgB,GAAG,IAAI,EACvB,YAAY,GAAG,QAAQ,EACvB,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,MAAM,GACpB,KAAI;IACD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5D,IAAA,MAAM,eAAe,GAAG,kBAAkB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/F,MAAM,YAAY,GAAG,CAAC,EAAE,aAAa,IAAI,eAAe,IA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AC,kBAAkB,EAAE;AAC7C,oBAAA,CAAC,MAAM,CAAC,2BAA2B,GAAG,CAAC,gBAAgB;AACvD,oBAAA,CAAC,MAAM,CAAC,2BAA2B,GAAG,YAAY,KAAK,MAAM;AAC7D,oBAAA,CAAC,MAAM,CAAC,6BAA6B,GAAG,YAAY,KAAK,QAAQ;iBACpE,CAAC,EAAA,QAAA,EAAA,CAED,aAAa,EACb,eAAe,EACf,cAAc,CACb,EAAA,CAAA,CACT,CACC,EAAA,CAAA,EACR;AACN;;;;"}
|
package/index.css
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
.magritte-placeholder-
|
|
1
|
+
.magritte-placeholder-container___4kN6h_7-0-0{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
flex:1;
|
|
5
5
|
margin:auto;
|
|
6
6
|
height:inherit;
|
|
7
7
|
}
|
|
8
|
-
.magritte-placeholder-container_vertical-align-
|
|
8
|
+
.magritte-placeholder-container_vertical-align-top___mKdWm_7-0-0{
|
|
9
9
|
justify-content:flex-start;
|
|
10
10
|
}
|
|
11
|
-
.magritte-placeholder-container_vertical-align-
|
|
11
|
+
.magritte-placeholder-container_vertical-align-center___S3DkI_7-0-0{
|
|
12
12
|
justify-content:center;
|
|
13
13
|
}
|
|
14
|
-
.magritte-placeholder-container_vertical-align-bottom___Zo2-
|
|
14
|
+
.magritte-placeholder-container_vertical-align-bottom___Zo2-M_7-0-0{
|
|
15
15
|
justify-content:flex-end;
|
|
16
16
|
}
|
|
17
|
-
.magritte-placeholder-buttons___FO-
|
|
17
|
+
.magritte-placeholder-buttons___FO-A6_7-0-0{
|
|
18
18
|
display:flex;
|
|
19
19
|
flex-direction:column;
|
|
20
20
|
gap:12px;
|
|
21
21
|
margin-top:32px;
|
|
22
22
|
}
|
|
23
23
|
@media (min-width: 1020px){
|
|
24
|
-
body.magritte-old-layout .magritte-placeholder-buttons_no-
|
|
24
|
+
body.magritte-old-layout .magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0{
|
|
25
25
|
flex-direction:row;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
@media (min-width: 1024px){
|
|
29
|
-
body:not(.magritte-old-layout) .magritte-placeholder-buttons_no-
|
|
29
|
+
body:not(.magritte-old-layout) .magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0{
|
|
30
30
|
flex-direction:row;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
.magritte-placeholder-buttons_no-
|
|
33
|
+
.magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0.magritte-placeholder-buttons_align-left___mzBmy_7-0-0{
|
|
34
34
|
justify-content:flex-start;
|
|
35
35
|
}
|
|
36
|
-
.magritte-placeholder-buttons_no-
|
|
36
|
+
.magritte-placeholder-buttons_no-stretch___04p3Z_7-0-0.magritte-placeholder-buttons_align-center___7QhoH_7-0-0{
|
|
37
37
|
justify-content:center;
|
|
38
38
|
}
|
|
39
|
-
.magritte-placeholder-image-
|
|
39
|
+
.magritte-placeholder-image-container___3eIPQ_7-0-0{
|
|
40
40
|
margin-bottom:32px;
|
|
41
41
|
display:flex;
|
|
42
42
|
align-content:center;
|
|
43
43
|
justify-content:center;
|
|
44
44
|
}
|
|
45
|
-
.magritte-placeholder-
|
|
45
|
+
.magritte-placeholder-image___bMcah_7-0-0{
|
|
46
46
|
max-width:100%;
|
|
47
47
|
max-height:100%;
|
|
48
48
|
object-fit:contain;
|
|
49
49
|
}
|
|
50
|
-
.magritte-placeholder-
|
|
50
|
+
.magritte-placeholder-image_hidden___5fOaL_7-0-0{
|
|
51
51
|
visibility:hidden;
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-placeholder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@hh.ru/magritte-design-tokens": "18.1.2",
|
|
23
23
|
"@hh.ru/magritte-ui-breakpoint": "4.0.1",
|
|
24
24
|
"@hh.ru/magritte-ui-theme-provider": "1.1.22",
|
|
25
|
-
"@hh.ru/magritte-ui-title": "
|
|
25
|
+
"@hh.ru/magritte-ui-title": "5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"classnames": ">=2.3.2",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "77a359961872f43d688f9507b225fa72ba99a3e8"
|
|
35
35
|
}
|
package/types.d.ts
CHANGED
|
@@ -37,9 +37,9 @@ interface PlaceholderBaseProps {
|
|
|
37
37
|
/** Выравнивание кнопок по горизонтали */
|
|
38
38
|
buttonsAlign?: PlaceholderButtonsAlign;
|
|
39
39
|
/** Лейбл картинки для скринридеров (подставляется в alt картинки) */
|
|
40
|
-
|
|
40
|
+
'aria-label'?: string;
|
|
41
41
|
/** data-qa атрибут для контейнера */
|
|
42
|
-
|
|
42
|
+
'data-qa'?: string;
|
|
43
43
|
}
|
|
44
44
|
interface PlaceholderButtonsProps {
|
|
45
45
|
/** Primary кнопка (компонент Button) */
|