cozy-ui 141.0.0 → 142.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 +37 -0
- package/package.json +4 -4
- package/react/Dialog/Readme.md +1 -3
- package/react/Markdown/index.jsx +29 -20
- package/react/Markdown/index.spec.jsx +29 -0
- package/react/Table/Readme.md +33 -27
- package/react/Table/Virtualized/Cell.jsx +7 -3
- package/react/Table/Virtualized/HeadCell.jsx +11 -2
- package/react/Table/Virtualized/index.jsx +9 -5
- package/react/Table/Virtualized/locales/en.json +6 -0
- package/react/Table/Virtualized/locales/fr.json +6 -0
- package/react/Table/Virtualized/locales/ru.json +6 -0
- package/react/Table/Virtualized/locales/vi.json +6 -0
- package/transpiled/react/Markdown/index.js +43 -30
- package/transpiled/react/Markdown/index.spec.d.ts +1 -0
- package/transpiled/react/Table/Virtualized/Cell.js +4 -3
- package/transpiled/react/Table/Virtualized/HeadCell.js +37 -1
- package/transpiled/react/Table/Virtualized/index.d.ts +1 -0
- package/transpiled/react/Table/Virtualized/index.js +6 -3
- package/transpiled/react/stylesheet.css +1 -1
- package/react/deprecated/InfosCarrousel/Readme.md +0 -64
- package/react/deprecated/InfosCarrousel/index.jsx +0 -107
- package/react/deprecated/InfosCarrousel/styles.styl +0 -31
- package/react/deprecated/ViewStack/ModalStack.jsx +0 -43
- package/react/deprecated/ViewStack/Readme.md +0 -10
- package/react/deprecated/ViewStack/ViewStack.jsx +0 -41
- package/react/deprecated/ViewStack/context.js +0 -4
- package/react/deprecated/ViewStack/example.jsx +0 -41
- package/react/deprecated/ViewStack/hooks.js +0 -30
- package/react/deprecated/ViewStack/index.js +0 -3
- package/transpiled/react/deprecated/InfosCarrousel/index.d.ts +0 -24
- package/transpiled/react/deprecated/InfosCarrousel/index.js +0 -118
- package/transpiled/react/deprecated/ViewStack/ModalStack.d.ts +0 -16
- package/transpiled/react/deprecated/ViewStack/ModalStack.js +0 -47
- package/transpiled/react/deprecated/ViewStack/ViewStack.d.ts +0 -13
- package/transpiled/react/deprecated/ViewStack/ViewStack.js +0 -49
- package/transpiled/react/deprecated/ViewStack/context.d.ts +0 -3
- package/transpiled/react/deprecated/ViewStack/context.js +0 -5
- package/transpiled/react/deprecated/ViewStack/example.d.ts +0 -3
- package/transpiled/react/deprecated/ViewStack/example.js +0 -66
- package/transpiled/react/deprecated/ViewStack/hooks.d.ts +0 -1
- package/transpiled/react/deprecated/ViewStack/hooks.js +0 -77
- package/transpiled/react/deprecated/ViewStack/index.d.ts +0 -3
- package/transpiled/react/deprecated/ViewStack/index.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
# [142.1.0](https://github.com/cozy/cozy-ui/compare/v142.0.1...v142.1.0) (2026-09-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Table:** Keep slow clicks on VirtualizedTable cells without a long press handler ([a283f77](https://github.com/cozy/cozy-ui/commit/a283f77))
|
|
7
|
+
* **Table:** Show a pointer only on clickable VirtualizedTable cells ([9953f49](https://github.com/cozy/cozy-ui/commit/9953f49))
|
|
8
|
+
* **Table:** Sort VirtualizedTable rows only when rows or order change ([b1be981](https://github.com/cozy/cozy-ui/commit/b1be981))
|
|
9
|
+
* **Table:** Translate the VirtualizedTable sort direction announcement ([2d67cd8](https://github.com/cozy/cozy-ui/commit/2d67cd8))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **Table:** Export VirtuosoMockContext to test VirtualizedTable ([ba3e8bd](https://github.com/cozy/cozy-ui/commit/ba3e8bd))
|
|
15
|
+
|
|
16
|
+
## [142.0.1](https://github.com/cozy/cozy-ui/compare/v142.0.0...v142.0.1) (2026-09-17)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* Dialog doc ([1d28879](https://github.com/cozy/cozy-ui/commit/1d28879))
|
|
22
|
+
|
|
23
|
+
# [142.0.0](https://github.com/cozy/cozy-ui/compare/v141.0.0...v142.0.0) (2026-09-03)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* Build docs with transpiled [@react-spring](https://github.com/react-spring) ([07af455](https://github.com/cozy/cozy-ui/commit/07af455))
|
|
29
|
+
* Remove ViewStack and InfosCarrousel ([db3eeef](https://github.com/cozy/cozy-ui/commit/db3eeef))
|
|
30
|
+
* Update mui-bottom-sheet ([384f167](https://github.com/cozy/cozy-ui/commit/384f167))
|
|
31
|
+
* Update react-markdown ([7eb612c](https://github.com/cozy/cozy-ui/commit/7eb612c))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* ViewStack and InfosCarrousel have been removed without replacement.
|
|
37
|
+
|
|
1
38
|
# [141.0.0](https://github.com/cozy/cozy-ui/compare/v140.6.0...v141.0.0) (2026-07-30)
|
|
2
39
|
|
|
3
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "142.1.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "24.x"
|
|
@@ -169,18 +169,18 @@
|
|
|
169
169
|
"date-fns": "2.30.0",
|
|
170
170
|
"hammerjs": "^2.0.8",
|
|
171
171
|
"intersection-observer": "0.11.0",
|
|
172
|
-
"mui-bottom-sheet": "https://github.com/cozy/mui-bottom-sheet.git#v1.0.
|
|
172
|
+
"mui-bottom-sheet": "https://github.com/cozy/mui-bottom-sheet.git#v1.0.10",
|
|
173
173
|
"node-polyglot": "^2.5.0",
|
|
174
174
|
"normalize.css": "^8.0.0",
|
|
175
175
|
"patch-package": "^8.0.0",
|
|
176
176
|
"pdf-lib": "1.17.1",
|
|
177
177
|
"react-colorful": "5.7.0",
|
|
178
|
-
"react-markdown": "^
|
|
178
|
+
"react-markdown": "^6.0.3",
|
|
179
179
|
"react-popper": "^2.2.3",
|
|
180
180
|
"react-remove-scroll": "^2.4.0",
|
|
181
181
|
"react-select": "^4.3.0",
|
|
182
|
-
"react-swipeable-views": "^0.13.3",
|
|
183
182
|
"react-virtuoso": "^4.13.0",
|
|
183
|
+
"remark-gfm": "^1.0.0",
|
|
184
184
|
"rooks": "7.14.1"
|
|
185
185
|
},
|
|
186
186
|
"peerDependencies": {
|
package/react/Dialog/Readme.md
CHANGED
|
@@ -18,9 +18,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
18
18
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
19
19
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
20
20
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
21
|
-
import { FileTypeFolder, FileTypeText, Icon } from '@linagora/twake-icons'
|
|
22
|
-
|
|
23
|
-
import { Dots } from '@linagora/twake-icons'
|
|
21
|
+
import { FileTypeFolder, FileTypeText, Icon, Dots } from '@linagora/twake-icons'
|
|
24
22
|
|
|
25
23
|
const handleClose = () => setState({ modalOpened: !state.modalOpened })
|
|
26
24
|
|
package/react/Markdown/index.jsx
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import ReactMarkdown from 'react-markdown'
|
|
3
|
+
import remarkGfm from 'remark-gfm'
|
|
3
4
|
|
|
4
5
|
import Link from '../Link'
|
|
5
6
|
import Typography from '../Typography'
|
|
6
7
|
|
|
8
|
+
const heading =
|
|
9
|
+
level =>
|
|
10
|
+
({ children }) =>
|
|
11
|
+
(
|
|
12
|
+
<Typography variant={`h${level}`} className="u-mb-1">
|
|
13
|
+
{children}
|
|
14
|
+
</Typography>
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const components = {
|
|
18
|
+
a: ({ children, href }) => (
|
|
19
|
+
<Link href={href} rel="noreferrer" target="_blank">
|
|
20
|
+
{children}
|
|
21
|
+
</Link>
|
|
22
|
+
),
|
|
23
|
+
p: ({ children }) => (
|
|
24
|
+
<Typography variant="body1" className="u-mb-1">
|
|
25
|
+
{children}
|
|
26
|
+
</Typography>
|
|
27
|
+
),
|
|
28
|
+
...Object.fromEntries(
|
|
29
|
+
[1, 2, 3, 4, 5, 6].map(level => [`h${level}`, heading(level)])
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
7
33
|
const Markdown = ({ content }) => {
|
|
8
34
|
return (
|
|
9
|
-
<ReactMarkdown
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
/>
|
|
35
|
+
<ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>
|
|
36
|
+
{content}
|
|
37
|
+
</ReactMarkdown>
|
|
29
38
|
)
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import Markdown from '.'
|
|
5
|
+
|
|
6
|
+
describe('Markdown', () => {
|
|
7
|
+
it('renders headings and paragraphs', () => {
|
|
8
|
+
render(<Markdown content={'# Title\n\nSome text.'} />)
|
|
9
|
+
|
|
10
|
+
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Title')
|
|
11
|
+
expect(screen.getByText('Some text.')).toBeInTheDocument()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('renders links that open in a new tab', () => {
|
|
15
|
+
render(<Markdown content="[cozy](https://cozy.io)" />)
|
|
16
|
+
|
|
17
|
+
const link = screen.getByRole('link', { name: 'cozy' })
|
|
18
|
+
|
|
19
|
+
expect(link).toHaveAttribute('href', 'https://cozy.io')
|
|
20
|
+
expect(link).toHaveAttribute('target', '_blank')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('renders strikethrough', () => {
|
|
24
|
+
render(<Markdown content="~~gone~~" />)
|
|
25
|
+
|
|
26
|
+
expect(screen.getByText('gone')).toBeInTheDocument()
|
|
27
|
+
expect(document.querySelector('del')).toBeInTheDocument()
|
|
28
|
+
})
|
|
29
|
+
})
|
package/react/Table/Readme.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
```jsx
|
|
4
4
|
import { useState } from 'react'
|
|
5
5
|
import VirtualizedTable from 'cozy-ui/transpiled/react/Table/Virtualized'
|
|
6
|
+
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
|
|
6
7
|
import Variants from 'cozy-ui/docs/components/Variants'
|
|
7
8
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
8
9
|
import Stack from 'cozy-ui/transpiled/react/Stack'
|
|
@@ -138,26 +139,28 @@ const SelectButton = () => {
|
|
|
138
139
|
|
|
139
140
|
;
|
|
140
141
|
|
|
141
|
-
<
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
142
|
+
<DemoProvider>
|
|
143
|
+
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
144
|
+
{variant => (
|
|
145
|
+
<>
|
|
146
|
+
<SelectionProvider>
|
|
147
|
+
<Typography className="u-mt-1" variant="h4">Not sorted table</Typography>
|
|
148
|
+
<SelectButton />
|
|
149
|
+
<div style={{ border: "1px solid var(--borderMainColor)", height: 400, width: "100%" }}>
|
|
150
|
+
<ExampleTable variant={variant} />
|
|
151
|
+
</div>
|
|
152
|
+
</SelectionProvider>
|
|
153
|
+
<SelectionProvider>
|
|
154
|
+
<Typography className="u-mt-1" variant="h4">Sorted table</Typography>
|
|
155
|
+
<SelectButton />
|
|
156
|
+
<div style={{ border: "1px solid var(--borderMainColor)", height: 400, width: "100%" }}>
|
|
157
|
+
<ExampleTable variant={variant} defaultOrder={{by: columns[0].id, direction: 'asc'}} />
|
|
158
|
+
</div>
|
|
159
|
+
</SelectionProvider>
|
|
160
|
+
</>
|
|
161
|
+
)}
|
|
162
|
+
</Variants>
|
|
163
|
+
</DemoProvider>
|
|
161
164
|
```
|
|
162
165
|
|
|
163
166
|
### With Drag'n'Drop
|
|
@@ -165,6 +168,7 @@ const SelectButton = () => {
|
|
|
165
168
|
```jsx
|
|
166
169
|
import { useState } from 'react'
|
|
167
170
|
import VirtualizedTableDnd from 'cozy-ui/transpiled/react/Table/Virtualized/Dnd'
|
|
171
|
+
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
|
|
168
172
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
169
173
|
import SelectionProvider, { useSelection } from 'cozy-ui/transpiled/react/providers/Selection'
|
|
170
174
|
import { DndProvider } from 'react-dnd'
|
|
@@ -238,11 +242,13 @@ const DndExample = () => {
|
|
|
238
242
|
|
|
239
243
|
;
|
|
240
244
|
|
|
241
|
-
<
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
</
|
|
245
|
+
<DemoProvider>
|
|
246
|
+
<SelectionProvider>
|
|
247
|
+
<DndProvider backend={HTML5Backend}>
|
|
248
|
+
<div className="u-mt-half" style={{ border: "1px solid var(--borderMainColor)", height: 400, width: "100%" }}>
|
|
249
|
+
<DndExample />
|
|
250
|
+
</div>
|
|
251
|
+
</DndProvider>
|
|
252
|
+
</SelectionProvider>
|
|
253
|
+
</DemoProvider>
|
|
248
254
|
```
|
|
@@ -28,17 +28,21 @@ const Cell = ({
|
|
|
28
28
|
const [isLongPress, setIsLongPress] = useState(false) // onClick is triggered after a long press anyway, so we need this bool to avoid this behavior
|
|
29
29
|
const [lastClickTime, setLastClickTime] = useState(0)
|
|
30
30
|
|
|
31
|
-
const classes = useStyles({
|
|
31
|
+
const classes = useStyles({
|
|
32
|
+
column,
|
|
33
|
+
isClickable: !!onClick && !column.disableClick
|
|
34
|
+
})
|
|
32
35
|
const cellContent = get(row, column.id, '—')
|
|
33
36
|
|
|
34
37
|
const longPressRef = useOnLongPress(
|
|
35
38
|
() => {
|
|
36
|
-
|
|
39
|
+
// without a long press handler, a slow click must stay a click
|
|
40
|
+
if (column.disableClick || !onLongPress) {
|
|
37
41
|
return
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
setIsLongPress(true)
|
|
41
|
-
onLongPress
|
|
45
|
+
onLongPress(row, column)
|
|
42
46
|
},
|
|
43
47
|
{ duration: 300 }
|
|
44
48
|
)
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
2
3
|
|
|
4
|
+
import en from './locales/en.json'
|
|
5
|
+
import fr from './locales/fr.json'
|
|
6
|
+
import ru from './locales/ru.json'
|
|
7
|
+
import vi from './locales/vi.json'
|
|
3
8
|
import TableCell from '../../TableCell'
|
|
4
9
|
import TableSortLabel from '../../TableSortLabel'
|
|
5
10
|
import { makeStyles } from '../../styles'
|
|
6
11
|
|
|
12
|
+
const locales = { en, fr, ru, vi }
|
|
13
|
+
|
|
7
14
|
const useStyles = makeStyles({
|
|
8
15
|
root: {
|
|
9
16
|
width: ({ column }) => column.width,
|
|
@@ -18,6 +25,8 @@ const TableHeadCell = ({
|
|
|
18
25
|
orderDirection,
|
|
19
26
|
onClick
|
|
20
27
|
}) => {
|
|
28
|
+
useExtendI18n(locales)
|
|
29
|
+
const { t } = useI18n()
|
|
21
30
|
const classes = useStyles({ column })
|
|
22
31
|
|
|
23
32
|
return (
|
|
@@ -39,8 +48,8 @@ const TableHeadCell = ({
|
|
|
39
48
|
{orderBy === column.id && (
|
|
40
49
|
<span className={className}>
|
|
41
50
|
{orderDirection === 'desc'
|
|
42
|
-
? '
|
|
43
|
-
: '
|
|
51
|
+
? t('VirtualizedTable.sortedDesc')
|
|
52
|
+
: t('VirtualizedTable.sortedAsc')}
|
|
44
53
|
</span>
|
|
45
54
|
)}
|
|
46
55
|
</TableSortLabel>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
|
-
import React, { useState, forwardRef } from 'react'
|
|
2
|
+
import React, { useMemo, useState, forwardRef } from 'react'
|
|
3
3
|
import { TableVirtuoso, GroupedTableVirtuoso } from 'react-virtuoso'
|
|
4
4
|
|
|
5
|
+
export { VirtuosoMockContext } from 'react-virtuoso'
|
|
6
|
+
|
|
5
7
|
import FixedHeaderContent from './FixedHeaderContent'
|
|
6
8
|
import RowContent from './RowContent'
|
|
7
9
|
import { stableSort, getComparator } from './helpers'
|
|
@@ -32,10 +34,12 @@ const VirtualizedTable = forwardRef(
|
|
|
32
34
|
)
|
|
33
35
|
const [orderBy, setOrderBy] = useState(defaultOrder?.by ?? undefined)
|
|
34
36
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const data = useMemo(() => {
|
|
38
|
+
const sortedData = orderBy
|
|
39
|
+
? stableSort(rows, getComparator(orderDirection, orderBy))
|
|
40
|
+
: rows
|
|
41
|
+
return secondarySort ? secondarySort(sortedData) : sortedData
|
|
42
|
+
}, [rows, orderBy, orderDirection, secondarySort])
|
|
39
43
|
const { groupLabels, groupCounts } = groups?.(data) || {}
|
|
40
44
|
const isGroupedTable = !!groupCounts
|
|
41
45
|
const _context = {
|
|
@@ -1,39 +1,52 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
1
7
|
import React from 'react';
|
|
2
8
|
import ReactMarkdown from 'react-markdown';
|
|
9
|
+
import remarkGfm from 'remark-gfm';
|
|
3
10
|
import Link from "cozy-ui/transpiled/react/Link";
|
|
4
11
|
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
5
12
|
|
|
6
|
-
var
|
|
7
|
-
|
|
13
|
+
var heading = function heading(level) {
|
|
14
|
+
return function (_ref) {
|
|
15
|
+
var children = _ref.children;
|
|
16
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
17
|
+
variant: "h".concat(level),
|
|
18
|
+
className: "u-mb-1"
|
|
19
|
+
}, children);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var components = _objectSpread({
|
|
24
|
+
a: function a(_ref2) {
|
|
25
|
+
var children = _ref2.children,
|
|
26
|
+
href = _ref2.href;
|
|
27
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
28
|
+
href: href,
|
|
29
|
+
rel: "noreferrer",
|
|
30
|
+
target: "_blank"
|
|
31
|
+
}, children);
|
|
32
|
+
},
|
|
33
|
+
p: function p(_ref3) {
|
|
34
|
+
var children = _ref3.children;
|
|
35
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
36
|
+
variant: "body1",
|
|
37
|
+
className: "u-mb-1"
|
|
38
|
+
}, children);
|
|
39
|
+
}
|
|
40
|
+
}, Object.fromEntries([1, 2, 3, 4, 5, 6].map(function (level) {
|
|
41
|
+
return ["h".concat(level), heading(level)];
|
|
42
|
+
})));
|
|
43
|
+
|
|
44
|
+
var Markdown = function Markdown(_ref4) {
|
|
45
|
+
var content = _ref4.content;
|
|
8
46
|
return /*#__PURE__*/React.createElement(ReactMarkdown, {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
});
|
|
47
|
+
remarkPlugins: [remarkGfm],
|
|
48
|
+
components: components
|
|
49
|
+
}, content);
|
|
37
50
|
};
|
|
38
51
|
|
|
39
52
|
export default Markdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -47,16 +47,17 @@ var Cell = function Cell(_ref4) {
|
|
|
47
47
|
|
|
48
48
|
var classes = useStyles({
|
|
49
49
|
column: column,
|
|
50
|
-
isClickable: !!onClick
|
|
50
|
+
isClickable: !!onClick && !column.disableClick
|
|
51
51
|
});
|
|
52
52
|
var cellContent = get(row, column.id, '—');
|
|
53
53
|
var longPressRef = useOnLongPress(function () {
|
|
54
|
-
|
|
54
|
+
// without a long press handler, a slow click must stay a click
|
|
55
|
+
if (column.disableClick || !onLongPress) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
setIsLongPress(true);
|
|
59
|
-
onLongPress
|
|
60
|
+
onLongPress(row, column);
|
|
60
61
|
}, {
|
|
61
62
|
duration: 300
|
|
62
63
|
});
|
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useI18n, useExtendI18n } from 'twake-i18n';
|
|
3
|
+
var en = {
|
|
4
|
+
VirtualizedTable: {
|
|
5
|
+
sortedAsc: "sorted ascending",
|
|
6
|
+
sortedDesc: "sorted descending"
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var fr = {
|
|
10
|
+
VirtualizedTable: {
|
|
11
|
+
sortedAsc: "tri croissant",
|
|
12
|
+
sortedDesc: "tri d\xE9croissant"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var ru = {
|
|
16
|
+
VirtualizedTable: {
|
|
17
|
+
sortedAsc: "\u043E\u0442\u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u043F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E",
|
|
18
|
+
sortedDesc: "\u043E\u0442\u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u043F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var vi = {
|
|
22
|
+
VirtualizedTable: {
|
|
23
|
+
sortedAsc: "s\u1EAFp x\u1EBFp t\u0103ng d\u1EA7n",
|
|
24
|
+
sortedDesc: "s\u1EAFp x\u1EBFp gi\u1EA3m d\u1EA7n"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
2
27
|
import TableCell from "cozy-ui/transpiled/react/TableCell";
|
|
3
28
|
import TableSortLabel from "cozy-ui/transpiled/react/TableSortLabel";
|
|
4
29
|
import { makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
30
|
+
var locales = {
|
|
31
|
+
en: en,
|
|
32
|
+
fr: fr,
|
|
33
|
+
ru: ru,
|
|
34
|
+
vi: vi
|
|
35
|
+
};
|
|
5
36
|
var useStyles = makeStyles({
|
|
6
37
|
root: {
|
|
7
38
|
width: function width(_ref) {
|
|
@@ -23,6 +54,11 @@ var TableHeadCell = function TableHeadCell(_ref3) {
|
|
|
23
54
|
orderBy = _ref3.orderBy,
|
|
24
55
|
orderDirection = _ref3.orderDirection,
|
|
25
56
|
onClick = _ref3.onClick;
|
|
57
|
+
useExtendI18n(locales);
|
|
58
|
+
|
|
59
|
+
var _useI18n = useI18n(),
|
|
60
|
+
t = _useI18n.t;
|
|
61
|
+
|
|
26
62
|
var classes = useStyles({
|
|
27
63
|
column: column
|
|
28
64
|
});
|
|
@@ -39,7 +75,7 @@ var TableHeadCell = function TableHeadCell(_ref3) {
|
|
|
39
75
|
onClick: onClick
|
|
40
76
|
}, column.label, orderBy === column.id && /*#__PURE__*/React.createElement("span", {
|
|
41
77
|
className: className
|
|
42
|
-
}, orderDirection === 'desc' ? '
|
|
78
|
+
}, orderDirection === 'desc' ? t('VirtualizedTable.sortedDesc') : t('VirtualizedTable.sortedAsc'))) : column.label);
|
|
43
79
|
};
|
|
44
80
|
|
|
45
81
|
export default TableHeadCell;
|
|
@@ -9,8 +9,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, { useState, forwardRef } from 'react';
|
|
12
|
+
import React, { useMemo, useState, forwardRef } from 'react';
|
|
13
13
|
import { TableVirtuoso, GroupedTableVirtuoso } from 'react-virtuoso';
|
|
14
|
+
export { VirtuosoMockContext } from 'react-virtuoso';
|
|
14
15
|
import FixedHeaderContent from "cozy-ui/transpiled/react/Table/Virtualized/FixedHeaderContent";
|
|
15
16
|
import RowContent from "cozy-ui/transpiled/react/Table/Virtualized/RowContent";
|
|
16
17
|
import { stableSort, getComparator } from "cozy-ui/transpiled/react/Table/Virtualized/helpers";
|
|
@@ -43,8 +44,10 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
43
44
|
orderBy = _useState4[0],
|
|
44
45
|
setOrderBy = _useState4[1];
|
|
45
46
|
|
|
46
|
-
var
|
|
47
|
-
|
|
47
|
+
var data = useMemo(function () {
|
|
48
|
+
var sortedData = orderBy ? stableSort(rows, getComparator(orderDirection, orderBy)) : rows;
|
|
49
|
+
return secondarySort ? secondarySort(sortedData) : sortedData;
|
|
50
|
+
}, [rows, orderBy, orderDirection, secondarySort]);
|
|
48
51
|
|
|
49
52
|
var _ref2 = (groups === null || groups === void 0 ? void 0 : groups(data)) || {},
|
|
50
53
|
groupLabels = _ref2.groupLabels,
|