@hh.ru/magritte-ui-checkable-card 5.1.10 → 5.1.12
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/CheckableCard.d.ts +3 -3
- package/CheckableCard.js +93 -43
- package/CheckableCard.js.map +1 -1
- package/CheckableCardContainer.js +16 -6
- package/CheckableCardContainer.js.map +1 -1
- package/CheckableCardElement.d.ts +2 -2
- package/CheckableCardElement.js +73 -25
- package/CheckableCardElement.js.map +1 -1
- package/Skeleton.d.ts +1 -1
- package/Skeleton.js +29 -8
- package/Skeleton.js.map +1 -1
- package/checkable-card-DjoTmv6N.js +5 -0
- package/checkable-card-DjoTmv6N.js.map +1 -0
- package/index.css +294 -294
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/index.mock.d.ts +1 -1
- package/index.mock.js +14 -6
- package/index.mock.js.map +1 -1
- package/package.json +12 -11
- package/checkable-card-D6GxUFJb.js +0 -5
- package/checkable-card-D6GxUFJb.js.map +0 -1
package/CheckableCard.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CheckableCardProps } from '
|
|
2
|
-
export declare const CheckableCardComponent: import("react").ForwardRefExoticComponent<import("
|
|
1
|
+
import { CheckableCardProps } from './types';
|
|
2
|
+
export declare const CheckableCardComponent: import("react").ForwardRefExoticComponent<import("./types").CheckableCardNativeProps & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, keyof import("./types").CheckableCardBaseProps> & {
|
|
3
3
|
children?: import("react").ReactNode | undefined;
|
|
4
4
|
} & import("react").RefAttributes<HTMLLabelElement>>;
|
|
5
|
-
export declare const CheckableCard: import("@hh.ru/magritte-ui-skeleton").ComponentWithSkeleton<import("react").ForwardRefExoticComponent<import("
|
|
5
|
+
export declare const CheckableCard: import("@hh.ru/magritte-ui-skeleton").ComponentWithSkeleton<import("react").ForwardRefExoticComponent<import("./types").CheckableCardNativeProps & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, keyof import("./types").CheckableCardBaseProps> & {
|
|
6
6
|
children?: import("react").ReactNode | undefined;
|
|
7
7
|
} & import("react").RefAttributes<HTMLLabelElement>>, CheckableCardProps>;
|
package/CheckableCard.js
CHANGED
|
@@ -8,66 +8,116 @@ import { CheckableCardSkeleton } from './Skeleton.js';
|
|
|
8
8
|
import { useGalleryContext, useScrollableControls } from '@hh.ru/magritte-ui-scrollable-container';
|
|
9
9
|
import { enrichWithSkeleton } from '@hh.ru/magritte-ui-skeleton';
|
|
10
10
|
import 'classnames';
|
|
11
|
-
import './checkable-card-
|
|
11
|
+
import './checkable-card-DjoTmv6N.js';
|
|
12
12
|
import '@hh.ru/magritte-common-use-loading-state';
|
|
13
13
|
|
|
14
|
-
const CheckableCardComponent = forwardRef(
|
|
14
|
+
const CheckableCardComponent = forwardRef(
|
|
15
|
+
({
|
|
16
|
+
children,
|
|
17
|
+
padding = 0,
|
|
18
|
+
paddingLeft,
|
|
19
|
+
paddingRight,
|
|
20
|
+
paddingTop,
|
|
21
|
+
paddingBottom,
|
|
22
|
+
borderRadius = 0,
|
|
23
|
+
borderTopLeftRadius,
|
|
24
|
+
borderTopRightRadius,
|
|
25
|
+
borderBottomLeftRadius,
|
|
26
|
+
borderBottomRightRadius,
|
|
27
|
+
toneHover,
|
|
28
|
+
borderLayer,
|
|
29
|
+
onFocus,
|
|
30
|
+
onClick,
|
|
31
|
+
disabled,
|
|
32
|
+
type = "checkbox",
|
|
33
|
+
flexible,
|
|
34
|
+
labelDataQa,
|
|
35
|
+
respectContainer = false,
|
|
36
|
+
...inputProps
|
|
37
|
+
}, ref) => {
|
|
15
38
|
const contentRef = useRef(null);
|
|
16
39
|
const inputRef = useRef(null);
|
|
17
40
|
const forceDisabled = useDisabled();
|
|
18
41
|
const { registerItem, removeItem } = useGalleryContext();
|
|
19
42
|
const { scrollToItem } = useScrollableControls();
|
|
20
43
|
const stopKeyboardEventPropagation = (event) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
inputRef.current?.dispatchEvent(new KeyboardEvent(event.type, { key: event.key, code: event.code }));
|
|
44
|
+
if (event.target === inputRef.current || !keyboardMatches(event, [keyboardKeys.Space, keyboardKeys.Enter])) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
inputRef.current?.dispatchEvent(new KeyboardEvent(event.type, { key: event.key, code: event.code }));
|
|
27
49
|
};
|
|
28
50
|
useLayoutEffect(() => {
|
|
29
|
-
|
|
30
|
-
|
|
51
|
+
registerItem(contentRef);
|
|
52
|
+
return () => removeItem(contentRef);
|
|
31
53
|
}, [registerItem, removeItem]);
|
|
32
54
|
useLayoutEffect(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
+
if ((inputProps.checked || inputProps.defaultChecked) && type === "radio" && contentRef.current) {
|
|
56
|
+
scrollToItem(contentRef);
|
|
57
|
+
}
|
|
37
58
|
}, []);
|
|
38
59
|
const props = {
|
|
60
|
+
padding,
|
|
61
|
+
paddingLeft,
|
|
62
|
+
paddingRight,
|
|
63
|
+
paddingTop,
|
|
64
|
+
paddingBottom,
|
|
65
|
+
borderRadius,
|
|
66
|
+
borderTopLeftRadius,
|
|
67
|
+
borderTopRightRadius,
|
|
68
|
+
borderBottomLeftRadius,
|
|
69
|
+
borderBottomRightRadius,
|
|
70
|
+
disabled,
|
|
71
|
+
toneHover,
|
|
72
|
+
borderLayer,
|
|
73
|
+
flexible,
|
|
74
|
+
"data-qa": labelDataQa
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
CheckableCardElement,
|
|
78
|
+
{
|
|
79
|
+
...props,
|
|
80
|
+
onClickCapture: (event) => {
|
|
81
|
+
if (event.target === inputRef.current || !contentRef.current?.contains(event.target)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
inputRef.current?.click();
|
|
87
|
+
},
|
|
39
88
|
padding,
|
|
40
|
-
paddingLeft,
|
|
41
|
-
paddingRight,
|
|
42
|
-
paddingTop,
|
|
43
|
-
paddingBottom,
|
|
44
89
|
borderRadius,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
90
|
+
onKeyDownCapture: stopKeyboardEventPropagation,
|
|
91
|
+
onKeyPressCapture: stopKeyboardEventPropagation,
|
|
92
|
+
onKeyUpCapture: stopKeyboardEventPropagation,
|
|
93
|
+
input: /* @__PURE__ */ jsx(
|
|
94
|
+
"input",
|
|
95
|
+
{
|
|
96
|
+
...inputProps,
|
|
97
|
+
ref: inputRef,
|
|
98
|
+
type,
|
|
99
|
+
disabled: !!disabled || forceDisabled,
|
|
100
|
+
onFocus: (event) => {
|
|
101
|
+
onFocus?.(event);
|
|
102
|
+
scrollToItem(contentRef);
|
|
103
|
+
},
|
|
104
|
+
onClick: (event) => {
|
|
105
|
+
onClick?.(event);
|
|
106
|
+
scrollToItem(contentRef);
|
|
58
107
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
Element: "label",
|
|
111
|
+
ref,
|
|
112
|
+
contentRef,
|
|
113
|
+
disabled: !!disabled || forceDisabled,
|
|
114
|
+
respectContainer,
|
|
115
|
+
children
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
CheckableCardComponent.displayName = "CheckableCard";
|
|
71
121
|
const CheckableCard = enrichWithSkeleton(CheckableCardComponent, CheckableCardSkeleton);
|
|
72
122
|
|
|
73
123
|
export { CheckableCard, CheckableCardComponent };
|
package/CheckableCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckableCard.js","sources":["src/CheckableCard.tsx"],"sourcesContent":["import { forwardRef, useLayoutEffect, useRef } from 'react';\n\nimport { keyboardMatches, keyboardKeys } from '@hh.ru/magritte-common-keyboard';\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { CheckableCardSkeleton } from '@hh.ru/magritte-ui-checkable-card/Skeleton';\nimport { CheckableCardProps } from '@hh.ru/magritte-ui-checkable-card/types';\nimport { useGalleryContext, useScrollableControls } from '@hh.ru/magritte-ui-scrollable-container';\nimport { enrichWithSkeleton } from '@hh.ru/magritte-ui-skeleton';\n\nexport const CheckableCardComponent = forwardRef<HTMLLabelElement, React.PropsWithChildren<CheckableCardProps>>(\n (\n {\n children,\n padding = 0,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius = 0,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n toneHover,\n borderLayer,\n onFocus,\n onClick,\n disabled,\n type = 'checkbox',\n flexible,\n labelDataQa,\n respectContainer = false,\n ...inputProps\n },\n ref\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const forceDisabled = useDisabled();\n\n const { registerItem, removeItem } = useGalleryContext();\n const { scrollToItem } = useScrollableControls();\n\n const stopKeyboardEventPropagation: React.KeyboardEventHandler<HTMLLabelElement> = (event) => {\n if (\n event.target === inputRef.current ||\n !keyboardMatches(event, [keyboardKeys.Space, keyboardKeys.Enter])\n ) {\n return;\n }\n event.stopPropagation();\n inputRef.current?.dispatchEvent(new KeyboardEvent(event.type, { key: event.key, code: event.code }));\n };\n\n useLayoutEffect(() => {\n registerItem(contentRef);\n return () => removeItem(contentRef);\n }, [registerItem, removeItem]);\n\n useLayoutEffect(() => {\n if ((inputProps.checked || inputProps.defaultChecked) && type === 'radio' && contentRef.current) {\n scrollToItem(contentRef);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const props = {\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n disabled,\n toneHover,\n borderLayer,\n flexible,\n 'data-qa': labelDataQa,\n };\n\n return (\n <CheckableCardElement\n {...props}\n onClickCapture={(event) => {\n if (event.target === inputRef.current || !contentRef.current?.contains(event.target as Node)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n inputRef.current?.click();\n }}\n padding={padding}\n borderRadius={borderRadius}\n onKeyDownCapture={stopKeyboardEventPropagation}\n onKeyPressCapture={stopKeyboardEventPropagation}\n onKeyUpCapture={stopKeyboardEventPropagation}\n input={\n <input\n {...inputProps}\n ref={inputRef}\n type={type}\n disabled={!!disabled || forceDisabled}\n onFocus={(event) => {\n onFocus?.(event);\n scrollToItem(contentRef);\n }}\n onClick={(event) => {\n onClick?.(event);\n scrollToItem(contentRef);\n }}\n />\n }\n Element=\"label\"\n ref={ref}\n contentRef={contentRef}\n disabled={!!disabled || forceDisabled}\n respectContainer={respectContainer}\n >\n {children}\n </CheckableCardElement>\n );\n }\n);\n\nCheckableCardComponent.displayName = 'CheckableCard';\n\nexport const CheckableCard = enrichWithSkeleton(CheckableCardComponent, CheckableCardSkeleton);\n"],"names":[
|
|
1
|
+
{"version":3,"file":"CheckableCard.js","sources":["src/CheckableCard.tsx"],"sourcesContent":["import { forwardRef, useLayoutEffect, useRef } from 'react';\n\nimport { keyboardMatches, keyboardKeys } from '@hh.ru/magritte-common-keyboard';\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { CheckableCardElement } from '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';\nimport { CheckableCardSkeleton } from '@hh.ru/magritte-ui-checkable-card/Skeleton';\nimport { CheckableCardProps } from '@hh.ru/magritte-ui-checkable-card/types';\nimport { useGalleryContext, useScrollableControls } from '@hh.ru/magritte-ui-scrollable-container';\nimport { enrichWithSkeleton } from '@hh.ru/magritte-ui-skeleton';\n\nexport const CheckableCardComponent = forwardRef<HTMLLabelElement, React.PropsWithChildren<CheckableCardProps>>(\n (\n {\n children,\n padding = 0,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius = 0,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n toneHover,\n borderLayer,\n onFocus,\n onClick,\n disabled,\n type = 'checkbox',\n flexible,\n labelDataQa,\n respectContainer = false,\n ...inputProps\n },\n ref\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const forceDisabled = useDisabled();\n\n const { registerItem, removeItem } = useGalleryContext();\n const { scrollToItem } = useScrollableControls();\n\n const stopKeyboardEventPropagation: React.KeyboardEventHandler<HTMLLabelElement> = (event) => {\n if (\n event.target === inputRef.current ||\n !keyboardMatches(event, [keyboardKeys.Space, keyboardKeys.Enter])\n ) {\n return;\n }\n event.stopPropagation();\n inputRef.current?.dispatchEvent(new KeyboardEvent(event.type, { key: event.key, code: event.code }));\n };\n\n useLayoutEffect(() => {\n registerItem(contentRef);\n return () => removeItem(contentRef);\n }, [registerItem, removeItem]);\n\n useLayoutEffect(() => {\n if ((inputProps.checked || inputProps.defaultChecked) && type === 'radio' && contentRef.current) {\n scrollToItem(contentRef);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const props = {\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n disabled,\n toneHover,\n borderLayer,\n flexible,\n 'data-qa': labelDataQa,\n };\n\n return (\n <CheckableCardElement\n {...props}\n onClickCapture={(event) => {\n if (event.target === inputRef.current || !contentRef.current?.contains(event.target as Node)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n inputRef.current?.click();\n }}\n padding={padding}\n borderRadius={borderRadius}\n onKeyDownCapture={stopKeyboardEventPropagation}\n onKeyPressCapture={stopKeyboardEventPropagation}\n onKeyUpCapture={stopKeyboardEventPropagation}\n input={\n <input\n {...inputProps}\n ref={inputRef}\n type={type}\n disabled={!!disabled || forceDisabled}\n onFocus={(event) => {\n onFocus?.(event);\n scrollToItem(contentRef);\n }}\n onClick={(event) => {\n onClick?.(event);\n scrollToItem(contentRef);\n }}\n />\n }\n Element=\"label\"\n ref={ref}\n contentRef={contentRef}\n disabled={!!disabled || forceDisabled}\n respectContainer={respectContainer}\n >\n {children}\n </CheckableCardElement>\n );\n }\n);\n\nCheckableCardComponent.displayName = 'CheckableCard';\n\nexport const CheckableCard = enrichWithSkeleton(CheckableCardComponent, CheckableCardSkeleton);\n"],"names":[],"mappings":";;;;;;;;;;;;AAUO,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAClC,CACI;AAAA,IACI,QAAA;AAAA,IACA,OAAU,GAAA,CAAA;AAAA,IACV,WAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,YAAe,GAAA,CAAA;AAAA,IACf,mBAAA;AAAA,IACA,oBAAA;AAAA,IACA,sBAAA;AAAA,IACA,uBAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAO,GAAA,UAAA;AAAA,IACP,QAAA;AAAA,IACA,WAAA;AAAA,IACA,gBAAmB,GAAA,KAAA;AAAA,IACnB,GAAG,UAAA;AAAA,KAEP,GACC,KAAA;AACD,IAAM,MAAA,UAAA,GAAa,OAAuB,IAAI,CAAA,CA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AA;AAAA,aAC3B;AAAA,WAAA;AAAA,SACJ;AAAA,QAEJ,OAAQ,EAAA,OAAA;AAAA,QACR,GAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAA,EAAU,CAAC,CAAC,QAAY,IAAA,aAAA;AAAA,QACxB,gBAAA;AAAA,QAEC,QAAA;AAAA,OAAA;AAAA,KACL,CAAA;AAAA,GAER;AACJ,EAAA;AAEA,sBAAA,CAAuB,WAAc,GAAA,eAAA,CAAA;AAExB,MAAA,aAAA,GAAgB,kBAAmB,CAAA,sBAAA,EAAwB,qBAAqB;;;;"}
|
|
@@ -3,13 +3,23 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { ScrollableContainer } from '@hh.ru/magritte-ui-scrollable-container';
|
|
6
|
-
import { s as styles } from './checkable-card-
|
|
6
|
+
import { s as styles } from './checkable-card-DjoTmv6N.js';
|
|
7
7
|
|
|
8
|
-
const CheckableCardScrollableContainer = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const CheckableCardScrollableContainer = ({
|
|
9
|
+
disableButtons,
|
|
10
|
+
children,
|
|
11
|
+
...containerProps
|
|
12
|
+
}) => {
|
|
13
|
+
const WrapperComponent = disableButtons ? Fragment : ScrollableContainer.DefaultLayout;
|
|
14
|
+
return /* @__PURE__ */ jsx(ScrollableContainer, { "data-qa": "checkable-card-scrollable-container", ...containerProps, children: /* @__PURE__ */ jsx(WrapperComponent, { children: /* @__PURE__ */ jsx(ScrollableContainer.Gallery, { children: /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: classnames(styles.scrollContainer, {
|
|
18
|
+
[styles.scrollContainerMobile]: !!disableButtons
|
|
19
|
+
}),
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
) }) }) });
|
|
13
23
|
};
|
|
14
24
|
|
|
15
25
|
export { CheckableCardScrollableContainer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckableCardContainer.js","sources":["src/CheckableCardContainer.tsx"],"sourcesContent":["import { type FC, type ReactNode, Fragment } from 'react';\nimport classnames from 'classnames';\n\nimport { ScrollableContainer, type ScrollableContainerProps } from '@hh.ru/magritte-ui-scrollable-container';\n\nimport styles from './checkable-card.less';\n\ninterface CheckableCardScrollableContainerProps extends ScrollableContainerProps {\n children: ReactNode;\n disableButtons?: boolean;\n}\n\nexport const CheckableCardScrollableContainer: FC<CheckableCardScrollableContainerProps> = ({\n disableButtons,\n children,\n ...containerProps\n}) => {\n const WrapperComponent = disableButtons ? Fragment : ScrollableContainer.DefaultLayout;\n return (\n <ScrollableContainer data-qa=\"checkable-card-scrollable-container\" {...containerProps}>\n <WrapperComponent>\n <ScrollableContainer.Gallery>\n <div\n className={classnames(styles.scrollContainer, {\n [styles.scrollContainerMobile]: !!disableButtons,\n })}\n >\n {children}\n </div>\n </ScrollableContainer.Gallery>\n </WrapperComponent>\n </ScrollableContainer>\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"CheckableCardContainer.js","sources":["src/CheckableCardContainer.tsx"],"sourcesContent":["import { type FC, type ReactNode, Fragment } from 'react';\nimport classnames from 'classnames';\n\nimport { ScrollableContainer, type ScrollableContainerProps } from '@hh.ru/magritte-ui-scrollable-container';\n\nimport styles from './checkable-card.less';\n\ninterface CheckableCardScrollableContainerProps extends ScrollableContainerProps {\n children: ReactNode;\n disableButtons?: boolean;\n}\n\nexport const CheckableCardScrollableContainer: FC<CheckableCardScrollableContainerProps> = ({\n disableButtons,\n children,\n ...containerProps\n}) => {\n const WrapperComponent = disableButtons ? Fragment : ScrollableContainer.DefaultLayout;\n return (\n <ScrollableContainer data-qa=\"checkable-card-scrollable-container\" {...containerProps}>\n <WrapperComponent>\n <ScrollableContainer.Gallery>\n <div\n className={classnames(styles.scrollContainer, {\n [styles.scrollContainerMobile]: !!disableButtons,\n })}\n >\n {children}\n </div>\n </ScrollableContainer.Gallery>\n </WrapperComponent>\n </ScrollableContainer>\n );\n};\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,mCAA8E,CAAC;AAAA,EACxF,cAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG,cAAA;AACP,CAAM,KAAA;AACF,EAAM,MAAA,gBAAA,GAAmB,cAAiB,GAAA,QAAA,GAAW,mBAAoB,CAAA,aAAA,CAAA;AACzE,EACI,uBAAA,GAAA,CAAC,mBAAoB,EAAA,EAAA,SAAA,EAAQ,qCAAuC,EAAA,GAAG,cACnE,EAAA,QAAA,kBAAA,GAAA,CAAC,gBACG,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAoB,CAAA,OAAA,EAApB,EACG,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACG,SAAA,EAAW,UAAW,CAAA,MAAA,CAAO,eAAiB,EAAA;AAAA,QAC1C,CAAC,MAAA,CAAO,qBAAqB,GAAG,CAAC,CAAC,cAAA;AAAA,OACrC,CAAA;AAAA,MAEA,QAAA;AAAA,KAAA;AAAA,GACL,EACJ,GACJ,CACJ,EAAA,CAAA,CAAA;AAER;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PolymorphicComponentWithRef } from '@hh.ru/magritte-types';
|
|
2
|
-
import type { CheckableCardElementProps } from '
|
|
3
|
-
export declare const CheckableCardElement: PolymorphicComponentWithRef<CheckableCardElementProps,
|
|
2
|
+
import type { CheckableCardElementProps } from './types';
|
|
3
|
+
export declare const CheckableCardElement: PolymorphicComponentWithRef<CheckableCardElementProps, 'div'>;
|
package/CheckableCardElement.js
CHANGED
|
@@ -3,32 +3,80 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { useDisabled, DisabledContext } from '@hh.ru/magritte-common-use-disabled';
|
|
6
|
-
import { s as styles } from './checkable-card-
|
|
6
|
+
import { s as styles } from './checkable-card-DjoTmv6N.js';
|
|
7
7
|
|
|
8
|
-
const genBorderRadiusClasses = (radiusProps) => Object.entries(radiusProps).reduce(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
const genBorderRadiusClasses = (radiusProps) => Object.entries(radiusProps).reduce(
|
|
9
|
+
(acc, [key, value]) => value !== void 0 ? [...acc, styles[`border${key}Radius${value}`]] : acc,
|
|
10
|
+
[]
|
|
11
|
+
);
|
|
12
|
+
const genPaddingProps = (paddingProps) => Object.entries(paddingProps).reduce(
|
|
13
|
+
(acc, [key, value]) => value !== void 0 ? { ...acc, [`padding${key}`]: value } : acc,
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
const CheckableCardElementForwardRefRenderFunc = ({
|
|
17
|
+
children,
|
|
18
|
+
padding,
|
|
19
|
+
paddingLeft,
|
|
20
|
+
paddingRight,
|
|
21
|
+
paddingTop,
|
|
22
|
+
paddingBottom,
|
|
23
|
+
borderRadius,
|
|
24
|
+
borderTopLeftRadius,
|
|
25
|
+
borderTopRightRadius,
|
|
26
|
+
borderBottomLeftRadius,
|
|
27
|
+
borderBottomRightRadius,
|
|
28
|
+
toneHover,
|
|
29
|
+
borderLayer = "above-content",
|
|
30
|
+
disabled,
|
|
31
|
+
flexible,
|
|
32
|
+
Element = "div",
|
|
33
|
+
input,
|
|
34
|
+
contentRef,
|
|
35
|
+
checked = false,
|
|
36
|
+
focusVisible = false,
|
|
37
|
+
respectContainer = false,
|
|
38
|
+
...props
|
|
39
|
+
}, ref) => {
|
|
40
|
+
const paddingProps = genPaddingProps({
|
|
41
|
+
Left: paddingLeft ?? padding,
|
|
42
|
+
Right: paddingRight ?? padding,
|
|
43
|
+
Top: paddingTop ?? padding,
|
|
44
|
+
Bottom: paddingBottom ?? padding
|
|
45
|
+
});
|
|
46
|
+
const forceDisabled = useDisabled();
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
Element,
|
|
49
|
+
{
|
|
50
|
+
...props,
|
|
51
|
+
className: classnames(
|
|
52
|
+
styles.card,
|
|
53
|
+
styles[`borderRadius${borderRadius}`],
|
|
54
|
+
genBorderRadiusClasses({
|
|
55
|
+
TopLeft: borderTopLeftRadius,
|
|
56
|
+
TopRight: borderTopRightRadius,
|
|
57
|
+
BottomLeft: borderBottomLeftRadius,
|
|
58
|
+
BottomRight: borderBottomRightRadius
|
|
59
|
+
}),
|
|
60
|
+
{
|
|
61
|
+
[styles.cardDisabled]: forceDisabled || !!disabled,
|
|
62
|
+
[styles.cardChecked]: checked,
|
|
63
|
+
[styles.cardHugContent]: !flexible,
|
|
64
|
+
[styles.cardToneHover]: toneHover,
|
|
65
|
+
[styles.cardBorderBelowContent]: borderLayer === "below-content",
|
|
66
|
+
"focus-visible": focusVisible,
|
|
67
|
+
[styles.cardRespectContainer]: respectContainer
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
"data-interactive": true,
|
|
71
|
+
ref,
|
|
72
|
+
tabIndex: input || forceDisabled || !!disabled ? -1 : 0,
|
|
73
|
+
"aria-disabled": forceDisabled || !!disabled,
|
|
74
|
+
children: [
|
|
75
|
+
input,
|
|
76
|
+
/* @__PURE__ */ jsx("div", { className: styles.content, ref: contentRef, children: /* @__PURE__ */ jsx("div", { className: styles.contentBorderContainer, style: paddingProps, children: /* @__PURE__ */ jsx("div", { className: styles.contentOpacityContainer, children: /* @__PURE__ */ jsx(DisabledContext.Provider, { value: forceDisabled || !!disabled, children }) }) }) })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
32
80
|
};
|
|
33
81
|
const CheckableCardElement = forwardRef(CheckableCardElementForwardRefRenderFunc);
|
|
34
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckableCardElement.js","sources":["src/CheckableCardElement.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useDisabled, DisabledContext } from '@hh.ru/magritte-common-use-disabled';\nimport type { PolymorphicForwardRefRenderFunc, PolymorphicComponentWithRef } from '@hh.ru/magritte-types';\nimport type {\n CheckableCardBorderRadius,\n CheckableCardElementProps,\n CheckableCardPadding,\n} from '@hh.ru/magritte-ui-checkable-card/types';\n\nimport styles from './checkable-card.less';\n\nconst genBorderRadiusClasses = (radiusProps: {\n TopLeft?: CheckableCardBorderRadius;\n TopRight?: CheckableCardBorderRadius;\n BottomLeft?: CheckableCardBorderRadius;\n BottomRight?: CheckableCardBorderRadius;\n}) =>\n Object.entries(radiusProps).reduce<string[]>(\n (acc, [key, value]) =>\n value !== undefined ? [...acc, styles[`border${key as keyof typeof radiusProps}Radius${value}`]] : acc,\n []\n );\n\nconst genPaddingProps = (paddingProps: {\n Left?: CheckableCardPadding;\n Right?: CheckableCardPadding;\n Top?: CheckableCardPadding;\n Bottom?: CheckableCardPadding;\n}) =>\n Object.entries(paddingProps).reduce<Record<string, number>>(\n (acc, [key, value]) => (value !== undefined ? { ...acc, [`padding${key}`]: value } : acc),\n {}\n );\n\nconst CheckableCardElementForwardRefRenderFunc: PolymorphicForwardRefRenderFunc<CheckableCardElementProps, 'div'> = (\n {\n children,\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n toneHover,\n borderLayer = 'above-content',\n disabled,\n flexible,\n Element = 'div',\n input,\n contentRef,\n checked = false,\n focusVisible = false,\n respectContainer = false,\n ...props\n },\n ref\n) => {\n const paddingProps = genPaddingProps({\n Left: paddingLeft ?? padding,\n Right: paddingRight ?? padding,\n Top: paddingTop ?? padding,\n Bottom: paddingBottom ?? padding,\n });\n\n const forceDisabled = useDisabled();\n\n return (\n <Element\n {...props}\n className={classnames(\n styles.card,\n styles[`borderRadius${borderRadius}`],\n genBorderRadiusClasses({\n TopLeft: borderTopLeftRadius,\n TopRight: borderTopRightRadius,\n BottomLeft: borderBottomLeftRadius,\n BottomRight: borderBottomRightRadius,\n }),\n {\n [styles.cardDisabled]: forceDisabled || !!disabled,\n [styles.cardChecked]: checked,\n [styles.cardHugContent]: !flexible,\n [styles.cardToneHover]: toneHover,\n [styles.cardBorderBelowContent]: borderLayer === 'below-content',\n 'focus-visible': focusVisible,\n [styles.cardRespectContainer]: respectContainer,\n }\n )}\n data-interactive={true}\n ref={ref}\n tabIndex={input || forceDisabled || !!disabled ? -1 : 0}\n aria-disabled={forceDisabled || !!disabled}\n >\n {input}\n <div className={styles.content} ref={contentRef}>\n <div className={styles.contentBorderContainer} style={paddingProps}>\n <div className={styles.contentOpacityContainer}>\n <DisabledContext.Provider value={forceDisabled || !!disabled}>\n {children}\n </DisabledContext.Provider>\n </div>\n </div>\n </div>\n </Element>\n );\n};\n\nexport const CheckableCardElement = forwardRef(CheckableCardElementForwardRefRenderFunc) as PolymorphicComponentWithRef<\n CheckableCardElementProps,\n 'div'\n>;\n"],"names":[
|
|
1
|
+
{"version":3,"file":"CheckableCardElement.js","sources":["src/CheckableCardElement.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useDisabled, DisabledContext } from '@hh.ru/magritte-common-use-disabled';\nimport type { PolymorphicForwardRefRenderFunc, PolymorphicComponentWithRef } from '@hh.ru/magritte-types';\nimport type {\n CheckableCardBorderRadius,\n CheckableCardElementProps,\n CheckableCardPadding,\n} from '@hh.ru/magritte-ui-checkable-card/types';\n\nimport styles from './checkable-card.less';\n\nconst genBorderRadiusClasses = (radiusProps: {\n TopLeft?: CheckableCardBorderRadius;\n TopRight?: CheckableCardBorderRadius;\n BottomLeft?: CheckableCardBorderRadius;\n BottomRight?: CheckableCardBorderRadius;\n}) =>\n Object.entries(radiusProps).reduce<string[]>(\n (acc, [key, value]) =>\n value !== undefined ? [...acc, styles[`border${key as keyof typeof radiusProps}Radius${value}`]] : acc,\n []\n );\n\nconst genPaddingProps = (paddingProps: {\n Left?: CheckableCardPadding;\n Right?: CheckableCardPadding;\n Top?: CheckableCardPadding;\n Bottom?: CheckableCardPadding;\n}) =>\n Object.entries(paddingProps).reduce<Record<string, number>>(\n (acc, [key, value]) => (value !== undefined ? { ...acc, [`padding${key}`]: value } : acc),\n {}\n );\n\nconst CheckableCardElementForwardRefRenderFunc: PolymorphicForwardRefRenderFunc<CheckableCardElementProps, 'div'> = (\n {\n children,\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n borderRadius,\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius,\n toneHover,\n borderLayer = 'above-content',\n disabled,\n flexible,\n Element = 'div',\n input,\n contentRef,\n checked = false,\n focusVisible = false,\n respectContainer = false,\n ...props\n },\n ref\n) => {\n const paddingProps = genPaddingProps({\n Left: paddingLeft ?? padding,\n Right: paddingRight ?? padding,\n Top: paddingTop ?? padding,\n Bottom: paddingBottom ?? padding,\n });\n\n const forceDisabled = useDisabled();\n\n return (\n <Element\n {...props}\n className={classnames(\n styles.card,\n styles[`borderRadius${borderRadius}`],\n genBorderRadiusClasses({\n TopLeft: borderTopLeftRadius,\n TopRight: borderTopRightRadius,\n BottomLeft: borderBottomLeftRadius,\n BottomRight: borderBottomRightRadius,\n }),\n {\n [styles.cardDisabled]: forceDisabled || !!disabled,\n [styles.cardChecked]: checked,\n [styles.cardHugContent]: !flexible,\n [styles.cardToneHover]: toneHover,\n [styles.cardBorderBelowContent]: borderLayer === 'below-content',\n 'focus-visible': focusVisible,\n [styles.cardRespectContainer]: respectContainer,\n }\n )}\n data-interactive={true}\n ref={ref}\n tabIndex={input || forceDisabled || !!disabled ? -1 : 0}\n aria-disabled={forceDisabled || !!disabled}\n >\n {input}\n <div className={styles.content} ref={contentRef}>\n <div className={styles.contentBorderContainer} style={paddingProps}>\n <div className={styles.contentOpacityContainer}>\n <DisabledContext.Provider value={forceDisabled || !!disabled}>\n {children}\n </DisabledContext.Provider>\n </div>\n </div>\n </div>\n </Element>\n );\n};\n\nexport const CheckableCardElement = forwardRef(CheckableCardElementForwardRefRenderFunc) as PolymorphicComponentWithRef<\n CheckableCardElementProps,\n 'div'\n>;\n"],"names":[],"mappings":";;;;;;AAaA,MAAM,yBAAyB,CAAC,WAAA,KAM5B,MAAO,CAAA,OAAA,CAAQ,WAAW,CAAE,CAAA,MAAA;AAAA,EACxB,CAAC,GAAK,EAAA,CAAC,KAAK,KAAK,CAAA,KACb,UAAU,KAAY,CAAA,GAAA,CAAC,GAAG,GAAA,EAAK,OAAO,CAAS,MAAA,EAAA,GAA+B,SAAS,KAAK,CAAA,CAAE,CAAC,CAAI,GAAA,GAAA;AAAA,EACvG,EAAC;AACL,CAAA,CAAA;AAEJ,MAAM,kBAAkB,CAAC,YAAA,KAMrB,MAAO,CAAA,OAAA,CAAQ,YAAY,CAAE,CAAA,MAAA;AAAA,EACzB,CAAC,GAAK,EAAA,CAAC,GAAK,EAAA,KAAK,MAAO,KAAU,KAAA,KAAA,CAAA,GAAY,EAAE,GAAG,KAAK,CAAC,CAAA,OAAA,EAAU,GAAG,CAAE,CAAA,GAAG,OAAU,GAAA,GAAA;AAAA,EACrF,EAAC;AACL,CAAA,CAAA;AAEJ,MAAM,2CAA8G,CAChH;AAAA,EACI,QAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA,sBAAA;AAAA,EACA,uBAAA;AAAA,EACA,SAAA;AA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MAAO,CAAA,oBAAoB,GAAG,gBAAA;AAAA,SACnC;AAAA,OACJ;AAAA,MACA,kBAAkB,EAAA,IAAA;AAAA,MAClB,GAAA;AAAA,MACA,UAAU,KAAS,IAAA,aAAA,IAAiB,CAAC,CAAC,WAAW,CAAK,CAAA,GAAA,CAAA;AAAA,MACtD,eAAA,EAAe,aAAiB,IAAA,CAAC,CAAC,QAAA;AAAA,MAEjC,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,wBACA,GAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,MAAA,CAAO,OAAS,EAAA,GAAA,EAAK,UACjC,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,sBAAA,EAAwB,OAAO,YAClD,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,uBAAA,EACnB,QAAC,kBAAA,GAAA,CAAA,eAAA,CAAgB,UAAhB,EAAyB,KAAA,EAAO,aAAiB,IAAA,CAAC,CAAC,QAAA,EAC/C,QACL,EAAA,CAAA,EACJ,GACJ,CACJ,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACJ,CAAA;AAER,CAAA,CAAA;AAEa,MAAA,oBAAA,GAAuB,WAAW,wCAAwC;;;;"}
|
package/Skeleton.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CheckableCardProps } from '
|
|
1
|
+
import { CheckableCardProps } from './types';
|
|
2
2
|
import { IncompleteSkeletonComponent } from '@hh.ru/magritte-ui-skeleton';
|
|
3
3
|
export declare const CheckableCardSkeleton: IncompleteSkeletonComponent<CheckableCardProps>;
|
package/Skeleton.js
CHANGED
|
@@ -4,18 +4,39 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { useLoadingState } from '@hh.ru/magritte-common-use-loading-state';
|
|
6
6
|
import { Skeleton } from '@hh.ru/magritte-ui-skeleton';
|
|
7
|
-
import { s as styles } from './checkable-card-
|
|
7
|
+
import { s as styles } from './checkable-card-DjoTmv6N.js';
|
|
8
8
|
|
|
9
|
-
const CheckableCardSkeleton = forwardRef(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const CheckableCardSkeleton = forwardRef(
|
|
10
|
+
({
|
|
11
|
+
Component: CheckableCard,
|
|
12
|
+
// skeleton props
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
inline,
|
|
16
|
+
additionalClass,
|
|
17
|
+
loading,
|
|
18
|
+
...cardProps
|
|
19
|
+
}, ref) => {
|
|
12
20
|
const isLoading = useLoadingState() || loading;
|
|
13
21
|
if (isLoading) {
|
|
14
|
-
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { className: classnames(styles.cardSkeleton, { [styles.cardHugContent]: !cardProps.flexible }), children: /* @__PURE__ */ jsx(
|
|
23
|
+
Skeleton,
|
|
24
|
+
{
|
|
25
|
+
width: !cardProps.flexible ? width : `100%`,
|
|
26
|
+
height: !cardProps.flexible ? height : `100%`,
|
|
27
|
+
borderRadius: cardProps.borderRadius,
|
|
28
|
+
borderTopLeftRadius: cardProps.borderTopLeftRadius,
|
|
29
|
+
borderTopRightRadius: cardProps.borderTopRightRadius,
|
|
30
|
+
borderBottomLeftRadius: cardProps.borderBottomLeftRadius,
|
|
31
|
+
borderBottomRightRadius: cardProps.borderBottomRightRadius,
|
|
32
|
+
loading
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
15
35
|
}
|
|
16
|
-
return jsx(CheckableCard, { ref
|
|
17
|
-
}
|
|
18
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx(CheckableCard, { ref, ...cardProps });
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
CheckableCardSkeleton.displayName = "CheckableCardSkeleton";
|
|
19
40
|
|
|
20
41
|
export { CheckableCardSkeleton };
|
|
21
42
|
//# sourceMappingURL=Skeleton.js.map
|
package/Skeleton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sources":["src/Skeleton.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useLoadingState } from '@hh.ru/magritte-common-use-loading-state';\nimport { CheckableCardProps } from '@hh.ru/magritte-ui-checkable-card/types';\nimport { IncompleteSkeletonComponent, IncompleteSkeletonPropsWithRef, Skeleton } from '@hh.ru/magritte-ui-skeleton';\n\nimport styles from './checkable-card.less';\n\nexport const CheckableCardSkeleton = forwardRef<\n HTMLLabelElement,\n IncompleteSkeletonPropsWithRef<CheckableCardProps, HTMLLabelElement>\n>(\n (\n {\n Component: CheckableCard,\n\n // skeleton props\n width,\n height,\n inline,\n additionalClass,\n loading,\n ...cardProps\n },\n ref\n ) => {\n const isLoading = useLoadingState() || loading;\n\n if (isLoading) {\n return (\n <div className={classnames(styles.cardSkeleton, { [styles.cardHugContent]: !cardProps.flexible })}>\n <Skeleton\n width={!cardProps.flexible ? width : `100%`}\n height={!cardProps.flexible ? height : `100%`}\n borderRadius={cardProps.borderRadius}\n borderTopLeftRadius={cardProps.borderTopLeftRadius}\n borderTopRightRadius={cardProps.borderTopRightRadius}\n borderBottomLeftRadius={cardProps.borderBottomLeftRadius}\n borderBottomRightRadius={cardProps.borderBottomRightRadius}\n loading={loading}\n />\n </div>\n );\n }\n\n return <CheckableCard ref={ref} {...cardProps} />;\n }\n) as IncompleteSkeletonComponent<CheckableCardProps>;\n\nCheckableCardSkeleton.displayName = 'CheckableCardSkeleton';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["src/Skeleton.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useLoadingState } from '@hh.ru/magritte-common-use-loading-state';\nimport { CheckableCardProps } from '@hh.ru/magritte-ui-checkable-card/types';\nimport { IncompleteSkeletonComponent, IncompleteSkeletonPropsWithRef, Skeleton } from '@hh.ru/magritte-ui-skeleton';\n\nimport styles from './checkable-card.less';\n\nexport const CheckableCardSkeleton = forwardRef<\n HTMLLabelElement,\n IncompleteSkeletonPropsWithRef<CheckableCardProps, HTMLLabelElement>\n>(\n (\n {\n Component: CheckableCard,\n\n // skeleton props\n width,\n height,\n inline,\n additionalClass,\n loading,\n ...cardProps\n },\n ref\n ) => {\n const isLoading = useLoadingState() || loading;\n\n if (isLoading) {\n return (\n <div className={classnames(styles.cardSkeleton, { [styles.cardHugContent]: !cardProps.flexible })}>\n <Skeleton\n width={!cardProps.flexible ? width : `100%`}\n height={!cardProps.flexible ? height : `100%`}\n borderRadius={cardProps.borderRadius}\n borderTopLeftRadius={cardProps.borderTopLeftRadius}\n borderTopRightRadius={cardProps.borderTopRightRadius}\n borderBottomLeftRadius={cardProps.borderBottomLeftRadius}\n borderBottomRightRadius={cardProps.borderBottomRightRadius}\n loading={loading}\n />\n </div>\n );\n }\n\n return <CheckableCard ref={ref} {...cardProps} />;\n }\n) as IncompleteSkeletonComponent<CheckableCardProps>;\n\nCheckableCardSkeleton.displayName = 'CheckableCardSkeleton';\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,qBAAwB,GAAA,UAAA;AAAA,EAIjC,CACI;AAAA,IACI,SAAW,EAAA,aAAA;AAAA;AAAA,IAGX,KAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAG,SAAA;AAAA,KAEP,GACC,KAAA;AACD,IAAM,MAAA,SAAA,GAAY,iBAAqB,IAAA,OAAA,CAAA;AAEvC,IAAA,IAAI,SAAW,EAAA;AACX,MAAA,uBACK,GAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,UAAA,CAAW,OAAO,YAAc,EAAA,EAAE,CAAC,MAAA,CAAO,cAAc,GAAG,CAAC,SAAU,CAAA,QAAA,EAAU,CAC5F,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACG,KAAO,EAAA,CAAC,SAAU,CAAA,QAAA,GAAW,KAAQ,GAAA,CAAA,IAAA,CAAA;AAAA,UACrC,MAAQ,EAAA,CAAC,SAAU,CAAA,QAAA,GAAW,MAAS,GAAA,CAAA,IAAA,CAAA;AAAA,UACvC,cAAc,SAAU,CAAA,YAAA;AAAA,UACxB,qBAAqB,SAAU,CAAA,mBAAA;AAAA,UAC/B,sBAAsB,SAAU,CAAA,oBAAA;AAAA,UAChC,wBAAwB,SAAU,CAAA,sBAAA;AAAA,UAClC,yBAAyB,SAAU,CAAA,uBAAA;AAAA,UACnC,OAAA;AAAA,SAAA;AAAA,OAER,EAAA,CAAA,CAAA;AAAA,KAER;AAEA,IAAA,uBAAQ,GAAA,CAAA,aAAA,EAAA,EAAc,GAAW,EAAA,GAAG,SAAW,EAAA,CAAA,CAAA;AAAA,GACnD;AACJ,EAAA;AAEA,qBAAA,CAAsB,WAAc,GAAA,uBAAA;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
var styles = {"card":"magritte-card___kxw8G_5-1-12","card-skeleton":"magritte-card-skeleton___QeWAi_5-1-12","cardSkeleton":"magritte-card-skeleton___QeWAi_5-1-12","card_disabled":"magritte-card_disabled___VY399_5-1-12","cardDisabled":"magritte-card_disabled___VY399_5-1-12","card_hug-content":"magritte-card_hug-content___5HzPo_5-1-12","cardHugContent":"magritte-card_hug-content___5HzPo_5-1-12","content":"magritte-content___8L-gU_5-1-12","content-border-container":"magritte-content-border-container___nYgS5_5-1-12","contentBorderContainer":"magritte-content-border-container___nYgS5_5-1-12","content-opacity-container":"magritte-content-opacity-container___6F4WI_5-1-12","contentOpacityContainer":"magritte-content-opacity-container___6F4WI_5-1-12","card-border-below-content":"magritte-card-border-below-content___u90k-_5-1-12","cardBorderBelowContent":"magritte-card-border-below-content___u90k-_5-1-12","card_checked":"magritte-card_checked___nN6ga_5-1-12","cardChecked":"magritte-card_checked___nN6ga_5-1-12","card_tone-hover":"magritte-card_tone-hover___t2ICs_5-1-12","cardToneHover":"magritte-card_tone-hover___t2ICs_5-1-12","disabled":"magritte-disabled___Ab4OC_5-1-12","border-radius-0":"magritte-border-radius-0___--hCS_5-1-12","borderRadius0":"magritte-border-radius-0___--hCS_5-1-12","border-top-left-radius-0":"magritte-border-top-left-radius-0___IV8UU_5-1-12","borderTopLeftRadius0":"magritte-border-top-left-radius-0___IV8UU_5-1-12","border-top-right-radius-0":"magritte-border-top-right-radius-0___eBVf0_5-1-12","borderTopRightRadius0":"magritte-border-top-right-radius-0___eBVf0_5-1-12","border-bottom-left-radius-0":"magritte-border-bottom-left-radius-0___jmTBk_5-1-12","borderBottomLeftRadius0":"magritte-border-bottom-left-radius-0___jmTBk_5-1-12","border-bottom-right-radius-0":"magritte-border-bottom-right-radius-0___D-Fs-_5-1-12","borderBottomRightRadius0":"magritte-border-bottom-right-radius-0___D-Fs-_5-1-12","border-radius-12":"magritte-border-radius-12___ihVXv_5-1-12","borderRadius12":"magritte-border-radius-12___ihVXv_5-1-12","border-top-left-radius-12":"magritte-border-top-left-radius-12___c-jEA_5-1-12","borderTopLeftRadius12":"magritte-border-top-left-radius-12___c-jEA_5-1-12","border-top-right-radius-12":"magritte-border-top-right-radius-12___UA8OT_5-1-12","borderTopRightRadius12":"magritte-border-top-right-radius-12___UA8OT_5-1-12","border-bottom-left-radius-12":"magritte-border-bottom-left-radius-12___fJtJ7_5-1-12","borderBottomLeftRadius12":"magritte-border-bottom-left-radius-12___fJtJ7_5-1-12","border-bottom-right-radius-12":"magritte-border-bottom-right-radius-12___2FNgs_5-1-12","borderBottomRightRadius12":"magritte-border-bottom-right-radius-12___2FNgs_5-1-12","border-radius-16":"magritte-border-radius-16___6eKmx_5-1-12","borderRadius16":"magritte-border-radius-16___6eKmx_5-1-12","border-top-left-radius-16":"magritte-border-top-left-radius-16___tZAjN_5-1-12","borderTopLeftRadius16":"magritte-border-top-left-radius-16___tZAjN_5-1-12","border-top-right-radius-16":"magritte-border-top-right-radius-16___1S1ct_5-1-12","borderTopRightRadius16":"magritte-border-top-right-radius-16___1S1ct_5-1-12","border-bottom-left-radius-16":"magritte-border-bottom-left-radius-16___i0GAm_5-1-12","borderBottomLeftRadius16":"magritte-border-bottom-left-radius-16___i0GAm_5-1-12","border-bottom-right-radius-16":"magritte-border-bottom-right-radius-16___cGBZM_5-1-12","borderBottomRightRadius16":"magritte-border-bottom-right-radius-16___cGBZM_5-1-12","border-radius-24":"magritte-border-radius-24___ulqxw_5-1-12","borderRadius24":"magritte-border-radius-24___ulqxw_5-1-12","border-top-left-radius-24":"magritte-border-top-left-radius-24___kJKz-_5-1-12","borderTopLeftRadius24":"magritte-border-top-left-radius-24___kJKz-_5-1-12","border-top-right-radius-24":"magritte-border-top-right-radius-24___h4WrI_5-1-12","borderTopRightRadius24":"magritte-border-top-right-radius-24___h4WrI_5-1-12","border-bottom-left-radius-24":"magritte-border-bottom-left-radius-24___CwCs8_5-1-12","borderBottomLeftRadius24":"magritte-border-bottom-left-radius-24___CwCs8_5-1-12","border-bottom-right-radius-24":"magritte-border-bottom-right-radius-24___PIRfH_5-1-12","borderBottomRightRadius24":"magritte-border-bottom-right-radius-24___PIRfH_5-1-12","border-radius-32":"magritte-border-radius-32___Bvm7h_5-1-12","borderRadius32":"magritte-border-radius-32___Bvm7h_5-1-12","border-top-left-radius-32":"magritte-border-top-left-radius-32___QVqKC_5-1-12","borderTopLeftRadius32":"magritte-border-top-left-radius-32___QVqKC_5-1-12","border-top-right-radius-32":"magritte-border-top-right-radius-32___7a2qq_5-1-12","borderTopRightRadius32":"magritte-border-top-right-radius-32___7a2qq_5-1-12","border-bottom-left-radius-32":"magritte-border-bottom-left-radius-32___cmrmL_5-1-12","borderBottomLeftRadius32":"magritte-border-bottom-left-radius-32___cmrmL_5-1-12","border-bottom-right-radius-32":"magritte-border-bottom-right-radius-32___yMDwz_5-1-12","borderBottomRightRadius32":"magritte-border-bottom-right-radius-32___yMDwz_5-1-12","border-radius-40":"magritte-border-radius-40___CSg91_5-1-12","borderRadius40":"magritte-border-radius-40___CSg91_5-1-12","border-top-left-radius-40":"magritte-border-top-left-radius-40___oANEa_5-1-12","borderTopLeftRadius40":"magritte-border-top-left-radius-40___oANEa_5-1-12","border-top-right-radius-40":"magritte-border-top-right-radius-40___TYtjf_5-1-12","borderTopRightRadius40":"magritte-border-top-right-radius-40___TYtjf_5-1-12","border-bottom-left-radius-40":"magritte-border-bottom-left-radius-40___-bPFb_5-1-12","borderBottomLeftRadius40":"magritte-border-bottom-left-radius-40___-bPFb_5-1-12","border-bottom-right-radius-40":"magritte-border-bottom-right-radius-40___ArdFn_5-1-12","borderBottomRightRadius40":"magritte-border-bottom-right-radius-40___ArdFn_5-1-12","scroll-container":"magritte-scroll-container___FuttX_5-1-12","scrollContainer":"magritte-scroll-container___FuttX_5-1-12","scroll-container-mobile":"magritte-scroll-container-mobile___9y-d7_5-1-12","scrollContainerMobile":"magritte-scroll-container-mobile___9y-d7_5-1-12","card-respect-container":"magritte-card-respect-container___-7bUI_5-1-12","cardRespectContainer":"magritte-card-respect-container___-7bUI_5-1-12"};
|
|
3
|
+
|
|
4
|
+
export { styles as s };
|
|
5
|
+
//# sourceMappingURL=checkable-card-DjoTmv6N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkable-card-DjoTmv6N.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|