@synerise/ds-confirmation 1.2.10 → 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 +10 -0
- package/README.md +6 -5
- 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 -89
- package/dist/Confirmation.styles.d.ts +11 -13
- package/dist/Confirmation.styles.js +35 -31
- 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 -15
- 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,16 @@
|
|
|
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
|
+
|
|
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)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- panel regressions ([c88aad5](https://github.com/Synerise/synerise-design/commit/c88aad5c4584a172c41c50dd8d64e5f86784de65))
|
|
15
|
+
|
|
6
16
|
## [1.2.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-confirmation@1.2.9...@synerise/ds-confirmation@1.2.10) (2026-03-09)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @synerise/ds-confirmation
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import Confirmation from '@synerise/ds-confirmation'
|
|
|
33
33
|
| icon | icon to display above title | Preferably Xl size icon from ds-icons ReactNode | - |
|
|
34
34
|
| title | confirmation title | ReactNode | - |
|
|
35
35
|
| description | confirmation details | ReactNode | - |
|
|
36
|
-
| texts | custom translations |
|
|
36
|
+
| texts | custom translations | `Partial<ConfirmationTexts>` | - |
|
|
37
37
|
| type | action type - this defines the button (and icon if negative) color | `success` / `warning` / `negative` / `informative` | - |
|
|
38
38
|
| mainButtonProps | additional button customisation props | subset of ButtonProps see ds-button | - |
|
|
39
39
|
| secondaryButtonProps | additional button customisation props | subset of ButtonProps see ds-button | - |
|
|
@@ -41,6 +41,7 @@ import Confirmation from '@synerise/ds-confirmation'
|
|
|
41
41
|
| batchActionItems | renders a list of items that are affected | ListItemProps[] | - |
|
|
42
42
|
| decisionOptions | renders a group of radio buttons to choose from | RadioProps[] | - |
|
|
43
43
|
| additionalInfo | extra description to render within a bordered frame | ReactNode | - |
|
|
44
|
+
| customFooterComponent| additional custom footer component like custom actions | ReactNode | - |
|
|
44
45
|
|
|
45
46
|
### Prompt
|
|
46
47
|
|
|
@@ -48,7 +49,7 @@ import Confirmation from '@synerise/ds-confirmation'
|
|
|
48
49
|
| -------------------- | ------------------------------------------- | -------------------------------------------------- | ------- |
|
|
49
50
|
| title | prompt title | ReactNode | - |
|
|
50
51
|
| content | prompt content | ReactNode | - |
|
|
51
|
-
| texts | custom translations |
|
|
52
|
+
| texts | custom translations | `Partial<ConfirmationTexts>` | - |
|
|
52
53
|
| type | action type - this defines the button color | `success` / `warning` / `negative` / `informative` | - |
|
|
53
54
|
| mainButtonProps | additional button customisation props | subset of ButtonProps see ds-button | - |
|
|
54
55
|
| secondaryButtonProps | additional button customisation props | subset of ButtonProps see ds-button | - |
|
|
@@ -60,6 +61,6 @@ import Confirmation from '@synerise/ds-confirmation'
|
|
|
60
61
|
| mainButtonLabel | | ReactNode | `Ok` |
|
|
61
62
|
| secondaryButtonLabel | | ReactNode | `Cancel` |
|
|
62
63
|
| relatedObjectsButtonLabel | | ReactNode | `Show related objects` |
|
|
63
|
-
| relatedObjectsTitle | | ReactNode | `
|
|
64
|
-
| batchActionItemsTitle | | ReactNode | `
|
|
65
|
-
| decisionTitle | | ReactNode | `
|
|
64
|
+
| relatedObjectsTitle | | ReactNode | `Related objects` |
|
|
65
|
+
| batchActionItemsTitle | | ReactNode | `Objects to delete` |
|
|
66
|
+
| decisionTitle | | ReactNode | `What do you want to do?` |
|
|
@@ -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,94 +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
|
-
}, description)), additionalInfo && /*#__PURE__*/React.createElement(S.AdditionalInfo, null, additionalInfo), (batchActionItems == null ? void 0 : batchActionItems.length) && /*#__PURE__*/React.createElement(BatchItemsList, {
|
|
50
|
-
items: batchActionItems,
|
|
51
|
-
title: allTexts.batchActionItemsTitle
|
|
52
|
-
}), (decisionOptions == null ? void 0 : decisionOptions.length) && /*#__PURE__*/React.createElement(DecisionSection, {
|
|
53
|
-
options: decisionOptions,
|
|
54
|
-
title: allTexts.decisionTitle
|
|
55
|
-
}));
|
|
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
|
+
] });
|
|
56
49
|
}
|
|
57
50
|
return relatedObjects;
|
|
58
51
|
}, [relatedObjects, mode, icon, iconColor, additionalInfo, title, description, batchActionItems, decisionOptions, allTexts.batchActionItemsTitle, allTexts.decisionTitle]);
|
|
59
|
-
|
|
60
|
-
return mode ===
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
type: "custom-color",
|
|
73
|
-
onClick: onOk,
|
|
74
|
-
color: buttonColor
|
|
75
|
-
}, 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;
|
|
76
65
|
}, [mode, onOk, onCancel, buttonColor, mainButtonProps, relatedObjects, secondaryButtonProps, allTexts.secondaryButtonLabel, allTexts.mainButtonLabel, allTexts.relatedObjectsButtonLabel]);
|
|
77
|
-
|
|
78
|
-
onClick:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
footer: modalFooter,
|
|
88
|
-
bodyStyle: {
|
|
89
|
-
padding: 0
|
|
90
|
-
},
|
|
91
|
-
title: modalTitle
|
|
92
|
-
}), 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
|
|
93
76
|
};
|
|
94
|
-
export default Confirmation;
|
|
@@ -1,13 +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
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const DecisionOptions: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("@synerise/ds-panel").PanelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
13
|
-
export declare const ModalBackTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
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,59 +1,63 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
import Panel from
|
|
3
|
-
import {
|
|
4
|
-
import Scrollbar from
|
|
5
|
-
import { Title as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export var ConfirmationModalContent = styled.div.withConfig({
|
|
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({
|
|
9
8
|
displayName: "Confirmationstyles__ConfirmationModalContent",
|
|
10
9
|
componentId: "sc-17izghl-0"
|
|
11
10
|
})(["display:flex;flex-direction:column;align-items:stretch;", " gap:24px;"], modalContentCSS);
|
|
12
|
-
|
|
11
|
+
const PromptContent = /* @__PURE__ */ styled.div.withConfig({
|
|
13
12
|
displayName: "Confirmationstyles__PromptContent",
|
|
14
13
|
componentId: "sc-17izghl-1"
|
|
15
14
|
})(["", ""], modalContentCSS);
|
|
16
|
-
|
|
15
|
+
const ConfirmationModalContentMain = /* @__PURE__ */ styled.div.withConfig({
|
|
17
16
|
displayName: "Confirmationstyles__ConfirmationModalContentMain",
|
|
18
17
|
componentId: "sc-17izghl-2"
|
|
19
18
|
})(["display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px;"]);
|
|
20
|
-
|
|
19
|
+
const Title = /* @__PURE__ */ styled(Title$1).withConfig({
|
|
21
20
|
displayName: "Confirmationstyles__Title",
|
|
22
21
|
componentId: "sc-17izghl-3"
|
|
23
22
|
})(["margin:0;"]);
|
|
24
|
-
|
|
23
|
+
const FooterRight = /* @__PURE__ */ styled.div.withConfig({
|
|
25
24
|
displayName: "Confirmationstyles__FooterRight",
|
|
26
25
|
componentId: "sc-17izghl-4"
|
|
27
26
|
})(["flex:1 1 auto;"]);
|
|
28
|
-
|
|
27
|
+
const FooterLeft = /* @__PURE__ */ styled.div.withConfig({
|
|
29
28
|
displayName: "Confirmationstyles__FooterLeft",
|
|
30
29
|
componentId: "sc-17izghl-5"
|
|
31
30
|
})(["flex:1 1 auto;text-align:left;"]);
|
|
32
|
-
|
|
31
|
+
const Footer = /* @__PURE__ */ styled.div.withConfig({
|
|
33
32
|
displayName: "Confirmationstyles__Footer",
|
|
34
33
|
componentId: "sc-17izghl-6"
|
|
35
34
|
})(["display:flex;justify-content:space-between;"]);
|
|
36
|
-
|
|
35
|
+
const ConfirmationExtra = /* @__PURE__ */ styled.div.withConfig({
|
|
37
36
|
displayName: "Confirmationstyles__ConfirmationExtra",
|
|
38
37
|
componentId: "sc-17izghl-7"
|
|
39
38
|
})([""]);
|
|
40
|
-
|
|
41
|
-
displayName: "Confirmationstyles__ConfirmationExtraTitle",
|
|
42
|
-
componentId: "sc-17izghl-8"
|
|
43
|
-
})(["", ""], sectionTitleCSS);
|
|
44
|
-
export var BatchItemsList = styled(Scrollbar).withConfig({
|
|
39
|
+
const BatchItemsList = /* @__PURE__ */ styled(Scrollbar).withConfig({
|
|
45
40
|
displayName: "Confirmationstyles__BatchItemsList",
|
|
46
|
-
componentId: "sc-17izghl-
|
|
41
|
+
componentId: "sc-17izghl-8"
|
|
47
42
|
})([""]);
|
|
48
|
-
|
|
49
|
-
displayName: "Confirmationstyles__AdditionalInfo",
|
|
50
|
-
componentId: "sc-17izghl-10"
|
|
51
|
-
})(["padding:8px 18px;"]);
|
|
52
|
-
export var DecisionOptions = styled(Panel).withConfig({
|
|
43
|
+
const DecisionOptions = /* @__PURE__ */ styled(Panel).withConfig({
|
|
53
44
|
displayName: "Confirmationstyles__DecisionOptions",
|
|
54
|
-
componentId: "sc-17izghl-
|
|
55
|
-
})(["", "{padding:7px 0;margin-bottom:0;}", ":empty{display:none;}
|
|
56
|
-
|
|
45
|
+
componentId: "sc-17izghl-9"
|
|
46
|
+
})(["", "{padding:7px 0;margin-bottom:0;}", ":empty{display:none;}"], RadioWrapper, AdditionalData);
|
|
47
|
+
const ModalBackTitle = /* @__PURE__ */ styled.div.withConfig({
|
|
57
48
|
displayName: "Confirmationstyles__ModalBackTitle",
|
|
58
|
-
componentId: "sc-17izghl-
|
|
59
|
-
})(["display:flex;gap:12px;align-items:center;"]);
|
|
49
|
+
componentId: "sc-17izghl-10"
|
|
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,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, option));
|
|
14
|
-
}))));
|
|
15
|
-
};
|
|
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.
|
|
40
|
-
"@synerise/ds-list-item": "^1.4.
|
|
41
|
-
"@synerise/ds-modal": "^1.
|
|
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.
|
|
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
|
}
|