@hh.ru/magritte-ui-placeholder 11.0.0 → 11.0.2
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 +1 -1
- package/Placeholder.js.map +1 -1
- package/index.css +9 -9
- package/package.json +8 -8
- package/utils.js.map +1 -1
package/Placeholder.js
CHANGED
|
@@ -8,7 +8,7 @@ import { ScrollbarContainer } from '@hh.ru/magritte-ui-scrollbar';
|
|
|
8
8
|
import { VSpacing } from '@hh.ru/magritte-ui-spacing';
|
|
9
9
|
import { Title } from '@hh.ru/magritte-ui-title';
|
|
10
10
|
|
|
11
|
-
var styles = {"placeholder":"magritte-placeholder___8EHpb_11-0-
|
|
11
|
+
var styles = {"placeholder":"magritte-placeholder___8EHpb_11-0-2","vertical-align-top":"magritte-vertical-align-top___nmf-X_11-0-2","verticalAlignTop":"magritte-vertical-align-top___nmf-X_11-0-2","vertical-align-center":"magritte-vertical-align-center___-QB1n_11-0-2","verticalAlignCenter":"magritte-vertical-align-center___-QB1n_11-0-2","vertical-align-bottom":"magritte-vertical-align-bottom___l9O6B_11-0-2","verticalAlignBottom":"magritte-vertical-align-bottom___l9O6B_11-0-2","title-container":"magritte-title-container___dki9b_11-0-2","titleContainer":"magritte-title-container___dki9b_11-0-2","image-container":"magritte-image-container___n7AQh_11-0-2","imageContainer":"magritte-image-container___n7AQh_11-0-2","content":"magritte-content___J6qIa_11-0-2","placeholder-image":"magritte-placeholder-image___bMcah_11-0-2","placeholderImage":"magritte-placeholder-image___bMcah_11-0-2","placeholder-image_hidden":"magritte-placeholder-image_hidden___5fOaL_11-0-2","placeholderImageHidden":"magritte-placeholder-image_hidden___5fOaL_11-0-2"};
|
|
12
12
|
|
|
13
13
|
const PLACEHOLDER_IMAGE_HEIGHT = 200;
|
|
14
14
|
const Placeholder = ({ title, titleProps, description, children, buttons, maxWidth, minHeight, gapTop = 24, gapBottom = 24, paddingTop, paddingBottom, 'data-qa': dataQa, verticalAlign = 'center', }) => {
|
package/Placeholder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placeholder.js","sources":["
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sources":["src/Placeholder.tsx"],"sourcesContent":["import { isValidElement, useState } from 'react';\nimport classnames from 'classnames';\n\nimport { CENTERED_WRAPPER_CLASS } from '@hh.ru/magritte-ui-button-stack';\nimport { PlaceholderProps } from '@hh.ru/magritte-ui-placeholder/types';\nimport { getContainerStyles } from '@hh.ru/magritte-ui-placeholder/utils';\nimport { ScrollbarContainer } from '@hh.ru/magritte-ui-scrollbar';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\nimport { Title } from '@hh.ru/magritte-ui-title';\n\nimport styles from './placeholder.less';\n\nconst PLACEHOLDER_IMAGE_HEIGHT = 200;\n\nexport const Placeholder: React.FC<PlaceholderProps> & {\n Image: React.FC<React.ImgHTMLAttributes<HTMLImageElement>>;\n} = ({\n title,\n titleProps,\n description,\n children,\n buttons,\n\n maxWidth,\n minHeight,\n gapTop = 24,\n gapBottom = 24,\n paddingTop,\n paddingBottom,\n\n 'data-qa': dataQa,\n verticalAlign = 'center',\n}) => {\n return (\n <div\n className={classnames(styles.placeholder, {\n [styles.verticalAlignTop]: verticalAlign === 'top',\n [styles.verticalAlignCenter]: verticalAlign === 'center',\n [styles.verticalAlignBottom]: verticalAlign === 'bottom',\n })}\n style={getContainerStyles({ paddingTop, paddingBottom, maxWidth, minHeight })}\n data-qa={dataQa}\n >\n {isValidElement(children) && children.type === Placeholder.Image ? (\n children\n ) : (\n <div className={styles.content}>\n <ScrollbarContainer>{children}</ScrollbarContainer>\n </div>\n )}\n {Boolean(children) && <VSpacing default={gapTop} />}\n <div className={styles.titleContainer}>\n <Title size=\"medium\" alignment=\"center\" Element=\"h2\" description={description} {...titleProps}>\n {title}\n </Title>\n </div>\n {Boolean(buttons) && <VSpacing default={gapBottom} />}\n <div className={CENTERED_WRAPPER_CLASS}>{buttons}</div>\n </div>\n );\n};\n\nconst PlaceholderImage: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = (props) => {\n const [isLoaded, setIsLoaded] = useState(false);\n const [isLoadingError, setIsLoadingError] = useState(false);\n return (\n <div className={styles.imageContainer}>\n <img\n {...props}\n onLoad={(event) => {\n props.onLoad?.(event);\n setIsLoaded(true);\n }}\n onError={(event) => {\n props.onError?.(event);\n setIsLoaded(false);\n setIsLoadingError(true);\n }}\n className={classnames(props.className, styles.placeholderImage, {\n [styles.placeholderImageHidden]: isLoadingError,\n })}\n width={props.width}\n height={!isLoaded && !props.height ? PLACEHOLDER_IMAGE_HEIGHT : props.height}\n />\n </div>\n );\n};\n\nPlaceholderImage.displayName = 'Placeholder.Image';\nPlaceholder.Image = PlaceholderImage;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAYA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAExB,MAAA,WAAW,GAEpB,CAAC,EACD,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,OAAO,EAEP,QAAQ,EACR,SAAS,EACT,MAAM,GAAG,EAAE,EACX,SAAS,GAAG,EAAE,EACd,UAAU,EACV,aAAa,EAEb,SAAS,EAAE,MAAM,EACjB,aAAa,GAAG,QAAQ,GAC3B,KAAI;IACD,QACIA,cACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE;AACtC,YAAA,CAAC,MAAM,CAAC,gBAAgB,GAAG,aAAa,KAAK,KAAK;AAClD,YAAA,CAAC,MAAM,CAAC,mBAAmB,GAAG,aAAa,KAAK,QAAQ;AACxD,YAAA,CAAC,MAAM,CAAC,mBAAmB,GAAG,aAAa,KAAK,QAAQ;SAC3D,CAAC,EACF,KAAK,EAAE,kBAAkB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EACpE,SAAA,EAAA,MAAM,EAEd,QAAA,EAAA,CAAA,cAAc,CAAC,QAAQ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KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;gBACtB,WAAW,CAAC,IAAI,CAAC,CAAC;AACtB,aAAC,EACD,OAAO,EAAE,CAAC,KAAK,KAAI;AACf,gBAAA,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;gBACvB,WAAW,CAAC,KAAK,CAAC,CAAC;gBACnB,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAC5B,aAAC,EACD,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAE;AAC5D,gBAAA,CAAC,MAAM,CAAC,sBAAsB,GAAG,cAAc;AAClD,aAAA,CAAC,EACF,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,wBAAwB,GAAG,KAAK,CAAC,MAAM,EAC9E,CAAA,EAAA,CACA,EACR;AACN,CAAC,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AACnD,WAAW,CAAC,KAAK,GAAG,gBAAgB;;;;"}
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.magritte-placeholder___8EHpb_11-0-
|
|
1
|
+
.magritte-placeholder___8EHpb_11-0-2{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
flex:1;
|
|
@@ -6,32 +6,32 @@
|
|
|
6
6
|
height:inherit;
|
|
7
7
|
box-sizing:border-box;
|
|
8
8
|
}
|
|
9
|
-
.magritte-vertical-align-top___nmf-X_11-0-
|
|
9
|
+
.magritte-vertical-align-top___nmf-X_11-0-2{
|
|
10
10
|
justify-content:flex-start;
|
|
11
11
|
}
|
|
12
|
-
.magritte-vertical-align-center___-QB1n_11-0-
|
|
12
|
+
.magritte-vertical-align-center___-QB1n_11-0-2{
|
|
13
13
|
justify-content:center;
|
|
14
14
|
}
|
|
15
|
-
.magritte-vertical-align-bottom___l9O6B_11-0-
|
|
15
|
+
.magritte-vertical-align-bottom___l9O6B_11-0-2{
|
|
16
16
|
justify-content:flex-end;
|
|
17
17
|
}
|
|
18
|
-
.magritte-title-container___dki9b_11-0-
|
|
18
|
+
.magritte-title-container___dki9b_11-0-2{
|
|
19
19
|
padding:0 12px;
|
|
20
20
|
}
|
|
21
|
-
.magritte-image-container___n7AQh_11-0-
|
|
21
|
+
.magritte-image-container___n7AQh_11-0-2{
|
|
22
22
|
display:flex;
|
|
23
23
|
align-content:center;
|
|
24
24
|
justify-content:center;
|
|
25
25
|
min-height:0;
|
|
26
26
|
}
|
|
27
|
-
.magritte-content___J6qIa_11-0-
|
|
27
|
+
.magritte-content___J6qIa_11-0-2{
|
|
28
28
|
overflow:hidden;
|
|
29
29
|
}
|
|
30
|
-
.magritte-placeholder-image___bMcah_11-0-
|
|
30
|
+
.magritte-placeholder-image___bMcah_11-0-2{
|
|
31
31
|
max-width:100%;
|
|
32
32
|
max-height:100%;
|
|
33
33
|
object-fit:contain;
|
|
34
34
|
}
|
|
35
|
-
.magritte-placeholder-image_hidden___5fOaL_11-0-
|
|
35
|
+
.magritte-placeholder-image_hidden___5fOaL_11-0-2{
|
|
36
36
|
visibility:hidden;
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-placeholder",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"watch": "yarn root:watch $(pwd)"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@hh.ru/magritte-design-tokens": "24.4.
|
|
23
|
-
"@hh.ru/magritte-ui-breakpoint": "6.0.
|
|
24
|
-
"@hh.ru/magritte-ui-button-stack": "3.0.
|
|
25
|
-
"@hh.ru/magritte-ui-scrollbar": "1.0.
|
|
26
|
-
"@hh.ru/magritte-ui-spacing": "2.1.
|
|
27
|
-
"@hh.ru/magritte-ui-title": "7.0.
|
|
22
|
+
"@hh.ru/magritte-design-tokens": "24.4.1",
|
|
23
|
+
"@hh.ru/magritte-ui-breakpoint": "6.0.7",
|
|
24
|
+
"@hh.ru/magritte-ui-button-stack": "3.0.2",
|
|
25
|
+
"@hh.ru/magritte-ui-scrollbar": "1.0.18",
|
|
26
|
+
"@hh.ru/magritte-ui-spacing": "2.1.11",
|
|
27
|
+
"@hh.ru/magritte-ui-title": "7.0.30"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"classnames": ">=2.3.2",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "ec7d56f576ca5581c2acb5010b53bbfb8da52962"
|
|
37
37
|
}
|
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["src/utils.ts"],"sourcesContent":["import { PlaceholderProps } from '@hh.ru/magritte-ui-placeholder/types';\n\nexport const getContainerStyles = ({\n paddingTop,\n paddingBottom,\n maxWidth,\n minHeight,\n}: {\n paddingTop: PlaceholderProps['paddingTop'];\n paddingBottom: PlaceholderProps['paddingBottom'];\n maxWidth: PlaceholderProps['maxWidth'];\n minHeight: PlaceholderProps['minHeight'];\n}): Record<string, string> => {\n const containerStyles: Record<string, string> = {};\n if (paddingTop !== undefined) {\n containerStyles.paddingTop = `${paddingTop}px`;\n }\n if (paddingBottom !== undefined) {\n containerStyles.paddingBottom = `${paddingBottom}px`;\n }\n if (maxWidth !== undefined) {\n containerStyles.maxWidth = `${maxWidth}${isNaN(+maxWidth) ? '' : 'px'}`;\n }\n if (minHeight !== undefined) {\n containerStyles.minHeight = `${minHeight}px`;\n }\n return containerStyles;\n};\n"],"names":[],"mappings":"AAEO,MAAM,kBAAkB,GAAG,CAAC,EAC/B,UAAU,EACV,aAAa,EACb,QAAQ,EACR,SAAS,GAMZ,KAA4B;IACzB,MAAM,eAAe,GAA2B,EAAE,CAAC;AACnD,IAAA,IAAI,UAAU,KAAK,SAAS,EAAE;AAC1B,QAAA,eAAe,CAAC,UAAU,GAAG,CAAG,EAAA,UAAU,IAAI,CAAC;KAClD;AACD,IAAA,IAAI,aAAa,KAAK,SAAS,EAAE;AAC7B,QAAA,eAAe,CAAC,aAAa,GAAG,CAAG,EAAA,aAAa,IAAI,CAAC;KACxD;AACD,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;QACxB,eAAe,CAAC,QAAQ,GAAG,CAAA,EAAG,QAAQ,CAAG,EAAA,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;KAC3E;AACD,IAAA,IAAI,SAAS,KAAK,SAAS,EAAE;AACzB,QAAA,eAAe,CAAC,SAAS,GAAG,CAAG,EAAA,SAAS,IAAI,CAAC;KAChD;AACD,IAAA,OAAO,eAAe,CAAC;AAC3B;;;;"}
|