cozy-harvest-lib 9.32.2 → 9.32.3
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,17 @@
|
|
|
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
|
+
## [9.32.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.2...cozy-harvest-lib@9.32.3) (2022-12-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **harvest:** Use correct button to close CozyConfirmDialog ([cd7e22b](https://github.com/cozy/cozy-libs/commit/cd7e22bdb9c5f7addacb1230e788b4a3a03c1126))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [9.32.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.1...cozy-harvest-lib@9.32.2) (2022-12-02)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import React, { createContext, useContext, useState } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import Button from 'cozy-ui/transpiled/react/Buttons';
|
|
5
5
|
import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
6
6
|
export var CozyConfirmDialogContext = /*#__PURE__*/createContext();
|
|
7
7
|
var currentDialogId = 0;
|
|
@@ -55,21 +55,20 @@ export var CozyConfirmDialogProvider = /*#__PURE__*/React.memo(function (props)
|
|
|
55
55
|
value: context
|
|
56
56
|
}, dialogs && dialogs.map(function (dialog) {
|
|
57
57
|
return /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
58
|
-
key: dialog.id,
|
|
59
58
|
open: true,
|
|
59
|
+
key: dialog.id,
|
|
60
60
|
title: dialog.title,
|
|
61
61
|
content: dialog.description,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Buttons, {
|
|
66
|
-
variant: "text",
|
|
67
|
-
color: "primary",
|
|
62
|
+
actions: /*#__PURE__*/React.createElement(Button, {
|
|
63
|
+
label: dialog.closeLabel,
|
|
68
64
|
"aria-label": "Close dialog",
|
|
69
65
|
onClick: function onClick() {
|
|
70
66
|
return _onClose(dialog.id);
|
|
71
67
|
}
|
|
72
|
-
},
|
|
68
|
+
}),
|
|
69
|
+
onClose: function onClose() {
|
|
70
|
+
return _onClose(dialog.id);
|
|
71
|
+
}
|
|
73
72
|
});
|
|
74
73
|
}), children);
|
|
75
74
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "9.32.
|
|
3
|
+
"version": "9.32.3",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"react-router-dom": "^5.0.1"
|
|
92
92
|
},
|
|
93
93
|
"sideEffects": false,
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "2fd687303ab3f8627577806ba20607989e4c13f2"
|
|
95
95
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext, useState } from 'react'
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
3
4
|
import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
4
5
|
|
|
5
6
|
export const CozyConfirmDialogContext = createContext()
|
|
@@ -19,12 +20,14 @@ export const useCozyConfirmDialog = () => {
|
|
|
19
20
|
export const CozyConfirmDialogProvider = React.memo(props => {
|
|
20
21
|
const [dialogs, setDialogs] = useState([])
|
|
21
22
|
const { children } = props
|
|
23
|
+
|
|
22
24
|
const onClose = dialogId => {
|
|
23
25
|
dialogs.find(dialog => dialog.id === dialogId).callback()
|
|
24
26
|
setDialogs(prevDialogs =>
|
|
25
27
|
prevDialogs.filter(dialog => dialog.id !== dialogId)
|
|
26
28
|
)
|
|
27
29
|
}
|
|
30
|
+
|
|
28
31
|
const context = {
|
|
29
32
|
showDialog: ({ title, closeLabel, description }) => {
|
|
30
33
|
return new Promise(resolve => {
|
|
@@ -43,29 +46,25 @@ export const CozyConfirmDialogProvider = React.memo(props => {
|
|
|
43
46
|
})
|
|
44
47
|
}
|
|
45
48
|
}
|
|
49
|
+
|
|
46
50
|
return (
|
|
47
51
|
<CozyConfirmDialogContext.Provider value={context}>
|
|
48
52
|
{dialogs &&
|
|
49
53
|
dialogs.map(dialog => {
|
|
50
54
|
return (
|
|
51
55
|
<ConfirmDialog
|
|
56
|
+
open
|
|
52
57
|
key={dialog.id}
|
|
53
|
-
open={true}
|
|
54
58
|
title={dialog.title}
|
|
55
59
|
content={dialog.description}
|
|
56
|
-
onClose={() => onClose(dialog.id)}
|
|
57
60
|
actions={
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onClick={() => onClose(dialog.id)}
|
|
64
|
-
>
|
|
65
|
-
{dialog.closeLabel}
|
|
66
|
-
</Buttons>
|
|
67
|
-
</>
|
|
61
|
+
<Button
|
|
62
|
+
label={dialog.closeLabel}
|
|
63
|
+
aria-label="Close dialog"
|
|
64
|
+
onClick={() => onClose(dialog.id)}
|
|
65
|
+
/>
|
|
68
66
|
}
|
|
67
|
+
onClose={() => onClose(dialog.id)}
|
|
69
68
|
/>
|
|
70
69
|
)
|
|
71
70
|
})}
|