@transferwise/components 0.0.0-experimental-04d15ef → 0.0.0-experimental-bfbd26d
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/build/listItem/AvatarView/ListItemAvatarView.js +2 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -1
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +2 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -1
- package/build/listItem/ListItem.js +7 -1
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +7 -1
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/ListItemContext.js.map +1 -1
- package/build/listItem/ListItemContext.mjs.map +1 -1
- package/build/listItem/useListItemMedia.js +21 -0
- package/build/listItem/useListItemMedia.js.map +1 -0
- package/build/listItem/useListItemMedia.mjs +19 -0
- package/build/listItem/useListItemMedia.mjs.map +1 -0
- package/build/main.css +27 -60
- package/build/styles/listItem/ListItem.css +27 -60
- package/build/styles/listItem/ListItem.grid.css +9 -9
- package/build/styles/main.css +27 -60
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemContext.d.ts +4 -0
- package/build/types/listItem/ListItemContext.d.ts.map +1 -1
- package/build/types/listItem/useListItemMedia.d.ts +6 -0
- package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +3 -0
- package/src/listItem/Button/ListItemButton.spec.tsx +2 -0
- package/src/listItem/ListItem.css +27 -60
- package/src/listItem/ListItem.grid.css +9 -9
- package/src/listItem/ListItem.grid.less +13 -13
- package/src/listItem/ListItem.less +25 -76
- package/src/listItem/ListItem.tsx +16 -2
- package/src/listItem/ListItemContext.tsx +5 -0
- package/src/listItem/_stories/ListItem.story.tsx +5 -5
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +5 -2
- package/src/listItem/useListItemMedia.tsx +13 -0
- package/src/main.css +27 -60
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
gap: 4px 16px;
|
|
6
6
|
gap: var(--size-4) var(--size-16);
|
|
7
7
|
}
|
|
8
|
-
@container (min-width:
|
|
8
|
+
@container (min-width: 375px) {
|
|
9
9
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
10
10
|
grid-template-columns: auto 1fr auto;
|
|
11
11
|
grid-template-rows: auto auto auto;
|
|
12
|
-
grid-template-areas: "media body control" "media info
|
|
12
|
+
grid-template-areas: "media body control" "media info ." ". prompt prompt";
|
|
13
13
|
}
|
|
14
14
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
15
15
|
grid-template-columns: auto 1fr auto;
|
|
16
16
|
grid-template-rows: auto auto;
|
|
17
|
-
grid-template-areas: "media body control" "media info
|
|
17
|
+
grid-template-areas: "media body control" "media info .";
|
|
18
18
|
}
|
|
19
19
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
20
20
|
grid-template-columns: auto 1fr auto;
|
|
21
21
|
grid-template-rows: auto auto;
|
|
22
|
-
grid-template-areas: "media body control" "
|
|
22
|
+
grid-template-areas: "media body control" ". prompt prompt";
|
|
23
23
|
}
|
|
24
24
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-noPrompt {
|
|
25
25
|
grid-template-columns: auto 1fr auto;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-hasPrompt {
|
|
30
30
|
grid-template-columns: auto 1fr;
|
|
31
31
|
grid-template-rows: auto auto;
|
|
32
|
-
grid-template-areas: "media body" "media info" "
|
|
32
|
+
grid-template-areas: "media body" "media info" ". prompt";
|
|
33
33
|
}
|
|
34
34
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-noPrompt {
|
|
35
35
|
grid-template-columns: auto 1fr;
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
53
53
|
grid-template-columns: 1fr auto;
|
|
54
54
|
grid-template-rows: auto auto auto;
|
|
55
|
-
grid-template-areas: "body control" "info
|
|
55
|
+
grid-template-areas: "body control" "info ." "prompt prompt";
|
|
56
56
|
}
|
|
57
57
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
58
58
|
grid-template-columns: 1fr auto;
|
|
59
59
|
grid-template-rows: auto auto;
|
|
60
|
-
grid-template-areas: "body control" "info
|
|
60
|
+
grid-template-areas: "body control" "info .";
|
|
61
61
|
}
|
|
62
62
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
63
63
|
grid-template-columns: 1fr auto;
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
grid-template-areas: "body";
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
@container (min-width:
|
|
96
|
+
@container (min-width: 297px) and (max-width: 375px) {
|
|
97
97
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl .wds-list-item-media {
|
|
98
98
|
margin-bottom: 12px;
|
|
99
99
|
margin-bottom: var(--size-12);
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
grid-template-areas: "body";
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
@container (max-width:
|
|
224
|
+
@container (max-width: 297px) {
|
|
225
225
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
226
226
|
grid-template-columns: auto 1fr;
|
|
227
227
|
grid-template-rows: auto auto auto;
|
|
@@ -368,8 +368,8 @@
|
|
|
368
368
|
background-color: #ffffff;
|
|
369
369
|
background-color: var(--color-background-screen);
|
|
370
370
|
position: relative;
|
|
371
|
-
padding: 12px
|
|
372
|
-
padding: var(--size-12)
|
|
371
|
+
padding: 12px;
|
|
372
|
+
padding: var(--size-12);
|
|
373
373
|
container-type: inline-size;
|
|
374
374
|
}
|
|
375
375
|
.wds-list-item + .wds-list-item-spotlight,
|
|
@@ -403,6 +403,12 @@
|
|
|
403
403
|
.wds-list-item-interactive .np-checkbox-button:has(input[type="checkbox"]:focus-visible) .tw-checkbox-button {
|
|
404
404
|
outline: none;
|
|
405
405
|
}
|
|
406
|
+
.wds-list-item-interactive:has(.wds-list-item-control:focus-visible),
|
|
407
|
+
.wds-list-item-interactive:has(input[type="checkbox"]:focus-visible) {
|
|
408
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
409
|
+
outline-offset: var(--ring-outline-offset);
|
|
410
|
+
outline-offset: -1px;
|
|
411
|
+
}
|
|
406
412
|
.wds-list-item-interactive .wds-list-item-additional-info {
|
|
407
413
|
--ring-outline-offset: 0;
|
|
408
414
|
}
|
|
@@ -421,59 +427,24 @@
|
|
|
421
427
|
position: absolute;
|
|
422
428
|
inset: 0;
|
|
423
429
|
}
|
|
424
|
-
.wds-list-item-interactive
|
|
425
|
-
.wds-list-item-interactive.wds-list-item-spotlight:has(input[type="checkbox"]:focus-visible) {
|
|
426
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
427
|
-
outline-offset: var(--ring-outline-offset);
|
|
428
|
-
outline-offset: -1px;
|
|
429
|
-
}
|
|
430
|
-
.wds-list-item-interactive.wds-list-item-spotlight:not(.disabled):not(:disabled):hover {
|
|
430
|
+
.wds-list-item-interactive:not(.disabled):not(:disabled):hover {
|
|
431
431
|
background-color: var(--color-background-screen-hover);
|
|
432
432
|
}
|
|
433
|
-
.wds-list-item-interactive.wds-list-item-spotlight:not(.disabled):not(:disabled):active {
|
|
434
|
-
background-color: var(--color-background-screen-active);
|
|
435
|
-
}
|
|
436
|
-
.wds-list-item-interactive.wds-list-item-spotlight:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button):hover {
|
|
437
|
-
background-color: transparent;
|
|
438
|
-
background-color: initial;
|
|
439
|
-
}
|
|
440
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):has(.wds-list-item-control:focus-visible):before,
|
|
441
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):has(input[type="checkbox"]:focus-visible):before {
|
|
442
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
443
|
-
outline-offset: var(--ring-outline-offset);
|
|
444
|
-
content: '';
|
|
445
|
-
position: absolute;
|
|
446
|
-
inset: 0 -8px;
|
|
447
|
-
border-radius: 16px;
|
|
448
|
-
border-radius: var(--radius-medium);
|
|
449
|
-
outline-offset: -1px;
|
|
450
|
-
}
|
|
451
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):not(.disabled):not(:disabled):hover:before,
|
|
452
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):not(.disabled):not(:disabled):active:before {
|
|
453
|
-
content: '';
|
|
454
|
-
position: absolute;
|
|
455
|
-
inset: 0 -8px;
|
|
456
|
-
border-radius: 16px;
|
|
457
|
-
border-radius: var(--radius-medium);
|
|
458
|
-
}
|
|
459
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):not(.disabled):not(:disabled):hover:before {
|
|
460
|
-
background-color: var(--color-background-screen-hover);
|
|
461
|
-
}
|
|
462
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):not(.disabled):not(:disabled):active:before {
|
|
463
|
-
background-color: var(--color-background-screen-active);
|
|
464
|
-
}
|
|
465
|
-
.wds-list-item-interactive:not(.wds-list-item-spotlight):has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button):hover:before {
|
|
466
|
-
background-color: transparent;
|
|
467
|
-
background-color: initial;
|
|
468
|
-
}
|
|
469
433
|
.wds-list-item-interactive:not(.disabled):not(:disabled):hover .wds-list-item-control-wrapper .wds-Button {
|
|
470
434
|
background-color: var(--Button-background-hover);
|
|
471
435
|
color: var(--Button-color-hover);
|
|
472
436
|
transition: none;
|
|
473
437
|
}
|
|
438
|
+
.wds-list-item-interactive:not(.disabled):not(:disabled):active {
|
|
439
|
+
background-color: var(--color-background-screen-active);
|
|
440
|
+
}
|
|
474
441
|
.wds-list-item-interactive .wds-list-item-button-control .wds-Button {
|
|
475
442
|
transition: none;
|
|
476
443
|
}
|
|
444
|
+
.wds-list-item-interactive:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button):hover {
|
|
445
|
+
background-color: transparent;
|
|
446
|
+
background-color: initial;
|
|
447
|
+
}
|
|
477
448
|
.wds-list-item-media {
|
|
478
449
|
grid-area: media;
|
|
479
450
|
}
|
|
@@ -510,6 +481,8 @@
|
|
|
510
481
|
}
|
|
511
482
|
.wds-list-item-control-wrapper {
|
|
512
483
|
grid-area: control;
|
|
484
|
+
align-content: center;
|
|
485
|
+
max-height: var(--wds-list-item-control-wrapper-height);
|
|
513
486
|
}
|
|
514
487
|
.wds-list-item-control {
|
|
515
488
|
flex: 0 0 auto;
|
|
@@ -525,12 +498,6 @@
|
|
|
525
498
|
color: #768e9c;
|
|
526
499
|
color: var(--color-content-tertiary);
|
|
527
500
|
}
|
|
528
|
-
.wds-list-item-spotlight {
|
|
529
|
-
padding-left: 12px;
|
|
530
|
-
padding-left: var(--size-12);
|
|
531
|
-
padding-right: 12px;
|
|
532
|
-
padding-right: var(--size-12);
|
|
533
|
-
}
|
|
534
501
|
.wds-list-item-spotlight-active {
|
|
535
502
|
background-color: rgba(134,167,189,0.10196);
|
|
536
503
|
background-color: var(--color-background-neutral);
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
gap: 4px 16px;
|
|
6
6
|
gap: var(--size-4) var(--size-16);
|
|
7
7
|
}
|
|
8
|
-
@container (min-width:
|
|
8
|
+
@container (min-width: 375px) {
|
|
9
9
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
10
10
|
grid-template-columns: auto 1fr auto;
|
|
11
11
|
grid-template-rows: auto auto auto;
|
|
12
|
-
grid-template-areas: "media body control" "media info
|
|
12
|
+
grid-template-areas: "media body control" "media info ." ". prompt prompt";
|
|
13
13
|
}
|
|
14
14
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
15
15
|
grid-template-columns: auto 1fr auto;
|
|
16
16
|
grid-template-rows: auto auto;
|
|
17
|
-
grid-template-areas: "media body control" "media info
|
|
17
|
+
grid-template-areas: "media body control" "media info .";
|
|
18
18
|
}
|
|
19
19
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
20
20
|
grid-template-columns: auto 1fr auto;
|
|
21
21
|
grid-template-rows: auto auto;
|
|
22
|
-
grid-template-areas: "media body control" "
|
|
22
|
+
grid-template-areas: "media body control" ". prompt prompt";
|
|
23
23
|
}
|
|
24
24
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-noPrompt {
|
|
25
25
|
grid-template-columns: auto 1fr auto;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-hasPrompt {
|
|
30
30
|
grid-template-columns: auto 1fr;
|
|
31
31
|
grid-template-rows: auto auto;
|
|
32
|
-
grid-template-areas: "media body" "media info" "
|
|
32
|
+
grid-template-areas: "media body" "media info" ". prompt";
|
|
33
33
|
}
|
|
34
34
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-noPrompt {
|
|
35
35
|
grid-template-columns: auto 1fr;
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
53
53
|
grid-template-columns: 1fr auto;
|
|
54
54
|
grid-template-rows: auto auto auto;
|
|
55
|
-
grid-template-areas: "body control" "info
|
|
55
|
+
grid-template-areas: "body control" "info ." "prompt prompt";
|
|
56
56
|
}
|
|
57
57
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
58
58
|
grid-template-columns: 1fr auto;
|
|
59
59
|
grid-template-rows: auto auto;
|
|
60
|
-
grid-template-areas: "body control" "info
|
|
60
|
+
grid-template-areas: "body control" "info .";
|
|
61
61
|
}
|
|
62
62
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
63
63
|
grid-template-columns: 1fr auto;
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
grid-template-areas: "body";
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
@container (min-width:
|
|
96
|
+
@container (min-width: 297px) and (max-width: 375px) {
|
|
97
97
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl .wds-list-item-media {
|
|
98
98
|
margin-bottom: 12px;
|
|
99
99
|
margin-bottom: var(--size-12);
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
grid-template-areas: "body";
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
@container (max-width:
|
|
224
|
+
@container (max-width: 297px) {
|
|
225
225
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
226
226
|
grid-template-columns: auto 1fr;
|
|
227
227
|
grid-template-rows: auto auto auto;
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
display: grid;
|
|
4
4
|
gap: var(--size-4) var(--size-16);
|
|
5
5
|
|
|
6
|
-
@container (min-width:
|
|
6
|
+
@container (min-width: 375px) {
|
|
7
7
|
&.wds-list-item-hasMedia-hasControl {
|
|
8
8
|
&.wds-list-item-hasInfo-hasPrompt {
|
|
9
9
|
grid-template-columns: auto 1fr auto;
|
|
10
10
|
grid-template-rows: auto auto auto;
|
|
11
11
|
grid-template-areas:
|
|
12
12
|
"media body control"
|
|
13
|
-
"media info
|
|
14
|
-
"
|
|
13
|
+
"media info ."
|
|
14
|
+
". prompt prompt";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&.wds-list-item-hasInfo-noPrompt {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
grid-template-rows: auto auto;
|
|
20
20
|
grid-template-areas:
|
|
21
21
|
"media body control"
|
|
22
|
-
"media info
|
|
22
|
+
"media info ."
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&.wds-list-item-noInfo-hasPrompt {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
grid-template-rows: auto auto;
|
|
28
28
|
grid-template-areas:
|
|
29
29
|
"media body control"
|
|
30
|
-
"
|
|
30
|
+
". prompt prompt";
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&.wds-list-item-noInfo-noPrompt {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
grid-template-areas:
|
|
46
46
|
"media body"
|
|
47
47
|
"media info"
|
|
48
|
-
"
|
|
48
|
+
". prompt";
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
&.wds-list-item-hasInfo-noPrompt {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
grid-template-rows: auto auto auto;
|
|
54
54
|
grid-template-areas:
|
|
55
55
|
"media body"
|
|
56
|
-
"media info"
|
|
56
|
+
"media info"
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
&.wds-list-item-noInfo-hasPrompt {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
grid-template-rows: auto auto auto;
|
|
83
83
|
grid-template-areas:
|
|
84
84
|
"body control"
|
|
85
|
-
"info
|
|
85
|
+
"info ."
|
|
86
86
|
"prompt prompt";
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
grid-template-rows: auto auto;
|
|
92
92
|
grid-template-areas:
|
|
93
93
|
"body control"
|
|
94
|
-
"info
|
|
94
|
+
"info ."
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
&.wds-list-item-noInfo-hasPrompt {
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
@container (min-width:
|
|
152
|
+
@container (min-width: 297px) and (max-width: 375px) {
|
|
153
153
|
&.wds-list-item-hasMedia-hasControl {
|
|
154
154
|
.wds-list-item-media {
|
|
155
155
|
margin-bottom: var(--size-12);
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
grid-template-rows: auto auto auto;
|
|
247
247
|
grid-template-areas:
|
|
248
248
|
"media media"
|
|
249
|
-
"body body"
|
|
249
|
+
"body body"
|
|
250
250
|
"info info";
|
|
251
251
|
}
|
|
252
252
|
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
@container (max-width:
|
|
381
|
+
@container (max-width: 297px) {
|
|
382
382
|
&.wds-list-item-hasMedia-hasControl {
|
|
383
383
|
&.wds-list-item-hasInfo-hasPrompt {
|
|
384
384
|
grid-template-columns: auto 1fr;
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
grid-template-rows: auto auto auto;
|
|
462
462
|
grid-template-areas:
|
|
463
463
|
"body"
|
|
464
|
-
"info"
|
|
464
|
+
"info"
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
&.wds-list-item-noInfo-hasPrompt {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
border-radius: var(--radius-medium);
|
|
8
8
|
background-color: var(--color-background-screen);
|
|
9
9
|
position: relative;
|
|
10
|
-
padding: var(--size-12)
|
|
10
|
+
padding: var(--size-12);
|
|
11
11
|
container-type: inline-size;
|
|
12
12
|
|
|
13
13
|
& + .wds-list-item-spotlight,
|
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
outline: none;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
&:has(.wds-list-item-control:focus-visible),
|
|
51
|
+
&:has(input[type="checkbox"]:focus-visible) {
|
|
52
|
+
.ring();
|
|
53
|
+
outline-offset: -1px;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
.wds-list-item-additional-info {
|
|
51
57
|
.ring-offset-0
|
|
52
58
|
}
|
|
@@ -70,88 +76,32 @@
|
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
&:not(.disabled, :disabled) {
|
|
83
|
-
&:hover {
|
|
84
|
-
background-color: var(--color-background-screen-hover);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:active {
|
|
88
|
-
background-color: var(--color-background-screen-active);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button) {
|
|
93
|
-
&:hover {
|
|
94
|
-
background-color: unset;
|
|
79
|
+
&:not(.disabled, :disabled):hover {
|
|
80
|
+
background-color: var(--color-background-screen-hover);
|
|
81
|
+
|
|
82
|
+
.wds-list-item-control-wrapper {
|
|
83
|
+
.wds-Button {
|
|
84
|
+
background-color: var(--Button-background-hover);
|
|
85
|
+
color: var(--Button-color-hover);
|
|
86
|
+
transition: none;
|
|
87
|
+
}
|
|
95
88
|
}
|
|
96
|
-
}
|
|
97
89
|
}
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
&:not(.wds-list-item-spotlight) {
|
|
102
|
-
&:has(.wds-list-item-control:focus-visible),
|
|
103
|
-
&:has(input[type="checkbox"]:focus-visible) {
|
|
104
|
-
&:before {
|
|
105
|
-
.ring();
|
|
106
|
-
content: '';
|
|
107
|
-
position: absolute;
|
|
108
|
-
inset: 0 -8px;
|
|
109
|
-
border-radius: var(--radius-medium);
|
|
110
|
-
outline-offset: -1px;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&:not(.disabled, :disabled) {
|
|
115
|
-
&:hover,
|
|
116
|
-
&:active {
|
|
117
|
-
&:before {
|
|
118
|
-
content: '';
|
|
119
|
-
position: absolute;
|
|
120
|
-
inset: 0 -8px;
|
|
121
|
-
border-radius: var(--radius-medium);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&:hover:before {
|
|
126
|
-
background-color: var(--color-background-screen-hover);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&:active:before {
|
|
130
|
-
background-color: var(--color-background-screen-active);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button) {
|
|
135
|
-
&:hover:before {
|
|
136
|
-
background-color: unset;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
91
|
+
&:not(.disabled, :disabled):active {
|
|
92
|
+
background-color: var(--color-background-screen-active);
|
|
139
93
|
}
|
|
140
94
|
|
|
141
|
-
|
|
142
|
-
.wds-list-item-control-wrapper {
|
|
95
|
+
.wds-list-item-button-control {
|
|
143
96
|
.wds-Button {
|
|
144
|
-
background-color: var(--Button-background-hover);
|
|
145
|
-
color: var(--Button-color-hover);
|
|
146
97
|
transition: none;
|
|
147
98
|
}
|
|
148
99
|
}
|
|
149
|
-
}
|
|
150
100
|
|
|
151
|
-
.wds-list-item-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
101
|
+
&:has(.wds-list-item-prompt:hover a, .wds-list-item-prompt:hover button) {
|
|
102
|
+
&:hover {
|
|
103
|
+
background-color: unset;
|
|
104
|
+
}
|
|
155
105
|
}
|
|
156
106
|
}
|
|
157
107
|
|
|
@@ -190,6 +140,8 @@
|
|
|
190
140
|
|
|
191
141
|
&-control-wrapper {
|
|
192
142
|
grid-area: control;
|
|
143
|
+
align-content: center;
|
|
144
|
+
max-height: var(--wds-list-item-control-wrapper-height)
|
|
193
145
|
}
|
|
194
146
|
|
|
195
147
|
&-control {
|
|
@@ -212,9 +164,6 @@
|
|
|
212
164
|
|
|
213
165
|
|
|
214
166
|
&-spotlight {
|
|
215
|
-
padding-left: var(--size-12);
|
|
216
|
-
padding-right: var(--size-12);
|
|
217
|
-
|
|
218
167
|
&-active {
|
|
219
168
|
background-color: var(--color-background-neutral);
|
|
220
169
|
&:not(.disabled, :disabled):hover {
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useId,
|
|
5
5
|
useMemo,
|
|
6
6
|
useState,
|
|
7
|
+
useEffect,
|
|
7
8
|
type PropsWithChildren,
|
|
8
9
|
type ReactNode,
|
|
9
10
|
} from 'react';
|
|
@@ -22,7 +23,11 @@ import { AvatarView } from './AvatarView';
|
|
|
22
23
|
import { Image } from './Image';
|
|
23
24
|
import { Prompt } from './Prompt';
|
|
24
25
|
import { PrimitiveAnchor } from '../primitives';
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
ListItemContext,
|
|
28
|
+
type ListItemContextData,
|
|
29
|
+
type ListItemMediaSize,
|
|
30
|
+
} from './ListItemContext';
|
|
26
31
|
|
|
27
32
|
export type ListItemTypes =
|
|
28
33
|
| 'non-interactive'
|
|
@@ -119,6 +124,8 @@ export const ListItem = ({
|
|
|
119
124
|
const idPrefix = useId();
|
|
120
125
|
const [controlProps, setControlProps] = useState<ListItemControlProps>({});
|
|
121
126
|
const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');
|
|
127
|
+
const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();
|
|
128
|
+
|
|
122
129
|
const ids: ListItemContextData['ids'] = {
|
|
123
130
|
title: `${idPrefix}_title`,
|
|
124
131
|
...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),
|
|
@@ -156,11 +163,13 @@ export const ListItem = ({
|
|
|
156
163
|
() => ({
|
|
157
164
|
setControlType,
|
|
158
165
|
setControlProps,
|
|
166
|
+
setMediaSize,
|
|
159
167
|
ids,
|
|
160
168
|
props: { disabled, inverted },
|
|
169
|
+
mediaSize,
|
|
161
170
|
describedByIds,
|
|
162
171
|
}),
|
|
163
|
-
[describedByIds],
|
|
172
|
+
[describedByIds, mediaSize],
|
|
164
173
|
);
|
|
165
174
|
const gridColumnsStyle = {
|
|
166
175
|
'--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
|
|
@@ -312,6 +321,11 @@ export const ListItem = ({
|
|
|
312
321
|
className={clsx('wds-list-item-control-wrapper', {
|
|
313
322
|
'wds-list-item-button-control': controlType === 'button',
|
|
314
323
|
})}
|
|
324
|
+
style={
|
|
325
|
+
{
|
|
326
|
+
'--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',
|
|
327
|
+
} as React.CSSProperties
|
|
328
|
+
}
|
|
315
329
|
>
|
|
316
330
|
{control}
|
|
317
331
|
</Body>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import type { ListItemTypes, ListItemControlProps, Props as ListItemProps } from './ListItem';
|
|
3
|
+
import type { ListItemAvatarViewProps } from './AvatarView';
|
|
4
|
+
|
|
5
|
+
export type ListItemMediaSize = 32 | 40 | 48 | 56 | 72;
|
|
3
6
|
|
|
4
7
|
export type ListItemContextData = {
|
|
5
8
|
setControlType: (type: ListItemTypes) => void;
|
|
6
9
|
setControlProps: (props: ListItemControlProps) => void;
|
|
10
|
+
setMediaSize: (size: ListItemMediaSize | undefined) => void;
|
|
7
11
|
ids: {
|
|
8
12
|
title: string;
|
|
9
13
|
subtitle?: string;
|
|
@@ -14,6 +18,7 @@ export type ListItemContextData = {
|
|
|
14
18
|
prompt?: string;
|
|
15
19
|
};
|
|
16
20
|
props: Pick<ListItemProps, 'disabled' | 'inverted'>;
|
|
21
|
+
mediaSize?: ListItemAvatarViewProps['size'];
|
|
17
22
|
describedByIds: string;
|
|
18
23
|
};
|
|
19
24
|
|
|
@@ -241,7 +241,7 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
241
241
|
const [props, previewProps] = getPropsForPreview(args);
|
|
242
242
|
|
|
243
243
|
return (
|
|
244
|
-
<ol
|
|
244
|
+
<ol className="list-unstyled">
|
|
245
245
|
<ListItem {...props} {...previewProps} />
|
|
246
246
|
</ol>
|
|
247
247
|
);
|
|
@@ -277,9 +277,9 @@ export const Responsiveness: Story = {
|
|
|
277
277
|
return (
|
|
278
278
|
<ol
|
|
279
279
|
className="list-unstyled"
|
|
280
|
-
style={{ display: 'grid', gridTemplateColumns: '
|
|
280
|
+
style={{ display: 'grid', gridTemplateColumns: '320px 360px 400px', gap: 16 }}
|
|
281
281
|
>
|
|
282
|
-
<div style={{ width: '
|
|
282
|
+
<div style={{ width: '320px' }}>
|
|
283
283
|
<ListItem
|
|
284
284
|
{...args}
|
|
285
285
|
subtitle={lorem10}
|
|
@@ -289,7 +289,7 @@ export const Responsiveness: Story = {
|
|
|
289
289
|
prompt={PROMPTS.interactive}
|
|
290
290
|
/>
|
|
291
291
|
</div>
|
|
292
|
-
<div style={{ width: '
|
|
292
|
+
<div style={{ width: '360px' }}>
|
|
293
293
|
<ListItem
|
|
294
294
|
{...args}
|
|
295
295
|
subtitle={lorem10}
|
|
@@ -299,7 +299,7 @@ export const Responsiveness: Story = {
|
|
|
299
299
|
prompt={PROMPTS.interactive}
|
|
300
300
|
/>
|
|
301
301
|
</div>
|
|
302
|
-
<div style={{ width: '
|
|
302
|
+
<div style={{ width: '400px' }}>
|
|
303
303
|
<ListItem
|
|
304
304
|
{...args}
|
|
305
305
|
subtitle={lorem10}
|
|
@@ -71,18 +71,21 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
71
71
|
const additionalInfo = isInteractive ? infoWithLink : infoWithoutLink;
|
|
72
72
|
const variants = [
|
|
73
73
|
{ title },
|
|
74
|
+
{ title, valueTitle },
|
|
74
75
|
{ title, subtitle },
|
|
76
|
+
{ title, valueTitle, valueSubtitle },
|
|
75
77
|
{ title, subtitle, inverted: true },
|
|
76
78
|
{ title, subtitle, valueTitle },
|
|
77
79
|
{ title, subtitle, valueTitle, inverted: true },
|
|
78
80
|
{ title, subtitle, valueTitle, valueSubtitle },
|
|
79
81
|
{ title, subtitle, valueTitle, valueSubtitle, inverted: true },
|
|
80
82
|
{ media, title },
|
|
83
|
+
{ media, title, valueTitle },
|
|
84
|
+
{ media, title, subtitle },
|
|
85
|
+
{ media, title, valueTitle, valueSubtitle },
|
|
81
86
|
{ media, title, subtitle },
|
|
82
87
|
{ media, title, subtitle, valueTitle },
|
|
83
88
|
{ media, title, subtitle, valueTitle, valueSubtitle },
|
|
84
|
-
{ media, title },
|
|
85
|
-
{ media, title, subtitle },
|
|
86
89
|
{ media, title, subtitle, additionalInfo: infoWithoutLink },
|
|
87
90
|
isInteractive ? { media, title, subtitle, additionalInfo: infoWithLink } : null,
|
|
88
91
|
{ media, title, subtitle, additionalInfo, valueTitle },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { ListItemContext, type ListItemContextData } from './ListItemContext';
|
|
3
|
+
import type { ListItemAvatarViewProps } from './AvatarView';
|
|
4
|
+
|
|
5
|
+
export function useListItemMedia(size?: ListItemAvatarViewProps['size']) {
|
|
6
|
+
const { setMediaSize, mediaSize } = useContext<ListItemContextData>(ListItemContext);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setMediaSize(size);
|
|
10
|
+
}, [size, setMediaSize]);
|
|
11
|
+
|
|
12
|
+
return { mediaSize, setMediaSize };
|
|
13
|
+
}
|