@pushwoosh/dumb-components 1.1.87 → 1.1.89
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/FrequencyCapping/FrequencyCappingEdit.d.ts +2 -2
- package/FrequencyCapping/FrequencyCappingEdit.js +8 -6
- package/FrequencyCapping/components/Settings/index.d.ts +3 -3
- package/FrequencyCapping/components/Settings/index.js +8 -8
- package/FrequencyCapping/types.d.ts +1 -0
- package/NotificationInbox/NotificationBell.js +6 -13
- package/NotificationInbox/NotificationInbox.js +10 -31
- package/NotificationInbox/styles.d.ts +0 -1
- package/NotificationInbox/styles.js +5 -9
- package/NotificationInbox/useInfiniteScroll.d.ts +11 -0
- package/NotificationInbox/useInfiniteScroll.js +39 -0
- package/RadioCard/RadioCard.d.ts +3 -0
- package/RadioCard/RadioCard.js +23 -0
- package/RadioCard/index.d.ts +1 -0
- package/RadioCard/index.js +1 -0
- package/RadioCard/styled.d.ts +65 -0
- package/RadioCard/styled.js +15 -0
- package/RadioCard/types.d.ts +8 -0
- package/RadioCard/types.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
2
|
import { type CappingBase, type FrequencyCappingEditProps } from './types';
|
|
3
|
-
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, }: FrequencyCappingEditProps<T>):
|
|
3
|
+
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, isDisabled, }: FrequencyCappingEditProps<T>): ReactElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
@@ -17,7 +17,8 @@ export function FrequencyCappingEdit({
|
|
|
17
17
|
onChange,
|
|
18
18
|
applicationCode,
|
|
19
19
|
editGlobalClicked,
|
|
20
|
-
isInJourney = false
|
|
20
|
+
isInJourney = false,
|
|
21
|
+
isDisabled = false
|
|
21
22
|
}) {
|
|
22
23
|
const {
|
|
23
24
|
enabled,
|
|
@@ -28,7 +29,7 @@ export function FrequencyCappingEdit({
|
|
|
28
29
|
const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
|
|
29
30
|
const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
|
|
30
31
|
const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
|
|
31
|
-
const onChangeFrequencyCapping =
|
|
32
|
+
const onChangeFrequencyCapping = useCallback(value => {
|
|
32
33
|
if (value === CappingTypes.IGNORE) {
|
|
33
34
|
onChange({
|
|
34
35
|
...capping,
|
|
@@ -53,7 +54,7 @@ export function FrequencyCappingEdit({
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
}, [capping, onChange]);
|
|
56
|
-
const onSettingsChange =
|
|
57
|
+
const onSettingsChange = useCallback((messages, days) => {
|
|
57
58
|
onChange({
|
|
58
59
|
...capping,
|
|
59
60
|
messages,
|
|
@@ -70,6 +71,7 @@ export function FrequencyCappingEdit({
|
|
|
70
71
|
title: "Frequency capping"
|
|
71
72
|
}, React.createElement(Select, {
|
|
72
73
|
name: "cappingOption",
|
|
74
|
+
isDisabled: isDisabled,
|
|
73
75
|
options: cappingOptions,
|
|
74
76
|
value: cappingOptions.find(option => option.value === cappingOption),
|
|
75
77
|
onChange: newValue => onChangeFrequencyCapping(newValue.value)
|
|
@@ -79,15 +81,15 @@ export function FrequencyCappingEdit({
|
|
|
79
81
|
days: globalCapping.days,
|
|
80
82
|
isInJourney: isInJourney
|
|
81
83
|
}, cappingOption === CappingTypes.GLOBAL && React.createElement(Link, {
|
|
84
|
+
target: "_blank",
|
|
82
85
|
href: `/applications/${applicationCode}/message-delivery?tab=capping`,
|
|
83
86
|
title: globalCappingLinkText,
|
|
84
|
-
target: "_blank",
|
|
85
87
|
onClick: editGlobalClicked
|
|
86
88
|
}, React.createElement(LinkWrapper, null, globalCappingLinkText, React.createElement(OpenIcon, {
|
|
87
89
|
size: "small",
|
|
88
90
|
view: "lined",
|
|
89
91
|
as: "span"
|
|
90
|
-
})))), cappingOption === CappingTypes.CUSTOM && React.createElement(EditCappingSettings, {
|
|
92
|
+
})))), cappingOption === CappingTypes.CUSTOM && !isDisabled && React.createElement(EditCappingSettings, {
|
|
91
93
|
messages: messages,
|
|
92
94
|
days: days,
|
|
93
95
|
onChange: onSettingsChange
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
type
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
type EditCappingSettingsProps = {
|
|
3
3
|
messages: number;
|
|
4
4
|
days: number;
|
|
5
5
|
onChange: (messages: number, days: number) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare function EditCappingSettings(props:
|
|
7
|
+
export declare function EditCappingSettings(props: EditCappingSettingsProps): ReactElement;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
3
|
import { Paragraph } from '@pushwoosh/kit-typography';
|
|
4
4
|
import { NumberPicker } from '../../../NumberPicker';
|
|
@@ -8,10 +8,10 @@ export function EditCappingSettings(props) {
|
|
|
8
8
|
days,
|
|
9
9
|
onChange
|
|
10
10
|
} = props;
|
|
11
|
-
const onMessagesChange =
|
|
11
|
+
const onMessagesChange = useCallback(value => {
|
|
12
12
|
onChange(value, days);
|
|
13
13
|
}, [days, onChange]);
|
|
14
|
-
const onDaysChange =
|
|
14
|
+
const onDaysChange = useCallback(value => {
|
|
15
15
|
onChange(messages, value);
|
|
16
16
|
}, [messages, onChange]);
|
|
17
17
|
return React.createElement(Horizontal, {
|
|
@@ -20,15 +20,15 @@ export function EditCappingSettings(props) {
|
|
|
20
20
|
style: {
|
|
21
21
|
gridTemplateColumns: '145px 70px 90px 70px 40px'
|
|
22
22
|
}
|
|
23
|
-
}, React.createElement(Paragraph, null, "Limit to a
|
|
24
|
-
onChange: value => onMessagesChange(value),
|
|
23
|
+
}, React.createElement(Paragraph, null, "Limit to a\u00A0maximum\u00A0of"), React.createElement(NumberPicker, {
|
|
25
24
|
value: messages,
|
|
26
25
|
minValue: 1,
|
|
27
|
-
maxValue: 1000
|
|
26
|
+
maxValue: 1000,
|
|
27
|
+
onChange: value => onMessagesChange(value)
|
|
28
28
|
}), React.createElement(Paragraph, null, "messages per"), React.createElement(NumberPicker, {
|
|
29
29
|
maxValue: 30,
|
|
30
30
|
minValue: 1,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
value: days,
|
|
32
|
+
onChange: value => onDaysChange(value)
|
|
33
33
|
}), React.createElement(Paragraph, null, "day(s)"));
|
|
34
34
|
}
|
|
@@ -23,6 +23,7 @@ export type FrequencyCappingEditProps<T extends CappingBase> = {
|
|
|
23
23
|
editGlobalClicked: () => void;
|
|
24
24
|
applicationCode: string;
|
|
25
25
|
isInJourney?: boolean;
|
|
26
|
+
isDisabled?: boolean;
|
|
26
27
|
};
|
|
27
28
|
export type FrequencyCappingReadonlyProps<T extends CappingBase> = {
|
|
28
29
|
capping: T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { NotificationIcon } from '@pushwoosh/kit-icons';
|
|
4
|
-
import { NotificationBellButton,
|
|
4
|
+
import { NotificationBellButton, NotificationBellBadge, NotificationBellBadgeDot } from './styles';
|
|
5
5
|
export function NotificationBell({
|
|
6
6
|
count = 0,
|
|
7
7
|
severity,
|
|
@@ -17,25 +17,18 @@ export function NotificationBell({
|
|
|
17
17
|
if (severity === 'warning') return Color.WARNING;
|
|
18
18
|
return Color.PRIMARY;
|
|
19
19
|
};
|
|
20
|
-
const getIconColor = () => {
|
|
21
|
-
if (isOpened) return Color.CLEAR;
|
|
22
|
-
return Color.MAIN;
|
|
23
|
-
};
|
|
24
|
-
const getIconView = () => {
|
|
25
|
-
return isOpened ? 'filled' : 'lined';
|
|
26
|
-
};
|
|
27
20
|
return React.createElement(NotificationBellButton, {
|
|
28
21
|
className: className,
|
|
29
22
|
"$isOpened": isOpened,
|
|
30
23
|
onClick: onClick,
|
|
31
24
|
type: "button",
|
|
32
25
|
"aria-label": hasNotifications ? 'You have unread notifications' : 'Notifications'
|
|
33
|
-
}, React.createElement(
|
|
34
|
-
size: "
|
|
35
|
-
view: getIconView(),
|
|
26
|
+
}, React.createElement(NotificationIcon, {
|
|
27
|
+
size: "medium",
|
|
36
28
|
type: "enabled",
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
view: isOpened ? 'filled' : 'lined',
|
|
30
|
+
color: "currentColor"
|
|
31
|
+
}), showBadge && React.createElement(NotificationBellBadge, null, React.createElement(NotificationBellBadgeDot, {
|
|
39
32
|
"$color": getBadgeColor(),
|
|
40
33
|
"$isDot": true
|
|
41
34
|
})));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
5
|
+
import { useInfiniteScroll } from './useInfiniteScroll';
|
|
5
6
|
import { Badge } from '../Badge';
|
|
6
7
|
import { Spinner } from '../Spinner';
|
|
7
8
|
import emptyNotificationsIcon from './assets/EmptyNotifications.svg?url';
|
|
@@ -33,9 +34,6 @@ export function NotificationInbox({
|
|
|
33
34
|
emptyStateIcon,
|
|
34
35
|
className
|
|
35
36
|
}) {
|
|
36
|
-
const listRef = useRef(null);
|
|
37
|
-
const observerRef = useRef(null);
|
|
38
|
-
const loadMoreRef = useRef(null);
|
|
39
37
|
const unreadCount = notifications.filter(n => !n.isRead).length;
|
|
40
38
|
const handleNotificationClick = useCallback(notification => {
|
|
41
39
|
if (!notification.isRead && onMarkAsRead) {
|
|
@@ -43,31 +41,11 @@ export function NotificationInbox({
|
|
|
43
41
|
}
|
|
44
42
|
onNotificationClick === null || onNotificationClick === void 0 || onNotificationClick(notification);
|
|
45
43
|
}, [onMarkAsRead, onNotificationClick]);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!loadMoreElement) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
observerRef.current = new IntersectionObserver(entries => {
|
|
55
|
-
const [entry] = entries;
|
|
56
|
-
if (entry !== null && entry !== void 0 && entry.isIntersecting && hasMore && !isLoading) {
|
|
57
|
-
onLoadMore();
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
root: listRef.current,
|
|
61
|
-
rootMargin: '100px',
|
|
62
|
-
threshold: 0.1
|
|
63
|
-
});
|
|
64
|
-
observerRef.current.observe(loadMoreElement);
|
|
65
|
-
return () => {
|
|
66
|
-
if (observerRef.current) {
|
|
67
|
-
observerRef.current.disconnect();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}, [hasMore, onLoadMore, isLoading]);
|
|
44
|
+
const loadMoreRef = useInfiniteScroll({
|
|
45
|
+
hasMore,
|
|
46
|
+
isLoading,
|
|
47
|
+
onLoadMore
|
|
48
|
+
});
|
|
71
49
|
if (notifications.length === 0 && !isLoading) {
|
|
72
50
|
return React.createElement(NotificationInboxContainer, {
|
|
73
51
|
className: className
|
|
@@ -109,7 +87,7 @@ export function NotificationInbox({
|
|
|
109
87
|
"$variant": "h4",
|
|
110
88
|
"$color": Color.LOCKED
|
|
111
89
|
}, unreadCount, ' ', "unread")))), React.createElement(NotificationInboxList, {
|
|
112
|
-
|
|
90
|
+
"data-notification-list": true
|
|
113
91
|
}, notifications.map(notification => {
|
|
114
92
|
const isRead = notification.isRead ?? false;
|
|
115
93
|
const badgeColor = severityToBadgeColorMap[notification.severity] || 'gray';
|
|
@@ -156,11 +134,12 @@ export function NotificationInbox({
|
|
|
156
134
|
}
|
|
157
135
|
}, notification.expandButton.label))));
|
|
158
136
|
}), hasMore && React.createElement(NotificationInboxLoadMore, {
|
|
137
|
+
ref: loadMoreRef,
|
|
159
138
|
"$variant": "footnote",
|
|
160
139
|
"$color": Color.PHANTOM
|
|
161
140
|
}, isLoading ? React.createElement(Spinner, {
|
|
162
141
|
size: "small"
|
|
163
|
-
}) : 'Loading more...'), isLoading && notifications.length === 0 && React.createElement(Horizontal, {
|
|
142
|
+
}) : 'Loading more...'), isLoading && notifications.length === 0 && !hasMore && React.createElement(Horizontal, {
|
|
164
143
|
"$justifyContent": "center",
|
|
165
144
|
"$alignItems": "center",
|
|
166
145
|
"$padding": "16px 0"
|
|
@@ -431,7 +431,6 @@ export declare const NotificationBarBadgeText: import("styled-components").Style
|
|
|
431
431
|
export declare const NotificationBellButton: import("styled-components").StyledComponent<"button", any, {
|
|
432
432
|
$isOpened: boolean;
|
|
433
433
|
}, never>;
|
|
434
|
-
export declare const NotificationBellIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
435
434
|
export declare const NotificationBellBadge: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
436
435
|
export declare const NotificationBellBadgeDot: import("styled-components").StyledComponent<"div", any, {
|
|
437
436
|
$color: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { Color, FontSize, FontWeight, FontFamily, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { Color, FontSize, FontWeight, FontFamily, ShapeRadius, Shadow } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
5
5
|
export const NotificationInboxContainer = styled(Vertical).withConfig({
|
|
6
6
|
displayName: "NotificationInboxContainer",
|
|
7
7
|
componentId: "sc-1nrene1-0"
|
|
8
|
-
})(["width:100%;min-width:360px;max-width:360px;max-height:600px;background:", ";border:1px solid ", ";border-radius:", ";overflow:hidden;display:flex;flex-direction:column;"], Color.CLEAR, Color.FORM, ShapeRadius.DIALOG);
|
|
8
|
+
})(["width:100%;min-width:360px;max-width:360px;max-height:600px;background:", ";border:1px solid ", ";border-radius:", ";box-shadow:", ";overflow:hidden;display:flex;flex-direction:column;"], Color.CLEAR, Color.FORM, ShapeRadius.DIALOG, Shadow.REGULAR);
|
|
9
9
|
export const NotificationInboxHeader = styled(Horizontal).withConfig({
|
|
10
10
|
displayName: "NotificationInboxHeader",
|
|
11
11
|
componentId: "sc-1nrene1-1"
|
|
@@ -237,7 +237,7 @@ export const NotificationBarBadgeText = styled(Text).withConfig({
|
|
|
237
237
|
export const NotificationBellButton = styled.button.withConfig({
|
|
238
238
|
displayName: "NotificationBellButton",
|
|
239
239
|
componentId: "sc-1nrene1-17"
|
|
240
|
-
})(["position:relative;width:36px;height:36px;padding:6px;border:none;background:", ";border-radius:", ";cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color 0.2s
|
|
240
|
+
})(["position:relative;width:36px;height:36px;padding:6px;border:none;background:", ";border-radius:", ";cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color 0.2s;color:", ";transition:background-color 0.2s,color 0.2s;&:hover:not(:disabled){background-color:", ";color:", ";}"], ({
|
|
241
241
|
$isOpened
|
|
242
242
|
}) => $isOpened ? Color.MAIN : 'transparent', ShapeRadius.CONTROL, ({
|
|
243
243
|
$isOpened
|
|
@@ -246,17 +246,13 @@ export const NotificationBellButton = styled.button.withConfig({
|
|
|
246
246
|
}) => $isOpened ? Color.MAIN : Color.BRIGHT_LIGHT, ({
|
|
247
247
|
$isOpened
|
|
248
248
|
}) => $isOpened ? Color.CLEAR : Color.PRIMARY_HOVER);
|
|
249
|
-
export const NotificationBellIcon = styled.div.withConfig({
|
|
250
|
-
displayName: "NotificationBellIcon",
|
|
251
|
-
componentId: "sc-1nrene1-18"
|
|
252
|
-
})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:color 0.2s;color:var(--icon-color);"]);
|
|
253
249
|
export const NotificationBellBadge = styled.div.withConfig({
|
|
254
250
|
displayName: "NotificationBellBadge",
|
|
255
|
-
componentId: "sc-1nrene1-
|
|
251
|
+
componentId: "sc-1nrene1-18"
|
|
256
252
|
})(["position:absolute;right:4px;top:4px;z-index:1;"]);
|
|
257
253
|
export const NotificationBellBadgeDot = styled.div.withConfig({
|
|
258
254
|
displayName: "NotificationBellBadgeDot",
|
|
259
|
-
componentId: "sc-1nrene1-
|
|
255
|
+
componentId: "sc-1nrene1-19"
|
|
260
256
|
})(["background-color:", ";border-radius:100px;", " display:flex;align-items:center;justify-content:center;font-size:10px;font-family:", ";font-weight:", ";line-height:1;color:", ";white-space:nowrap;"], ({
|
|
261
257
|
$color
|
|
262
258
|
}) => $color, ({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type UseInfiniteScrollOptions = {
|
|
2
|
+
hasMore: boolean;
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
onLoadMore?: () => void;
|
|
5
|
+
root?: Element | null;
|
|
6
|
+
rootMargin?: string;
|
|
7
|
+
threshold?: number | number[];
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function useInfiniteScroll({ hasMore, isLoading, onLoadMore, root, rootMargin, threshold, enabled, }: UseInfiniteScrollOptions): (node: HTMLDivElement | null) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
export function useInfiniteScroll({
|
|
3
|
+
hasMore,
|
|
4
|
+
isLoading,
|
|
5
|
+
onLoadMore,
|
|
6
|
+
root,
|
|
7
|
+
rootMargin = '100px',
|
|
8
|
+
threshold = 0.1,
|
|
9
|
+
enabled = true
|
|
10
|
+
}) {
|
|
11
|
+
const elementRef = useRef(null);
|
|
12
|
+
const observerRef = useRef(null);
|
|
13
|
+
const setRef = useCallback(node => {
|
|
14
|
+
elementRef.current = node;
|
|
15
|
+
}, []);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
var _observerRef$current;
|
|
18
|
+
const el = elementRef.current;
|
|
19
|
+
if (!enabled || !el || !hasMore || !onLoadMore) return;
|
|
20
|
+
const resolvedRoot = root ?? el.closest('[data-notification-list]');
|
|
21
|
+
(_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 || _observerRef$current.disconnect();
|
|
22
|
+
observerRef.current = new IntersectionObserver(([entry]) => {
|
|
23
|
+
if (entry !== null && entry !== void 0 && entry.isIntersecting && !isLoading && hasMore) {
|
|
24
|
+
onLoadMore();
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
root: resolvedRoot,
|
|
28
|
+
rootMargin,
|
|
29
|
+
threshold
|
|
30
|
+
});
|
|
31
|
+
observerRef.current.observe(el);
|
|
32
|
+
return () => {
|
|
33
|
+
var _observerRef$current2;
|
|
34
|
+
(_observerRef$current2 = observerRef.current) === null || _observerRef$current2 === void 0 || _observerRef$current2.disconnect();
|
|
35
|
+
observerRef.current = null;
|
|
36
|
+
};
|
|
37
|
+
}, [enabled, hasMore, isLoading, onLoadMore, root, rootMargin, threshold]);
|
|
38
|
+
return setRef;
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { H4, Paragraph } from '@pushwoosh/kit-typography';
|
|
4
|
+
import { Radio } from '../Radio';
|
|
5
|
+
import { RootBox } from './styled';
|
|
6
|
+
export function RadioCard(props) {
|
|
7
|
+
const {
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
isActive,
|
|
11
|
+
onClick,
|
|
12
|
+
children
|
|
13
|
+
} = props;
|
|
14
|
+
return React.createElement(RootBox, {
|
|
15
|
+
isActive: isActive,
|
|
16
|
+
onClick: onClick
|
|
17
|
+
}, React.createElement(Vertical, null, React.createElement(Horizontal, {
|
|
18
|
+
"$alignItems": "center",
|
|
19
|
+
"$justifyContent": "space-between"
|
|
20
|
+
}, React.createElement(H4, null, title), React.createElement(Radio, {
|
|
21
|
+
isChecked: isActive
|
|
22
|
+
})), React.createElement(Paragraph, null, description)), children);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioCard } from './RadioCard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioCard } from './RadioCard';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
2
|
+
export declare const RootBox: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
4
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
5
|
+
$bgColor?: string | undefined;
|
|
6
|
+
$border?: string | ({
|
|
7
|
+
top?: string | undefined;
|
|
8
|
+
right?: string | undefined;
|
|
9
|
+
bottom?: string | undefined;
|
|
10
|
+
left?: string | undefined;
|
|
11
|
+
} | {
|
|
12
|
+
horizontal: string;
|
|
13
|
+
top?: string | undefined;
|
|
14
|
+
bottom?: string | undefined;
|
|
15
|
+
} | {
|
|
16
|
+
vertical: string;
|
|
17
|
+
right?: string | undefined;
|
|
18
|
+
left?: string | undefined;
|
|
19
|
+
}) | undefined;
|
|
20
|
+
$borderRadius?: (string | number) | undefined;
|
|
21
|
+
$boxShadow?: string | undefined;
|
|
22
|
+
$gap?: (string | number) | undefined;
|
|
23
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
24
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
25
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
26
|
+
$margin?: (string | number) | ({
|
|
27
|
+
top?: (string | number) | undefined;
|
|
28
|
+
right?: (string | number) | undefined;
|
|
29
|
+
bottom?: (string | number) | undefined;
|
|
30
|
+
left?: (string | number) | undefined;
|
|
31
|
+
} | {
|
|
32
|
+
horizontal: string | number;
|
|
33
|
+
top?: (string | number) | undefined;
|
|
34
|
+
bottom?: (string | number) | undefined;
|
|
35
|
+
} | {
|
|
36
|
+
vertical: string | number;
|
|
37
|
+
right?: (string | number) | undefined;
|
|
38
|
+
left?: (string | number) | undefined;
|
|
39
|
+
}) | undefined;
|
|
40
|
+
$padding?: (string | number) | ({
|
|
41
|
+
top?: (string | number) | undefined;
|
|
42
|
+
right?: (string | number) | undefined;
|
|
43
|
+
bottom?: (string | number) | undefined;
|
|
44
|
+
left?: (string | number) | undefined;
|
|
45
|
+
} | {
|
|
46
|
+
horizontal: string | number;
|
|
47
|
+
top?: (string | number) | undefined;
|
|
48
|
+
bottom?: (string | number) | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
vertical: string | number;
|
|
51
|
+
right?: (string | number) | undefined;
|
|
52
|
+
left?: (string | number) | undefined;
|
|
53
|
+
}) | undefined;
|
|
54
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
55
|
+
} & {
|
|
56
|
+
$gridAutoFlow: string;
|
|
57
|
+
} & {
|
|
58
|
+
$padding: number;
|
|
59
|
+
$alignItems: string;
|
|
60
|
+
$bgColor: Color;
|
|
61
|
+
$borderRadius: ShapeRadius;
|
|
62
|
+
$gap: number;
|
|
63
|
+
} & {
|
|
64
|
+
isActive?: boolean;
|
|
65
|
+
}, "$gridAutoFlow" | "$alignItems" | "$bgColor" | "$borderRadius" | "$gap" | "$padding">;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
export const RootBox = styled(Vertical).attrs({
|
|
5
|
+
$padding: 16,
|
|
6
|
+
$alignItems: 'start',
|
|
7
|
+
$bgColor: Color.CLEAR,
|
|
8
|
+
$borderRadius: ShapeRadius.SECTION,
|
|
9
|
+
$gap: 12
|
|
10
|
+
}).withConfig({
|
|
11
|
+
displayName: "RootBox",
|
|
12
|
+
componentId: "sc-tkztr1-0"
|
|
13
|
+
})(["width:262px;height:100%;border:", ";box-sizing:border-box;cursor:pointer;"], ({
|
|
14
|
+
isActive
|
|
15
|
+
}) => isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { Pagination } from './Pagination';
|
|
|
16
16
|
export { ProgressBar } from './ProgressBar';
|
|
17
17
|
export { Popover } from './Popover';
|
|
18
18
|
export { Radio } from './Radio';
|
|
19
|
+
export { RadioCard } from './RadioCard';
|
|
19
20
|
export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
|
|
20
21
|
export { Spinner } from './Spinner';
|
|
21
22
|
export { SortButton, type SortButtonParams } from './SortButton';
|
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { Pagination } from './Pagination';
|
|
|
16
16
|
export { ProgressBar } from './ProgressBar';
|
|
17
17
|
export { Popover } from './Popover';
|
|
18
18
|
export { Radio } from './Radio';
|
|
19
|
+
export { RadioCard } from './RadioCard';
|
|
19
20
|
export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
|
|
20
21
|
export { Spinner } from './Spinner';
|
|
21
22
|
export { SortButton } from './SortButton';
|