cozy-ui 103.0.0 → 103.1.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +2 -1
  3. package/react/Filename/Readme.md +1 -1
  4. package/react/Filename/index.jsx +16 -39
  5. package/react/IntentDialogOpener/IntentDialogOpener.jsx +1 -0
  6. package/react/MidEllipsis/Readme.md +4 -32
  7. package/react/MidEllipsis/index.jsx +31 -4
  8. package/react/deprecated/IntentModal/IntentModal.jsx +2 -2
  9. package/scripts/screenshots/fetchAllComponents.js +2 -0
  10. package/scripts/screenshots/screenshotComponent.js +1 -1
  11. package/transpiled/react/Filename/index.js +10 -18
  12. package/transpiled/react/IntentDialogOpener/IntentDialogOpener.js +1 -0
  13. package/transpiled/react/MidEllipsis/index.js +38 -5
  14. package/transpiled/react/deprecated/IntentModal/IntentModal.js +2 -2
  15. package/transpiled/react/stylesheet.css +1 -1
  16. package/react/AccordionActions/Readme.md +0 -1
  17. package/react/AlertTitle/Readme.md +0 -1
  18. package/react/AppBar/Readme.md +0 -1
  19. package/react/Backdrop/Readme.md +0 -1
  20. package/react/BottomNavigation/Readme.md +0 -1
  21. package/react/BottomNavigationAction/Readme.md +0 -1
  22. package/react/Box/Readme.md +0 -1
  23. package/react/Button/Readme.md +0 -1
  24. package/react/ButtonBase/Readme.md +0 -1
  25. package/react/CardActionArea/Readme.md +0 -1
  26. package/react/CardActions/Readme.md +0 -1
  27. package/react/CardContent/Readme.md +0 -1
  28. package/react/CardHeader/Readme.md +0 -1
  29. package/react/CardMedia/Readme.md +0 -1
  30. package/react/CircularProgress/Readme.md +0 -1
  31. package/react/ClickAwayListener/Readme.md +0 -1
  32. package/react/Collapse/Readme.md +0 -1
  33. package/react/Container/Readme.md +0 -1
  34. package/react/CssBaseline/Readme.md +0 -1
  35. package/react/DialogActions/Readme.md +0 -1
  36. package/react/DialogContent/Readme.md +0 -1
  37. package/react/DialogContentText/Readme.md +0 -1
  38. package/react/DialogTitle/Readme.md +0 -1
  39. package/react/Drawer/Readme.md +0 -1
  40. package/react/Fade/Readme.md +0 -1
  41. package/react/Filename/styles.styl +0 -9
  42. package/react/FilledInput/Readme.md +0 -1
  43. package/react/FormControl/Readme.md +0 -1
  44. package/react/FormControlLabel/Readme.md +0 -1
  45. package/react/FormGroup/Readme.md +0 -1
  46. package/react/FormHelperText/Readme.md +0 -1
  47. package/react/FormLabel/Readme.md +0 -1
  48. package/react/GridList/Readme.md +0 -1
  49. package/react/GridListTile/Readme.md +0 -1
  50. package/react/GridListTileBar/Readme.md +0 -1
  51. package/react/Grow/Readme.md +0 -1
  52. package/react/Hidden/Readme.md +0 -1
  53. package/react/InputAdornment/Readme.md +0 -1
  54. package/react/InputBase/Readme.md +0 -1
  55. package/react/LinearProgress/Readme.md +0 -1
  56. package/react/Link/Readme.md +0 -1
  57. package/react/ListItemAvatar/Readme.md +0 -1
  58. package/react/MenuItem/Readme.md +0 -1
  59. package/react/MenuList/Readme.md +0 -1
  60. package/react/MobileStepper/Readme.md +0 -1
  61. package/react/Modal/Readme.md +0 -1
  62. package/react/NativeSelect/Readme.md +0 -1
  63. package/react/NoSsr/Readme.md +0 -1
  64. package/react/OutlinedInput/Readme.md +0 -1
  65. package/react/RadioGroup/Readme.md +0 -1
  66. package/react/RootRef/Readme.md +0 -1
  67. package/react/ScopedCssBaseline/Readme.md +0 -1
  68. package/react/Select/Readme.md +0 -1
  69. package/react/Skeleton/Readme.md +0 -1
  70. package/react/Slide/Readme.md +0 -1
  71. package/react/Slider/Readme.md +0 -1
  72. package/react/SnackbarContent/Readme.md +0 -1
  73. package/react/Step/Readme.md +0 -1
  74. package/react/StepButton/Readme.md +0 -1
  75. package/react/StepConnector/Readme.md +0 -1
  76. package/react/StepContent/Readme.md +0 -1
  77. package/react/StepIcon/Readme.md +0 -1
  78. package/react/StepLabel/Readme.md +0 -1
  79. package/react/SvgIcon/Readme.md +0 -1
  80. package/react/SwipeableDrawer/Readme.md +0 -1
  81. package/react/Tab/Readme.md +0 -1
  82. package/react/TextareaAutosize/Readme.md +0 -1
  83. package/react/Timeline/Readme.md +0 -1
  84. package/react/TimelineConnector/Readme.md +0 -1
  85. package/react/TimelineContent/Readme.md +0 -1
  86. package/react/TimelineDot/Readme.md +0 -1
  87. package/react/TimelineItem/Readme.md +0 -1
  88. package/react/TimelineOppositeContent/Readme.md +0 -1
  89. package/react/TimelineSeparator/Readme.md +0 -1
  90. package/react/Toolbar/Readme.md +0 -1
  91. package/react/Zoom/Readme.md +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [103.1.1](https://github.com/cozy/cozy-ui/compare/v103.1.0...v103.1.1) (2024-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Stop propagation of event ([167e50b](https://github.com/cozy/cozy-ui/commit/167e50b))
7
+
8
+ # [103.1.0](https://github.com/cozy/cozy-ui/compare/v103.0.0...v103.1.0) (2024-02-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **Filename:** Adjust style and DOM structure ([7f000a6](https://github.com/cozy/cozy-ui/commit/7f000a6))
14
+
15
+
16
+ ### Features
17
+
18
+ * **MidEllipsis:** Use `ui.midellipsis-lib.enabled` flag for better one ([b7b484e](https://github.com/cozy/cozy-ui/commit/b7b484e))
19
+ * **Packages:** Add react-middle-ellipsis package ([a8991d9](https://github.com/cozy/cozy-ui/commit/a8991d9))
20
+
1
21
  # [103.0.0](https://github.com/cozy/cozy-ui/compare/v102.2.1...v103.0.0) (2024-02-06)
2
22
 
3
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "103.0.0",
3
+ "version": "103.1.1",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -174,6 +174,7 @@
174
174
  "piwik-react-router": "0.12.1",
175
175
  "react-chartjs-2": "4.1.0",
176
176
  "react-markdown": "^4.0.8",
177
+ "react-middle-ellipsis": "1.2.2",
177
178
  "react-pdf": "^5.7.2",
178
179
  "react-popper": "^2.2.3",
179
180
  "react-remove-scroll": "^2.4.0",
@@ -17,7 +17,7 @@ const initialVariants = [
17
17
  icon={variant.icon ? FileIcon : undefined}
18
18
  variant={variant.body1Variant ? 'body1' : undefined}
19
19
  midEllipsis={variant.midEllipsis}
20
- filename="Lacinia condimentum potenti id est tortor dictumst lectus tincidunt hac ultricies, curae mattis nisi neque sodales sagittis dui nulla aliquam turpis eros, finibus ac iaculis dictum et orci elit posuere ex"
20
+ filename="Lacinia condimentum potenti id est tortor dictumst lectus tincidunt hac ultricies, curae mattis nisi neque sodales sagittis dui nulla aliquam turpis eros, finibus ac iaculis dictum et orci elit posuere ex and this is the end"
21
21
  extension={variant.noExtension ? undefined : ".pdf"}
22
22
  />
23
23
  )}
@@ -1,58 +1,35 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
- import cx from 'classnames'
4
3
 
5
- import { Media, Bd, Img } from '../deprecated/Media'
6
- import Icon from '../Icon'
4
+ import Icon, { iconPropType } from '../Icon'
7
5
  import Typography from '../Typography'
8
6
  import MidEllipsis from '../MidEllipsis'
9
7
 
10
- import styles from './styles.styl'
11
-
12
8
  const Filename = ({ icon, filename, extension, midEllipsis, variant }) => {
13
9
  return (
14
- <Media>
10
+ <div className="u-flex u-flex-items-center">
15
11
  {icon && (
16
- <Img>
17
- <Icon className={'u-mr-1'} icon={icon} width={30} height={30} />
18
- </Img>
12
+ <div className="u-mr-1">
13
+ <Icon icon={icon} width={30} height={30} />
14
+ </div>
15
+ )}
16
+ {filename && (
17
+ <Typography variant={variant} component="span" noWrap>
18
+ {midEllipsis ? <MidEllipsis text={filename} /> : filename}
19
+ </Typography>
19
20
  )}
20
- {(filename || extension) && (
21
- <Bd className={styles['c-filename-wrapper']}>
22
- {filename && (
23
- <Typography
24
- variant={variant}
25
- component="span"
26
- className={cx(styles['c-filename-name'], {
27
- 'u-ellipsis': !midEllipsis,
28
- 'u-ov-hidden': midEllipsis
29
- })}
30
- >
31
- {midEllipsis ? <MidEllipsis text={filename} /> : filename}
32
- </Typography>
33
- )}
34
- {extension && (
35
- <Typography
36
- variant={variant}
37
- component="span"
38
- color="textSecondary"
39
- >
40
- {extension}
41
- </Typography>
42
- )}
43
- </Bd>
21
+ {extension && (
22
+ <Typography variant={variant} component="span" color="textSecondary">
23
+ {extension}
24
+ </Typography>
44
25
  )}
45
- </Media>
26
+ </div>
46
27
  )
47
28
  }
48
29
 
49
30
  Filename.propTypes = {
50
31
  /** Filename icon */
51
- icon: PropTypes.oneOfType([
52
- PropTypes.string,
53
- PropTypes.object,
54
- PropTypes.func
55
- ]),
32
+ icon: iconPropType,
56
33
  /** folder or file name */
57
34
  filename: PropTypes.string,
58
35
  /** If a file name, you can specify the extension */
@@ -28,6 +28,7 @@ const IntentDialogOpener = props => {
28
28
 
29
29
  const openModal = ev => {
30
30
  ev.preventDefault()
31
+ ev.stopPropagation()
31
32
  setModalOpened(true)
32
33
  }
33
34
  const closeModal = () => setModalOpened(false)
@@ -1,39 +1,11 @@
1
1
  #### Ellipsis in the middle
2
2
 
3
- ```jsx
4
- import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis';
5
-
6
- <MidEllipsis text={content.ada.short} />
7
- ```
8
-
9
- #### Ellipsis in directory tree
10
-
11
- ```jsx
12
- import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis';
13
-
14
- <MidEllipsis text="/Administratif/Netflix" />
15
- ```
16
-
17
- #### Ellipsis with React string children
3
+ Text can be passed in `text` prop or as `child`.
18
4
 
19
5
  ```jsx
20
- import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis';
6
+ import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis'
21
7
 
22
- <MidEllipsis>/Administratif/Netflix</MidEllipsis>
23
- ```
24
-
25
- #### Ellipsis in directory tree with complex names
26
-
27
- ```jsx
28
- import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis';
29
-
30
- <MidEllipsis text="/Administratif/Ameli//1 88 88 88 888 888" />
31
- ```
32
-
33
- #### Ellipsis in directory tree with complex names and unusual characters
8
+ ;
34
9
 
35
- ```jsx
36
- import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis';
37
-
38
- <MidEllipsis text="/Partages reçus/Cozy 🗄 - Team/Customers & Partners 🛒/Xxxxxx (Xxxxxxxx)/4_Suivi opérationnel/Point de synchro" />
10
+ <MidEllipsis text={content.ada.short} />
39
11
  ```
@@ -1,6 +1,8 @@
1
1
  import React, { forwardRef } from 'react'
2
- import cx from 'classnames'
3
2
  import PropTypes from 'prop-types'
3
+ import cx from 'classnames'
4
+ import MiddleEllipsis from 'react-middle-ellipsis'
5
+ import flag from 'cozy-flags'
4
6
 
5
7
  /** The left-to-right mark (LRM) is a control character (an invisible formatting character)
6
8
  * used in computerized typesetting (including word processing in a program like Microsoft Word)
@@ -14,7 +16,7 @@ import PropTypes from 'prop-types'
14
16
  * */
15
17
  const LRM = <>&#8206;</>
16
18
 
17
- const MidEllipsis = forwardRef(
19
+ const MidEllipsisLegacy = forwardRef(
18
20
  ({ text, className, children, ...props }, ref) => {
19
21
  if (text && typeof text !== 'string')
20
22
  throw new Error('The "text" prop of MidEllipsis can only be a string')
@@ -41,11 +43,36 @@ const MidEllipsis = forwardRef(
41
43
  }
42
44
  )
43
45
 
44
- MidEllipsis.displayName = 'MidEllipsis'
46
+ MidEllipsisLegacy.displayName = 'MidEllipsis'
45
47
 
46
- MidEllipsis.propTypes = {
48
+ MidEllipsisLegacy.propTypes = {
47
49
  text: PropTypes.string,
48
50
  className: PropTypes.string
49
51
  }
50
52
 
53
+ // --
54
+ // This is new component based on react-middle-ellipsis
55
+ // We will delete all other stuff if perf test are successful with this one
56
+ const styles = { whiteSpace: 'nowrap', overflow: 'hidden' }
57
+
58
+ const MidEllipsisWithLib = forwardRef(({ text, ...props }, ref) => {
59
+ return (
60
+ <span style={styles}>
61
+ <MiddleEllipsis {...props} ref={ref}>
62
+ <span>{text}</span>
63
+ </MiddleEllipsis>
64
+ </span>
65
+ )
66
+ })
67
+ //
68
+ // --
69
+
70
+ const MidEllipsis = forwardRef((props, ref) => {
71
+ if (flag('ui.midellipsis-lib.enabled')) {
72
+ return <MidEllipsisWithLib {...props} ref={ref} />
73
+ }
74
+
75
+ return <MidEllipsisLegacy {...props} ref={ref} />
76
+ })
77
+
51
78
  export default MidEllipsis
@@ -46,9 +46,9 @@ class IntentModal extends Component {
46
46
  // FIXME: this should be fixed by diferenciating dismissAction (for closing
47
47
  // modal) and onCancel (for intent cancellation), but it implies deprecating
48
48
  // dismissAction first, ensure legacy, prevent regressions, etc.
49
- dismiss = once(() => {
49
+ dismiss = once(evt => {
50
50
  const { dismissAction } = this.props
51
- dismissAction && dismissAction()
51
+ dismissAction && dismissAction(evt)
52
52
  })
53
53
 
54
54
  render() {
@@ -41,7 +41,9 @@ const fetchAllComponents = async (page, args, config) => {
41
41
  return Array.from(document.querySelectorAll(`${sidebarSelector} a`))
42
42
  .filter(v => !v.href.includes('?id='))
43
43
  .map(x => x.text)
44
+ .filter(x => x !== 'Cozy-ui documentation') // see section's name in styleguide.config.js
44
45
  })
46
+
45
47
  const sortedCategoriesNames = sortBy(
46
48
  categoriesName.map(catName => ({
47
49
  link: styleguideIndexURL + '#/' + catName,
@@ -26,7 +26,7 @@ const screenshotComponent = async (page, options) => {
26
26
  const { link, name } = component
27
27
 
28
28
  await page.goto(link)
29
- await sleep(100) // to be sure the page is entirely loaded
29
+ await sleep(200) // to be sure the page is entirely loaded
30
30
 
31
31
  const getScreenshotName =
32
32
  options.getScreenshotName || defaultGetScreenshotName
@@ -1,14 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import { Media, Bd, Img } from "cozy-ui/transpiled/react/deprecated/Media";
5
- import Icon from "cozy-ui/transpiled/react/Icon";
3
+ import Icon, { iconPropType } from "cozy-ui/transpiled/react/Icon";
6
4
  import Typography from "cozy-ui/transpiled/react/Typography";
7
5
  import MidEllipsis from "cozy-ui/transpiled/react/MidEllipsis";
8
- var styles = {
9
- "c-filename-wrapper": "styles__c-filename-wrapper___3tVpA",
10
- "c-filename-name": "styles__c-filename-name___1jDMz"
11
- };
12
6
 
13
7
  var Filename = function Filename(_ref) {
14
8
  var icon = _ref.icon,
@@ -16,32 +10,30 @@ var Filename = function Filename(_ref) {
16
10
  extension = _ref.extension,
17
11
  midEllipsis = _ref.midEllipsis,
18
12
  variant = _ref.variant;
19
- return /*#__PURE__*/React.createElement(Media, null, icon && /*#__PURE__*/React.createElement(Img, null, /*#__PURE__*/React.createElement(Icon, {
20
- className: 'u-mr-1',
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ className: "u-flex u-flex-items-center"
15
+ }, icon && /*#__PURE__*/React.createElement("div", {
16
+ className: "u-mr-1"
17
+ }, /*#__PURE__*/React.createElement(Icon, {
21
18
  icon: icon,
22
19
  width: 30,
23
20
  height: 30
24
- })), (filename || extension) && /*#__PURE__*/React.createElement(Bd, {
25
- className: styles['c-filename-wrapper']
26
- }, filename && /*#__PURE__*/React.createElement(Typography, {
21
+ })), filename && /*#__PURE__*/React.createElement(Typography, {
27
22
  variant: variant,
28
23
  component: "span",
29
- className: cx(styles['c-filename-name'], {
30
- 'u-ellipsis': !midEllipsis,
31
- 'u-ov-hidden': midEllipsis
32
- })
24
+ noWrap: true
33
25
  }, midEllipsis ? /*#__PURE__*/React.createElement(MidEllipsis, {
34
26
  text: filename
35
27
  }) : filename), extension && /*#__PURE__*/React.createElement(Typography, {
36
28
  variant: variant,
37
29
  component: "span",
38
30
  color: "textSecondary"
39
- }, extension)));
31
+ }, extension));
40
32
  };
41
33
 
42
34
  Filename.propTypes = {
43
35
  /** Filename icon */
44
- icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
36
+ icon: iconPropType,
45
37
 
46
38
  /** folder or file name */
47
39
  filename: PropTypes.string,
@@ -33,6 +33,7 @@ var IntentDialogOpener = function IntentDialogOpener(props) {
33
33
 
34
34
  var openModal = function openModal(ev) {
35
35
  ev.preventDefault();
36
+ ev.stopPropagation();
36
37
  setModalOpened(true);
37
38
  };
38
39
 
@@ -1,9 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["text", "className", "children"];
3
+ var _excluded = ["text", "className", "children"],
4
+ _excluded2 = ["text"];
4
5
  import React, { forwardRef } from 'react';
5
- import cx from 'classnames';
6
6
  import PropTypes from 'prop-types';
7
+ import cx from 'classnames';
8
+ import MiddleEllipsis from 'react-middle-ellipsis';
9
+ import flag from 'cozy-flags';
7
10
  /** The left-to-right mark (LRM) is a control character (an invisible formatting character)
8
11
  * used in computerized typesetting (including word processing in a program like Microsoft Word)
9
12
  * of text that contains a mixture of left-to-right text (such as English or Russian)
@@ -16,7 +19,7 @@ import PropTypes from 'prop-types';
16
19
  * */
17
20
 
18
21
  var LRM = /*#__PURE__*/React.createElement(React.Fragment, null, "\u200E");
19
- var MidEllipsis = /*#__PURE__*/forwardRef(function (_ref, ref) {
22
+ var MidEllipsisLegacy = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
23
  var text = _ref.text,
21
24
  className = _ref.className,
22
25
  children = _ref.children,
@@ -33,9 +36,39 @@ var MidEllipsis = /*#__PURE__*/forwardRef(function (_ref, ref) {
33
36
  ref: ref
34
37
  }, props), /*#__PURE__*/React.createElement("span", null, firstPart), /*#__PURE__*/React.createElement("span", null, LRM, lastPart, LRM));
35
38
  });
36
- MidEllipsis.displayName = 'MidEllipsis';
37
- MidEllipsis.propTypes = {
39
+ MidEllipsisLegacy.displayName = 'MidEllipsis';
40
+ MidEllipsisLegacy.propTypes = {
38
41
  text: PropTypes.string,
39
42
  className: PropTypes.string
43
+ }; // --
44
+ // This is new component based on react-middle-ellipsis
45
+ // We will delete all other stuff if perf test are successful with this one
46
+
47
+ var styles = {
48
+ whiteSpace: 'nowrap',
49
+ overflow: 'hidden'
40
50
  };
51
+ var MidEllipsisWithLib = /*#__PURE__*/forwardRef(function (_ref2, ref) {
52
+ var text = _ref2.text,
53
+ props = _objectWithoutProperties(_ref2, _excluded2);
54
+
55
+ return /*#__PURE__*/React.createElement("span", {
56
+ style: styles
57
+ }, /*#__PURE__*/React.createElement(MiddleEllipsis, _extends({}, props, {
58
+ ref: ref
59
+ }), /*#__PURE__*/React.createElement("span", null, text)));
60
+ }); //
61
+ // --
62
+
63
+ var MidEllipsis = /*#__PURE__*/forwardRef(function (props, ref) {
64
+ if (flag('ui.midellipsis-lib.enabled')) {
65
+ return /*#__PURE__*/React.createElement(MidEllipsisWithLib, _extends({}, props, {
66
+ ref: ref
67
+ }));
68
+ }
69
+
70
+ return /*#__PURE__*/React.createElement(MidEllipsisLegacy, _extends({}, props, {
71
+ ref: ref
72
+ }));
73
+ });
41
74
  export default MidEllipsis;
@@ -58,9 +58,9 @@ var IntentModal = /*#__PURE__*/function (_Component) {
58
58
  });
59
59
  });
60
60
 
61
- _defineProperty(_assertThisInitialized(_this), "dismiss", once(function () {
61
+ _defineProperty(_assertThisInitialized(_this), "dismiss", once(function (evt) {
62
62
  var dismissAction = _this.props.dismissAction;
63
- dismissAction && dismissAction();
63
+ dismissAction && dismissAction(evt);
64
64
  }));
65
65
 
66
66
  logIntentModalDepecrated('The IntentModal component has been deprecated and should be replaced by IntentIframe wrapped in Dialog');