cozy-ui 128.10.0 → 128.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [128.10.1](https://github.com/cozy/cozy-ui/compare/v128.10.0...v128.10.1) (2025-09-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **AddModal/ContactForm:** Secondary input wasn't hide correctly ([b1fd6b0](https://github.com/cozy/cozy-ui/commit/b1fd6b0))
7
+
1
8
  # [128.10.0](https://github.com/cozy/cozy-ui/compare/v128.9.0...v128.10.0) (2025-09-16)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "128.10.0",
3
+ "version": "128.10.1",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -22,6 +22,7 @@ const FieldInput = ({
22
22
  error,
23
23
  helperText,
24
24
  label,
25
+ isInvisible,
25
26
  required
26
27
  }) => {
27
28
  const [id] = useState(uniqueId('field_')) // state only use to generate id once and not at each render
@@ -51,8 +52,8 @@ const FieldInput = ({
51
52
  className={cx(
52
53
  className,
53
54
  styles['contact-form-field__wrapper'],
54
- 'u-flex',
55
- 'u-flex-column-s'
55
+ 'u-flex-column-s',
56
+ { 'u-flex': !isInvisible, 'u-dn': isInvisible }
56
57
  )}
57
58
  >
58
59
  <Field
@@ -103,6 +104,8 @@ FieldInput.propTypes = {
103
104
  className: PropTypes.string,
104
105
  labelProps: labelPropTypes,
105
106
  attributes: fieldInputAttributesTypes,
107
+ /** Whether the field is visible by the user or not (still in the DOM anyway) */
108
+ isInvisible: PropTypes.bool,
106
109
  contacts: PropTypes.shape({
107
110
  data: PropTypes.arrayOf(PropTypes.object)
108
111
  }),
@@ -1,4 +1,3 @@
1
- import cx from 'classnames'
2
1
  import React, { useState } from 'react'
3
2
 
4
3
  import FieldInput from './FieldInput'
@@ -43,9 +42,10 @@ const FieldInputAccordion = ({
43
42
  return (
44
43
  <FieldInput
45
44
  key={index}
46
- className={cx('u-mt-1', { 'u-dn': !showExtended })}
45
+ className="u-mt-1"
47
46
  attributes={attributes}
48
47
  name={name}
48
+ isInvisible={!showExtended}
49
49
  label={t(`Contacts.AddModal.ContactForm.fields.${name}`)}
50
50
  />
51
51
  )
@@ -25,9 +25,10 @@ const FieldInputLayout = ({
25
25
 
26
26
  return (
27
27
  <div
28
- className={cx('u-flex u-mt-1', {
28
+ className={cx('u-mt-1', {
29
29
  'u-flex-items-center': !layout,
30
30
  'u-flex-items-baseline': !!layout,
31
+ 'u-flex': !isSecondary || showSecondaryFields,
31
32
  'u-dn': isSecondary && !showSecondaryFields
32
33
  })}
33
34
  >
@@ -1,5 +1,5 @@
1
1
  export default FieldInput;
2
- declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, required }: {
2
+ declare function FieldInput({ name, labelProps, className, attributes: { subFields, ...restAttributes }, contacts, error, helperText, label, isInvisible, required }: {
3
3
  name: any;
4
4
  labelProps: any;
5
5
  className: any;
@@ -11,6 +11,7 @@ declare function FieldInput({ name, labelProps, className, attributes: { subFiel
11
11
  error: any;
12
12
  helperText: any;
13
13
  label: any;
14
+ isInvisible: any;
14
15
  required: any;
15
16
  }): JSX.Element;
16
17
  declare namespace FieldInput {
@@ -19,6 +20,7 @@ declare namespace FieldInput {
19
20
  export const className: PropTypes.Requireable<string>;
20
21
  export { labelPropTypes as labelProps };
21
22
  export { fieldInputAttributesTypes as attributes };
23
+ export const isInvisible: PropTypes.Requireable<boolean>;
22
24
  export const contacts: PropTypes.Requireable<PropTypes.InferProps<{
23
25
  data: PropTypes.Requireable<(object | null)[]>;
24
26
  }>>;
@@ -28,6 +28,7 @@ var FieldInput = function FieldInput(_ref) {
28
28
  error = _ref.error,
29
29
  helperText = _ref.helperText,
30
30
  label = _ref.label,
31
+ isInvisible = _ref.isInvisible,
31
32
  required = _ref.required;
32
33
 
33
34
  var _useState = useState(uniqueId('field_')),
@@ -70,7 +71,10 @@ var FieldInput = function FieldInput(_ref) {
70
71
  };
71
72
 
72
73
  return /*#__PURE__*/React.createElement("div", {
73
- className: cx(className, styles['contact-form-field__wrapper'], 'u-flex', 'u-flex-column-s')
74
+ className: cx(className, styles['contact-form-field__wrapper'], 'u-flex-column-s', {
75
+ 'u-flex': !isInvisible,
76
+ 'u-dn': isInvisible
77
+ })
74
78
  }, /*#__PURE__*/React.createElement(Field, {
75
79
  required: required,
76
80
  error: error,
@@ -113,6 +117,9 @@ FieldInput.propTypes = {
113
117
  className: PropTypes.string,
114
118
  labelProps: labelPropTypes,
115
119
  attributes: fieldInputAttributesTypes,
120
+
121
+ /** Whether the field is visible by the user or not (still in the DOM anyway) */
122
+ isInvisible: PropTypes.bool,
116
123
  contacts: PropTypes.shape({
117
124
  data: PropTypes.arrayOf(PropTypes.object)
118
125
  }),
@@ -2,7 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["name", "label", "subFields"],
4
4
  _excluded2 = ["name"];
5
- import cx from 'classnames';
6
5
  import React, { useState } from 'react';
7
6
  import FieldInput from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/FieldInput";
8
7
  import { locales } from "cozy-ui/transpiled/react/Contacts/AddModal/ContactForm/locales";
@@ -58,11 +57,10 @@ var FieldInputAccordion = function FieldInputAccordion(_ref) {
58
57
 
59
58
  return /*#__PURE__*/React.createElement(FieldInput, {
60
59
  key: index,
61
- className: cx('u-mt-1', {
62
- 'u-dn': !showExtended
63
- }),
60
+ className: "u-mt-1",
64
61
  attributes: attributes,
65
62
  name: name,
63
+ isInvisible: !showExtended,
66
64
  label: t("Contacts.AddModal.ContactForm.fields.".concat(name))
67
65
  });
68
66
  }));
@@ -37,9 +37,10 @@ var FieldInputLayout = function FieldInputLayout(_ref) {
37
37
 
38
38
  var isError = fieldsRequired.includes(name) && !valid && submitFailed;
39
39
  return /*#__PURE__*/React.createElement("div", {
40
- className: cx('u-flex u-mt-1', {
40
+ className: cx('u-mt-1', {
41
41
  'u-flex-items-center': !layout,
42
42
  'u-flex-items-baseline': !!layout,
43
+ 'u-flex': !isSecondary || showSecondaryFields,
43
44
  'u-dn': isSecondary && !showSecondaryFields
44
45
  })
45
46
  }, /*#__PURE__*/React.createElement("div", {