cozy-ui-plus 3.1.2 → 4.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 (119) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/AppSections/Sections.js +5 -7
  3. package/dist/AppSections/components/AppsSection.js +2 -2
  4. package/dist/AppTile/index.js +3 -3
  5. package/dist/Contacts/AddModal/ContactAddressDialog/index.js +4 -4
  6. package/dist/Contacts/AddModal/ContactForm/FieldInput.js +6 -10
  7. package/dist/Contacts/AddModal/ContactForm/FieldInputAccordion.js +4 -4
  8. package/dist/Contacts/AddModal/ContactForm/FieldInputArray.js +7 -9
  9. package/dist/Contacts/AddModal/ContactForm/FieldInputLayout.js +6 -8
  10. package/dist/Contacts/AddModal/ContactForm/FieldInputWrapper.js +1 -1
  11. package/dist/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.js +3 -3
  12. package/dist/Contacts/AddModal/ContactForm/TextFieldSelect.js +4 -4
  13. package/dist/Contacts/AddModal/ContactForm/helpers.js +90 -33
  14. package/dist/Contacts/AddModal/ContactForm/index.js +10 -5
  15. package/dist/Contacts/AddModal/ContactForm/locales/index.js +4 -4
  16. package/dist/Contacts/AddModal/CustomLabelDialog/index.js +4 -4
  17. package/dist/Contacts/AddModal/index.js +4 -4
  18. package/dist/Contacts/GroupsSelect/GroupCreation.js +3 -3
  19. package/dist/Contacts/GroupsSelect/GroupsSelectProvider.js +3 -3
  20. package/dist/Contacts/GroupsSelect/SelectBox/Control.js +4 -4
  21. package/dist/Contacts/GroupsSelect/useGroupSelect.js +4 -4
  22. package/dist/Contacts/Header/GroupsSelection.js +4 -4
  23. package/dist/Contacts/Header/ImportDropdown.js +4 -4
  24. package/dist/Contacts/Header/index.js +4 -4
  25. package/dist/ContactsList/Contacts/ContactIdentity.js +4 -4
  26. package/dist/ContactsList/ContactsList.js +3 -3
  27. package/dist/ContactsList/locales/withContactsListLocales.js +2 -4
  28. package/dist/ContactsListModal/ContactsListContent.js +3 -3
  29. package/dist/ContactsListModal/ContactsListModal.js +3 -3
  30. package/dist/ContactsListModal/withContactsListLocales.js +2 -4
  31. package/dist/Dialogs/AuthentificationDialog/index.js +2 -2
  32. package/dist/Dialogs/AuthentificationDialog/withSpecificDialogsLocales.js +2 -4
  33. package/dist/FilePicker/FilePickerBodyItem.js +3 -3
  34. package/dist/FilePicker/FilePickerFooter.js +3 -3
  35. package/dist/FilePicker/docs/DemoProvider.js +3 -3
  36. package/dist/ListItem/ExpandedAttributes/ExpandedAttribute.js +3 -3
  37. package/dist/ListItem/ExpandedAttributes/index.js +3 -3
  38. package/dist/ListItem/ListItemBase/Renaming/RenameDialog.js +3 -3
  39. package/dist/ListItem/ListItemFile/ExpirationAnnotation.js +3 -3
  40. package/dist/ListItem/ListItemFile/SecondaryText.js +3 -3
  41. package/dist/ListItem/hoc/withListItemLocales.js +2 -4
  42. package/dist/Paywall/Paywall.js +3 -3
  43. package/dist/Paywall/locales/withPaywallLocales.js +2 -4
  44. package/dist/Qualification/QualificationGrid/index.js +3 -3
  45. package/dist/Qualification/QualificationGrid/locales/withLocales.js +2 -4
  46. package/dist/Qualification/QualificationModal/index.js +4 -4
  47. package/dist/Storage/StorageButton.js +4 -4
  48. package/dist/Storage/StorageProgress.js +4 -4
  49. package/dist/UploadQueue/Item.js +3 -3
  50. package/dist/UploadQueue/Pending.js +3 -3
  51. package/dist/UploadQueue/RemainingTime.js +3 -3
  52. package/dist/UploadQueue/index.js +4 -6
  53. package/dist/src/Contacts/AddModal/ContactForm/FieldInput.d.ts +2 -6
  54. package/dist/src/Contacts/AddModal/ContactForm/FieldInputArray.d.ts +2 -6
  55. package/dist/src/Contacts/AddModal/ContactForm/helpers.d.ts +4 -2
  56. package/dist/test/I18n.d.ts +1 -1
  57. package/package.json +7 -5
  58. package/src/AppSections/Readme.md +1 -1
  59. package/src/AppSections/Sections.jsx +1 -2
  60. package/src/AppSections/components/AppsSection.jsx +1 -1
  61. package/src/AppSections/helpers.spec.js +1 -1
  62. package/src/AppTile/AppTile.spec.jsx +1 -2
  63. package/src/AppTile/Readme.md +1 -1
  64. package/src/AppTile/index.jsx +1 -1
  65. package/src/Contacts/AddModal/ContactAddressDialog/index.jsx +1 -1
  66. package/src/Contacts/AddModal/ContactForm/FieldInput.jsx +4 -9
  67. package/src/Contacts/AddModal/ContactForm/FieldInputAccordion.jsx +1 -1
  68. package/src/Contacts/AddModal/ContactForm/FieldInputArray.jsx +8 -5
  69. package/src/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +4 -4
  70. package/src/Contacts/AddModal/ContactForm/FieldInputWrapper.jsx +1 -1
  71. package/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.jsx +1 -2
  72. package/src/Contacts/AddModal/ContactForm/TextFieldSelect.jsx +1 -1
  73. package/src/Contacts/AddModal/ContactForm/helpers.js +65 -17
  74. package/src/Contacts/AddModal/ContactForm/helpers.spec.js +344 -1
  75. package/src/Contacts/AddModal/ContactForm/index.jsx +11 -6
  76. package/src/Contacts/AddModal/ContactForm/locales/en.json +1 -1
  77. package/src/Contacts/AddModal/ContactForm/locales/fr.json +1 -1
  78. package/src/Contacts/AddModal/ContactForm/locales/ru.json +1 -1
  79. package/src/Contacts/AddModal/ContactForm/locales/vi.json +1 -1
  80. package/src/Contacts/AddModal/CustomLabelDialog/index.jsx +1 -1
  81. package/src/Contacts/AddModal/index.jsx +1 -1
  82. package/src/Contacts/GroupsSelect/GroupCreation.jsx +1 -1
  83. package/src/Contacts/GroupsSelect/GroupsSelectProvider.jsx +1 -2
  84. package/src/Contacts/GroupsSelect/SelectBox/Control.jsx +1 -1
  85. package/src/Contacts/GroupsSelect/useGroupSelect.jsx +1 -1
  86. package/src/Contacts/Header/GroupsSelection.jsx +1 -1
  87. package/src/Contacts/Header/ImportDropdown.jsx +1 -1
  88. package/src/Contacts/Header/index.jsx +1 -1
  89. package/src/ContactsList/Contacts/ContactIdentity.jsx +1 -1
  90. package/src/ContactsList/ContactsList.jsx +1 -1
  91. package/src/ContactsList/locales/withContactsListLocales.jsx +1 -1
  92. package/src/ContactsListModal/ContactsListContent.jsx +1 -1
  93. package/src/ContactsListModal/ContactsListModal.jsx +1 -1
  94. package/src/ContactsListModal/Readme.md +1 -1
  95. package/src/ContactsListModal/withContactsListLocales.jsx +1 -1
  96. package/src/Dialogs/AuthentificationDialog/index.jsx +1 -1
  97. package/src/Dialogs/AuthentificationDialog/withSpecificDialogsLocales.jsx +1 -1
  98. package/src/FilePicker/FilePickerBodyItem.jsx +1 -1
  99. package/src/FilePicker/FilePickerFooter.jsx +1 -1
  100. package/src/FilePicker/docs/DemoProvider.jsx +1 -1
  101. package/src/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +1 -1
  102. package/src/ListItem/ExpandedAttributes/index.jsx +1 -1
  103. package/src/ListItem/ListItemBase/Renaming/RenameDialog.jsx +1 -1
  104. package/src/ListItem/ListItemFile/ExpirationAnnotation.jsx +1 -1
  105. package/src/ListItem/ListItemFile/SecondaryText.jsx +1 -1
  106. package/src/ListItem/hoc/withListItemLocales.jsx +1 -1
  107. package/src/Paywall/Paywall.jsx +1 -1
  108. package/src/Paywall/locales/withPaywallLocales.jsx +1 -1
  109. package/src/Qualification/QualificationGrid/index.jsx +1 -1
  110. package/src/Qualification/QualificationGrid/locales/withLocales.jsx +1 -1
  111. package/src/Qualification/QualificationModal/index.jsx +1 -1
  112. package/src/Storage/StorageButton.jsx +1 -1
  113. package/src/Storage/StorageProgress.jsx +1 -1
  114. package/src/UploadQueue/Item.jsx +1 -1
  115. package/src/UploadQueue/Pending.jsx +1 -1
  116. package/src/UploadQueue/RemainingTime.jsx +1 -1
  117. package/src/UploadQueue/index.jsx +1 -2
  118. package/src/UploadQueue/index.spec.jsx +48 -34
  119. package/test/I18n.js +1 -1
@@ -19,6 +19,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
+ var _twakeI18n = require("twake-i18n");
23
+
22
24
  var _cozyClient = require("cozy-client");
23
25
 
24
26
  var _instance = require("cozy-client/dist/models/instance");
@@ -41,8 +43,6 @@ var _Spinner = _interopRequireDefault(require("cozy-ui/transpiled/react/Spinner"
41
43
 
42
44
  var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
43
45
 
44
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
45
-
46
46
  var _helpers = require("./helpers");
47
47
 
48
48
  var _withPaywallLocales = _interopRequireDefault(require("./locales/withPaywallLocales"));
@@ -66,7 +66,7 @@ var Paywall = function Paywall(_ref) {
66
66
  contentInterpolation = _ref.contentInterpolation;
67
67
  var instanceInfo = (0, _cozyClient.useInstanceInfo)();
68
68
 
69
- var _useI18n = (0, _I18n.useI18n)(),
69
+ var _useI18n = (0, _twakeI18n.useI18n)(),
70
70
  t = _useI18n.t;
71
71
 
72
72
  var webviewIntent = (0, _cozyIntent.useWebviewIntent)();
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _withOnlyLocales = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/I18n/withOnlyLocales"));
8
+ var _twakeI18n = require("twake-i18n");
11
9
 
12
10
  var en = {
13
11
  action: {
@@ -444,6 +442,6 @@ var locales = {
444
442
  vi: vi
445
443
  };
446
444
 
447
- var _default = (0, _withOnlyLocales.default)(locales);
445
+ var _default = (0, _twakeI18n.withOnlyLocales)(locales);
448
446
 
449
447
  exports.default = _default;
@@ -13,6 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
+ var _twakeI18n = require("twake-i18n");
17
+
16
18
  var _Grid = _interopRequireDefault(require("cozy-ui/transpiled/react/Grid"));
17
19
 
18
20
  var _Bank = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Bank"));
@@ -35,8 +37,6 @@ var _Team = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Team"
35
37
 
36
38
  var _Work = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Work"));
37
39
 
38
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
39
-
40
40
  var _helpers = require("./helpers");
41
41
 
42
42
  var _QualificationItem = _interopRequireDefault(require("../QualificationItem"));
@@ -67,7 +67,7 @@ var QualificationGrid = function QualificationGrid(_ref) {
67
67
  onClick = _ref.onClick;
68
68
  var themesList = (0, _helpers.getThemesList)(noHealth);
69
69
 
70
- var _useI18n = (0, _I18n.useI18n)(),
70
+ var _useI18n = (0, _twakeI18n.useI18n)(),
71
71
  t = _useI18n.t;
72
72
 
73
73
  var _useState = (0, _react.useState)(),
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.locales = exports.default = void 0;
9
7
 
10
- var _withOnlyLocales = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/I18n/withOnlyLocales"));
8
+ var _twakeI18n = require("twake-i18n");
11
9
 
12
10
  var en = {
13
11
  themes: {
@@ -77,6 +75,6 @@ var locales = {
77
75
  };
78
76
  exports.locales = locales;
79
77
 
80
- var _default = (0, _withOnlyLocales.default)(locales);
78
+ var _default = (0, _twakeI18n.withOnlyLocales)(locales);
81
79
 
82
80
  exports.default = _default;
@@ -15,14 +15,14 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
 
18
+ var _twakeI18n = require("twake-i18n");
19
+
18
20
  var _cozyClient = require("cozy-client");
19
21
 
20
22
  var _qualification = require("cozy-client/dist/models/document/qualification");
21
23
 
22
24
  var _NestedSelectResponsive = _interopRequireDefault(require("cozy-ui/transpiled/react/NestedSelect/NestedSelectResponsive"));
23
25
 
24
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
25
-
26
26
  var _helpers = require("./helpers");
27
27
 
28
28
  var _locales = require("./locales");
@@ -38,10 +38,10 @@ var QualificationModal = function QualificationModal(_ref) {
38
38
  title = _ref.title,
39
39
  noDataLabel = _ref.noDataLabel,
40
40
  onClose = _ref.onClose;
41
- (0, _I18n.useExtendI18n)(_locales.locales);
41
+ (0, _twakeI18n.useExtendI18n)(_locales.locales);
42
42
  var client = (0, _cozyClient.useClient)();
43
43
 
44
- var _useI18n = (0, _I18n.useI18n)(),
44
+ var _useI18n = (0, _twakeI18n.useI18n)(),
45
45
  t = _useI18n.t,
46
46
  lang = _useI18n.lang;
47
47
 
@@ -11,6 +11,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
14
+ var _twakeI18n = require("twake-i18n");
15
+
14
16
  var _cozyClient = require("cozy-client");
15
17
 
16
18
  var _instance = require("cozy-client/dist/models/instance");
@@ -21,15 +23,13 @@ var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
21
23
 
22
24
  var _TwakeWorkplace = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/TwakeWorkplace"));
23
25
 
24
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
25
-
26
26
  var _locales = require("./locales");
27
27
 
28
28
  var StorageButton = function StorageButton(_ref) {
29
29
  var className = _ref.className;
30
- (0, _I18n.useExtendI18n)(_locales.locales);
30
+ (0, _twakeI18n.useExtendI18n)(_locales.locales);
31
31
 
32
- var _useI18n = (0, _I18n.useI18n)(),
32
+ var _useI18n = (0, _twakeI18n.useI18n)(),
33
33
  t = _useI18n.t;
34
34
 
35
35
  var instanceInfo = (0, _cozyClient.useInstanceInfo)();
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
+ var _twakeI18n = require("twake-i18n");
13
+
12
14
  var _cozyClient = require("cozy-client");
13
15
 
14
16
  var _instance = require("cozy-client/dist/models/instance");
@@ -21,8 +23,6 @@ var _LinearProgress = _interopRequireDefault(require("cozy-ui/transpiled/react/L
21
23
 
22
24
  var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
23
25
 
24
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
25
-
26
26
  var _locales = require("./locales");
27
27
 
28
28
  /**
@@ -31,9 +31,9 @@ var _locales = require("./locales");
31
31
  var StorageProgress = function StorageProgress() {
32
32
  var _diskUsage$data, _diskUsage$data2;
33
33
 
34
- (0, _I18n.useExtendI18n)(_locales.locales);
34
+ (0, _twakeI18n.useExtendI18n)(_locales.locales);
35
35
 
36
- var _useI18n = (0, _I18n.useI18n)(),
36
+ var _useI18n = (0, _twakeI18n.useI18n)(),
37
37
  t = _useI18n.t;
38
38
 
39
39
  var _useInstanceInfo = (0, _cozyClient.useInstanceInfo)(),
@@ -13,6 +13,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
 
16
+ var _twakeI18n = require("twake-i18n");
17
+
16
18
  var _file = require("cozy-client/dist/models/file");
17
19
 
18
20
  var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
@@ -27,8 +29,6 @@ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typog
27
29
 
28
30
  var _Media = require("cozy-ui/transpiled/react/deprecated/Media");
29
31
 
30
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
31
-
32
32
  var _FileUploadProgress = _interopRequireDefault(require("./FileUploadProgress"));
33
33
 
34
34
  var _Pending = _interopRequireDefault(require("./Pending"));
@@ -127,6 +127,6 @@ var Item = function Item(_ref) {
127
127
  }), statusIcon && /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Media.Img, null, statusIcon)), isPending && /*#__PURE__*/_react.default.createElement(_Pending.default, null));
128
128
  };
129
129
 
130
- var _default = (0, _I18n.translate)()(Item);
130
+ var _default = (0, _twakeI18n.translate)()(Item);
131
131
 
132
132
  exports.default = _default;
@@ -9,11 +9,11 @@ exports.default = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
12
+ var _twakeI18n = require("twake-i18n");
13
13
 
14
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
14
+ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
15
15
 
16
- var Pending = (0, _I18n.translate)()(function (props) {
16
+ var Pending = (0, _twakeI18n.translate)()(function (props) {
17
17
  return /*#__PURE__*/_react.default.createElement(_Typography.default, {
18
18
  variant: "subtitle1",
19
19
  color: "primary"
@@ -11,9 +11,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
14
- var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
14
+ var _twakeI18n = require("twake-i18n");
15
15
 
16
- var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
16
+ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
17
17
 
18
18
  var _helpers = require("./helpers");
19
19
 
@@ -43,7 +43,7 @@ var styles = {
43
43
  var RemainingTime = function RemainingTime(_ref) {
44
44
  var durationInSec = _ref.durationInSec;
45
45
 
46
- var _useI18n = (0, _I18n.useI18n)(),
46
+ var _useI18n = (0, _twakeI18n.useI18n)(),
47
47
  t = _useI18n.t;
48
48
 
49
49
  return /*#__PURE__*/_react.default.createElement(_Typography.default, {
@@ -27,6 +27,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
27
27
 
28
28
  var _react = _interopRequireWildcard(require("react"));
29
29
 
30
+ var _twakeI18n = require("twake-i18n");
31
+
30
32
  var _LinearProgress = _interopRequireDefault(require("cozy-ui/transpiled/react/LinearProgress"));
31
33
 
32
34
  var _List = _interopRequireDefault(require("cozy-ui/transpiled/react/List"));
@@ -35,10 +37,6 @@ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typog
35
37
 
36
38
  var _Button = _interopRequireDefault(require("cozy-ui/transpiled/react/deprecated/Button"));
37
39
 
38
- var _format = require("cozy-ui/transpiled/react/providers/I18n/format");
39
-
40
- var _withLocales = _interopRequireDefault(require("cozy-ui/transpiled/react/providers/I18n/withLocales"));
41
-
42
40
  var _styles = require("cozy-ui/transpiled/react/styles");
43
41
 
44
42
  var _Item = _interopRequireDefault(require("./Item"));
@@ -156,7 +154,7 @@ exports.uploadStatus = uploadStatus;
156
154
 
157
155
  var formatRemainingTime = function formatRemainingTime(durationInSec) {
158
156
  var later = Date.now() + durationInSec * 1000;
159
- return (0, _format.formatLocallyDistanceToNow)(later);
157
+ return (0, _twakeI18n.formatLocallyDistanceToNow)(later);
160
158
  };
161
159
 
162
160
  exports.formatRemainingTime = formatRemainingTime;
@@ -272,6 +270,6 @@ UploadQueue.defaultProps = {
272
270
  popover: true
273
271
  };
274
272
 
275
- var _default = (0, _withLocales.default)(locales)(UploadQueue);
273
+ var _default = (0, _twakeI18n.withLocales)(locales)(UploadQueue);
276
274
 
277
275
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  export default FieldInput;
2
- declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, isInvisible, required }: {
2
+ declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, isInvisible }: {
3
3
  name: any;
4
4
  labelProps: any;
5
5
  className: any;
@@ -12,7 +12,6 @@ declare function FieldInput({ name, labelProps, className, attributes: { subFiel
12
12
  helperText: any;
13
13
  label: any;
14
14
  isInvisible: any;
15
- required: any;
16
15
  }): JSX.Element;
17
16
  declare namespace FieldInput {
18
17
  namespace propTypes {
@@ -26,12 +25,9 @@ declare namespace FieldInput {
26
25
  }>>;
27
26
  export let id: PropTypes.Requireable<string>;
28
27
  export let label: PropTypes.Requireable<string>;
29
- export let required: PropTypes.Requireable<boolean>;
30
28
  }
31
29
  namespace defaultProps {
32
- export let labelProps: any;
33
- let required_1: boolean;
34
- export { required_1 as required };
30
+ let labelProps: any;
35
31
  }
36
32
  }
37
33
  import PropTypes from 'prop-types';
@@ -1,14 +1,10 @@
1
1
  export default FieldInputArray;
2
- declare function FieldInputArray({ attributes: { name, label, ...restAttributes }, contacts, formProps: { valid, submitFailed, errors } }: {
2
+ declare function FieldInputArray({ attributes: { name, label, ...restAttributes }, contacts, formProps }: {
3
3
  attributes: {
4
4
  [x: string]: any;
5
5
  name: any;
6
6
  label: any;
7
7
  };
8
8
  contacts: any;
9
- formProps: {
10
- valid: any;
11
- submitFailed: any;
12
- errors: any;
13
- };
9
+ formProps: any;
14
10
  }): JSX.Element;
@@ -1,5 +1,7 @@
1
- export const fieldsRequired: string[];
2
- export function validateFields(values: object, t: func): object;
1
+ export function getFirstValueIfArray(values: any): {};
2
+ export function hasNoValues(values: object, fields: import("../types").Field[]): boolean;
3
+ export function makeIsRequiredError(required: boolean, formProps: object): boolean;
4
+ export function validateFields(values: object, fields: import("../types").Field[], t: Function): object;
3
5
  export function makeItemLabel(item?: object): string;
4
6
  export function makeTypeAndLabel(itemLabel?: string): {
5
7
  type?: string;
@@ -1,6 +1,6 @@
1
1
  export function I18nContext(options: any): {
2
2
  t: any;
3
- f: (date: any, formatStr: any, opts?: {}) => string | undefined;
3
+ f: (date: any, formatStr: any, opts?: {}) => string;
4
4
  polyglot: any;
5
5
  lang: any;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui-plus",
3
- "version": "3.1.2",
3
+ "version": "4.1.0",
4
4
  "description": "Cozy-ui-plus is an extension of cozy-ui and provides components based on cozy-client",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "cozy-intent": "^2.30.1",
38
38
  "cozy-logger": "^1.17.0",
39
39
  "cozy-stack-client": "^60.1.0",
40
- "cozy-ui": "^134.0.0",
40
+ "cozy-ui": "^135.0.0",
41
41
  "jest": "26.6.3",
42
42
  "jest-canvas-mock": "2.3.1",
43
43
  "jest-environment-jsdom": "26.6.2",
@@ -49,6 +49,7 @@
49
49
  "react-dom": "16.12.0",
50
50
  "react-test-renderer": "16.12.0",
51
51
  "stylus": "0.64.0",
52
+ "twake-i18n": "^0.3.0",
52
53
  "typescript": "5.5.2"
53
54
  },
54
55
  "dependencies": {
@@ -68,9 +69,10 @@
68
69
  "cozy-device-helper": ">=2.0.0",
69
70
  "cozy-intent": ">=2.30.0",
70
71
  "cozy-logger": ">=1.17.0",
71
- "cozy-ui": ">=134.0.0",
72
+ "cozy-ui": ">=135.0.0",
72
73
  "react": "^16 || ^17 || ^18",
73
- "react-dom": "^16 || ^17 || ^18"
74
+ "react-dom": "^16 || ^17 || ^18",
75
+ "twake-i18n": ">=0.3.0"
74
76
  },
75
- "gitHead": "7ec62d8445c373a3cb8de5234eee52d388ff274d"
77
+ "gitHead": "463474b57578fbca2e4fa04165e94abb82627d03"
76
78
  }
@@ -1,7 +1,7 @@
1
1
  ```jsx
2
2
  import { useState } from 'react'
3
3
  import mockApps from './_mockApps'
4
- import { I18n } from 'cozy-ui/transpiled/react/providers/I18n'
4
+ import { I18n } from 'twake-i18n'
5
5
  import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
6
6
  import Sections from 'cozy-ui/transpiled/react/AppSections'
7
7
  import Variants from 'cozy-ui/docs/components/Variants'
@@ -1,11 +1,10 @@
1
1
  import cx from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
3
  import React, { Component } from 'react'
4
+ import { useI18n, useExtendI18n, withOnlyLocales } from 'twake-i18n'
4
5
 
5
6
  import Typography from 'cozy-ui/transpiled/react/Typography'
6
7
  import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
7
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
8
- import withOnlyLocales from 'cozy-ui/transpiled/react/providers/I18n/withOnlyLocales'
9
8
 
10
9
  import styles from './Sections.styl'
11
10
  import * as catUtils from './categories'
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
3
3
  import React, { useMemo } from 'react'
4
4
 
5
5
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
6
- import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
+ import { useI18n } from 'twake-i18n'
7
7
 
8
8
  import styles from './AppsSection.styl'
9
9
  import AppTile from '../../AppTile'
@@ -1,4 +1,4 @@
1
- import { extend as extendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
1
+ import { extend as extendI18n } from 'twake-i18n'
2
2
 
3
3
  import { getTranslatedManifestProperty } from './helpers'
4
4
  import en from './locales/en'
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { render } from '@testing-library/react'
6
6
  import React from 'react'
7
-
8
- import I18n from 'cozy-ui/transpiled/react/providers/I18n'
7
+ import I18n from 'twake-i18n'
9
8
 
10
9
  import AppTile from '.'
11
10
  import en from '../AppSections/locales/en.json'
@@ -4,7 +4,7 @@ a list of apps for example in the Store.
4
4
  ```jsx
5
5
  import AppTile from 'cozy-ui/transpiled/react/AppTile'
6
6
  import mockApps from '../AppSections/_mockApps'
7
- import { I18n } from 'cozy-ui/transpiled/react/providers/I18n'
7
+ import { I18n } from 'twake-i18n'
8
8
  import Grid from 'cozy-ui/transpiled/react/Grid'
9
9
 
10
10
  const locale = {}
@@ -1,6 +1,7 @@
1
1
  import cx from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
3
  import React from 'react'
4
+ import { createUseI18n } from 'twake-i18n'
4
5
 
5
6
  import Icon from 'cozy-ui/transpiled/react/Icon'
6
7
  import WrenchCircleIcon from 'cozy-ui/transpiled/react/Icons/WrenchCircle'
@@ -11,7 +12,6 @@ import Tile, {
11
12
  TileIcon,
12
13
  TileDescription
13
14
  } from 'cozy-ui/transpiled/react/Tile'
14
- import { createUseI18n } from 'cozy-ui/transpiled/react/providers/I18n'
15
15
 
16
16
  import { APP_STATUS, getCurrentStatusLabel } from './helpers'
17
17
  import en from './locales/en.json'
@@ -1,10 +1,10 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import React from 'react'
3
3
  import { Field, useForm } from 'react-final-form'
4
+ import { useI18n, useExtendI18n } from 'twake-i18n'
4
5
 
5
6
  import Button from 'cozy-ui/transpiled/react/Buttons'
6
7
  import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
7
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
8
8
 
9
9
  import { makeFormattedAddressWithSubFields } from './helpers'
10
10
  import { locales } from './locales'
@@ -3,8 +3,7 @@ import uniqueId from 'lodash/uniqueId'
3
3
  import PropTypes from 'prop-types'
4
4
  import React, { useState } from 'react'
5
5
  import { Field } from 'react-final-form'
6
-
7
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
+ import { useI18n, useExtendI18n } from 'twake-i18n'
8
7
 
9
8
  import FieldInputWrapper from './FieldInputWrapper'
10
9
  import HasValueCondition from './HasValueCondition'
@@ -23,8 +22,7 @@ const FieldInput = ({
23
22
  error,
24
23
  helperText,
25
24
  label,
26
- isInvisible,
27
- required
25
+ isInvisible
28
26
  }) => {
29
27
  const [id] = useState(uniqueId('field_')) // state only use to generate id once and not at each render
30
28
  const [hasBeenFocused, setHasBeenFocused] = useState(false)
@@ -58,7 +56,6 @@ const FieldInput = ({
58
56
  )}
59
57
  >
60
58
  <Field
61
- required={required}
62
59
  error={error}
63
60
  helperText={helperText}
64
61
  label={label}
@@ -112,13 +109,11 @@ FieldInput.propTypes = {
112
109
  }),
113
110
  // Destructuring props
114
111
  id: PropTypes.string,
115
- label: PropTypes.string,
116
- required: PropTypes.bool
112
+ label: PropTypes.string
117
113
  }
118
114
 
119
115
  FieldInput.defaultProps = {
120
- labelProps: null,
121
- required: false
116
+ labelProps: null
122
117
  }
123
118
 
124
119
  export default FieldInput
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from 'react'
2
+ import { useI18n, useExtendI18n } from 'twake-i18n'
2
3
 
3
4
  import Icon from 'cozy-ui/transpiled/react/Icon'
4
5
  import IconButton from 'cozy-ui/transpiled/react/IconButton'
5
6
  import DropdownIcon from 'cozy-ui/transpiled/react/Icons/Dropdown'
6
7
  import DropupIcon from 'cozy-ui/transpiled/react/Icons/Dropup'
7
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
8
8
 
9
9
  import FieldInput from './FieldInput'
10
10
  import { locales } from './locales'
@@ -1,6 +1,7 @@
1
1
  import cx from 'classnames'
2
2
  import React from 'react'
3
3
  import { FieldArray } from 'react-final-form-arrays'
4
+ import { useI18n, useExtendI18n } from 'twake-i18n'
4
5
 
5
6
  import Button from 'cozy-ui/transpiled/react/Buttons'
6
7
  import Icon from 'cozy-ui/transpiled/react/Icon'
@@ -8,19 +9,19 @@ import IconButton from 'cozy-ui/transpiled/react/IconButton'
8
9
  import CrossCircleIcon from 'cozy-ui/transpiled/react/Icons/CrossCircle'
9
10
  import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
10
11
  import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
11
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
12
12
 
13
13
  import FieldInput from './FieldInput'
14
- import { fieldsRequired, addField, removeField } from './helpers'
14
+ import { addField, removeField, makeIsRequiredError } from './helpers'
15
15
  import { locales } from './locales'
16
16
 
17
17
  const FieldInputArray = ({
18
18
  attributes: { name, label, ...restAttributes },
19
19
  contacts,
20
- formProps: { valid, submitFailed, errors }
20
+ formProps
21
21
  }) => {
22
22
  useExtendI18n(locales)
23
23
  const { t } = useI18n()
24
+ const { errors } = formProps
24
25
 
25
26
  return (
26
27
  <FieldArray name={name}>
@@ -31,8 +32,10 @@ const FieldInputArray = ({
31
32
  const key = fields.value[index]?.fieldId || nameWithIndex
32
33
  const showRemove = fields.value[index]?.[name]
33
34
  const inputName = `${nameWithIndex}.${name}`
34
- const isError =
35
- fieldsRequired.includes(inputName) && !valid && submitFailed
35
+ const isError = makeIsRequiredError(
36
+ restAttributes.required,
37
+ formProps
38
+ )
36
39
 
37
40
  return (
38
41
  <div
@@ -1,14 +1,14 @@
1
1
  import cx from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
3
  import React from 'react'
4
+ import { useI18n, useExtendI18n } from 'twake-i18n'
4
5
 
5
6
  import Icon from 'cozy-ui/transpiled/react/Icon'
6
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
7
7
 
8
8
  import FieldInput from './FieldInput'
9
9
  import FieldInputAccordion from './FieldInputAccordion'
10
10
  import FieldInputArray from './FieldInputArray'
11
- import { fieldsRequired } from './helpers'
11
+ import { makeIsRequiredError } from './helpers'
12
12
  import { locales } from './locales'
13
13
 
14
14
  const FieldInputLayout = ({
@@ -19,10 +19,10 @@ const FieldInputLayout = ({
19
19
  }) => {
20
20
  useExtendI18n(locales)
21
21
  const { t } = useI18n()
22
- const { valid, submitFailed, errors } = formProps
22
+ const { errors } = formProps
23
23
  const { name, label, ...restAttributes } = attributes
24
24
 
25
- const isError = fieldsRequired.includes(name) && !valid && submitFailed
25
+ const isError = makeIsRequiredError(restAttributes.required, formProps)
26
26
 
27
27
  return (
28
28
  <div
@@ -25,8 +25,8 @@ const FieldInputWrapper = ({
25
25
 
26
26
  return (
27
27
  <Component
28
- {...restAttributes}
29
28
  {...input}
29
+ {...restAttributes}
30
30
  {...props}
31
31
  variant={variant}
32
32
  fullWidth={fullWidth}
@@ -1,6 +1,5 @@
1
1
  import React, { useState } from 'react'
2
-
3
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
2
+ import { useI18n, useExtendI18n } from 'twake-i18n'
4
3
 
5
4
  import TextFieldSelect from './TextFieldSelect'
6
5
  import { makeCustomLabel, makeInitialCustomValue } from './helpers'
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
+ import { useI18n, useExtendI18n } from 'twake-i18n'
2
3
 
3
4
  import MenuItem from 'cozy-ui/transpiled/react/MenuItem'
4
5
  import TextField from 'cozy-ui/transpiled/react/TextField'
5
- import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
6
6
 
7
7
  import { locales } from './locales'
8
8
  import { FieldInputWrapperPropTypes } from '../types'