cozy-ui 146.3.1 → 146.5.1
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 +22 -0
- package/assets/icons/illus/empty-members-illustration.svg +1 -0
- package/package.json +1 -1
- package/react/ColorList/Readme.md +2 -0
- package/react/ColorList/index.jsx +19 -4
- package/react/ColorList/index.spec.jsx +56 -0
- package/react/EditBadge/Readme.md +1 -0
- package/react/EditBadge/index.jsx +12 -2
- package/react/Icons/EmptyMembersIllustration.jsx +15 -0
- package/react/MemberAutocomplete/Readme.md +24 -0
- package/react/MemberList/EmptyMembers.jsx +2 -2
- package/react/MemberRow/MemberOrGroupAvatar.jsx +14 -4
- package/transpiled/react/ColorList/index.d.ts +6 -1
- package/transpiled/react/ColorList/index.js +23 -8
- package/transpiled/react/ColorList/index.spec.d.ts +1 -0
- package/transpiled/react/EditBadge/index.d.ts +6 -1
- package/transpiled/react/EditBadge/index.js +13 -5
- package/transpiled/react/Icons/EmptyMembersIllustration.d.ts +2 -0
- package/transpiled/react/Icons/EmptyMembersIllustration.js +15 -0
- package/transpiled/react/MemberList/EmptyMembers.js +4 -5
- package/transpiled/react/MemberRow/MemberOrGroupAvatar.d.ts +3 -1
- package/transpiled/react/MemberRow/MemberOrGroupAvatar.js +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [146.5.1](https://github.com/cozy/cozy-ui/compare/v146.5.0...v146.5.1) (2026-11-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **MemberAutocomplete:** Give the chip avatars the chip styles ([1cb1300](https://github.com/cozy/cozy-ui/commit/1cb1300))
|
|
7
|
+
* **MemberList:** Use the mockup illustration in the empty state ([ecccbbd](https://github.com/cozy/cozy-ui/commit/ecccbbd))
|
|
8
|
+
|
|
9
|
+
# [146.5.0](https://github.com/cozy/cozy-ui/compare/v146.4.0...v146.5.0) (2026-11-04)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **ColorList:** Name the colors ([886abac](https://github.com/cozy/cozy-ui/commit/886abac))
|
|
15
|
+
|
|
16
|
+
# [146.4.0](https://github.com/cozy/cozy-ui/compare/v146.3.1...v146.4.0) (2026-11-04)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **EditBadge:** Add componentsProps to customize the badge button ([8248bc7](https://github.com/cozy/cozy-ui/commit/8248bc7))
|
|
22
|
+
|
|
1
23
|
## [146.3.1](https://github.com/cozy/cozy-ui/compare/v146.3.0...v146.3.1) (2026-11-03)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="59" height="37" viewBox="0 0 59 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.59 22.783c.182-.274.37-.544.57-.807l.408-.536-.478-.279a10.822 10.822 0 0 0-5.449-1.46C4.774 19.702 0 24.352 0 30.067v3.185c0 .59.494 1.069 1.101 1.069h11.907v-3.012c0-.347.015-.714.048-1.154l.017-.212c.033-.384.081-.767.143-1.147l.01-.05c.068-.407.153-.81.254-1.21.1-.394.216-.782.347-1.166l-.47-.155.498.072c.26-.749.576-1.477.947-2.177l.081-.153c.174-.32.36-.634.555-.941l.152-.232Zm-4.949-5.728c3.103 0 5.628-2.458 5.628-5.479 0-3.02-2.525-5.478-5.628-5.478s-5.627 2.457-5.627 5.479c0 3.02 2.524 5.478 5.627 5.478m33.654 13.297c-.01-.149-.02-.297-.035-.446-.01-.099-.024-.197-.036-.296a12.178 12.178 0 0 0-.051-.394c-.016-.102-.035-.203-.052-.304a14.777 14.777 0 0 0-.07-.382c-.02-.098-.043-.196-.065-.294a13.065 13.065 0 0 0-.091-.385l-.074-.273c-.038-.135-.076-.27-.118-.403l-.078-.24a15.208 15.208 0 0 0-.15-.43c-.024-.068-.049-.134-.074-.2a12.983 12.983 0 0 0-.256-.619 14.777 14.777 0 0 0-.233-.503c-.018-.034-.034-.07-.051-.104-.09-.181-.185-.36-.284-.538l-.03-.057a14.061 14.061 0 0 0-.34-.571l-.005-.011c-2.577-4.123-7.236-6.882-12.545-6.882a14.807 14.807 0 0 0-11.29 5.174l-.06.07a14.64 14.64 0 0 0-.752.977c-.034.049-.069.097-.102.146-.087.129-.173.258-.257.39-.041.065-.084.13-.124.196-.069.111-.134.225-.2.337-.05.088-.102.174-.15.263-.046.083-.088.168-.133.252-.062.119-.125.236-.184.357l-.011.024a14.081 14.081 0 0 0-1.155 3.472l-.04.212a14.116 14.116 0 0 0-.103.7c-.016.123-.031.245-.043.369-.013.126-.02.252-.03.378-.007.096-.016.191-.02.287-.011.227-.018.455-.018.684v4.48c0 .668.564 1.212 1.256 1.212h26.835c.692 0 1.255-.544 1.255-1.213v-4.479c0-.236-.006-.471-.018-.704-.004-.084-.013-.168-.018-.252Zm-14.98-16.418c3.948 0 7.16-3.126 7.16-6.967 0-3.841-3.212-6.967-7.16-6.967-3.95 0-7.16 3.126-7.16 6.967 0 3.841 3.211 6.967 7.16 6.967Zm18.866 5.03c-2.088 0-4.115.593-5.86 1.715l-.462.296.35.42a15.717 15.717 0 0 1 1.999 3.07l.024.05c.1.205.197.412.29.625l.036.08c.088.205.171.412.265.657l.019.046c.176.472.33.952.459 1.44l.029.118c.05.193.096.388.138.584l.05.252a14.119 14.119 0 0 1 .19 1.21c.011.096.023.19.032.286.016.165.028.33.038.496l.017.249c.012.249.02.498.02.75v2.274h11.907c.607 0 1.1-.48 1.1-1.07v-3.184c0-5.714-4.774-10.363-10.641-10.363m0-2.391c3.103 0 5.627-2.458 5.627-5.479 0-3.02-2.524-5.478-5.627-5.478-3.103 0-5.627 2.458-5.627 5.478 0 3.021 2.524 5.479 5.627 5.479Z" fill="#DCEDFD"/></svg>
|
package/package.json
CHANGED
|
@@ -15,8 +15,10 @@ const ColorPickerDemo = ({ variant }) => {
|
|
|
15
15
|
<div style={{ width: (variant.medium || isMobile) ? '100%' : 200 }}>
|
|
16
16
|
<ColorList
|
|
17
17
|
size={variant.medium ? 'medium' : undefined}
|
|
18
|
+
getColorLabel={color => `Color ${color}`}
|
|
18
19
|
customColorProps={{
|
|
19
20
|
enabled: true,
|
|
21
|
+
'aria-label': 'Custom color',
|
|
20
22
|
onClick: () => {}
|
|
21
23
|
}}
|
|
22
24
|
selectedColor={selectedColor}
|
|
@@ -15,7 +15,15 @@ const sizeToPx = {
|
|
|
15
15
|
medium: 41
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const ColorList = ({
|
|
18
|
+
const ColorList = ({
|
|
19
|
+
size,
|
|
20
|
+
selectedColor,
|
|
21
|
+
getColorLabel,
|
|
22
|
+
customColorProps,
|
|
23
|
+
onClick
|
|
24
|
+
}) => {
|
|
25
|
+
const { enabled: isCustomEnabled, ...customButtonProps } =
|
|
26
|
+
customColorProps ?? {}
|
|
19
27
|
const { isMobile } = useBreakpoints()
|
|
20
28
|
|
|
21
29
|
const _size = size || (isMobile ? 'medium' : 'small')
|
|
@@ -37,6 +45,8 @@ const ColorList = ({ size, selectedColor, customColorProps, onClick }) => {
|
|
|
37
45
|
<ButtonBase
|
|
38
46
|
className="u-bdrs-circle"
|
|
39
47
|
component="div"
|
|
48
|
+
aria-label={getColorLabel?.(color) ?? color}
|
|
49
|
+
aria-pressed={selectedColor?.toUpperCase() === color}
|
|
40
50
|
onClick={() => onClick?.(color)}
|
|
41
51
|
>
|
|
42
52
|
<Avatar color={color} size={avatarSize}>
|
|
@@ -49,12 +59,13 @@ const ColorList = ({ size, selectedColor, customColorProps, onClick }) => {
|
|
|
49
59
|
</ButtonBase>
|
|
50
60
|
</ImageListItem>
|
|
51
61
|
))}
|
|
52
|
-
{
|
|
62
|
+
{isCustomEnabled && (
|
|
53
63
|
<ImageListItem
|
|
54
64
|
className="u-ta-center"
|
|
55
65
|
classes={{ item: 'u-ov-visible' }}
|
|
56
66
|
>
|
|
57
67
|
<Button
|
|
68
|
+
{...customButtonProps}
|
|
58
69
|
className="u-miw-auto u-mih-auto u-p-0 u-bdrs-circle"
|
|
59
70
|
variant="ghost"
|
|
60
71
|
style={{
|
|
@@ -68,7 +79,6 @@ const ColorList = ({ size, selectedColor, customColorProps, onClick }) => {
|
|
|
68
79
|
}}
|
|
69
80
|
classes={{ label: 'u-flex u-w-auto' }}
|
|
70
81
|
label={<Icon icon={Palette} size={iconSize} color="#000" />}
|
|
71
|
-
onClick={ev => customColorProps?.onClick(ev)}
|
|
72
82
|
/>
|
|
73
83
|
</ImageListItem>
|
|
74
84
|
)}
|
|
@@ -79,9 +89,14 @@ const ColorList = ({ size, selectedColor, customColorProps, onClick }) => {
|
|
|
79
89
|
ColorList.propTypes = {
|
|
80
90
|
size: propTypes.oneOf(['small', 'medium']),
|
|
81
91
|
selectedColor: propTypes.string,
|
|
92
|
+
/** Accessible name of a color. Defaults to its hexadecimal code */
|
|
93
|
+
getColorLabel: propTypes.func,
|
|
82
94
|
customColorProps: propTypes.shape({
|
|
83
95
|
enabled: propTypes.bool,
|
|
84
|
-
onClick: propTypes.func
|
|
96
|
+
onClick: propTypes.func,
|
|
97
|
+
'aria-label': propTypes.string,
|
|
98
|
+
'aria-pressed': propTypes.bool,
|
|
99
|
+
'data-testid': propTypes.string
|
|
85
100
|
}),
|
|
86
101
|
onClick: propTypes.func
|
|
87
102
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import ColorList from '.'
|
|
5
|
+
import { BreakpointsProvider } from '../providers/Breakpoints'
|
|
6
|
+
|
|
7
|
+
const setup = props =>
|
|
8
|
+
render(
|
|
9
|
+
<BreakpointsProvider>
|
|
10
|
+
<ColorList {...props} />
|
|
11
|
+
</BreakpointsProvider>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
describe('ColorList', () => {
|
|
15
|
+
it('lets a keyboard reach and pick a color', () => {
|
|
16
|
+
const onClick = jest.fn()
|
|
17
|
+
setup({ onClick })
|
|
18
|
+
|
|
19
|
+
const color = screen.getByRole('button', { name: '#273891' })
|
|
20
|
+
expect(color.tabIndex).toBe(0)
|
|
21
|
+
fireEvent.keyDown(color, { key: 'Enter' })
|
|
22
|
+
expect(onClick).toHaveBeenCalledWith('#273891')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('names its colors and tells the selected one, whatever its case', () => {
|
|
26
|
+
setup({
|
|
27
|
+
selectedColor: '#7e57e3',
|
|
28
|
+
getColorLabel: color => (color === '#7E57E3' ? 'Purple' : color)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
expect(screen.getByRole('button', { name: 'Purple' })).toHaveAttribute(
|
|
32
|
+
'aria-pressed',
|
|
33
|
+
'true'
|
|
34
|
+
)
|
|
35
|
+
expect(screen.getByRole('button', { name: '#273891' })).toHaveAttribute(
|
|
36
|
+
'aria-pressed',
|
|
37
|
+
'false'
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('passes its props to the custom color button', () => {
|
|
42
|
+
const onClick = jest.fn()
|
|
43
|
+
setup({
|
|
44
|
+
customColorProps: {
|
|
45
|
+
enabled: true,
|
|
46
|
+
onClick,
|
|
47
|
+
'aria-label': 'Custom color',
|
|
48
|
+
'data-testid': 'custom'
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
fireEvent.click(screen.getByRole('button', { name: 'Custom color' }))
|
|
53
|
+
expect(onClick).toHaveBeenCalledTimes(1)
|
|
54
|
+
expect(screen.queryByTestId('custom')).toBeInTheDocument()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Icon, Pen } from '@linagora/twake-icons'
|
|
2
|
+
import cx from 'classnames'
|
|
2
3
|
import PropTypes from 'prop-types'
|
|
3
4
|
import React, { useState, useRef } from 'react'
|
|
4
5
|
|
|
@@ -12,6 +13,7 @@ const EditBadge = ({
|
|
|
12
13
|
onUpload,
|
|
13
14
|
onDelete,
|
|
14
15
|
anchorOrigin,
|
|
16
|
+
componentsProps,
|
|
15
17
|
children,
|
|
16
18
|
...props
|
|
17
19
|
}) => {
|
|
@@ -28,9 +30,13 @@ const EditBadge = ({
|
|
|
28
30
|
badgeContent={
|
|
29
31
|
<>
|
|
30
32
|
<Button
|
|
33
|
+
{...componentsProps?.button}
|
|
31
34
|
ref={menuAnchorRef}
|
|
32
35
|
component="div"
|
|
33
|
-
className=
|
|
36
|
+
className={cx(
|
|
37
|
+
'u-miw-auto u-w-2-half u-h-2-half u-bdrs-circle',
|
|
38
|
+
componentsProps?.button?.className
|
|
39
|
+
)}
|
|
34
40
|
classes={{ label: 'u-flex u-w-auto' }}
|
|
35
41
|
style={{
|
|
36
42
|
outline: '4px solid var(--paperBackgroundColor)'
|
|
@@ -74,7 +80,11 @@ EditBadge.defaultProps = {
|
|
|
74
80
|
EditBadge.propTypes = {
|
|
75
81
|
src: PropTypes.func.isRequired,
|
|
76
82
|
onUpload: PropTypes.func.isRequired,
|
|
77
|
-
onDelete: PropTypes.func.isRequired
|
|
83
|
+
onDelete: PropTypes.func.isRequired,
|
|
84
|
+
componentsProps: PropTypes.shape({
|
|
85
|
+
/** Props spread to the badge button */
|
|
86
|
+
button: PropTypes.object
|
|
87
|
+
})
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
export default EditBadge
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/illus/empty-members-illustration.svg` to regenerate;
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function SvgEmptyMembersIllustration(props) {
|
|
5
|
+
return (
|
|
6
|
+
<svg viewBox="0 0 59 37" fill="none" {...props}>
|
|
7
|
+
<path
|
|
8
|
+
d="M15.59 22.783c.182-.274.37-.544.57-.807l.408-.536-.478-.279a10.822 10.822 0 00-5.449-1.46C4.774 19.702 0 24.352 0 30.067v3.185c0 .59.494 1.069 1.101 1.069h11.907v-3.012c0-.347.015-.714.048-1.154l.017-.212c.033-.384.081-.767.143-1.147l.01-.05a15.11 15.11 0 01.601-2.376l-.47-.155.498.072c.26-.749.576-1.477.947-2.177l.081-.153c.174-.32.36-.634.555-.941l.152-.232zm-4.949-5.728c3.103 0 5.628-2.458 5.628-5.479 0-3.02-2.525-5.478-5.628-5.478s-5.627 2.457-5.627 5.479c0 3.02 2.524 5.478 5.627 5.478m33.654 13.297c-.01-.149-.02-.297-.035-.446-.01-.099-.024-.197-.036-.296a12.178 12.178 0 00-.051-.394c-.016-.102-.035-.203-.052-.304a14.777 14.777 0 00-.07-.382c-.02-.098-.043-.196-.065-.294a13.065 13.065 0 00-.091-.385l-.074-.273c-.038-.135-.076-.27-.118-.403l-.078-.24a15.208 15.208 0 00-.15-.43c-.024-.068-.049-.134-.074-.2a12.983 12.983 0 00-.256-.619 14.777 14.777 0 00-.233-.503c-.018-.034-.034-.07-.051-.104-.09-.181-.185-.36-.284-.538l-.03-.057a14.061 14.061 0 00-.34-.571l-.005-.011c-2.577-4.123-7.236-6.882-12.545-6.882a14.807 14.807 0 00-11.29 5.174l-.06.07a14.64 14.64 0 00-.752.977c-.034.049-.069.097-.102.146-.087.129-.173.258-.257.39-.041.065-.084.13-.124.196-.069.111-.134.225-.2.337-.05.088-.102.174-.15.263-.046.083-.088.168-.133.252-.062.119-.125.236-.184.357l-.011.024a14.081 14.081 0 00-1.155 3.472l-.04.212a14.116 14.116 0 00-.103.7c-.016.123-.031.245-.043.369-.013.126-.02.252-.03.378-.007.096-.016.191-.02.287-.011.227-.018.455-.018.684v4.48c0 .668.564 1.212 1.256 1.212h26.835c.692 0 1.255-.544 1.255-1.213v-4.479c0-.236-.006-.471-.018-.704-.004-.084-.013-.168-.018-.252zm-14.98-16.418c3.948 0 7.16-3.126 7.16-6.967 0-3.841-3.212-6.967-7.16-6.967-3.95 0-7.16 3.126-7.16 6.967 0 3.841 3.211 6.967 7.16 6.967zm18.866 5.03c-2.088 0-4.115.593-5.86 1.715l-.462.296.35.42a15.717 15.717 0 011.999 3.07l.024.05c.1.205.197.412.29.625l.036.08c.088.205.171.412.265.657l.019.046c.176.472.33.952.459 1.44l.029.118c.05.193.096.388.138.584l.05.252a14.119 14.119 0 01.19 1.21c.011.096.023.19.032.286.016.165.028.33.038.496l.017.249c.012.249.02.498.02.75v2.274h11.907c.607 0 1.1-.48 1.1-1.07v-3.184c0-5.714-4.774-10.363-10.641-10.363m0-2.391c3.103 0 5.627-2.458 5.627-5.479 0-3.02-2.524-5.478-5.627-5.478-3.103 0-5.627 2.458-5.627 5.478 0 3.021 2.524 5.479 5.627 5.479z"
|
|
9
|
+
fill="#DCEDFD"
|
|
10
|
+
/>
|
|
11
|
+
</svg>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default SvgEmptyMembersIllustration
|
|
@@ -63,3 +63,27 @@ initialState = { members: [], role: 'readWrite' }
|
|
|
63
63
|
</Variants>
|
|
64
64
|
</DemoProvider>
|
|
65
65
|
```
|
|
66
|
+
|
|
67
|
+
### With picked members
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
|
|
71
|
+
import MemberAutocomplete from 'cozy-ui/transpiled/react/MemberAutocomplete'
|
|
72
|
+
|
|
73
|
+
const members = [
|
|
74
|
+
{ id: 'alice', name: 'Alice Wonderland', subtitle: 'alice@cozy.cc', email: 'alice@cozy.cc', initials: 'AW' },
|
|
75
|
+
{ id: 'bob', name: 'Bob Sponge', subtitle: 'bob@cozy.cc', email: 'bob@cozy.cc', initials: 'BS' },
|
|
76
|
+
{ id: 'family', name: 'Family', subtitle: '3 members', isGroup: true, color: '#FF7F1B' }
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
;
|
|
80
|
+
|
|
81
|
+
<DemoProvider>
|
|
82
|
+
<MemberAutocomplete
|
|
83
|
+
value={members}
|
|
84
|
+
title="Add people"
|
|
85
|
+
onChange={() => {}}
|
|
86
|
+
onSubmit={() => {}}
|
|
87
|
+
/>
|
|
88
|
+
</DemoProvider>
|
|
89
|
+
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Icon, Team } from '@linagora/twake-icons'
|
|
2
1
|
import cx from 'classnames'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
import { useI18n, useExtendI18n } from 'twake-i18n'
|
|
5
4
|
|
|
6
5
|
import { locales } from './locales'
|
|
6
|
+
import EmptyMembersIllustration from '../Icons/EmptyMembersIllustration'
|
|
7
7
|
import Typography from '../Typography'
|
|
8
8
|
import useBreakpoints from '../providers/Breakpoints'
|
|
9
9
|
import { alpha, makeStyles } from '../styles'
|
|
@@ -31,7 +31,7 @@ const EmptyMembers = () => {
|
|
|
31
31
|
classes.root
|
|
32
32
|
)}
|
|
33
33
|
>
|
|
34
|
-
<
|
|
34
|
+
<EmptyMembersIllustration width={59} height={37} />
|
|
35
35
|
<Typography variant="body2" className="u-mt-half">
|
|
36
36
|
{t('MemberList.empty.title')}
|
|
37
37
|
</Typography>
|
|
@@ -5,17 +5,27 @@ import MemberAvatar from './MemberAvatar'
|
|
|
5
5
|
import MemberGroupAvatar from './MemberGroupAvatar'
|
|
6
6
|
import { memberPropType } from './propTypes'
|
|
7
7
|
|
|
8
|
-
const MemberOrGroupAvatar = ({ member, size }) => {
|
|
8
|
+
const MemberOrGroupAvatar = ({ member, size, className }) => {
|
|
9
9
|
const { avatarUrl, initials, color, isGroup } = member
|
|
10
10
|
|
|
11
|
-
if (isGroup)
|
|
11
|
+
if (isGroup) {
|
|
12
|
+
return <MemberGroupAvatar size={size} color={color} className={className} />
|
|
13
|
+
}
|
|
12
14
|
|
|
13
|
-
return
|
|
15
|
+
return (
|
|
16
|
+
<MemberAvatar
|
|
17
|
+
size={size}
|
|
18
|
+
initials={initials}
|
|
19
|
+
avatarUrl={avatarUrl}
|
|
20
|
+
className={className}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
MemberOrGroupAvatar.propTypes = {
|
|
17
26
|
member: memberPropType.isRequired,
|
|
18
|
-
size: PropTypes.string.isRequired
|
|
27
|
+
size: PropTypes.string.isRequired,
|
|
28
|
+
className: PropTypes.string
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
export default MemberOrGroupAvatar
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { COLORS };
|
|
2
2
|
export default ColorList;
|
|
3
3
|
import { COLORS } from "./helpers";
|
|
4
|
-
declare function ColorList({ size, selectedColor, customColorProps, onClick }: {
|
|
4
|
+
declare function ColorList({ size, selectedColor, getColorLabel, customColorProps, onClick }: {
|
|
5
5
|
size: any;
|
|
6
6
|
selectedColor: any;
|
|
7
|
+
getColorLabel: any;
|
|
7
8
|
customColorProps: any;
|
|
8
9
|
onClick: any;
|
|
9
10
|
}): JSX.Element;
|
|
@@ -11,9 +12,13 @@ declare namespace ColorList {
|
|
|
11
12
|
namespace propTypes {
|
|
12
13
|
const size: propTypes.Requireable<string>;
|
|
13
14
|
const selectedColor: propTypes.Requireable<string>;
|
|
15
|
+
const getColorLabel: propTypes.Requireable<(...args: any[]) => any>;
|
|
14
16
|
const customColorProps: propTypes.Requireable<propTypes.InferProps<{
|
|
15
17
|
enabled: propTypes.Requireable<boolean>;
|
|
16
18
|
onClick: propTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
'aria-label': propTypes.Requireable<string>;
|
|
20
|
+
'aria-pressed': propTypes.Requireable<boolean>;
|
|
21
|
+
'data-testid': propTypes.Requireable<string>;
|
|
17
22
|
}>>;
|
|
18
23
|
const onClick: propTypes.Requireable<(...args: any[]) => any>;
|
|
19
24
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["enabled"];
|
|
1
4
|
import { Icon, Check, Palette } from '@linagora/twake-icons';
|
|
2
5
|
import propTypes from 'prop-types';
|
|
3
6
|
import React from 'react';
|
|
@@ -16,9 +19,14 @@ var sizeToPx = {
|
|
|
16
19
|
var ColorList = function ColorList(_ref) {
|
|
17
20
|
var size = _ref.size,
|
|
18
21
|
selectedColor = _ref.selectedColor,
|
|
22
|
+
getColorLabel = _ref.getColorLabel,
|
|
19
23
|
customColorProps = _ref.customColorProps,
|
|
20
24
|
_onClick = _ref.onClick;
|
|
21
25
|
|
|
26
|
+
var _ref2 = customColorProps !== null && customColorProps !== void 0 ? customColorProps : {},
|
|
27
|
+
isCustomEnabled = _ref2.enabled,
|
|
28
|
+
customButtonProps = _objectWithoutProperties(_ref2, _excluded);
|
|
29
|
+
|
|
22
30
|
var _useBreakpoints = useBreakpoints(),
|
|
23
31
|
isMobile = _useBreakpoints.isMobile;
|
|
24
32
|
|
|
@@ -31,6 +39,8 @@ var ColorList = function ColorList(_ref) {
|
|
|
31
39
|
rowHeight: avatarSize,
|
|
32
40
|
gap: _size === 'medium' ? 16 : 5
|
|
33
41
|
}, COLORS.map(function (color) {
|
|
42
|
+
var _getColorLabel;
|
|
43
|
+
|
|
34
44
|
return /*#__PURE__*/React.createElement(ImageListItem, {
|
|
35
45
|
key: color,
|
|
36
46
|
className: "u-ta-center",
|
|
@@ -40,6 +50,8 @@ var ColorList = function ColorList(_ref) {
|
|
|
40
50
|
}, /*#__PURE__*/React.createElement(ButtonBase, {
|
|
41
51
|
className: "u-bdrs-circle",
|
|
42
52
|
component: "div",
|
|
53
|
+
"aria-label": (_getColorLabel = getColorLabel === null || getColorLabel === void 0 ? void 0 : getColorLabel(color)) !== null && _getColorLabel !== void 0 ? _getColorLabel : color,
|
|
54
|
+
"aria-pressed": (selectedColor === null || selectedColor === void 0 ? void 0 : selectedColor.toUpperCase()) === color,
|
|
43
55
|
onClick: function onClick() {
|
|
44
56
|
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(color);
|
|
45
57
|
}
|
|
@@ -50,12 +62,12 @@ var ColorList = function ColorList(_ref) {
|
|
|
50
62
|
icon: Check,
|
|
51
63
|
size: iconSize
|
|
52
64
|
}) : ' ')));
|
|
53
|
-
}),
|
|
65
|
+
}), isCustomEnabled && /*#__PURE__*/React.createElement(ImageListItem, {
|
|
54
66
|
className: "u-ta-center",
|
|
55
67
|
classes: {
|
|
56
68
|
item: 'u-ov-visible'
|
|
57
69
|
}
|
|
58
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({}, customButtonProps, {
|
|
59
71
|
className: "u-miw-auto u-mih-auto u-p-0 u-bdrs-circle",
|
|
60
72
|
variant: "ghost",
|
|
61
73
|
style: {
|
|
@@ -73,19 +85,22 @@ var ColorList = function ColorList(_ref) {
|
|
|
73
85
|
icon: Palette,
|
|
74
86
|
size: iconSize,
|
|
75
87
|
color: "#000"
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
return customColorProps === null || customColorProps === void 0 ? void 0 : customColorProps.onClick(ev);
|
|
79
|
-
}
|
|
80
|
-
})));
|
|
88
|
+
})
|
|
89
|
+
}))));
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
ColorList.propTypes = {
|
|
84
93
|
size: propTypes.oneOf(['small', 'medium']),
|
|
85
94
|
selectedColor: propTypes.string,
|
|
95
|
+
|
|
96
|
+
/** Accessible name of a color. Defaults to its hexadecimal code */
|
|
97
|
+
getColorLabel: propTypes.func,
|
|
86
98
|
customColorProps: propTypes.shape({
|
|
87
99
|
enabled: propTypes.bool,
|
|
88
|
-
onClick: propTypes.func
|
|
100
|
+
onClick: propTypes.func,
|
|
101
|
+
'aria-label': propTypes.string,
|
|
102
|
+
'aria-pressed': propTypes.bool,
|
|
103
|
+
'data-testid': propTypes.string
|
|
89
104
|
}),
|
|
90
105
|
onClick: propTypes.func
|
|
91
106
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export default EditBadge;
|
|
2
|
-
declare function EditBadge({ src, onUpload, onDelete, anchorOrigin, children, ...props }: {
|
|
2
|
+
declare function EditBadge({ src, onUpload, onDelete, anchorOrigin, componentsProps, children, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
src: any;
|
|
5
5
|
onUpload: any;
|
|
6
6
|
onDelete: any;
|
|
7
7
|
anchorOrigin: any;
|
|
8
|
+
componentsProps: any;
|
|
8
9
|
children: any;
|
|
9
10
|
}): JSX.Element;
|
|
10
11
|
declare namespace EditBadge {
|
|
@@ -18,6 +19,10 @@ declare namespace EditBadge {
|
|
|
18
19
|
const src: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
20
|
const onUpload: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
21
|
const onDelete: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
+
const componentsProps: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
|
+
/** Props spread to the badge button */
|
|
24
|
+
button: PropTypes.Requireable<object>;
|
|
25
|
+
}>>;
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
import PropTypes from "prop-types";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["src", "onUpload", "onDelete", "anchorOrigin", "children"];
|
|
4
|
+
var _excluded = ["src", "onUpload", "onDelete", "anchorOrigin", "componentsProps", "children"];
|
|
5
5
|
import { Icon, Pen } from '@linagora/twake-icons';
|
|
6
|
+
import cx from 'classnames';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import React, { useState, useRef } from 'react';
|
|
8
9
|
import EditMenu from "cozy-ui/transpiled/react/EditBadge/EditMenu";
|
|
@@ -11,10 +12,13 @@ import Badge from "cozy-ui/transpiled/react/Badge";
|
|
|
11
12
|
import Button from "cozy-ui/transpiled/react/Buttons";
|
|
12
13
|
|
|
13
14
|
var EditBadge = function EditBadge(_ref) {
|
|
15
|
+
var _componentsProps$butt;
|
|
16
|
+
|
|
14
17
|
var src = _ref.src,
|
|
15
18
|
onUpload = _ref.onUpload,
|
|
16
19
|
onDelete = _ref.onDelete,
|
|
17
20
|
anchorOrigin = _ref.anchorOrigin,
|
|
21
|
+
componentsProps = _ref.componentsProps,
|
|
18
22
|
children = _ref.children,
|
|
19
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
24
|
|
|
@@ -37,10 +41,10 @@ var EditBadge = function EditBadge(_ref) {
|
|
|
37
41
|
var menuAnchorRef = useRef(null);
|
|
38
42
|
return /*#__PURE__*/React.createElement(Badge, _extends({}, props, {
|
|
39
43
|
anchorOrigin: anchorOrigin,
|
|
40
|
-
badgeContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
44
|
+
badgeContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.button, {
|
|
41
45
|
ref: menuAnchorRef,
|
|
42
46
|
component: "div",
|
|
43
|
-
className:
|
|
47
|
+
className: cx('u-miw-auto u-w-2-half u-h-2-half u-bdrs-circle', componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$butt = componentsProps.button) === null || _componentsProps$butt === void 0 ? void 0 : _componentsProps$butt.className),
|
|
44
48
|
classes: {
|
|
45
49
|
label: 'u-flex u-w-auto'
|
|
46
50
|
},
|
|
@@ -56,7 +60,7 @@ var EditBadge = function EditBadge(_ref) {
|
|
|
56
60
|
return !v;
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
|
-
}), /*#__PURE__*/React.createElement(EditMenu, {
|
|
63
|
+
})), /*#__PURE__*/React.createElement(EditMenu, {
|
|
60
64
|
anchorRef: menuAnchorRef.current,
|
|
61
65
|
status: status,
|
|
62
66
|
showMenu: showMenu,
|
|
@@ -83,6 +87,10 @@ EditBadge.defaultProps = {
|
|
|
83
87
|
EditBadge.propTypes = {
|
|
84
88
|
src: PropTypes.func.isRequired,
|
|
85
89
|
onUpload: PropTypes.func.isRequired,
|
|
86
|
-
onDelete: PropTypes.func.isRequired
|
|
90
|
+
onDelete: PropTypes.func.isRequired,
|
|
91
|
+
componentsProps: PropTypes.shape({
|
|
92
|
+
/** Props spread to the badge button */
|
|
93
|
+
button: PropTypes.object
|
|
94
|
+
})
|
|
87
95
|
};
|
|
88
96
|
export default EditBadge;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/illus/empty-members-illustration.svg` to regenerate;
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function SvgEmptyMembersIllustration(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
7
|
+
viewBox: "0 0 59 37",
|
|
8
|
+
fill: "none"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M15.59 22.783c.182-.274.37-.544.57-.807l.408-.536-.478-.279a10.822 10.822 0 00-5.449-1.46C4.774 19.702 0 24.352 0 30.067v3.185c0 .59.494 1.069 1.101 1.069h11.907v-3.012c0-.347.015-.714.048-1.154l.017-.212c.033-.384.081-.767.143-1.147l.01-.05a15.11 15.11 0 01.601-2.376l-.47-.155.498.072c.26-.749.576-1.477.947-2.177l.081-.153c.174-.32.36-.634.555-.941l.152-.232zm-4.949-5.728c3.103 0 5.628-2.458 5.628-5.479 0-3.02-2.525-5.478-5.628-5.478s-5.627 2.457-5.627 5.479c0 3.02 2.524 5.478 5.627 5.478m33.654 13.297c-.01-.149-.02-.297-.035-.446-.01-.099-.024-.197-.036-.296a12.178 12.178 0 00-.051-.394c-.016-.102-.035-.203-.052-.304a14.777 14.777 0 00-.07-.382c-.02-.098-.043-.196-.065-.294a13.065 13.065 0 00-.091-.385l-.074-.273c-.038-.135-.076-.27-.118-.403l-.078-.24a15.208 15.208 0 00-.15-.43c-.024-.068-.049-.134-.074-.2a12.983 12.983 0 00-.256-.619 14.777 14.777 0 00-.233-.503c-.018-.034-.034-.07-.051-.104-.09-.181-.185-.36-.284-.538l-.03-.057a14.061 14.061 0 00-.34-.571l-.005-.011c-2.577-4.123-7.236-6.882-12.545-6.882a14.807 14.807 0 00-11.29 5.174l-.06.07a14.64 14.64 0 00-.752.977c-.034.049-.069.097-.102.146-.087.129-.173.258-.257.39-.041.065-.084.13-.124.196-.069.111-.134.225-.2.337-.05.088-.102.174-.15.263-.046.083-.088.168-.133.252-.062.119-.125.236-.184.357l-.011.024a14.081 14.081 0 00-1.155 3.472l-.04.212a14.116 14.116 0 00-.103.7c-.016.123-.031.245-.043.369-.013.126-.02.252-.03.378-.007.096-.016.191-.02.287-.011.227-.018.455-.018.684v4.48c0 .668.564 1.212 1.256 1.212h26.835c.692 0 1.255-.544 1.255-1.213v-4.479c0-.236-.006-.471-.018-.704-.004-.084-.013-.168-.018-.252zm-14.98-16.418c3.948 0 7.16-3.126 7.16-6.967 0-3.841-3.212-6.967-7.16-6.967-3.95 0-7.16 3.126-7.16 6.967 0 3.841 3.211 6.967 7.16 6.967zm18.866 5.03c-2.088 0-4.115.593-5.86 1.715l-.462.296.35.42a15.717 15.717 0 011.999 3.07l.024.05c.1.205.197.412.29.625l.036.08c.088.205.171.412.265.657l.019.046c.176.472.33.952.459 1.44l.029.118c.05.193.096.388.138.584l.05.252a14.119 14.119 0 01.19 1.21c.011.096.023.19.032.286.016.165.028.33.038.496l.017.249c.012.249.02.498.02.75v2.274h11.907c.607 0 1.1-.48 1.1-1.07v-3.184c0-5.714-4.774-10.363-10.641-10.363m0-2.391c3.103 0 5.627-2.458 5.627-5.479 0-3.02-2.524-5.478-5.627-5.478-3.103 0-5.627 2.458-5.627 5.478 0 3.021 2.524 5.479 5.627 5.479z",
|
|
11
|
+
fill: "#DCEDFD"
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default SvgEmptyMembersIllustration;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Icon, Team } from '@linagora/twake-icons';
|
|
2
1
|
import cx from 'classnames';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { useI18n, useExtendI18n } from 'twake-i18n';
|
|
5
4
|
import { locales } from "cozy-ui/transpiled/react/MemberList/locales";
|
|
5
|
+
import EmptyMembersIllustration from "cozy-ui/transpiled/react/Icons/EmptyMembersIllustration";
|
|
6
6
|
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
7
7
|
import useBreakpoints from "cozy-ui/transpiled/react/providers/Breakpoints";
|
|
8
8
|
import { alpha, makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
@@ -26,10 +26,9 @@ var EmptyMembers = function EmptyMembers() {
|
|
|
26
26
|
var classes = useStyles();
|
|
27
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
28
|
className: cx('u-flex u-flex-column u-flex-items-center u-pv-2 u-ph-1 u-bdrs-6', isMobile ? 'u-mh-1' : 'u-mh-2', classes.root)
|
|
29
|
-
}, /*#__PURE__*/React.createElement(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
color: "var(--primaryColorLight)"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(EmptyMembersIllustration, {
|
|
30
|
+
width: 59,
|
|
31
|
+
height: 37
|
|
33
32
|
}), /*#__PURE__*/React.createElement(Typography, {
|
|
34
33
|
variant: "body2",
|
|
35
34
|
className: "u-mt-half"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export default MemberOrGroupAvatar;
|
|
2
|
-
declare function MemberOrGroupAvatar({ member, size }: {
|
|
2
|
+
declare function MemberOrGroupAvatar({ member, size, className }: {
|
|
3
3
|
member: any;
|
|
4
4
|
size: any;
|
|
5
|
+
className: any;
|
|
5
6
|
}): JSX.Element;
|
|
6
7
|
declare namespace MemberOrGroupAvatar {
|
|
7
8
|
namespace propTypes {
|
|
@@ -34,6 +35,7 @@ declare namespace MemberOrGroupAvatar {
|
|
|
34
35
|
data: PropTypes.Requireable<any>;
|
|
35
36
|
}>>;
|
|
36
37
|
const size: PropTypes.Validator<string>;
|
|
38
|
+
const className: PropTypes.Requireable<string>;
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
import PropTypes from "prop-types";
|
|
@@ -6,24 +6,32 @@ import { memberPropType } from "cozy-ui/transpiled/react/MemberRow/propTypes";
|
|
|
6
6
|
|
|
7
7
|
var MemberOrGroupAvatar = function MemberOrGroupAvatar(_ref) {
|
|
8
8
|
var member = _ref.member,
|
|
9
|
-
size = _ref.size
|
|
9
|
+
size = _ref.size,
|
|
10
|
+
className = _ref.className;
|
|
10
11
|
var avatarUrl = member.avatarUrl,
|
|
11
12
|
initials = member.initials,
|
|
12
13
|
color = member.color,
|
|
13
14
|
isGroup = member.isGroup;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
if (isGroup) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(MemberGroupAvatar, {
|
|
18
|
+
size: size,
|
|
19
|
+
color: color,
|
|
20
|
+
className: className
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
return /*#__PURE__*/React.createElement(MemberAvatar, {
|
|
19
25
|
size: size,
|
|
20
26
|
initials: initials,
|
|
21
|
-
avatarUrl: avatarUrl
|
|
27
|
+
avatarUrl: avatarUrl,
|
|
28
|
+
className: className
|
|
22
29
|
});
|
|
23
30
|
};
|
|
24
31
|
|
|
25
32
|
MemberOrGroupAvatar.propTypes = {
|
|
26
33
|
member: memberPropType.isRequired,
|
|
27
|
-
size: PropTypes.string.isRequired
|
|
34
|
+
size: PropTypes.string.isRequired,
|
|
35
|
+
className: PropTypes.string
|
|
28
36
|
};
|
|
29
37
|
export default MemberOrGroupAvatar;
|