@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 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 type { ConfirmationType } from './Confirmation.types';
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
- export var BUTTON_COLOR_MAPPING = {
2
- negative: 'red',
3
- success: 'green',
4
- warning: 'yellow',
5
- informative: 'blue'
1
+ const BUTTON_COLOR_MAPPING = {
2
+ negative: "red",
3
+ success: "green",
4
+ warning: "yellow",
5
+ informative: "blue"
6
6
  };
7
- export var ICON_COLOR_MAPPING = {
8
- negative: 'red-600',
9
- success: 'green-600',
10
- warning: 'yellow-600',
11
- informative: 'grey-600'
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;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import type { ListItemProps } from '@synerise/ds-list-item';
3
- import type { ConfirmationProps } from './Confirmation.types';
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;
@@ -1,97 +1,76 @@
1
- var _excluded = ["type", "texts", "title", "description", "onCancel", "onOk", "icon", "batchActionItems", "decisionOptions", "relatedObjects", "additionalInfo", "secondaryButtonProps", "mainButtonProps", "customFooterComponent"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { useMemo, useState } from 'react';
5
- import Button from '@synerise/ds-button';
6
- import { useTheme } from '@synerise/ds-core';
7
- import Icon, { ArrowLeftM, ShowM } from '@synerise/ds-icon';
8
- import Modal from '@synerise/ds-modal';
9
- import Panel from '@synerise/ds-panel';
10
- import { Paragraph } from '@synerise/ds-typography';
11
- import { BUTTON_COLOR_MAPPING } from './Confirmation.const';
12
- import * as S from './Confirmation.styles';
13
- import { getIconColor } from './Confirmation.utils';
14
- import { BatchItemsList } from './components/BatchItemsList';
15
- import { DecisionSection } from './components/DecisionSection';
16
- import { useDefaultTexts } from './hooks/useDefaultTexts';
17
- var Confirmation = function Confirmation(_ref) {
18
- var type = _ref.type,
19
- texts = _ref.texts,
20
- title = _ref.title,
21
- description = _ref.description,
22
- onCancel = _ref.onCancel,
23
- onOk = _ref.onOk,
24
- icon = _ref.icon,
25
- batchActionItems = _ref.batchActionItems,
26
- decisionOptions = _ref.decisionOptions,
27
- relatedObjects = _ref.relatedObjects,
28
- additionalInfo = _ref.additionalInfo,
29
- secondaryButtonProps = _ref.secondaryButtonProps,
30
- mainButtonProps = _ref.mainButtonProps,
31
- customFooterComponent = _ref.customFooterComponent,
32
- modalProps = _objectWithoutPropertiesLoose(_ref, _excluded);
33
- var _useState = useState('default'),
34
- mode = _useState[0],
35
- setMode = _useState[1];
36
- var theme = useTheme();
37
- var allTexts = useDefaultTexts(texts);
38
- var buttonColor = BUTTON_COLOR_MAPPING[type];
39
- var iconColor = getIconColor(type, theme);
40
- var modalContent = useMemo(function () {
41
- if (mode === 'default') {
42
- return /*#__PURE__*/React.createElement(S.ConfirmationModalContent, null, /*#__PURE__*/React.createElement(S.ConfirmationModalContentMain, null, /*#__PURE__*/React.createElement(Icon, {
43
- component: icon,
44
- size: 96,
45
- color: iconColor
46
- }), /*#__PURE__*/React.createElement(S.Title, {
47
- level: 3
48
- }, title), /*#__PURE__*/React.createElement(Paragraph, {
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
- var modalFooter = useMemo(function () {
63
- return mode === 'default' && (relatedObjects || onOk || onCancel) ? /*#__PURE__*/React.createElement(S.Footer, null, relatedObjects && /*#__PURE__*/React.createElement(S.FooterLeft, null, /*#__PURE__*/React.createElement(Button, {
64
- onClick: function onClick() {
65
- return setMode('related-objects');
66
- },
67
- type: "ghost",
68
- mode: "icon-label"
69
- }, /*#__PURE__*/React.createElement(Icon, {
70
- component: /*#__PURE__*/React.createElement(ShowM, null)
71
- }), ' ', allTexts.relatedObjectsButtonLabel)), customFooterComponent && /*#__PURE__*/React.createElement(S.FooterLeft, null, customFooterComponent), (onOk || onCancel) && /*#__PURE__*/React.createElement(S.FooterRight, null, onCancel && /*#__PURE__*/React.createElement(Button, _extends({
72
- type: "secondary",
73
- onClick: onCancel
74
- }, secondaryButtonProps), allTexts.secondaryButtonLabel), onOk && /*#__PURE__*/React.createElement(Button, _extends({
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
- var modalTitle = mode === 'related-objects' ? /*#__PURE__*/React.createElement(S.ModalBackTitle, null, /*#__PURE__*/React.createElement(Icon, {
81
- onClick: function onClick() {
82
- return setMode('default');
83
- },
84
- component: /*#__PURE__*/React.createElement(ArrowLeftM, null)
85
- }), allTexts.relatedObjectsTitle) : undefined;
86
- return /*#__PURE__*/React.createElement(Modal, _extends({}, modalProps, {
87
- onCancel: onCancel,
88
- size: "small",
89
- blank: mode === 'default',
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("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
+ 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 'styled-components';
2
- import Panel from '@synerise/ds-panel';
3
- import { AdditionalData, RadioWrapper } from '@synerise/ds-radio/dist/Radio.styles';
4
- import Scrollbar from '@synerise/ds-scrollbar';
5
- import { Title as TypographyTitle } from '@synerise/ds-typography';
6
- var modalContentCSS = css(["padding:36px 48px 48px;"]);
7
- 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({
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
- export var PromptContent = styled.div.withConfig({
11
+ const PromptContent = /* @__PURE__ */ styled.div.withConfig({
12
12
  displayName: "Confirmationstyles__PromptContent",
13
13
  componentId: "sc-17izghl-1"
14
14
  })(["", ""], modalContentCSS);
15
- export var ConfirmationModalContentMain = styled.div.withConfig({
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
- export var Title = styled(TypographyTitle).withConfig({
19
+ const Title = /* @__PURE__ */ styled(Title$1).withConfig({
20
20
  displayName: "Confirmationstyles__Title",
21
21
  componentId: "sc-17izghl-3"
22
22
  })(["margin:0;"]);
23
- export var FooterRight = styled.div.withConfig({
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
- export var FooterLeft = styled.div.withConfig({
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
- export var Footer = styled.div.withConfig({
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
- export var ConfirmationExtra = styled.div.withConfig({
35
+ const ConfirmationExtra = /* @__PURE__ */ styled.div.withConfig({
36
36
  displayName: "Confirmationstyles__ConfirmationExtra",
37
37
  componentId: "sc-17izghl-7"
38
38
  })([""]);
39
- export var BatchItemsList = styled(Scrollbar).withConfig({
39
+ const BatchItemsList = /* @__PURE__ */ styled(Scrollbar).withConfig({
40
40
  displayName: "Confirmationstyles__BatchItemsList",
41
41
  componentId: "sc-17izghl-8"
42
42
  })([""]);
43
- export var DecisionOptions = styled(Panel).withConfig({
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
- export var ModalBackTitle = styled.div.withConfig({
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 type { ReactNode } from 'react';
2
- import type { ButtonProps } from '@synerise/ds-button';
3
- import type { ListItemProps } from '@synerise/ds-list-item';
4
- import type { ModalProps } from '@synerise/ds-modal';
5
- import type { RadioProps } from '@synerise/ds-radio';
6
- import type { DataAttributes } from '@synerise/ds-utils';
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
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import { type ThemePropsVars } from '@synerise/ds-core';
2
- import { type ConfirmationType } from './Confirmation.types';
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 './Confirmation.const';
2
- export var getIconColor = function getIconColor(type, theme) {
3
- var colorToken = ICON_COLOR_MAPPING[type];
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 { type ListItemProps } from '@synerise/ds-list-item';
3
- import type { BatchItemsListProps } from '../Confirmation.types';
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
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React from 'react';
3
- import ListItem, { ListContextProvider } from '@synerise/ds-list-item';
4
- import Panel from '@synerise/ds-panel';
5
- import { ITEM_SIZE, MAX_ITEMS } from '../Confirmation.const';
6
- import * as S from '../Confirmation.styles';
7
- export var BatchItemsList = function BatchItemsList(_ref) {
8
- var items = _ref.items,
9
- title = _ref.title;
10
- return /*#__PURE__*/React.createElement(S.ConfirmationExtra, null, /*#__PURE__*/React.createElement(Panel, {
11
- label: title
12
- }, /*#__PURE__*/React.createElement(ListContextProvider, null, /*#__PURE__*/React.createElement(S.BatchItemsList, {
13
- maxHeight: ITEM_SIZE * MAX_ITEMS,
14
- absolute: true
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 type { DecisionSectionProps } from '../Confirmation.types';
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
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React from 'react';
3
- import Radio from '@synerise/ds-radio';
4
- import * as S from '../Confirmation.styles';
5
- export var DecisionSection = function DecisionSection(_ref) {
6
- var options = _ref.options,
7
- title = _ref.title;
8
- return /*#__PURE__*/React.createElement(S.ConfirmationExtra, null, /*#__PURE__*/React.createElement(S.DecisionOptions, {
9
- p: "8px 18px",
10
- label: title
11
- }, /*#__PURE__*/React.createElement(Radio.Group, null, options.map(function (option) {
12
- return /*#__PURE__*/React.createElement(Radio, _extends({
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 type { PromptProps } from '../Confirmation.types';
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
- var _excluded = ["type", "texts", "onCancel", "onOk", "mainButtonProps", "secondaryButtonProps", "content"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { useMemo } from 'react';
5
- import Button from '@synerise/ds-button';
6
- import Modal from '@synerise/ds-modal';
7
- import { BUTTON_COLOR_MAPPING } from '../Confirmation.const';
8
- import * as S from '../Confirmation.styles';
9
- import { useDefaultTexts } from '../hooks/useDefaultTexts';
10
- export var Prompt = function Prompt(_ref) {
11
- var type = _ref.type,
12
- texts = _ref.texts,
13
- onCancel = _ref.onCancel,
14
- onOk = _ref.onOk,
15
- mainButtonProps = _ref.mainButtonProps,
16
- secondaryButtonProps = _ref.secondaryButtonProps,
17
- content = _ref.content,
18
- modalProps = _objectWithoutPropertiesLoose(_ref, _excluded);
19
- var allTexts = useDefaultTexts(texts);
20
- var buttonColor = BUTTON_COLOR_MAPPING[type];
21
- var modalFooter = useMemo(function () {
22
- return /*#__PURE__*/React.createElement(S.Footer, null, /*#__PURE__*/React.createElement(S.FooterRight, null, /*#__PURE__*/React.createElement(Button, _extends({
23
- type: "secondary",
24
- onClick: onCancel
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 /*#__PURE__*/React.createElement(Modal, _extends({}, modalProps, {
32
- onCancel: onCancel,
33
- size: "small",
34
- footer: modalFooter,
35
- bodyStyle: {
36
- padding: 0
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 { type ConfirmationTexts } from '../Confirmation.types';
1
+ import { ConfirmationTexts } from '../Confirmation.types';
2
2
  export declare const useDefaultTexts: (defaultTexts?: Partial<ConfirmationTexts>) => ConfirmationTexts;
@@ -1,31 +1,16 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React from 'react';
3
- import { FormattedMessage } from 'react-intl';
4
- export var useDefaultTexts = function useDefaultTexts(defaultTexts) {
5
- return _extends({
6
- mainButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
7
- id: "DS.CONFIRMATION.MAIN-BUTTON-LABEL",
8
- defaultMessage: "Ok"
9
- }),
10
- secondaryButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
11
- id: "DS.CONFIRMATION.SECONDARY-BUTTON-LABEL",
12
- defaultMessage: "Cancel"
13
- }),
14
- relatedObjectsButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
15
- id: "DS.CONFIRMATION.RELATED-OBJECT-BUTTON-LABEL",
16
- defaultMessage: "Show related objects"
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
@@ -1,2 +1,6 @@
1
- export { default } from './Confirmation';
2
- export { Prompt } from './components/Prompt';
1
+ import { default as default2 } from "./Confirmation.js";
2
+ import { Prompt } from "./components/Prompt.js";
3
+ export {
4
+ Prompt,
5
+ default2 as default
6
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
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.11",
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": "pnpm run build:js && pnpm run build:css && pnpm run defs",
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": "pnpm run build:js -- --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.17",
39
- "@synerise/ds-icon": "^1.15.0",
40
- "@synerise/ds-list-item": "^1.4.9",
41
- "@synerise/ds-modal": "^1.4.0",
42
- "@synerise/ds-panel": "^1.2.2",
43
- "@synerise/ds-radio": "^1.1.2",
44
- "@synerise/ds-scrollbar": "^1.2.16",
45
- "@synerise/ds-typography": "^1.1.12",
46
- "@synerise/ds-utils": "^1.7.0"
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": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
54
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
55
55
  }