@hh.ru/magritte-ui-placeholder 11.1.47 → 11.1.49
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.d.ts +1 -1
- package/Placeholder.js +58 -20
- package/Placeholder.js.map +1 -1
- package/index.css +9 -9
- package/index.d.ts +2 -2
- package/index.mock.d.ts +1 -1
- package/index.mock.js +2 -2
- package/index.mock.js.map +1 -1
- package/package.json +6 -6
- package/utils.d.ts +5 -5
- package/utils.js +20 -15
- package/utils.js.map +1 -1
package/Placeholder.d.ts
CHANGED
package/Placeholder.js
CHANGED
|
@@ -7,31 +7,69 @@ import { getContainerStyles } from './utils.js';
|
|
|
7
7
|
import { VSpacing } from '@hh.ru/magritte-ui-spacing';
|
|
8
8
|
import { Title } from '@hh.ru/magritte-ui-title';
|
|
9
9
|
|
|
10
|
-
var styles = {"placeholder":"magritte-placeholder___8EHpb_11-1-
|
|
10
|
+
var styles = {"placeholder":"magritte-placeholder___8EHpb_11-1-49","vertical-align-top":"magritte-vertical-align-top___nmf-X_11-1-49","verticalAlignTop":"magritte-vertical-align-top___nmf-X_11-1-49","vertical-align-center":"magritte-vertical-align-center___-QB1n_11-1-49","verticalAlignCenter":"magritte-vertical-align-center___-QB1n_11-1-49","vertical-align-bottom":"magritte-vertical-align-bottom___l9O6B_11-1-49","verticalAlignBottom":"magritte-vertical-align-bottom___l9O6B_11-1-49","title-container":"magritte-title-container___dki9b_11-1-49","titleContainer":"magritte-title-container___dki9b_11-1-49","image-container":"magritte-image-container___n7AQh_11-1-49","imageContainer":"magritte-image-container___n7AQh_11-1-49","content":"magritte-content___J6qIa_11-1-49","placeholder-image":"magritte-placeholder-image___bMcah_11-1-49","placeholderImage":"magritte-placeholder-image___bMcah_11-1-49","placeholder-image_hidden":"magritte-placeholder-image_hidden___5fOaL_11-1-49","placeholderImageHidden":"magritte-placeholder-image_hidden___5fOaL_11-1-49"};
|
|
11
11
|
|
|
12
12
|
const PLACEHOLDER_IMAGE_HEIGHT = 200;
|
|
13
|
-
const Placeholder = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const Placeholder = ({
|
|
14
|
+
title,
|
|
15
|
+
titleProps,
|
|
16
|
+
description,
|
|
17
|
+
children,
|
|
18
|
+
buttons,
|
|
19
|
+
maxWidth,
|
|
20
|
+
minHeight,
|
|
21
|
+
gapTop = 24,
|
|
22
|
+
gapBottom = 24,
|
|
23
|
+
paddingTop,
|
|
24
|
+
paddingBottom,
|
|
25
|
+
"data-qa": dataQa,
|
|
26
|
+
verticalAlign = "center"
|
|
27
|
+
}) => {
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: classnames(styles.placeholder, {
|
|
32
|
+
[styles.verticalAlignTop]: verticalAlign === "top",
|
|
33
|
+
[styles.verticalAlignCenter]: verticalAlign === "center",
|
|
34
|
+
[styles.verticalAlignBottom]: verticalAlign === "bottom"
|
|
35
|
+
}),
|
|
36
|
+
style: getContainerStyles({ paddingTop, paddingBottom, maxWidth, minHeight }),
|
|
37
|
+
"data-qa": dataQa,
|
|
38
|
+
children: [
|
|
39
|
+
isValidElement(children) && children.type === Placeholder.Image ? children : /* @__PURE__ */ jsx("div", { className: styles.content, children }),
|
|
40
|
+
Boolean(children) && /* @__PURE__ */ jsx(VSpacing, { default: gapTop }),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: styles.titleContainer, children: /* @__PURE__ */ jsx(Title, { size: "medium", alignment: "center", Element: "h2", description, ...titleProps, children: title }) }),
|
|
42
|
+
Boolean(buttons) && /* @__PURE__ */ jsx(VSpacing, { default: gapBottom }),
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: CENTERED_WRAPPER_CLASS, children: buttons })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
19
47
|
};
|
|
20
48
|
const PlaceholderImage = (props) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
50
|
+
const [isLoadingError, setIsLoadingError] = useState(false);
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: styles.imageContainer, children: /* @__PURE__ */ jsx(
|
|
52
|
+
"img",
|
|
53
|
+
{
|
|
54
|
+
...props,
|
|
55
|
+
onLoad: (event) => {
|
|
56
|
+
props.onLoad?.(event);
|
|
57
|
+
setIsLoaded(true);
|
|
58
|
+
},
|
|
59
|
+
onError: (event) => {
|
|
60
|
+
props.onError?.(event);
|
|
61
|
+
setIsLoaded(false);
|
|
62
|
+
setIsLoadingError(true);
|
|
63
|
+
},
|
|
64
|
+
className: classnames(props.className, styles.placeholderImage, {
|
|
65
|
+
[styles.placeholderImageHidden]: isLoadingError
|
|
66
|
+
}),
|
|
67
|
+
width: props.width,
|
|
68
|
+
height: !isLoaded && !props.height ? PLACEHOLDER_IMAGE_HEIGHT : props.height
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
33
71
|
};
|
|
34
|
-
PlaceholderImage.displayName =
|
|
72
|
+
PlaceholderImage.displayName = "Placeholder.Image";
|
|
35
73
|
Placeholder.Image = PlaceholderImage;
|
|
36
74
|
|
|
37
75
|
export { Placeholder };
|
package/Placeholder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 { 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}>{children}</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":[
|
|
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 { 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}>{children}</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":[],"mappings":"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"}
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.magritte-placeholder___8EHpb_11-1-
|
|
1
|
+
.magritte-placeholder___8EHpb_11-1-49{
|
|
2
2
|
display:flex;
|
|
3
3
|
flex-direction:column;
|
|
4
4
|
flex:1;
|
|
@@ -6,33 +6,33 @@
|
|
|
6
6
|
height:inherit;
|
|
7
7
|
box-sizing:border-box;
|
|
8
8
|
}
|
|
9
|
-
.magritte-vertical-align-top___nmf-X_11-1-
|
|
9
|
+
.magritte-vertical-align-top___nmf-X_11-1-49{
|
|
10
10
|
justify-content:flex-start;
|
|
11
11
|
}
|
|
12
|
-
.magritte-vertical-align-center___-QB1n_11-1-
|
|
12
|
+
.magritte-vertical-align-center___-QB1n_11-1-49{
|
|
13
13
|
justify-content:center;
|
|
14
14
|
}
|
|
15
|
-
.magritte-vertical-align-bottom___l9O6B_11-1-
|
|
15
|
+
.magritte-vertical-align-bottom___l9O6B_11-1-49{
|
|
16
16
|
justify-content:flex-end;
|
|
17
17
|
}
|
|
18
|
-
.magritte-title-container___dki9b_11-1-
|
|
18
|
+
.magritte-title-container___dki9b_11-1-49{
|
|
19
19
|
padding:0 12px;
|
|
20
20
|
}
|
|
21
|
-
.magritte-image-container___n7AQh_11-1-
|
|
21
|
+
.magritte-image-container___n7AQh_11-1-49{
|
|
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-1-
|
|
27
|
+
.magritte-content___J6qIa_11-1-49{
|
|
28
28
|
display:flex;
|
|
29
29
|
justify-content:center;
|
|
30
30
|
}
|
|
31
|
-
.magritte-placeholder-image___bMcah_11-1-
|
|
31
|
+
.magritte-placeholder-image___bMcah_11-1-49{
|
|
32
32
|
max-width:100%;
|
|
33
33
|
max-height:100%;
|
|
34
34
|
object-fit:contain;
|
|
35
35
|
}
|
|
36
|
-
.magritte-placeholder-image_hidden___5fOaL_11-1-
|
|
36
|
+
.magritte-placeholder-image_hidden___5fOaL_11-1-49{
|
|
37
37
|
visibility:hidden;
|
|
38
38
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export { type PlaceholderProps, type PlaceholderVerticalAlign } from '
|
|
1
|
+
export * from './Placeholder';
|
|
2
|
+
export { type PlaceholderProps, type PlaceholderVerticalAlign } from './types';
|
package/index.mock.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
export { type PlaceholderProps, type PlaceholderVerticalAlign } from '
|
|
2
|
+
export { type PlaceholderProps, type PlaceholderVerticalAlign } from './types';
|
|
3
3
|
export declare const Placeholder: FC<Record<string, unknown>>;
|
package/index.mock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
|
|
3
3
|
|
|
4
|
-
const Placeholder = mockComponent(
|
|
5
|
-
|
|
4
|
+
const Placeholder = mockComponent("Placeholder", void 0, {
|
|
5
|
+
withChildren: true
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export { Placeholder };
|
package/index.mock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport { type PlaceholderProps, type PlaceholderVerticalAlign } from '@hh.ru/magritte-ui-placeholder/types';\n\nexport const Placeholder: FC<Record<string, unknown>> = mockComponent('Placeholder', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport { type PlaceholderProps, type PlaceholderVerticalAlign } from '@hh.ru/magritte-ui-placeholder/types';\n\nexport const Placeholder: FC<Record<string, unknown>> = mockComponent('Placeholder', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;AAMa,MAAA,WAAA,GAA2C,aAAc,CAAA,aAAA,EAAe,KAAW,CAAA,EAAA;AAAA,EAC5F,YAAc,EAAA,IAAA;AAClB,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-placeholder",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.49",
|
|
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": "
|
|
22
|
+
"@hh.ru/magritte-design-tokens": "26.0.1",
|
|
23
23
|
"@hh.ru/magritte-ui-breakpoint": "6.1.2",
|
|
24
|
-
"@hh.ru/magritte-ui-button-stack": "4.0.
|
|
24
|
+
"@hh.ru/magritte-ui-button-stack": "4.0.36",
|
|
25
25
|
"@hh.ru/magritte-ui-mock-component": "1.1.8",
|
|
26
|
-
"@hh.ru/magritte-ui-spacing": "2.1.
|
|
27
|
-
"@hh.ru/magritte-ui-title": "8.3.
|
|
26
|
+
"@hh.ru/magritte-ui-spacing": "2.1.31",
|
|
27
|
+
"@hh.ru/magritte-ui-title": "8.3.14"
|
|
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": "f6539d7a0e7cd42dd851458db1de04a748bbee03"
|
|
37
37
|
}
|
package/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlaceholderProps } from '
|
|
1
|
+
import { PlaceholderProps } from './types';
|
|
2
2
|
export declare const getContainerStyles: ({ paddingTop, paddingBottom, maxWidth, minHeight, }: {
|
|
3
|
-
paddingTop: PlaceholderProps[
|
|
4
|
-
paddingBottom: PlaceholderProps[
|
|
5
|
-
maxWidth: PlaceholderProps[
|
|
6
|
-
minHeight: PlaceholderProps[
|
|
3
|
+
paddingTop: PlaceholderProps['paddingTop'];
|
|
4
|
+
paddingBottom: PlaceholderProps['paddingBottom'];
|
|
5
|
+
maxWidth: PlaceholderProps['maxWidth'];
|
|
6
|
+
minHeight: PlaceholderProps['minHeight'];
|
|
7
7
|
}) => Record<string, string>;
|
package/utils.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import './index.css';
|
|
2
|
-
const getContainerStyles = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
const getContainerStyles = ({
|
|
3
|
+
paddingTop,
|
|
4
|
+
paddingBottom,
|
|
5
|
+
maxWidth,
|
|
6
|
+
minHeight
|
|
7
|
+
}) => {
|
|
8
|
+
const containerStyles = {};
|
|
9
|
+
if (paddingTop !== void 0) {
|
|
10
|
+
containerStyles.paddingTop = `${paddingTop}px`;
|
|
11
|
+
}
|
|
12
|
+
if (paddingBottom !== void 0) {
|
|
13
|
+
containerStyles.paddingBottom = `${paddingBottom}px`;
|
|
14
|
+
}
|
|
15
|
+
if (maxWidth !== void 0) {
|
|
16
|
+
containerStyles.maxWidth = `${maxWidth}${isNaN(+maxWidth) ? "" : "px"}`;
|
|
17
|
+
}
|
|
18
|
+
if (minHeight !== void 0) {
|
|
19
|
+
containerStyles.minHeight = `${minHeight}px`;
|
|
20
|
+
}
|
|
21
|
+
return containerStyles;
|
|
17
22
|
};
|
|
18
23
|
|
|
19
24
|
export { getContainerStyles };
|
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,qBAAqB,CAAC;AAAA,EAC/B,UAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AACJ,CAK8B,KAAA;AAC1B,EAAA,MAAM,kBAA0C,EAAC,CAAA;AACjD,EAAA,IAAI,eAAe,KAAW,CAAA,EAAA;AAC1B,IAAgB,eAAA,CAAA,UAAA,GAAa,GAAG,UAAU,CAAA,EAAA,CAAA,CAAA;AAAA,GAC9C;AACA,EAAA,IAAI,kBAAkB,KAAW,CAAA,EAAA;AAC7B,IAAgB,eAAA,CAAA,aAAA,GAAgB,GAAG,aAAa,CAAA,EAAA,CAAA,CAAA;AAAA,GACpD;AACA,EAAA,IAAI,aAAa,KAAW,CAAA,EAAA;AACxB,IAAgB,eAAA,CAAA,QAAA,GAAW,GAAG,QAAQ,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAI,GAAA,EAAA,GAAK,IAAI,CAAA,CAAA,CAAA;AAAA,GACzE;AACA,EAAA,IAAI,cAAc,KAAW,CAAA,EAAA;AACzB,IAAgB,eAAA,CAAA,SAAA,GAAY,GAAG,SAAS,CAAA,EAAA,CAAA,CAAA;AAAA,GAC5C;AACA,EAAO,OAAA,eAAA,CAAA;AACX;;;;"}
|