@trackunit/react-compound-components 1.7.158 → 1.7.163
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/index.cjs.js +2 -72
- package/index.esm.js +5 -74
- package/package.json +7 -10
- package/src/index.d.ts +0 -1
- package/translation.cjs.js +1 -4
- package/translation.cjs10.js +1 -4
- package/translation.cjs11.js +1 -4
- package/translation.cjs12.js +1 -4
- package/translation.cjs13.js +1 -4
- package/translation.cjs14.js +1 -4
- package/translation.cjs15.js +1 -4
- package/translation.cjs16.js +1 -4
- package/translation.cjs17.js +1 -4
- package/translation.cjs2.js +1 -4
- package/translation.cjs3.js +1 -4
- package/translation.cjs4.js +1 -4
- package/translation.cjs5.js +1 -4
- package/translation.cjs6.js +1 -4
- package/translation.cjs7.js +1 -4
- package/translation.cjs8.js +1 -4
- package/translation.cjs9.js +1 -4
- package/translation.esm.js +1 -4
- package/translation.esm10.js +1 -4
- package/translation.esm11.js +1 -4
- package/translation.esm12.js +1 -4
- package/translation.esm13.js +1 -4
- package/translation.esm14.js +1 -4
- package/translation.esm15.js +1 -4
- package/translation.esm16.js +1 -4
- package/translation.esm17.js +1 -4
- package/translation.esm2.js +1 -4
- package/translation.esm3.js +1 -4
- package/translation.esm4.js +1 -4
- package/translation.esm5.js +1 -4
- package/translation.esm6.js +1 -4
- package/translation.esm7.js +1 -4
- package/translation.esm8.js +1 -4
- package/translation.esm9.js +1 -4
- package/src/ConfirmationDialog/ConfirmationDialogContextProvider.d.ts +0 -10
- package/src/ConfirmationDialog/ConfirmationDialogModal.d.ts +0 -12
- package/src/ConfirmationDialog/useConfirmationDialog.demo.d.ts +0 -41
- package/src/ConfirmationDialog/useConfirmationDialog.stories.d.ts +0 -18
package/index.cjs.js
CHANGED
|
@@ -2,19 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
|
-
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
6
|
-
var reactModal = require('@trackunit/react-modal');
|
|
7
|
-
var react = require('react');
|
|
8
5
|
var reactComponents = require('@trackunit/react-components');
|
|
9
6
|
var reactFormComponents = require('@trackunit/react-form-components');
|
|
7
|
+
var react = require('react');
|
|
10
8
|
var tailwindMerge = require('tailwind-merge');
|
|
11
9
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
12
10
|
|
|
13
11
|
var defaultTranslations = {
|
|
14
|
-
|
|
15
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
16
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
17
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
12
|
+
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
/** The translation namespace for this library */
|
|
@@ -48,10 +43,6 @@ const translations = {
|
|
|
48
43
|
th: () => Promise.resolve().then(function () { return require('./translation.cjs17.js'); }),
|
|
49
44
|
},
|
|
50
45
|
};
|
|
51
|
-
/**
|
|
52
|
-
* Local useTranslation for this specific library
|
|
53
|
-
*/
|
|
54
|
-
const useTranslation = () => i18nLibraryTranslation.useNamespaceTranslation(namespace);
|
|
55
46
|
/**
|
|
56
47
|
* Registers the translations for this library
|
|
57
48
|
*/
|
|
@@ -59,66 +50,6 @@ const setupLibraryTranslations = () => {
|
|
|
59
50
|
i18nLibraryTranslation.registerTranslations(translations);
|
|
60
51
|
};
|
|
61
52
|
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
const ConfirmationDialogModal = ({ title, message, handlePrimaryActionClick, handleSecondaryActionClick, secondaryActionLabel, primaryActionType, primaryActionLabel, ...modalProps }) => {
|
|
66
|
-
return (jsxRuntime.jsxs(reactModal.Modal, { ...modalProps, className: "max-w-xl", children: [jsxRuntime.jsx(reactModal.ModalHeader, { heading: title, id: "dialogTitle", onClose: modalProps.close }), jsxRuntime.jsx(reactModal.ModalBody, { id: "dialogDesc", children: message }), jsxRuntime.jsxs(reactModal.ModalFooter, { children: [jsxRuntime.jsx(reactComponents.Button, { "data-testid": "secondaryAction", onClick: handleSecondaryActionClick, variant: "ghost-neutral", children: secondaryActionLabel }), jsxRuntime.jsx(reactComponents.Button, { "data-testid": "primaryAction", onClick: handlePrimaryActionClick, variant: primaryActionType, children: primaryActionLabel })] })] }));
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Helper that resolves the promise with the given action and immediately clears the resolver to prevent double resolution
|
|
71
|
-
*
|
|
72
|
-
* Prevents scenarios where both a button click and modal auto-close would resolve the same promise
|
|
73
|
-
*/
|
|
74
|
-
const resolveAndClear = (resolveAction, setResolveAction, action) => {
|
|
75
|
-
if (resolveAction) {
|
|
76
|
-
resolveAction(action);
|
|
77
|
-
setResolveAction(null);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* ConfirmationDialogContextProvider
|
|
82
|
-
*
|
|
83
|
-
* Provides confirmation dialog context and manages modal state with Promise-based resolution
|
|
84
|
-
*/
|
|
85
|
-
const ConfirmationDialogContextProvider = ({ children }) => {
|
|
86
|
-
const [t] = useTranslation();
|
|
87
|
-
const modal = reactModal.useModal({
|
|
88
|
-
onClose: () => {
|
|
89
|
-
resolveAndClear(resolveAction, setResolveAction, "CLOSE");
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const [resolveAction, setResolveAction] = react.useState(null);
|
|
93
|
-
const [confirmationDialogProps, setConfirmationDialogProps] = react.useState({
|
|
94
|
-
title: t("confirmationDialog.default.title"),
|
|
95
|
-
primaryActionType: "primary",
|
|
96
|
-
primaryActionLabel: t("confirmationDialog.default.primarybutton"),
|
|
97
|
-
secondaryActionLabel: t("confirmationDialog.default.secondarybutton"),
|
|
98
|
-
message: t("confirmationDialog.default.message"),
|
|
99
|
-
});
|
|
100
|
-
const confirmationDialogModalProps = react.useMemo(() => ({
|
|
101
|
-
...confirmationDialogProps,
|
|
102
|
-
handlePrimaryActionClick: () => {
|
|
103
|
-
resolveAndClear(resolveAction, setResolveAction, "PRIMARY");
|
|
104
|
-
modal.close();
|
|
105
|
-
},
|
|
106
|
-
handleSecondaryActionClick: () => {
|
|
107
|
-
resolveAndClear(resolveAction, setResolveAction, "SECONDARY");
|
|
108
|
-
modal.close();
|
|
109
|
-
},
|
|
110
|
-
}), [confirmationDialogProps, resolveAction, setResolveAction, modal]);
|
|
111
|
-
const confirm = react.useCallback(async (props) => {
|
|
112
|
-
setConfirmationDialogProps(prev => ({ ...prev, ...props }));
|
|
113
|
-
modal.open();
|
|
114
|
-
return new Promise(resolve => {
|
|
115
|
-
setResolveAction(() => resolve);
|
|
116
|
-
});
|
|
117
|
-
}, [modal]);
|
|
118
|
-
const value = react.useMemo(() => ({ confirm }), [confirm]);
|
|
119
|
-
return (jsxRuntime.jsxs(reactCoreHooks.ConfirmationDialogProvider, { value: value, children: [children, resolveAction ? jsxRuntime.jsx(ConfirmationDialogModal, { ...modal, ...confirmationDialogModalProps }) : null] }));
|
|
120
|
-
};
|
|
121
|
-
|
|
122
53
|
const cvaPreferenceCard = cssClassVarianceUtilities.cvaMerge(["rounded-lg", "border", "border-neutral-200", "bg-white", "w-full"], {
|
|
123
54
|
variants: {
|
|
124
55
|
disabled: {
|
|
@@ -244,5 +175,4 @@ const PreferenceCard = ({ title, description, icon, input, firstTag, secondTag,
|
|
|
244
175
|
*/
|
|
245
176
|
setupLibraryTranslations();
|
|
246
177
|
|
|
247
|
-
exports.ConfirmationDialogContextProvider = ConfirmationDialogContextProvider;
|
|
248
178
|
exports.PreferenceCard = PreferenceCard;
|
package/index.esm.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { registerTranslations
|
|
3
|
-
import {
|
|
4
|
-
import { Modal, ModalHeader, ModalBody, ModalFooter, useModal } from '@trackunit/react-modal';
|
|
5
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
6
|
-
import { Button, Tooltip, SkeletonLines, Icon, Text, Tag } from '@trackunit/react-components';
|
|
2
|
+
import { registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
|
+
import { Tooltip, SkeletonLines, Icon, Text, Tag } from '@trackunit/react-components';
|
|
7
4
|
import { Checkbox, RadioItem, ToggleSwitch } from '@trackunit/react-form-components';
|
|
5
|
+
import { useCallback } from 'react';
|
|
8
6
|
import { twMerge } from 'tailwind-merge';
|
|
9
7
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
10
8
|
|
|
11
9
|
var defaultTranslations = {
|
|
12
|
-
|
|
13
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
14
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
15
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
10
|
+
|
|
16
11
|
};
|
|
17
12
|
|
|
18
13
|
/** The translation namespace for this library */
|
|
@@ -46,10 +41,6 @@ const translations = {
|
|
|
46
41
|
th: () => import('./translation.esm17.js'),
|
|
47
42
|
},
|
|
48
43
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Local useTranslation for this specific library
|
|
51
|
-
*/
|
|
52
|
-
const useTranslation = () => useNamespaceTranslation(namespace);
|
|
53
44
|
/**
|
|
54
45
|
* Registers the translations for this library
|
|
55
46
|
*/
|
|
@@ -57,66 +48,6 @@ const setupLibraryTranslations = () => {
|
|
|
57
48
|
registerTranslations(translations);
|
|
58
49
|
};
|
|
59
50
|
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
const ConfirmationDialogModal = ({ title, message, handlePrimaryActionClick, handleSecondaryActionClick, secondaryActionLabel, primaryActionType, primaryActionLabel, ...modalProps }) => {
|
|
64
|
-
return (jsxs(Modal, { ...modalProps, className: "max-w-xl", children: [jsx(ModalHeader, { heading: title, id: "dialogTitle", onClose: modalProps.close }), jsx(ModalBody, { id: "dialogDesc", children: message }), jsxs(ModalFooter, { children: [jsx(Button, { "data-testid": "secondaryAction", onClick: handleSecondaryActionClick, variant: "ghost-neutral", children: secondaryActionLabel }), jsx(Button, { "data-testid": "primaryAction", onClick: handlePrimaryActionClick, variant: primaryActionType, children: primaryActionLabel })] })] }));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Helper that resolves the promise with the given action and immediately clears the resolver to prevent double resolution
|
|
69
|
-
*
|
|
70
|
-
* Prevents scenarios where both a button click and modal auto-close would resolve the same promise
|
|
71
|
-
*/
|
|
72
|
-
const resolveAndClear = (resolveAction, setResolveAction, action) => {
|
|
73
|
-
if (resolveAction) {
|
|
74
|
-
resolveAction(action);
|
|
75
|
-
setResolveAction(null);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* ConfirmationDialogContextProvider
|
|
80
|
-
*
|
|
81
|
-
* Provides confirmation dialog context and manages modal state with Promise-based resolution
|
|
82
|
-
*/
|
|
83
|
-
const ConfirmationDialogContextProvider = ({ children }) => {
|
|
84
|
-
const [t] = useTranslation();
|
|
85
|
-
const modal = useModal({
|
|
86
|
-
onClose: () => {
|
|
87
|
-
resolveAndClear(resolveAction, setResolveAction, "CLOSE");
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
const [resolveAction, setResolveAction] = useState(null);
|
|
91
|
-
const [confirmationDialogProps, setConfirmationDialogProps] = useState({
|
|
92
|
-
title: t("confirmationDialog.default.title"),
|
|
93
|
-
primaryActionType: "primary",
|
|
94
|
-
primaryActionLabel: t("confirmationDialog.default.primarybutton"),
|
|
95
|
-
secondaryActionLabel: t("confirmationDialog.default.secondarybutton"),
|
|
96
|
-
message: t("confirmationDialog.default.message"),
|
|
97
|
-
});
|
|
98
|
-
const confirmationDialogModalProps = useMemo(() => ({
|
|
99
|
-
...confirmationDialogProps,
|
|
100
|
-
handlePrimaryActionClick: () => {
|
|
101
|
-
resolveAndClear(resolveAction, setResolveAction, "PRIMARY");
|
|
102
|
-
modal.close();
|
|
103
|
-
},
|
|
104
|
-
handleSecondaryActionClick: () => {
|
|
105
|
-
resolveAndClear(resolveAction, setResolveAction, "SECONDARY");
|
|
106
|
-
modal.close();
|
|
107
|
-
},
|
|
108
|
-
}), [confirmationDialogProps, resolveAction, setResolveAction, modal]);
|
|
109
|
-
const confirm = useCallback(async (props) => {
|
|
110
|
-
setConfirmationDialogProps(prev => ({ ...prev, ...props }));
|
|
111
|
-
modal.open();
|
|
112
|
-
return new Promise(resolve => {
|
|
113
|
-
setResolveAction(() => resolve);
|
|
114
|
-
});
|
|
115
|
-
}, [modal]);
|
|
116
|
-
const value = useMemo(() => ({ confirm }), [confirm]);
|
|
117
|
-
return (jsxs(ConfirmationDialogProvider, { value: value, children: [children, resolveAction ? jsx(ConfirmationDialogModal, { ...modal, ...confirmationDialogModalProps }) : null] }));
|
|
118
|
-
};
|
|
119
|
-
|
|
120
51
|
const cvaPreferenceCard = cvaMerge(["rounded-lg", "border", "border-neutral-200", "bg-white", "w-full"], {
|
|
121
52
|
variants: {
|
|
122
53
|
disabled: {
|
|
@@ -242,4 +173,4 @@ const PreferenceCard = ({ title, description, icon, input, firstTag, secondTag,
|
|
|
242
173
|
*/
|
|
243
174
|
setupLibraryTranslations();
|
|
244
175
|
|
|
245
|
-
export {
|
|
176
|
+
export { PreferenceCard };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-compound-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.163",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,15 +9,12 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react": "19.0.0",
|
|
11
11
|
"tailwind-merge": "^2.0.0",
|
|
12
|
-
"@trackunit/
|
|
13
|
-
"@trackunit/react-components": "1.
|
|
14
|
-
"@trackunit/
|
|
15
|
-
"@trackunit/
|
|
16
|
-
"@trackunit/
|
|
17
|
-
"@trackunit/
|
|
18
|
-
"@trackunit/shared-utils": "1.9.107",
|
|
19
|
-
"@trackunit/ui-icons": "1.7.108",
|
|
20
|
-
"@trackunit/iris-app-runtime-core-api": "1.7.117"
|
|
12
|
+
"@trackunit/css-class-variance-utilities": "1.7.110",
|
|
13
|
+
"@trackunit/react-form-components": "1.8.161",
|
|
14
|
+
"@trackunit/i18n-library-translation": "1.7.131",
|
|
15
|
+
"@trackunit/shared-utils": "1.9.110",
|
|
16
|
+
"@trackunit/ui-icons": "1.7.111",
|
|
17
|
+
"@trackunit/react-components": "1.10.86"
|
|
21
18
|
},
|
|
22
19
|
"module": "./index.esm.js",
|
|
23
20
|
"main": "./index.cjs.js",
|
package/src/index.d.ts
CHANGED
package/translation.cjs.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs10.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs11.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs12.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs13.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs14.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs15.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs16.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs17.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs2.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs3.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs4.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs5.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs6.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs7.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs8.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.cjs9.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var translation = {
|
|
4
|
-
|
|
5
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
6
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
7
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
4
|
+
|
|
8
5
|
};
|
|
9
6
|
|
|
10
7
|
exports.default = translation;
|
package/translation.esm.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm10.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm11.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm12.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm13.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm14.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm15.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm16.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm17.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm2.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm3.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm4.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm5.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm6.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm7.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm8.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
package/translation.esm9.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
var translation = {
|
|
2
|
-
|
|
3
|
-
"confirmationDialog.default.primarybutton": "Confirm",
|
|
4
|
-
"confirmationDialog.default.secondarybutton": "Cancel",
|
|
5
|
-
"confirmationDialog.default.title": "Please confirm this action"
|
|
2
|
+
|
|
6
3
|
};
|
|
7
4
|
|
|
8
5
|
export { translation as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
export interface ConfirmationDialogProviderProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* ConfirmationDialogContextProvider
|
|
7
|
-
*
|
|
8
|
-
* Provides confirmation dialog context and manages modal state with Promise-based resolution
|
|
9
|
-
*/
|
|
10
|
-
export declare const ConfirmationDialogContextProvider: ({ children }: ConfirmationDialogProviderProps) => ReactElement;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
-
import { UseModalReturnValue } from "@trackunit/react-modal";
|
|
3
|
-
import { ReactElement } from "react";
|
|
4
|
-
import { ConfirmationDialogProps } from "./useConfirmationDialog.demo";
|
|
5
|
-
export interface ConfirmationDialogModalProps extends Pick<ConfirmationDialogProps, "title" | "message" | "primaryActionLabel" | "secondaryActionLabel" | "primaryActionType">, UseModalReturnValue, CommonProps {
|
|
6
|
-
handlePrimaryActionClick: () => void;
|
|
7
|
-
handleSecondaryActionClick: () => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare const ConfirmationDialogModal: ({ title, message, handlePrimaryActionClick, handleSecondaryActionClick, secondaryActionLabel, primaryActionType, primaryActionLabel, ...modalProps }: ConfirmationDialogModalProps) => ReactElement;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ConfirmationDialogProps as ConfirmationDialogPropsActual } from "@trackunit/iris-app-runtime-core-api";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
export interface ConfirmationDialogProps extends ConfirmationDialogPropsActual {
|
|
4
|
-
/**
|
|
5
|
-
* The heading of the modal.
|
|
6
|
-
*/
|
|
7
|
-
title: string;
|
|
8
|
-
/**
|
|
9
|
-
* The content to show in the modal.
|
|
10
|
-
*/
|
|
11
|
-
message: string | ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* The type of the primary action button.
|
|
14
|
-
* For actions like delete, the primary action button should be primary-danger.
|
|
15
|
-
*/
|
|
16
|
-
primaryActionType: "primary" | "primary-danger";
|
|
17
|
-
/**
|
|
18
|
-
* The label of the primary action button.
|
|
19
|
-
* For example, "Delete user".
|
|
20
|
-
*/
|
|
21
|
-
primaryActionLabel: string;
|
|
22
|
-
/**
|
|
23
|
-
* The label of the secondary action button.
|
|
24
|
-
* For example, "Cancel".
|
|
25
|
-
*/
|
|
26
|
-
secondaryActionLabel: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The useConfirmationDialog hook is used to show a confirmation dialog in the _**Manager**_ or _**Iris Apps**_.
|
|
30
|
-
*
|
|
31
|
-
* It returns a function that can be called with a ConfirmationDialogProps object.
|
|
32
|
-
*
|
|
33
|
-
* The function returns a promise that resolves to a UserInteractionType.
|
|
34
|
-
*
|
|
35
|
-
* The UserInteractionType is either "PRIMARY", "SECONDARY" or "CLOSE".
|
|
36
|
-
*
|
|
37
|
-
* The promise resolves when the user clicks the primary, secondary, or close button. (CLOSE is also triggered when the modal is dismissed in other ways.)
|
|
38
|
-
*
|
|
39
|
-
* **ATTENTION:** In the Manager and Iris Apps, this hook will "just work". If you are using the hook in a custom setup, you need to wrap your app in the ConfirmationDialogContextProvider.
|
|
40
|
-
*/
|
|
41
|
-
export declare const UseConfirmationDialogDemoComponent: (props: ConfirmationDialogProps) => ReactElement;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-webpack5";
|
|
2
|
-
import { ReactElement } from "react";
|
|
3
|
-
type Story = StoryObj<typeof meta>;
|
|
4
|
-
declare const meta: {
|
|
5
|
-
title: string;
|
|
6
|
-
component: (props: import("./useConfirmationDialog.demo").ConfirmationDialogProps) => ReactElement;
|
|
7
|
-
parameters: {
|
|
8
|
-
docs: {
|
|
9
|
-
source: {
|
|
10
|
-
type: string;
|
|
11
|
-
excludeDecorators: boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default meta;
|
|
17
|
-
export declare const PackageName: () => ReactElement;
|
|
18
|
-
export declare const Default: Story;
|