cozy-viewer 1.1.0

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.
Files changed (250) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +21 -0
  3. package/Readme.md +44 -0
  4. package/babel.config.js +23 -0
  5. package/dist/Footer/BottomSheetContent.d.ts +12 -0
  6. package/dist/Footer/BottomSheetContent.js +45 -0
  7. package/dist/Footer/DownloadButton.d.ts +16 -0
  8. package/dist/Footer/DownloadButton.js +113 -0
  9. package/dist/Footer/FooterActionButtons.d.ts +13 -0
  10. package/dist/Footer/FooterActionButtons.js +33 -0
  11. package/dist/Footer/FooterActionButtons.spec.d.ts +1 -0
  12. package/dist/Footer/FooterContent.d.ts +16 -0
  13. package/dist/Footer/FooterContent.js +120 -0
  14. package/dist/Footer/ForwardButton.d.ts +20 -0
  15. package/dist/Footer/ForwardButton.js +177 -0
  16. package/dist/Footer/ForwardButton.spec.d.ts +1 -0
  17. package/dist/Footer/ForwardOrDownloadButton.d.ts +11 -0
  18. package/dist/Footer/ForwardOrDownloadButton.js +42 -0
  19. package/dist/Footer/Sharing.d.ts +16 -0
  20. package/dist/Footer/Sharing.js +79 -0
  21. package/dist/Footer/helpers.d.ts +8 -0
  22. package/dist/Footer/helpers.js +179 -0
  23. package/dist/Footer/helpers.spec.d.ts +1 -0
  24. package/dist/NoViewer/DownloadButton.d.ts +2 -0
  25. package/dist/NoViewer/DownloadButton.js +52 -0
  26. package/dist/NoViewer/FileIcon.d.ts +4 -0
  27. package/dist/NoViewer/FileIcon.js +76 -0
  28. package/dist/NoViewer/NoViewer.d.ts +18 -0
  29. package/dist/NoViewer/NoViewer.js +64 -0
  30. package/dist/NoViewer/NoViewer.spec.d.ts +1 -0
  31. package/dist/NoViewer/index.d.ts +1 -0
  32. package/dist/NoViewer/index.js +15 -0
  33. package/dist/Panel/ActionMenuDesktop.d.ts +3 -0
  34. package/dist/Panel/ActionMenuDesktop.js +91 -0
  35. package/dist/Panel/ActionMenuMobile.d.ts +20 -0
  36. package/dist/Panel/ActionMenuMobile.js +95 -0
  37. package/dist/Panel/ActionMenuWrapper.d.ts +3 -0
  38. package/dist/Panel/ActionMenuWrapper.js +155 -0
  39. package/dist/Panel/Certifications.d.ts +2 -0
  40. package/dist/Panel/Certifications.js +80 -0
  41. package/dist/Panel/PanelContent.d.ts +2 -0
  42. package/dist/Panel/PanelContent.js +71 -0
  43. package/dist/Panel/Qualification.d.ts +2 -0
  44. package/dist/Panel/Qualification.js +148 -0
  45. package/dist/Panel/QualificationListItemContact.d.ts +10 -0
  46. package/dist/Panel/QualificationListItemContact.js +123 -0
  47. package/dist/Panel/QualificationListItemDate.d.ts +3 -0
  48. package/dist/Panel/QualificationListItemDate.js +90 -0
  49. package/dist/Panel/QualificationListItemInformation.d.ts +3 -0
  50. package/dist/Panel/QualificationListItemInformation.js +84 -0
  51. package/dist/Panel/QualificationListItemInformation.spec.d.ts +1 -0
  52. package/dist/Panel/QualificationListItemOther.d.ts +3 -0
  53. package/dist/Panel/QualificationListItemOther.js +78 -0
  54. package/dist/Panel/QualificationListItemText.d.ts +13 -0
  55. package/dist/Panel/QualificationListItemText.js +42 -0
  56. package/dist/Panel/getPanelBlocks.d.ts +26 -0
  57. package/dist/Panel/getPanelBlocks.js +79 -0
  58. package/dist/Panel/getPanelBlocks.spec.d.ts +1 -0
  59. package/dist/Viewer.d.ts +39 -0
  60. package/dist/Viewer.js +191 -0
  61. package/dist/ViewerContainer.d.ts +22 -0
  62. package/dist/ViewerContainer.js +221 -0
  63. package/dist/ViewerExposer.d.ts +2 -0
  64. package/dist/ViewerExposer.js +13 -0
  65. package/dist/ViewerInformationsWrapper.d.ts +20 -0
  66. package/dist/ViewerInformationsWrapper.js +68 -0
  67. package/dist/ViewerInformationsWrapper.spec.d.ts +1 -0
  68. package/dist/ViewerWithCustomPanelAndFooter.d.ts +2 -0
  69. package/dist/ViewerWithCustomPanelAndFooter.js +78 -0
  70. package/dist/ViewersByFile/AudioViewer.d.ts +74 -0
  71. package/dist/ViewersByFile/AudioViewer.js +57 -0
  72. package/dist/ViewersByFile/AudioViewer.spec.d.ts +1 -0
  73. package/dist/ViewersByFile/BlankPaperViewer.d.ts +2 -0
  74. package/dist/ViewersByFile/BlankPaperViewer.js +97 -0
  75. package/dist/ViewersByFile/ImageViewer.d.ts +31 -0
  76. package/dist/ViewersByFile/ImageViewer.js +385 -0
  77. package/dist/ViewersByFile/ImageViewer.spec.d.ts +1 -0
  78. package/dist/ViewersByFile/NoNetworkViewer.d.ts +2 -0
  79. package/dist/ViewersByFile/NoNetworkViewer.js +54 -0
  80. package/dist/ViewersByFile/OnlyOfficeViewer.d.ts +2 -0
  81. package/dist/ViewersByFile/OnlyOfficeViewer.js +46 -0
  82. package/dist/ViewersByFile/PdfJsViewer.d.ts +31 -0
  83. package/dist/ViewersByFile/PdfJsViewer.js +283 -0
  84. package/dist/ViewersByFile/PdfJsViewer.spec.d.ts +1 -0
  85. package/dist/ViewersByFile/PdfMobileViewer.d.ts +4 -0
  86. package/dist/ViewersByFile/PdfMobileViewer.js +185 -0
  87. package/dist/ViewersByFile/PdfMobileViewer.spec.d.ts +1 -0
  88. package/dist/ViewersByFile/ShortcutViewer.d.ts +2 -0
  89. package/dist/ViewersByFile/ShortcutViewer.js +61 -0
  90. package/dist/ViewersByFile/ShortcutViewer.spec.d.ts +4 -0
  91. package/dist/ViewersByFile/TextViewer.d.ts +90 -0
  92. package/dist/ViewersByFile/TextViewer.js +250 -0
  93. package/dist/ViewersByFile/TextViewer.spec.d.ts +1 -0
  94. package/dist/ViewersByFile/VideoViewer.d.ts +74 -0
  95. package/dist/ViewersByFile/VideoViewer.js +46 -0
  96. package/dist/ViewersByFile/VideoViewer.spec.d.ts +1 -0
  97. package/dist/assets/IlluGenericNewPage.svg +10 -0
  98. package/dist/components/ExpirationAlert.d.ts +2 -0
  99. package/dist/components/ExpirationAlert.js +129 -0
  100. package/dist/components/ExpirationAnnotation.d.ts +10 -0
  101. package/dist/components/ExpirationAnnotation.js +56 -0
  102. package/dist/components/Footer.d.ts +4 -0
  103. package/dist/components/Footer.js +41 -0
  104. package/dist/components/InformationPanel.d.ts +12 -0
  105. package/dist/components/InformationPanel.js +36 -0
  106. package/dist/components/Navigation.d.ts +18 -0
  107. package/dist/components/Navigation.js +63 -0
  108. package/dist/components/PdfToolbarButton.d.ts +16 -0
  109. package/dist/components/PdfToolbarButton.js +40 -0
  110. package/dist/components/PrintButton.d.ts +16 -0
  111. package/dist/components/PrintButton.js +163 -0
  112. package/dist/components/Toolbar.d.ts +2 -0
  113. package/dist/components/Toolbar.js +146 -0
  114. package/dist/components/ToolbarButtons.d.ts +5 -0
  115. package/dist/components/ToolbarButtons.js +20 -0
  116. package/dist/components/ToolbarFilePath.d.ts +3 -0
  117. package/dist/components/ToolbarFilePath.js +92 -0
  118. package/dist/components/ViewerByFile.d.ts +7 -0
  119. package/dist/components/ViewerByFile.js +137 -0
  120. package/dist/components/ViewerByFile.spec.d.ts +1 -0
  121. package/dist/components/ViewerControls.d.ts +9 -0
  122. package/dist/components/ViewerControls.js +251 -0
  123. package/dist/components/ViewerControls.spec.d.ts +1 -0
  124. package/dist/components/ViewerSpinner.d.ts +2 -0
  125. package/dist/components/ViewerSpinner.js +31 -0
  126. package/dist/docs/DemoProvider.d.ts +6 -0
  127. package/dist/docs/DemoProvider.js +159 -0
  128. package/dist/helpers.d.ts +37 -0
  129. package/dist/helpers.js +190 -0
  130. package/dist/helpers.spec.d.ts +1 -0
  131. package/dist/hoc/withFileUrl.d.ts +75 -0
  132. package/dist/hoc/withFileUrl.js +231 -0
  133. package/dist/hoc/withViewerLocales.d.ts +1 -0
  134. package/dist/hoc/withViewerLocales.js +15 -0
  135. package/dist/hooks/useReferencedContactName.d.ts +5 -0
  136. package/dist/hooks/useReferencedContactName.js +45 -0
  137. package/dist/index.d.ts +10 -0
  138. package/dist/index.js +75 -0
  139. package/dist/locales/index.d.ts +6 -0
  140. package/dist/locales/index.js +18 -0
  141. package/dist/proptypes.d.ts +7 -0
  142. package/dist/proptypes.js +25 -0
  143. package/dist/providers/ActionMenuProvider.d.ts +13 -0
  144. package/dist/providers/ActionMenuProvider.js +47 -0
  145. package/dist/providers/EncryptedProvider.d.ts +8 -0
  146. package/dist/providers/EncryptedProvider.js +43 -0
  147. package/dist/queries.d.ts +15 -0
  148. package/dist/queries.js +40 -0
  149. package/dist/stylesheet.css +218 -0
  150. package/jest.config.js +23 -0
  151. package/package.json +62 -0
  152. package/preprocess.js +16 -0
  153. package/src/Footer/BottomSheetContent.jsx +30 -0
  154. package/src/Footer/DownloadButton.jsx +66 -0
  155. package/src/Footer/FooterActionButtons.jsx +22 -0
  156. package/src/Footer/FooterActionButtons.spec.jsx +30 -0
  157. package/src/Footer/FooterContent.jsx +102 -0
  158. package/src/Footer/ForwardButton.jsx +95 -0
  159. package/src/Footer/ForwardButton.spec.jsx +87 -0
  160. package/src/Footer/ForwardOrDownloadButton.jsx +24 -0
  161. package/src/Footer/Sharing.jsx +59 -0
  162. package/src/Footer/helpers.js +106 -0
  163. package/src/Footer/helpers.spec.js +77 -0
  164. package/src/NoViewer/DownloadButton.jsx +28 -0
  165. package/src/NoViewer/FileIcon.jsx +46 -0
  166. package/src/NoViewer/NoViewer.jsx +30 -0
  167. package/src/NoViewer/NoViewer.spec.jsx +44 -0
  168. package/src/NoViewer/__snapshots__/NoViewer.spec.jsx.snap +82 -0
  169. package/src/NoViewer/index.jsx +1 -0
  170. package/src/Panel/ActionMenuDesktop.jsx +69 -0
  171. package/src/Panel/ActionMenuMobile.jsx +76 -0
  172. package/src/Panel/ActionMenuWrapper.jsx +104 -0
  173. package/src/Panel/Certifications.jsx +63 -0
  174. package/src/Panel/PanelContent.jsx +50 -0
  175. package/src/Panel/Qualification.jsx +114 -0
  176. package/src/Panel/QualificationListItemContact.jsx +85 -0
  177. package/src/Panel/QualificationListItemDate.jsx +78 -0
  178. package/src/Panel/QualificationListItemInformation.jsx +68 -0
  179. package/src/Panel/QualificationListItemInformation.spec.jsx +73 -0
  180. package/src/Panel/QualificationListItemOther.jsx +61 -0
  181. package/src/Panel/QualificationListItemText.jsx +30 -0
  182. package/src/Panel/getPanelBlocks.jsx +56 -0
  183. package/src/Panel/getPanelBlocks.spec.jsx +79 -0
  184. package/src/Panel/styles.styl +13 -0
  185. package/src/Readme.md +352 -0
  186. package/src/Viewer.jsx +135 -0
  187. package/src/ViewerContainer.jsx +170 -0
  188. package/src/ViewerExposer.js +3 -0
  189. package/src/ViewerInformationsWrapper.jsx +70 -0
  190. package/src/ViewerInformationsWrapper.spec.jsx +63 -0
  191. package/src/ViewerWithCustomPanelAndFooter.jsx +57 -0
  192. package/src/ViewersByFile/AudioViewer.jsx +22 -0
  193. package/src/ViewersByFile/AudioViewer.spec.jsx +40 -0
  194. package/src/ViewersByFile/BlankPaperViewer.jsx +47 -0
  195. package/src/ViewersByFile/ImageViewer.jsx +331 -0
  196. package/src/ViewersByFile/ImageViewer.spec.jsx +73 -0
  197. package/src/ViewersByFile/NoNetworkViewer.jsx +18 -0
  198. package/src/ViewersByFile/OnlyOfficeViewer.jsx +29 -0
  199. package/src/ViewersByFile/PdfJsViewer.jsx +210 -0
  200. package/src/ViewersByFile/PdfJsViewer.spec.jsx +161 -0
  201. package/src/ViewersByFile/PdfMobileViewer.jsx +106 -0
  202. package/src/ViewersByFile/PdfMobileViewer.spec.jsx +76 -0
  203. package/src/ViewersByFile/ShortcutViewer.jsx +38 -0
  204. package/src/ViewersByFile/ShortcutViewer.spec.jsx +32 -0
  205. package/src/ViewersByFile/TextViewer.jsx +126 -0
  206. package/src/ViewersByFile/TextViewer.spec.jsx +118 -0
  207. package/src/ViewersByFile/VideoViewer.jsx +13 -0
  208. package/src/ViewersByFile/VideoViewer.spec.jsx +40 -0
  209. package/src/ViewersByFile/__snapshots__/AudioViewer.spec.jsx.snap +43 -0
  210. package/src/ViewersByFile/__snapshots__/ShortcutViewer.spec.jsx.snap +57 -0
  211. package/src/ViewersByFile/__snapshots__/TextViewer.spec.jsx.snap +100 -0
  212. package/src/ViewersByFile/__snapshots__/VideoViewer.spec.jsx.snap +19 -0
  213. package/src/ViewersByFile/styles.styl +87 -0
  214. package/src/assets/IlluGenericNewPage.svg +10 -0
  215. package/src/components/ExpirationAlert.jsx +86 -0
  216. package/src/components/ExpirationAnnotation.jsx +39 -0
  217. package/src/components/Footer.jsx +14 -0
  218. package/src/components/InformationPanel.jsx +26 -0
  219. package/src/components/Navigation.jsx +40 -0
  220. package/src/components/PdfToolbarButton.jsx +26 -0
  221. package/src/components/PrintButton.jsx +89 -0
  222. package/src/components/Toolbar.jsx +111 -0
  223. package/src/components/ToolbarButtons.jsx +11 -0
  224. package/src/components/ToolbarFilePath.jsx +61 -0
  225. package/src/components/ViewerByFile.jsx +112 -0
  226. package/src/components/ViewerByFile.spec.jsx +100 -0
  227. package/src/components/ViewerControls.jsx +191 -0
  228. package/src/components/ViewerControls.spec.jsx +54 -0
  229. package/src/components/ViewerSpinner.jsx +17 -0
  230. package/src/components/styles.styl +93 -0
  231. package/src/docs/DemoProvider.jsx +90 -0
  232. package/src/helpers.js +131 -0
  233. package/src/helpers.spec.js +136 -0
  234. package/src/hoc/withFileUrl.jsx +93 -0
  235. package/src/hoc/withViewerLocales.jsx +5 -0
  236. package/src/hooks/useReferencedContactName.jsx +26 -0
  237. package/src/index.jsx +12 -0
  238. package/src/locales/en.json +66 -0
  239. package/src/locales/fr.json +66 -0
  240. package/src/locales/index.js +4 -0
  241. package/src/proptypes.js +12 -0
  242. package/src/providers/ActionMenuProvider.jsx +35 -0
  243. package/src/providers/EncryptedProvider.jsx +25 -0
  244. package/src/queries.js +20 -0
  245. package/src/styles.styl +22 -0
  246. package/src/vars.styl +6 -0
  247. package/test/__mocks__/fileMock.js +3 -0
  248. package/test/jestLib/setup.js +5 -0
  249. package/tsconfig-build.json +13 -0
  250. package/tsconfig.json +34 -0
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _paper = require("cozy-client/dist/models/paper");
17
+
18
+ var _List = _interopRequireDefault(require("cozy-ui/transpiled/react/List"));
19
+
20
+ var _ActionMenuWrapper = _interopRequireDefault(require("./ActionMenuWrapper"));
21
+
22
+ var _QualificationListItemContact = _interopRequireDefault(require("./QualificationListItemContact"));
23
+
24
+ var _QualificationListItemDate = _interopRequireDefault(require("./QualificationListItemDate"));
25
+
26
+ var _QualificationListItemInformation = _interopRequireDefault(require("./QualificationListItemInformation"));
27
+
28
+ var _QualificationListItemOther = _interopRequireDefault(require("./QualificationListItemOther"));
29
+
30
+ var _ExpirationAlert = _interopRequireDefault(require("../components/ExpirationAlert"));
31
+
32
+ var _withViewerLocales = require("../hoc/withViewerLocales");
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
38
+ var ComponentFromMetadataQualificationType = {
39
+ contact: _QualificationListItemContact.default,
40
+ date: _QualificationListItemDate.default,
41
+ information: _QualificationListItemInformation.default,
42
+ other: _QualificationListItemOther.default,
43
+ bills: _QualificationListItemInformation.default
44
+ };
45
+
46
+ var isExpirationAlertHidden = function isExpirationAlertHidden(file) {
47
+ var _file$metadata$hideEx, _file$metadata;
48
+
49
+ return (_file$metadata$hideEx = file === null || file === void 0 ? void 0 : (_file$metadata = file.metadata) === null || _file$metadata === void 0 ? void 0 : _file$metadata.hideExpirationAlert) !== null && _file$metadata$hideEx !== void 0 ? _file$metadata$hideEx : false;
50
+ };
51
+
52
+ var Qualification = function Qualification(_ref) {
53
+ var _file$bills2;
54
+
55
+ var file = _ref.file;
56
+ var _file$metadata2 = file.metadata,
57
+ metadata = _file$metadata2 === void 0 ? {} : _file$metadata2;
58
+ var actionBtnRef = (0, _react.useRef)([]);
59
+
60
+ var _useState = (0, _react.useState)({
61
+ id: '',
62
+ name: '',
63
+ value: ''
64
+ }),
65
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
66
+ optionFile = _useState2[0],
67
+ setOptionFile = _useState2[1];
68
+
69
+ var hideActionsMenu = function hideActionsMenu() {
70
+ setOptionFile({
71
+ id: '',
72
+ name: '',
73
+ value: ''
74
+ });
75
+ };
76
+
77
+ var _toggleActionsMenu = function toggleActionsMenu(id, name, value) {
78
+ setOptionFile(function (prev) {
79
+ if (prev.value) return {
80
+ id: '',
81
+ name: '',
82
+ value: ''
83
+ };
84
+ return {
85
+ id: id,
86
+ name: name,
87
+ value: value
88
+ };
89
+ });
90
+ };
91
+
92
+ var formattedMetadataQualification = (0, _react.useMemo)(function () {
93
+ var _file$bills, _file$bills$data;
94
+
95
+ var relatedBills = (_file$bills = file.bills) === null || _file$bills === void 0 ? void 0 : (_file$bills$data = _file$bills.data) === null || _file$bills$data === void 0 ? void 0 : _file$bills$data[0];
96
+
97
+ if (relatedBills) {
98
+ var formattedBillsMetadata = _paper.KNOWN_BILLS_ATTRIBUTES_NAMES.map(function (attrName) {
99
+ return {
100
+ name: attrName,
101
+ value: relatedBills[attrName]
102
+ };
103
+ });
104
+
105
+ return (0, _paper.formatMetadataQualification)(metadata).concat(formattedBillsMetadata);
106
+ }
107
+
108
+ return (0, _paper.formatMetadataQualification)(metadata);
109
+ }, [metadata, (_file$bills2 = file.bills) === null || _file$bills2 === void 0 ? void 0 : _file$bills2.data]);
110
+ (0, _react.useEffect)(function () {
111
+ actionBtnRef.current = formattedMetadataQualification.map(function (_, idx) {
112
+ var _actionBtnRef$current;
113
+
114
+ return (_actionBtnRef$current = actionBtnRef.current[idx]) !== null && _actionBtnRef$current !== void 0 ? _actionBtnRef$current : /*#__PURE__*/(0, _react.createRef)();
115
+ });
116
+ }, [formattedMetadataQualification]);
117
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _paper.isExpiringSoon)(file) && !isExpirationAlertHidden(file) && /*#__PURE__*/_react.default.createElement(_ExpirationAlert.default, {
118
+ file: file
119
+ }), /*#__PURE__*/_react.default.createElement(_List.default, {
120
+ className: "u-pv-1"
121
+ }, formattedMetadataQualification.map(function (meta, idx) {
122
+ var name = meta.name;
123
+ var metadataQualificationType = (0, _paper.getMetadataQualificationType)(name);
124
+ var QualificationListItemComp = ComponentFromMetadataQualificationType[metadataQualificationType];
125
+ return /*#__PURE__*/_react.default.createElement(QualificationListItemComp, {
126
+ key: idx,
127
+ file: file,
128
+ ref: actionBtnRef.current[idx],
129
+ formattedMetadataQualification: meta,
130
+ toggleActionsMenu: function toggleActionsMenu(val) {
131
+ return _toggleActionsMenu(idx, name, val);
132
+ }
133
+ });
134
+ }), optionFile.name && /*#__PURE__*/_react.default.createElement(_ActionMenuWrapper.default, {
135
+ onClose: hideActionsMenu,
136
+ file: file,
137
+ optionFile: optionFile,
138
+ ref: actionBtnRef.current[optionFile.id]
139
+ })));
140
+ };
141
+
142
+ Qualification.propTypes = {
143
+ file: _propTypes.default.object.isRequired
144
+ };
145
+
146
+ var _default = (0, _withViewerLocales.withViewerLocales)(Qualification);
147
+
148
+ exports.default = _default;
@@ -0,0 +1,10 @@
1
+ export default QualificationListItemContact;
2
+ declare function QualificationListItemContact({ file }: {
3
+ file: any;
4
+ }): JSX.Element | null;
5
+ declare namespace QualificationListItemContact {
6
+ namespace propTypes {
7
+ const file: PropTypes.Validator<object>;
8
+ }
9
+ }
10
+ import PropTypes from "prop-types";
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _paper = require("cozy-client/dist/models/paper");
17
+
18
+ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
19
+
20
+ var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
21
+
22
+ var _Dots = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Dots"));
23
+
24
+ var _ListItem = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItem"));
25
+
26
+ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemSecondaryAction"));
27
+
28
+ var _Spinner = _interopRequireDefault(require("cozy-ui/transpiled/react/Spinner"));
29
+
30
+ var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
31
+
32
+ var _ActionMenuWrapper = _interopRequireDefault(require("./ActionMenuWrapper"));
33
+
34
+ var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
35
+
36
+ var _useReferencedContactName = _interopRequireDefault(require("../hooks/useReferencedContactName"));
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
+
42
+ var QualificationListItemContact = function QualificationListItemContact(_ref) {
43
+ var file = _ref.file;
44
+
45
+ var _useI18n = (0, _I18n.useI18n)(),
46
+ lang = _useI18n.lang;
47
+
48
+ var actionBtnRef = (0, _react.useRef)();
49
+
50
+ var _useState = (0, _react.useState)({
51
+ name: '',
52
+ value: ''
53
+ }),
54
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
55
+ optionFile = _useState2[0],
56
+ setOptionFile = _useState2[1];
57
+
58
+ var hideActionsMenu = function hideActionsMenu() {
59
+ return setOptionFile({
60
+ name: '',
61
+ value: ''
62
+ });
63
+ };
64
+
65
+ var toggleActionsMenu = function toggleActionsMenu(name, value) {
66
+ return setOptionFile(function (prev) {
67
+ if (prev.value) return {
68
+ name: '',
69
+ value: ''
70
+ };
71
+ return {
72
+ name: name,
73
+ value: value
74
+ };
75
+ });
76
+ };
77
+
78
+ var _useReferencedContact = (0, _useReferencedContactName.default)(file),
79
+ contacts = _useReferencedContact.contacts,
80
+ isLoadingContacts = _useReferencedContact.isLoadingContacts;
81
+
82
+ if (isLoadingContacts) {
83
+ return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
84
+ className: "u-pl-2 u-pr-3"
85
+ }, /*#__PURE__*/_react.default.createElement(_Spinner.default, {
86
+ color: "var(--secondaryTextColor)"
87
+ }));
88
+ }
89
+
90
+ var formattedTitle = (0, _paper.getTranslatedNameForContact)({
91
+ lang: lang
92
+ });
93
+ var formattedValue = (0, _paper.formatContactValue)(contacts);
94
+
95
+ if (!isLoadingContacts && !formattedValue) {
96
+ return null;
97
+ }
98
+
99
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
100
+ className: "u-ph-2"
101
+ }, /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
102
+ primary: formattedTitle,
103
+ secondary: formattedValue
104
+ }), /*#__PURE__*/_react.default.createElement(_ListItemSecondaryAction.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
105
+ ref: actionBtnRef,
106
+ onClick: function onClick() {
107
+ return toggleActionsMenu('contact', formattedValue);
108
+ }
109
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
110
+ icon: _Dots.default
111
+ })))), optionFile.value && /*#__PURE__*/_react.default.createElement(_ActionMenuWrapper.default, {
112
+ onClose: hideActionsMenu,
113
+ file: file,
114
+ optionFile: optionFile,
115
+ ref: actionBtnRef
116
+ }));
117
+ };
118
+
119
+ QualificationListItemContact.propTypes = {
120
+ file: _propTypes.default.object.isRequired
121
+ };
122
+ var _default = QualificationListItemContact;
123
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ export default QualificationListItemDate;
2
+ declare const QualificationListItemDate: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _paper = require("cozy-client/dist/models/paper");
15
+
16
+ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
17
+
18
+ var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
19
+
20
+ var _Dots = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Dots"));
21
+
22
+ var _ListItem = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItem"));
23
+
24
+ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemSecondaryAction"));
25
+
26
+ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
27
+
28
+ var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
29
+
30
+ var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
31
+
32
+ var _ExpirationAnnotation = _interopRequireDefault(require("../components/ExpirationAnnotation"));
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
38
+ var QualificationListItemDate = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
39
+ var file = _ref.file,
40
+ formattedMetadataQualification = _ref.formattedMetadataQualification,
41
+ toggleActionsMenu = _ref.toggleActionsMenu;
42
+
43
+ var _useI18n = (0, _I18n.useI18n)(),
44
+ f = _useI18n.f,
45
+ lang = _useI18n.lang;
46
+
47
+ var name = formattedMetadataQualification.name,
48
+ value = formattedMetadataQualification.value;
49
+ var formattedTitle = (0, _paper.getTranslatedNameForDateMetadata)(name, {
50
+ lang: lang
51
+ });
52
+ var formattedDate = (0, _paper.formatDateMetadataValue)(value, {
53
+ f: f,
54
+ lang: lang
55
+ });
56
+ var isExpirationDate = name === 'expirationDate';
57
+ return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
58
+ className: "u-pl-2 u-pr-3"
59
+ }, /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
60
+ primary: formattedTitle,
61
+ secondary: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
62
+ component: "span",
63
+ variant: "inherit"
64
+ }, formattedDate), isExpirationDate && ((0, _paper.isExpired)(file) || (0, _paper.isExpiringSoon)(file)) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
65
+ component: "span",
66
+ variant: "inherit"
67
+ }, ' · '), /*#__PURE__*/_react.default.createElement(_ExpirationAnnotation.default, {
68
+ file: file
69
+ }))),
70
+ disabled: !value
71
+ }), /*#__PURE__*/_react.default.createElement(_ListItemSecondaryAction.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
72
+ ref: ref,
73
+ onClick: function onClick() {
74
+ return toggleActionsMenu(formattedDate);
75
+ }
76
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
77
+ icon: _Dots.default
78
+ }))));
79
+ });
80
+ QualificationListItemDate.displayName = 'QualificationListItemDate';
81
+ QualificationListItemDate.propTypes = {
82
+ file: _propTypes.default.object.isRequired,
83
+ formattedMetadataQualification: _propTypes.default.shape({
84
+ name: _propTypes.default.string,
85
+ value: _propTypes.default.string
86
+ }).isRequired,
87
+ toggleActionsMenu: _propTypes.default.func.isRequired
88
+ };
89
+ var _default = QualificationListItemDate;
90
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ export default QualificationListItemInformation;
2
+ declare const QualificationListItemInformation: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _paper = require("cozy-client/dist/models/paper");
15
+
16
+ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
17
+
18
+ var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
19
+
20
+ var _Dots = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Dots"));
21
+
22
+ var _ListItem = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItem"));
23
+
24
+ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemSecondaryAction"));
25
+
26
+ var _MidEllipsis = _interopRequireDefault(require("cozy-ui/transpiled/react/MidEllipsis"));
27
+
28
+ var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
29
+
30
+ var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
36
+ var QualificationListItemInformation = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
37
+ var formattedMetadataQualification = _ref.formattedMetadataQualification,
38
+ file = _ref.file,
39
+ toggleActionsMenu = _ref.toggleActionsMenu;
40
+
41
+ var _useI18n = (0, _I18n.useI18n)(),
42
+ lang = _useI18n.lang;
43
+
44
+ var name = formattedMetadataQualification.name,
45
+ value = formattedMetadataQualification.value;
46
+ var qualificationLabel = file.metadata.qualification.label;
47
+ var formattedTitle = (0, _paper.getTranslatedNameForInformationMetadata)(name, {
48
+ lang: lang,
49
+ qualificationLabel: qualificationLabel
50
+ });
51
+ var formattedValue = (0, _paper.formatInformationMetadataValue)(value, {
52
+ lang: lang,
53
+ name: name,
54
+ qualificationLabel: qualificationLabel
55
+ });
56
+ var titleComponent = formattedTitle === name ? /*#__PURE__*/_react.default.createElement(_MidEllipsis.default, {
57
+ text: name
58
+ }) : formattedTitle;
59
+ return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
60
+ className: "u-pl-2 u-pr-3"
61
+ }, /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
62
+ primary: titleComponent,
63
+ secondary: formattedValue,
64
+ disabled: !value
65
+ }), /*#__PURE__*/_react.default.createElement(_ListItemSecondaryAction.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
66
+ ref: ref,
67
+ onClick: function onClick() {
68
+ return toggleActionsMenu(value);
69
+ },
70
+ "data-testid": "toggleActionsMenuBtn"
71
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
72
+ icon: _Dots.default
73
+ }))));
74
+ });
75
+ QualificationListItemInformation.displayName = 'QualificationListItemNumber';
76
+ QualificationListItemInformation.propTypes = {
77
+ formattedMetadataQualification: _propTypes.default.shape({
78
+ name: _propTypes.default.string,
79
+ value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
80
+ }).isRequired,
81
+ toggleActionsMenu: _propTypes.default.func.isRequired
82
+ };
83
+ var _default = QualificationListItemInformation;
84
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ export default QualificationListItemOther;
2
+ declare const QualificationListItemOther: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _paper = require("cozy-client/dist/models/paper");
15
+
16
+ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
17
+
18
+ var _IconButton = _interopRequireDefault(require("cozy-ui/transpiled/react/IconButton"));
19
+
20
+ var _Dots = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Dots"));
21
+
22
+ var _ListItem = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItem"));
23
+
24
+ var _ListItemSecondaryAction = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemSecondaryAction"));
25
+
26
+ var _MidEllipsis = _interopRequireDefault(require("cozy-ui/transpiled/react/MidEllipsis"));
27
+
28
+ var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
29
+
30
+ var _QualificationListItemText = _interopRequireDefault(require("./QualificationListItemText"));
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
36
+ var QualificationListItemOther = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
37
+ var formattedMetadataQualification = _ref.formattedMetadataQualification,
38
+ toggleActionsMenu = _ref.toggleActionsMenu;
39
+
40
+ var _useI18n = (0, _I18n.useI18n)(),
41
+ lang = _useI18n.lang;
42
+
43
+ var name = formattedMetadataQualification.name,
44
+ value = formattedMetadataQualification.value;
45
+ if (!value) return null;
46
+ var formattedTitle = (0, _paper.getTranslatedNameForOtherMetadata)(name, {
47
+ lang: lang
48
+ });
49
+ var formattedValue = (0, _paper.formatOtherMetadataValue)(value, {
50
+ lang: lang,
51
+ name: name
52
+ });
53
+ return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
54
+ className: "u-pl-2 u-pr-3"
55
+ }, /*#__PURE__*/_react.default.createElement(_QualificationListItemText.default, {
56
+ primary: formattedTitle,
57
+ secondary: /*#__PURE__*/_react.default.createElement(_MidEllipsis.default, {
58
+ text: formattedValue
59
+ })
60
+ }), /*#__PURE__*/_react.default.createElement(_ListItemSecondaryAction.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
61
+ ref: ref,
62
+ onClick: function onClick() {
63
+ return toggleActionsMenu(formattedValue);
64
+ }
65
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
66
+ icon: _Dots.default
67
+ }))));
68
+ });
69
+ QualificationListItemOther.displayName = 'QualificationListItemOther';
70
+ QualificationListItemOther.propTypes = {
71
+ formattedMetadataQualification: _propTypes.default.shape({
72
+ name: _propTypes.default.string,
73
+ value: _propTypes.default.string
74
+ }).isRequired,
75
+ toggleActionsMenu: _propTypes.default.func.isRequired
76
+ };
77
+ var _default = QualificationListItemOther;
78
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ export default QualificationListItemText;
2
+ declare function QualificationListItemText({ primary, secondary, disabled }: {
3
+ primary: any;
4
+ secondary: any;
5
+ disabled: any;
6
+ }): JSX.Element;
7
+ declare namespace QualificationListItemText {
8
+ namespace propTypes {
9
+ const primary: PropTypes.Validator<string>;
10
+ const secondary: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
11
+ }
12
+ }
13
+ import PropTypes from "prop-types";
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _ListItemText = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemText"));
15
+
16
+ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
17
+
18
+ var QualificationListItemText = function QualificationListItemText(_ref) {
19
+ var primary = _ref.primary,
20
+ secondary = _ref.secondary,
21
+ disabled = _ref.disabled;
22
+ return /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
23
+ disableTypography: true,
24
+ primary: /*#__PURE__*/_react.default.createElement(_Typography.default, {
25
+ variant: "caption"
26
+ }, primary),
27
+ secondary: /*#__PURE__*/_react.default.createElement(_Typography.default, {
28
+ component: "div",
29
+ variant: "body1",
30
+ style: disabled ? {
31
+ color: 'var(--disabledTextColor)'
32
+ } : undefined
33
+ }, secondary)
34
+ });
35
+ };
36
+
37
+ QualificationListItemText.propTypes = {
38
+ primary: _propTypes.default.string.isRequired,
39
+ secondary: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
40
+ };
41
+ var _default = QualificationListItemText;
42
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ export function getPanelBlocksSpecs(isPublic?: boolean): PanelBlocksSpecs;
2
+ export default getPanelBlocks;
3
+ export type PanelBlockSpec = {
4
+ /**
5
+ * - Function that returns true if the block should be displayed
6
+ */
7
+ condition: Function;
8
+ /**
9
+ * - Component to display
10
+ */
11
+ component: React.Component;
12
+ };
13
+ export type PanelBlocksSpecs = {
14
+ [x: string]: PanelBlockSpec;
15
+ };
16
+ /**
17
+ * Returns the blocks to display in the panel
18
+ * @param {Object} options
19
+ * @param {PanelBlocksSpecs} options.panelBlocksSpecs - Specs of the blocks to display in the panel
20
+ * @param {import('cozy-client/types/types').FileDocument} options.file - File object
21
+ * @returns {Array.<React.Component>}
22
+ */
23
+ declare function getPanelBlocks({ panelBlocksSpecs, file }: {
24
+ panelBlocksSpecs: PanelBlocksSpecs;
25
+ file: import('cozy-client/types/types').FileDocument;
26
+ }): Array<React.Component>;