@innovaccer/design-system 2.7.0-1 → 2.8.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/.github/workflows/chromatic.yml +3 -1
- package/.github/workflows/main.yml +1 -1
- package/.github/workflows/manual.yml +1 -1
- package/.github/workflows/pull_request.yml +1 -1
- package/.github/workflows/test.yml +1 -1
- package/CHANGELOG.md +43 -1
- package/core/accessibility/utils/useAccessibilityProps.ts +30 -6
- package/core/components/atoms/_chip/__tests__/__snapshots__/_chip.test.tsx.snap +16 -8
- package/core/components/atoms/_chip/index.tsx +1 -1
- package/core/components/atoms/avatar/__tests__/__snapshots__/Avatar.test.tsx.snap +20 -0
- package/core/components/atoms/avatarGroup/AvatarCount.tsx +29 -0
- package/core/components/atoms/avatarGroup/AvatarGroup.tsx +17 -62
- package/core/components/atoms/avatarGroup/AvatarPopperBody.tsx +37 -0
- package/core/components/atoms/avatarGroup/Avatars.tsx +23 -0
- package/core/components/atoms/avatarGroup/__stories__/index.story.tsx +42 -1
- package/core/components/atoms/avatarGroup/__tests__/AvatarGroup.test.tsx +1 -1
- package/core/components/atoms/avatarGroup/__tests__/__snapshots__/AvatarGroup.test.tsx.snap +8 -4
- package/core/components/atoms/button/__tests__/__snapshots__/Button.test.tsx.snap +9 -0
- package/core/components/atoms/checkbox/__stories__/Group.story.tsx +1 -1
- package/core/components/atoms/checkbox/__stories__/Nested.story.tsx +2 -0
- package/core/components/atoms/checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +6 -0
- package/core/components/atoms/chip/__tests__/__snapshots__/Chip.test.tsx.snap +11 -11
- package/core/components/atoms/chipGroup/__tests__/__snapshots__/chipGroup.test.tsx.snap +8 -4
- package/core/components/atoms/dropdown/DropdownButton.tsx +1 -1
- package/core/components/atoms/dropdown/DropdownList.tsx +57 -29
- package/core/components/atoms/dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +58 -2
- package/core/components/atoms/input/__tests__/__snapshots__/Input.test.tsx.snap +5 -0
- package/core/components/atoms/message/__tests__/__snapshots__/Message.test.tsx.snap +4 -0
- package/core/components/atoms/metaList/__tests__/__snapshots__/MetaList.test.tsx.snap +296 -0
- package/core/components/atoms/metricInput/__tests__/__snapshots__/MetricInput.test.tsx.snap +2 -0
- package/core/components/atoms/multiSlider/Handle.tsx +1 -0
- package/core/components/atoms/popperWrapper/PopperWrapper.tsx +104 -12
- package/core/components/atoms/toast/__tests__/__snapshots__/Toast.test.tsx.snap +12 -0
- package/core/components/molecules/chipInput/__tests__/__snapshots__/ChipInput.test.tsx.snap +4 -4
- package/core/components/molecules/dialog/__tests__/__snapshots__/Dialog.test.tsx.snap +260 -182
- package/core/components/molecules/dropzone/Dropzone.tsx +16 -9
- package/core/components/molecules/dropzone/__stories__/index.story.tsx +15 -1
- package/core/components/molecules/dropzone/__tests__/__snapshots__/Dropzone.test.tsx.snap +68 -70
- package/core/components/molecules/editableChipInput/__tests__/__snapshots__/EditableChipInput.test.tsx.snap +4 -4
- package/core/components/molecules/editableDropdown/__tests__/__snapshots__/EditableDropdown.test.tsx.snap +2 -0
- package/core/components/molecules/fileList/__tests__/__snapshots__/FileList.test.tsx.snap +5 -0
- package/core/components/molecules/fileUploader/__tests__/__snapshots__/FileUploader.test.tsx.snap +6 -0
- package/core/components/molecules/fileUploader/__tests__/__snapshots__/FileUploaderList.test.tsx.snap +5 -0
- package/core/components/molecules/fullscreenModal/FullscreenModal.tsx +13 -12
- package/core/components/molecules/fullscreenModal/__tests__/Fullscreen.test.tsx +2 -5
- package/core/components/molecules/fullscreenModal/__tests__/__snapshots__/Fullscreen.test.tsx.snap +126 -90
- package/core/components/molecules/modal/Modal.tsx +11 -9
- package/core/components/molecules/modal/__tests__/__snapshots__/Modal.test.tsx.snap +258 -168
- package/core/components/molecules/overlayHeader/__tests__/__snapshots__/OverlayHeader.test.tsx.snap +1 -0
- package/core/components/molecules/pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +8 -0
- package/core/components/molecules/popover/Popover.tsx +9 -0
- package/core/components/molecules/popover/__tests__/__snapshots__/Popover.test.tsx.snap +16 -8
- package/core/components/molecules/sidesheet/Sidesheet.tsx +23 -22
- package/core/components/molecules/sidesheet/__tests__/__snapshots__/Sidesheet.test.tsx.snap +40 -28
- package/core/components/molecules/stepper/__tests__/__snapshots__/Stepper.test.tsx.snap +4 -0
- package/core/components/molecules/tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +2 -0
- package/core/components/molecules/tooltip/Tooltip.tsx +20 -1
- package/core/components/molecules/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +8 -0
- package/core/components/organisms/calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +106 -8
- package/core/components/organisms/datePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +48 -13
- package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +648 -30
- package/core/components/organisms/horizontalNav/__tests__/__snapshots__/HorizontalNav.test.tsx.snap +1 -0
- package/core/components/organisms/inlineMessage/__tests__/__snapshots__/InlineMessage.test.tsx.snap +4 -0
- package/core/components/organisms/navigation/__tests__/__snapshots__/Navigation.test.tsx.snap +2 -0
- package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +2 -2
- package/core/components/organisms/table/__tests__/__snapshots__/Table.test.tsx.snap +3344 -0
- package/core/components/organisms/verticalNav/__tests__/__snapshots__/VerticalNav.test.tsx.snap +14 -0
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +25 -2
- package/css/dist/index.css +264 -6
- package/css/dist/index.css.map +1 -1
- package/css/src/components/ProgressBar.css +1 -1
- package/css/src/components/button.css +1 -0
- package/css/src/components/chip.css +4 -0
- package/css/src/components/dropdown.css +5 -0
- package/css/src/components/dropdownButton.css +2 -0
- package/css/src/components/fullscreenModal.css +0 -5
- package/css/src/components/popover.css +12 -0
- package/css/src/components/slider.css +1 -0
- package/css/src/components/tooltip.css +115 -0
- package/css/src/core/animation.css +8 -0
- package/css/src/utils/utility.css +4 -0
- package/dist/core/accessibility/utils/useAccessibilityProps.d.ts +4 -3
- package/dist/core/components/atoms/avatarGroup/AvatarCount.d.ts +2 -0
- package/dist/core/components/atoms/avatarGroup/AvatarGroup.d.ts +2 -2
- package/dist/core/components/atoms/avatarGroup/AvatarPopperBody.d.ts +2 -0
- package/dist/core/components/atoms/avatarGroup/Avatars.d.ts +2 -0
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +61 -54
- package/dist/core/components/molecules/popover/Popover.d.ts +4 -0
- package/dist/core/components/molecules/sidesheet/Sidesheet.d.ts +1 -0
- package/dist/index.esm.js +285 -129
- package/dist/index.js +308 -155
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
|
|
2
|
-
## 2.
|
|
2
|
+
## 2.8.0-0 (2022-01-12)
|
|
3
|
+
### Highlights
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
NA
|
|
7
|
+
|
|
8
|
+
### Migration guide
|
|
9
|
+
NA
|
|
10
|
+
|
|
11
|
+
### Deprecations
|
|
12
|
+
NA
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
NA
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
* Fix chip inline alignment problem (253ba672)
|
|
19
|
+
* Fix progressbar background color (938be99b)
|
|
20
|
+
* Fix disabled slider knob shadow (aff1ddb6)
|
|
21
|
+
* Fix broken alignment due to inlineLabel in Dropdown (d7b51053)
|
|
22
|
+
* Resolve tooltip close issue on disabled button (cc0c693d)
|
|
23
|
+
|
|
24
|
+
### Improvements
|
|
25
|
+
* Add popover transitions (f1873f65)
|
|
26
|
+
* Add support for three characters in Avatar component (ba6bc35b)
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
NA
|
|
30
|
+
|
|
31
|
+
-------------------
|
|
32
|
+
|
|
33
|
+
## 2.7.0 (2021-12-23)
|
|
3
34
|
### Highlights
|
|
4
35
|
|
|
5
36
|
### Breaking changes
|
|
@@ -17,12 +48,20 @@ NA
|
|
|
17
48
|
|
|
18
49
|
### Features
|
|
19
50
|
* Option to use custom search placeholder in Dropdown search input (9fcb2b65)
|
|
51
|
+
* Adds keyboard interactions in Dropzone component. (8541a26d)
|
|
52
|
+
* Adds subinfo option when checkbox is true Dropdown (96a581a3)
|
|
53
|
+
* Adds transition to switch component (f8cbba79)
|
|
54
|
+
* Transition in sidesheet component added (8c61ef05)
|
|
20
55
|
|
|
21
56
|
### Fixes
|
|
22
57
|
* fix: updates docpage for stories without components exported (d5138109)
|
|
23
58
|
* fix(storybook): update package json file to fix storybook docs page (149f8ec8)
|
|
24
59
|
* fix(InputMask): fixes issue with fast input (4d1f8330)
|
|
25
60
|
* fix(switch): add styling for hover and active state (3a54a934)
|
|
61
|
+
* Button re-rendering issue is fixed, which was sometimes causing button to be clicked twice. (6b46d66f)
|
|
62
|
+
* FileList truncates long file names now. (0c2a07b6)
|
|
63
|
+
* Breadcrumbs separator color updated. (5b88f5c5)
|
|
64
|
+
* Fixed loader issue when Table has nested rows. (f41f7f96)
|
|
26
65
|
|
|
27
66
|
### Improvements
|
|
28
67
|
* Added transitions to fullscreenModal component (98cac857)
|
|
@@ -31,6 +70,9 @@ NA
|
|
|
31
70
|
### Documentation
|
|
32
71
|
* Example for custom header in sidesheet added (edc300cc)
|
|
33
72
|
* Input examples (stories) are interactive now (ead16746)
|
|
73
|
+
* add npm ci command to use package.lock freezed versions on CI environments on github actions (621d0934)
|
|
74
|
+
* updates versions of dev dependencies for security issues (3c3d5288)
|
|
75
|
+
* adds manual release workflow (e31559d3)
|
|
34
76
|
|
|
35
77
|
|
|
36
78
|
-------------------
|
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
type AriaRoleType = React.AriaRole;
|
|
4
|
+
type KeyboardEventKeyType = KeyboardEvent['key'];
|
|
3
5
|
|
|
4
6
|
interface IProps {
|
|
5
7
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
6
8
|
onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
7
|
-
role?:
|
|
9
|
+
role?: AriaRoleType;
|
|
8
10
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
const
|
|
13
|
+
const allowed: Record<string, Set<KeyboardEventKeyType>> = {
|
|
14
|
+
button: new Set(['Enter', 'Space', 'Spacebar', ' ']),
|
|
15
|
+
link: new Set(['Enter']),
|
|
16
|
+
// onChange handles everything, no need for extra keyboard interaction
|
|
17
|
+
checkbox: new Set([]),
|
|
18
|
+
radio: new Set([]),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Refer for keyboard interactions: https://webaim.org/techniques/keyboard/#testing
|
|
22
|
+
const isKeyboardInteractionAllowed = (role: AriaRoleType, key: KeyboardEventKeyType) => {
|
|
23
|
+
if (!allowed[role]) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const allowedKeys = allowed[role];
|
|
28
|
+
return allowedKeys.has(key);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const useAccessibilityProps = ({ onClick, onKeyDown, role = 'button', ...rest }: IProps) => {
|
|
12
32
|
return {
|
|
13
33
|
...(onClick
|
|
14
34
|
? {
|
|
15
35
|
onClick: onClick,
|
|
16
|
-
role: role
|
|
36
|
+
role: role,
|
|
17
37
|
tabIndex: 0,
|
|
18
38
|
'aria-label': rest['aria-label'],
|
|
19
39
|
onKeyDown: (e: React.SyntheticEvent<HTMLElement>) => {
|
|
@@ -21,8 +41,12 @@ const useAccessibilityProps = ({ onClick, onKeyDown, role, ...rest }: IProps) =>
|
|
|
21
41
|
onKeyDown(e as React.KeyboardEvent<HTMLElement>);
|
|
22
42
|
return;
|
|
23
43
|
}
|
|
24
|
-
|
|
25
|
-
|
|
44
|
+
const key = (e as React.KeyboardEvent<HTMLElement>).key;
|
|
45
|
+
if (isKeyboardInteractionAllowed(role, key)) {
|
|
46
|
+
if (onClick) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
onClick(e as React.MouseEvent<HTMLElement>);
|
|
49
|
+
}
|
|
26
50
|
}
|
|
27
51
|
},
|
|
28
52
|
}
|
|
@@ -6,12 +6,13 @@ exports[`Chip component
|
|
|
6
6
|
<body>
|
|
7
7
|
<div>
|
|
8
8
|
<div
|
|
9
|
-
class="undefined"
|
|
9
|
+
class="Chip-wrapper undefined"
|
|
10
10
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
11
11
|
>
|
|
12
12
|
<i
|
|
13
13
|
class="material-icons material-icons-round Icon Icon--default Chip-icon Chip-icon--left"
|
|
14
14
|
data-test="DesignSystem-GenericChip--Icon"
|
|
15
|
+
role="button"
|
|
15
16
|
style="font-size: 16px; width: 16px;"
|
|
16
17
|
>
|
|
17
18
|
events_round
|
|
@@ -33,12 +34,13 @@ exports[`Chip component
|
|
|
33
34
|
<body>
|
|
34
35
|
<div>
|
|
35
36
|
<div
|
|
36
|
-
class="undefined"
|
|
37
|
+
class="Chip-wrapper undefined"
|
|
37
38
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
38
39
|
>
|
|
39
40
|
<i
|
|
40
41
|
class="material-icons material-icons-round Icon Icon--info Chip-icon Chip-icon--left"
|
|
41
42
|
data-test="DesignSystem-GenericChip--Icon"
|
|
43
|
+
role="button"
|
|
42
44
|
style="font-size: 16px; width: 16px;"
|
|
43
45
|
>
|
|
44
46
|
events_round
|
|
@@ -60,12 +62,13 @@ exports[`Chip component
|
|
|
60
62
|
<body>
|
|
61
63
|
<div>
|
|
62
64
|
<div
|
|
63
|
-
class="undefined"
|
|
65
|
+
class="Chip-wrapper undefined"
|
|
64
66
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
65
67
|
>
|
|
66
68
|
<i
|
|
67
69
|
class="material-icons material-icons-round Icon Icon--disabled Chip-icon Chip-icon--left"
|
|
68
70
|
data-test="DesignSystem-GenericChip--Icon"
|
|
71
|
+
role="button"
|
|
69
72
|
style="font-size: 16px; width: 16px;"
|
|
70
73
|
>
|
|
71
74
|
events_round
|
|
@@ -87,12 +90,13 @@ exports[`Chip component
|
|
|
87
90
|
<body>
|
|
88
91
|
<div>
|
|
89
92
|
<div
|
|
90
|
-
class="undefined"
|
|
93
|
+
class="Chip-wrapper undefined"
|
|
91
94
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
92
95
|
>
|
|
93
96
|
<i
|
|
94
97
|
class="material-icons material-icons-round Icon Icon--info Chip-icon Chip-icon--left"
|
|
95
98
|
data-test="DesignSystem-GenericChip--Icon"
|
|
99
|
+
role="button"
|
|
96
100
|
style="font-size: 16px; width: 16px;"
|
|
97
101
|
>
|
|
98
102
|
events_round
|
|
@@ -114,12 +118,13 @@ exports[`Chip component
|
|
|
114
118
|
<body>
|
|
115
119
|
<div>
|
|
116
120
|
<div
|
|
117
|
-
class="undefined"
|
|
121
|
+
class="Chip-wrapper undefined"
|
|
118
122
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
119
123
|
>
|
|
120
124
|
<i
|
|
121
125
|
class="material-icons material-icons-round Icon Chip-icon Chip-icon--left"
|
|
122
126
|
data-test="DesignSystem-GenericChip--Icon"
|
|
127
|
+
role="button"
|
|
123
128
|
style="font-size: 16px; width: 16px;"
|
|
124
129
|
>
|
|
125
130
|
events_round
|
|
@@ -150,12 +155,13 @@ exports[`Chip component
|
|
|
150
155
|
<body>
|
|
151
156
|
<div>
|
|
152
157
|
<div
|
|
153
|
-
class="undefined"
|
|
158
|
+
class="Chip-wrapper undefined"
|
|
154
159
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
155
160
|
>
|
|
156
161
|
<i
|
|
157
162
|
class="material-icons material-icons-round Icon Icon--info Chip-icon Chip-icon--left"
|
|
158
163
|
data-test="DesignSystem-GenericChip--Icon"
|
|
164
|
+
role="button"
|
|
159
165
|
style="font-size: 16px; width: 16px;"
|
|
160
166
|
>
|
|
161
167
|
events_round
|
|
@@ -186,12 +192,13 @@ exports[`Chip component
|
|
|
186
192
|
<body>
|
|
187
193
|
<div>
|
|
188
194
|
<div
|
|
189
|
-
class="undefined"
|
|
195
|
+
class="Chip-wrapper undefined"
|
|
190
196
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
191
197
|
>
|
|
192
198
|
<i
|
|
193
199
|
class="material-icons material-icons-round Icon Icon--disabled Chip-icon Chip-icon--left"
|
|
194
200
|
data-test="DesignSystem-GenericChip--Icon"
|
|
201
|
+
role="button"
|
|
195
202
|
style="font-size: 16px; width: 16px;"
|
|
196
203
|
>
|
|
197
204
|
events_round
|
|
@@ -222,12 +229,13 @@ exports[`Chip component
|
|
|
222
229
|
<body>
|
|
223
230
|
<div>
|
|
224
231
|
<div
|
|
225
|
-
class="undefined"
|
|
232
|
+
class="Chip-wrapper undefined"
|
|
226
233
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
227
234
|
>
|
|
228
235
|
<i
|
|
229
236
|
class="material-icons material-icons-round Icon Icon--info Chip-icon Chip-icon--left"
|
|
230
237
|
data-test="DesignSystem-GenericChip--Icon"
|
|
238
|
+
role="button"
|
|
231
239
|
style="font-size: 16px; width: 16px;"
|
|
232
240
|
>
|
|
233
241
|
events_round
|
|
@@ -57,7 +57,7 @@ export const GenericChip = (props: GenericChipProps) => {
|
|
|
57
57
|
<div
|
|
58
58
|
data-test="DesignSystem-GenericChip--GenericChipWrapper"
|
|
59
59
|
{...baseProps}
|
|
60
|
-
className={
|
|
60
|
+
className={`Chip-wrapper ${className}`}
|
|
61
61
|
onClick={onClickHandler}
|
|
62
62
|
>
|
|
63
63
|
{icon && (
|
|
@@ -7,6 +7,7 @@ Object {
|
|
|
7
7
|
"asFragment": [Function],
|
|
8
8
|
"baseElement": <body>
|
|
9
9
|
<div>
|
|
10
|
+
<style />
|
|
10
11
|
<div
|
|
11
12
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
12
13
|
>
|
|
@@ -25,6 +26,7 @@ Object {
|
|
|
25
26
|
</div>
|
|
26
27
|
</body>,
|
|
27
28
|
"container": <div>
|
|
29
|
+
<style />
|
|
28
30
|
<div
|
|
29
31
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
30
32
|
>
|
|
@@ -102,6 +104,7 @@ Object {
|
|
|
102
104
|
"asFragment": [Function],
|
|
103
105
|
"baseElement": <body>
|
|
104
106
|
<div>
|
|
107
|
+
<style />
|
|
105
108
|
<div
|
|
106
109
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
107
110
|
>
|
|
@@ -120,6 +123,7 @@ Object {
|
|
|
120
123
|
</div>
|
|
121
124
|
</body>,
|
|
122
125
|
"container": <div>
|
|
126
|
+
<style />
|
|
123
127
|
<div
|
|
124
128
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
125
129
|
>
|
|
@@ -197,6 +201,7 @@ Object {
|
|
|
197
201
|
"asFragment": [Function],
|
|
198
202
|
"baseElement": <body>
|
|
199
203
|
<div>
|
|
204
|
+
<style />
|
|
200
205
|
<div
|
|
201
206
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
202
207
|
>
|
|
@@ -215,6 +220,7 @@ Object {
|
|
|
215
220
|
</div>
|
|
216
221
|
</body>,
|
|
217
222
|
"container": <div>
|
|
223
|
+
<style />
|
|
218
224
|
<div
|
|
219
225
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
220
226
|
>
|
|
@@ -292,6 +298,7 @@ Object {
|
|
|
292
298
|
"asFragment": [Function],
|
|
293
299
|
"baseElement": <body>
|
|
294
300
|
<div>
|
|
301
|
+
<style />
|
|
295
302
|
<div
|
|
296
303
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
297
304
|
>
|
|
@@ -310,6 +317,7 @@ Object {
|
|
|
310
317
|
</div>
|
|
311
318
|
</body>,
|
|
312
319
|
"container": <div>
|
|
320
|
+
<style />
|
|
313
321
|
<div
|
|
314
322
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
315
323
|
>
|
|
@@ -387,6 +395,7 @@ Object {
|
|
|
387
395
|
"asFragment": [Function],
|
|
388
396
|
"baseElement": <body>
|
|
389
397
|
<div>
|
|
398
|
+
<style />
|
|
390
399
|
<div
|
|
391
400
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
392
401
|
>
|
|
@@ -405,6 +414,7 @@ Object {
|
|
|
405
414
|
</div>
|
|
406
415
|
</body>,
|
|
407
416
|
"container": <div>
|
|
417
|
+
<style />
|
|
408
418
|
<div
|
|
409
419
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
410
420
|
>
|
|
@@ -482,6 +492,7 @@ Object {
|
|
|
482
492
|
"asFragment": [Function],
|
|
483
493
|
"baseElement": <body>
|
|
484
494
|
<div>
|
|
495
|
+
<style />
|
|
485
496
|
<div
|
|
486
497
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
487
498
|
>
|
|
@@ -500,6 +511,7 @@ Object {
|
|
|
500
511
|
</div>
|
|
501
512
|
</body>,
|
|
502
513
|
"container": <div>
|
|
514
|
+
<style />
|
|
503
515
|
<div
|
|
504
516
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
505
517
|
>
|
|
@@ -577,6 +589,7 @@ Object {
|
|
|
577
589
|
"asFragment": [Function],
|
|
578
590
|
"baseElement": <body>
|
|
579
591
|
<div>
|
|
592
|
+
<style />
|
|
580
593
|
<div
|
|
581
594
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
582
595
|
>
|
|
@@ -595,6 +608,7 @@ Object {
|
|
|
595
608
|
</div>
|
|
596
609
|
</body>,
|
|
597
610
|
"container": <div>
|
|
611
|
+
<style />
|
|
598
612
|
<div
|
|
599
613
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
600
614
|
>
|
|
@@ -672,6 +686,7 @@ Object {
|
|
|
672
686
|
"asFragment": [Function],
|
|
673
687
|
"baseElement": <body>
|
|
674
688
|
<div>
|
|
689
|
+
<style />
|
|
675
690
|
<div
|
|
676
691
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
677
692
|
>
|
|
@@ -690,6 +705,7 @@ Object {
|
|
|
690
705
|
</div>
|
|
691
706
|
</body>,
|
|
692
707
|
"container": <div>
|
|
708
|
+
<style />
|
|
693
709
|
<div
|
|
694
710
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
695
711
|
>
|
|
@@ -767,6 +783,7 @@ Object {
|
|
|
767
783
|
"asFragment": [Function],
|
|
768
784
|
"baseElement": <body>
|
|
769
785
|
<div>
|
|
786
|
+
<style />
|
|
770
787
|
<div
|
|
771
788
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
772
789
|
>
|
|
@@ -785,6 +802,7 @@ Object {
|
|
|
785
802
|
</div>
|
|
786
803
|
</body>,
|
|
787
804
|
"container": <div>
|
|
805
|
+
<style />
|
|
788
806
|
<div
|
|
789
807
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
790
808
|
>
|
|
@@ -862,6 +880,7 @@ Object {
|
|
|
862
880
|
"asFragment": [Function],
|
|
863
881
|
"baseElement": <body>
|
|
864
882
|
<div>
|
|
883
|
+
<style />
|
|
865
884
|
<div
|
|
866
885
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
867
886
|
>
|
|
@@ -880,6 +899,7 @@ Object {
|
|
|
880
899
|
</div>
|
|
881
900
|
</body>,
|
|
882
901
|
"container": <div>
|
|
902
|
+
<style />
|
|
883
903
|
<div
|
|
884
904
|
class="OutsideClick PopperWrapper-trigger flex-grow-0"
|
|
885
905
|
>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Text } from '@/index';
|
|
4
|
+
|
|
5
|
+
const AvatarCount = (props: any) => {
|
|
6
|
+
const { hiddenAvatarCount, avatarStyle } = props;
|
|
7
|
+
|
|
8
|
+
const ContentClass = classNames({
|
|
9
|
+
[`Avatar-content--secondary`]: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const AvatarVariantsClass = classNames({
|
|
13
|
+
Avatar: true,
|
|
14
|
+
[`Avatar--regular`]: true,
|
|
15
|
+
[`Avatar--secondary`]: true,
|
|
16
|
+
['Avatar--disabled']: true,
|
|
17
|
+
});
|
|
18
|
+
return (
|
|
19
|
+
<div data-test="DesignSystem-AvatarGroup--TriggerAvatar" style={avatarStyle}>
|
|
20
|
+
<span className={AvatarVariantsClass}>
|
|
21
|
+
<Text appearance={'white'} className={ContentClass}>
|
|
22
|
+
{`+${hiddenAvatarCount}`}
|
|
23
|
+
</Text>
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default AvatarCount;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { BaseProps, extractBaseProps } from '@/utils/types';
|
|
4
|
-
import {
|
|
4
|
+
import { Popover } from '@/index';
|
|
5
5
|
import { AvatarProps, PopoverProps } from '@/index.type';
|
|
6
|
+
import AvatarCount from './AvatarCount';
|
|
7
|
+
import Avatars from './Avatars';
|
|
8
|
+
import AvatarPopperBody from './AvatarPopperBody';
|
|
6
9
|
|
|
7
10
|
interface AvatarData extends Record<string, any> {
|
|
8
11
|
firstName?: string;
|
|
@@ -10,7 +13,7 @@ interface AvatarData extends Record<string, any> {
|
|
|
10
13
|
appearance?: AvatarProps['appearance'];
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
interface
|
|
16
|
+
interface AvatarPopoverProps {
|
|
14
17
|
popperRenderer?: (names: AvatarData[]) => JSX.Element;
|
|
15
18
|
appendToBody?: PopoverProps['appendToBody'];
|
|
16
19
|
dark?: PopoverProps['dark'];
|
|
@@ -46,7 +49,7 @@ export interface AvatarGroupProps extends BaseProps {
|
|
|
46
49
|
* **Popover for +x avatar**
|
|
47
50
|
*
|
|
48
51
|
* <pre className="DocPage-codeBlock">
|
|
49
|
-
*
|
|
52
|
+
* AvatarPopoverProps: {
|
|
50
53
|
* popperRenderer?: (names: AvatarData[]) => JSX.Element;
|
|
51
54
|
* appendToBody?: boolean;
|
|
52
55
|
* dark?: boolean;
|
|
@@ -68,7 +71,7 @@ export interface AvatarGroupProps extends BaseProps {
|
|
|
68
71
|
* </pre>
|
|
69
72
|
*
|
|
70
73
|
*/
|
|
71
|
-
popoverOptions:
|
|
74
|
+
popoverOptions: AvatarPopoverProps;
|
|
72
75
|
/**
|
|
73
76
|
* Position to place the tooltip on `Avatars` shown before +x
|
|
74
77
|
*/
|
|
@@ -90,7 +93,7 @@ export const AvatarGroup = (props: AvatarGroupProps) => {
|
|
|
90
93
|
|
|
91
94
|
const baseProps = extractBaseProps(props);
|
|
92
95
|
|
|
93
|
-
const
|
|
96
|
+
const hiddenAvatarCount = list.length > max ? Math.min(list.length - max, 99) : 0;
|
|
94
97
|
|
|
95
98
|
const style = {
|
|
96
99
|
borderRadius: '50%',
|
|
@@ -113,73 +116,25 @@ export const AvatarGroup = (props: AvatarGroupProps) => {
|
|
|
113
116
|
popperClassName
|
|
114
117
|
);
|
|
115
118
|
|
|
116
|
-
const trigger = (
|
|
117
|
-
<div data-test="DesignSystem-AvatarGroup--TriggerAvatar" style={style}>
|
|
118
|
-
<Avatar appearance="secondary" firstName="+" lastName={`${extraAvatars}`} withTooltip={false} />
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
const renderPopper = () => {
|
|
123
|
-
const extraAvatarsList = list.slice(max, list.length);
|
|
124
|
-
|
|
125
|
-
if (popperRenderer && typeof renderPopper === 'function') {
|
|
126
|
-
return popperRenderer(extraAvatarsList);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return (
|
|
130
|
-
<div className="py-6 pr-4 pl-6">
|
|
131
|
-
<div className="AvatarGroup-TextWrapper" style={{ maxHeight }}>
|
|
132
|
-
{extraAvatarsList.map((item, ind) => {
|
|
133
|
-
const { firstName = '', lastName = '' } = item;
|
|
134
|
-
const name = `${firstName} ${lastName}`;
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<Text
|
|
138
|
-
key={ind}
|
|
139
|
-
appearance={dark ? 'white' : 'default'}
|
|
140
|
-
className={ind < extraAvatars - 1 ? 'mb-5' : ''}
|
|
141
|
-
data-test="DesignSystem-AvatarGroup--Text"
|
|
142
|
-
>
|
|
143
|
-
{name}
|
|
144
|
-
</Text>
|
|
145
|
-
);
|
|
146
|
-
})}
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const renderAvatars = () => {
|
|
153
|
-
const avatars = list.slice(0, max).map((item, index) => {
|
|
154
|
-
const { appearance, firstName, lastName } = item;
|
|
155
|
-
return (
|
|
156
|
-
<div data-test="DesignSystem-AvatarGroup--Avatar" className="AvatarGroup-item" style={style} key={index}>
|
|
157
|
-
<Avatar
|
|
158
|
-
appearance={appearance}
|
|
159
|
-
firstName={firstName}
|
|
160
|
-
lastName={lastName}
|
|
161
|
-
withTooltip={true}
|
|
162
|
-
tooltipPosition={tooltipPosition}
|
|
163
|
-
/>
|
|
164
|
-
</div>
|
|
165
|
-
);
|
|
166
|
-
});
|
|
167
|
-
return avatars;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
119
|
return (
|
|
171
120
|
<div data-test="DesignSystem-AvatarGroup" {...baseProps} className={`${AvatarGroupClass} d-inline-flex`}>
|
|
172
|
-
{
|
|
121
|
+
<Avatars avatarList={list.slice(0, max)} avatarStyle={style} tooltipPosition={tooltipPosition} />
|
|
173
122
|
{list.length - max > 0 && (
|
|
174
123
|
<Popover
|
|
175
124
|
on={on}
|
|
176
125
|
dark={dark}
|
|
177
|
-
trigger={
|
|
126
|
+
trigger={<AvatarCount hiddenAvatarCount={hiddenAvatarCount} avatarStyle={style} />}
|
|
178
127
|
position={position}
|
|
179
128
|
appendToBody={appendToBody}
|
|
180
129
|
className={popperClass}
|
|
130
|
+
offset="medium"
|
|
181
131
|
>
|
|
182
|
-
|
|
132
|
+
<AvatarPopperBody
|
|
133
|
+
hiddenAvatarList={list.slice(max, list.length)}
|
|
134
|
+
popperRenderer={popperRenderer}
|
|
135
|
+
maxHeight={maxHeight}
|
|
136
|
+
dark={dark}
|
|
137
|
+
/>
|
|
183
138
|
</Popover>
|
|
184
139
|
)}
|
|
185
140
|
</div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Text } from '@/index';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
const AvatarPopperBody = (props: any) => {
|
|
6
|
+
const { hiddenAvatarList, popperRenderer, maxHeight, dark } = props;
|
|
7
|
+
|
|
8
|
+
if (popperRenderer) {
|
|
9
|
+
return popperRenderer(hiddenAvatarList);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className="py-6 pr-4 pl-6">
|
|
14
|
+
<div className="AvatarGroup-TextWrapper" style={{ maxHeight }}>
|
|
15
|
+
{hiddenAvatarList.map((item: any, ind: any) => {
|
|
16
|
+
const { firstName = '', lastName = '' } = item;
|
|
17
|
+
const name = `${firstName} ${lastName}`;
|
|
18
|
+
const AvatarTextClass = classNames({
|
|
19
|
+
[`mb-5`]: ind < hiddenAvatarList.length - 1,
|
|
20
|
+
});
|
|
21
|
+
return (
|
|
22
|
+
<Text
|
|
23
|
+
key={ind}
|
|
24
|
+
appearance={dark ? 'white' : 'default'}
|
|
25
|
+
className={AvatarTextClass}
|
|
26
|
+
data-test="DesignSystem-AvatarGroup--Text"
|
|
27
|
+
>
|
|
28
|
+
{name}
|
|
29
|
+
</Text>
|
|
30
|
+
);
|
|
31
|
+
})}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default AvatarPopperBody;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Avatar } from '@/index';
|
|
3
|
+
|
|
4
|
+
const Avatars = (props: any) => {
|
|
5
|
+
const { avatarList, avatarStyle, tooltipPosition } = props;
|
|
6
|
+
const avatars = avatarList.map((item: any, index: any) => {
|
|
7
|
+
const { appearance, firstName, lastName } = item;
|
|
8
|
+
return (
|
|
9
|
+
<div data-test="DesignSystem-AvatarGroup--Avatar" className="AvatarGroup-item" style={avatarStyle} key={index}>
|
|
10
|
+
<Avatar
|
|
11
|
+
appearance={appearance}
|
|
12
|
+
firstName={firstName}
|
|
13
|
+
lastName={lastName}
|
|
14
|
+
withTooltip={true}
|
|
15
|
+
tooltipPosition={tooltipPosition}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
return avatars;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default Avatars;
|