cozy-ui 126.2.0 → 126.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [126.4.0](https://github.com/cozy/cozy-ui/compare/v126.3.0...v126.4.0) (2025-06-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * **VirtualizedTable:** Lazy load dragndrop components ([620846e](https://github.com/cozy/cozy-ui/commit/620846e))
7
+
8
+ # [126.3.0](https://github.com/cozy/cozy-ui/compare/v126.2.0...v126.3.0) (2025-06-17)
9
+
10
+
11
+ ### Features
12
+
13
+ * **ExtendableFab:** Forward ref in ExtendableFab component ([86e0b93](https://github.com/cozy/cozy-ui/commit/86e0b93))
14
+
1
15
  # [126.2.0](https://github.com/cozy/cozy-ui/compare/v126.1.0...v126.2.0) (2025-06-16)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "126.2.0",
3
+ "version": "126.4.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,30 +1,31 @@
1
- import React from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
 
3
3
  import Fab from '.'
4
4
  import Icon from '../Icon'
5
5
  import useScroll from '../hooks/useScroll'
6
6
 
7
- const ExtendableFab = ({
8
- label,
9
- icon,
10
- follow,
11
- topLimit = 50,
12
- scrollOptions,
13
- ...rest
14
- }) => {
15
- const { scrollTop } = useScroll(follow, scrollOptions)
16
- const isBelowTopLimit = scrollTop < topLimit
7
+ const ExtendableFab = forwardRef(
8
+ ({ label, icon, follow, topLimit = 50, scrollOptions, ...rest }, ref) => {
9
+ const { scrollTop } = useScroll(follow, scrollOptions)
10
+ const isBelowTopLimit = scrollTop < topLimit
17
11
 
18
- return (
19
- <Fab
20
- aria-label={label}
21
- variant={isBelowTopLimit ? 'extended' : 'circular'}
22
- {...rest}
23
- >
24
- <Icon icon={icon} {...(isBelowTopLimit && { className: 'u-mr-half' })} />
25
- {isBelowTopLimit && label}
26
- </Fab>
27
- )
28
- }
12
+ return (
13
+ <Fab
14
+ ref={ref}
15
+ aria-label={label}
16
+ variant={isBelowTopLimit ? 'extended' : 'circular'}
17
+ {...rest}
18
+ >
19
+ <Icon
20
+ icon={icon}
21
+ {...(isBelowTopLimit && { className: 'u-mr-half' })}
22
+ />
23
+ {isBelowTopLimit && label}
24
+ </Fab>
25
+ )
26
+ }
27
+ )
28
+
29
+ ExtendableFab.displayName = 'ExtendableFab'
29
30
 
30
31
  export default ExtendableFab
@@ -1,12 +1,15 @@
1
1
  import React, { useState, forwardRef } from 'react'
2
2
  import { TableVirtuoso } from 'react-virtuoso'
3
3
 
4
- import CustomDragLayer from './Dnd/CustomDrag/CustomDragLayer'
5
4
  import FixedHeaderContent from './FixedHeaderContent'
6
5
  import RowContent from './RowContent'
7
6
  import { stableSort, getComparator } from './helpers'
8
7
  import virtuosoComponents from './virtuosoComponents'
9
8
 
9
+ const CustomDragLayer = React.lazy(() =>
10
+ import('./Dnd/CustomDrag/CustomDragLayer')
11
+ )
12
+
10
13
  const VirtualizedTable = forwardRef(
11
14
  (
12
15
  {
@@ -91,14 +94,14 @@ VirtualizedTable.displayName = 'VirtualizedTable'
91
94
  const VirtuosoTableWrapper = props => {
92
95
  if (!props.dragProps?.enabled) {
93
96
  return <VirtualizedTable {...props} />
97
+ } else {
98
+ return (
99
+ <React.Suspense>
100
+ <CustomDragLayer dragId={props.dragProps.dragId} />
101
+ <VirtualizedTable {...props} />
102
+ </React.Suspense>
103
+ )
94
104
  }
95
-
96
- return (
97
- <>
98
- <CustomDragLayer dragId={props.dragProps.dragId} />
99
- <VirtualizedTable {...props} />
100
- </>
101
- )
102
105
  }
103
106
 
104
107
  export default VirtuosoTableWrapper
@@ -1,7 +1,5 @@
1
1
  import React, { forwardRef } from 'react'
2
2
 
3
- import DnDConfigWrapper from './Dnd/DnDConfigWrapper'
4
- import TableRowDnD from './Dnd/TableRow'
5
3
  import Table from '..'
6
4
  import Paper from '../../Paper'
7
5
  import TableBody from '../../TableBody'
@@ -10,6 +8,9 @@ import TableFooter from '../../TableFooter'
10
8
  import TableHead from '../../TableHead'
11
9
  import TableRow from '../../TableRow'
12
10
 
11
+ const DnDConfigWrapper = React.lazy(() => import('./Dnd/DnDConfigWrapper'))
12
+ const TableRowDnD = React.lazy(() => import('./Dnd/TableRow'))
13
+
13
14
  const _TableContainer = forwardRef((props, ref) => (
14
15
  <TableContainer
15
16
  {...props}
@@ -25,13 +26,15 @@ const virtuosoComponents = {
25
26
  Scroller: forwardRef(({ context, ...props }, ref) => {
26
27
  if (!context.dragProps?.enabled) {
27
28
  return <_TableContainer {...props} ref={ref} />
29
+ } else {
30
+ return (
31
+ <React.Suspense>
32
+ <DnDConfigWrapper ref={ref}>
33
+ <_TableContainer {...props} ref={ref} />
34
+ </DnDConfigWrapper>
35
+ </React.Suspense>
36
+ )
28
37
  }
29
-
30
- return (
31
- <DnDConfigWrapper ref={ref}>
32
- <_TableContainer {...props} ref={ref} />
33
- </DnDConfigWrapper>
34
- )
35
38
  }),
36
39
  Table: forwardRef((props, ref) => <Table {...props} ref={ref} />),
37
40
  TableHead: forwardRef((props, ref) => <TableHead {...props} ref={ref} />),
@@ -43,18 +46,20 @@ const virtuosoComponents = {
43
46
 
44
47
  if (!context.dragProps?.enabled) {
45
48
  return <TableRow {...props} ref={ref} selected={isSelected} hover />
49
+ } else {
50
+ return (
51
+ <React.Suspense>
52
+ <TableRowDnD
53
+ {...props}
54
+ item={item}
55
+ context={context}
56
+ selected={isSelected}
57
+ disabled={isDisabled}
58
+ hover
59
+ />
60
+ </React.Suspense>
61
+ )
46
62
  }
47
-
48
- return (
49
- <TableRowDnD
50
- {...props}
51
- item={item}
52
- context={context}
53
- selected={isSelected}
54
- disabled={isDisabled}
55
- hover
56
- />
57
- )
58
63
  })
59
64
  }
60
65
 
@@ -1421,6 +1421,7 @@ Display an chip that represents complex identity
1421
1421
  NB: `flex` being much more complex, it has its own set of utility classes, [see further](section-utilities.html#kssref-utilities-flexbox).
1422
1422
 
1423
1423
  .u-dn - Display none
1424
+ .u-dc - Display contents
1424
1425
  .u-di - Display inline
1425
1426
  .u-db - Display block
1426
1427
  .u-dib - Display inline-block
@@ -1,9 +1,3 @@
1
1
  export default ExtendableFab;
2
- declare function ExtendableFab({ label, icon, follow, topLimit, scrollOptions, ...rest }: {
3
- [x: string]: any;
4
- label: any;
5
- icon: any;
6
- follow: any;
7
- topLimit?: number | undefined;
8
- scrollOptions: any;
9
- }): JSX.Element;
2
+ declare const ExtendableFab: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
@@ -1,12 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["label", "icon", "follow", "topLimit", "scrollOptions"];
4
- import React from 'react';
4
+ import React, { forwardRef } from 'react';
5
5
  import Fab from "cozy-ui/transpiled/react/Fab";
6
6
  import Icon from "cozy-ui/transpiled/react/Icon";
7
7
  import useScroll from "cozy-ui/transpiled/react/hooks/useScroll";
8
-
9
- var ExtendableFab = function ExtendableFab(_ref) {
8
+ var ExtendableFab = /*#__PURE__*/forwardRef(function (_ref, ref) {
10
9
  var label = _ref.label,
11
10
  icon = _ref.icon,
12
11
  follow = _ref.follow,
@@ -20,6 +19,7 @@ var ExtendableFab = function ExtendableFab(_ref) {
20
19
 
21
20
  var isBelowTopLimit = scrollTop < topLimit;
22
21
  return /*#__PURE__*/React.createElement(Fab, _extends({
22
+ ref: ref,
23
23
  "aria-label": label,
24
24
  variant: isBelowTopLimit ? 'extended' : 'circular'
25
25
  }, rest), /*#__PURE__*/React.createElement(Icon, _extends({
@@ -27,6 +27,6 @@ var ExtendableFab = function ExtendableFab(_ref) {
27
27
  }, isBelowTopLimit && {
28
28
  className: 'u-mr-half'
29
29
  })), isBelowTopLimit && label);
30
- };
31
-
30
+ });
31
+ ExtendableFab.displayName = 'ExtendableFab';
32
32
  export default ExtendableFab;
@@ -4,11 +4,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
4
4
  var _excluded = ["rows", "columns", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "dragProps"];
5
5
  import React, { useState, forwardRef } from 'react';
6
6
  import { TableVirtuoso } from 'react-virtuoso';
7
- import CustomDragLayer from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer";
8
7
  import FixedHeaderContent from "cozy-ui/transpiled/react/Table/Virtualized/FixedHeaderContent";
9
8
  import RowContent from "cozy-ui/transpiled/react/Table/Virtualized/RowContent";
10
9
  import { stableSort, getComparator } from "cozy-ui/transpiled/react/Table/Virtualized/helpers";
11
10
  import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
11
+ var CustomDragLayer = /*#__PURE__*/React.lazy(function () {
12
+ return import('./Dnd/CustomDrag/CustomDragLayer');
13
+ });
12
14
  var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
15
  var rows = _ref.rows,
14
16
  columns = _ref.columns,
@@ -105,11 +107,11 @@ var VirtuosoTableWrapper = function VirtuosoTableWrapper(props) {
105
107
 
106
108
  if (!((_props$dragProps = props.dragProps) !== null && _props$dragProps !== void 0 && _props$dragProps.enabled)) {
107
109
  return /*#__PURE__*/React.createElement(VirtualizedTable, props);
110
+ } else {
111
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
112
+ dragId: props.dragProps.dragId
113
+ }), /*#__PURE__*/React.createElement(VirtualizedTable, props));
108
114
  }
109
-
110
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
111
- dragId: props.dragProps.dragId
112
- }), /*#__PURE__*/React.createElement(VirtualizedTable, props));
113
115
  };
114
116
 
115
117
  export default VirtuosoTableWrapper;
@@ -9,8 +9,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
9
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; }
10
10
 
11
11
  import React, { forwardRef } from 'react';
12
- import DnDConfigWrapper from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper";
13
- import TableRowDnD from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/TableRow";
14
12
  import Table from "cozy-ui/transpiled/react/Table";
15
13
  import Paper from "cozy-ui/transpiled/react/Paper";
16
14
  import TableBody from "cozy-ui/transpiled/react/TableBody";
@@ -18,6 +16,12 @@ import TableContainer from "cozy-ui/transpiled/react/TableContainer";
18
16
  import TableFooter from "cozy-ui/transpiled/react/TableFooter";
19
17
  import TableHead from "cozy-ui/transpiled/react/TableHead";
20
18
  import TableRow from "cozy-ui/transpiled/react/TableRow";
19
+ var DnDConfigWrapper = /*#__PURE__*/React.lazy(function () {
20
+ return import('./Dnd/DnDConfigWrapper');
21
+ });
22
+ var TableRowDnD = /*#__PURE__*/React.lazy(function () {
23
+ return import('./Dnd/TableRow');
24
+ });
21
25
 
22
26
  var _TableContainer = /*#__PURE__*/forwardRef(function (props, ref) {
23
27
  return /*#__PURE__*/React.createElement(TableContainer, _extends({}, props, {
@@ -42,13 +46,13 @@ var virtuosoComponents = {
42
46
  return /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
43
47
  ref: ref
44
48
  }));
49
+ } else {
50
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(DnDConfigWrapper, {
51
+ ref: ref
52
+ }, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
53
+ ref: ref
54
+ }))));
45
55
  }
46
-
47
- return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
48
- ref: ref
49
- }, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
50
- ref: ref
51
- })));
52
56
  }),
53
57
  Table: /*#__PURE__*/forwardRef(function (props, ref) {
54
58
  return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
@@ -86,15 +90,15 @@ var virtuosoComponents = {
86
90
  selected: isSelected,
87
91
  hover: true
88
92
  }));
93
+ } else {
94
+ return /*#__PURE__*/React.createElement(React.Suspense, null, /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
95
+ item: item,
96
+ context: context,
97
+ selected: isSelected,
98
+ disabled: isDisabled,
99
+ hover: true
100
+ })));
89
101
  }
90
-
91
- return /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
92
- item: item,
93
- context: context,
94
- selected: isSelected,
95
- disabled: isDisabled,
96
- hover: true
97
- }));
98
102
  })
99
103
  };
100
104
  export default virtuosoComponents;