@pushwoosh/dumb-components 1.1.210 → 1.1.212
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/RadioCard/RadioCard.d.ts +1 -1
- package/RadioCard/RadioCard.js +21 -6
- package/RadioCard/styled.d.ts +1 -0
- package/RadioCard/styled.js +11 -3
- package/RadioCard/types.d.ts +5 -1
- package/package.json +1 -1
package/RadioCard/RadioCard.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { RadioCardProps } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Selectable card with a title, description and a radio indicator — a richer
|
|
4
|
+
* Selectable card with a title, optional description and a radio indicator — a richer
|
|
5
5
|
* alternative to {@link Radio} for choosing one option among cards.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
package/RadioCard/RadioCard.js
CHANGED
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { H4, Paragraph } from '@pushwoosh/kit-typography';
|
|
4
4
|
import { Radio } from '../Radio';
|
|
5
|
+
import { TooltipTrigger } from '../Tooltip';
|
|
5
6
|
import { RootBox } from './styled';
|
|
6
7
|
/**
|
|
7
|
-
* Selectable card with a title, description and a radio indicator — a richer
|
|
8
|
+
* Selectable card with a title, optional description and a radio indicator — a richer
|
|
8
9
|
* alternative to {@link Radio} for choosing one option among cards.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
@@ -14,25 +15,39 @@ export function RadioCard(props) {
|
|
|
14
15
|
const {
|
|
15
16
|
title,
|
|
16
17
|
description,
|
|
18
|
+
titleTooltip,
|
|
17
19
|
width = '262px',
|
|
18
20
|
isActive,
|
|
21
|
+
isDisabled,
|
|
19
22
|
onClick,
|
|
20
23
|
children
|
|
21
24
|
} = props;
|
|
22
25
|
return _jsxs(RootBox, {
|
|
23
26
|
"$width": width,
|
|
24
27
|
isActive: isActive,
|
|
25
|
-
|
|
28
|
+
isDisabled: isDisabled,
|
|
29
|
+
onClick: isDisabled ? undefined : onClick,
|
|
26
30
|
children: [_jsxs(Vertical, {
|
|
31
|
+
"$gap": 0,
|
|
27
32
|
children: [_jsxs(Horizontal, {
|
|
28
33
|
"$alignItems": "center",
|
|
29
34
|
"$justifyContent": "space-between",
|
|
30
|
-
children: [
|
|
31
|
-
|
|
35
|
+
children: [_jsxs(Horizontal, {
|
|
36
|
+
"$alignItems": "center",
|
|
37
|
+
"$gap": 4,
|
|
38
|
+
children: [_jsx(H4, {
|
|
39
|
+
children: title
|
|
40
|
+
}), titleTooltip && _jsx(TooltipTrigger, {
|
|
41
|
+
content: titleTooltip,
|
|
42
|
+
position: "top-middle",
|
|
43
|
+
view: "question"
|
|
44
|
+
})]
|
|
32
45
|
}), _jsx(Radio, {
|
|
33
|
-
isChecked: isActive
|
|
46
|
+
isChecked: isActive,
|
|
47
|
+
isDisabled: isDisabled,
|
|
48
|
+
size: "compact"
|
|
34
49
|
})]
|
|
35
|
-
}), _jsx(Paragraph, {
|
|
50
|
+
}), description && _jsx(Paragraph, {
|
|
36
51
|
children: description
|
|
37
52
|
})]
|
|
38
53
|
}), children]
|
package/RadioCard/styled.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ export declare const RootBox: import("styled-components").StyledComponent<"div",
|
|
|
18
18
|
$gap: number;
|
|
19
19
|
} & {
|
|
20
20
|
isActive?: boolean;
|
|
21
|
+
isDisabled?: boolean;
|
|
21
22
|
$width: string | number;
|
|
22
23
|
}, "$gridAutoFlow" | "$bgColor" | "$borderRadius" | "$padding" | "$alignItems" | "$gap">;
|
package/RadioCard/styled.js
CHANGED
|
@@ -6,12 +6,20 @@ export const RootBox = styled(Vertical).attrs({
|
|
|
6
6
|
$alignItems: 'start',
|
|
7
7
|
$bgColor: Color.CLEAR,
|
|
8
8
|
$borderRadius: ShapeRadius.SECTION,
|
|
9
|
-
$gap:
|
|
9
|
+
$gap: 0
|
|
10
10
|
}).withConfig({
|
|
11
11
|
displayName: "RootBox",
|
|
12
12
|
componentId: "sc-tkztr1-0"
|
|
13
|
-
})(["width:", ";height:100%;box-sizing:border-box;outline:", ";cursor:pointer;&:hover{background:", ";}"], ({
|
|
13
|
+
})(["width:", ";height:100%;box-sizing:border-box;outline:", ";cursor:", ";opacity:", ";pointer-events:", ";&:hover{background:", ";}"], ({
|
|
14
14
|
$width
|
|
15
15
|
}) => toCssValue($width), ({
|
|
16
16
|
isActive
|
|
17
|
-
}) => isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`,
|
|
17
|
+
}) => isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`, ({
|
|
18
|
+
isDisabled
|
|
19
|
+
}) => isDisabled ? 'default' : 'pointer', ({
|
|
20
|
+
isDisabled
|
|
21
|
+
}) => isDisabled ? 0.5 : 1, ({
|
|
22
|
+
isDisabled
|
|
23
|
+
}) => isDisabled ? 'none' : 'auto', ({
|
|
24
|
+
isDisabled
|
|
25
|
+
}) => isDisabled ? Color.CLEAR : Color.ROW_HOVER);
|
package/RadioCard/types.d.ts
CHANGED
|
@@ -4,11 +4,15 @@ export interface RadioCardProps {
|
|
|
4
4
|
/** Card heading. */
|
|
5
5
|
title: string;
|
|
6
6
|
/** Supporting text under the title. */
|
|
7
|
-
description
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Help tooltip shown via a question-mark icon next to the title. */
|
|
9
|
+
titleTooltip?: ReactNode;
|
|
8
10
|
/** CSS width of the card (default `"262px"`). */
|
|
9
11
|
width?: string | number;
|
|
10
12
|
/** Whether this card is the selected one (drives the radio + active styling). */
|
|
11
13
|
isActive?: boolean;
|
|
14
|
+
/** Dim the card and ignore clicks. */
|
|
15
|
+
isDisabled?: boolean;
|
|
12
16
|
/** Extra content rendered below the description. */
|
|
13
17
|
children?: ReactNode;
|
|
14
18
|
/** Fires when the card is clicked. */
|