cozy-ui 128.2.0 → 128.3.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 (99) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +5 -1
  3. package/react/Contacts/AddModal/ContactAddressDialog/helpers.js +22 -0
  4. package/react/Contacts/AddModal/ContactAddressDialog/helpers.spec.js +64 -0
  5. package/react/Contacts/AddModal/ContactAddressDialog/index.jsx +84 -0
  6. package/react/Contacts/AddModal/ContactAddressDialog/locales/en.json +25 -0
  7. package/react/Contacts/AddModal/ContactAddressDialog/locales/fr.json +25 -0
  8. package/react/Contacts/AddModal/ContactAddressDialog/locales/index.jsx +7 -0
  9. package/react/Contacts/AddModal/ContactForm/FieldInput.jsx +117 -0
  10. package/react/Contacts/AddModal/ContactForm/FieldInputArray.jsx +80 -0
  11. package/react/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +65 -0
  12. package/react/Contacts/AddModal/ContactForm/FieldInputWrapper.jsx +41 -0
  13. package/react/Contacts/AddModal/ContactForm/HasValueCondition.jsx +31 -0
  14. package/react/Contacts/AddModal/ContactForm/HasValueCondition.spec.jsx +79 -0
  15. package/react/Contacts/AddModal/ContactForm/RelatedContactList.jsx +37 -0
  16. package/react/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.jsx +78 -0
  17. package/react/Contacts/AddModal/ContactForm/TextFieldSelect.jsx +39 -0
  18. package/react/Contacts/AddModal/ContactForm/__snapshots__/HasValueCondition.spec.jsx.snap +33 -0
  19. package/react/Contacts/AddModal/ContactForm/contactToFormValues.js +99 -0
  20. package/react/Contacts/AddModal/ContactForm/contactToFormValues.spec.js +128 -0
  21. package/react/Contacts/AddModal/ContactForm/fieldsConfig.jsx +341 -0
  22. package/react/Contacts/AddModal/ContactForm/formValuesToContact.js +100 -0
  23. package/react/Contacts/AddModal/ContactForm/formValuesToContact.spec.js +494 -0
  24. package/react/Contacts/AddModal/ContactForm/helpers.js +324 -0
  25. package/react/Contacts/AddModal/ContactForm/helpers.spec.js +152 -0
  26. package/react/Contacts/AddModal/ContactForm/index.jsx +104 -0
  27. package/react/Contacts/AddModal/ContactForm/index.spec.jsx +289 -0
  28. package/react/Contacts/AddModal/ContactForm/locales/en.json +73 -0
  29. package/react/Contacts/AddModal/ContactForm/locales/fr.json +73 -0
  30. package/react/Contacts/AddModal/ContactForm/locales/index.jsx +7 -0
  31. package/react/Contacts/AddModal/ContactForm/styles.styl +2 -0
  32. package/react/Contacts/AddModal/CustomLabelDialog/index.jsx +108 -0
  33. package/react/Contacts/AddModal/CustomLabelDialog/locales/en.json +15 -0
  34. package/react/Contacts/AddModal/CustomLabelDialog/locales/fr.json +15 -0
  35. package/react/Contacts/AddModal/CustomLabelDialog/locales/index.jsx +7 -0
  36. package/react/Contacts/AddModal/Readme.md +46 -0
  37. package/react/Contacts/AddModal/index.jsx +78 -0
  38. package/react/Contacts/AddModal/locales/en.json +13 -0
  39. package/react/Contacts/AddModal/locales/fr.json +13 -0
  40. package/react/Contacts/AddModal/locales/index.jsx +7 -0
  41. package/react/Contacts/AddModal/mocks.js +249 -0
  42. package/react/Contacts/AddModal/types.js +57 -0
  43. package/react/Contacts/Header/Readme.md +0 -2
  44. package/react/providers/DemoProvider.jsx +3 -2
  45. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/helpers.d.ts +4 -0
  46. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/helpers.js +20 -0
  47. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/helpers.spec.d.ts +1 -0
  48. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/index.d.ts +39 -0
  49. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/index.js +87 -0
  50. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/locales/index.d.ts +6 -0
  51. package/transpiled/react/Contacts/AddModal/ContactAddressDialog/locales/index.js +54 -0
  52. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInput.d.ts +35 -0
  53. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInput.js +126 -0
  54. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputArray.d.ts +14 -0
  55. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputArray.js +82 -0
  56. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputLayout.d.ts +20 -0
  57. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputLayout.js +70 -0
  58. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputWrapper.d.ts +16 -0
  59. package/transpiled/react/Contacts/AddModal/ContactForm/FieldInputWrapper.js +31 -0
  60. package/transpiled/react/Contacts/AddModal/ContactForm/HasValueCondition.d.ts +18 -0
  61. package/transpiled/react/Contacts/AddModal/ContactForm/HasValueCondition.js +32 -0
  62. package/transpiled/react/Contacts/AddModal/ContactForm/HasValueCondition.spec.d.ts +1 -0
  63. package/transpiled/react/Contacts/AddModal/ContactForm/RelatedContactList.d.ts +15 -0
  64. package/transpiled/react/Contacts/AddModal/ContactForm/RelatedContactList.js +39 -0
  65. package/transpiled/react/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.d.ts +9 -0
  66. package/transpiled/react/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.js +81 -0
  67. package/transpiled/react/Contacts/AddModal/ContactForm/TextFieldSelect.d.ts +5 -0
  68. package/transpiled/react/Contacts/AddModal/ContactForm/TextFieldSelect.js +42 -0
  69. package/transpiled/react/Contacts/AddModal/ContactForm/contactToFormValues.d.ts +2 -0
  70. package/transpiled/react/Contacts/AddModal/ContactForm/contactToFormValues.js +88 -0
  71. package/transpiled/react/Contacts/AddModal/ContactForm/contactToFormValues.spec.d.ts +1 -0
  72. package/transpiled/react/Contacts/AddModal/ContactForm/fieldsConfig.d.ts +4 -0
  73. package/transpiled/react/Contacts/AddModal/ContactForm/fieldsConfig.js +278 -0
  74. package/transpiled/react/Contacts/AddModal/ContactForm/formValuesToContact.d.ts +6 -0
  75. package/transpiled/react/Contacts/AddModal/ContactForm/formValuesToContact.js +94 -0
  76. package/transpiled/react/Contacts/AddModal/ContactForm/formValuesToContact.spec.d.ts +1 -0
  77. package/transpiled/react/Contacts/AddModal/ContactForm/helpers.d.ts +28 -0
  78. package/transpiled/react/Contacts/AddModal/ContactForm/helpers.js +335 -0
  79. package/transpiled/react/Contacts/AddModal/ContactForm/helpers.spec.d.ts +1 -0
  80. package/transpiled/react/Contacts/AddModal/ContactForm/index.d.ts +11 -0
  81. package/transpiled/react/Contacts/AddModal/ContactForm/index.js +114 -0
  82. package/transpiled/react/Contacts/AddModal/ContactForm/index.spec.d.ts +1 -0
  83. package/transpiled/react/Contacts/AddModal/ContactForm/locales/index.d.ts +6 -0
  84. package/transpiled/react/Contacts/AddModal/ContactForm/locales/index.js +150 -0
  85. package/transpiled/react/Contacts/AddModal/CustomLabelDialog/index.d.ts +22 -0
  86. package/transpiled/react/Contacts/AddModal/CustomLabelDialog/index.js +113 -0
  87. package/transpiled/react/Contacts/AddModal/CustomLabelDialog/locales/index.d.ts +6 -0
  88. package/transpiled/react/Contacts/AddModal/CustomLabelDialog/locales/index.js +34 -0
  89. package/transpiled/react/Contacts/AddModal/index.d.ts +7 -0
  90. package/transpiled/react/Contacts/AddModal/index.js +109 -0
  91. package/transpiled/react/Contacts/AddModal/locales/index.d.ts +6 -0
  92. package/transpiled/react/Contacts/AddModal/locales/index.js +30 -0
  93. package/transpiled/react/Contacts/AddModal/mocks.d.ts +270 -0
  94. package/transpiled/react/Contacts/AddModal/mocks.js +214 -0
  95. package/transpiled/react/Contacts/AddModal/types.d.ts +54 -0
  96. package/transpiled/react/Contacts/AddModal/types.js +49 -0
  97. package/transpiled/react/providers/DemoProvider.d.ts +2 -1
  98. package/transpiled/react/providers/DemoProvider.js +7 -3
  99. package/transpiled/react/stylesheet.css +1 -1
@@ -0,0 +1,214 @@
1
+ export var johnDoeContact = {
2
+ id: '9ecfbf4b-20e7-4bac-87f1-eea53350857d',
3
+ _id: '9ecfbf4b-20e7-4bac-87f1-eea53350857d',
4
+ _type: 'io.cozy.contacts',
5
+ _rev: '1-19c313536e8b27473aa26bf105b03269',
6
+ address: [{
7
+ formattedAddress: '94 Hinton Road 05034 Fresno, Singapore',
8
+ type: 'Home',
9
+ primary: true
10
+ }, {
11
+ pobox: '2',
12
+ street: '426 Runolfsson Knolls',
13
+ city: 'Port Easter',
14
+ region: undefined,
15
+ country: 'Cocos (Keeling) Islands',
16
+ postcode: '84573',
17
+ type: 'Work'
18
+ }],
19
+ email: [{
20
+ address: 'john.doe@posteo.net',
21
+ type: 'personal',
22
+ primary: false
23
+ }, {
24
+ address: 'john.doe@cozycloud.cc',
25
+ primary: true
26
+ }],
27
+ birthday: '1999-5-1',
28
+ birthplace: 'somewhere',
29
+ gender: 'male',
30
+ company: 'Cozy cloud',
31
+ jobTitle: 'Dreamer',
32
+ cozy: [{
33
+ type: 'MyCozy',
34
+ primary: true,
35
+ url: 'https://johndoe.mycozy.cloud'
36
+ }],
37
+ fullname: 'John Doe',
38
+ name: {
39
+ givenName: 'John',
40
+ familyName: 'Doe',
41
+ additionalName: 'J.'
42
+ },
43
+ metadata: {
44
+ cozy: true,
45
+ version: 1
46
+ },
47
+ note: 'Atque cupiditate saepe omnis quos ut molestiae labore voluptates omnis.',
48
+ phone: [{
49
+ number: '+33 (2)0 90 00 54 04',
50
+ primary: true
51
+ }, {
52
+ number: '+33 6 77 11 22 33',
53
+ primary: false
54
+ }]
55
+ };
56
+ export var johnDoeFormValues = {
57
+ birthday: '1999-5-1',
58
+ birthplace: 'somewhere',
59
+ gender: 'male',
60
+ cozy: 'https://johndoe.mycozy.cloud',
61
+ cozyLabel: '{"type":"MyCozy"}',
62
+ address: [{
63
+ fieldId: 'fieldId_1',
64
+ address: '94 Hinton Road 05034 Fresno, Singapore',
65
+ addressLabel: '{"type":"Home"}',
66
+ addressapartment: undefined,
67
+ addressbuilding: undefined,
68
+ addresscity: undefined,
69
+ addresscode: undefined,
70
+ addressregion: undefined,
71
+ addresscountry: undefined,
72
+ addressentrycode: undefined,
73
+ addressfloor: undefined,
74
+ addresslocality: undefined,
75
+ addressnumber: undefined,
76
+ addressstairs: undefined,
77
+ addressstreet: '94 Hinton Road 05034 Fresno, Singapore'
78
+ }, {
79
+ fieldId: 'fieldId_2',
80
+ address: '426 Runolfsson Knolls 84573 Port Easter Cocos (Keeling) Islands',
81
+ addressLabel: '{"type":"Work"}',
82
+ addressapartment: undefined,
83
+ addressbuilding: undefined,
84
+ addresscity: 'Port Easter',
85
+ addressregion: undefined,
86
+ addresscode: '84573',
87
+ addresscountry: 'Cocos (Keeling) Islands',
88
+ addressentrycode: undefined,
89
+ addressfloor: undefined,
90
+ addresslocality: undefined,
91
+ addressnumber: undefined,
92
+ addressstairs: undefined,
93
+ addressstreet: '426 Runolfsson Knolls'
94
+ }],
95
+ email: [{
96
+ fieldId: 'fieldId_3',
97
+ email: 'john.doe@cozycloud.cc',
98
+ emailLabel: undefined
99
+ }, {
100
+ fieldId: 'fieldId_4',
101
+ email: 'john.doe@posteo.net',
102
+ emailLabel: '{"type":"personal"}'
103
+ }],
104
+ phone: [{
105
+ fieldId: 'fieldId_5',
106
+ phone: '+33 (2)0 90 00 54 04',
107
+ phoneLabel: undefined
108
+ }, {
109
+ fieldId: 'fieldId_6',
110
+ phone: '+33 6 77 11 22 33',
111
+ phoneLabel: undefined
112
+ }],
113
+ givenName: 'John',
114
+ additionalName: 'J.',
115
+ familyName: 'Doe',
116
+ company: 'Cozy cloud',
117
+ jobTitle: 'Dreamer',
118
+ note: 'Atque cupiditate saepe omnis quos ut molestiae labore voluptates omnis.',
119
+ relatedContact: [{
120
+ relatedContactId: 'relatedContactID',
121
+ relatedContactLabel: '{"type":"related"}'
122
+ }]
123
+ };
124
+ export var johnDoeContactWithRelated = {
125
+ id: '9ecfbf4b-20e7-4bac-87f1-eea53350857d',
126
+ _id: '9ecfbf4b-20e7-4bac-87f1-eea53350857d',
127
+ _type: 'io.cozy.contacts',
128
+ _rev: '1-19c313536e8b27473aa26bf105b03269',
129
+ address: [{
130
+ formattedAddress: '94 Hinton Road 05034 Fresno, Singapore',
131
+ type: 'Home',
132
+ primary: true
133
+ }, {
134
+ pobox: '2',
135
+ street: '426 Runolfsson Knolls',
136
+ city: 'Port Easter',
137
+ region: undefined,
138
+ country: 'Cocos (Keeling) Islands',
139
+ postcode: '84573',
140
+ type: 'Work'
141
+ }],
142
+ email: [{
143
+ address: 'john.doe@posteo.net',
144
+ type: 'personal',
145
+ primary: false
146
+ }, {
147
+ address: 'john.doe@cozycloud.cc',
148
+ primary: true
149
+ }],
150
+ birthday: '1999-5-1',
151
+ birthplace: 'somewhere',
152
+ gender: 'male',
153
+ company: 'Cozy cloud',
154
+ jobTitle: 'Dreamer',
155
+ cozy: [{
156
+ type: 'MyCozy',
157
+ primary: true,
158
+ url: 'https://johndoe.mycozy.cloud'
159
+ }],
160
+ fullname: 'John Doe',
161
+ name: {
162
+ givenName: 'John',
163
+ familyName: 'Doe',
164
+ additionalName: 'J.'
165
+ },
166
+ metadata: {
167
+ cozy: true,
168
+ version: 1
169
+ },
170
+ note: 'Atque cupiditate saepe omnis quos ut molestiae labore voluptates omnis.',
171
+ phone: [{
172
+ number: '+33 (2)0 90 00 54 04',
173
+ primary: true
174
+ }, {
175
+ number: '+33 6 77 11 22 33',
176
+ primary: false
177
+ }],
178
+ relationships: {
179
+ accounts: {
180
+ data: []
181
+ },
182
+ groups: {
183
+ data: []
184
+ },
185
+ related: {
186
+ data: [{
187
+ metadata: {
188
+ relationTypes: ['spouse']
189
+ },
190
+ _id: '5b49553c5916cf7b5b2a5f48600078a8',
191
+ _type: 'io.cozy.contacts'
192
+ }]
193
+ }
194
+ },
195
+ related: {
196
+ target: {
197
+ id: '4e33fd27e1d8e55a34742bac6d16d3bd',
198
+ _id: '4e33fd27e1d8e55a34742bac6d16d3bd',
199
+ _type: 'io.cozy.contacts',
200
+ _rev: '6-57f4ab78b1fb97bb90ea273ec881f196',
201
+ company: '',
202
+ fullname: 'John Doe',
203
+ me: true,
204
+ note: ''
205
+ },
206
+ name: 'related',
207
+ doctype: 'io.cozy.contacts',
208
+ data: [{
209
+ displayName: 'Alice Doe',
210
+ _id: '5b49553c5916cf7b5b2a5f48600078a8',
211
+ _type: 'io.cozy.contacts'
212
+ }]
213
+ }
214
+ };
@@ -0,0 +1,54 @@
1
+ export const labelPropTypes: PropTypes.Requireable<PropTypes.InferProps<{
2
+ name: PropTypes.Requireable<string>;
3
+ options: PropTypes.Requireable<(PropTypes.InferProps<{
4
+ value: PropTypes.Requireable<string>;
5
+ label: PropTypes.Requireable<string>;
6
+ }> | null)[]>;
7
+ customLabelOptions: PropTypes.Requireable<PropTypes.InferProps<{
8
+ hide: PropTypes.Requireable<boolean>;
9
+ defaultType: PropTypes.Requireable<string>;
10
+ defaultLabel: PropTypes.Requireable<string>;
11
+ }>>;
12
+ }>>;
13
+ export const fieldInputAttributesTypes: PropTypes.Requireable<PropTypes.InferProps<{
14
+ name: PropTypes.Requireable<string>;
15
+ icon: PropTypes.Requireable<string | object>;
16
+ type: PropTypes.Requireable<string>;
17
+ label: PropTypes.Requireable<PropTypes.InferProps<{
18
+ name: PropTypes.Requireable<string>;
19
+ options: PropTypes.Requireable<(PropTypes.InferProps<{
20
+ value: PropTypes.Requireable<string>;
21
+ label: PropTypes.Requireable<string>;
22
+ }> | null)[]>;
23
+ customLabelOptions: PropTypes.Requireable<PropTypes.InferProps<{
24
+ hide: PropTypes.Requireable<boolean>;
25
+ defaultType: PropTypes.Requireable<string>;
26
+ defaultLabel: PropTypes.Requireable<string>;
27
+ }>>;
28
+ }>>;
29
+ isArray: PropTypes.Requireable<boolean>;
30
+ subFields: PropTypes.Requireable<(PropTypes.InferProps<{
31
+ name: PropTypes.Validator<string>;
32
+ icon: PropTypes.Requireable<string>;
33
+ type: PropTypes.Validator<string>;
34
+ }> | null)[]>;
35
+ labelProps: PropTypes.Requireable<PropTypes.InferProps<{
36
+ shrink: PropTypes.Requireable<boolean>;
37
+ }>>;
38
+ }>>;
39
+ export namespace FieldInputWrapperPropTypes {
40
+ export const input: PropTypes.Requireable<object>;
41
+ export { fieldInputAttributesTypes as attributes };
42
+ export const meta: PropTypes.Requireable<object>;
43
+ export const id: PropTypes.Requireable<string>;
44
+ export const label: PropTypes.Requireable<string>;
45
+ export const required: PropTypes.Requireable<boolean>;
46
+ export const variant: PropTypes.Requireable<string>;
47
+ export const customLabelOptions: PropTypes.Requireable<PropTypes.InferProps<{
48
+ hide: PropTypes.Requireable<boolean>;
49
+ defaultType: PropTypes.Validator<string>;
50
+ defaultLabel: PropTypes.Validator<string>;
51
+ }>>;
52
+ export const fullWidth: PropTypes.Requireable<boolean>;
53
+ }
54
+ import PropTypes from "prop-types";
@@ -0,0 +1,49 @@
1
+ import PropTypes from 'prop-types';
2
+ import { iconPropType } from "cozy-ui/transpiled/react/Icon";
3
+ export var labelPropTypes = PropTypes.shape({
4
+ name: PropTypes.string,
5
+ options: PropTypes.arrayOf(PropTypes.shape({
6
+ value: PropTypes.string,
7
+ label: PropTypes.string
8
+ })),
9
+ customLabelOptions: PropTypes.shape({
10
+ hide: PropTypes.bool,
11
+ defaultType: PropTypes.string,
12
+ defaultLabel: PropTypes.string
13
+ })
14
+ });
15
+ export var fieldInputAttributesTypes = PropTypes.shape({
16
+ name: PropTypes.string,
17
+ icon: iconPropType,
18
+ type: PropTypes.string,
19
+ label: labelPropTypes,
20
+ isArray: PropTypes.bool,
21
+ subFields: PropTypes.arrayOf(PropTypes.shape({
22
+ name: PropTypes.string.isRequired,
23
+ icon: PropTypes.string,
24
+ type: PropTypes.string.isRequired
25
+ })),
26
+ labelProps: PropTypes.shape({
27
+ shrink: PropTypes.bool
28
+ })
29
+ });
30
+ export var FieldInputWrapperPropTypes = {
31
+ // See official documentation for more information: https://final-form.org/docs/react-final-form/types/FieldRenderProps
32
+ input: PropTypes.object,
33
+ //
34
+ attributes: fieldInputAttributesTypes,
35
+ // Destructuring props
36
+ // See official documentation for more information: https://final-form.org/docs/react-final-form/types/FieldRenderProps
37
+ meta: PropTypes.object,
38
+ //
39
+ id: PropTypes.string,
40
+ label: PropTypes.string,
41
+ required: PropTypes.bool,
42
+ variant: PropTypes.string,
43
+ customLabelOptions: PropTypes.shape({
44
+ hide: PropTypes.bool,
45
+ defaultType: PropTypes.string.isRequired,
46
+ defaultLabel: PropTypes.string.isRequired
47
+ }),
48
+ fullWidth: PropTypes.bool
49
+ };
@@ -1,6 +1,7 @@
1
1
  export default DemoProvider;
2
- declare function DemoProvider({ client, variant, children }: {
2
+ declare function DemoProvider({ client, variant, dictRequire, children }: {
3
3
  client: any;
4
4
  variant: any;
5
+ dictRequire: any;
5
6
  children: any;
6
7
  }): JSX.Element;
@@ -26,15 +26,19 @@ var defaultClient = {
26
26
  var DemoProvider = function DemoProvider(_ref) {
27
27
  var client = _ref.client,
28
28
  variant = _ref.variant,
29
+ dictRequire = _ref.dictRequire,
29
30
  children = _ref.children;
30
31
  var lang = localStorage.getItem('lang') || 'en';
32
+
33
+ var _dictRequire = dictRequire ? dictRequire : function () {
34
+ return {};
35
+ };
36
+
31
37
  return /*#__PURE__*/React.createElement(CozyProvider, {
32
38
  client: client || defaultClient
33
39
  }, /*#__PURE__*/React.createElement(BreakpointsProvider, null, /*#__PURE__*/React.createElement(I18n, {
34
40
  lang: lang,
35
- dictRequire: function dictRequire() {
36
- return {};
37
- }
41
+ dictRequire: _dictRequire
38
42
  }, /*#__PURE__*/React.createElement(CozyTheme, {
39
43
  variant: variant
40
44
  }, children))));