@lumx/react 2.2.0 → 2.2.1-alpha.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/esm/_internal/Avatar2.js +5 -1
- package/esm/_internal/Avatar2.js.map +1 -1
- package/esm/_internal/Thumbnail2.js +2 -0
- package/esm/_internal/Thumbnail2.js.map +1 -1
- package/esm/_internal/Tooltip2.js +0 -5
- package/esm/_internal/Tooltip2.js.map +1 -1
- package/esm/_internal/UserBlock.js +41 -17
- package/esm/_internal/UserBlock.js.map +1 -1
- package/esm/_internal/user-block.js +2 -0
- package/esm/_internal/user-block.js.map +1 -1
- package/package.json +4 -4
- package/src/components/avatar/Avatar.stories.tsx +30 -53
- package/src/components/avatar/Avatar.tsx +8 -0
- package/src/components/avatar/__snapshots__/Avatar.test.tsx.snap +193 -330
- package/src/components/thumbnail/Thumbnail.stories.tsx +2 -7
- package/src/components/thumbnail/Thumbnail.test.tsx +1 -7
- package/src/components/thumbnail/Thumbnail.tsx +2 -0
- package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +4 -2
- package/src/components/tooltip/Tooltip.stories.tsx +7 -4
- package/src/components/tooltip/useInjectTooltipRef.tsx +1 -3
- package/src/components/user-block/UserBlock.stories.tsx +65 -105
- package/src/components/user-block/UserBlock.test.tsx +6 -0
- package/src/components/user-block/UserBlock.tsx +50 -25
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +113 -144
- package/src/stories/generated/Thumbnail/Demos.stories.tsx +1 -0
- package/src/stories/utils/CustomLink.tsx +7 -0
- package/types.d.ts +14 -4
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<UserBlock> Snapshots and structure should render story '
|
|
3
|
+
exports[`<UserBlock> Snapshots and structure should render story 'Clickable' 1`] = `
|
|
4
4
|
Array [
|
|
5
5
|
<div
|
|
6
|
-
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
7
|
-
onMouseEnter={[Function]}
|
|
8
|
-
onMouseLeave={[Function]}
|
|
6
|
+
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
9
7
|
>
|
|
10
|
-
<
|
|
8
|
+
<Avatar
|
|
9
|
+
alt="Avatar"
|
|
11
10
|
className="lumx-user-block__avatar"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
color="blue"
|
|
18
|
-
>
|
|
19
|
-
<Icon
|
|
20
|
-
icon="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"
|
|
21
|
-
/>
|
|
22
|
-
</Badge>
|
|
23
|
-
}
|
|
24
|
-
image="/demo-assets/avatar1.jpg"
|
|
25
|
-
onClick={[Function]}
|
|
26
|
-
size="m"
|
|
27
|
-
tabIndex={0}
|
|
28
|
-
theme="light"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
11
|
+
image="/demo-assets/avatar1.jpg"
|
|
12
|
+
onClick={[Function]}
|
|
13
|
+
size="m"
|
|
14
|
+
theme="light"
|
|
15
|
+
/>
|
|
31
16
|
<div
|
|
32
17
|
className="lumx-user-block__wrapper"
|
|
33
18
|
>
|
|
34
|
-
<
|
|
19
|
+
<Link
|
|
35
20
|
className="lumx-user-block__name"
|
|
36
|
-
|
|
37
|
-
tabIndex={0}
|
|
21
|
+
color="dark"
|
|
38
22
|
>
|
|
39
23
|
Emmitt O. Lum
|
|
40
|
-
</
|
|
24
|
+
</Link>
|
|
41
25
|
<div
|
|
42
26
|
className="lumx-user-block__fields"
|
|
43
27
|
>
|
|
@@ -57,41 +41,30 @@ Array [
|
|
|
57
41
|
</div>
|
|
58
42
|
</div>,
|
|
59
43
|
<div
|
|
60
|
-
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
61
|
-
onMouseEnter={[Function]}
|
|
62
|
-
onMouseLeave={[Function]}
|
|
44
|
+
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
63
45
|
>
|
|
64
|
-
<
|
|
46
|
+
<Avatar
|
|
47
|
+
alt="Avatar"
|
|
65
48
|
className="lumx-user-block__avatar"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<Badge
|
|
71
|
-
color="blue"
|
|
72
|
-
>
|
|
73
|
-
<Icon
|
|
74
|
-
icon="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"
|
|
75
|
-
/>
|
|
76
|
-
</Badge>
|
|
49
|
+
image="/demo-assets/avatar1.jpg"
|
|
50
|
+
linkProps={
|
|
51
|
+
Object {
|
|
52
|
+
"href": "https://example.com",
|
|
77
53
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
theme="light"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
54
|
+
}
|
|
55
|
+
size="m"
|
|
56
|
+
theme="light"
|
|
57
|
+
/>
|
|
85
58
|
<div
|
|
86
59
|
className="lumx-user-block__wrapper"
|
|
87
60
|
>
|
|
88
|
-
<
|
|
61
|
+
<Link
|
|
89
62
|
className="lumx-user-block__name"
|
|
90
|
-
|
|
91
|
-
|
|
63
|
+
color="dark"
|
|
64
|
+
href="https://example.com"
|
|
92
65
|
>
|
|
93
66
|
Emmitt O. Lum
|
|
94
|
-
</
|
|
67
|
+
</Link>
|
|
95
68
|
<div
|
|
96
69
|
className="lumx-user-block__fields"
|
|
97
70
|
>
|
|
@@ -111,41 +84,26 @@ Array [
|
|
|
111
84
|
</div>
|
|
112
85
|
</div>,
|
|
113
86
|
<div
|
|
114
|
-
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
115
|
-
onMouseEnter={[Function]}
|
|
116
|
-
onMouseLeave={[Function]}
|
|
87
|
+
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light lumx-user-block--is-clickable"
|
|
117
88
|
>
|
|
118
|
-
<
|
|
89
|
+
<Avatar
|
|
90
|
+
alt="Avatar"
|
|
119
91
|
className="lumx-user-block__avatar"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
color="blue"
|
|
126
|
-
>
|
|
127
|
-
<Icon
|
|
128
|
-
icon="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"
|
|
129
|
-
/>
|
|
130
|
-
</Badge>
|
|
131
|
-
}
|
|
132
|
-
image="/demo-assets/avatar3.jpg"
|
|
133
|
-
onClick={[Function]}
|
|
134
|
-
size="m"
|
|
135
|
-
tabIndex={0}
|
|
136
|
-
theme="light"
|
|
137
|
-
/>
|
|
138
|
-
</div>
|
|
92
|
+
image="/demo-assets/avatar1.jpg"
|
|
93
|
+
linkAs={[Function]}
|
|
94
|
+
size="m"
|
|
95
|
+
theme="light"
|
|
96
|
+
/>
|
|
139
97
|
<div
|
|
140
98
|
className="lumx-user-block__wrapper"
|
|
141
99
|
>
|
|
142
|
-
<
|
|
100
|
+
<Link
|
|
143
101
|
className="lumx-user-block__name"
|
|
144
|
-
|
|
145
|
-
|
|
102
|
+
color="dark"
|
|
103
|
+
linkAs={[Function]}
|
|
146
104
|
>
|
|
147
105
|
Emmitt O. Lum
|
|
148
|
-
</
|
|
106
|
+
</Link>
|
|
149
107
|
<div
|
|
150
108
|
className="lumx-user-block__fields"
|
|
151
109
|
>
|
|
@@ -167,6 +125,47 @@ Array [
|
|
|
167
125
|
]
|
|
168
126
|
`;
|
|
169
127
|
|
|
128
|
+
exports[`<UserBlock> Snapshots and structure should render story 'Default' 1`] = `
|
|
129
|
+
<div
|
|
130
|
+
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
131
|
+
onMouseEnter={[Function]}
|
|
132
|
+
onMouseLeave={[Function]}
|
|
133
|
+
>
|
|
134
|
+
<Avatar
|
|
135
|
+
alt="Avatar"
|
|
136
|
+
className="lumx-user-block__avatar"
|
|
137
|
+
image="/demo-assets/avatar1.jpg"
|
|
138
|
+
size="m"
|
|
139
|
+
theme="light"
|
|
140
|
+
/>
|
|
141
|
+
<div
|
|
142
|
+
className="lumx-user-block__wrapper"
|
|
143
|
+
>
|
|
144
|
+
<span
|
|
145
|
+
className="lumx-user-block__name"
|
|
146
|
+
>
|
|
147
|
+
Emmitt O. Lum
|
|
148
|
+
</span>
|
|
149
|
+
<div
|
|
150
|
+
className="lumx-user-block__fields"
|
|
151
|
+
>
|
|
152
|
+
<span
|
|
153
|
+
className="lumx-user-block__field"
|
|
154
|
+
key="0"
|
|
155
|
+
>
|
|
156
|
+
Creative developer
|
|
157
|
+
</span>
|
|
158
|
+
<span
|
|
159
|
+
className="lumx-user-block__field"
|
|
160
|
+
key="1"
|
|
161
|
+
>
|
|
162
|
+
Denpasar
|
|
163
|
+
</span>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
`;
|
|
168
|
+
|
|
170
169
|
exports[`<UserBlock> Snapshots and structure should render story 'Sizes' 1`] = `
|
|
171
170
|
Array [
|
|
172
171
|
<div
|
|
@@ -174,25 +173,18 @@ Array [
|
|
|
174
173
|
onMouseEnter={[Function]}
|
|
175
174
|
onMouseLeave={[Function]}
|
|
176
175
|
>
|
|
177
|
-
<
|
|
176
|
+
<Avatar
|
|
177
|
+
alt="Avatar"
|
|
178
178
|
className="lumx-user-block__avatar"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
onClick={[Function]}
|
|
184
|
-
size="s"
|
|
185
|
-
tabIndex={0}
|
|
186
|
-
theme="light"
|
|
187
|
-
/>
|
|
188
|
-
</div>
|
|
179
|
+
image="/demo-assets/avatar1.jpg"
|
|
180
|
+
size="s"
|
|
181
|
+
theme="light"
|
|
182
|
+
/>
|
|
189
183
|
<div
|
|
190
184
|
className="lumx-user-block__wrapper"
|
|
191
185
|
>
|
|
192
186
|
<span
|
|
193
187
|
className="lumx-user-block__name"
|
|
194
|
-
onClick={[Function]}
|
|
195
|
-
tabIndex={0}
|
|
196
188
|
>
|
|
197
189
|
Emmitt O. Lum
|
|
198
190
|
</span>
|
|
@@ -203,25 +195,18 @@ Array [
|
|
|
203
195
|
onMouseEnter={[Function]}
|
|
204
196
|
onMouseLeave={[Function]}
|
|
205
197
|
>
|
|
206
|
-
<
|
|
198
|
+
<Avatar
|
|
199
|
+
alt="Avatar"
|
|
207
200
|
className="lumx-user-block__avatar"
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
onClick={[Function]}
|
|
213
|
-
size="m"
|
|
214
|
-
tabIndex={0}
|
|
215
|
-
theme="light"
|
|
216
|
-
/>
|
|
217
|
-
</div>
|
|
201
|
+
image="/demo-assets/avatar1.jpg"
|
|
202
|
+
size="m"
|
|
203
|
+
theme="light"
|
|
204
|
+
/>
|
|
218
205
|
<div
|
|
219
206
|
className="lumx-user-block__wrapper"
|
|
220
207
|
>
|
|
221
208
|
<span
|
|
222
209
|
className="lumx-user-block__name"
|
|
223
|
-
onClick={[Function]}
|
|
224
|
-
tabIndex={0}
|
|
225
210
|
>
|
|
226
211
|
Emmitt O. Lum
|
|
227
212
|
</span>
|
|
@@ -248,25 +233,18 @@ Array [
|
|
|
248
233
|
onMouseEnter={[Function]}
|
|
249
234
|
onMouseLeave={[Function]}
|
|
250
235
|
>
|
|
251
|
-
<
|
|
236
|
+
<Avatar
|
|
237
|
+
alt="Avatar"
|
|
252
238
|
className="lumx-user-block__avatar"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
onClick={[Function]}
|
|
258
|
-
size="l"
|
|
259
|
-
tabIndex={0}
|
|
260
|
-
theme="light"
|
|
261
|
-
/>
|
|
262
|
-
</div>
|
|
239
|
+
image="/demo-assets/avatar1.jpg"
|
|
240
|
+
size="l"
|
|
241
|
+
theme="light"
|
|
242
|
+
/>
|
|
263
243
|
<div
|
|
264
244
|
className="lumx-user-block__wrapper"
|
|
265
245
|
>
|
|
266
246
|
<span
|
|
267
247
|
className="lumx-user-block__name"
|
|
268
|
-
onClick={[Function]}
|
|
269
|
-
tabIndex={0}
|
|
270
248
|
>
|
|
271
249
|
Emmitt O. Lum
|
|
272
250
|
</span>
|
|
@@ -294,37 +272,28 @@ Array [
|
|
|
294
272
|
exports[`<UserBlock> Snapshots and structure should render story 'WithBadge' 1`] = `
|
|
295
273
|
<div
|
|
296
274
|
className="lumx-user-block lumx-user-block--orientation-horizontal lumx-user-block--size-m lumx-user-block--theme-light"
|
|
297
|
-
onMouseEnter={[Function]}
|
|
298
|
-
onMouseLeave={[Function]}
|
|
299
275
|
>
|
|
300
|
-
<
|
|
276
|
+
<Avatar
|
|
277
|
+
alt="Avatar"
|
|
278
|
+
badge={
|
|
279
|
+
<Badge
|
|
280
|
+
color="blue"
|
|
281
|
+
>
|
|
282
|
+
<Icon
|
|
283
|
+
icon="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"
|
|
284
|
+
/>
|
|
285
|
+
</Badge>
|
|
286
|
+
}
|
|
301
287
|
className="lumx-user-block__avatar"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
<Badge
|
|
307
|
-
color="blue"
|
|
308
|
-
>
|
|
309
|
-
<Icon
|
|
310
|
-
icon="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"
|
|
311
|
-
/>
|
|
312
|
-
</Badge>
|
|
313
|
-
}
|
|
314
|
-
image="/demo-assets/avatar1.jpg"
|
|
315
|
-
onClick={[Function]}
|
|
316
|
-
size="m"
|
|
317
|
-
tabIndex={0}
|
|
318
|
-
theme="light"
|
|
319
|
-
/>
|
|
320
|
-
</div>
|
|
288
|
+
image="/demo-assets/avatar1.jpg"
|
|
289
|
+
size="m"
|
|
290
|
+
theme="light"
|
|
291
|
+
/>
|
|
321
292
|
<div
|
|
322
293
|
className="lumx-user-block__wrapper"
|
|
323
294
|
>
|
|
324
295
|
<span
|
|
325
296
|
className="lumx-user-block__name"
|
|
326
|
-
onClick={[Function]}
|
|
327
|
-
tabIndex={0}
|
|
328
297
|
>
|
|
329
298
|
Emmitt O. Lum
|
|
330
299
|
</span>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export default { title: 'LumX components/thumbnail/Thumbnail Demos' };
|
|
5
5
|
|
|
6
6
|
export { App as Combined } from './combined';
|
|
7
|
+
export { App as LoadingError } from './loading-error';
|
|
7
8
|
export { App as Ratios } from './ratios';
|
|
8
9
|
export { App as Sizes } from './sizes';
|
|
9
10
|
export { App as Variants } from './variants';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Example custom link that can be used in linkAs props.
|
|
6
|
+
*/
|
|
7
|
+
export const CustomLink: any = ({ ...props }) => <a href="#" data-custom-link {...props} />;
|
package/types.d.ts
CHANGED
|
@@ -430,6 +430,10 @@ export interface AvatarProps extends GenericProps {
|
|
|
430
430
|
badge?: ReactElement;
|
|
431
431
|
/** Image URL. */
|
|
432
432
|
image: string;
|
|
433
|
+
/** Props to pass to the link wrapping the thumbnail. */
|
|
434
|
+
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
435
|
+
/** Custom react component for the link (can be used to inject react router Link). */
|
|
436
|
+
linkAs?: "a" | any;
|
|
433
437
|
/** On click callback. */
|
|
434
438
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
435
439
|
/** On key press callback. */
|
|
@@ -2528,16 +2532,22 @@ export declare type UserBlockSize = Extract<Size, "s" | "m" | "l">;
|
|
|
2528
2532
|
export interface UserBlockProps extends GenericProps {
|
|
2529
2533
|
/** Props to pass to the avatar. */
|
|
2530
2534
|
avatarProps?: AvatarProps;
|
|
2531
|
-
/** Simple action toolbar content. */
|
|
2532
|
-
simpleAction?: ReactNode;
|
|
2533
|
-
/** Multiple action toolbar content. */
|
|
2534
|
-
multipleActions?: ReactNode;
|
|
2535
2535
|
/** Additional fields used to describe the user. */
|
|
2536
2536
|
fields?: string[];
|
|
2537
|
+
/** Props to pass to the link wrapping the avatar thumbnail. */
|
|
2538
|
+
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
2539
|
+
/** Custom react component for the link (can be used to inject react router Link). */
|
|
2540
|
+
linkAs?: "a" | any;
|
|
2541
|
+
/** Multiple action toolbar content. */
|
|
2542
|
+
multipleActions?: ReactNode;
|
|
2537
2543
|
/** User name. */
|
|
2538
2544
|
name?: string;
|
|
2545
|
+
/** Props to pass to the name block. */
|
|
2546
|
+
nameProps?: GenericProps;
|
|
2539
2547
|
/** Orientation. */
|
|
2540
2548
|
orientation?: Orientation;
|
|
2549
|
+
/** Simple action toolbar content. */
|
|
2550
|
+
simpleAction?: ReactNode;
|
|
2541
2551
|
/** Size variant. */
|
|
2542
2552
|
size?: UserBlockSize;
|
|
2543
2553
|
/** Theme adapting the component to light or dark background. */
|