cozy-ui 68.9.0 → 69.1.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,33 @@
1
+ # [69.1.0](https://github.com/cozy/cozy-ui/compare/v69.0.0...v69.1.0) (2022-07-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Icon:** Add new tag icon ([514402f](https://github.com/cozy/cozy-ui/commit/514402f))
7
+
8
+ # [69.0.0](https://github.com/cozy/cozy-ui/compare/v68.9.1...v69.0.0) (2022-07-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **Typography:** Removed forced color ([1880d93](https://github.com/cozy/cozy-ui/commit/1880d93))
14
+
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * **Typography:** Old deprecated texts components are removed : `Text`, `Title`, `MainTitle`, `SubTitle`, `Bold`, `Uppercase`, `Caption`, `ErrorMessage`, `NewSubTitle` from `/react/Text`. You now have to rely on `Typography` component. You can use a codemod for that :
19
+ ```
20
+ $ yarn global add @cozy/codemods
21
+ $ jscodeshift -t $(yarn global dir)/node_modules/@cozy/codemods/src/transforms/transform-typography.js src --parser babel --ignore-pattern=src/targets/ --extensions js,jsx
22
+ ```
23
+
24
+ ## [68.9.1](https://github.com/cozy/cozy-ui/compare/v68.9.0...v68.9.1) (2022-06-30)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **ListSubheader:** Only 1rem of text indent on mobile ([af38d1d](https://github.com/cozy/cozy-ui/commit/af38d1d))
30
+
1
31
  # [68.9.0](https://github.com/cozy/cozy-ui/compare/v68.8.0...v68.9.0) (2022-06-30)
2
32
 
3
33
 
@@ -0,0 +1 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"/><path clip-rule="evenodd" d="M2 0a2 2 0 0 0-2 2v5.89a2 2 0 0 0 .586 1.415l5.98 5.973a2.462 2.462 0 0 0 3.481 0l5.236-5.237.002-.002a2.461 2.461 0 0 0 0-3.47L9.303.587A2 2 0 0 0 7.888 0H2Zm0 2h5.888l5.978 5.98a.461.461 0 0 1 0 .649l-5.234 5.236a.46.46 0 0 1-.652 0L2 7.89V2Z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "68.9.0",
3
+ "version": "69.1.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -128,7 +128,7 @@ exports[`ActionMenu should render as expected 1`] = `
128
128
  class="styles__bd___1Uv-F u-mr-1 u-stack-xs"
129
129
  >
130
130
  <p
131
- class="MuiTypography-root MuiTypography-body1 MuiTypography-gutterBottom"
131
+ class="MuiTypography-root MuiTypography-body1 MuiTypography-colorTextPrimary MuiTypography-gutterBottom"
132
132
  >
133
133
  Item 4
134
134
  </p>
@@ -27,7 +27,7 @@ exports[`ContactRow should match the contact snapshot 1`] = `
27
27
  </span>
28
28
  </div>
29
29
  <p
30
- className="MuiTypography-root u-ml-1 MuiTypography-body1 MuiTypography-noWrap MuiTypography-gutterBottom MuiTypography-displayInline"
30
+ className="MuiTypography-root u-ml-1 MuiTypography-body1 MuiTypography-colorTextPrimary MuiTypography-noWrap MuiTypography-gutterBottom MuiTypography-displayInline"
31
31
  >
32
32
  <span
33
33
  className=""
@@ -9,7 +9,6 @@ The inverted theme is not supported for several components but the work
9
9
 
10
10
  ```jsx
11
11
  import CozyTheme from 'cozy-ui/transpiled/react/CozyTheme'
12
- import { Title, SubTitle } from 'cozy-ui/transpiled/react/Text'
13
12
  import Button from 'cozy-ui/transpiled/react/Button'
14
13
  import MuiButton from 'cozy-ui/transpiled/react/MuiCozyTheme/Buttons'
15
14
  import TextField from 'cozy-ui/transpiled/react/MuiCozyTheme/TextField'
@@ -29,8 +28,8 @@ const themesSupportingContext = [
29
28
 
30
29
  <CozyTheme variant='inverted' className='u-stack-m'>
31
30
  <Paper className='u-p-1'>
32
- <Title className='u-white u-mb-1'>Inverted theme</Title>
33
- <SubTitle className='u-white'>Buttons</SubTitle>
31
+ <Typography className='u-white u-mb-1' variant="h4">Inverted theme</Typography>
32
+ <Typography className='u-white' variant="h5">Buttons</Typography>
34
33
  {themesSupportingContext.map(theme =>
35
34
  <p key={theme}>{
36
35
  props.map(
@@ -38,13 +37,13 @@ const themesSupportingContext = [
38
37
  )
39
38
  }</p>
40
39
  )}
41
- <SubTitle className='u-white u-mt-1'>BarButton</SubTitle>
40
+ <Typography className='u-white u-mt-1' variant="h5">BarButton</Typography>
42
41
  <BarButton icon={DotsIcon} />
43
- <SubTitle className='u-white u-mb-1'>MUI Buttons</SubTitle>
42
+ <Typography className='u-white u-mb-1' variant="h5">MUI Buttons</Typography>
44
43
  <MuiButton variant='outlined' color='primary'>
45
44
  A MUI button
46
45
  </MuiButton>
47
- <SubTitle className='u-white u-mt-1'>MUI TextField</SubTitle>
46
+ <Typography className='u-white u-mt-1' variant="h5">MUI TextField</Typography>
48
47
  <TextField
49
48
  id="inverted-field"
50
49
  label="A field"
@@ -53,7 +52,7 @@ const themesSupportingContext = [
53
52
  variant="outlined"
54
53
  placeholder="placeholder"
55
54
  />
56
- <SubTitle className='u-white u-mt-1'>Normal theme inside inverted theme</SubTitle>
55
+ <Typography className='u-white u-mt-1' variant="h5">Normal theme inside inverted theme</Typography>
57
56
  <CozyTheme variant='normal'>
58
57
  <Paper className='u-p-1 u-mv-1'>
59
58
  <Typography variant='body1'>
@@ -214,6 +214,7 @@ import Stats from 'cozy-ui/transpiled/react/Icons/Stats'
214
214
  import Subway from 'cozy-ui/transpiled/react/Icons/Subway'
215
215
  import Sync from 'cozy-ui/transpiled/react/Icons/Sync'
216
216
  import SyncCozy from 'cozy-ui/transpiled/react/Icons/SyncCozy'
217
+ import Tag from 'cozy-ui/transpiled/react/Icons/Tag'
217
218
  import Target from 'cozy-ui/transpiled/react/Icons/Target'
218
219
  import Team from 'cozy-ui/transpiled/react/Icons/Team'
219
220
  import Telephone from 'cozy-ui/transpiled/react/Icons/Telephone'
@@ -426,6 +427,7 @@ const icons = [
426
427
  Subway,
427
428
  Sync,
428
429
  SyncCozy,
430
+ Tag,
429
431
  Target,
430
432
  Team,
431
433
  Telephone,
@@ -704,7 +706,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography'
704
706
 
705
707
  const colors = ['#297EF2', '#08b442', '#B449E7', '#F52D2D', '#FF962F']
706
708
  let i = 0
707
- 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','paper','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']
709
+ 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','paper','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','tag','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']
708
710
  ;
709
711
  <div style={{ fontSize: '2rem', display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)' }}>
710
712
  <Sprite />
@@ -526,7 +526,7 @@ module.exports = `<svg><defs>
526
526
  <path d="M8 2c2.21 0 4 1.79 4 4 2.21 0 4 1.79 4 4s-1.79 4-4 4H4c-2.21 0-4-1.79-4-4s1.79-4 4-4c0-2.21 1.79-4 4-4zM4.6 9.014c-.12-.025-.242-.004-.345.055l-.038.024c-.042.029-.08.063-.112.104l-.012.014c-.034.047-.059.1-.074.16l-.006.04C4.008 9.441 4 9.469 4 9.5v2c0 .276.224.5.5.5.237 0 .426-.168.478-.39C5.728 12.459 6.818 13 8 13c1.547 0 2.956-.899 3.632-2.268.122-.247.02-.547-.228-.67-.248-.121-.547-.02-.67.228C10.227 11.322 9.162 12 8 12c-.74 0-1.436-.286-1.976-.754.135-.007.267-.064.36-.176.177-.212.148-.527-.064-.704l-1.5-1.25c-.005-.005-.012-.006-.017-.011l-.04-.024c-.04-.025-.08-.045-.124-.057zM8 5c-1.57 0-2.992.906-3.653 2.291-.119.25-.013.548.236.667.25.118.548.013.667-.236C5.746 6.682 6.817 6 8 6c.769 0 1.477.287 2.017.758-.149-.005-.298.048-.401.172-.177.212-.148.527.064.704l1.5 1.25.011.007c.01.008.023.013.034.02.04.028.083.05.127.063l.04.01c.054.012.11.017.163.01.005 0 .009.002.013.001.063-.01.118-.031.17-.059.014-.007.025-.016.038-.024.04-.027.076-.059.107-.097l.02-.021c.034-.047.06-.1.077-.158.003-.01.002-.02.004-.03.008-.034.016-.068.016-.106v-2c0-.276-.224-.5-.5-.5-.226 0-.41.152-.471.357C10.284 5.523 9.196 5 7.999 5z"/>
527
527
  </g>
528
528
  </g>
529
- </symbol><symbol id="sync" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M16 7.2V3c0-.6-.4-1-1-1-.5 0-.8.3-.9.7A8.09 8.09 0 0 0 8 0C4.9 0 2 1.8.7 4.6c-.2.5 0 1.1.5 1.3.5.2 1.1 0 1.3-.5C3.5 3.4 5.6 2 8 2c1.5 0 3 .6 4 1.5-.3 0-.6.1-.8.3-.4.4-.3 1.1.1 1.4l3 2.5h.1c.1.1.2.1.3.1h.4c.1 0 .2-.1.3-.1h.1c.1-.1.2-.1.2-.2.2 0 .2-.1.3-.3 0 .1 0 0 0 0m-1.2 2.9c-.5-.2-1.1 0-1.3.5A6 6 0 0 1 8 14c-1.5 0-2.9-.6-4-1.5.3 0 .5-.1.7-.4.4-.4.3-1.1-.1-1.4l-3-2.5h-.1L1.3 8h-.1c-.2 0-.5 0-.7.1H.4c-.1.1-.1.2-.2.3-.1.1-.1.2-.2.3V13c0 .6.4 1 1 1 .5 0 .9-.3 1-.8C3.5 14.9 5.6 16 8 16c3.1 0 5.9-1.8 7.3-4.5.2-.5 0-1.1-.5-1.4"/></symbol><symbol id="target" viewBox="0 0 16 16">
529
+ </symbol><symbol id="sync" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M16 7.2V3c0-.6-.4-1-1-1-.5 0-.8.3-.9.7A8.09 8.09 0 0 0 8 0C4.9 0 2 1.8.7 4.6c-.2.5 0 1.1.5 1.3.5.2 1.1 0 1.3-.5C3.5 3.4 5.6 2 8 2c1.5 0 3 .6 4 1.5-.3 0-.6.1-.8.3-.4.4-.3 1.1.1 1.4l3 2.5h.1c.1.1.2.1.3.1h.4c.1 0 .2-.1.3-.1h.1c.1-.1.2-.1.2-.2.2 0 .2-.1.3-.3 0 .1 0 0 0 0m-1.2 2.9c-.5-.2-1.1 0-1.3.5A6 6 0 0 1 8 14c-1.5 0-2.9-.6-4-1.5.3 0 .5-.1.7-.4.4-.4.3-1.1-.1-1.4l-3-2.5h-.1L1.3 8h-.1c-.2 0-.5 0-.7.1H.4c-.1.1-.1.2-.2.3-.1.1-.1.2-.2.3V13c0 .6.4 1 1 1 .5 0 .9-.3 1-.8C3.5 14.9 5.6 16 8 16c3.1 0 5.9-1.8 7.3-4.5.2-.5 0-1.1-.5-1.4"/></symbol><symbol id="tag" viewBox="0 0 16 16"><path d="M5 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"/><path clip-rule="evenodd" d="M2 0a2 2 0 0 0-2 2v5.89a2 2 0 0 0 .586 1.415l5.98 5.973a2.462 2.462 0 0 0 3.481 0l5.236-5.237.002-.002a2.461 2.461 0 0 0 0-3.47L9.303.587A2 2 0 0 0 7.888 0H2Zm0 2h5.888l5.978 5.98a.461.461 0 0 1 0 .649l-5.234 5.236a.46.46 0 0 1-.652 0L2 7.89V2Z"/></symbol><symbol id="target" viewBox="0 0 16 16">
530
530
  <path fill-rule="evenodd" d="M9 12.899V12a1 1 0 0 0-2 0v.899A5.016 5.016 0 0 1 3.101 9H4a1 1 0 0 0 0-2h-.899A5.016 5.016 0 0 1 7 3.101V4a1 1 0 0 0 2 0v-.899A5.016 5.016 0 0 1 12.899 7H12a1 1 0 0 0 0 2h.899A5.016 5.016 0 0 1 9 12.899zM16 7h-1.08A7.005 7.005 0 0 0 9 1.08V1a1 1 0 0 0-2 0v.08A7.005 7.005 0 0 0 1.08 7H1a1 1 0 0 0 0 2h.08A7.004 7.004 0 0 0 7 14.92V15a1 1 0 0 0 2 0v-.08A7.004 7.004 0 0 0 14.92 9H16V7z"/>
531
531
  </symbol><symbol id="team" viewBox="0 0 16 16">
532
532
  <path fill-rule="evenodd" d="M11.145 7.75C10.263 7.285 9.647 6.23 9.647 5c0-1.657 1.12-3 2.5-3 1.381 0 2.5 1.343 2.5 3 0 1.231-.618 2.29-1.502 2.752V9l1.105.553c.49.245 1.095.848 1.342 1.342l.106.21c.245.49 0 .895-.55.895H9.142c-.544 0-.797-.4-.55-.895l.106-.21c.245-.49.848-1.095 1.342-1.342L11.145 9V7.75zM4.647 10.8c-1.165-.48-2-1.776-2-3.3 0-1.933 1.343-3.5 3-3.5s3 1.567 3 3.5c0 1.524-.835 2.82-2 3.3V12l2.051.684c.532.177 1.15.717 1.397 1.21l.105.211c.245.49.002.895-.548.895h-8.01c-.539 0-.794-.4-.547-.895l.105-.21c.245-.49.872-1.037 1.397-1.211L4.647 12v-1.2z"/>
@@ -0,0 +1,16 @@
1
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/tag.svg` to regenerate;
2
+ import React from 'react'
3
+
4
+ function SvgTag(props) {
5
+ return (
6
+ <svg viewBox="0 0 16 16" fill="none" {...props}>
7
+ <path d="M5 6a1 1 0 100-2 1 1 0 000 2z" />
8
+ <path
9
+ clipRule="evenodd"
10
+ d="M2 0a2 2 0 00-2 2v5.89a2 2 0 00.586 1.415l5.98 5.973a2.462 2.462 0 003.481 0l5.236-5.237.002-.002a2.461 2.461 0 000-3.47L9.303.587A2 2 0 007.888 0H2zm0 2h5.888l5.978 5.98a.461.461 0 010 .649l-5.234 5.236a.46.46 0 01-.652 0L2 7.89V2z"
11
+ />
12
+ </svg>
13
+ )
14
+ }
15
+
16
+ export default SvgTag
@@ -432,14 +432,17 @@ const makeOverrides = theme => ({
432
432
  padding: 0,
433
433
  height: '2rem',
434
434
  backgroundColor: theme.palette.background.paper,
435
- textIndent: '2rem',
435
+ textIndent: '1rem',
436
436
  fontWeight: 'bold',
437
437
  fontSize: '.75rem',
438
438
  textTransform: 'uppercase',
439
439
  alignItems: 'center',
440
440
  display: 'flex',
441
441
  lineHeight: 1.33,
442
- color: theme.palette.text.secondary
442
+ color: theme.palette.text.secondary,
443
+ [theme.breakpoints.up('sm')]: {
444
+ textIndent: '2rem'
445
+ }
443
446
  },
444
447
  gutters: {
445
448
  paddingLeft: 0,
@@ -4,39 +4,33 @@ export const makeTypography = palette => ({
4
4
  fontFamily: getCssVariableValue('primaryFont') || 'Lato',
5
5
  h1: {
6
6
  fontSize: 48,
7
- color: palette.text.primary,
8
7
  fontWeight: 'bold',
9
8
  lineHeight: 1.087,
10
9
  letterSpacing: -0.8
11
10
  },
12
11
  h2: {
13
12
  fontSize: 32,
14
- color: palette.text.primary,
15
13
  fontWeight: 'bold',
16
14
  lineHeight: 1.313,
17
15
  letterSpacing: -0.4
18
16
  },
19
17
  h3: {
20
18
  fontSize: 24,
21
- color: palette.text.primary,
22
19
  fontWeight: 'bold',
23
20
  lineHeight: 1.167
24
21
  },
25
22
  h4: {
26
23
  fontSize: 20,
27
- color: palette.text.primary,
28
24
  fontWeight: 'bold',
29
25
  lineHeight: 1.167
30
26
  },
31
27
  h5: {
32
28
  fontSize: 18,
33
- color: palette.text.primary,
34
29
  fontWeight: 'bold',
35
30
  lineHeight: 1.313
36
31
  },
37
32
  h6: {
38
33
  fontSize: 16,
39
- color: palette.text.primary,
40
34
  fontWeight: 'bold',
41
35
  lineHeight: 1.313
42
36
  },
@@ -48,13 +42,11 @@ export const makeTypography = palette => ({
48
42
  },
49
43
  body1: {
50
44
  fontSize: 16,
51
- lineHeight: 1.313,
52
- color: palette.text.primary
45
+ lineHeight: 1.313
53
46
  },
54
47
  body2: {
55
48
  fontSize: 14,
56
- lineHeight: 1.313,
57
- color: palette.text.primary
49
+ lineHeight: 1.313
58
50
  },
59
51
  button: {
60
52
  fontWeight: 'bold',
@@ -35,7 +35,7 @@ exports[`SquareAppIcon component should render an app correctly with the app nam
35
35
  />
36
36
  </span>
37
37
  <h6
38
- class="MuiTypography-root makeStyles-name-7 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
38
+ class="MuiTypography-root makeStyles-name-7 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
39
39
  >
40
40
  Test
41
41
  </h6>
@@ -77,7 +77,7 @@ exports[`SquareAppIcon component should render an app correctly with the given n
77
77
  />
78
78
  </span>
79
79
  <h6
80
- class="MuiTypography-root makeStyles-name-1 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
80
+ class="MuiTypography-root makeStyles-name-1 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
81
81
  >
82
82
  modified
83
83
  </h6>
@@ -119,7 +119,7 @@ exports[`SquareAppIcon component should render an app with the app slug if no na
119
119
  />
120
120
  </span>
121
121
  <h6
122
- class="MuiTypography-root makeStyles-name-13 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
122
+ class="MuiTypography-root makeStyles-name-13 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
123
123
  >
124
124
  testslug
125
125
  </h6>
@@ -168,7 +168,7 @@ exports[`SquareAppIcon component should render correctly an app in add state 1`]
168
168
  />
169
169
  </span>
170
170
  <h6
171
- class="MuiTypography-root makeStyles-name-37 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
171
+ class="MuiTypography-root makeStyles-name-37 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
172
172
  />
173
173
  </div>
174
174
  `;
@@ -220,7 +220,7 @@ exports[`SquareAppIcon component should render correctly an app in error state 1
220
220
  />
221
221
  </span>
222
222
  <h6
223
- class="MuiTypography-root makeStyles-name-31 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
223
+ class="MuiTypography-root makeStyles-name-31 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
224
224
  >
225
225
  Test
226
226
  </h6>
@@ -262,7 +262,7 @@ exports[`SquareAppIcon component should render correctly an app in ghost state 1
262
262
  />
263
263
  </span>
264
264
  <h6
265
- class="MuiTypography-root makeStyles-name-25 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
265
+ class="MuiTypography-root makeStyles-name-25 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
266
266
  >
267
267
  Test
268
268
  </h6>
@@ -304,7 +304,7 @@ exports[`SquareAppIcon component should render correctly an app in maintenance s
304
304
  />
305
305
  </span>
306
306
  <h6
307
- class="MuiTypography-root makeStyles-name-19 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
307
+ class="MuiTypography-root makeStyles-name-19 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
308
308
  >
309
309
  Test
310
310
  </h6>
@@ -324,7 +324,7 @@ exports[`SquareAppIcon component should render correctly an app in shortcut stat
324
324
  style="background-color: rgb(61, 166, 126);"
325
325
  >
326
326
  <h2
327
- class="MuiTypography-root makeStyles-letter-44 MuiTypography-h2 MuiTypography-alignCenter"
327
+ class="MuiTypography-root makeStyles-letter-44 MuiTypography-h2 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
328
328
  >
329
329
  S
330
330
  </h2>
@@ -349,7 +349,7 @@ exports[`SquareAppIcon component should render correctly an app in shortcut stat
349
349
  </span>
350
350
  </span>
351
351
  <h6
352
- class="MuiTypography-root makeStyles-name-43 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
352
+ class="MuiTypography-root makeStyles-name-43 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
353
353
  >
354
354
  shortcut
355
355
  </h6>
@@ -392,7 +392,7 @@ exports[`SquareAppIcon component should render correctly an app with custom cont
392
392
  />
393
393
  </span>
394
394
  <h6
395
- class="MuiTypography-root makeStyles-name-49 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
395
+ class="MuiTypography-root makeStyles-name-49 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
396
396
  >
397
397
  custom icon
398
398
  </h6>
@@ -1,25 +1,12 @@
1
- Use typographic components to have sensible defaults for text
2
- content. The typography variants naming is based on material design.
1
+ Use typographic components to have sensible defaults for text content. The typography variants naming is based on material design.
3
2
 
4
- Read the original [Typography component](https://material-ui.com/components/typography/)
5
- documentation for more information.
6
-
7
- 🆕 The Typography component should be used instead of Text components.
8
-
9
- <details>
10
- <summary>⤵️ A codemod can be used to help you migrate the code (click here for more information).</summary>
11
-
12
- ```bash
13
- npm install -g jscodeshift
14
- jscodeshift -t node_modules/cozy-ui/codemods/transform-typography.js --parser babel src/
15
- ```
16
-
17
- </details>
3
+ Read the original [Typography component](https://v4.mui.com/components/typography/) documentation for more information.
18
4
 
19
5
  ```jsx
20
6
  import Typography from 'cozy-ui/transpiled/react/Typography'
21
7
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
22
8
  import Stack from 'cozy-ui/transpiled/react/Stack'
9
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
23
10
 
24
11
  const variants = [
25
12
  'h1',
@@ -32,58 +19,23 @@ const variants = [
32
19
  'body1',
33
20
  'body2',
34
21
  'caption',
35
- ];
36
-
37
- <Stack spacing='s'>
38
- { variants.map(variant => (
39
- <Typography variant={variant}>{variant}</Typography>
40
- )) }
41
- </Stack>
42
- ```
43
-
44
- You can use `color="textSecondary"`:
45
-
46
- ```jsx
47
- <Typography variant='body1' color="textSecondary">A text written in secondary text color.</Typography>
48
- ```
49
-
50
- From old to new :
51
-
52
- ```jsx
53
- import { Text, Caption, MainTitle, SubTitle, Title, Bold, ErrorMessage } from 'cozy-ui/transpiled/react/Text'
54
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
55
- import Typography from 'cozy-ui/transpiled/react/Typography';
56
-
57
- const trStyle = { borderBottom: '1px solid gray'}
58
- const tdStyle = { borderRight: '1px solid gray'};
59
-
60
- <table className='u-w-100'>
61
- <tbody>
62
- <tr style={trStyle}>
63
- <td style={tdStyle}><MainTitle>MainTitle</MainTitle></td>
64
- <td><Typography variant='h3'>is replaced by &lt;Typography variant="h3" &gt;</Typography></td>
65
- </tr>
66
- <tr style={trStyle}>
67
- <td style={tdStyle}><Title>Title</Title></td>
68
- <td><Typography variant='h4'>is replaced by &lt;Typography variant="h4" &gt;</Typography></td>
69
- </tr>
70
- <tr style={trStyle}>
71
- <td style={tdStyle}><SubTitle>SubTitle</SubTitle></td>
72
- <td><Typography variant='h5'>is replaced by &lt;Typography variant="h5" &gt;</Typography></td>
73
- </tr>
74
- <tr style={trStyle}>
75
- <td style={tdStyle}><Bold>Bold</Bold></td>
76
- <td><Typography variant='h6'>is replaced by &lt;Typography variant="h6" &gt;</Typography></td>
77
- </tr>
78
- <tr style={trStyle}>
79
- <td style={tdStyle}><Caption>Caption</Caption></td>
80
- <td><Typography variant='caption' color='textSecondary'>is replaced by &lt;Typography variant="caption" color="textSecondary" /&gt; </Typography></td>
81
- </tr>
82
- <tr style={trStyle}>
83
- <td style={tdStyle}><ErrorMessage>ErrorMessage</ErrorMessage></td>
84
- <td><Typography variant='body1' color='error'>is replaced by &lt;Typography color="error" variant='body1' /&gt; </Typography></td>
85
- </tr>
86
- </tbody>
87
- </table>
88
-
22
+ ]
23
+ const colors = ['initial', 'inherit', 'primary', 'secondary', 'textPrimary', 'textSecondary', 'error']
24
+
25
+ ;
26
+
27
+ <Grid container>
28
+ {colors.map((color, index) =>
29
+ <Grid item xs={6} sm={3} md={2} className="u-mb-2" key={index}>
30
+ <Stack spacing="s">
31
+ <div>{color}</div>
32
+ {variants.map(variant =>
33
+ <div key={variant + color}>
34
+ <Typography variant={variant} color={color}>{variant}</Typography>
35
+ </div>
36
+ )}
37
+ </Stack>
38
+ </Grid>
39
+ )}
40
+ </Grid>
89
41
  ```
@@ -1,3 +1,15 @@
1
- import Typography from '@material-ui/core/Typography'
1
+ import React, { forwardRef } from 'react'
2
+ import MuiTypography from '@material-ui/core/Typography'
3
+
4
+ const Typography = forwardRef(({ color, variant, children, ...props }, ref) => {
5
+ const madeColor =
6
+ color || (variant === 'caption' ? 'textSecondary' : 'textPrimary')
7
+
8
+ return (
9
+ <MuiTypography ref={ref} variant={variant} color={madeColor} {...props}>
10
+ {children}
11
+ </MuiTypography>
12
+ )
13
+ })
2
14
 
3
15
  export default Typography
@@ -3,7 +3,7 @@ import cx from 'classnames'
3
3
 
4
4
  import Icon from 'cozy-ui/transpiled/react/Icon'
5
5
  import Button from 'cozy-ui/transpiled/react/Button'
6
- import { MainTitle } from 'cozy-ui/transpiled/react/Text'
6
+ import Typography from 'cozy-ui/transpiled/react/Typography'
7
7
  import Input from 'cozy-ui/transpiled/react/Input'
8
8
 
9
9
  import styles from './styles.styl'
@@ -58,12 +58,12 @@ export const WizardDescription = ({ children }) => {
58
58
 
59
59
  export const WizardTitle = ({ children, tag, className }) => {
60
60
  return (
61
- <MainTitle
62
- tag={tag || 'h1'}
61
+ <Typography
62
+ variant={tag || 'h3'}
63
63
  className={cx(styles['wizard-title'], className)}
64
64
  >
65
65
  {children}
66
- </MainTitle>
66
+ </Typography>
67
67
  )
68
68
  }
69
69