cozy-ui 130.7.0 → 130.7.2

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,17 @@
1
+ ## [130.7.2](https://github.com/cozy/cozy-ui/compare/v130.7.1...v130.7.2) (2025-10-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * replace cozy mention in uploadqueue component header by app variable 🐛 ([e07a3ba](https://github.com/cozy/cozy-ui/commit/e07a3ba))
7
+
8
+ ## [130.7.1](https://github.com/cozy/cozy-ui/compare/v130.7.0...v130.7.1) (2025-10-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **GridListVirtualized:** Avoid useless redering ([6c75a3e](https://github.com/cozy/cozy-ui/commit/6c75a3e))
14
+
1
15
  # [130.7.0](https://github.com/cozy/cozy-ui/compare/v130.6.1...v130.7.0) (2025-10-07)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "130.7.0",
3
+ "version": "130.7.2",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,59 +1,52 @@
1
- import React, { forwardRef, useState, useMemo } from 'react'
1
+ import React, { useState, useMemo } from 'react'
2
2
 
3
- import GridItem from './GridItem'
3
+ import virtuosoComponents from './virtuosoComponents'
4
4
  import VirtualizedGridList from '../'
5
5
  import CustomDragLayer from '../../../utils/Dnd/CustomDrag/CustomDragLayer'
6
- import DnDConfigWrapper from '../../../utils/Dnd/DnDConfigWrapper'
7
6
 
8
7
  const VirtualizedGridListDnd = ({
8
+ items,
9
9
  dragProps,
10
10
  context,
11
11
  itemRenderer,
12
12
  children,
13
- componentProps = {
14
- List: {},
15
- Item: {}
16
- },
13
+ componentProps,
17
14
  components,
18
15
  ...props
19
16
  }) => {
20
17
  const [itemsInDropProcess, setItemsInDropProcess] = useState([])
21
18
 
19
+ const _components = useMemo(
20
+ () => ({ ...virtuosoComponents, ...components }),
21
+ [components]
22
+ )
23
+
22
24
  const _context = useMemo(
23
25
  () => ({
24
26
  ...context,
25
27
  dragProps,
26
28
  itemRenderer,
27
29
  itemsInDropProcess,
30
+ componentProps,
28
31
  setItemsInDropProcess,
29
- items: props.items
32
+ items
30
33
  }),
31
- [context, dragProps, itemRenderer, itemsInDropProcess, props.items]
34
+ [
35
+ context,
36
+ dragProps,
37
+ itemRenderer,
38
+ itemsInDropProcess,
39
+ componentProps,
40
+ items
41
+ ]
32
42
  )
33
43
 
34
44
  return (
35
45
  <>
36
46
  <CustomDragLayer dragId={dragProps.dragId} />
37
47
  <VirtualizedGridList
38
- components={{
39
- Scroller: forwardRef(({ ...scrollerProps }, ref) => (
40
- <DnDConfigWrapper ref={ref}>
41
- <div {...scrollerProps} ref={ref} />
42
- </DnDConfigWrapper>
43
- )),
44
- Item: ({ context, ...props }) => {
45
- const item = context?.items?.[props['data-index']]
46
- return (
47
- <GridItem
48
- item={item}
49
- context={context}
50
- renderItem={itemRenderer}
51
- {...componentProps.Item}
52
- />
53
- )
54
- },
55
- ...components
56
- }}
48
+ items={items}
49
+ components={_components}
57
50
  context={_context}
58
51
  {...props}
59
52
  >
@@ -0,0 +1,36 @@
1
+ /* eslint-disable no-unused-vars */ // for unused context
2
+
3
+ import React, { forwardRef } from 'react'
4
+
5
+ import GridItem from './GridItem'
6
+ import DnDConfigWrapper from '../../../utils/Dnd/DnDConfigWrapper'
7
+
8
+ /**
9
+ Be aware that context is spread to every components but should not be spread to root components
10
+ so we desctrure it from props, but don't spread to child to avoid its presence in DOM
11
+ */
12
+ const virtuosoComponents = {
13
+ Scroller: forwardRef(({ context, ...scrollerProps }, ref) => {
14
+ return (
15
+ <DnDConfigWrapper ref={ref}>
16
+ <div {...scrollerProps} ref={ref} />
17
+ </DnDConfigWrapper>
18
+ )
19
+ }),
20
+ Item: ({ context, ...props }) => {
21
+ const item = context.items?.[props['data-index']]
22
+ const itemRenderer = context.itemRenderer
23
+ const _props = context.componentProps?.Item || {}
24
+
25
+ return (
26
+ <GridItem
27
+ item={item}
28
+ context={context}
29
+ renderItem={itemRenderer}
30
+ {..._props}
31
+ />
32
+ )
33
+ }
34
+ }
35
+
36
+ export default virtuosoComponents
@@ -1,5 +1,5 @@
1
1
  {
2
- "header": "Import de %{smart_count} fichier dans votre Cozy |||| Import de %{smart_count} fichiers dans votre Cozy",
2
+ "header": "Import de %{smart_count} fichier dans votre %{app} |||| Import de %{smart_count} fichiers dans votre %{app}",
3
3
  "header_mobile": "Import de %{done} sur %{smart_count}",
4
4
  "header_done": "%{done} sur %{smart_count} élément importé |||| %{done} sur %{smart_count} éléments importés",
5
5
  "close": "Fermer",
@@ -1,13 +1,11 @@
1
1
  export default VirtualizedGridListDnd;
2
- declare function VirtualizedGridListDnd({ dragProps, context, itemRenderer, children, componentProps, components, ...props }: {
2
+ declare function VirtualizedGridListDnd({ items, dragProps, context, itemRenderer, children, componentProps, components, ...props }: {
3
3
  [x: string]: any;
4
+ items: any;
4
5
  dragProps: any;
5
6
  context: any;
6
7
  itemRenderer: any;
7
8
  children: any;
8
- componentProps?: {
9
- List: {};
10
- Item: {};
11
- } | undefined;
9
+ componentProps: any;
12
10
  components: any;
13
11
  }): JSX.Element;
@@ -2,29 +2,24 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["dragProps", "context", "itemRenderer", "children", "componentProps", "components"],
6
- _excluded2 = ["context"];
5
+ var _excluded = ["items", "dragProps", "context", "itemRenderer", "children", "componentProps", "components"];
7
6
 
8
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
8
 
10
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
10
 
12
- import React, { forwardRef, useState, useMemo } from 'react';
13
- import GridItem from "cozy-ui/transpiled/react/GridList/Virtualized/Dnd/GridItem";
11
+ import React, { useState, useMemo } from 'react';
12
+ import virtuosoComponents from "cozy-ui/transpiled/react/GridList/Virtualized/Dnd/virtuosoComponents";
14
13
  import VirtualizedGridList from "cozy-ui/transpiled/react/GridList/Virtualized";
15
14
  import CustomDragLayer from "cozy-ui/transpiled/react/utils/Dnd/CustomDrag/CustomDragLayer";
16
- import DnDConfigWrapper from "cozy-ui/transpiled/react/utils/Dnd/DnDConfigWrapper";
17
15
 
18
16
  var VirtualizedGridListDnd = function VirtualizedGridListDnd(_ref) {
19
- var dragProps = _ref.dragProps,
17
+ var items = _ref.items,
18
+ dragProps = _ref.dragProps,
20
19
  context = _ref.context,
21
20
  itemRenderer = _ref.itemRenderer,
22
21
  children = _ref.children,
23
- _ref$componentProps = _ref.componentProps,
24
- componentProps = _ref$componentProps === void 0 ? {
25
- List: {},
26
- Item: {}
27
- } : _ref$componentProps,
22
+ componentProps = _ref.componentProps,
28
23
  components = _ref.components,
29
24
  props = _objectWithoutProperties(_ref, _excluded);
30
25
 
@@ -33,43 +28,26 @@ var VirtualizedGridListDnd = function VirtualizedGridListDnd(_ref) {
33
28
  itemsInDropProcess = _useState2[0],
34
29
  setItemsInDropProcess = _useState2[1];
35
30
 
31
+ var _components = useMemo(function () {
32
+ return _objectSpread(_objectSpread({}, virtuosoComponents), components);
33
+ }, [components]);
34
+
36
35
  var _context = useMemo(function () {
37
36
  return _objectSpread(_objectSpread({}, context), {}, {
38
37
  dragProps: dragProps,
39
38
  itemRenderer: itemRenderer,
40
39
  itemsInDropProcess: itemsInDropProcess,
40
+ componentProps: componentProps,
41
41
  setItemsInDropProcess: setItemsInDropProcess,
42
- items: props.items
42
+ items: items
43
43
  });
44
- }, [context, dragProps, itemRenderer, itemsInDropProcess, props.items]);
44
+ }, [context, dragProps, itemRenderer, itemsInDropProcess, componentProps, items]);
45
45
 
46
46
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
47
47
  dragId: dragProps.dragId
48
48
  }), /*#__PURE__*/React.createElement(VirtualizedGridList, _extends({
49
- components: _objectSpread({
50
- Scroller: /*#__PURE__*/forwardRef(function (_ref2, ref) {
51
- var scrollerProps = _extends({}, _ref2);
52
-
53
- return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
54
- ref: ref
55
- }, /*#__PURE__*/React.createElement("div", _extends({}, scrollerProps, {
56
- ref: ref
57
- })));
58
- }),
59
- Item: function Item(_ref3) {
60
- var _context$items;
61
-
62
- var context = _ref3.context,
63
- props = _objectWithoutProperties(_ref3, _excluded2);
64
-
65
- var item = context === null || context === void 0 ? void 0 : (_context$items = context.items) === null || _context$items === void 0 ? void 0 : _context$items[props['data-index']];
66
- return /*#__PURE__*/React.createElement(GridItem, _extends({
67
- item: item,
68
- context: context,
69
- renderItem: itemRenderer
70
- }, componentProps.Item));
71
- }
72
- }, components),
49
+ items: items,
50
+ components: _components,
73
51
  context: _context
74
52
  }, props), children));
75
53
  };
@@ -0,0 +1,9 @@
1
+ export default virtuosoComponents;
2
+ declare namespace virtuosoComponents {
3
+ const Scroller: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
4
+ function Item({ context, ...props }: {
5
+ [x: string]: any;
6
+ context: any;
7
+ }): JSX.Element;
8
+ }
9
+ import React from "react";
@@ -0,0 +1,45 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["context"],
4
+ _excluded2 = ["context"];
5
+
6
+ /* eslint-disable no-unused-vars */
7
+ // for unused context
8
+ import React, { forwardRef } from 'react';
9
+ import GridItem from "cozy-ui/transpiled/react/GridList/Virtualized/Dnd/GridItem";
10
+ import DnDConfigWrapper from "cozy-ui/transpiled/react/utils/Dnd/DnDConfigWrapper";
11
+ /**
12
+ Be aware that context is spread to every components but should not be spread to root components
13
+ so we desctrure it from props, but don't spread to child to avoid its presence in DOM
14
+ */
15
+
16
+ var virtuosoComponents = {
17
+ Scroller: /*#__PURE__*/forwardRef(function (_ref, ref) {
18
+ var context = _ref.context,
19
+ scrollerProps = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
22
+ ref: ref
23
+ }, /*#__PURE__*/React.createElement("div", _extends({}, scrollerProps, {
24
+ ref: ref
25
+ })));
26
+ }),
27
+ Item: function Item(_ref2) {
28
+ var _context$items, _context$componentPro;
29
+
30
+ var context = _ref2.context,
31
+ props = _objectWithoutProperties(_ref2, _excluded2);
32
+
33
+ var item = (_context$items = context.items) === null || _context$items === void 0 ? void 0 : _context$items[props['data-index']];
34
+ var itemRenderer = context.itemRenderer;
35
+
36
+ var _props = ((_context$componentPro = context.componentProps) === null || _context$componentPro === void 0 ? void 0 : _context$componentPro.Item) || {};
37
+
38
+ return /*#__PURE__*/React.createElement(GridItem, _extends({
39
+ item: item,
40
+ context: context,
41
+ renderItem: itemRenderer
42
+ }, _props));
43
+ }
44
+ };
45
+ export default virtuosoComponents;
@@ -36,7 +36,7 @@ var localeEs = {
36
36
  }
37
37
  };
38
38
  var localeFr = {
39
- header: "Import de %{smart_count} fichier dans votre Cozy |||| Import de %{smart_count} fichiers dans votre Cozy",
39
+ header: "Import de %{smart_count} fichier dans votre %{app} |||| Import de %{smart_count} fichiers dans votre %{app}",
40
40
  header_mobile: "Import de %{done} sur %{smart_count}",
41
41
  header_done: "%{done} sur %{smart_count} \xE9l\xE9ment import\xE9 |||| %{done} sur %{smart_count} \xE9l\xE9ments import\xE9s",
42
42
  close: "Fermer",