@pushwoosh/dumb-components 1.0.0 → 1.0.1
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/ActionsGroup/ActionsGroup.d.ts +3 -0
- package/ActionsGroup/ActionsGroup.js +18 -0
- package/ActionsGroup/ActionsGroupItem.d.ts +3 -0
- package/ActionsGroup/ActionsGroupItem.js +12 -0
- package/ActionsGroup/index.d.ts +3 -0
- package/ActionsGroup/index.js +2 -0
- package/ActionsGroup/styles.d.ts +7 -0
- package/ActionsGroup/styles.js +22 -0
- package/ActionsGroup/types.d.ts +12 -0
- package/Badge/Badge.d.ts +3 -0
- package/Badge/Badge.js +16 -0
- package/Badge/index.d.ts +2 -0
- package/Badge/index.js +1 -0
- package/Badge/maps.d.ts +19 -0
- package/Badge/maps.js +19 -0
- package/Badge/styles.d.ts +5 -0
- package/Badge/styles.js +14 -0
- package/Badge/types.d.ts +8 -0
- package/Banner/Banner.d.ts +3 -0
- package/Banner/Banner.js +82 -0
- package/Banner/colors.d.ts +12 -0
- package/Banner/colors.js +115 -0
- package/Banner/index.d.ts +2 -0
- package/Banner/index.js +1 -0
- package/Banner/maps.d.ts +27 -0
- package/Banner/maps.js +19 -0
- package/Banner/styles.d.ts +29 -0
- package/Banner/styles.js +45 -0
- package/Banner/types.d.ts +20 -0
- package/Button/Button.d.ts +5 -0
- package/Button/Button.js +48 -0
- package/Button/GhostButton.d.ts +1 -0
- package/Button/GhostButton.js +5 -0
- package/Button/colors.d.ts +16 -0
- package/Button/colors.js +130 -0
- package/Button/index.d.ts +3 -0
- package/Button/index.js +2 -0
- package/Button/maps.d.ts +132 -0
- package/Button/maps.js +37 -0
- package/Button/styles.d.ts +120 -0
- package/Button/styles.js +103 -0
- package/Button/types.d.ts +26 -0
- package/CardMetric/CardChildren.d.ts +3 -0
- package/CardMetric/CardChildren.js +25 -0
- package/CardMetric/CardCollapse.d.ts +3 -0
- package/CardMetric/CardCollapse.js +13 -0
- package/CardMetric/CardMetric.d.ts +3 -0
- package/CardMetric/CardMetric.js +62 -0
- package/CardMetric/index.d.ts +2 -0
- package/CardMetric/index.js +1 -0
- package/CardMetric/styles.d.ts +13 -0
- package/CardMetric/styles.js +74 -0
- package/CardMetric/types.d.ts +34 -0
- package/Checkbox/Checkbox.d.ts +3 -0
- package/Checkbox/Checkbox.js +47 -0
- package/Checkbox/index.d.ts +2 -0
- package/Checkbox/index.js +1 -0
- package/Checkbox/maps.d.ts +3 -0
- package/Checkbox/maps.js +7 -0
- package/Checkbox/styles.d.ts +9 -0
- package/Checkbox/styles.js +17 -0
- package/Checkbox/types.d.ts +15 -0
- package/Drawer/Drawer.d.ts +3 -0
- package/Drawer/Drawer.js +62 -0
- package/Drawer/index.d.ts +1 -0
- package/Drawer/index.js +1 -0
- package/Drawer/maps.d.ts +6 -0
- package/Drawer/maps.js +6 -0
- package/Drawer/styles.d.ts +11 -0
- package/Drawer/styles.js +57 -0
- package/Drawer/types.d.ts +18 -0
- package/EditableField/EditableField.d.ts +3 -0
- package/EditableField/EditableField.js +61 -0
- package/EditableField/index.d.ts +2 -0
- package/EditableField/index.js +1 -0
- package/EditableField/styles.d.ts +8 -0
- package/EditableField/styles.js +25 -0
- package/EditableField/types.d.ts +15 -0
- package/EmailTemplatePreview/EmailTemplatePreview.d.ts +3 -11
- package/EmailTemplatePreview/EmailTemplatePreview.js +11 -10
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +2 -2
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +3 -3
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/assets/PW_logo.svg +1 -5
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/{styled.js → styles.js} +2 -2
- package/EmailTemplatePreview/{styled.js → styles.js} +1 -1
- package/EmailTemplatePreview/types.d.ts +8 -0
- package/ExportResult/ExportResult.d.ts +2 -2
- package/ExportResult/ExportResult.js +10 -9
- package/ExportResult/{styled.js → styles.js} +5 -5
- package/FieldBox/FieldBox.d.ts +3 -3
- package/FieldBox/FieldBox.js +8 -7
- package/FieldBox/index.d.ts +1 -1
- package/FieldBox/types.js +1 -0
- package/NumberPicker/NumberPicker.js +2 -2
- package/NumberPicker/{AutosizeInput.d.ts → components/AutosizeInput/AutosizeInput.d.ts} +1 -1
- package/NumberPicker/{AutosizeInput.js → components/AutosizeInput/AutosizeInput.js} +3 -3
- package/NumberPicker/components/AutosizeInput/index.d.ts +1 -0
- package/NumberPicker/components/AutosizeInput/index.js +1 -0
- package/NumberPicker/{AutosizeInput.styled.js → components/AutosizeInput/styles.js} +1 -1
- package/NumberPicker/components/AutosizeInput/types.js +1 -0
- package/NumberPicker/{styled.js → styles.js} +3 -3
- package/Popover/Popover.d.ts +3 -0
- package/Popover/Popover.js +44 -0
- package/Popover/index.d.ts +4 -0
- package/Popover/index.js +2 -0
- package/Popover/styles.d.ts +6 -0
- package/Popover/styles.js +19 -0
- package/Popover/types.d.ts +12 -0
- package/Popover/types.js +1 -0
- package/ProgressBar/ProgressBar.d.ts +2 -2
- package/ProgressBar/ProgressBar.js +19 -16
- package/ProgressBar/{styled.js → styles.js} +10 -10
- package/PushPreview/PushPreview.js +3 -3
- package/PushPreview/{styled.js → styles.js} +8 -8
- package/Radio/Radio.d.ts +3 -0
- package/Radio/Radio.js +37 -0
- package/Radio/index.d.ts +2 -0
- package/Radio/index.js +1 -0
- package/Radio/maps.d.ts +3 -0
- package/Radio/maps.js +8 -0
- package/Radio/styled.d.ts +5 -0
- package/Radio/styled.js +13 -0
- package/Radio/types.d.ts +12 -0
- package/Radio/types.js +1 -0
- package/Spinner/Spinner.d.ts +3 -0
- package/Spinner/Spinner.js +20 -0
- package/Spinner/assets/index.d.ts +4 -0
- package/Spinner/assets/index.js +6 -0
- package/Spinner/assets/spinner.medium.svg +1 -0
- package/Spinner/assets/spinner.small.svg +1 -0
- package/Spinner/index.d.ts +2 -0
- package/Spinner/index.js +1 -0
- package/Spinner/maps.d.ts +5 -0
- package/Spinner/maps.js +5 -0
- package/Spinner/styles.d.ts +5 -0
- package/Spinner/styles.js +20 -0
- package/Spinner/types.d.ts +6 -0
- package/Spinner/types.js +1 -0
- package/StatisticCard/StatisticCard.d.ts +2 -2
- package/StatisticCard/StatisticCard.js +15 -14
- package/Tabs/{tab/tab.d.ts → components/Tab/Tab.d.ts} +2 -2
- package/Tabs/{tab/tab.js → components/Tab/Tab.js} +2 -2
- package/Tabs/components/Tab/index.d.ts +1 -0
- package/Tabs/components/Tab/index.js +1 -0
- package/Tabs/{tab/tab.types.d.ts → components/Tab/types.d.ts} +1 -1
- package/Tabs/components/Tab/types.js +1 -0
- package/Tabs/{tab-bar/tab-bar.js → components/TabBar/TabBar.js} +2 -2
- package/Tabs/components/TabBar/index.d.ts +1 -0
- package/Tabs/components/TabBar/index.js +1 -0
- package/Tabs/{tab-bar/tab-bar.styles.js → components/TabBar/styles.js} +2 -2
- package/Tabs/components/TabBar/types.js +1 -0
- package/Tabs/{tabs-list-slide-frame/tabs-list-slide-frame.d.ts → components/TabBarScrollableFrame/TabBarScrollableFrame.d.ts} +1 -1
- package/Tabs/{tabs-list-slide-frame/tabs-list-slide-frame.js → components/TabBarScrollableFrame/TabBarScrollableFrame.js} +2 -2
- package/Tabs/components/TabBarScrollableFrame/index.d.ts +1 -0
- package/Tabs/components/TabBarScrollableFrame/index.js +1 -0
- package/Tabs/{tabs-list-slide-frame/tabs-list-slide-frame.styles.js → components/TabBarScrollableFrame/styles.js} +5 -5
- package/Tabs/components/TabBarScrollableFrame/types.js +1 -0
- package/Tabs/{tab-base/tab-base.js → components/TabBase/TabBase.js} +1 -1
- package/Tabs/components/TabBase/index.d.ts +1 -0
- package/Tabs/components/TabBase/index.js +1 -0
- package/Tabs/{tab-base/tab-base.styles.js → components/TabBase/styles.js} +4 -4
- package/Tabs/components/TabBase/types.js +1 -0
- package/Tabs/{tab-panel/tab-panel.d.ts → components/TabPanel/TabPanel.d.ts} +1 -1
- package/Tabs/{tab-panel/tab-panel.js → components/TabPanel/TabPanel.js} +1 -1
- package/Tabs/components/TabPanel/index.d.ts +1 -0
- package/Tabs/components/TabPanel/index.js +1 -0
- package/Tabs/{tab-panel → components/TabPanel}/styles.js +1 -1
- package/Tabs/{tab-panel/tab-panel.types.d.ts → components/TabPanel/types.d.ts} +1 -1
- package/Tabs/components/TabPanel/types.js +1 -0
- package/Tabs/{tabs/tabs.d.ts → components/Tabs/Tabs.d.ts} +1 -1
- package/Tabs/{tabs/tabs.js → components/Tabs/Tabs.js} +1 -1
- package/Tabs/components/Tabs/index.d.ts +1 -0
- package/Tabs/components/Tabs/index.js +1 -0
- package/Tabs/{tabs → components/Tabs}/styles.js +1 -1
- package/Tabs/{tabs/tabs.types.d.ts → components/Tabs/types.d.ts} +1 -1
- package/Tabs/components/Tabs/types.js +1 -0
- package/Tabs/{tabs.context.d.ts → context.d.ts} +1 -1
- package/Tabs/index.d.ts +5 -5
- package/Tabs/index.js +4 -5
- package/Tabs/types.js +1 -0
- package/Tooltip/Tooltip.d.ts +3 -0
- package/Tooltip/Tooltip.js +47 -0
- package/Tooltip/index.d.ts +2 -0
- package/Tooltip/index.js +1 -0
- package/Tooltip/maps.d.ts +48 -0
- package/Tooltip/maps.js +161 -0
- package/Tooltip/styles.d.ts +5 -0
- package/Tooltip/styles.js +22 -0
- package/Tooltip/types.d.ts +14 -0
- package/Tooltip/types.js +1 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useElementWidth.d.ts +11 -0
- package/hooks/useElementWidth.js +27 -0
- package/hooks/useOnClickOutside.d.ts +4 -0
- package/hooks/useOnClickOutside.js +23 -0
- package/index.d.ts +14 -3
- package/index.js +12 -1
- package/package.json +6 -3
- package/Tabs/tab/index.d.ts +0 -2
- package/Tabs/tab/index.js +0 -2
- package/Tabs/tab-bar/index.d.ts +0 -2
- package/Tabs/tab-bar/index.js +0 -2
- package/Tabs/tab-base/index.d.ts +0 -3
- package/Tabs/tab-base/index.js +0 -3
- package/Tabs/tab-panel/index.d.ts +0 -2
- package/Tabs/tab-panel/index.js +0 -2
- package/Tabs/tabs/index.d.ts +0 -2
- package/Tabs/tabs/index.js +0 -2
- package/Tabs/tabs-list-slide-frame/index.d.ts +0 -3
- package/Tabs/tabs-list-slide-frame/index.js +0 -3
- package/{FieldBox/FieldBox.types.js → ActionsGroup/types.js} +0 -0
- package/{NumberPicker/AutosizeInput.types.js → Badge/types.js} +0 -0
- package/{Tabs/tab-bar/tab-bar.types.js → Banner/types.js} +0 -0
- package/{Tabs/tab-base/tab-base.types.js → Button/types.js} +0 -0
- package/{Tabs/tab-panel/tab-panel.types.js → CardMetric/types.js} +0 -0
- package/{Tabs/tab/tab.types.js → Checkbox/types.js} +0 -0
- package/{Tabs/tabs-list-slide-frame/tabs-list-slide-frame.types.js → Drawer/types.js} +0 -0
- package/{Tabs/tabs.types.js → EditableField/types.js} +0 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/{styled.d.ts → styles.d.ts} +0 -0
- package/EmailTemplatePreview/{styled.d.ts → styles.d.ts} +0 -0
- package/{Tabs/tabs/tabs.types.js → EmailTemplatePreview/types.js} +0 -0
- package/ExportResult/{styled.d.ts → styles.d.ts} +0 -0
- package/FieldBox/{FieldBox.types.d.ts → types.d.ts} +0 -0
- package/NumberPicker/{AutosizeInput.constants.d.ts → components/AutosizeInput/constants.d.ts} +0 -0
- package/NumberPicker/{AutosizeInput.constants.js → components/AutosizeInput/constants.js} +0 -0
- package/NumberPicker/{AutosizeInput.styled.d.ts → components/AutosizeInput/styles.d.ts} +0 -0
- package/NumberPicker/{AutosizeInput.types.d.ts → components/AutosizeInput/types.d.ts} +0 -0
- package/NumberPicker/{styled.d.ts → styles.d.ts} +0 -0
- package/ProgressBar/{styled.d.ts → styles.d.ts} +0 -0
- package/PushPreview/{constants/urls.d.ts → constants.d.ts} +0 -0
- package/PushPreview/{constants/urls.js → constants.js} +0 -0
- package/PushPreview/{helpers/helpers.d.ts → helpers.d.ts} +0 -0
- package/PushPreview/{helpers/helpers.js → helpers.js} +0 -0
- package/PushPreview/{styled.d.ts → styles.d.ts} +0 -0
- package/Tabs/{tab-bar/tab-bar.d.ts → components/TabBar/TabBar.d.ts} +0 -0
- package/Tabs/{tab-bar/tab-bar.styles.d.ts → components/TabBar/styles.d.ts} +0 -0
- package/Tabs/{tab-bar/tab-bar.types.d.ts → components/TabBar/types.d.ts} +0 -0
- package/Tabs/{tabs-list-slide-frame/tabs-list-slide-frame.styles.d.ts → components/TabBarScrollableFrame/styles.d.ts} +0 -0
- package/Tabs/{tabs-list-slide-frame/tabs-list-slide-frame.types.d.ts → components/TabBarScrollableFrame/types.d.ts} +0 -0
- package/Tabs/{tab-base/tab-base.d.ts → components/TabBase/TabBase.d.ts} +1 -1
- package/Tabs/{tab-base/tab-base.styles.d.ts → components/TabBase/styles.d.ts} +0 -0
- package/Tabs/{tab-base/tab-base.types.d.ts → components/TabBase/types.d.ts} +1 -1
- /package/Tabs/{tab-panel → components/TabPanel}/styles.d.ts +0 -0
- /package/Tabs/{tabs → components/Tabs}/styles.d.ts +0 -0
- /package/Tabs/{tabs.context.js → context.js} +0 -0
- /package/Tabs/{tabs.helpers.d.ts → helpers.d.ts} +0 -0
- /package/Tabs/{tabs.helpers.js → helpers.js} +0 -0
- /package/Tabs/{tabs.types.d.ts → types.d.ts} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { InfoRoundIcon, ChevronIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { Spinner } from '../Spinner';
|
|
5
|
+
import { Tooltip } from '../Tooltip';
|
|
6
|
+
import { CardChildren } from './CardChildren';
|
|
7
|
+
import { CardContainer, CardHeader, CardTitle, CardInfo, CardMetricValue, CardExtraMetric, CardDescription, CardHeaderLeft } from './styles';
|
|
8
|
+
export function CardMetric(props) {
|
|
9
|
+
const {
|
|
10
|
+
view = 'rounded',
|
|
11
|
+
focus = false,
|
|
12
|
+
title = '',
|
|
13
|
+
tooltip = '',
|
|
14
|
+
description = '',
|
|
15
|
+
loading = false,
|
|
16
|
+
collapse = undefined,
|
|
17
|
+
metric = undefined,
|
|
18
|
+
extraMetric = undefined,
|
|
19
|
+
extraMetricColor = Color.MAIN,
|
|
20
|
+
headerExtra = undefined,
|
|
21
|
+
children,
|
|
22
|
+
...otherProps
|
|
23
|
+
} = props;
|
|
24
|
+
const [visibleInfo, setVisibleInfo] = useState(false);
|
|
25
|
+
const [isCollapsed, setIsCollapsed] = useState(!!(collapse !== null && collapse !== void 0 && collapse.isCollapsed));
|
|
26
|
+
const onMouseOver = () => setVisibleInfo(true);
|
|
27
|
+
const onMouseOut = () => setVisibleInfo(false);
|
|
28
|
+
return React.createElement(CardContainer, {
|
|
29
|
+
view: view,
|
|
30
|
+
focus: focus,
|
|
31
|
+
...otherProps
|
|
32
|
+
}, (!!title || !!headerExtra) && React.createElement(CardHeader, null, React.createElement(CardHeaderLeft, null, React.createElement(CardTitle, {
|
|
33
|
+
onClick: () => {
|
|
34
|
+
if (collapse !== undefined) {
|
|
35
|
+
setIsCollapsed(prevState => !prevState);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
collapsable: collapse !== undefined
|
|
39
|
+
}, title, collapse !== undefined && React.createElement(ChevronIcon, {
|
|
40
|
+
direction: isCollapsed ? 'down' : 'up',
|
|
41
|
+
size: "small"
|
|
42
|
+
}), React.createElement(CardInfo, {
|
|
43
|
+
hide: !tooltip,
|
|
44
|
+
onMouseOver: onMouseOver,
|
|
45
|
+
onMouseOut: onMouseOut
|
|
46
|
+
}, React.createElement(Tooltip, {
|
|
47
|
+
isVisible: visibleInfo,
|
|
48
|
+
content: tooltip
|
|
49
|
+
}, React.createElement("div", null, React.createElement(InfoRoundIcon, {
|
|
50
|
+
size: "small",
|
|
51
|
+
view: "lined",
|
|
52
|
+
color: visibleInfo ? Color.PRIMARY_HOVER : Color.SOFT
|
|
53
|
+
}))))), metric !== undefined && (loading ? React.createElement(Spinner, {
|
|
54
|
+
size: "medium"
|
|
55
|
+
}) : React.createElement(CardMetricValue, null, metric, React.createElement(CardExtraMetric, {
|
|
56
|
+
color: extraMetricColor
|
|
57
|
+
}, extraMetric)))), React.createElement("div", null, headerExtra)), React.createElement(CardChildren, {
|
|
58
|
+
loading: loading,
|
|
59
|
+
collapse: collapse,
|
|
60
|
+
isCollapsed: isCollapsed
|
|
61
|
+
}, children), !!description && React.createElement(CardDescription, null, description));
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CardMetric } from './CardMetric';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CardContainerProps, CardTitleProps, CollapseContainerProps } from './types';
|
|
2
|
+
export declare const CardContainer: import("styled-components").StyledComponent<"div", any, CardContainerProps, never>;
|
|
3
|
+
export declare const CardHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const CardHeaderLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const CardTitle: import("styled-components").StyledComponent<"div", any, CardTitleProps, never>;
|
|
6
|
+
export declare const CardInfo: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
hide: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const CardMetricValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const CardExtraMetric: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const CardDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const CollapseContainer: import("styled-components").StyledComponent<"div", any, CollapseContainerProps, never>;
|
|
13
|
+
export declare const CollapseInner: import("styled-components").StyledComponent<"div", any, CollapseContainerProps, never>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, Spacing, FontSize, FontWeight } from '@pushwoosh/kit-constants';
|
|
3
|
+
export const CardContainer = styled.div.withConfig({
|
|
4
|
+
displayName: "CardContainer",
|
|
5
|
+
componentId: "sc-17snd37-0"
|
|
6
|
+
})(["display:flex;color:", ";background-color:white;flex-direction:column;scroll-margin:4px;outline-style:solid;gap:", ";padding:", ";border-radius:", ";border-bottom:", ";outline-color:", ";outline-width:", ";"], Color.MAIN, Spacing.S4, ({
|
|
7
|
+
view
|
|
8
|
+
}) => view === 'stacking' ? '24px' : '16px', ({
|
|
9
|
+
view
|
|
10
|
+
}) => view === 'stacking' ? 0 : '4px', ({
|
|
11
|
+
view,
|
|
12
|
+
focus
|
|
13
|
+
}) => view === 'stacking' && !focus ? `1px solid ${Color.DIVIDER}` : 'none', ({
|
|
14
|
+
focus
|
|
15
|
+
}) => focus ? Color.BRIGHT : Color.DIVIDER, ({
|
|
16
|
+
view,
|
|
17
|
+
focus
|
|
18
|
+
}) => {
|
|
19
|
+
if (focus) {
|
|
20
|
+
return '4px';
|
|
21
|
+
}
|
|
22
|
+
if (view === 'stacking') {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
return '1px';
|
|
26
|
+
});
|
|
27
|
+
export const CardHeader = styled.div.withConfig({
|
|
28
|
+
displayName: "CardHeader",
|
|
29
|
+
componentId: "sc-17snd37-1"
|
|
30
|
+
})(["display:flex;justify-content:space-between;align-items:start;gap:", ";"], Spacing.S3);
|
|
31
|
+
export const CardHeaderLeft = styled.div.withConfig({
|
|
32
|
+
displayName: "CardHeaderLeft",
|
|
33
|
+
componentId: "sc-17snd37-2"
|
|
34
|
+
})(["display:flex;flex-direction:column;flex:1;gap:", ";"], Spacing.S3);
|
|
35
|
+
export const CardTitle = styled.div.withConfig({
|
|
36
|
+
displayName: "CardTitle",
|
|
37
|
+
componentId: "sc-17snd37-3"
|
|
38
|
+
})(["display:flex;align-items:center;text-transform:uppercase;font-size:", ";color:", ";cursor:", ";gap:", ";"], FontSize.SMALL, ({
|
|
39
|
+
collapsable
|
|
40
|
+
}) => collapsable ? Color.SOFT : Color.MAIN, ({
|
|
41
|
+
collapsable
|
|
42
|
+
}) => collapsable ? 'pointer' : 'auto', Spacing.S1);
|
|
43
|
+
export const CardInfo = styled.div.withConfig({
|
|
44
|
+
displayName: "CardInfo",
|
|
45
|
+
componentId: "sc-17snd37-4"
|
|
46
|
+
})(["display:", ";cursor:pointer;"], ({
|
|
47
|
+
hide
|
|
48
|
+
}) => hide ? 'none' : 'block');
|
|
49
|
+
export const CardMetricValue = styled.div.withConfig({
|
|
50
|
+
displayName: "CardMetricValue",
|
|
51
|
+
componentId: "sc-17snd37-5"
|
|
52
|
+
})(["display:flex;align-items:start;justify-content:start;font-size:", ";font-weight:", ";gap:", ";"], FontSize.HEADING1, FontWeight.MEDIUM, Spacing.S1);
|
|
53
|
+
export const CardExtraMetric = styled.div.withConfig({
|
|
54
|
+
displayName: "CardExtraMetric",
|
|
55
|
+
componentId: "sc-17snd37-6"
|
|
56
|
+
})(["color:", ";font-size:", ";"], ({
|
|
57
|
+
color
|
|
58
|
+
}) => color, FontSize.REGULAR);
|
|
59
|
+
export const CardDescription = styled.div.withConfig({
|
|
60
|
+
displayName: "CardDescription",
|
|
61
|
+
componentId: "sc-17snd37-7"
|
|
62
|
+
})(["color:", ";"], Color.LOCKED);
|
|
63
|
+
export const CollapseContainer = styled.div.withConfig({
|
|
64
|
+
displayName: "CollapseContainer",
|
|
65
|
+
componentId: "sc-17snd37-8"
|
|
66
|
+
})(["display:grid;grid-template-rows:", ";transition:grid-template-rows 0.5s ease-out;"], ({
|
|
67
|
+
isCollapsed
|
|
68
|
+
}) => isCollapsed ? '0fr' : '1fr');
|
|
69
|
+
export const CollapseInner = styled.div.withConfig({
|
|
70
|
+
displayName: "CollapseInner",
|
|
71
|
+
componentId: "sc-17snd37-9"
|
|
72
|
+
})(["overflow:", ";"], ({
|
|
73
|
+
isCollapsed
|
|
74
|
+
}) => isCollapsed ? 'hidden' : 'auto');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type CardMetricProps = {
|
|
3
|
+
view?: 'rounded' | 'stacking';
|
|
4
|
+
focus?: boolean;
|
|
5
|
+
title?: string | ReactElement;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
collapse?: {
|
|
9
|
+
isCollapsed: boolean;
|
|
10
|
+
};
|
|
11
|
+
description?: string;
|
|
12
|
+
metric?: string | number;
|
|
13
|
+
extraMetric?: string | number;
|
|
14
|
+
extraMetricColor?: string;
|
|
15
|
+
headerExtra?: ReactElement;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
export type CardContainerProps = {
|
|
19
|
+
view: 'rounded' | 'stacking';
|
|
20
|
+
focus: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type CardTitleProps = {
|
|
23
|
+
collapsable: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type CollapseContainerProps = {
|
|
26
|
+
isCollapsed: boolean;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
export type CardChildrenProps = {
|
|
30
|
+
loading: boolean;
|
|
31
|
+
collapse?: object;
|
|
32
|
+
isCollapsed: boolean;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { NativeLabel, NativeCheckbox } from './styles';
|
|
3
|
+
// eslint-disable-next-line prefer-const
|
|
4
|
+
let counter = 0;
|
|
5
|
+
export function Checkbox(props) {
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
id,
|
|
9
|
+
name,
|
|
10
|
+
value,
|
|
11
|
+
color,
|
|
12
|
+
activeCheckboxColor,
|
|
13
|
+
isChecked,
|
|
14
|
+
isDisabled,
|
|
15
|
+
isIndeterminate,
|
|
16
|
+
onChange,
|
|
17
|
+
className
|
|
18
|
+
} = props;
|
|
19
|
+
const [localId] = useState(() => {
|
|
20
|
+
if (id) {
|
|
21
|
+
return id;
|
|
22
|
+
}
|
|
23
|
+
const newCounter = counter + 1;
|
|
24
|
+
return `checkbox-${newCounter}`;
|
|
25
|
+
});
|
|
26
|
+
const checkboxRef = useRef(null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (checkboxRef.current) {
|
|
29
|
+
checkboxRef.current.indeterminate = isIndeterminate ?? false;
|
|
30
|
+
}
|
|
31
|
+
}, [checkboxRef, isIndeterminate]);
|
|
32
|
+
return React.createElement(NativeLabel, {
|
|
33
|
+
htmlFor: localId,
|
|
34
|
+
"$color": color,
|
|
35
|
+
className: className
|
|
36
|
+
}, React.createElement(NativeCheckbox, {
|
|
37
|
+
type: "checkbox",
|
|
38
|
+
id: localId,
|
|
39
|
+
ref: checkboxRef,
|
|
40
|
+
value: value,
|
|
41
|
+
color: activeCheckboxColor,
|
|
42
|
+
name: name,
|
|
43
|
+
checked: isChecked,
|
|
44
|
+
disabled: isDisabled,
|
|
45
|
+
onChange: event => onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.checked)
|
|
46
|
+
}), label && React.createElement("span", null, label));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from './Checkbox';
|
package/Checkbox/maps.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextColor } from './types';
|
|
2
|
+
export declare const NativeCheckbox: import("styled-components").StyledComponent<"input", any, {
|
|
3
|
+
type: "checkbox";
|
|
4
|
+
} & {
|
|
5
|
+
color?: string;
|
|
6
|
+
}, "type">;
|
|
7
|
+
export declare const NativeLabel: import("styled-components").StyledComponent<"label", any, {
|
|
8
|
+
$color?: TextColor;
|
|
9
|
+
}, never>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, Spacing, FontSize, LineHeight } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { ColorMap } from './maps';
|
|
4
|
+
export const NativeCheckbox = styled.input.attrs({
|
|
5
|
+
type: 'checkbox'
|
|
6
|
+
}).withConfig({
|
|
7
|
+
displayName: "NativeCheckbox",
|
|
8
|
+
componentId: "sc-1lw3rny-0"
|
|
9
|
+
})(["--active:", ";--active-inner:", ";--focus:2px rgba(39,94,254,.3);--border:#BBC1E1;--border-hover:#275EFE;--default-background:", ";--disabled:#F6F8FF;--disabled-inner:#E1E6F9;appearance:none;-webkit-appearance:none;-moz-appearance:none;width:18px;height:18px;outline:none;display:inline-block;vertical-align:top;position:relative;margin:0;cursor:pointer;border:2px solid var(--bc,var(--border));border-radius:4px;box-sizing:border-box;background:var(--background,var(--default-background));transition:background 0.3s,border-color 0.3s,box-shadow 0.2s;&:checked{--background:var(--active);--bc:var(--active);--d-o:.3s;--d-t:.6s;--o:1;--r:43deg;}&:disabled{--background:var(--disabled);cursor:not-allowed;opacity:0.9;}&:disabled:checked{--background:var(--disabled-inner);--bc:var(--border);}&:hover:not(:checked):not(:disabled){--bc:var(--border-hover);}&:focus{box-shadow:0 0 0 var(--focus);}&:after{content:\"\";display:block;position:absolute;transition:transform var(--d-t,0.3s),opacity var(--d-o,0.2s);opacity:var(--o,0);width:4px;height:8px;border:1px solid var(--active-inner);border-top:0;border-left:0;left:5px;top:1px;transform:rotate(var(--r,20deg)) scale(1.4);}&:indeterminate{--background:var(--active);--bc:var(--active);}&:indeterminate:after{width:11.5px;height:1.5px;top:6.25px;left:1.3px;border:none;background-color:var(--active-inner);transform:none;opacity:var(--o,1);transition:width var(--d-t,0.3s),height var(--d-o,0.2s),opacity var(--d-o,0.2s);}&:disabled + span{cursor:not-allowed;}"], ({
|
|
10
|
+
color
|
|
11
|
+
}) => color ?? Color.PRIMARY, Color.CLEAR, Color.CLEAR);
|
|
12
|
+
export const NativeLabel = styled.label.withConfig({
|
|
13
|
+
displayName: "NativeLabel",
|
|
14
|
+
componentId: "sc-1lw3rny-1"
|
|
15
|
+
})(["font-size:", ";line-height:", ";", " user-select:none;& > ", "{margin:1px;&:not(:last-child){margin-right:", ";}}"], FontSize.REGULAR, LineHeight.REGULAR, ({
|
|
16
|
+
$color
|
|
17
|
+
}) => $color && `color: ${ColorMap[$color]};`, NativeCheckbox, Spacing.S3);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type TextColor = 'main' | 'primary' | 'danger' | 'current';
|
|
3
|
+
export type CheckboxProps = {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
id?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: string | number;
|
|
8
|
+
color?: TextColor;
|
|
9
|
+
activeCheckboxColor?: string;
|
|
10
|
+
isChecked?: boolean;
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
isIndeterminate?: boolean;
|
|
13
|
+
onChange?: (checked: boolean) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
package/Drawer/Drawer.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { drawerSizes } from './maps';
|
|
4
|
+
import { DrawerBoxTrans, DrawerBox, LockBody, DrawerInner, DrawerContainer } from './styles';
|
|
5
|
+
function createDivElement() {
|
|
6
|
+
return document.createElement('div');
|
|
7
|
+
}
|
|
8
|
+
export function Drawer(props) {
|
|
9
|
+
const {
|
|
10
|
+
size,
|
|
11
|
+
isOpen,
|
|
12
|
+
zIndex = 10000,
|
|
13
|
+
onClose,
|
|
14
|
+
children,
|
|
15
|
+
withoutLockScreen = false,
|
|
16
|
+
closeOnClickOutside = true
|
|
17
|
+
} = props;
|
|
18
|
+
const ref = useRef();
|
|
19
|
+
const [element] = useState(createDivElement);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
var _document$body$lastCh;
|
|
22
|
+
(_document$body$lastCh = document.body.lastChild) === null || _document$body$lastCh === void 0 || _document$body$lastCh.after(element);
|
|
23
|
+
return () => element.remove();
|
|
24
|
+
}, [element]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (isOpen && onClose) {
|
|
27
|
+
const onCloseEventHandler = event => {
|
|
28
|
+
if (event.key === 'Escape') {
|
|
29
|
+
onClose();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener('keydown', onCloseEventHandler);
|
|
33
|
+
return () => {
|
|
34
|
+
window.removeEventListener('keydown', onCloseEventHandler);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return () => {};
|
|
38
|
+
}, [isOpen, onClose]);
|
|
39
|
+
const handleClose = useCallback(event => {
|
|
40
|
+
if (event.target === event.currentTarget) {
|
|
41
|
+
onClose === null || onClose === void 0 || onClose();
|
|
42
|
+
}
|
|
43
|
+
}, [onClose]);
|
|
44
|
+
const handleClickOutside = useCallback(event => {
|
|
45
|
+
if (closeOnClickOutside) {
|
|
46
|
+
handleClose(event);
|
|
47
|
+
}
|
|
48
|
+
}, [handleClose, closeOnClickOutside]);
|
|
49
|
+
return createPortal(React.createElement(DrawerBoxTrans, {
|
|
50
|
+
nodeRef: ref,
|
|
51
|
+
isOpen: isOpen,
|
|
52
|
+
withoutLockScreen: withoutLockScreen
|
|
53
|
+
}, React.createElement(DrawerBox, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
"$zIndex": zIndex
|
|
56
|
+
}, React.createElement(LockBody, null), React.createElement(DrawerInner, {
|
|
57
|
+
onMouseDown: handleClickOutside
|
|
58
|
+
}, React.createElement(DrawerContainer, {
|
|
59
|
+
"$width": drawerSizes[size],
|
|
60
|
+
onClick: handleClose
|
|
61
|
+
}, children)))), element);
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer } from './Drawer';
|
package/Drawer/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer } from './Drawer';
|
package/Drawer/maps.d.ts
ADDED
package/Drawer/maps.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DrawerBoxBaseProps, IDrawerBoxTransProps } from './types';
|
|
3
|
+
export declare const LockBody: import("styled-components").GlobalStyleComponent<{}, import("styled-components").DefaultTheme>;
|
|
4
|
+
export declare const DrawerBox: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
$zIndex: number;
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const DrawerInner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const DrawerBoxTrans: import("styled-components").StyledComponent<React.FC<DrawerBoxBaseProps>, any, IDrawerBoxTransProps, never>;
|
|
9
|
+
export declare const DrawerContainer: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
$width: string;
|
|
11
|
+
}, never>;
|
package/Drawer/styles.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CSSTransition } from 'react-transition-group';
|
|
3
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
4
|
+
const animationTimeout = 300;
|
|
5
|
+
export const LockBody = createGlobalStyle(["body{overflow:hidden;position:relative;height:100%;}"]);
|
|
6
|
+
export const DrawerBox = styled.div.withConfig({
|
|
7
|
+
displayName: "DrawerBox",
|
|
8
|
+
componentId: "sc-1c6sp83-0"
|
|
9
|
+
})(["position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:all;z-index:", ";"], ({
|
|
10
|
+
$zIndex
|
|
11
|
+
}) => $zIndex);
|
|
12
|
+
export const DrawerInner = styled.div.withConfig({
|
|
13
|
+
displayName: "DrawerInner",
|
|
14
|
+
componentId: "sc-1c6sp83-1"
|
|
15
|
+
})(["display:flex;justify-content:flex-end;width:100vw;height:100vh;padding:0 0 0 280px;"]);
|
|
16
|
+
const DrawerBoxBase = props => {
|
|
17
|
+
const {
|
|
18
|
+
isOpen,
|
|
19
|
+
nodeRef,
|
|
20
|
+
className,
|
|
21
|
+
children
|
|
22
|
+
} = props;
|
|
23
|
+
return React.createElement(CSSTransition, {
|
|
24
|
+
appear: true,
|
|
25
|
+
unmountOnExit: true,
|
|
26
|
+
in: isOpen,
|
|
27
|
+
timeout: animationTimeout,
|
|
28
|
+
classNames: className,
|
|
29
|
+
nodeRef: nodeRef
|
|
30
|
+
}, children);
|
|
31
|
+
};
|
|
32
|
+
export const DrawerBoxTrans = styled(DrawerBoxBase).withConfig({
|
|
33
|
+
displayName: "DrawerBoxTrans",
|
|
34
|
+
componentId: "sc-1c6sp83-2"
|
|
35
|
+
})(["&-appear{background-color:", ";transition:background-color ", "ms;", "{opacity:0;transform:translateX(100%);}}&-appear-active{background-color:", ";", "{opacity:0.99;transform:translateX(.1%);transition:opacity ", "ms,transform ", "ms;}}&-appear-done{background-color:", ";", "{opacity:1;transform:translateX(0);}}&-enter{background-color:", ";transition:background-color ", "ms;", "{opacity:0;transform:translateX(100%);}}&-enter-active{background-color:", ";", "{opacity:0.99;transform:translateX(.1%);transition:opacity ", "ms,transform ", "ms;}}&-enter-done{background-color:", ";", "{opacity:1;transform:translateX(0);}}&-exit{background-color:", ";", "{opacity:1;transform:translateX(0);transition:opacity ", "ms,transform ", "ms;}}&-exit-active{transition:background-color ", "ms;background-color:", ";", "{opacity:0;transform:translateX(100%);}}"], ({
|
|
36
|
+
withoutLockScreen = false
|
|
37
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 0%)', animationTimeout, DrawerInner, ({
|
|
38
|
+
withoutLockScreen = false
|
|
39
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 70%)', DrawerInner, animationTimeout, animationTimeout, ({
|
|
40
|
+
withoutLockScreen = false
|
|
41
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 70%)', DrawerInner, ({
|
|
42
|
+
withoutLockScreen = false
|
|
43
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 0%)', animationTimeout, DrawerInner, ({
|
|
44
|
+
withoutLockScreen = false
|
|
45
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 70%)', DrawerInner, animationTimeout, animationTimeout, ({
|
|
46
|
+
withoutLockScreen = false
|
|
47
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 70%)', DrawerInner, ({
|
|
48
|
+
withoutLockScreen = false
|
|
49
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 70%)', DrawerInner, animationTimeout, animationTimeout, animationTimeout, ({
|
|
50
|
+
withoutLockScreen = false
|
|
51
|
+
}) => withoutLockScreen ? 'transparent' : 'rgb(0 0 0 / 0%)', DrawerInner);
|
|
52
|
+
export const DrawerContainer = styled.div.withConfig({
|
|
53
|
+
displayName: "DrawerContainer",
|
|
54
|
+
componentId: "sc-1c6sp83-3"
|
|
55
|
+
})(["position:relative;display:inline-flex;flex-direction:column;align-items:stretch;justify-content:flex-start;width:", ";height:100vh;z-index:10;box-shadow:0 10px 16px 0 rgba(27,31,36,0.1);"], ({
|
|
56
|
+
$width
|
|
57
|
+
}) => $width);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MutableRefObject, PropsWithChildren } from 'react';
|
|
2
|
+
import type { drawerSizes } from './maps';
|
|
3
|
+
export type DrawerProps = PropsWithChildren<{
|
|
4
|
+
readonly size: keyof typeof drawerSizes;
|
|
5
|
+
readonly isOpen: boolean;
|
|
6
|
+
readonly zIndex?: number;
|
|
7
|
+
readonly onClose?: () => any;
|
|
8
|
+
readonly withoutLockScreen?: boolean;
|
|
9
|
+
readonly closeOnClickOutside?: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export type DrawerBoxBaseProps = PropsWithChildren<{
|
|
12
|
+
className?: string;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
nodeRef: MutableRefObject<HTMLElement | undefined>;
|
|
15
|
+
}>;
|
|
16
|
+
export type IDrawerBoxTransProps = {
|
|
17
|
+
withoutLockScreen?: boolean;
|
|
18
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { DropdownIcon, EditIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { useOnClickOutside } from '../hooks';
|
|
6
|
+
import { Popover, PopoverContainer } from '../Popover';
|
|
7
|
+
import { FieldBox, TitleBox, ButtonsGroup } from './styles';
|
|
8
|
+
export function EditableField(props) {
|
|
9
|
+
const {
|
|
10
|
+
value,
|
|
11
|
+
title = '',
|
|
12
|
+
open = false,
|
|
13
|
+
loading = false,
|
|
14
|
+
width = 332,
|
|
15
|
+
position = 'right-start',
|
|
16
|
+
zIndex = 1000,
|
|
17
|
+
onToggleOpen,
|
|
18
|
+
onSubmit,
|
|
19
|
+
onCancel,
|
|
20
|
+
children
|
|
21
|
+
} = props;
|
|
22
|
+
const rootRef = useRef(null);
|
|
23
|
+
const buttonRef = useRef(null);
|
|
24
|
+
useOnClickOutside(rootRef, onCancel);
|
|
25
|
+
return React.createElement(PopoverContainer, {
|
|
26
|
+
ref: rootRef
|
|
27
|
+
}, React.createElement(FieldBox, {
|
|
28
|
+
open: open,
|
|
29
|
+
onClick: onToggleOpen,
|
|
30
|
+
ref: buttonRef
|
|
31
|
+
}, React.createElement("span", null, value), open ? React.createElement(DropdownIcon, {
|
|
32
|
+
direction: "up",
|
|
33
|
+
size: "small",
|
|
34
|
+
color: Color.CLEAR
|
|
35
|
+
}) : React.createElement(EditIcon, {
|
|
36
|
+
view: "lined",
|
|
37
|
+
size: "small"
|
|
38
|
+
})), React.createElement(Popover, {
|
|
39
|
+
open: open,
|
|
40
|
+
position: position,
|
|
41
|
+
anchorEl: buttonRef,
|
|
42
|
+
windowWidth: width,
|
|
43
|
+
internalWindowRef: rootRef,
|
|
44
|
+
loading: loading,
|
|
45
|
+
zIndex: zIndex
|
|
46
|
+
}, title && React.createElement(TitleBox, null, title), children, React.createElement(ButtonsGroup, {
|
|
47
|
+
"$isLoading": loading
|
|
48
|
+
}, React.createElement(Button, {
|
|
49
|
+
view: "shape",
|
|
50
|
+
color: "primary",
|
|
51
|
+
size: "compact",
|
|
52
|
+
isLoading: loading,
|
|
53
|
+
onClick: onSubmit
|
|
54
|
+
}, "Submit"), React.createElement(Button, {
|
|
55
|
+
view: "shape",
|
|
56
|
+
color: "secondary",
|
|
57
|
+
size: "compact",
|
|
58
|
+
isDisabled: loading,
|
|
59
|
+
onClick: onCancel
|
|
60
|
+
}, "Cancel"))));
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EditableField } from './EditableField';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { H5 } from '@pushwoosh/kit-typography';
|
|
2
|
+
export declare const FieldBox: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
open: boolean;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const TitleBox: import("styled-components").StyledComponent<typeof H5, any, {}, never>;
|
|
6
|
+
export declare const ButtonsGroup: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
$isLoading: boolean;
|
|
8
|
+
}, never>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, ShapeRadius, Spacing, FontSize, LineHeight } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { H5 } from '@pushwoosh/kit-typography';
|
|
4
|
+
export const FieldBox = styled.div.withConfig({
|
|
5
|
+
displayName: "FieldBox",
|
|
6
|
+
componentId: "sc-qxboek-0"
|
|
7
|
+
})(["display:flex;align-items:center;font-size:", ";line-height:", ";padding:", " ", " ", " ", ";gap:", ";border-radius:", ";color:", ";background:", ";box-sizing:border-box;cursor:pointer;svg{opacity:0.2;}&:active{opacity:0.5;}&:hover{color:", ";background:", ";svg{opacity:1;}}"], FontSize.REGULAR, LineHeight.REGULAR, Spacing.S0, Spacing.S2, Spacing.S0, Spacing.S3, Spacing.S2, ShapeRadius.CONTROL, ({
|
|
8
|
+
open
|
|
9
|
+
}) => open ? Color.CLEAR : Color.MAIN, ({
|
|
10
|
+
open
|
|
11
|
+
}) => open ? Color.MAIN : Color.CLEAR, ({
|
|
12
|
+
open
|
|
13
|
+
}) => open ? Color.CLEAR : Color.PRIMARY_HOVER, ({
|
|
14
|
+
open
|
|
15
|
+
}) => open ? Color.MAIN : 'rgba(153, 201, 255, 0.14)');
|
|
16
|
+
export const TitleBox = styled(H5).withConfig({
|
|
17
|
+
displayName: "TitleBox",
|
|
18
|
+
componentId: "sc-qxboek-1"
|
|
19
|
+
})(["color:", ";margin-bottom:", ";"], Color.MAIN, Spacing.S1);
|
|
20
|
+
export const ButtonsGroup = styled.div.withConfig({
|
|
21
|
+
displayName: "ButtonsGroup",
|
|
22
|
+
componentId: "sc-qxboek-2"
|
|
23
|
+
})(["display:flex;margin-top:", ";opacity:", ";gap:", ";"], Spacing.S5, ({
|
|
24
|
+
$isLoading
|
|
25
|
+
}) => $isLoading ? '0.5' : '1', Spacing.S3);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from '../Popover';
|
|
3
|
+
export interface EditableFieldProps {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly title?: string;
|
|
6
|
+
readonly open?: boolean;
|
|
7
|
+
readonly loading?: boolean;
|
|
8
|
+
readonly position?: Placement;
|
|
9
|
+
readonly zIndex?: number;
|
|
10
|
+
readonly width?: number;
|
|
11
|
+
readonly onToggleOpen: () => void;
|
|
12
|
+
readonly onSubmit: () => void;
|
|
13
|
+
readonly onCancel: () => void;
|
|
14
|
+
readonly children: ReactNode | undefined;
|
|
15
|
+
}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
type PreviewIframeProps
|
|
3
|
-
|
|
4
|
-
width?: string;
|
|
5
|
-
height?: string;
|
|
6
|
-
template: string;
|
|
7
|
-
localization: Record<string, string>;
|
|
8
|
-
values: Record<string, any>;
|
|
9
|
-
};
|
|
10
|
-
export declare const EmailTemplatePreview: FC<PreviewIframeProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { PreviewIframeProps } from './types';
|
|
3
|
+
export declare function EmailTemplatePreview(props: PreviewIframeProps): ReactElement;
|