cozy-ui 68.4.0 → 68.6.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,24 @@
1
+ # [68.6.0](https://github.com/cozy/cozy-ui/compare/v68.5.1...v68.6.0) (2022-06-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Icon:** Add hand icon ([c7c814f](https://github.com/cozy/cozy-ui/commit/c7c814f))
7
+
8
+ ## [68.5.1](https://github.com/cozy/cozy-ui/compare/v68.5.0...v68.5.1) (2022-06-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Reduce console spam by AppLinker ([27d9064](https://github.com/cozy/cozy-ui/commit/27d9064))
14
+
15
+ # [68.5.0](https://github.com/cozy/cozy-ui/compare/v68.4.0...v68.5.0) (2022-06-08)
16
+
17
+
18
+ ### Features
19
+
20
+ * **DropdownText:** Add possibility to ellipsis text and pass more props ([8971e52](https://github.com/cozy/cozy-ui/commit/8971e52))
21
+
1
22
  # [68.4.0](https://github.com/cozy/cozy-ui/compare/v68.3.1...v68.4.0) (2022-06-08)
2
23
 
3
24
 
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16">
2
+ <path d="M14.992 8V5a1.001 1.001 0 0 0-2 0v3h-1V2a1.001 1.001 0 0 0-2 0v5h-1V1a1.001 1.001 0 0 0-2 0v6h-1V2c0-.551-.45-1-1-1-.551 0-1 .449-1 1v6.5a.5.5 0 0 1-.88.325L1.1 6.125c-.222-.182-.64-.166-.897.091a.7.7 0 0 0-.075.898c.064.117 1.542 4.144 3.227 6.798A4.486 4.486 0 0 0 7.156 16h3.336c2.48 0 4.5-2.019 4.5-4.5V8Z"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "68.4.0",
3
+ "version": "68.6.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -87,25 +87,23 @@ export class AppLinker extends React.Component {
87
87
  const appInfo = NATIVE_APP_INFOS[slug]
88
88
 
89
89
  if (isFlagshipApp()) {
90
- if (!context)
91
- logger.warn(
92
- 'FlagshipApp detected but no context found. Is the app wrapped in <WebviewIntentProvider? />'
93
- )
94
-
95
- if (context) {
96
- const imgPayload =
97
- imgRef &&
98
- JSON.stringify({
99
- ...imgRef.getBoundingClientRect().toJSON()
100
- })
101
-
102
- return {
103
- onClick: event => {
104
- event.preventDefault()
105
- context.call('openApp', href, app, imgPayload)
106
- },
107
- href: '#'
108
- }
90
+ const imgPayload =
91
+ imgRef &&
92
+ JSON.stringify({
93
+ ...imgRef.getBoundingClientRect().toJSON()
94
+ })
95
+
96
+ return {
97
+ onClick: event => {
98
+ event.preventDefault()
99
+
100
+ context
101
+ ? context.call('openApp', href, app, imgPayload)
102
+ : logger.error(
103
+ `Failed to "openApp(${app})". WebviewService has the following falsy value "${context}" in AppLinker's context.`
104
+ )
105
+ },
106
+ href: '#'
109
107
  }
110
108
  }
111
109
 
@@ -43,6 +43,12 @@ const variants = [
43
43
  ))}
44
44
  </Grid>
45
45
  </Grid>
46
+ <DropdownText style={{ border: '1px solid var(--borderMainColor)', width: '150px', marginBottom: '1rem' }} color="error">
47
+ This is a long text without ellipsis
48
+ </DropdownText>
49
+ <DropdownText noWrap style={{ border: '1px solid var(--borderMainColor)', width: '150px', marginBottom: '1rem' }}>
50
+ This is a long text with ellipsis
51
+ </DropdownText>
46
52
  <DropdownText spaceBetween style={{ border: '1px solid var(--borderMainColor)', width: '100%', marginBottom: '1rem' }}>
47
53
  Space between text and icon
48
54
  </DropdownText>
@@ -7,15 +7,20 @@ import Icon from '../Icon'
7
7
  import BottomIcon from '../Icons/Bottom'
8
8
 
9
9
  const useStyles = makeStyles(theme => ({
10
- endIcon: {
11
- marginLeft: '5px'
12
- },
13
- typography: {
10
+ container: {
14
11
  display: 'flex',
15
- alignItems: 'center',
16
12
  width: '100%',
13
+ alignItems: 'center',
17
14
  justifyContent: ({ spaceBetween }) =>
18
- spaceBetween ? 'space-between' : 'left',
15
+ spaceBetween ? 'space-between' : 'left'
16
+ },
17
+ typography: {
18
+ color: ({ disabled }) =>
19
+ theme.palette.text[disabled ? 'disabled' : 'primary']
20
+ },
21
+ endIcon: {
22
+ display: 'flex',
23
+ marginLeft: '5px',
19
24
  color: ({ disabled }) =>
20
25
  theme.palette.text[disabled ? 'disabled' : 'primary']
21
26
  }
@@ -41,27 +46,39 @@ const DropdownText = forwardRef(
41
46
  spaceBetween = false,
42
47
  variant = 'body1',
43
48
  disabled = false,
49
+ noWrap = false,
50
+ color = 'primary',
44
51
  children,
52
+ innerTextProps,
53
+ innerIconContainerProps,
54
+ innerIconProps,
45
55
  ...props
46
56
  },
47
57
  ref
48
58
  ) => {
49
- const styles = useStyles({ spaceBetween, disabled })
59
+ const styles = useStyles({ spaceBetween, disabled, color })
50
60
 
51
61
  return (
52
- <Typography
53
- ref={ref}
54
- classes={{ root: styles.typography }}
55
- variant={variant}
56
- {...props}
57
- >
58
- {children}
59
- <Icon
60
- className={styles.endIcon}
61
- icon={BottomIcon}
62
- size={endIconSizeByVariant[variant]}
63
- />
64
- </Typography>
62
+ <div ref={ref} className={styles.container} {...props}>
63
+ <Typography
64
+ classes={{ root: styles.typography }}
65
+ variant={variant}
66
+ noWrap={noWrap}
67
+ {...innerTextProps}
68
+ >
69
+ {children}
70
+ </Typography>
71
+ <Typography
72
+ classes={{ root: styles.endIcon }}
73
+ {...innerIconContainerProps}
74
+ >
75
+ <Icon
76
+ icon={BottomIcon}
77
+ size={endIconSizeByVariant[variant]}
78
+ {...innerIconProps}
79
+ />
80
+ </Typography>
81
+ </div>
65
82
  )
66
83
  }
67
84
  )
@@ -73,6 +90,14 @@ DropdownText.propTypes = {
73
90
  variant: PropTypes.string,
74
91
  /** Whether the component is disabled */
75
92
  disabled: PropTypes.bool,
93
+ /** Whether using ellipsis on text */
94
+ noWrap: PropTypes.bool,
95
+ /** Props passed to the text */
96
+ innerTextProps: PropTypes.object,
97
+ /** Props passed to the icon container */
98
+ innerIconContainerProps: PropTypes.object,
99
+ /** Props passed to the icon */
100
+ innerIconProps: PropTypes.object,
76
101
  children: PropTypes.node
77
102
  }
78
103
 
@@ -128,6 +128,7 @@ import GraphCircle from 'cozy-ui/transpiled/react/Icons/GraphCircle'
128
128
  import Grid from 'cozy-ui/transpiled/react/Icons/Grid'
129
129
  import GroupList from 'cozy-ui/transpiled/react/Icons/GroupList'
130
130
  import Groups from 'cozy-ui/transpiled/react/Icons/Groups'
131
+ import Hand from 'cozy-ui/transpiled/react/Icons/Hand'
131
132
  import Heart from 'cozy-ui/transpiled/react/Icons/Heart'
132
133
  import Help from 'cozy-ui/transpiled/react/Icons/Help'
133
134
  import History from 'cozy-ui/transpiled/react/Icons/History'
@@ -338,6 +339,7 @@ const icons = [
338
339
  Grid,
339
340
  GroupList,
340
341
  Groups,
342
+ Hand,
341
343
  Heart,
342
344
  Help,
343
345
  History,
@@ -473,7 +475,7 @@ const InfoModal = ({ icon }) => {
473
475
  <>
474
476
  <Typography variant='body1'>To import {iconName}, copy/paste the following line:</Typography>
475
477
  <pre>
476
- import {iconName}Icon from 'cozy-ui/transpiled/react/icons/{iconName}'
478
+ import {iconName}Icon from 'cozy-ui/transpiled/react/Icons/{iconName}'
477
479
  </pre>
478
480
  </>
479
481
  }
@@ -700,7 +702,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
700
702
 
701
703
  const colors = ['#297EF2', '#08b442', '#B449E7', '#F52D2D', '#FF962F']
702
704
  let i = 0
703
- const availableIcons = ['album-add','album-remove','album','answer','apple','archive','attachment','attention','bank','banking-add','banking','bell','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','categories','certified','check-circle','check-list','check-square','check','checkbox','circle-filled','clock','cloud-happy','cloud','collect','comment','company','compass','connector','contract','contrast','cozy-laugh','cozy-text','credit-card-add','credit-card','credit','crop','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','email-notification','email','eu','euro','exchange','eye-closed','eye','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder','forbidden','from-user','gear','globe','graph-circle','grid','group-list','groups','heart','help','history','home','hourglass','image','info-outlined','info','key','laptop','left','lightbulb','link-out','link','list','location','lock','logout','magic-trick','magnet','magnifier','merge','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online','openwith','palette','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus','previous','printer','qualify','radio-checked','radio-unchecked','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','select-all','setting','share-circle','share','shield','shop','sound','spinner','stack','star','stats','subway','sync-cozy','sync','target','team','telephone','to-the-cloud','top','train','trash','trophy','unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','wrench-circle']
705
+ const availableIcons = ['album-add','album-remove','album','answer','apple','archive','attachment','attention','bank','banking-add','banking','bell','bike','bill','bottom','browser-brave','browser-chrome','browser-duckduckgo','browser-edge','browser-edge-chromium','browser-firefox','browser-ie','browser-opera','browser-safari','burger','bus','calendar','camera','car','carbonCopy','categories','certified','check-circle','check-list','check-square','check','checkbox','circle-filled','clock','cloud-happy','cloud','collect','comment','company','compass','connector','contract','contrast','cozy-laugh','cozy-text','credit-card-add','credit-card','credit','crop','cross-circle','cross-medium','cross-small','cross','cube','dash','dashboard','data-control','debit','devices','dots','down','download','drawing-arrow-up','dropdown-close','dropdown-open','dropdown','dropup','email-notification','email','eu','euro','exchange','eye-closed','eye','file-add','file-duotone','file-new','file-none','file-outline','file','filter','fingerprint','fitness','flag-outlined','flag','flash-auto','flashlight','folder-add','folder-moveto','folder','forbidden','from-user','gear','globe','graph-circle','grid','group-list','groups','hand','heart','help','history','home','hourglass','image','info-outlined','info','key','laptop','left','lightbulb','link-out','link','list','location','lock','logout','magic-trick','magnet','magnifier','merge','mountain','movement-in','movement-out','mouvement','moveto','multi-files','music','new','next','note','notification-email','offline','online','openwith','palette','paperplane','password','pen','people','percent-circle','percent','personal-data','phone-download','phone-upload','phone','pie-chart','pin','plane','plus-small','plus','previous','printer','qualify','radio-checked','radio-unchecked','repare','reply','restaurant','restore-straight','restore','right','rise','rotate-left','rotate-right','sad-cozy','safe','school','select-all','setting','share-circle','share','shield','shop','sound','spinner','stack','star','stats','subway','sync-cozy','sync','target','team','telephone','to-the-cloud','top','train','trash','trophy','unknow','unlink','unlock','up','upload','videos','walk','wallet-add','wallet-new','wallet','warn','warning-circle','warning','wrench-circle']
704
706
  ;
705
707
  <div style={{ fontSize: '2rem', display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)' }}>
706
708
  <Sprite />
@@ -341,7 +341,9 @@ module.exports = `<svg><defs>
341
341
  <path fill-rule="evenodd" d="M6 1h10v2H6V1zm0 6h10v2H6V7zm0 6h10v2H6v-2zM2 4L.195 1.854a.901.901 0 0 1 0-1.121c.261-.31.682-.31.943 0L2 1.758 2.862.733c.26-.31.682-.31.943 0 .26.31.26.81 0 1.12L2 4zm0 6L.195 7.854a.901.901 0 0 1 0-1.121c.261-.31.682-.31.943 0L2 7.758l.862-1.025c.26-.31.682-.31.943 0 .26.31.26.81 0 1.12L2 10zm0 6L.195 13.854a.901.901 0 0 1 0-1.121c.261-.31.682-.31.943 0L2 13.758l.862-1.025c.26-.31.682-.31.943 0 .26.31.26.81 0 1.12L2 16z"/>
342
342
  </symbol><symbol id="groups" viewBox="0 0 16 16">
343
343
  <path fill-rule="evenodd" d="M2.944 3.473a1.473 1.473 0 1 1-2.946-.002 1.473 1.473 0 0 1 2.946.002zM5 4.722v-2.5h11v2.5H5zm0 4.64v-2.5h11v2.5H5zM5 14v-2.5h11V14H5z"/>
344
- </symbol><symbol id="heart" viewBox="0 0 16 16">
344
+ </symbol><symbol id="hand" viewBox="0 0 15 16">
345
+ <path d="M14.992 8V5a1.001 1.001 0 0 0-2 0v3h-1V2a1.001 1.001 0 0 0-2 0v5h-1V1a1.001 1.001 0 0 0-2 0v6h-1V2c0-.551-.45-1-1-1-.551 0-1 .449-1 1v6.5a.5.5 0 0 1-.88.325L1.1 6.125c-.222-.182-.64-.166-.897.091a.7.7 0 0 0-.075.898c.064.117 1.542 4.144 3.227 6.798A4.486 4.486 0 0 0 7.156 16h3.336c2.48 0 4.5-2.019 4.5-4.5V8Z"/>
346
+ </symbol><symbol id="heart" viewBox="0 0 16 16">
345
347
  <path fill-rule="evenodd" d="M1.467 8.096a4.023 4.023 0 0 1-.699-.738L.724 7.31l.007-.006a4 4 0 1 1 7.21-2.994 6.685 6.685 0 0 1 .118 0 4.001 4.001 0 1 1 7.21 2.995l.005.005-.036.038a4.023 4.023 0 0 1-.713.753L8 15 1.467 8.096z"/>
346
348
  </symbol><symbol id="help" viewBox="0 0 16 16">
347
349
  <path fill-rule="evenodd" d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zm1-7.198C10.122 8.355 11 7.21 11 6c0-1.552-1.448-3-3-3S5 4.448 5 6h2c0-.448.552-1 1-1 .448 0 1 .552 1 1 0 .448-.552 1-1 1a1 1 0 0 0-1 1v2h2V8.802zM7 11v2h2v-2H7z"/>
@@ -0,0 +1,12 @@
1
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/hand.svg` to regenerate;
2
+ import React from 'react'
3
+
4
+ function SvgHand(props) {
5
+ return (
6
+ <svg viewBox="0 0 15 16" {...props}>
7
+ <path d="M14.992 8V5a1.001 1.001 0 00-2 0v3h-1V2a1.001 1.001 0 00-2 0v5h-1V1a1.001 1.001 0 00-2 0v6h-1V2c0-.551-.45-1-1-1-.551 0-1 .449-1 1v6.5a.5.5 0 01-.88.325L1.1 6.125c-.222-.182-.64-.166-.897.091a.7.7 0 00-.075.898c.064.117 1.542 4.144 3.227 6.798A4.486 4.486 0 007.156 16h3.336c2.48 0 4.5-2.019 4.5-4.5V8z" />
8
+ </svg>
9
+ )
10
+ }
11
+
12
+ export default SvgHand