cozy-ui 58.1.2 → 58.2.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,10 @@
1
+ # [58.2.0](https://github.com/cozy/cozy-ui/compare/v58.1.2...v58.2.0) (2021-12-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add `noWrap` prop on BarTitle ([74e3742](https://github.com/cozy/cozy-ui/commit/74e3742))
7
+
1
8
  ## [58.1.2](https://github.com/cozy/cozy-ui/compare/v58.1.1...v58.1.2) (2021-12-07)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "58.1.2",
3
+ "version": "58.2.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -15,12 +15,22 @@ const MyPage = () => {
15
15
  }
16
16
  ```
17
17
 
18
- ### Display
18
+ ### Basic usage
19
19
 
20
- The border is here to show the area of the bar.
20
+ The red border is here only to show the area of the bar.
21
21
 
22
- ```
23
- <div style={{ height: '3rem', border: '1px solid var(--dividerColor) ' }}>
22
+ ```jsx
23
+ <div style={{ border: '1px solid red' }}>
24
24
  <BarTitle>My transactions</BarTitle>
25
25
  </div>
26
26
  ```
27
+
28
+ ### Long title with ellipsis
29
+
30
+ The red border is here only to show the area of the bar.
31
+
32
+ ```jsx
33
+ <div style={{ border: '1px solid red' }}>
34
+ <BarTitle noWrap>{content.ada.short}</BarTitle>
35
+ </div>
36
+ ```
@@ -1,13 +1,27 @@
1
1
  import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
2
4
  import Typography from '../Typography'
5
+
3
6
  import styles from './styles.styl'
4
7
 
5
- const BarTitle = ({ children }) => {
8
+ const BarTitle = ({ noWrap, children }) => {
6
9
  return (
7
- <Typography variant="h5" component="h1" className={styles.BarTitle}>
8
- {children}
9
- </Typography>
10
+ <div className={styles.BarTitle}>
11
+ <Typography variant="h5" component="h1" noWrap={noWrap}>
12
+ {children}
13
+ </Typography>
14
+ </div>
10
15
  )
11
16
  }
12
17
 
18
+ BarTitle.defaultProps = {
19
+ noWrap: false
20
+ }
21
+
22
+ BarTitle.propTypes = {
23
+ /** Add an ellipsis like `noWrap` prop on Typography component does */
24
+ noWrap: PropTypes.bool
25
+ }
26
+
13
27
  export default BarTitle
@@ -1,16 +1,27 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import Typography from "cozy-ui/transpiled/react/Typography";
3
4
  var styles = {
4
5
  "BarTitle": "styles__BarTitle___I5r2e"
5
6
  };
6
7
 
7
8
  var BarTitle = function BarTitle(_ref) {
8
- var children = _ref.children;
9
- return React.createElement(Typography, {
9
+ var noWrap = _ref.noWrap,
10
+ children = _ref.children;
11
+ return React.createElement("div", {
12
+ className: styles.BarTitle
13
+ }, React.createElement(Typography, {
10
14
  variant: "h5",
11
15
  component: "h1",
12
- className: styles.BarTitle
13
- }, children);
16
+ noWrap: noWrap
17
+ }, children));
14
18
  };
15
19
 
20
+ BarTitle.defaultProps = {
21
+ noWrap: false
22
+ };
23
+ BarTitle.propTypes = {
24
+ /** Add an ellipsis like `noWrap` prop on Typography component does */
25
+ noWrap: PropTypes.bool
26
+ };
16
27
  export default BarTitle;