cozy-ui 111.8.1 → 111.10.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,21 @@
1
+ # [111.10.0](https://github.com/cozy/cozy-ui/compare/v111.9.0...v111.10.0) (2024-09-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add secret in GA deploy script ([67e17f2](https://github.com/cozy/cozy-ui/commit/67e17f2))
7
+ * **Badge:** Add `success`, `warning`, `info` colors ([2445e51](https://github.com/cozy/cozy-ui/commit/2445e51))
8
+ * Revert adding token, seems not to be the problem ([4898612](https://github.com/cozy/cozy-ui/commit/4898612))
9
+ * Try to use GITHUB_TOKEN to deploy ([8a18c13](https://github.com/cozy/cozy-ui/commit/8a18c13))
10
+ * Update deploy config to avoid Protected branch update failed error ([5a13cfa](https://github.com/cozy/cozy-ui/commit/5a13cfa))
11
+
12
+ # [111.9.0](https://github.com/cozy/cozy-ui/compare/v111.8.1...v111.9.0) (2024-09-05)
13
+
14
+
15
+ ### Features
16
+
17
+ * Add markdwon component ([366def6](https://github.com/cozy/cozy-ui/commit/366def6))
18
+
1
19
  ## [111.8.1](https://github.com/cozy/cozy-ui/compare/v111.8.0...v111.8.1) (2024-08-28)
2
20
 
3
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "111.8.1",
3
+ "version": "111.10.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -137,7 +137,6 @@
137
137
  "prettier": "2.6.0",
138
138
  "pretty": "2.0.0",
139
139
  "prop-types": "15.7.2",
140
- "puppeteer-core": "22.15.0",
141
140
  "react": "16.12.0",
142
141
  "react-dom": "16.12.0",
143
142
  "react-hot-loader": "^4.3.11",
@@ -1,6 +1,6 @@
1
- export const generateI18nConfig = (categories?: {
2
- [key: string]: string
3
- }): {
1
+ export const generateI18nConfig = (
2
+ categories?: Record<string, string>
3
+ ): {
4
4
  en: Record<string, string>
5
5
  fr: Record<string, string>
6
6
  } => {
@@ -11,7 +11,7 @@ export const generateI18nConfig = (categories?: {
11
11
  for (const [key, value] of Object.entries(categories)) {
12
12
  // Extract the final part of the path as the display name
13
13
  const displayName =
14
- value?.split('/').pop() ?? ''.replace(/([A-Z])/g, ' $1').trim()
14
+ value.split('/').pop() ?? ''.replace(/([A-Z])/g, ' $1').trim()
15
15
 
16
16
  i18nConfig[`app_categories.${key}`] = displayName
17
17
  }
@@ -13,19 +13,15 @@ import Variants from 'cozy-ui/docs/components/Variants'
13
13
  import CircleFilledIcon from "cozy-ui/transpiled/react/Icons/CircleFilled"
14
14
 
15
15
  const initialVariants = [
16
- { overlap: true, error: false, dot: false, withBorder: false, left: false, bottom: false, small: false, large: false }
16
+ { overlap: true, dot: false, withBorder: false, left: false, bottom: false, small: false, large: false }
17
17
  ]
18
18
 
19
- ;
20
-
21
- <Variants initialVariants={initialVariants} screenshotAllVariants>
22
- {variant => (
19
+ const DemoBadge = ({ variant, ...props }) => {
20
+ return (
23
21
  <Badge
22
+ {...props}
24
23
  className="u-m-half"
25
24
  badgeContent={4}
26
- color={
27
- variant.error ? "error" : variant.secondaryColor ? "secondary" : "primary"
28
- }
29
25
  variant={variant.dot ? "dot" : "standard"}
30
26
  size={variant.large ? "large" : variant.small ? "small" : "medium"}
31
27
  anchorOrigin={{
@@ -41,6 +37,22 @@ const initialVariants = [
41
37
  color="var(--slateGrey)"
42
38
  />
43
39
  </Badge>
40
+ )
41
+ }
42
+
43
+ ;
44
+
45
+ <Variants initialVariants={initialVariants} screenshotAllVariants>
46
+ {variant => (
47
+ <>
48
+ <DemoBadge variant={variant} color="default" />
49
+ <DemoBadge variant={variant} color="primary" />
50
+ <DemoBadge variant={variant} color="secondary" />
51
+ <DemoBadge variant={variant} color="success" />
52
+ <DemoBadge variant={variant} color="error" />
53
+ <DemoBadge variant={variant} color="warning" />
54
+ <DemoBadge variant={variant} color="info" />
55
+ </>
44
56
  )}
45
57
  </Variants>
46
58
  ```
@@ -8,6 +8,7 @@ const Badge = ({
8
8
  size,
9
9
  withBorder,
10
10
  overlap: overlapProp,
11
+ color,
11
12
  ...props
12
13
  }) => {
13
14
  const sizeClasses = {
@@ -28,10 +29,16 @@ const Badge = ({
28
29
  return (
29
30
  <MuiBadge
30
31
  classes={{
31
- badge: cx(sizeClasses[size], withBorder ? 'badgeBorder' : null),
32
+ badge: cx(sizeClasses[size], {
33
+ badgeBorder: !!withBorder,
34
+ colorSuccess: color === 'success',
35
+ colorWarning: color === 'warning',
36
+ colorInfo: color === 'info'
37
+ }),
32
38
  ...classes
33
39
  }}
34
40
  overlap={overlap}
41
+ color={['success', 'warning', 'info'].includes(color) ? 'primary' : color}
35
42
  {...props}
36
43
  />
37
44
  )
@@ -42,6 +49,16 @@ Badge.propTypes = {
42
49
  horizontal: PropTypes.oneOf(['left', 'right']),
43
50
  vertical: PropTypes.oneOf(['bottom', 'top'])
44
51
  }),
52
+ className: PropTypes.string,
53
+ color: PropTypes.oneOf([
54
+ 'default',
55
+ 'success',
56
+ 'warning',
57
+ 'error',
58
+ 'info',
59
+ 'primary',
60
+ 'secondary'
61
+ ]),
45
62
  size: PropTypes.oneOf(['small', 'medium', 'large']),
46
63
  showZero: PropTypes.bool,
47
64
  variant: PropTypes.oneOf(['standard', 'dot']),
@@ -17,12 +17,12 @@ import {
17
17
  import { DialogTitle, DialogContent } from '../Dialog'
18
18
  import Icon from '../Icon'
19
19
  import PlusIcon from '../Icons/Plus'
20
+ import TextField from '../TextField'
20
21
  import useEventListener from '../hooks/useEventListener'
21
22
  import useRealtime from '../hooks/useRealtime'
22
- import CozyTheme from '../providers/CozyTheme'
23
23
  import useBreakpoints from '../providers/Breakpoints'
24
+ import CozyTheme from '../providers/CozyTheme'
24
25
  import { useI18n } from '../providers/I18n'
25
- import TextField from '../TextField'
26
26
 
27
27
  const ContactsListModal = ({
28
28
  onItemClick,
@@ -1,5 +1,5 @@
1
- import '@testing-library/jest-dom'
2
1
  import { Theme } from '@material-ui/core'
2
+ import '@testing-library/jest-dom'
3
3
  import { render } from '@testing-library/react'
4
4
  import React from 'react'
5
5
 
@@ -0,0 +1,71 @@
1
+ This component is used to render markdown content. To see more about the Markdown, you can check the [Markdown Guide](https://www.markdownguide.org/).
2
+
3
+ ```jsx
4
+
5
+ import Markdown from 'cozy-ui/transpiled/react/Markdown'
6
+
7
+ const textInMarkdown = `
8
+ # Demo
9
+
10
+ This is a text to test all possibilities of markdown.
11
+
12
+ ## Headers
13
+
14
+ # H1 Header
15
+ ## H2 Header
16
+ ### H3 Header
17
+ #### H4 Header
18
+ ##### H5 Header
19
+ ###### H6 Header
20
+
21
+ ## Paragraphs
22
+
23
+ I really like using Markdown.
24
+
25
+ I think I'll use it to format all of my documents from now on.
26
+
27
+ ## Emphasis
28
+
29
+ _Italic Text_
30
+
31
+ ***Bold Text***
32
+
33
+ __Bold and Italic Text__
34
+
35
+ ~~Strikethrough~~
36
+
37
+ <u>Underline</u>
38
+
39
+ ## Lists
40
+
41
+ 1. Ordered List Item 1
42
+ 2. Ordered List Item 2
43
+ 3. Ordered List Item 3
44
+
45
+ - Unordered List Item 1
46
+ - Unordered List Item 2
47
+ - Unordered List Item 3
48
+
49
+ ## Links
50
+
51
+ [Link to GitHub](https://github.com/cozy/cozy-ui)
52
+
53
+ ## Images
54
+
55
+ ![The San Juan Mountains are beautiful!](/assets/images/san-juan-mountains.jpg "San Juan Mountains")
56
+
57
+ ## Code
58
+
59
+ Inline code: \`const variable = 'value';\`
60
+
61
+ Block code:
62
+ \`\`\`javascript function add(a, b) { return a + b; }\`\`\`
63
+
64
+ ## Blockquotes
65
+
66
+ > This is a blockquote.
67
+ `;
68
+
69
+ <Markdown content={textInMarkdown} />
70
+
71
+ ```
@@ -0,0 +1,32 @@
1
+ import React from 'react'
2
+ import ReactMarkdown from 'react-markdown'
3
+
4
+ import Link from '../Link'
5
+ import Typography from '../Typography'
6
+
7
+ const Markdown = ({ content }) => {
8
+ return (
9
+ <ReactMarkdown
10
+ source={content}
11
+ renderers={{
12
+ link: ({ children, href }) => (
13
+ <Link href={href} rel="noreferrer" target="_blank">
14
+ {children}
15
+ </Link>
16
+ ),
17
+ heading: ({ children, level }) => (
18
+ <Typography variant={`h${level}`} className="u-mb-1">
19
+ {children}
20
+ </Typography>
21
+ ),
22
+ paragraph: ({ children }) => (
23
+ <Typography variant="body1" className="u-mb-1">
24
+ {children}
25
+ </Typography>
26
+ )
27
+ }}
28
+ />
29
+ )
30
+ }
31
+
32
+ export default Markdown
@@ -723,6 +723,20 @@ export const makeLightNormalOverrides = theme => ({
723
723
  fontSize: '.5rem'
724
724
  }
725
725
  },
726
+ colorPrimary: {
727
+ '&.colorSuccess': {
728
+ backgroundColor: theme.palette.success.main,
729
+ color: theme.palette.success.contrastText
730
+ },
731
+ '&.colorWarning': {
732
+ backgroundColor: theme.palette.warning.main,
733
+ color: theme.palette.warning.contrastText
734
+ },
735
+ '&.colorInfo': {
736
+ backgroundColor: theme.palette.info.main,
737
+ color: theme.palette.info.contrastText
738
+ }
739
+ },
726
740
  anchorOriginTopRightRectangular: {
727
741
  transform: 'scale(1) translate(37%, -37%)'
728
742
  },
@@ -1,6 +1,5 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import React, { useEffect, useState } from 'react'
3
- import ReactMarkdown from 'react-markdown'
4
3
 
5
4
  import { useInstanceInfo } from 'cozy-client'
6
5
  import { buildPremiumLink } from 'cozy-client/dist/models/instance'
@@ -14,6 +13,7 @@ import Button from '../Buttons'
14
13
  import { IllustrationDialog } from '../CozyDialogs'
15
14
  import Icon from '../Icon'
16
15
  import CozyUpgradeIcon from '../Icons/CozyUpgrade'
16
+ import Markdown from '../Markdown'
17
17
  import Spinner from '../Spinner'
18
18
  import Typography from '../Typography'
19
19
  import { useI18n } from '../providers/I18n'
@@ -94,13 +94,10 @@ const Paywall = ({ variant, onClose, isPublic, contentInterpolation }) => {
94
94
  />
95
95
  }
96
96
  content={
97
- <ReactMarkdown
98
- source={t(`${variant}Paywall.${type}.content`, {
97
+ <Markdown
98
+ content={t(`${variant}Paywall.${type}.content`, {
99
99
  ...contentInterpolation
100
100
  })}
101
- renderers={{
102
- paragraph: ({ children }) => <p className="u-mt-0">{children}</p>
103
- }}
104
101
  />
105
102
  }
106
103
  onClose={onClose}
@@ -94,15 +94,15 @@ const makeClient = premiumLink =>
94
94
  }
95
95
  ]
96
96
  },
97
- 'io.cozy.settings/context': {
97
+ 'io.cozy.settings/io.cozy.settings.context': {
98
98
  doctype: 'io.cozy.settings',
99
99
  definition: {
100
100
  doctype: 'io.cozy.settings',
101
- id: 'io.cozy.settings/context'
101
+ id: 'io.cozy.settings/io.cozy.settings.context'
102
102
  },
103
103
  data: [
104
104
  {
105
- id: 'io.cozy.settings/context',
105
+ id: 'io.cozy.settings/io.cozy.settings.context',
106
106
  attributes: {
107
107
  enable_premium_links: premiumLink,
108
108
  manager_url: 'http://mycozy.cloud',
@@ -356,8 +356,8 @@ exports[`Avatar should render examples: Avatar 1`] = `
356
356
  exports[`Badge should render examples: Badge 1`] = `
357
357
  "<div data-testid=\\"mountNode\\">
358
358
  <div class=\\"MuiPaper-root u-p-1 u-mb-1 MuiPaper-elevation1\\">
359
- <h5 class=\\"MuiTypography-root u-mb-1 MuiTypography-h5 MuiTypography-colorTextPrimary\\">Variant selector</h5><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary PrivateSwitchBase-checked-2 Mui-checked MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"OVERLAP\\" aria-checked=\\"\\" value=\\"\\" checked=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">OVERLAP</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"ERROR\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">ERROR</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"DOT\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">DOT</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"WITHBORDER\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">WITHBORDER</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"LEFT\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">LEFT</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"BOTTOM\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">BOTTOM</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"SMALL\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">SMALL</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"LARGE\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">LARGE</span></label>
360
- </div><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium MuiBadge-anchorOriginTopRightCircular MuiBadge-colorPrimary\\">4</span></span>
359
+ <h5 class=\\"MuiTypography-root u-mb-1 MuiTypography-h5 MuiTypography-colorTextPrimary\\">Variant selector</h5><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary PrivateSwitchBase-checked-2 Mui-checked MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"OVERLAP\\" aria-checked=\\"\\" value=\\"\\" checked=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">OVERLAP</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"DOT\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">DOT</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"WITHBORDER\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">WITHBORDER</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"LEFT\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">LEFT</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"BOTTOM\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">BOTTOM</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"SMALL\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">SMALL</span></label><label class=\\"MuiFormControlLabel-root\\"><span class=\\"MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-1 MuiCheckbox-root MuiCheckbox-colorPrimary MuiIconButton-colorPrimary\\" aria-disabled=\\"false\\"><span class=\\"MuiIconButton-label\\"><input class=\\"PrivateSwitchBase-input-4\\" type=\\"checkbox\\" data-indeterminate=\\"false\\" aria-label=\\"LARGE\\" aria-checked=\\"\\" value=\\"\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\"><path d=\\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\\"></path></svg></span></span><span class=\\"MuiTypography-root MuiFormControlLabel-label MuiTypography-body1\\">LARGE</span></label>
360
+ </div><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium MuiBadge-anchorOriginTopRightCircular\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium MuiBadge-anchorOriginTopRightCircular MuiBadge-colorPrimary\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium MuiBadge-anchorOriginTopRightCircular MuiBadge-colorSecondary\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium colorSuccess MuiBadge-anchorOriginTopRightCircular MuiBadge-colorPrimary\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium MuiBadge-anchorOriginTopRightCircular MuiBadge-colorError\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium colorWarning MuiBadge-anchorOriginTopRightCircular MuiBadge-colorPrimary\\">4</span></span><span class=\\"MuiBadge-root u-m-half\\"><svg viewBox=\\"0 0 16 16\\" class=\\"styles__icon___23x3R\\" style=\\"fill: var(--slateGrey);\\" width=\\"24\\" height=\\"24\\"><circle cx=\\"8\\" cy=\\"8\\" r=\\"8\\" fill-rule=\\"evenodd\\"></circle></svg><span class=\\"MuiBadge-badge badgeSizeMedium colorInfo MuiBadge-anchorOriginTopRightCircular MuiBadge-colorPrimary\\">4</span></span>
361
361
  </div>"
362
362
  `;
363
363
 
package/react/index.js CHANGED
@@ -137,3 +137,4 @@ export { default as AlertProvider, useAlert } from './Alert'
137
137
  export { default as Modal } from './Modal'
138
138
  export { ListSkeleton, ListItemSkeleton } from './Skeletons'
139
139
  export { default as ActionsBar } from './ActionsBar'
140
+ export { default as Markdown } from './Markdown'
@@ -1,6 +1,4 @@
1
- export declare const generateI18nConfig: (categories?: {
2
- [key: string]: string;
3
- } | undefined) => {
1
+ export declare const generateI18nConfig: (categories?: Record<string, string> | undefined) => {
4
2
  en: Record<string, string>;
5
3
  fr: Record<string, string>;
6
4
  };
@@ -10,12 +10,12 @@ export var generateI18nConfig = function generateI18nConfig(categories) {
10
10
  var _value$split$pop;
11
11
 
12
12
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
13
- _key = _Object$entries$_i[0],
13
+ key = _Object$entries$_i[0],
14
14
  value = _Object$entries$_i[1];
15
15
 
16
16
  // Extract the final part of the path as the display name
17
- var displayName = (_value$split$pop = value === null || value === void 0 ? void 0 : value.split('/').pop()) !== null && _value$split$pop !== void 0 ? _value$split$pop : ''.replace(/([A-Z])/g, ' $1').trim();
18
- i18nConfig["app_categories.".concat(_key)] = displayName;
17
+ var displayName = (_value$split$pop = value.split('/').pop()) !== null && _value$split$pop !== void 0 ? _value$split$pop : ''.replace(/([A-Z])/g, ' $1').trim();
18
+ i18nConfig["app_categories.".concat(key)] = displayName;
19
19
  }
20
20
 
21
21
  return {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["classes", "size", "withBorder", "overlap"];
4
+ var _excluded = ["classes", "size", "withBorder", "overlap", "color"];
5
5
 
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
7
 
@@ -18,6 +18,7 @@ var Badge = function Badge(_ref) {
18
18
  size = _ref.size,
19
19
  withBorder = _ref.withBorder,
20
20
  overlapProp = _ref.overlap,
21
+ color = _ref.color,
21
22
  props = _objectWithoutProperties(_ref, _excluded);
22
23
 
23
24
  var sizeClasses = {
@@ -30,9 +31,15 @@ var Badge = function Badge(_ref) {
30
31
  var overlap = overlapProp === 'circle' ? 'circular' : overlapProp === 'rectangle' ? 'rectangular' : overlapProp;
31
32
  return /*#__PURE__*/React.createElement(MuiBadge, _extends({
32
33
  classes: _objectSpread({
33
- badge: cx(sizeClasses[size], withBorder ? 'badgeBorder' : null)
34
+ badge: cx(sizeClasses[size], {
35
+ badgeBorder: !!withBorder,
36
+ colorSuccess: color === 'success',
37
+ colorWarning: color === 'warning',
38
+ colorInfo: color === 'info'
39
+ })
34
40
  }, classes),
35
- overlap: overlap
41
+ overlap: overlap,
42
+ color: ['success', 'warning', 'info'].includes(color) ? 'primary' : color
36
43
  }, props));
37
44
  };
38
45
 
@@ -41,6 +48,8 @@ Badge.propTypes = {
41
48
  horizontal: PropTypes.oneOf(['left', 'right']),
42
49
  vertical: PropTypes.oneOf(['bottom', 'top'])
43
50
  }),
51
+ className: PropTypes.string,
52
+ color: PropTypes.oneOf(['default', 'success', 'warning', 'error', 'info', 'primary', 'secondary']),
44
53
  size: PropTypes.oneOf(['small', 'medium', 'large']),
45
54
  showZero: PropTypes.bool,
46
55
  variant: PropTypes.oneOf(['standard', 'dot']),
@@ -15,12 +15,12 @@ import { TopAnchoredDialog, DialogCloseButton, useCozyDialog } from "cozy-ui/tra
15
15
  import { DialogTitle, DialogContent } from "cozy-ui/transpiled/react/Dialog";
16
16
  import Icon from "cozy-ui/transpiled/react/Icon";
17
17
  import PlusIcon from "cozy-ui/transpiled/react/Icons/Plus";
18
+ import TextField from "cozy-ui/transpiled/react/TextField";
18
19
  import useEventListener from "cozy-ui/transpiled/react/hooks/useEventListener";
19
20
  import useRealtime from "cozy-ui/transpiled/react/hooks/useRealtime";
20
- import CozyTheme from "cozy-ui/transpiled/react/providers/CozyTheme";
21
21
  import useBreakpoints from "cozy-ui/transpiled/react/providers/Breakpoints";
22
+ import CozyTheme from "cozy-ui/transpiled/react/providers/CozyTheme";
22
23
  import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
23
- import TextField from "cozy-ui/transpiled/react/TextField";
24
24
 
25
25
  var ContactsListModal = function ContactsListModal(_ref) {
26
26
  var onItemClick = _ref.onItemClick,
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import ReactMarkdown from 'react-markdown';
3
+ import Link from "cozy-ui/transpiled/react/Link";
4
+ import Typography from "cozy-ui/transpiled/react/Typography";
5
+
6
+ var Markdown = function Markdown(_ref) {
7
+ var content = _ref.content;
8
+ return /*#__PURE__*/React.createElement(ReactMarkdown, {
9
+ source: content,
10
+ renderers: {
11
+ link: function link(_ref2) {
12
+ var children = _ref2.children,
13
+ href = _ref2.href;
14
+ return /*#__PURE__*/React.createElement(Link, {
15
+ href: href,
16
+ rel: "noreferrer",
17
+ target: "_blank"
18
+ }, children);
19
+ },
20
+ heading: function heading(_ref3) {
21
+ var children = _ref3.children,
22
+ level = _ref3.level;
23
+ return /*#__PURE__*/React.createElement(Typography, {
24
+ variant: "h".concat(level),
25
+ className: "u-mb-1"
26
+ }, children);
27
+ },
28
+ paragraph: function paragraph(_ref4) {
29
+ var children = _ref4.children;
30
+ return /*#__PURE__*/React.createElement(Typography, {
31
+ variant: "body1",
32
+ className: "u-mb-1"
33
+ }, children);
34
+ }
35
+ }
36
+ });
37
+ };
38
+
39
+ export default Markdown;
@@ -753,6 +753,20 @@ export function makeDarkInvertedOverrides(theme: any): {
753
753
  fontSize: string;
754
754
  };
755
755
  };
756
+ colorPrimary: {
757
+ '&.colorSuccess': {
758
+ backgroundColor: any;
759
+ color: any;
760
+ };
761
+ '&.colorWarning': {
762
+ backgroundColor: any;
763
+ color: any;
764
+ };
765
+ '&.colorInfo': {
766
+ backgroundColor: any;
767
+ color: any;
768
+ };
769
+ };
756
770
  anchorOriginTopRightRectangular: {
757
771
  transform: string;
758
772
  };
@@ -753,6 +753,20 @@ export function makeDarkNormalOverrides(theme: any): {
753
753
  fontSize: string;
754
754
  };
755
755
  };
756
+ colorPrimary: {
757
+ '&.colorSuccess': {
758
+ backgroundColor: any;
759
+ color: any;
760
+ };
761
+ '&.colorWarning': {
762
+ backgroundColor: any;
763
+ color: any;
764
+ };
765
+ '&.colorInfo': {
766
+ backgroundColor: any;
767
+ color: any;
768
+ };
769
+ };
756
770
  anchorOriginTopRightRectangular: {
757
771
  transform: string;
758
772
  };
@@ -753,6 +753,20 @@ export function makeLightInvertedOverrides(theme: any): {
753
753
  fontSize: string;
754
754
  };
755
755
  };
756
+ colorPrimary: {
757
+ '&.colorSuccess': {
758
+ backgroundColor: any;
759
+ color: any;
760
+ };
761
+ '&.colorWarning': {
762
+ backgroundColor: any;
763
+ color: any;
764
+ };
765
+ '&.colorInfo': {
766
+ backgroundColor: any;
767
+ color: any;
768
+ };
769
+ };
756
770
  anchorOriginTopRightRectangular: {
757
771
  transform: string;
758
772
  };
@@ -753,6 +753,20 @@ export function makeLightNormalOverrides(theme: any): {
753
753
  fontSize: string;
754
754
  };
755
755
  };
756
+ colorPrimary: {
757
+ '&.colorSuccess': {
758
+ backgroundColor: any;
759
+ color: any;
760
+ };
761
+ '&.colorWarning': {
762
+ backgroundColor: any;
763
+ color: any;
764
+ };
765
+ '&.colorInfo': {
766
+ backgroundColor: any;
767
+ color: any;
768
+ };
769
+ };
756
770
  anchorOriginTopRightRectangular: {
757
771
  transform: string;
758
772
  };
@@ -667,6 +667,20 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
667
667
  fontSize: '.5rem'
668
668
  }
669
669
  },
670
+ colorPrimary: {
671
+ '&.colorSuccess': {
672
+ backgroundColor: theme.palette.success.main,
673
+ color: theme.palette.success.contrastText
674
+ },
675
+ '&.colorWarning': {
676
+ backgroundColor: theme.palette.warning.main,
677
+ color: theme.palette.warning.contrastText
678
+ },
679
+ '&.colorInfo': {
680
+ backgroundColor: theme.palette.info.main,
681
+ color: theme.palette.info.contrastText
682
+ }
683
+ },
670
684
  anchorOriginTopRightRectangular: {
671
685
  transform: 'scale(1) translate(37%, -37%)'
672
686
  },