@synerise/ds-confirmation 1.2.11 → 1.2.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/CHANGELOG.md +4 -0
- package/dist/Confirmation.const.d.ts +1 -1
- package/dist/Confirmation.const.js +18 -12
- package/dist/Confirmation.d.ts +3 -3
- package/dist/Confirmation.js +71 -92
- package/dist/Confirmation.styles.d.ts +11 -11
- package/dist/Confirmation.styles.js +31 -18
- package/dist/Confirmation.types.d.ts +6 -6
- package/dist/Confirmation.types.js +1 -1
- package/dist/Confirmation.utils.d.ts +2 -2
- package/dist/Confirmation.utils.js +7 -4
- package/dist/components/BatchItemsList.d.ts +3 -3
- package/dist/components/BatchItemsList.js +14 -20
- package/dist/components/DecisionSection.d.ts +2 -2
- package/dist/components/DecisionSection.js +12 -16
- package/dist/components/Prompt.d.ts +2 -2
- package/dist/components/Prompt.js +31 -38
- package/dist/hooks/useDefaultTexts.d.ts +1 -1
- package/dist/hooks/useDefaultTexts.js +16 -31
- package/dist/index.js +6 -2
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-confirmation@1.2.11...@synerise/ds-confirmation@1.2.12) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-confirmation
|
|
9
|
+
|
|
6
10
|
## [1.2.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-confirmation@1.2.10...@synerise/ds-confirmation@1.2.11) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ConfirmationType } from './Confirmation.types';
|
|
2
2
|
export declare const BUTTON_COLOR_MAPPING: Record<ConfirmationType, string>;
|
|
3
3
|
export declare const ICON_COLOR_MAPPING: Record<ConfirmationType, string>;
|
|
4
4
|
export declare const ITEM_SIZE = 32;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
negative:
|
|
3
|
-
success:
|
|
4
|
-
warning:
|
|
5
|
-
informative:
|
|
1
|
+
const BUTTON_COLOR_MAPPING = {
|
|
2
|
+
negative: "red",
|
|
3
|
+
success: "green",
|
|
4
|
+
warning: "yellow",
|
|
5
|
+
informative: "blue"
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
negative:
|
|
9
|
-
success:
|
|
10
|
-
warning:
|
|
11
|
-
informative:
|
|
7
|
+
const ICON_COLOR_MAPPING = {
|
|
8
|
+
negative: "red-600",
|
|
9
|
+
success: "green-600",
|
|
10
|
+
warning: "yellow-600",
|
|
11
|
+
informative: "grey-600"
|
|
12
|
+
};
|
|
13
|
+
const ITEM_SIZE = 32;
|
|
14
|
+
const MAX_ITEMS = 6;
|
|
15
|
+
export {
|
|
16
|
+
BUTTON_COLOR_MAPPING,
|
|
17
|
+
ICON_COLOR_MAPPING,
|
|
18
|
+
ITEM_SIZE,
|
|
19
|
+
MAX_ITEMS
|
|
12
20
|
};
|
|
13
|
-
export var ITEM_SIZE = 32;
|
|
14
|
-
export var MAX_ITEMS = 6;
|
package/dist/Confirmation.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
3
|
+
import { ConfirmationProps } from './Confirmation.types';
|
|
4
4
|
declare const Confirmation: <ItemType extends ListItemProps>({ type, texts, title, description, onCancel, onOk, icon, batchActionItems, decisionOptions, relatedObjects, additionalInfo, secondaryButtonProps, mainButtonProps, customFooterComponent, ...modalProps }: ConfirmationProps<ItemType>) => React.JSX.Element;
|
|
5
5
|
export default Confirmation;
|
package/dist/Confirmation.js
CHANGED
|
@@ -1,97 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
size: "small"
|
|
50
|
-
}, description)), additionalInfo && /*#__PURE__*/React.createElement(Panel, {
|
|
51
|
-
p: "8px 18px"
|
|
52
|
-
}, additionalInfo), (batchActionItems == null ? void 0 : batchActionItems.length) && /*#__PURE__*/React.createElement(BatchItemsList, {
|
|
53
|
-
items: batchActionItems,
|
|
54
|
-
title: allTexts.batchActionItemsTitle
|
|
55
|
-
}), (decisionOptions == null ? void 0 : decisionOptions.length) && /*#__PURE__*/React.createElement(DecisionSection, {
|
|
56
|
-
options: decisionOptions,
|
|
57
|
-
title: allTexts.decisionTitle
|
|
58
|
-
}));
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import { useTheme } from "@synerise/ds-core";
|
|
5
|
+
import Icon, { ShowM, ArrowLeftM } from "@synerise/ds-icon";
|
|
6
|
+
import Modal from "@synerise/ds-modal";
|
|
7
|
+
import Panel from "@synerise/ds-panel";
|
|
8
|
+
import { Paragraph } from "@synerise/ds-typography";
|
|
9
|
+
import { BUTTON_COLOR_MAPPING } from "./Confirmation.const.js";
|
|
10
|
+
import { ConfirmationModalContent, ConfirmationModalContentMain, Title, Footer, FooterLeft, FooterRight, ModalBackTitle } from "./Confirmation.styles.js";
|
|
11
|
+
import { getIconColor } from "./Confirmation.utils.js";
|
|
12
|
+
import { BatchItemsList } from "./components/BatchItemsList.js";
|
|
13
|
+
import { DecisionSection } from "./components/DecisionSection.js";
|
|
14
|
+
import { useDefaultTexts } from "./hooks/useDefaultTexts.js";
|
|
15
|
+
const Confirmation = ({
|
|
16
|
+
type,
|
|
17
|
+
texts,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
onCancel,
|
|
21
|
+
onOk,
|
|
22
|
+
icon,
|
|
23
|
+
batchActionItems,
|
|
24
|
+
decisionOptions,
|
|
25
|
+
relatedObjects,
|
|
26
|
+
additionalInfo,
|
|
27
|
+
secondaryButtonProps,
|
|
28
|
+
mainButtonProps,
|
|
29
|
+
customFooterComponent,
|
|
30
|
+
...modalProps
|
|
31
|
+
}) => {
|
|
32
|
+
const [mode, setMode] = useState("default");
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
const allTexts = useDefaultTexts(texts);
|
|
35
|
+
const buttonColor = BUTTON_COLOR_MAPPING[type];
|
|
36
|
+
const iconColor = getIconColor(type, theme);
|
|
37
|
+
const modalContent = useMemo(() => {
|
|
38
|
+
if (mode === "default") {
|
|
39
|
+
return /* @__PURE__ */ jsxs(ConfirmationModalContent, { children: [
|
|
40
|
+
/* @__PURE__ */ jsxs(ConfirmationModalContentMain, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Icon, { component: icon, size: 96, color: iconColor }),
|
|
42
|
+
/* @__PURE__ */ jsx(Title, { level: 3, children: title }),
|
|
43
|
+
/* @__PURE__ */ jsx(Paragraph, { size: "small", children: description })
|
|
44
|
+
] }),
|
|
45
|
+
additionalInfo && /* @__PURE__ */ jsx(Panel, { p: "8px 18px", children: additionalInfo }),
|
|
46
|
+
batchActionItems?.length && /* @__PURE__ */ jsx(BatchItemsList, { items: batchActionItems, title: allTexts.batchActionItemsTitle }),
|
|
47
|
+
decisionOptions?.length && /* @__PURE__ */ jsx(DecisionSection, { options: decisionOptions, title: allTexts.decisionTitle })
|
|
48
|
+
] });
|
|
59
49
|
}
|
|
60
50
|
return relatedObjects;
|
|
61
51
|
}, [relatedObjects, mode, icon, iconColor, additionalInfo, title, description, batchActionItems, decisionOptions, allTexts.batchActionItemsTitle, allTexts.decisionTitle]);
|
|
62
|
-
|
|
63
|
-
return mode ===
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
type: "custom-color",
|
|
76
|
-
onClick: onOk,
|
|
77
|
-
color: buttonColor
|
|
78
|
-
}, mainButtonProps), allTexts.mainButtonLabel))) : null;
|
|
52
|
+
const modalFooter = useMemo(() => {
|
|
53
|
+
return mode === "default" && (relatedObjects || onOk || onCancel) ? /* @__PURE__ */ jsxs(Footer, { children: [
|
|
54
|
+
relatedObjects && /* @__PURE__ */ jsx(FooterLeft, { children: /* @__PURE__ */ jsxs(Button, { onClick: () => setMode("related-objects"), type: "ghost", mode: "icon-label", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ShowM, {}) }),
|
|
56
|
+
" ",
|
|
57
|
+
allTexts.relatedObjectsButtonLabel
|
|
58
|
+
] }) }),
|
|
59
|
+
customFooterComponent && /* @__PURE__ */ jsx(FooterLeft, { children: customFooterComponent }),
|
|
60
|
+
(onOk || onCancel) && /* @__PURE__ */ jsxs(FooterRight, { children: [
|
|
61
|
+
onCancel && /* @__PURE__ */ jsx(Button, { type: "secondary", onClick: onCancel, ...secondaryButtonProps, children: allTexts.secondaryButtonLabel }),
|
|
62
|
+
onOk && /* @__PURE__ */ jsx(Button, { type: "custom-color", onClick: onOk, color: buttonColor, ...mainButtonProps, children: allTexts.mainButtonLabel })
|
|
63
|
+
] })
|
|
64
|
+
] }) : null;
|
|
79
65
|
}, [mode, onOk, onCancel, buttonColor, mainButtonProps, relatedObjects, secondaryButtonProps, allTexts.secondaryButtonLabel, allTexts.mainButtonLabel, allTexts.relatedObjectsButtonLabel]);
|
|
80
|
-
|
|
81
|
-
onClick:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
footer: modalFooter,
|
|
91
|
-
bodyStyle: {
|
|
92
|
-
padding: 0
|
|
93
|
-
},
|
|
94
|
-
title: modalTitle
|
|
95
|
-
}), modalContent);
|
|
66
|
+
const modalTitle = mode === "related-objects" ? /* @__PURE__ */ jsxs(ModalBackTitle, { children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Icon, { onClick: () => setMode("default"), component: /* @__PURE__ */ jsx(ArrowLeftM, {}) }),
|
|
68
|
+
allTexts.relatedObjectsTitle
|
|
69
|
+
] }) : void 0;
|
|
70
|
+
return /* @__PURE__ */ jsx(Modal, { ...modalProps, onCancel, size: "small", blank: mode === "default", footer: modalFooter, bodyStyle: {
|
|
71
|
+
padding: 0
|
|
72
|
+
}, title: modalTitle, children: modalContent });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
Confirmation as default
|
|
96
76
|
};
|
|
97
|
-
export default Confirmation;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare const ConfirmationModalContent: import(
|
|
2
|
-
export declare const PromptContent: import(
|
|
3
|
-
export declare const ConfirmationModalContentMain: import(
|
|
4
|
-
export declare const Title: import(
|
|
5
|
-
export declare const FooterRight: import(
|
|
6
|
-
export declare const FooterLeft: import(
|
|
7
|
-
export declare const Footer: import(
|
|
8
|
-
export declare const ConfirmationExtra: import(
|
|
9
|
-
export declare const BatchItemsList: import(
|
|
10
|
-
export declare const DecisionOptions: import(
|
|
11
|
-
export declare const ModalBackTitle: import(
|
|
1
|
+
export declare const ConfirmationModalContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const PromptContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const ConfirmationModalContentMain: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const Title: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
|
5
|
+
export declare const FooterRight: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const FooterLeft: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const Footer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const ConfirmationExtra: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const BatchItemsList: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<(import('@synerise/ds-scrollbar').ScrollbarProps | import('@synerise/ds-scrollbar').VirtualScrollbarProps) & import('react').RefAttributes<HTMLElement>>, any, {}, never>;
|
|
10
|
+
export declare const DecisionOptions: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<Omit<import('@synerise/ds-panel').PanelProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
11
|
+
export declare const ModalBackTitle: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import Panel from
|
|
3
|
-
import {
|
|
4
|
-
import Scrollbar from
|
|
5
|
-
import { Title as
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import Panel from "@synerise/ds-panel";
|
|
3
|
+
import { RadioWrapper, AdditionalData } from "@synerise/ds-radio/dist/Radio.styles";
|
|
4
|
+
import Scrollbar from "@synerise/ds-scrollbar";
|
|
5
|
+
import { Title as Title$1 } from "@synerise/ds-typography";
|
|
6
|
+
const modalContentCSS = /* @__PURE__ */ css(["padding:36px 48px 48px;"]);
|
|
7
|
+
const ConfirmationModalContent = /* @__PURE__ */ styled.div.withConfig({
|
|
8
8
|
displayName: "Confirmationstyles__ConfirmationModalContent",
|
|
9
9
|
componentId: "sc-17izghl-0"
|
|
10
10
|
})(["display:flex;flex-direction:column;align-items:stretch;", " gap:24px;"], modalContentCSS);
|
|
11
|
-
|
|
11
|
+
const PromptContent = /* @__PURE__ */ styled.div.withConfig({
|
|
12
12
|
displayName: "Confirmationstyles__PromptContent",
|
|
13
13
|
componentId: "sc-17izghl-1"
|
|
14
14
|
})(["", ""], modalContentCSS);
|
|
15
|
-
|
|
15
|
+
const ConfirmationModalContentMain = /* @__PURE__ */ styled.div.withConfig({
|
|
16
16
|
displayName: "Confirmationstyles__ConfirmationModalContentMain",
|
|
17
17
|
componentId: "sc-17izghl-2"
|
|
18
18
|
})(["display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px;"]);
|
|
19
|
-
|
|
19
|
+
const Title = /* @__PURE__ */ styled(Title$1).withConfig({
|
|
20
20
|
displayName: "Confirmationstyles__Title",
|
|
21
21
|
componentId: "sc-17izghl-3"
|
|
22
22
|
})(["margin:0;"]);
|
|
23
|
-
|
|
23
|
+
const FooterRight = /* @__PURE__ */ styled.div.withConfig({
|
|
24
24
|
displayName: "Confirmationstyles__FooterRight",
|
|
25
25
|
componentId: "sc-17izghl-4"
|
|
26
26
|
})(["flex:1 1 auto;"]);
|
|
27
|
-
|
|
27
|
+
const FooterLeft = /* @__PURE__ */ styled.div.withConfig({
|
|
28
28
|
displayName: "Confirmationstyles__FooterLeft",
|
|
29
29
|
componentId: "sc-17izghl-5"
|
|
30
30
|
})(["flex:1 1 auto;text-align:left;"]);
|
|
31
|
-
|
|
31
|
+
const Footer = /* @__PURE__ */ styled.div.withConfig({
|
|
32
32
|
displayName: "Confirmationstyles__Footer",
|
|
33
33
|
componentId: "sc-17izghl-6"
|
|
34
34
|
})(["display:flex;justify-content:space-between;"]);
|
|
35
|
-
|
|
35
|
+
const ConfirmationExtra = /* @__PURE__ */ styled.div.withConfig({
|
|
36
36
|
displayName: "Confirmationstyles__ConfirmationExtra",
|
|
37
37
|
componentId: "sc-17izghl-7"
|
|
38
38
|
})([""]);
|
|
39
|
-
|
|
39
|
+
const BatchItemsList = /* @__PURE__ */ styled(Scrollbar).withConfig({
|
|
40
40
|
displayName: "Confirmationstyles__BatchItemsList",
|
|
41
41
|
componentId: "sc-17izghl-8"
|
|
42
42
|
})([""]);
|
|
43
|
-
|
|
43
|
+
const DecisionOptions = /* @__PURE__ */ styled(Panel).withConfig({
|
|
44
44
|
displayName: "Confirmationstyles__DecisionOptions",
|
|
45
45
|
componentId: "sc-17izghl-9"
|
|
46
46
|
})(["", "{padding:7px 0;margin-bottom:0;}", ":empty{display:none;}"], RadioWrapper, AdditionalData);
|
|
47
|
-
|
|
47
|
+
const ModalBackTitle = /* @__PURE__ */ styled.div.withConfig({
|
|
48
48
|
displayName: "Confirmationstyles__ModalBackTitle",
|
|
49
49
|
componentId: "sc-17izghl-10"
|
|
50
|
-
})(["display:flex;gap:12px;align-items:center;"]);
|
|
50
|
+
})(["display:flex;gap:12px;align-items:center;"]);
|
|
51
|
+
export {
|
|
52
|
+
BatchItemsList,
|
|
53
|
+
ConfirmationExtra,
|
|
54
|
+
ConfirmationModalContent,
|
|
55
|
+
ConfirmationModalContentMain,
|
|
56
|
+
DecisionOptions,
|
|
57
|
+
Footer,
|
|
58
|
+
FooterLeft,
|
|
59
|
+
FooterRight,
|
|
60
|
+
ModalBackTitle,
|
|
61
|
+
PromptContent,
|
|
62
|
+
Title
|
|
63
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@synerise/ds-button';
|
|
3
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
4
|
+
import { ModalProps } from '@synerise/ds-modal';
|
|
5
|
+
import { RadioProps } from '@synerise/ds-radio';
|
|
6
|
+
import { DataAttributes } from '@synerise/ds-utils';
|
|
7
7
|
export type ConfirmationType = 'success' | 'warning' | 'negative' | 'informative';
|
|
8
8
|
export type ConfirmationButtonProps = Pick<ButtonProps, 'mode' | 'loading' | 'readOnly' | 'disabled' | 'tagProps'> & DataAttributes;
|
|
9
9
|
export type ConfirmationTexts = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ThemePropsVars } from '@synerise/ds-core';
|
|
2
|
+
import { ConfirmationType } from './Confirmation.types';
|
|
3
3
|
export declare const getIconColor: (type: ConfirmationType, theme: ThemePropsVars) => string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { ICON_COLOR_MAPPING } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ICON_COLOR_MAPPING } from "./Confirmation.const.js";
|
|
2
|
+
const getIconColor = (type, theme) => {
|
|
3
|
+
const colorToken = ICON_COLOR_MAPPING[type];
|
|
4
4
|
return theme.palette[colorToken];
|
|
5
|
-
};
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
getIconColor
|
|
8
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
3
|
+
import { BatchItemsListProps } from '../Confirmation.types';
|
|
4
4
|
export declare const BatchItemsList: <ItemType extends ListItemProps>({ items, title, }: BatchItemsListProps<ItemType>) => React.JSX.Element;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, items.map(function (item) {
|
|
16
|
-
return /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
17
|
-
key: item.id
|
|
18
|
-
}, item));
|
|
19
|
-
})))));
|
|
20
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import ListItem, { ListContextProvider } from "@synerise/ds-list-item";
|
|
3
|
+
import Panel from "@synerise/ds-panel";
|
|
4
|
+
import { ITEM_SIZE, MAX_ITEMS } from "../Confirmation.const.js";
|
|
5
|
+
import { ConfirmationExtra, BatchItemsList as BatchItemsList$1 } from "../Confirmation.styles.js";
|
|
6
|
+
const BatchItemsList = ({
|
|
7
|
+
items,
|
|
8
|
+
title
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(ConfirmationExtra, { children: /* @__PURE__ */ jsx(Panel, { label: title, children: /* @__PURE__ */ jsx(ListContextProvider, { children: /* @__PURE__ */ jsx(BatchItemsList$1, { maxHeight: ITEM_SIZE * MAX_ITEMS, absolute: true, children: items.map((item) => /* @__PURE__ */ jsx(ListItem, { ...item }, item.id)) }) }) }) });
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
BatchItemsList
|
|
14
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DecisionSectionProps } from '../Confirmation.types';
|
|
3
3
|
export declare const DecisionSection: ({ options, title }: DecisionSectionProps) => React.JSX.Element;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
key: option.id
|
|
14
|
-
}, option));
|
|
15
|
-
}))));
|
|
16
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Radio from "@synerise/ds-radio";
|
|
3
|
+
import { ConfirmationExtra, DecisionOptions } from "../Confirmation.styles.js";
|
|
4
|
+
const DecisionSection = ({
|
|
5
|
+
options,
|
|
6
|
+
title
|
|
7
|
+
}) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(ConfirmationExtra, { children: /* @__PURE__ */ jsx(DecisionOptions, { p: "8px 18px", label: title, children: /* @__PURE__ */ jsx(Radio.Group, { children: options.map((option) => /* @__PURE__ */ jsx(Radio, { ...option }, option.id)) }) }) });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
DecisionSection
|
|
12
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PromptProps } from '../Confirmation.types';
|
|
3
3
|
export declare const Prompt: ({ type, texts, onCancel, onOk, mainButtonProps, secondaryButtonProps, content, ...modalProps }: PromptProps) => React.JSX.Element;
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type: "
|
|
24
|
-
|
|
25
|
-
}, secondaryButtonProps), allTexts.secondaryButtonLabel), /*#__PURE__*/React.createElement(Button, _extends({
|
|
26
|
-
type: "custom-color",
|
|
27
|
-
onClick: onOk,
|
|
28
|
-
color: buttonColor
|
|
29
|
-
}, mainButtonProps), allTexts.mainButtonLabel)));
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import Button from "@synerise/ds-button";
|
|
4
|
+
import Modal from "@synerise/ds-modal";
|
|
5
|
+
import { BUTTON_COLOR_MAPPING } from "../Confirmation.const.js";
|
|
6
|
+
import { Footer, FooterRight, PromptContent } from "../Confirmation.styles.js";
|
|
7
|
+
import { useDefaultTexts } from "../hooks/useDefaultTexts.js";
|
|
8
|
+
const Prompt = ({
|
|
9
|
+
type,
|
|
10
|
+
texts,
|
|
11
|
+
onCancel,
|
|
12
|
+
onOk,
|
|
13
|
+
mainButtonProps,
|
|
14
|
+
secondaryButtonProps,
|
|
15
|
+
content,
|
|
16
|
+
...modalProps
|
|
17
|
+
}) => {
|
|
18
|
+
const allTexts = useDefaultTexts(texts);
|
|
19
|
+
const buttonColor = BUTTON_COLOR_MAPPING[type];
|
|
20
|
+
const modalFooter = useMemo(() => {
|
|
21
|
+
return /* @__PURE__ */ jsx(Footer, { children: /* @__PURE__ */ jsxs(FooterRight, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Button, { type: "secondary", onClick: onCancel, ...secondaryButtonProps, children: allTexts.secondaryButtonLabel }),
|
|
23
|
+
/* @__PURE__ */ jsx(Button, { type: "custom-color", onClick: onOk, color: buttonColor, ...mainButtonProps, children: allTexts.mainButtonLabel })
|
|
24
|
+
] }) });
|
|
30
25
|
}, [buttonColor, onCancel, onOk, mainButtonProps, allTexts.mainButtonLabel, allTexts.secondaryButtonLabel, secondaryButtonProps]);
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), /*#__PURE__*/React.createElement(S.PromptContent, null, content));
|
|
39
|
-
};
|
|
26
|
+
return /* @__PURE__ */ jsx(Modal, { ...modalProps, onCancel, size: "small", footer: modalFooter, bodyStyle: {
|
|
27
|
+
padding: 0
|
|
28
|
+
}, children: /* @__PURE__ */ jsx(PromptContent, { children: content }) });
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
Prompt
|
|
32
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfirmationTexts } from '../Confirmation.types';
|
|
2
2
|
export declare const useDefaultTexts: (defaultTexts?: Partial<ConfirmationTexts>) => ConfirmationTexts;
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
batchActionItemsTitle: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
19
|
-
id: "DS.CONFIRMATION.BATCH-ACTIONS-ITEMS-TITLE",
|
|
20
|
-
defaultMessage: "Objects to delete"
|
|
21
|
-
}),
|
|
22
|
-
decisionTitle: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
23
|
-
id: "DS.CONFIRMATION.DECISION-TITLE",
|
|
24
|
-
defaultMessage: "What do you want to do?"
|
|
25
|
-
}),
|
|
26
|
-
relatedObjectsTitle: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
27
|
-
id: "DS.CONFIRMATION.RELATED-OBJECTS-TITLE",
|
|
28
|
-
defaultMessage: "Related objects"
|
|
29
|
-
})
|
|
30
|
-
}, defaultTexts || {});
|
|
31
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
3
|
+
const useDefaultTexts = (defaultTexts) => {
|
|
4
|
+
return {
|
|
5
|
+
mainButtonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.MAIN-BUTTON-LABEL", defaultMessage: "Ok" }),
|
|
6
|
+
secondaryButtonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.SECONDARY-BUTTON-LABEL", defaultMessage: "Cancel" }),
|
|
7
|
+
relatedObjectsButtonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.RELATED-OBJECT-BUTTON-LABEL", defaultMessage: "Show related objects" }),
|
|
8
|
+
batchActionItemsTitle: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.BATCH-ACTIONS-ITEMS-TITLE", defaultMessage: "Objects to delete" }),
|
|
9
|
+
decisionTitle: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.DECISION-TITLE", defaultMessage: "What do you want to do?" }),
|
|
10
|
+
relatedObjectsTitle: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.CONFIRMATION.RELATED-OBJECTS-TITLE", defaultMessage: "Related objects" }),
|
|
11
|
+
...defaultTexts || {}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
useDefaultTexts
|
|
16
|
+
};
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-confirmation",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "Confirmation UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-button": "^1.5.
|
|
39
|
-
"@synerise/ds-icon": "^1.15.
|
|
40
|
-
"@synerise/ds-list-item": "^1.4.
|
|
41
|
-
"@synerise/ds-modal": "^1.4.
|
|
42
|
-
"@synerise/ds-panel": "^1.2.
|
|
43
|
-
"@synerise/ds-radio": "^1.1.
|
|
44
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
45
|
-
"@synerise/ds-typography": "^1.1.
|
|
46
|
-
"@synerise/ds-utils": "^1.7.
|
|
38
|
+
"@synerise/ds-button": "^1.5.18",
|
|
39
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
40
|
+
"@synerise/ds-list-item": "^1.4.10",
|
|
41
|
+
"@synerise/ds-modal": "^1.4.1",
|
|
42
|
+
"@synerise/ds-panel": "^1.2.3",
|
|
43
|
+
"@synerise/ds-radio": "^1.1.3",
|
|
44
|
+
"@synerise/ds-scrollbar": "^1.2.17",
|
|
45
|
+
"@synerise/ds-typography": "^1.1.13",
|
|
46
|
+
"@synerise/ds-utils": "^1.7.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@synerise/ds-core": "*",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"react-intl": "^6.8.7",
|
|
52
52
|
"styled-components": "^5.3.3"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
55
55
|
}
|